/* =====================================================================
   XICO · Sistema Integral de Operaciones — Sistema de diseño
   Identidad oficial: azul #087CFA · violeta #6428F5 · azul marino #0D1B37
   Minimalista, legible y adaptable. Modo claro / oscuro con tokens.
   ===================================================================== */

:root {
    --primary: #087CFA;
    --violet: #6428F5;
    --navy: #0D1B37;
    --primary-hover: color-mix(in srgb, var(--primary) 86%, #000);
    --primary-soft: color-mix(in srgb, var(--primary) 11%, transparent);
    --primary-text: color-mix(in srgb, var(--primary) 82%, #000);
    --on-primary: #fff;

    --bg: #F5F7FB;
    --surface: #FFFFFF;
    --surface-2: #F1F4F9;
    --surface-3: #E7ECF4;
    --border: #E2E8F0;
    --border-strong: #CBD5E1;
    --text: #0D1B37;
    --text-2: #4A5A78;
    --text-3: #8592AB;
    --sidebar: #FFFFFF;

    --success: #12A150; --success-soft: #DCFCE7;
    --warning: #C2710C; --warning-soft: #FEF3C7;
    --danger:  #DC2626; --danger-soft:  #FEE2E2;
    --info:    #087CFA; --info-soft:    #E0EEFF;

    --shadow-sm: 0 1px 2px rgba(13, 27, 55, .05);
    --shadow: 0 1px 3px rgba(13, 27, 55, .07), 0 1px 2px rgba(13, 27, 55, .04);
    --shadow-lg: 0 12px 32px -8px rgba(13, 27, 55, .20), 0 4px 8px -4px rgba(13, 27, 55, .08);
    --ring: 0 0 0 3px color-mix(in srgb, var(--primary) 28%, transparent);

    --radius-sm: 6px;
    --radius: 10px;
    --radius-lg: 14px;
    --sidebar-w: 256px;
    --sidebar-w-collapsed: 68px;
    --topbar-h: 60px;
    --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    --ease: cubic-bezier(.2, .8, .2, 1);
    color-scheme: light;
}

:root[data-theme="dark"] {
    --primary-text: #5AA9FF;
    --primary-soft: color-mix(in srgb, var(--primary) 18%, transparent);
    --bg: #0A1426;
    --surface: #0F1C33;
    --surface-2: #14233D;
    --surface-3: #1B2C4A;
    --border: #1D2D4A;
    --border-strong: #2A3C5E;
    --text: #E7EDF7;
    --text-2: #9DAAC3;
    --text-3: #6B7A96;
    --sidebar: #0C172C;
    --success: #3FB950; --success-soft: rgba(63, 185, 80, .14);
    --warning: #E3A008; --warning-soft: rgba(227, 160, 8, .14);
    --danger:  #F85149; --danger-soft:  rgba(248, 81, 73, .14);
    --info:    #5AA9FF; --info-soft:    rgba(8, 124, 250, .16);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .35);
    --shadow: 0 1px 3px rgba(0, 0, 0, .45);
    --shadow-lg: 0 16px 40px -8px rgba(0, 0, 0, .6);
    color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
    :root[data-theme="system"] {
        --primary-text: #5AA9FF;
        --primary-soft: color-mix(in srgb, var(--primary) 18%, transparent);
        --bg: #0A1426;
        --surface: #0F1C33;
        --surface-2: #14233D;
        --surface-3: #1B2C4A;
        --border: #1D2D4A;
        --border-strong: #2A3C5E;
        --text: #E7EDF7;
        --text-2: #9DAAC3;
        --text-3: #6B7A96;
        --sidebar: #0C172C;
        --success: #3FB950; --success-soft: rgba(63, 185, 80, .14);
        --warning: #E3A008; --warning-soft: rgba(227, 160, 8, .14);
        --danger:  #F85149; --danger-soft:  rgba(248, 81, 73, .14);
        --info:    #5AA9FF; --info-soft:    rgba(8, 124, 250, .16);
        --shadow-sm: 0 1px 2px rgba(0, 0, 0, .35);
        --shadow: 0 1px 3px rgba(0, 0, 0, .45);
        --shadow-lg: 0 16px 40px -8px rgba(0, 0, 0, .6);
        color-scheme: dark;
    }
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
    margin: 0; background: var(--bg); color: var(--text);
    font: 14px/1.5 var(--font); font-feature-settings: "cv11", "ss01";
    -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
}
h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -.015em; line-height: 1.25; }
h1 { font-size: 24px; }
h2 { font-size: 18px; }
h3 { font-size: 14.5px; }
p { margin: 0; }
a { color: var(--primary-text); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }
code { font-family: var(--mono); font-size: .9em; background: var(--surface-2); padding: 1px 6px; border-radius: 5px; border: 1px solid var(--border); }
pre { font-family: var(--mono); font-size: 12px; white-space: pre-wrap; word-break: break-word; margin: 6px 0 0; padding: 10px; background: var(--surface-2); border-radius: var(--radius-sm); border: 1px solid var(--border); }
hr, .divider { border: 0; height: 1px; background: var(--border); margin: 16px 0; }
.icon { flex-shrink: 0; vertical-align: middle; }
[hidden], .hidden { display: none !important; }
::selection { background: var(--primary-soft); }
:focus-visible { outline: none; box-shadow: var(--ring); border-radius: 6px; }
.skip-link { position: absolute; left: -999px; top: 8px; z-index: 100; background: var(--surface); padding: 8px 12px; border-radius: 8px; }
.skip-link:focus { left: 8px; }

/* ---------- Utilidades ---------- */
.muted { color: var(--text-2); }
.small { font-size: 12.5px; }
.center { text-align: center; }
.t-right { text-align: right; }
.t-center { text-align: center; }
.nowrap { white-space: nowrap; }
.block { display: block; }
.mt { margin-top: 16px; }
.mb { margin-bottom: 16px; }
.grow { flex: 1; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.row-gap { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.text-success { color: var(--success) !important; }
.text-warning { color: var(--warning) !important; }
.text-danger { color: var(--danger) !important; }
.clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.link { color: var(--primary-text); font-weight: 500; }

/* ---------- Estructura ---------- */
.app { display: flex; min-height: 100vh; min-height: 100dvh; }
.sidebar {
    width: var(--sidebar-w); flex-shrink: 0; background: var(--sidebar); border-right: 1px solid var(--border);
    display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; height: 100dvh; z-index: 40;
    padding-top: env(safe-area-inset-top);
}
.sidebar-brand { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 18px 14px 12px 18px; min-height: 68px; }
.brand { display: flex; flex-direction: column; align-items: flex-start; gap: 5px; color: var(--text); min-width: 0; }
.brand:hover { text-decoration: none; }
.brand-org { color: var(--text-3); font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 180px; }

/* Logotipo oficial XICO: dos versiones; el tema decide cuál se ve (sin recargar). */
.logo { display: block; height: auto; max-width: 100%; user-select: none; -webkit-user-drag: none; }
.logo-dark { display: none; }
:root[data-theme="dark"] .logo-light { display: none; }
:root[data-theme="dark"] .logo-dark { display: block; }
@media (prefers-color-scheme: dark) {
    :root[data-theme="system"] .logo-light { display: none; }
    :root[data-theme="system"] .logo-dark { display: block; }
}
.brand-wordmark .logo { height: 26px; width: auto; }
.brand-symbol { display: none; width: 34px; height: auto; }
.brand-custom { max-height: 38px; width: auto; max-width: 180px; object-fit: contain; }
.sidebar-toggle { color: var(--text-3); }
.sidebar-toggle .icon { transition: transform .2s var(--ease); }
.sidebar { transition: width .2s var(--ease); }

/* Menú lateral contraído (escritorio): solo la X oficial e iconos */
@media (min-width: 1024px) {
    .sb-collapsed .sidebar { width: var(--sidebar-w-collapsed); }
    .sb-collapsed .brand-wordmark, .sb-collapsed .brand-org, .sb-collapsed .brand-custom,
    .sb-collapsed .nav-label, .sb-collapsed .nav-item span:not(.area-dot), .sb-collapsed .nav-badge,
    .sb-collapsed .user-card-text { display: none; }
    .sb-collapsed .brand-symbol { display: block; }
    .sb-collapsed .sidebar-brand { flex-direction: column; justify-content: center; padding: 16px 8px 8px; gap: 10px; }
    .sb-collapsed .brand { align-items: center; }
    .sb-collapsed .sidebar-toggle .icon { transform: rotate(180deg); }
    .sb-collapsed .sidebar-nav { padding: 4px 10px 16px; }
    .sb-collapsed .nav-group { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border); }
    .sb-collapsed .nav-group:first-child { border-top: 0; padding-top: 0; }
    .sb-collapsed .nav-item { justify-content: center; padding: 9px; }
    .sb-collapsed .nav-item .area-dot { margin: 4px; }
    .sb-collapsed .user-card { justify-content: center; padding: 6px; }
}
@media (max-width: 1023px) { .sidebar-toggle { display: none !important; } }
.topbar-brand { display: none; }
@media (max-width: 1023px) {
    .topbar-brand { display: flex; align-items: center; flex-shrink: 0; }
    .topbar-brand .logo { height: 22px; width: auto; }
    .topbar-brand .brand-custom { max-height: 28px; }
}

/* Pantalla de carga: únicamente la X oficial */
.splash { position: fixed; inset: 0; z-index: 200; display: none; flex-direction: column; align-items: center; justify-content: center; gap: 22px; background: var(--bg); transition: opacity .35s var(--ease), visibility .35s; }
.show-splash .splash { display: flex; animation: splash-out .4s ease 3s forwards; } /* respaldo si el JS no carga */
@keyframes splash-out { to { opacity: 0; visibility: hidden; } }
.splash.is-done { opacity: 0; visibility: hidden; pointer-events: none; }
.splash img { width: 88px; height: auto; animation: splash-in .6s var(--ease) both; }
.splash-bar { width: 88px; height: 3px; border-radius: 3px; background: var(--surface-3); overflow: hidden; }
.splash-bar i { display: block; width: 40%; height: 100%; border-radius: inherit; background: var(--primary); animation: splash-bar 1s ease-in-out infinite; }
@keyframes splash-in { from { opacity: 0; transform: scale(.94); } to { opacity: 1; transform: none; } }
@keyframes splash-bar { from { transform: translateX(-100%); } to { transform: translateX(250%); } }
.icon-btn.sidebar-close { display: none; }
.sidebar-nav { flex: 1; overflow-y: auto; padding: 6px 10px 16px; }
.nav-group { margin-top: 14px; }
.nav-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); padding: 0 10px 6px; }
.nav-item {
    display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 8px; color: var(--text-2);
    font-weight: 500; transition: background .15s var(--ease), color .15s var(--ease); position: relative;
}
.nav-item span:not(.nav-badge):not(.area-dot) { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; }
.nav-item:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.nav-item.is-active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm), inset 0 0 0 1px var(--border); }
.nav-item.is-active .icon { color: var(--primary); }
.nav-badge { margin-left: auto; background: var(--primary); color: #fff; font-size: 11px; font-weight: 600; border-radius: 999px; padding: 0 7px; line-height: 18px; }
.area-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--c); margin: 0 5px; flex-shrink: 0; }
.sidebar-footer { padding: 10px; border-top: 1px solid var(--border); padding-bottom: calc(10px + env(safe-area-inset-bottom)); }
.user-card { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 10px; color: var(--text); }
.user-card:hover { background: var(--surface-2); text-decoration: none; }
.user-card-text { display: flex; flex-direction: column; min-width: 0; }
.user-card-text strong { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-card-text small { color: var(--text-3); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
    height: var(--topbar-h); display: flex; align-items: center; gap: 12px; padding: 0 24px;
    position: sticky; top: 0; z-index: 30; border-bottom: 1px solid var(--border);
    background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: saturate(180%) blur(12px); -webkit-backdrop-filter: saturate(180%) blur(12px);
    padding-top: env(safe-area-inset-top); box-sizing: content-box;
}
.icon-btn.menu-btn { display: none; }
.search-trigger {
    display: flex; align-items: center; gap: 10px; flex: 1; max-width: 440px; height: 36px; padding: 0 10px 0 12px;
    background: var(--surface); border: 1px solid var(--border); border-radius: 9px; color: var(--text-3); font: inherit; cursor: pointer;
    transition: border-color .15s, box-shadow .15s;
}
.search-trigger:hover { border-color: var(--border-strong); }
.search-trigger span { flex: 1; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
kbd { font-family: var(--font); font-size: 11px; color: var(--text-3); background: var(--surface-2); border: 1px solid var(--border); border-radius: 5px; padding: 1px 6px; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 4px; }
.content { padding: 28px 32px 48px; width: 100%; max-width: 1360px; margin: 0 auto; outline: none; animation: fade-in .3s var(--ease); }

@keyframes fade-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
@keyframes pop { from { opacity: 0; transform: translateY(-4px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes slide-up { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

/* ---------- Botones ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 36px; padding: 0 14px;
    border-radius: 9px; border: 1px solid transparent; font: 500 13.5px/1 var(--font); cursor: pointer; white-space: nowrap;
    transition: background .15s var(--ease), border-color .15s, color .15s, box-shadow .15s, transform .08s;
    text-decoration: none !important; user-select: none;
}
.btn:active { transform: translateY(1px); }
.btn[disabled], .btn.is-loading { opacity: .6; pointer-events: none; }
.btn-primary { background: var(--primary); color: var(--on-primary); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .18), var(--shadow-sm); }
.btn-primary:hover { background: var(--primary-hover); }
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border); box-shadow: var(--shadow-sm); }
.btn-secondary:hover { background: var(--surface-2); border-color: var(--border-strong); }
.btn-ghost { background: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: color-mix(in srgb, var(--danger) 88%, #000); }
.btn-sm { height: 30px; padding: 0 10px; font-size: 12.5px; border-radius: 8px; }
.btn-lg { height: 44px; padding: 0 18px; font-size: 14.5px; border-radius: 10px; }
.btn-block { width: 100%; }
.btn-icon { width: 36px; padding: 0; }
.icon-btn {
    width: 36px; height: 36px; display: inline-grid; place-items: center; border: 0; border-radius: 9px;
    background: transparent; color: var(--text-2); cursor: pointer; position: relative; transition: background .15s, color .15s;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn.sm { width: 28px; height: 28px; border-radius: 7px; }
.icon-btn.danger:hover { color: var(--danger); background: var(--danger-soft); }
.link-btn { background: none; border: 0; padding: 0; color: var(--primary-text); font: 500 12.5px var(--font); cursor: pointer; }
.link-btn:hover { text-decoration: underline; }
.avatar-btn { background: none; border: 0; padding: 2px; border-radius: 50%; cursor: pointer; margin-left: 4px; }
.avatar-btn:hover .avatar { box-shadow: 0 0 0 3px var(--surface-3); }

/* ---------- Tema ---------- */
.theme-ico-dark { display: none; }
:root[data-theme="dark"] .theme-ico-light { display: none; }
:root[data-theme="dark"] .theme-ico-dark { display: inline; }
@media (prefers-color-scheme: dark) {
    :root[data-theme="system"] .theme-ico-light { display: none; }
    :root[data-theme="system"] .theme-ico-dark { display: inline; }
}

/* ---------- Encabezados de página ---------- */
.page-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.page-header h1 + p { margin-top: 4px; }
.page-header.hero h1 { font-size: 26px; }
.eyebrow { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--primary-text); margin-bottom: 6px; }
.back-link { display: inline-flex; align-items: center; gap: 4px; color: var(--text-2); font-size: 13px; font-weight: 500; margin-bottom: 10px; }
.back-link:hover { color: var(--text); text-decoration: none; }
.section { margin-top: 32px; }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.section-head h2 { display: flex; align-items: center; gap: 8px; }

/* ---------- Tarjetas ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 18px; box-shadow: var(--shadow-sm); min-width: 0; }
.card.no-pad { padding: 0; overflow: hidden; }
.card.narrow { max-width: 760px; }
.card-header { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.card-header h3 { display: flex; align-items: center; gap: 8px; }
.card-header.pad, .pad { padding: 16px 18px; margin: 0; }
.card-header.mt { margin-top: 22px; }
.grid { display: grid; gap: 16px; margin-bottom: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.span-2 { grid-column: span 2; }

/* KPIs */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 16px; margin-bottom: 16px; }
.kpi {
    display: flex; align-items: center; gap: 14px; background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-lg); padding: 16px 18px; box-shadow: var(--shadow-sm); color: var(--text);
    transition: border-color .15s, transform .15s var(--ease), box-shadow .15s;
}
a.kpi:hover { text-decoration: none; border-color: var(--border-strong); transform: translateY(-1px); box-shadow: var(--shadow); }
.kpi-lg { flex-direction: column; align-items: flex-start; gap: 4px; }
.kpi-icon { width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; flex-shrink: 0; color: var(--c); background: color-mix(in srgb, var(--c) 13%, transparent); }
.kpi-label { display: block; font-size: 12.5px; color: var(--text-2); font-weight: 500; }
.kpi-value { display: block; font-size: 26px; font-weight: 650; letter-spacing: -.02em; line-height: 1.2; font-variant-numeric: tabular-nums; }
.kpi-value.small { font-size: 16px; }
.kpi-foot { font-size: 12px; color: var(--text-3); }
.stat-card { display: flex; flex-direction: column; gap: 4px; }
.progress { width: 100%; height: 6px; background: var(--surface-3); border-radius: 999px; overflow: hidden; margin: 6px 0 2px; }
.progress i { display: block; height: 100%; background: var(--primary); border-radius: inherit; transition: width .6s var(--ease); }

/* ---------- Badges y chips ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 600; padding: 2px 8px; border-radius: 999px; line-height: 18px; white-space: nowrap; }
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-success { background: var(--success-soft); color: var(--success); }
.badge-warning { background: var(--warning-soft); color: var(--warning); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }
.badge-info { background: var(--info-soft); color: var(--info); }
.badge-primary { background: var(--primary-soft); color: var(--primary-text); }
.badge-neutral { background: var(--surface-3); color: var(--text-2); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.chip {
    --c: var(--text-3);
    display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 500; padding: 2px 9px; border-radius: 999px;
    border: 1px solid color-mix(in srgb, var(--c) 35%, var(--border)); color: var(--text-2); background: color-mix(in srgb, var(--c) 8%, var(--surface)); white-space: nowrap;
}
.chip-primary { --c: var(--primary); color: var(--primary-text); }
.chip-danger { --c: var(--danger); color: var(--danger); }
.area-chip { --c: var(--primary); width: 30px; height: 30px; border-radius: 8px; display: inline-grid; place-items: center; color: var(--c); background: color-mix(in srgb, var(--c) 14%, transparent); flex-shrink: 0; }
.area-chip.lg { width: 42px; height: 42px; border-radius: 11px; }
.area-chip.xl { width: 64px; height: 64px; border-radius: 16px; }

/* ---------- Avatares ---------- */
.avatar {
    --av-h: 240; display: inline-grid; place-items: center; border-radius: 50%; flex-shrink: 0; object-fit: cover;
    font-weight: 600; color: hsl(var(--av-h) 45% 32%); background: hsl(var(--av-h) 60% 90%); letter-spacing: .01em;
}
:root[data-theme="dark"] .avatar { color: hsl(var(--av-h) 70% 82%); background: hsl(var(--av-h) 30% 24%); }
@media (prefers-color-scheme: dark) { :root[data-theme="system"] .avatar { color: hsl(var(--av-h) 70% 82%); background: hsl(var(--av-h) 30% 24%); } }
.avatar-xs { width: 24px; height: 24px; font-size: 10px; }
.avatar-sm { width: 32px; height: 32px; font-size: 12px; }
.avatar-md { width: 40px; height: 40px; font-size: 14px; }
.avatar-xl { width: 72px; height: 72px; font-size: 24px; }
.person { display: flex; align-items: center; gap: 10px; color: var(--text); min-width: 0; }
a.person:hover { text-decoration: none; }
a.person:hover strong { text-decoration: underline; }
.person > div { min-width: 0; display: flex; flex-direction: column; }
.person strong { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.person small { color: var(--text-3); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.person.lg { gap: 16px; }
.person.lg h1 { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* ---------- Tablas ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 12px; font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: .04em; padding: 10px 16px; border-bottom: 1px solid var(--border); background: var(--surface-2); white-space: nowrap; }
.table td { padding: 12px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background .12s; }
.table tbody tr:hover { background: color-mix(in srgb, var(--surface-2) 70%, transparent); }
tr[data-href] { cursor: pointer; }
.filters { display: flex; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--border); flex-wrap: wrap; align-items: center; }
.filters select, .filters input[type="date"] { width: auto; min-width: 150px; }
.pagination { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border-top: 1px solid var(--border); flex-wrap: wrap; }

/* Matriz de permisos */
.matrix th, .matrix td { padding: 9px 12px; }
.matrix-role { display: block; color: var(--text); text-transform: none; letter-spacing: 0; font-size: 12.5px; }
.matrix th small { text-transform: none; letter-spacing: 0; font-weight: 500; }
.matrix-group td { background: var(--surface-2); font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--text-2); padding: 7px 12px; }
.sticky-col { position: sticky; left: 0; background: var(--surface); z-index: 1; min-width: 230px; }
thead .sticky-col { background: var(--surface-2); }
.matrix-check { display: inline-grid; cursor: pointer; }
.matrix-check input { position: absolute; opacity: 0; pointer-events: none; }
.matrix-check span { width: 22px; height: 22px; border-radius: 6px; border: 1.5px solid var(--border-strong); display: grid; place-items: center; color: transparent; transition: all .15s var(--ease); background: var(--surface); }
.matrix-check input:checked + span { background: var(--primary); border-color: var(--primary); color: #fff; }
.matrix-check input:focus-visible + span { box-shadow: var(--ring); }
.matrix-check.is-locked span { opacity: .55; cursor: not-allowed; }

/* ---------- Formularios ---------- */
.form-layout { display: flex; flex-direction: column; gap: 16px; max-width: 980px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }
.form-grid .span-2 { grid-column: span 2; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label, .field-label { font-size: 13px; font-weight: 500; color: var(--text); }
.req { color: var(--danger); }
input[type="text"], input[type="email"], input[type="password"], input[type="tel"], input[type="search"], input[type="number"], input[type="date"], input[type="url"], input:not([type]), select, textarea {
    width: 100%; height: 38px; padding: 0 12px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface);
    color: var(--text); font: 14px var(--font); transition: border-color .15s, box-shadow .15s; appearance: none; -webkit-appearance: none;
}
textarea { height: auto; padding: 10px 12px; resize: vertical; line-height: 1.5; }
select { padding-right: 32px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%238B8B95' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; }
select[multiple] { height: auto; padding: 6px; background-image: none; }
select[multiple] option { padding: 6px 8px; border-radius: 6px; }
input:hover, select:hover, textarea:hover { border-color: var(--border-strong); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: var(--ring); }
input:disabled, select:disabled, textarea:disabled { background: var(--surface-2); color: var(--text-2); cursor: not-allowed; }
input::placeholder, textarea::placeholder { color: var(--text-3); }
.select-sm { height: 32px; font-size: 13px; width: auto; }
.has-error input, .has-error select, .has-error textarea { border-color: var(--danger); }
.field-error { color: var(--danger); font-size: 12.5px; font-weight: 500; }
.hint { font-size: 12.5px; color: var(--text-3); margin-top: 6px; }
.field .hint { margin-top: 0; }
.input-icon { position: relative; display: flex; align-items: center; }
.input-icon > .icon { position: absolute; left: 12px; color: var(--text-3); pointer-events: none; }
.input-icon input { padding-left: 36px; }
.input-action { position: absolute; right: 6px; width: 28px; height: 28px; border: 0; background: none; color: var(--text-3); border-radius: 6px; cursor: pointer; display: grid; place-items: center; }
.input-action:hover { background: var(--surface-2); color: var(--text); }
.check, .radio { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 13.5px; color: var(--text); }
input[type="checkbox"], input[type="radio"] { width: 16px; height: 16px; accent-color: var(--primary); margin: 0; cursor: pointer; flex-shrink: 0; }
.form-actions { display: flex; justify-content: flex-end; align-items: center; gap: 10px; margin-top: 18px; flex-wrap: wrap; }
.form-actions.sticky { position: sticky; bottom: 0; background: color-mix(in srgb, var(--bg) 85%, transparent); backdrop-filter: blur(8px); padding: 12px 0; margin-top: 0; z-index: 5; }
.card .form-actions.sticky { background: color-mix(in srgb, var(--surface) 90%, transparent); }
.form-actions.pad { justify-content: space-between; border-top: 1px solid var(--border); }
.photo-field { display: flex; align-items: center; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.photo-field > div { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.color-input { display: flex; align-items: center; gap: 10px; }
.color-input input[type="color"] { width: 44px; height: 38px; padding: 3px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface); cursor: pointer; }
.strength { height: 4px; background: var(--surface-3); border-radius: 999px; overflow: hidden; }
.strength i { display: block; height: 100%; width: 0; background: var(--danger); transition: width .25s, background .25s; }

.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-size: 13.5px; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch-ui { width: 36px; height: 20px; background: var(--border-strong); border-radius: 999px; position: relative; transition: background .2s; flex-shrink: 0; }
.switch-ui::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: var(--shadow-sm); transition: transform .2s var(--ease); }
.switch input:checked + .switch-ui { background: var(--primary); }
.switch input:checked + .switch-ui::after { transform: translateX(16px); }
.switch input:focus-visible + .switch-ui { box-shadow: var(--ring); }

.swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.swatch input { position: absolute; opacity: 0; }
.swatch span { display: block; width: 28px; height: 28px; border-radius: 50%; background: var(--c); cursor: pointer; box-shadow: inset 0 0 0 1px rgba(0,0,0,.08); transition: transform .15s; }
.swatch input:checked + span { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--c); }
.swatch span:hover { transform: scale(1.08); }
.icon-picker { display: flex; flex-wrap: wrap; gap: 6px; }
.icon-picker input { position: absolute; opacity: 0; }
.icon-picker span { width: 38px; height: 38px; display: grid; place-items: center; border: 1px solid var(--border); border-radius: 9px; cursor: pointer; color: var(--text-2); transition: all .15s; }
.icon-picker input:checked + span { border-color: var(--primary); color: var(--primary); background: var(--primary-soft); }

/* Asignación de áreas y roles */
.area-assign { display: flex; flex-direction: column; gap: 8px; }
.area-row { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; transition: border-color .15s, background .15s; flex-wrap: wrap; }
.area-row .check { flex: 1; min-width: 200px; }
.area-row.is-on { border-color: color-mix(in srgb, var(--primary) 45%, var(--border)); background: color-mix(in srgb, var(--primary) 4%, var(--surface)); }
.area-row:not(.is-on) select, .area-row:not(.is-on) .radio { opacity: .45; pointer-events: none; }
.role-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.role-option { display: flex; gap: 10px; align-items: flex-start; padding: 12px; border: 1px solid var(--border); border-radius: 10px; cursor: pointer; transition: border-color .15s, background .15s; }
.role-option:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); }
.role-option input { margin-top: 2px; }
.role-option div { display: flex; flex-direction: column; gap: 2px; }
.role-option small { color: var(--text-2); font-size: 12px; line-height: 1.4; }
.role-option.is-disabled { cursor: not-allowed; opacity: .75; }

/* ---------- Tabs y segmentados ---------- */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 20px; overflow-x: auto; scrollbar-width: none; }
.tab { background: none; border: 0; padding: 10px 14px; font: 500 13.5px var(--font); color: var(--text-2); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; transition: color .15s, border-color .15s; }
.tab:hover { color: var(--text); }
.tab.is-active { color: var(--text); border-bottom-color: var(--primary); }
.tab-panel { display: none; animation: fade-in .25s var(--ease); }
.tab-panel.is-active { display: block; }
.segmented { display: inline-flex; background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 3px; gap: 2px; }
.segmented > * { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 7px; border: 0; background: none; font: 500 13px var(--font); color: var(--text-2); cursor: pointer; }
.segmented > *:hover { color: var(--text); text-decoration: none; }
.segmented > .is-active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }

