:root {
    --bg: #f4f6fb;
    --surface: #ffffff;
    --surface-2: #f8fafc;
    --surface-3: #f1f5f9;
    --border: #e5e8f0;
    --border-strong: #d5dae6;
    --text: #0f172a;
    --text-soft: #334155;
    --muted: #64748b;
    --primary: #4f46e5;
    --primary-dark: #4338ca;
    --primary-soft: #eef2ff;
    --success: #059669;
    --success-soft: #ecfdf5;
    --warning: #d97706;
    --warning-soft: #fffbeb;
    --danger: #dc2626;
    --danger-soft: #fef2f2;
    --sidebar: #0b1220;
    --sidebar-2: #111b2e;
    --radius-sm: 8px;
    --radius: 12px;
    --radius-lg: 18px;
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, .05);
    --shadow: 0 10px 30px -18px rgba(15, 23, 42, .25);
    --shadow-lg: 0 30px 60px -30px rgba(15, 23, 42, .35);
    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}

* {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    font-family: var(--font);
    font-size: 14px;
    line-height: 1.55;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, p {
    margin: 0;
}

a {
    color: var(--primary);
    text-decoration: none;
}

a:hover {
    color: var(--primary-dark);
}

img, svg {
    display: block;
}

ul {
    margin: 0;
    padding: 0;
    list-style: none;
}

.icon {
    width: 18px;
    height: 18px;
    flex: 0 0 auto;
}

.icon-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    padding: 0;
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    transition: background .15s ease, color .15s ease;
}

.icon-button:hover {
    background: var(--surface-3);
    color: var(--text);
}

.icon-button .icon {
    width: 19px;
    height: 19px;
}

/* ============================================================
   Estructura del panel
   ============================================================ */
.app-shell {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    position: sticky;
    top: 0;
    display: flex;
    flex-direction: column;
    width: 266px;
    height: 100vh;
    flex: 0 0 266px;
    background: var(--sidebar);
    color: #cbd5e1;
    z-index: 60;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 22px 20px 16px;
}

.brand-link {
    display: flex;
    align-items: center;
    gap: 12px;
    color: #fff;
    min-width: 0;
}

.brand-link:hover {
    color: #fff;
}

.brand-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    flex: 0 0 40px;
    border-radius: 12px;
    color: #fff;
    background: linear-gradient(135deg, #6366f1, #4338ca);
    box-shadow: 0 8px 18px -8px rgba(99, 102, 241, .9);
}

.brand-mark .icon {
    width: 22px;
    height: 22px;
}

.brand-mark-webmail {
    background: linear-gradient(135deg, #0ea5e9, #4f46e5);
    box-shadow: 0 8px 18px -8px rgba(14, 165, 233, .8);
}

.brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
    min-width: 0;
}

.brand-text strong {
    font-size: 15px;
    letter-spacing: -.01em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.brand-text small {
    color: #8fa0bb;
    font-size: 11.5px;
    margin-top: 2px;
}

.sidebar-close {
    display: none;
    background: transparent;
    border: 0;
    color: #94a3b8;
    cursor: pointer;
    padding: 6px;
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 10px 12px 20px;
}

.nav-section {
    padding: 18px 12px 7px;
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: #64748b;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 10px 12px;
    margin-bottom: 2px;
    border-radius: 10px;
    color: #b6c2d4;
    font-weight: 500;
    font-size: 13.5px;
    transition: background .15s ease, color .15s ease;
}

.nav-link:hover {
    background: rgba(255, 255, 255, .06);
    color: #fff;
}

.nav-link.is-active {
    background: linear-gradient(90deg, rgba(99, 102, 241, .22), rgba(99, 102, 241, .07));
    color: #fff;
    box-shadow: inset 2px 0 0 #818cf8;
}

.nav-link .nav-icon {
    width: 18px;
    height: 18px;
    color: #7f8ea6;
}

.nav-link.is-active .nav-icon {
    color: #a5b4fc;
}

.nav-count {
    margin-left: auto;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    background: rgba(99, 102, 241, .25);
    color: #c7d2fe;
    font-size: 11px;
    font-weight: 700;
}

.sidebar-footer {
    padding: 10px 12px 16px;
    border-top: 1px solid rgba(255, 255, 255, .07);
}

.sidebar-footer > .nav-link {
    margin-bottom: 8px;
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    border-radius: 12px;
    background: rgba(255, 255, 255, .04);
}

.sidebar-user-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
    flex: 1;
    line-height: 1.25;
}