/* ---------- Dropdowns ---------- */
.dropdown { position: relative; }
.dropdown-menu {
    position: absolute; top: calc(100% + 6px); left: 0; min-width: 220px; background: var(--surface); border: 1px solid var(--border);
    border-radius: 12px; box-shadow: var(--shadow-lg); padding: 6px; z-index: 50; display: none; animation: pop .15s var(--ease);
}
.dropdown-right { left: auto; right: 0; }
.dropdown.is-open .dropdown-menu { display: block; }
.dropdown-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 0; background: none; border-radius: 7px; font: 13.5px var(--font); color: var(--text); cursor: pointer; text-align: left; }
.dropdown-item:hover { background: var(--surface-2); text-decoration: none; }
.dropdown-item.danger { color: var(--danger); }
.dropdown-item .icon { color: var(--text-3); }
.dropdown-item.danger .icon { color: inherit; }
.dropdown-header { padding: 8px 10px 10px; border-bottom: 1px solid var(--border); margin-bottom: 6px; display: flex; flex-direction: column; }
.dropdown-header small { color: var(--text-3); }
.dropdown-sep { height: 1px; background: var(--border); margin: 6px 0; }

/* Notificaciones (campana) */
.bell-badge { position: absolute; top: 4px; right: 3px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 999px; background: var(--danger); color: #fff; font-size: 10px; font-weight: 700; line-height: 16px; text-align: center; box-shadow: 0 0 0 2px var(--bg); }
.notif-menu { width: 360px; padding: 0; overflow: hidden; }
.notif-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.notif-list { max-height: 380px; overflow-y: auto; }
.notif-item { display: flex; gap: 10px; padding: 10px 14px; color: var(--text); border-bottom: 1px solid var(--border); position: relative; }
.notif-item:hover { background: var(--surface-2); text-decoration: none; }
.notif-item.is-unread { background: color-mix(in srgb, var(--primary) 5%, var(--surface)); }
.notif-item.is-unread::after { content: ""; position: absolute; right: 12px; top: 16px; width: 7px; height: 7px; border-radius: 50%; background: var(--primary); }
.notif-item strong { font-weight: 500; font-size: 13px; display: block; padding-right: 14px; }
.notif-item small { color: var(--text-3); font-size: 12px; }
.notif-item p { font-size: 12.5px; color: var(--text-2); }
.notif-empty { padding: 28px 14px; text-align: center; color: var(--text-3); }
.notif-foot { display: block; text-align: center; padding: 10px; font-weight: 500; font-size: 13px; }
.notif-page { list-style: none; margin: 0; padding: 0; }
.notif-page li a { display: flex; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--border); color: var(--text); align-items: flex-start; }
.notif-page li a:hover { background: var(--surface-2); text-decoration: none; }
.notif-page li.is-unread a { background: color-mix(in srgb, var(--primary) 4%, var(--surface)); }
.notif-page li a > div { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.unread-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--primary); margin-top: 6px; }

/* ---------- Listas ---------- */
.feed, .timeline, .area-list, .metric-list, .alert-list, .announce-list, .session-list, .mini-people, .req-list, .check-list { list-style: none; margin: 0; padding: 0; }
.feed li { display: flex; gap: 10px; align-items: flex-start; padding: 9px 0; border-bottom: 1px solid var(--border); }
.feed li:last-child { border-bottom: 0; }
.feed li > div { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.feed li p { font-size: 13px; }
.feed li.is-unread a { font-weight: 600; }
.feed-ico { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; background: var(--surface-2); color: var(--text-2); flex-shrink: 0; }
.timeline li { display: flex; gap: 12px; padding-bottom: 14px; position: relative; }
.timeline li::before { content: ""; position: absolute; left: 4px; top: 14px; bottom: 0; width: 1px; background: var(--border); }
.timeline li:last-child::before { display: none; }
.tl-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--primary); margin-top: 5px; flex-shrink: 0; box-shadow: 0 0 0 3px var(--primary-soft); }
.timeline p { font-size: 13px; }
.area-list li a { display: flex; align-items: center; gap: 12px; padding: 8px; margin: 0 -8px; border-radius: 9px; color: var(--text); }
.area-list li a:hover { background: var(--surface-2); text-decoration: none; }
.area-list li div { display: flex; flex-direction: column; min-width: 0; }
.metric-list li { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 9px 0; border-bottom: 1px solid var(--border); font-size: 13.5px; }
.metric-list li:last-child { border-bottom: 0; }
.metric-list strong { font-variant-numeric: tabular-nums; }
.alert-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; margin-bottom: 8px; font-size: 13px; background: var(--surface-2); }
.alert-item span { flex: 1; }
.alert-item.alert-warning { background: var(--warning-soft); color: var(--warning); }
.alert-item.alert-danger { background: var(--danger-soft); color: var(--danger); }
.alert-item.alert-info { background: var(--info-soft); color: var(--info); }
.alert-item span { color: var(--text); }
.session-list li { display: flex; gap: 10px; align-items: flex-start; padding: 10px 0; border-bottom: 1px solid var(--border); }
.session-list li > div { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.session-list li > div strong { display: inline; }
.mini-people { display: flex; flex-direction: column; gap: 8px; }
.req-list li { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 13.5px; }
.req-list li span { flex: 1; }
.req-list li.ok .icon { color: var(--success); }
.req-list li.bad .icon { color: var(--warning); }
.check-list li { display: flex; gap: 8px; align-items: center; font-size: 13px; color: var(--text-2); padding: 4px 0; }
.check-list .icon { color: var(--success); }
.dl { display: grid; grid-template-columns: auto 1fr; gap: 10px 14px; margin: 0; font-size: 13.5px; }
.dl dt { color: var(--text-2); display: flex; align-items: center; gap: 6px; }
.dl dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }

/* Avisos */
.announce-list li a { display: block; padding: 12px; margin: 0 -12px; border-radius: 10px; color: var(--text); }
.announce-list li a:hover { background: var(--surface-2); text-decoration: none; }
.announce-list li.is-important a { border-left: 3px solid var(--danger); border-radius: 4px 10px 10px 4px; }
.announce-meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 4px; }
.announce-feed { display: flex; flex-direction: column; gap: 16px; max-width: 820px; }
.announce { padding: 20px 22px; scroll-margin-top: 80px; }
.announce:target { box-shadow: 0 0 0 2px var(--primary); }
.announce.is-important { border-left: 4px solid var(--danger); }
.announce-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.announce h2 { margin-bottom: 8px; }
.prose { color: var(--text); line-height: 1.65; font-size: 14.5px; }

/* Áreas */
.area-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 16px; }
.area-card {
    --c: var(--primary); display: flex; flex-direction: column; gap: 8px; padding: 18px; border-radius: var(--radius-lg); background: var(--surface);
    border: 1px solid var(--border); color: var(--text); box-shadow: var(--shadow-sm); position: relative; overflow: hidden;
    transition: transform .2s var(--ease), box-shadow .2s, border-color .2s;
}
.area-card::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 3px; background: var(--c); }
a.area-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); text-decoration: none; border-color: color-mix(in srgb, var(--c) 40%, var(--border)); }
.area-card.is-inactive { opacity: .6; }
.area-card-top { display: flex; justify-content: space-between; align-items: flex-start; }
.area-card-foot { display: flex; flex-direction: column; gap: 2px; margin-top: auto; padding-top: 10px; border-top: 1px solid var(--border); font-size: 13px; }
.area-card-foot span:first-child { display: flex; align-items: center; gap: 6px; font-weight: 500; }