.sidebar-user-info strong {
    color: #e2e8f0;
    font-size: 12.5px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user-info small {
    color: #7d8ca3;
    font-size: 11px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user .icon-button {
    color: #8fa0bb;
}

.sidebar-user .icon-button:hover {
    background: rgba(255, 255, 255, .08);
    color: #fff;
}

.main-panel {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 40;
    display: flex;
    align-items: center;
    gap: 16px;
    min-height: 64px;
    padding: 0 28px;
    background: rgba(255, 255, 255, .88);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
}

.topbar-context {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 13px;
    min-width: 0;
}

.topbar-section {
    color: var(--muted);
}

.topbar-separator {
    color: #cbd5e1;
}

.topbar-page {
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.topbar-actions {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 10px;
}

.mobile-menu {
    display: none;
}

.content {
    flex: 1;
    width: 100%;
    max-width: 1320px;
    margin: 0 auto;
    padding: 28px;
}

.app-footer {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 28px 22px;
    color: var(--muted);
    font-size: 11.5px;
}

/* ============================================================
   Cabecera de página
   ============================================================ */
.page-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 22px;
    flex-wrap: wrap;
}

.page-head h1 {
    font-size: 25px;
    font-weight: 700;
    letter-spacing: -.025em;
}

.page-head p {
    margin-top: 5px;
    color: var(--muted);
    font-size: 13.5px;
    max-width: 700px;
}

.page-actions {
    display: flex;
    align-items: center;
    gap: 9px;
    flex-wrap: wrap;
}

/* ============================================================
   Botones
   ============================================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    height: 40px;
    padding: 0 16px;
    border: 1px solid transparent;
    border-radius: 10px;
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    line-height: 1;
    white-space: nowrap;
    cursor: pointer;
    transition: background .15s ease, border-color .15s ease, color .15s ease, transform .1s ease, box-shadow .15s ease;
}

.btn:active {
    transform: translateY(1px);
}

.btn .icon {
    width: 16px;
    height: 16px;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 8px 16px -10px rgba(79, 70, 229, .8);
}

.btn-primary:hover {
    background: var(--primary-dark);
    color: #fff;
}

.btn-secondary {
    background: #fff;
    border-color: var(--border-strong);
    color: var(--text-soft);
    box-shadow: var(--shadow-sm);
}

.btn-secondary:hover {
    background: var(--surface-2);
    border-color: #c2c9d8;
    color: var(--text);
}

.btn-danger {
    background: var(--danger);
    color: #fff;
}

.btn-danger:hover {
    background: #b91c1c;
    color: #fff;
}

.btn-soft-danger {
    background: var(--danger-soft);
    border-color: #fecaca;
    color: var(--danger);
}

.btn-soft-danger:hover {
    background: #fee2e2;
    color: #b91c1c;
}

.btn-success {
    background: var(--success);
    color: #fff;
}

.btn-success:hover {
    background: #047857;
    color: #fff;
}

.btn-ghost {
    background: transparent;
    color: var(--muted);
}

.btn-ghost:hover {
    background: var(--surface-3);
    color: var(--text);
}

.btn-sm {
    height: 33px;
    padding: 0 12px;
    font-size: 12.5px;
    border-radius: 9px;
}

.btn-sm .icon {
    width: 14px;
    height: 14px;
}

.btn-block {
    width: 100%;
}

.btn[disabled] {
    opacity: .55;
    cursor: not-allowed;
}

.inline-form {
    display: inline-flex;
    margin: 0;
}

/* ============================================================
   Tarjetas, cuadrículas y estadísticas
   ============================================================ */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.card + .card {
    margin-top: 20px;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 17px 22px;
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
}

.card-header h2,
.card-header h3 {
    font-size: 15px;
    font-weight: 650;
    letter-spacing: -.01em;
}

.card-header p {
    color: var(--muted);
    font-size: 12.5px;
    margin-top: 2px;
}

.card-body {
    padding: 22px;
}

.card-body.is-flush {
    padding: 0;
}

.grid {
    display: grid;
    gap: 20px;
}

.grid-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.grid-4 {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.grid-main-side {
    grid-template-columns: minmax(0, 1.75fr) minmax(280px, .85fr);
    align-items: start;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 22px;
}

.stat-card {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 18px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

.stat-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    border-radius: 12px;
    background: var(--primary-soft);
    color: var(--primary);
}

.stat-icon .icon {
    width: 21px;
    height: 21px;
}

.stat-icon.green {
    background: var(--success-soft);
    color: var(--success);
}

.stat-icon.amber {
    background: var(--warning-soft);
    color: var(--warning);
}

.stat-icon.red {
    background: var(--danger-soft);
    color: var(--danger);
}

.stat-icon.sky {
    background: #f0f9ff;
    color: #0284c7;
}

.stat-info {
    min-width: 0;
}

.stat-value {
    font-size: 23px;
    font-weight: 700;
    letter-spacing: -.03em;
    line-height: 1.15;
}

.stat-value small {
    font-size: 12px;
    font-weight: 500;
    color: var(--muted);
    letter-spacing: 0;
}

.stat-label {
    margin-top: 2px;
    color: var(--muted);
    font-size: 12.5px;
}

.stat-meta {
    margin-top: 7px;
    font-size: 11.5px;
    color: var(--muted);
}

/* ============================================================
   Tablas
   ============================================================ */
.table-wrap {
    width: 100%;
    overflow-x: auto;
}

table.data {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

table.data th {
    padding: 11px 18px;
    text-align: left;
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--muted);
    background: var(--surface-2);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

table.data td {
    padding: 13px 18px;
    border-bottom: 1px solid #eef1f6;
    vertical-align: middle;
}

table.data tbody tr:last-child td {
    border-bottom: 0;
}

table.data tbody tr:hover {
    background: #fafbff;
}

table.data .num {
    text-align: right;
    white-space: nowrap;
}

table.data .actions {
    text-align: right;
    white-space: nowrap;
}

.table-actions {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    justify-content: flex-end;
}

.cell-main {
    display: flex;
    align-items: center;
    gap: 11px;
    min-width: 0;
}

.cell-main .cell-text {
    min-width: 0;
}

.cell-main strong {
    display: block;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cell-main small {
    display: block;
    color: var(--muted);
    font-size: 11.5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cell-title {
    font-weight: 600;
    color: var(--text);
}

.cell-sub {
    color: var(--muted);
    font-size: 11.5px;
}

/* ============================================================
   Avatares y badges
   ============================================================ */
.avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    flex: 0 0 38px;
    border-radius: 11px;
    background: linear-gradient(135deg, #e0e7ff, #c7d2fe);
    color: #3730a3;
    font-size: 12.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .02em;
}

.avatar-sm {
    width: 32px;
    height: 32px;
    flex-basis: 32px;
    border-radius: 9px;
    font-size: 11px;
}

.avatar-domain {
    background: linear-gradient(135deg, #e0f2fe, #bae6fd);
    color: #075985;
}

.avatar-lg {
    width: 52px;
    height: 52px;
    flex-basis: 52px;
    border-radius: 14px;
    font-size: 16px;
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 9px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 650;
    line-height: 1.5;
    white-space: nowrap;
}

.badge-success {
    background: var(--success-soft);
    color: #047857;
    border: 1px solid #a7f3d0;
}

.badge-warning {
    background: var(--warning-soft);
    color: #b45309;
    border: 1px solid #fde68a;
}

.badge-danger {
    background: var(--danger-soft);
    color: #b91c1c;
    border: 1px solid #fecaca;
}

.badge-muted {
    background: var(--surface-3);
    color: var(--muted);
    border: 1px solid var(--border);
}

.badge-info {
    background: var(--primary-soft);
    color: var(--primary-dark);
    border: 1px solid #c7d2fe;
}

/* ============================================================
   Formularios
   ============================================================ */
.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.field.full {
    grid-column: 1 / -1;
}

.field label {
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text-soft);
}

.field label .req {
    color: var(--danger);
    margin-left: 2px;
}

.field input,
.field select,
.field textarea,
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="search"],
input[type="month"],
input[type="date"],
select,
textarea {
    width: 100%;
    min-height: 41px;
    padding: 9px 12px;
    font-family: inherit;
    font-size: 13.5px;
    color: var(--text);
    background: #fff;
    border: 1px solid var(--border-strong);
    border-radius: 10px;
    outline: none;
    transition: border-color .15s ease, box-shadow .15s ease;
}

textarea {
    min-height: 104px;
    resize: vertical;
    line-height: 1.55;
}

select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%2364748b' stroke-width='1.8' stroke-linecap='round'%3E%3Cpath d='m4 6 4 4 4-4'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 11px center;
    padding-right: 34px;
}

.field input:focus,
.field select:focus,
.field textarea:focus,
input:focus,
select:focus,
textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, .13);
}

.field input.is-invalid,
.field select.is-invalid,
.field textarea.is-invalid {
    border-color: var(--danger);
}

.field .hint {
    color: var(--muted);
    font-size: 11.5px;
}

.field .error-text {
    color: var(--danger);
    font-size: 11.5px;
}

.field .input-group {
    display: flex;
    gap: 8px;
}

.input-suffix {
    display: flex;
    align-items: stretch;
}

.input-suffix input {
    border-radius: 10px 0 0 10px;
}

.input-suffix span {
    display: inline-flex;
    align-items: center;
    padding: 0 13px;
    border: 1px solid var(--border-strong);
    border-left: 0;
    border-radius: 0 10px 10px 0;
    background: var(--surface-2);
    color: var(--muted);
    font-size: 12.5px;
    white-space: nowrap;
}

.form-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    padding-top: 20px;
    margin-top: 22px;
    border-top: 1px solid var(--border);
    flex-wrap: wrap;
}

.form-actions .spacer {
    flex: 1;
}

.checkbox-field {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    font-size: 13px;
    color: var(--text-soft);
}

.checkbox-field input {
    width: 16px;
    height: 16px;
    min-height: 0;
    margin-top: 2px;
    accent-color: var(--primary);
}

.password-wrap {
    position: relative;
}

.password-wrap input {
    padding-right: 42px;
}

.password-toggle {
    position: absolute;
    top: 50%;
    right: 7px;
    transform: translateY(-50%);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border: 0;
    border-radius: 7px;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
}

.password-toggle:hover {
    background: var(--surface-3);
    color: var(--text);
}

.password-toggle .icon {
    width: 16px;
    height: 16px;
}

/* ============================================================
   Toolbar, filtros y búsqueda
   ============================================================ */
.toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    padding: 14px 18px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    margin-bottom: 18px;
}