/* Accesos rápidos */
.quick-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.quick { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; padding: 12px; border: 1px solid var(--border); border-radius: 10px; color: var(--text); font-size: 13px; font-weight: 500; transition: all .15s var(--ease); }
.quick .icon { color: var(--primary); }
.quick:hover { border-color: var(--primary); background: var(--primary-soft); text-decoration: none; transform: translateY(-1px); }

/* Hoja de ruta */
.roadmap { margin-top: 16px; }
.roadmap-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; margin-top: 14px; }
.roadmap-grid div { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border: 1px dashed var(--border-strong); border-radius: 10px; font-size: 12.5px; color: var(--text-2); }
.phase { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--primary-text); background: var(--primary-soft); padding: 2px 6px; border-radius: 5px; flex-shrink: 0; }
.sys-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.sys-grid strong { font-size: 18px; }

/* Estados vacíos */
.empty-state { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 48px 20px; text-align: center; color: var(--text-3); }
.empty-state .icon { color: var(--text-3); opacity: .7; }
.empty-state h3 { color: var(--text); }
.empty-state.sm { padding: 24px 10px; }
.empty-state.sm p { font-size: 13px; }

/* Alertas en línea */
.alert { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 10px; font-size: 13.5px; margin-bottom: 16px; border: 1px solid transparent; }
.alert-success { background: var(--success-soft); color: var(--success); }
.alert-danger { background: var(--danger-soft); color: var(--danger); }
.alert-warning { background: var(--warning-soft); color: var(--warning); }
.alert-info { background: var(--info-soft); color: var(--info); }
.alert span, .alert div { color: var(--text); }
.alert div p { margin: 4px 0; }
.temp-pass code { font-size: 15px; padding: 3px 8px; }