.toolbar form {
    display: flex;
    align-items: center;
    gap: 9px;
    flex-wrap: wrap;
    flex: 1;
}

.search-box {
    position: relative;
    flex: 1;
    min-width: 200px;
    max-width: 340px;
}

.search-box .icon {
    position: absolute;
    top: 50%;
    left: 12px;
    width: 16px;
    height: 16px;
    transform: translateY(-50%);
    color: var(--muted);
    pointer-events: none;
}

.search-box input {
    padding-left: 36px;
    background: var(--surface-2);
}

.toolbar select {
    width: auto;
    min-width: 140px;
    background-color: var(--surface-2);
}

.toolbar .btn {
    height: 38px;
}

.toolbar-meta {
    color: var(--muted);
    font-size: 12px;
    white-space: nowrap;
}

/* ============================================================
   Alertas, estados vacíos
   ============================================================ */
.alert {
    display: flex;
    align-items: flex-start;
    gap: 11px;
    padding: 13px 15px;
    margin-bottom: 18px;
    border: 1px solid;
    border-radius: 12px;
    font-size: 13px;
    animation: alert-in .2s ease;
}

@keyframes alert-in {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: none; }
}

.alert-icon {
    width: 19px;
    height: 19px;
    flex: 0 0 19px;
    margin-top: 1px;
}

.alert-body {
    flex: 1;
    line-height: 1.5;
}

.alert-close {
    border: 0;
    background: transparent;
    color: currentColor;
    font-size: 20px;
    line-height: 1;
    opacity: .6;
    cursor: pointer;
    padding: 0 2px;
}

.alert-close:hover {
    opacity: 1;
}

.alert-success {
    color: #065f46;
    background: var(--success-soft);
    border-color: #a7f3d0;
}

.alert-error {
    color: #991b1b;
    background: var(--danger-soft);
    border-color: #fecaca;
}

.alert-warning {
    color: #92400e;
    background: var(--warning-soft);
    border-color: #fde68a;
}

.alert-info {
    color: #3730a3;
    background: var(--primary-soft);
    border-color: #c7d2fe;
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 52px 24px;
}

.empty-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 54px;
    height: 54px;
    border-radius: 16px;
    background: var(--surface-3);
    color: var(--muted);
    margin-bottom: 15px;
}

.empty-icon .icon {
    width: 25px;
    height: 25px;
}

.empty-state h3 {
    font-size: 15px;
    font-weight: 650;
    margin-bottom: 5px;
}

.empty-state p {
    color: var(--muted);
    font-size: 13px;
    max-width: 380px;
}

.empty-action {
    margin-top: 16px;
}

/* ============================================================
   Menú de usuario
   ============================================================ */
.user-menu {
    position: relative;
}

.user-button {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 4px 7px 4px 4px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 11px;
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-soft);
    cursor: pointer;
}

.user-button:hover {
    background: var(--surface-2);
    border-color: var(--border);
}

.user-button .chevron {
    width: 15px;
    height: 15px;
    color: var(--muted);
}

.dropdown-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    display: none;
    width: 236px;
    padding: 6px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 13px;
    box-shadow: var(--shadow-lg);
    z-index: 80;
}

.user-menu.open .dropdown-menu {
    display: block;
    animation: alert-in .15s ease;
}

.dropdown-head {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 3px;
    padding: 10px 11px 12px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 5px;
}

.dropdown-head strong {
    font-size: 13px;
}

.dropdown-head small {
    color: var(--muted);
    font-size: 11.5px;
    word-break: break-all;
}

.dropdown-head .badge {
    margin-top: 4px;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 9px 11px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--text-soft);
    font-family: inherit;
    font-size: 13px;
    font-weight: 500;
    text-align: left;
    cursor: pointer;
}

.dropdown-item:hover {
    background: var(--surface-3);
    color: var(--text);
}

.dropdown-item .icon {
    width: 16px;
    height: 16px;
    color: var(--muted);
}

.dropdown-item.is-danger {
    color: var(--danger);
}

.dropdown-item.is-danger .icon {
    color: var(--danger);
}

.dropdown-menu form {
    margin: 0;
    padding-top: 5px;
    border-top: 1px solid var(--border);
    margin-top: 5px;
}

/* ============================================================
   Listas de definición / detalles
   ============================================================ */
.detail-list {
    display: flex;
    flex-direction: column;
    gap: 13px;
}

.detail-list .detail-row {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    font-size: 13px;
}

.detail-list .detail-row span {
    color: var(--muted);
}

.detail-list .detail-row strong {
    font-weight: 600;
    text-align: right;
    word-break: break-word;
}

.info-box {
    padding: 14px 16px;
    border-radius: 12px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    font-size: 12.5px;
    color: var(--muted);
}

.info-box strong {
    color: var(--text-soft);
}

.info-box + .info-box {
    margin-top: 12px;
}

.code-field {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 8px 8px 12px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 9px;
    font-family: var(--mono);
    font-size: 12.5px;
    color: var(--text-soft);
    word-break: break-all;
}

.code-field span {
    flex: 1;
    min-width: 0;
}

.copy-button {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 8px;
    border: 1px solid var(--border-strong);
    border-radius: 7px;
    background: #fff;
    color: var(--muted);
    font-family: inherit;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
}

.copy-button:hover {
    color: var(--primary);
    border-color: #c7d2fe;
}

.copy-button.is-copied {
    color: var(--success);
    border-color: #a7f3d0;
    background: var(--success-soft);
}

.copy-button .icon {
    width: 13px;
    height: 13px;
}

.settings-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.settings-item {
    padding: 14px 16px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface-2);
}

.settings-item small {
    display: block;
    color: var(--muted);
    font-size: 11.5px;
    margin-bottom: 4px;
}

.settings-item strong {
    font-family: var(--mono);
    font-size: 12.5px;
    font-weight: 600;
    word-break: break-all;
}

/* ============================================================
   Gráfica simple
   ============================================================ */
.chart {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    height: 185px;
    padding-top: 8px;
}

.chart-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    flex: 1;
    height: 100%;
    justify-content: flex-end;
}