/* Charts */
.chart-box { position: relative; height: 240px; }

/* Logo */
.logo-preview { display: grid; place-items: center; height: 140px; background: repeating-conic-gradient(var(--surface-2) 0 25%, var(--surface) 0 50%) 0 / 16px 16px; border: 1px solid var(--border); border-radius: 12px; margin-bottom: 12px; }
.logo-preview img { max-height: 110px; max-width: 80%; object-fit: contain; }

.details summary { cursor: pointer; color: var(--primary-text); font-size: 12px; margin-top: 4px; }

/* ---------- Toasts ---------- */
.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 90; display: flex; flex-direction: column; gap: 10px; max-width: min(420px, calc(100vw - 32px)); }
.toast {
    display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; background: var(--surface); border: 1px solid var(--border);
    border-radius: 12px; box-shadow: var(--shadow-lg); font-size: 13.5px; animation: slide-up .3s var(--ease); transition: opacity .3s, transform .3s;
}
.toast span { flex: 1; }
.toast.is-hiding { opacity: 0; transform: translateY(8px); }
.toast-success > .icon { color: var(--success); }
.toast-error > .icon { color: var(--danger); }
.toast-info > .icon { color: var(--info); }
.toast-warning > .icon { color: var(--warning); }
.toast-close { border: 0; background: none; color: var(--text-3); cursor: pointer; padding: 2px; border-radius: 5px; }

/* ---------- Paleta de búsqueda ---------- */
.palette { position: fixed; inset: 0; z-index: 95; display: flex; justify-content: center; align-items: flex-start; padding: 12vh 16px 16px; }
.palette-backdrop { position: absolute; inset: 0; background: rgba(10, 10, 15, .45); backdrop-filter: blur(2px); animation: fade-in .15s; }
.palette-box { position: relative; width: 100%; max-width: 600px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow-lg); overflow: hidden; animation: pop .18s var(--ease); }
.palette-input { display: flex; align-items: center; gap: 10px; padding: 0 14px; border-bottom: 1px solid var(--border); color: var(--text-3); }
.palette-input input { border: 0; box-shadow: none !important; height: 52px; font-size: 15px; padding: 0; background: transparent; }
.palette-results { max-height: 50vh; overflow-y: auto; padding: 6px; }
.palette-hint { padding: 22px; text-align: center; color: var(--text-3); font-size: 13px; }
.palette-item { display: flex; align-items: center; gap: 12px; padding: 8px 10px; border-radius: 9px; color: var(--text); }
.palette-item:hover, .palette-item.is-active { background: var(--surface-2); text-decoration: none; }
.palette-item div { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.palette-item small { color: var(--text-3); font-size: 12px; }
.palette-type { font-size: 11px; color: var(--text-3); border: 1px solid var(--border); border-radius: 5px; padding: 0 6px; }

/* ---------- Modal ---------- */
.modal { border: 0; padding: 0; background: transparent; max-width: calc(100vw - 32px); }
.modal::backdrop { background: rgba(10, 10, 15, .5); backdrop-filter: blur(2px); }
.modal[open] { animation: pop .18s var(--ease); }
.modal-box { width: 420px; max-width: 100%; background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: 16px; padding: 22px; box-shadow: var(--shadow-lg); display: flex; flex-direction: column; gap: 10px; }
.modal-icon { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; background: var(--warning-soft); color: var(--warning); }
.modal-box p { color: var(--text-2); }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 10px; }