.chart-bar-track {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    width: 100%;
    height: 100%;
    border-radius: 8px;
    background: linear-gradient(180deg, #f8fafc, #f1f5f9);
    overflow: hidden;
}

.chart-bar {
    width: 100%;
    min-height: 4px;
    border-radius: 7px 7px 0 0;
    background: linear-gradient(180deg, #818cf8, #4f46e5);
    transition: height .4s ease;
}

.chart-col.is-current .chart-bar {
    background: linear-gradient(180deg, #34d399, #059669);
}

.chart-label {
    font-size: 10.5px;
    color: var(--muted);
    text-transform: capitalize;
    white-space: nowrap;
}

.chart-value {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-soft);
}

/* ============================================================
   Dominios y actividad
   ============================================================ */
.domain-card {
    display: flex;
    flex-direction: column;
    gap: 13px;
    padding: 18px;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: #fff;
    box-shadow: var(--shadow-sm);
}

.domain-card-head {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.domain-card-head .cell-text {
    flex: 1;
    min-width: 0;
}

.domain-card-head strong {
    display: block;
    font-size: 14.5px;
    font-weight: 650;
    letter-spacing: -.01em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.domain-card-head small {
    color: var(--muted);
    font-size: 11.5px;
}

.domain-card-meta {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
    font-size: 12px;
    color: var(--muted);
    flex-wrap: wrap;
}

.domain-card-meta strong {
    color: var(--text-soft);
}

.activity-list {
    display: flex;
    flex-direction: column;
}

.activity-item {
    display: flex;
    gap: 11px;
    padding: 12px 22px;
    border-bottom: 1px solid #eef1f6;
}

.activity-item:last-child {
    border-bottom: 0;
}

.activity-dot {
    width: 8px;
    height: 8px;
    flex: 0 0 8px;
    margin-top: 6px;
    border-radius: 50%;
    background: #a5b4fc;
    box-shadow: 0 0 0 3px #eef2ff;
}

.activity-body {
    min-width: 0;
}

.activity-body strong {
    display: block;
    font-size: 12.5px;
    font-weight: 600;
}

.activity-body small {
    display: block;
    color: var(--muted);
    font-size: 11.5px;
    margin-top: 1px;
}

/* ============================================================
   Factura / impresión
   ============================================================ */
.invoice-page {
    min-height: 100vh;
    padding: 30px 18px 60px;
    background: #eef1f7;
}

.invoice-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    width: min(860px, 100%);
    margin: 0 auto 18px;
    flex-wrap: wrap;
}

.invoice-toolbar-group {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.invoice-sheet {
    width: min(860px, 100%);
    margin: 0 auto;
    padding: 46px 48px;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 24px 55px -30px rgba(15, 23, 42, .35);
    color: #111827;
}

.invoice-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 30px;
    padding-bottom: 26px;
    border-bottom: 2px solid #111827;
}

.invoice-brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.invoice-brand .brand-mark {
    width: 46px;
    height: 46px;
    flex-basis: 46px;
    border-radius: 13px;
}

.invoice-brand strong {
    display: block;
    font-size: 16px;
    letter-spacing: -.01em;
}

.invoice-brand small {
    display: block;
    color: #6b7280;
    font-size: 12px;
    margin-top: 2px;
}

.invoice-title {
    text-align: right;
}

.invoice-title h1 {
    font-size: 28px;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: #111827;
}

.invoice-title .invoice-number {
    margin-top: 3px;
    font-family: var(--mono);
    font-size: 12.5px;
    color: #4b5563;
}

.invoice-status {
    display: inline-flex;
    margin-top: 9px;
    padding: 4px 12px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.invoice-status.paid {
    background: #d1fae5;
    color: #065f46;
}

.invoice-status.pending,
.invoice-status.overdue {
    background: #fef3c7;
    color: #92400e;
}

.invoice-status.overdue {
    background: #fee2e2;
    color: #991b1b;
}

.invoice-status.cancelled {
    background: #f1f5f9;
    color: #475569;
}

.invoice-parties {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    padding: 30px 0;
}

.invoice-parties h4 {
    margin-bottom: 8px;
    font-size: 10px;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: #6b7280;
}

.invoice-parties p {
    margin: 0;
    font-size: 13px;
    line-height: 1.6;
    color: #1f2937;
}

.invoice-parties .strong {
    font-weight: 650;
    color: #111827;
}

.invoice-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 6px;
}

.invoice-table th {
    padding: 10px 12px;
    text-align: left;
    font-size: 10px;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: #fff;
    background: #111827;
}

.invoice-table th:last-child,
.invoice-table td:last-child {
    text-align: right;
}

.invoice-table td {
    padding: 15px 12px;
    border-bottom: 1px solid #e5e7eb;
    font-size: 13px;
    vertical-align: top;
}

.invoice-table .description strong {
    display: block;
    font-weight: 650;
}

.invoice-table .description small {
    color: #6b7280;
    font-size: 11.5px;
}

.invoice-totals {
    display: flex;
    justify-content: flex-end;
    padding-top: 20px;
}

.invoice-totals-box {
    width: 280px;
}

.invoice-total-row {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    padding: 6px 0;
    font-size: 13px;
    color: #4b5563;
}

.invoice-total-row.grand {
    margin-top: 6px;
    padding-top: 12px;
    border-top: 2px solid #111827;
    font-size: 17px;
    font-weight: 700;
    color: #111827;
}

.invoice-notes {
    margin-top: 38px;
    padding-top: 20px;
    border-top: 1px solid #e5e7eb;
    color: #4b5563;
    font-size: 12px;
    line-height: 1.6;
}

.invoice-notes h4 {
    margin-bottom: 5px;
    font-size: 10px;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: #6b7280;
}

.invoice-footer {
    margin-top: 40px;
    padding-top: 16px;
    border-top: 1px solid #e5e7eb;
    display: flex;
    justify-content: space-between;
    gap: 20px;
    color: #9ca3af;
    font-size: 10.5px;
}

/* ============================================================
   Webmail
   ============================================================ */
.webmail-body {
    background: #eef1f7;
}

.mail-shell {
    display: flex;
    min-height: 100vh;
}

.mail-sidebar {
    position: sticky;
    top: 0;
    display: flex;
    flex-direction: column;
    width: 280px;
    flex: 0 0 280px;
    height: 100vh;
    padding: 18px 14px;
    background: var(--sidebar);
    color: #cbd5e1;
    z-index: 60;
}

.mail-brand {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 4px 6px 20px;
}

.mail-compose {
    margin: 0 4px 18px;
    width: calc(100% - 8px);
}

.mail-nav {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.mail-nav .nav-link {
    padding: 11px 12px;
    font-size: 13.5px;
}

.mail-quota {
    margin: auto 6px 16px;
    padding: 13px;
    border-radius: 12px;
    background: rgba(255, 255, 255, .04);
}

.mail-quota-head {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    font-size: 10.5px;
    color: #8fa0bb;
    margin-bottom: 8px;
}

.mail-quota-head strong {
    color: #cbd5e1;
    font-size: 10.5px;
    font-weight: 600;
    white-space: nowrap;
}

.progress {
    height: 6px;
    border-radius: 999px;
    background: rgba(255, 255, 255, .1);
    overflow: hidden;
}

.progress span {
    display: block;
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, #6366f1, #22d3ee);
}

.mail-sidebar-footer {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 11px 8px 2px;
    border-top: 1px solid rgba(255, 255, 255, .07);
}

.mail-main {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
}

.mail-topbar {
    position: sticky;
    top: 0;
    z-index: 40;
    display: flex;
    align-items: center;
    gap: 14px;
    min-height: 68px;
    padding: 0 28px;
    background: rgba(255, 255, 255, .93);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
}

.mail-topbar h1 {
    font-size: 17px;
    font-weight: 650;
    letter-spacing: -.015em;
}

.mail-topbar-actions {
    margin-left: auto;
}

.mail-content {
    flex: 1;
    width: 100%;
    max-width: 1120px;
    margin: 0 auto;
    padding: 24px 28px;
}

.mail-footer {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 28px 20px;
    color: var(--muted);
    font-size: 11px;
}

.message-list {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.message-row {
    display: flex;
    align-items: center;
    gap: 13px;
    padding: 13px 18px;
    border-bottom: 1px solid #eef1f6;
    color: var(--text);
    transition: background .12s ease;
}

.message-row:last-child {
    border-bottom: 0;
}

.message-row:hover {
    background: #fafbff;
    color: var(--text);
}

.message-row.is-unread {
    background: #fbfcff;
}

.message-row.is-unread .msg-subject {
    font-weight: 650;
}

.message-row .msg-body {
    flex: 1;
    min-width: 0;
}

.msg-subject {
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.msg-preview {
    margin-top: 1px;
    color: var(--muted);
    font-size: 11.5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.msg-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
    flex: 0 0 auto;
}

.msg-date {
    font-size: 10.5px;
    color: var(--muted);
    white-space: nowrap;
}

.msg-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--primary);
}

.msg-check {
    width: 16px;
    height: 16px;
    accent-color: var(--primary);
}

.mail-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.mail-toolbar h2 {
    font-size: 17px;
    font-weight: 650;
}

.mail-toolbar .toolbar-meta {
    font-size: 12px;
}

.message-view {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.message-view-head {
    padding: 22px 24px;
    border-bottom: 1px solid var(--border);
}

.message-view-head h2 {
    font-size: 19px;
    font-weight: 650;
    letter-spacing: -.02em;
}

.message-view-meta {
    display: flex;
    align-items: center;
    gap: 11px;
    margin-top: 13px;
}

.message-view-meta .meta-text {
    min-width: 0;
}

.message-view-meta strong {
    display: block;
    font-size: 13px;
    font-weight: 600;
}

.message-view-meta small {
    display: block;
    color: var(--muted);
    font-size: 11.5px;
    word-break: break-all;
}

.message-view-meta .msg-date {
    margin-left: auto;
}

.message-body {
    padding: 26px 24px;
    font-size: 13.5px;
    line-height: 1.7;
    color: var(--text-soft);
    white-space: pre-wrap;
    word-break: break-word;
}

.message-actions {
    display: flex;
    gap: 9px;
    padding: 16px 24px;
    border-top: 1px solid var(--border);
    background: var(--surface-2);
    flex-wrap: wrap;
}

.compose-card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.compose-card .form-grid {
    gap: 16px;
}

.compose-body textarea {
    min-height: 260px;
    font-size: 13.5px;
}

/* ============================================================
   Autenticación
   ============================================================ */
.auth-page {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 32px 18px;
    background:
        radial-gradient(900px 500px at 10% -10%, #e0e7ff 0, transparent 55%),
        radial-gradient(700px 500px at 100% 100%, #cffafe 0, transparent 50%),
        #f4f6fb;
}

.auth-shell {
    display: grid;
    grid-template-columns: 1.02fr .98fr;
    width: min(1000px, 100%);
    background: #fff;
    border: 1px solid rgba(255, 255, 255, .7);
    border-radius: 26px;
    box-shadow: 0 40px 90px -45px rgba(15, 23, 42, .45);
    overflow: hidden;
}

.auth-aside {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 36px;
    padding: 44px 44px 38px;
    background:
        radial-gradient(600px 380px at 80% 0%, rgba(99, 102, 241, .5), transparent 60%),
        radial-gradient(500px 400px at 0% 100%, rgba(14, 165, 233, .3), transparent 55%),
        #0b1220;
    color: #e2e8f0;
    overflow: hidden;
}

.auth-aside::after {
    content: "";
    position: absolute;
    right: -110px;
    bottom: -130px;
    width: 330px;
    height: 330px;
    border: 1px solid rgba(255, 255, 255, .08);
    border-radius: 50%;
    box-shadow: 0 0 0 50px rgba(255, 255, 255, .02), 0 0 0 100px rgba(255, 255, 255, .015);
    pointer-events: none;
}

.auth-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    color: #fff;
}

.auth-brand strong {
    font-size: 16px;
}

.auth-brand small {
    display: block;
    color: #93a4bd;
    font-size: 11.5px;
    margin-top: 1px;
}

.auth-copy h2 {
    font-size: 30px;
    line-height: 1.18;
    letter-spacing: -.035em;
    font-weight: 700;
    color: #fff;
    max-width: 340px;
}

.auth-copy p {
    margin-top: 13px;
    color: #9fb0c7;
    font-size: 13.5px;
    line-height: 1.65;
    max-width: 330px;
}

.auth-features {
    display: flex;
    flex-direction: column;
    gap: 13px;
    margin-top: 26px;
    position: relative;
    z-index: 1;
}

.auth-feature {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #c7d2e3;
    font-size: 12.5px;
}

.auth-feature .feature-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    flex: 0 0 30px;
    border-radius: 9px;
    background: rgba(255, 255, 255, .07);
    color: #a5b4fc;
}

.auth-feature .feature-icon .icon {
    width: 15px;
    height: 15px;
}

.auth-aside-footer {
    color: #7d8ea8;
    font-size: 11px;
    line-height: 1.6;
    position: relative;
    z-index: 1;
}

.auth-main {
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 48px 46px;
}

.auth-main-inner {
    width: 100%;
    max-width: 340px;
    margin: 0 auto;
}

.auth-head {
    margin-bottom: 26px;
}

.auth-head h1 {
    font-size: 24px;
    font-weight: 700;
    letter-spacing: -.03em;
}

.auth-head p {
    margin-top: 6px;
    color: var(--muted);
    font-size: 13px;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.auth-form .field label {
    font-size: 12px;
}

.auth-form .btn {
    height: 44px;
    font-size: 13.5px;
    margin-top: 4px;
}

.auth-options {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    font-size: 12px;
    color: var(--muted);
}

.auth-footer {
    margin-top: 26px;
    padding-top: 18px;
    border-top: 1px solid var(--border);
    text-align: center;
    font-size: 12px;
    color: var(--muted);
}

.auth-footer a {
    font-weight: 600;
}

.auth-demo {
    margin-top: 18px;
    padding: 12px 14px;
    border: 1px dashed #c7d2fe;
    border-radius: 10px;
    background: #f8faff;
    color: var(--muted);
    font-size: 11.5px;
    line-height: 1.6;
}

.auth-demo strong {
    color: var(--text-soft);
    font-weight: 600;
}

.auth-demo code {
    font-family: var(--mono);
    font-size: 11px;
    color: var(--primary-dark);
}

.auth-mobile-brand {
    display: none;
    align-items: center;
    gap: 10px;
    margin-bottom: 24px;
}

/* ============================================================
   Instalador
   ============================================================ */
.install-page {
    min-height: 100vh;
    padding: 36px 18px;
    background:
        radial-gradient(900px 500px at 10% -10%, #e0e7ff 0, transparent 55%),
        radial-gradient(700px 500px at 100% 100%, #cffafe 0, transparent 50%),
        #f4f6fb;
}

.install-shell {
    width: min(900px, 100%);
    margin: 0 auto;
}

.install-head {
    text-align: center;
    margin-bottom: 26px;
}

.install-brand {
    display: inline-flex;
    align-items: center;
    gap: 11px;
    margin-bottom: 18px;
}

.install-brand .brand-mark {
    width: 44px;
    height: 44px;
    flex-basis: 44px;
}

.install-brand strong {
    font-size: 18px;
    letter-spacing: -.02em;
}

.install-head h1 {
    font-size: 27px;
    letter-spacing: -.03em;
    font-weight: 700;
}

.install-head p {
    margin-top: 7px;
    color: var(--muted);
    font-size: 13.5px;
}

.install-steps {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 20px;
    font-size: 11.5px;
    color: var(--muted);
    flex-wrap: wrap;
}

.install-steps span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 11px;
    border-radius: 999px;
    background: #fff;
    border: 1px solid var(--border);
}

.install-body {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 280px;
    gap: 20px;
    align-items: start;
}

.install-section + .install-section {
    margin-top: 24px;
    padding-top: 22px;
    border-top: 1px solid var(--border);
}

.install-section h2 {
    font-size: 14px;
    font-weight: 650;
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.install-section h2 .step-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 7px;
    background: var(--primary-soft);
    color: var(--primary);
    font-size: 11px;
    font-weight: 700;
}

.install-side .info-box {
    margin-bottom: 12px;
}

.install-side h3 {
    font-size: 13px;
    margin-bottom: 8px;
}

.install-side p,
.install-side li {
    color: var(--muted);
    font-size: 12px;
    line-height: 1.6;
}

.install-side ul {
    display: flex;
    flex-direction: column;
    gap: 5px;
    padding-left: 2px;
}

.install-side li::before {
    content: "•";
    color: var(--primary);
    margin-right: 6px;
}

.install-requirements {
    display: grid;
    gap: 8px;
}

.requirement {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 9px 12px;
    border: 1px solid var(--border);
    border-radius: 9px;
    font-size: 12px;
    background: var(--surface-2);
}

.requirement .ok {
    color: var(--success);
    font-weight: 600;
}

.requirement .bad {
    color: var(--danger);
    font-weight: 600;
}

/* ============================================================
   Error
   ============================================================ */
.error-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 24px;
    background:
        radial-gradient(800px 450px at 50% -10%, #e0e7ff 0, transparent 60%),
        #f4f6fb;
}

.error-card {
    width: min(480px, 100%);
    padding: 42px;
    text-align: center;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 22px;
    box-shadow: 0 30px 70px -40px rgba(15, 23, 42, .4);
}

.error-code {
    font-size: 13px;
    font-weight: 700;
    letter-spacing: .14em;
    color: var(--primary);
    margin-bottom: 10px;
}

.error-card h1 {
    font-size: 23px;
    letter-spacing: -.03em;
    margin-bottom: 9px;
}

.error-card p {
    color: var(--muted);
    font-size: 13.5px;
    line-height: 1.65;
    margin-bottom: 22px;
}

/* ============================================================
   Utilidades
   ============================================================ */
.text-muted { color: var(--muted); }
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }
.text-right { text-align: right; }
.text-center { text-align: center; }
.nowrap { white-space: nowrap; }
.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.w-full { width: 100%; }
.flex { display: flex; }
.flex-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.flex-wrap { flex-wrap: wrap; }
.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }
.items-center { align-items: center; }
.small { font-size: 12px; }
.muted-box {
    padding: 14px 16px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface-2);
    color: var(--muted);
    font-size: 12.5px;
    line-height: 1.6;
}
.muted-box strong { color: var(--text-soft); }
.divider {
    height: 1px;
    background: var(--border);
    margin: 18px 0;
}
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}
.kbd {
    display: inline-block;
    padding: 1px 6px;
    border: 1px solid var(--border-strong);
    border-bottom-width: 2px;
    border-radius: 5px;
    background: #fff;
    font-family: var(--mono);
    font-size: 11px;
    color: var(--text-soft);
}
.sidebar-overlay {
    display: none;
}

@media (max-width: 1180px) {
    .stats-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .grid-main-side {
        grid-template-columns: minmax(0, 1fr);
    }
    .grid-4 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 980px) {
    .topbar-webmail {
        display: none;
    }
    .auth-shell {
        grid-template-columns: 1fr;
        max-width: 480px;
    }
    .auth-aside {
        display: none;
    }
    .auth-mobile-brand {
        display: flex;
    }
    .auth-main {
        padding: 38px 30px;
    }
    .install-body {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 900px) {
    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        transform: translateX(-100%);
        transition: transform .22s ease;
        box-shadow: 20px 0 50px -20px rgba(15, 23, 42, .5);
    }
    body.sidebar-open .sidebar {
        transform: none;
    }
    .sidebar-overlay {
        display: none;
        position: fixed;
        inset: 0;
        z-index: 55;
        background: rgba(15, 23, 42, .5);
        backdrop-filter: blur(2px);
    }
    body.sidebar-open .sidebar-overlay {
        display: block;
    }
    .sidebar-close,
    .mobile-menu {
        display: inline-flex;
    }
    .mail-sidebar {
        position: fixed;
        left: 0;
        top: 0;
        transform: translateX(-100%);
        transition: transform .22s ease;
    }
    body.sidebar-open .mail-sidebar {
        transform: none;
    }
    .content {
        padding: 22px 18px;
    }
    .topbar,
    .mail-topbar {
        padding: 0 18px;
    }
    .mail-content {
        padding: 20px 18px;
    }
    .app-footer,
    .mail-footer {
        padding-left: 18px;
        padding-right: 18px;
        flex-direction: column;
        gap: 3px;
    }
    .user-button-name {
        display: none;
    }
}

@media (max-width: 720px) {
    .form-grid,
    .grid-2,
    .grid-3,
    .grid-4,
    .settings-grid {
        grid-template-columns: 1fr;
    }
    .stats-grid {
        grid-template-columns: 1fr;
    }
    .page-head {
        align-items: flex-start;
        flex-direction: column;
    }
    .page-actions {
        width: 100%;
    }
    .page-actions .btn {
        flex: 1;
    }
    .toolbar {
        padding: 12px;
    }
    .toolbar form,
    .search-box {
        width: 100%;
        max-width: none;
    }
    .toolbar select {
        flex: 1;
    }
    .invoice-sheet {
        padding: 26px 20px;
    }
    .invoice-header,
    .invoice-parties {
        grid-template-columns: 1fr;
        flex-direction: column;
    }
    .invoice-title {
        text-align: left;
    }
    .invoice-parties {
        display: grid;
        gap: 20px;
    }
    .invoice-footer {
        flex-direction: column;
        gap: 4px;
    }
    .auth-main {
        padding: 30px 22px;
    }
    .auth-copy h2 {
        font-size: 26px;
    }
    .mail-topbar h1 {
        font-size: 15px;
    }
    .message-row {
        padding: 12px 14px;
        gap: 10px;
    }
    .msg-meta {
        display: none;
    }
    .message-view-head,
    .message-body,
    .message-actions {
        padding: 18px;
    }
    table.data th,
    table.data td {
        padding-left: 13px;
        padding-right: 13px;
    }
}

@media print {
    body.invoice-print {
        background: #fff;
    }
    .invoice-page {
        padding: 0;
        background: #fff;
    }
    .invoice-toolbar {
        display: none !important;
    }
    .invoice-sheet {
        width: 100%;
        max-width: none;
        margin: 0;
        padding: 20px;
        border-radius: 0;
        box-shadow: none;
    }
    .app-shell,
    .topbar,
    .sidebar {
        display: none !important;
    }
}

/* ============================================================
   Instalador
   ============================================================ */
.install-page {
    align-items: flex-start;
}

.install-shell {
    width: min(1020px, 100%);
    padding: 30px;
    background: #fff;
    border: 1px solid rgba(255, 255, 255, .7);
    border-radius: 26px;
    box-shadow: 0 40px 90px -45px rgba(15, 23, 42, .45);
}

.install-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border);
}

.install-head .auth-brand strong {
    font-size: 15px;
}

.install-head-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 12px;
    color: var(--muted);
}