/* ---------- Errores ---------- */
.error-page { text-align: center; padding: 60px 16px; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.error-code { font-size: 72px; font-weight: 700; letter-spacing: -.04em; background: linear-gradient(135deg, var(--primary), color-mix(in srgb, var(--primary) 40%, var(--text-3))); -webkit-background-clip: text; background-clip: text; color: transparent; line-height: 1; }
.error-page .row-gap { justify-content: center; margin-top: 8px; }

/* ---------- Inicio de sesión ---------- */
.auth-body { background: var(--bg); }
.auth-wrap { display: grid; grid-template-columns: minmax(400px, 560px) 1fr; min-height: 100vh; min-height: 100dvh; }
.auth-panel { display: flex; flex-direction: column; justify-content: center; padding: 40px clamp(24px, 6vw, 72px); gap: 26px; background: var(--surface); border-right: 1px solid var(--border); }
.auth-logo { display: flex; justify-content: center; padding-bottom: 6px; }
.auth-logo .logo { width: min(300px, 78%); }
.auth-logo .brand-custom { max-height: 110px; max-width: 78%; }
.auth-head { text-align: center; }
.auth-head h1 { font-size: 22px; }
.auth-head p { color: var(--text-2); margin-top: 6px; }
.auth-panel .input-icon input, .auth-panel input { height: 44px; }
.auth-foot { font-size: 12px; color: var(--text-3); text-align: center; }
.auth-art {
    position: relative; overflow: hidden; display: flex; align-items: center; justify-content: center; padding: 48px;
    background: radial-gradient(900px 520px at 85% 10%, rgba(8, 124, 250, .22), transparent 60%),
                radial-gradient(700px 480px at 10% 95%, rgba(100, 40, 245, .18), transparent 60%),
                var(--navy);
    color: #fff;
}
.auth-art-inner { max-width: 460px; position: relative; }
.auth-art h2 { font-size: 28px; line-height: 1.25; letter-spacing: -.02em; margin-top: 40px; color: #E3ECFB; }
.auth-art p { margin-top: 12px; color: rgba(214, 226, 245, .72); font-size: 15px; }
.art-card { background: rgba(255, 255, 255, .06); border: 1px solid rgba(255, 255, 255, .12); border-radius: 16px; padding: 18px; box-shadow: 0 20px 50px -24px rgba(0, 0, 0, .55); }
.art-card-1 { display: flex; flex-direction: column; gap: 12px; animation: float 6s ease-in-out infinite; }
.art-card-2 { margin: -18px 0 0 90px; width: 240px; animation: float 6s ease-in-out infinite 1.5s; }
.art-row { display: flex; align-items: center; gap: 10px; }
.art-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--c); }
.art-line { height: 8px; border-radius: 4px; background: rgba(214, 226, 245, .22); }
.w40 { width: 40%; } .w60 { width: 60%; } .w80 { width: 80%; }
.art-bars { display: flex; align-items: flex-end; gap: 8px; height: 80px; }
.art-bars i { flex: 1; height: var(--h); border-radius: 5px 5px 2px 2px; background: rgba(8, 124, 250, .75); }
.art-bars i:nth-child(even) { background: rgba(100, 40, 245, .7); }
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }

/* ---------- Navegación inferior (móvil) ---------- */
.bottom-nav { display: none; }

/* ---------- Adaptable ---------- */
@media (max-width: 1180px) {
    .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .grid-3 > .span-2 { grid-column: span 2; }
}
@media (max-width: 1023px) {
    .sidebar { position: fixed; left: 0; top: 0; bottom: 0; transform: translateX(-100%); transition: transform .25s var(--ease); box-shadow: var(--shadow-lg); }
    .app.sidebar-open .sidebar { transform: none; }
    .sidebar-backdrop { position: fixed; inset: 0; background: rgba(10, 10, 15, .4); z-index: 35; opacity: 0; pointer-events: none; transition: opacity .25s; }
    .app.sidebar-open .sidebar-backdrop { opacity: 1; pointer-events: auto; }
    .icon-btn.sidebar-close, .icon-btn.menu-btn { display: inline-grid; }
    .topbar { padding: 0 14px; }
    .content { padding: 20px 16px 96px; }
    .auth-wrap { grid-template-columns: 1fr; }
    .auth-art { display: none; }
    .bottom-nav {
        display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; justify-content: space-around;
        background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
        border-top: 1px solid var(--border); padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
    }
    .bottom-nav a, .bottom-nav button { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 4px 0; color: var(--text-3); font: 500 10.5px var(--font); background: none; border: 0; cursor: pointer; position: relative; }
    .bottom-nav a:hover { text-decoration: none; }
    .bottom-nav .is-active { color: var(--primary); }
    .dot-badge { position: absolute; top: 2px; left: calc(50% + 6px); width: 8px; height: 8px; border-radius: 50%; background: var(--danger); }
    .toasts { bottom: calc(80px + env(safe-area-inset-bottom)); right: 16px; left: 16px; max-width: none; }
}
@media (max-width: 760px) {
    .grid-2, .grid-3 { grid-template-columns: 1fr; }
    .grid-3 > .span-2, .span-2 { grid-column: auto; }
    .form-grid { grid-template-columns: 1fr; }
    .form-grid .span-2 { grid-column: auto; }
    .search-trigger span, .search-trigger kbd { display: none; }
    .search-trigger { flex: 0; width: 36px; padding: 0; justify-content: center; border-color: transparent; background: transparent; }
    .hide-sm { display: none; }
    h1 { font-size: 21px; }
    .page-header.hero h1 { font-size: 22px; }
    .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
    .kpi { padding: 12px; gap: 10px; flex-direction: column; align-items: flex-start; }
    .kpi-value { font-size: 22px; }
    .notif-menu { position: fixed; left: 12px; right: 12px; top: calc(var(--topbar-h) + env(safe-area-inset-top)); width: auto; }
    .filters select, .filters input[type="date"] { flex: 1; min-width: 130px; }
    .filters .grow { flex-basis: 100%; }
    .table .person strong, .table .person small { white-space: normal; }
    .table .badge { padding: 2px 6px; }
    .table td, .table th { padding: 10px 12px; }
    .person.lg { flex-direction: column; align-items: flex-start; }
    .palette { padding-top: 8vh; }
}
@media (max-width: 1100px) { .hide-md { display: none; } }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; }
}

@media print {
    .sidebar, .topbar, .bottom-nav, .toasts, .btn, .form-actions { display: none !important; }
    .content { padding: 0; max-width: none; }
    .card { box-shadow: none; break-inside: avoid; }
}