.install-head-meta a {
    font-weight: 600;
}

.install-intro {
    padding: 24px 2px 4px;
}

.install-intro h1 {
    font-size: 26px;
    letter-spacing: -.03em;
    font-weight: 700;
}

.install-intro p {
    max-width: 720px;
    margin-top: 6px;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.65;
}

.install-shell .card {
    margin-top: 18px;
    box-shadow: none;
}

.install-checks .card-body {
    padding: 0;
}

.check-list {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.check-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 14px 18px;
    border-top: 1px solid var(--border-light, var(--border));
    border-right: 1px solid var(--border-light, var(--border));
}

.check-item:nth-child(3n) {
    border-right: none;
}

.check-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    flex: 0 0 22px;
    margin-top: 1px;
    border-radius: 50%;
}

.check-mark .icon {
    width: 13px;
    height: 13px;
}

.check-item.is-ok .check-mark {
    background: #dcfce7;
    color: #15803d;
}

.check-item.is-fail .check-mark {
    background: #fee2e2;
    color: #b91c1c;
}

.check-text {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
}

.check-text strong {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-soft);
}

.check-text small {
    color: var(--muted);
    font-size: 11px;
    line-height: 1.45;
}

.checkbox-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    cursor: pointer;
}

.checkbox-row input {
    width: 16px;
    height: 16px;
    margin-top: 2px;
    accent-color: var(--primary);
}

.checkbox-row span {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.checkbox-row strong {
    font-size: 13px;
    font-weight: 600;
}

.checkbox-row small {
    color: var(--muted);
    font-size: 12px;
    line-height: 1.5;
}

.install-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-top: 18px;
    padding: 18px 20px;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: #f8fafc;
}

.install-actions strong {
    display: block;
    font-size: 12.5px;
    margin-bottom: 2px;
}

.install-actions p {
    color: var(--muted);
    font-size: 12px;
    line-height: 1.5;
}

.install-actions .btn {
    flex: 0 0 auto;
}

.install-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 22px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
    color: var(--muted);
    font-size: 11px;
}

@media (max-width: 860px) {
    .install-shell {
        padding: 22px 18px;
    }
    .check-list {
        grid-template-columns: 1fr;
    }
    .check-item {
        border-right: none;
    }
    .install-head,
    .install-actions,
    .install-footer {
        flex-direction: column;
        align-items: flex-start;
    }
    .install-actions .btn {
        width: 100%;
    }
}
