/* =========================================================
   SIG VoltaEnergy — Sistema de Diseño
   Empresarial · sobrio · profesional
   ========================================================= */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

/* ---------------------------------------------------------
   TOKENS
   --------------------------------------------------------- */
:root {
    /* Marca */
    --brand:            #0062ba;   /* azul del logo */
    --primary-color:    #1a5490;   /* azul corporativo (compatibilidad) */
    --primary-dark:     #123f6d;
    --primary-light:    #5a8fc9;
    --primary-50:       #eef4fb;
    --primary-100:      #d7e6f6;

    /* Semánticos */
    --success-color:    #15803d;
    --success-bg:       #dcfce7;
    --success-border:   #86efac;

    --warning-color:    #b45309;
    --warning-bg:       #fef3c7;
    --warning-border:   #fcd34d;

    --danger-color:     #b91c1c;
    --danger-bg:        #fee2e2;
    --danger-border:    #fca5a5;

    --info-color:       #0369a1;
    --info-bg:          #e0f2fe;
    --info-border:      #7dd3fc;

    --accent-color:     #ff9500;

    /* Neutros */
    --surface:          #ffffff;
    --surface-2:        #f8fafc;
    --page-bg:          #f1f5f9;
    --light-gray:       #f1f5f9;
    --border-color:     #e2e8f0;
    --border-strong:    #cbd5e1;
    --text:             #0f172a;
    --dark-gray:        #0f172a;
    --text-muted:       #64748b;
    --gray:             #64748b;
    --text-subtle:      #94a3b8;

    /* Espaciado */
    --sp-1: 4px;  --sp-2: 8px;  --sp-3: 12px; --sp-4: 16px;
    --sp-5: 20px; --sp-6: 24px; --sp-8: 32px; --sp-10: 40px;

    /* Radios */
    --r-sm: 6px;  --r-md: 8px;  --r-lg: 12px; --r-full: 999px;

    /* Sombras (suaves) */
    --shadow-xs: 0 1px 2px rgba(15,23,42,.06);
    --shadow:    0 1px 3px rgba(15,23,42,.08), 0 1px 2px rgba(15,23,42,.04);
    --shadow-md: 0 4px 12px rgba(15,23,42,.08);
    --shadow-lg: 0 12px 32px rgba(15,23,42,.14);

    /* Layout */
    --sidebar-w:          264px;
    --sidebar-w-collapsed: 72px;
    --header-h:           60px;

    --ring: 0 0 0 3px rgba(26,84,144,.20);
    --t: 160ms cubic-bezier(.4,0,.2,1);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--page-bg);
    color: var(--text);
    line-height: 1.55;
    font-size: 14px;
    -webkit-font-smoothing: antialiased;
}

/* Foco visible y consistente (accesibilidad) */
:focus-visible {
    outline: 2px solid var(--brand);
    outline-offset: 2px;
    border-radius: var(--r-sm);
}

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: var(--r-full); border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: var(--text-subtle); background-clip: content-box; }

/* =========================================================
   LOGIN
   ========================================================= */
.login-page {
    display: flex; align-items: center; justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    padding: var(--sp-4);
}
.login-container { width: 100%; max-width: 410px; }
.login-card {
    background: var(--surface);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-lg);
    padding: var(--sp-10) var(--sp-8);
    text-align: center;
    animation: slideUp .3s ease;
}
@keyframes slideUp { from { opacity:0; transform: translateY(14px);} to {opacity:1; transform:none;} }

.login-logo { margin-bottom: var(--sp-5); }
.login-logo img { width: 84px; height: auto; display: inline-block; }

.login-card h1 { font-size: 21px; font-weight: 700; color: var(--primary-color); margin-bottom: var(--sp-1); letter-spacing: -.2px; }
.login-card > p { font-size: 13px; color: var(--text-muted); margin-bottom: var(--sp-8); }

.password-wrapper { position: relative; display: flex; align-items: center; }
.password-wrapper input { padding-right: 42px; }
.toggle-password {
    position: absolute; right: 10px; background: none; border: none; cursor: pointer;
    font-size: 16px; padding: 5px; opacity: .55; transition: opacity var(--t); border-radius: var(--r-sm);
}
.toggle-password:hover { opacity: 1; }

.error-message {
    margin-top: var(--sp-5); padding: var(--sp-3) var(--sp-4);
    background: var(--danger-bg); color: var(--danger-color);
    border-radius: var(--r-md); font-size: 13px; display: none;
    border-left: 3px solid var(--danger-color); text-align: left;
}
.error-message:not(:empty) { display: block; }
.loading { margin-top: var(--sp-4); color: var(--primary-color); font-size: 13px; }
.hidden { display: none !important; }
.login-footer { margin-top: var(--sp-6); padding-top: var(--sp-5); border-top: 1px solid var(--border-color); }
.login-footer small { color: var(--text-muted); font-size: 12px; }
.login-footer strong { color: var(--primary-color); font-weight: 600; }

/* =========================================================
   LAYOUT
   ========================================================= */
.app-layout { display: flex; height: 100vh; overflow: hidden; }

/* ---------------- SIDEBAR ---------------- */
.sidebar {
    width: var(--sidebar-w);
    flex-shrink: 0;
    background: var(--primary-dark);
    color: #fff;
    display: flex; flex-direction: column;
    overflow: hidden;
    transition: width var(--t);
    z-index: 40;
}
.sidebar-brand {
    display: flex; flex-direction: column; align-items: center; gap: var(--sp-2);
    padding: var(--sp-5) var(--sp-4) var(--sp-4);
    border-bottom: 1px solid rgba(255,255,255,.12);
    flex-shrink: 0;
}
.sidebar-brand img { width: 100%; max-width: 168px; height: auto; display: block; transition: max-width var(--t); }
.sidebar-brand-sub {
    font-size: 10px; letter-spacing: .7px; text-transform: uppercase;
    color: rgba(255,255,255,.62); font-weight: 500; text-align: center; white-space: nowrap;
}

.sidebar-nav { flex: 1; overflow-y: auto; overflow-x: hidden; padding: var(--sp-3) var(--sp-3) var(--sp-5); }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.18); background-clip: content-box; }

.sidebar-group { margin-bottom: var(--sp-2); }
.sidebar-group-label {
    font-size: 10px; font-weight: 600; letter-spacing: .9px; text-transform: uppercase;
    color: rgba(255,255,255,.45); padding: var(--sp-3) var(--sp-3) var(--sp-1); white-space: nowrap;
}

.sidebar-menu { list-style: none; }
.sidebar-menu li { margin-bottom: 2px; }
.sidebar-menu a {
    display: flex; align-items: center; gap: var(--sp-3);
    padding: 9px var(--sp-3);
    color: rgba(255,255,255,.82); text-decoration: none;
    border-radius: var(--r-md); font-size: 13.5px; font-weight: 500;
    transition: background var(--t), color var(--t);
    position: relative; white-space: nowrap;
}
.sidebar-menu a .ico { width: 20px; text-align: center; font-size: 15px; flex-shrink: 0; }
.sidebar-menu a .txt { overflow: hidden; text-overflow: ellipsis; }
.sidebar-menu a:hover { background: rgba(255,255,255,.10); color: #fff; }
.sidebar-menu a.active { background: rgba(255,255,255,.16); color: #fff; font-weight: 600; }
.sidebar-menu a.active::before {
    content: ''; position: absolute; left: -12px; top: 50%; transform: translateY(-50%);
    width: 3px; height: 22px; background: #fff; border-radius: 0 3px 3px 0;
}
/* Badge de pendientes dentro del menú */
.sidebar-menu a .pill {
    margin-left: auto; background: var(--danger-color); color: #fff;
    font-size: 10.5px; font-weight: 700; padding: 1px 7px; border-radius: var(--r-full);
}

.sidebar-footer {
    flex-shrink: 0; padding: var(--sp-3) var(--sp-4) var(--sp-4);
    border-top: 1px solid rgba(255,255,255,.12);
}
.sidebar-user { display: flex; align-items: center; gap: var(--sp-3); margin-bottom: var(--sp-3); min-width: 0; }
.sidebar-user .avatar {
    width: 34px; height: 34px; border-radius: var(--r-full); flex-shrink: 0;
    background: rgba(255,255,255,.16); color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: 12.5px; font-weight: 700; letter-spacing: .3px;
}
.sidebar-user-info { min-width: 0; line-height: 1.3; }
.sidebar-user-nombre {
    font-size: 12.5px; font-weight: 600; color: #fff;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sidebar-user-rol { font-size: 10.5px; color: rgba(255,255,255,.6); text-transform: uppercase; letter-spacing: .5px; }

.btn-logout {
    width: 100%; padding: 8px var(--sp-3);
    background: rgba(255,255,255,.08); color: rgba(255,255,255,.9);
    border: 1px solid rgba(255,255,255,.16); border-radius: var(--r-md);
    font-size: 12.5px; font-weight: 500; font-family: inherit; cursor: pointer;
    display: flex; align-items: center; justify-content: center; gap: var(--sp-2);
    transition: background var(--t), border-color var(--t);
}
.btn-logout:hover { background: var(--danger-color); border-color: var(--danger-color); color: #fff; }

/* --- Sidebar contraído: solo iconos + tooltip --- */
.sidebar.collapsed { width: var(--sidebar-w-collapsed); }
.sidebar.collapsed .sidebar-brand { padding: var(--sp-4) var(--sp-2); }
.sidebar.collapsed .sidebar-brand img { max-width: 34px; }
.sidebar.collapsed .sidebar-brand-sub,
.sidebar.collapsed .sidebar-group-label,
.sidebar.collapsed .sidebar-menu a .txt,
.sidebar.collapsed .sidebar-menu a .pill,
.sidebar.collapsed .sidebar-user-info { display: none; }
.sidebar.collapsed .sidebar-nav { padding-left: var(--sp-2); padding-right: var(--sp-2); }
.sidebar.collapsed .sidebar-menu a { justify-content: center; padding: 11px 0; }
.sidebar.collapsed .sidebar-group { border-top: 1px solid rgba(255,255,255,.08); padding-top: var(--sp-2); margin-bottom: var(--sp-2); }
.sidebar.collapsed .sidebar-group:first-child { border-top: none; }
.sidebar.collapsed .sidebar-user { justify-content: center; }
.sidebar.collapsed .sidebar-footer { padding: var(--sp-3) var(--sp-2); }
.sidebar.collapsed .btn-logout span:not(.ico) { display: none; }

/* Tooltip del sidebar contraído */
.sidebar.collapsed .sidebar-menu a::after {
    content: attr(data-tooltip);
    position: absolute; left: calc(100% + 10px); top: 50%; transform: translateY(-50%);
    background: var(--text); color: #fff; padding: 6px 10px; border-radius: var(--r-sm);
    font-size: 12px; font-weight: 500; white-space: nowrap;
    opacity: 0; pointer-events: none; transition: opacity var(--t); z-index: 60;
    box-shadow: var(--shadow-md);
}
.sidebar.collapsed .sidebar-menu a:hover::after { opacity: 1; }

/* ---------------- MAIN ---------------- */
.main-content { flex: 1; display: flex; flex-direction: column; overflow: hidden; min-width: 0; }

/* ---------------- HEADER ---------------- */
.top-bar {
    height: var(--header-h); flex-shrink: 0;
    background: var(--surface);
    border-bottom: 1px solid var(--border-color);
    display: flex; align-items: center; gap: var(--sp-4);
    padding: 0 var(--sp-5);
    z-index: 30;
}
.top-bar-title { font-size: 16px; font-weight: 600; color: var(--text); letter-spacing: -.2px; }

.header-toggle {
    background: none; border: none; cursor: pointer; font-size: 17px; color: var(--text-muted);
    padding: 7px 9px; border-radius: var(--r-md); line-height: 1; transition: background var(--t), color var(--t);
    flex-shrink: 0;
}
.header-toggle:hover { background: var(--surface-2); color: var(--text); }

/* Breadcrumb */
.breadcrumb { display: flex; align-items: center; gap: var(--sp-2); min-width: 0; }
.breadcrumb-sep { color: var(--text-subtle); font-size: 12px; }
.breadcrumb a { color: var(--text-muted); text-decoration: none; font-size: 13px; transition: color var(--t); }
.breadcrumb a:hover { color: var(--brand); }
.breadcrumb .actual { font-size: 15px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.top-bar-actions { display: flex; align-items: center; gap: var(--sp-2); margin-left: auto; flex-shrink: 0; }

/* ---------------- BUSCADOR GLOBAL ---------------- */
.global-search { position: relative; flex: 1; max-width: 420px; margin-left: var(--sp-4); }
.global-search input {
    width: 100%; padding: 8px var(--sp-3) 8px 34px;
    border: 1px solid var(--border-color); border-radius: var(--r-md);
    background: var(--surface-2); font-family: inherit; font-size: 13px; color: var(--text);
    transition: border-color var(--t), box-shadow var(--t), background var(--t);
}
.global-search input::placeholder { color: var(--text-subtle); }
.global-search input:focus { outline: none; background: var(--surface); border-color: var(--brand); box-shadow: var(--ring); }
.global-search .lupa { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); font-size: 13px; opacity: .5; pointer-events: none; }

.search-results {
    position: absolute; top: calc(100% + 6px); left: 0; right: 0;
    background: var(--surface); border: 1px solid var(--border-color);
    border-radius: var(--r-md); box-shadow: var(--shadow-lg);
    max-height: 420px; overflow-y: auto; z-index: 70; display: none;
}
.search-results.open { display: block; }
.search-group-label {
    font-size: 10.5px; font-weight: 700; letter-spacing: .7px; text-transform: uppercase;
    color: var(--text-subtle); padding: var(--sp-3) var(--sp-4) var(--sp-1);
}
.search-item {
    display: flex; align-items: center; gap: var(--sp-3);
    padding: 9px var(--sp-4); cursor: pointer; text-decoration: none; color: var(--text);
    transition: background var(--t); border: none; background: none; width: 100%; text-align: left; font-family: inherit;
}
.search-item:hover, .search-item.sel { background: var(--primary-50); }
.search-item .ico { font-size: 15px; width: 20px; text-align: center; flex-shrink: 0; }
.search-item-main { min-width: 0; flex: 1; }
.search-item-title { font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.search-item-sub { font-size: 11.5px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------------- NOTIFICACIONES ---------------- */
.notif-wrap { position: relative; }
.notif-btn {
    background: none; border: none; cursor: pointer; font-size: 17px; color: var(--text-muted);
    padding: 7px 9px; border-radius: var(--r-md); position: relative; line-height: 1;
    transition: background var(--t);
}
.notif-btn:hover { background: var(--surface-2); }
.notif-count {
    position: absolute; top: 2px; right: 2px; min-width: 17px; height: 17px;
    background: var(--danger-color); color: #fff; border-radius: var(--r-full);
    font-size: 10px; font-weight: 700; display: flex; align-items: center; justify-content: center;
    padding: 0 4px; border: 2px solid var(--surface);
}
.notif-panel {
    position: absolute; top: calc(100% + 8px); right: 0; width: 340px;
    background: var(--surface); border: 1px solid var(--border-color);
    border-radius: var(--r-md); box-shadow: var(--shadow-lg);
    max-height: 440px; overflow-y: auto; z-index: 70; display: none;
}
.notif-panel.open { display: block; }
.notif-head {
    padding: var(--sp-3) var(--sp-4); border-bottom: 1px solid var(--border-color);
    font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .6px; color: var(--text-muted);
    display: flex; justify-content: space-between; align-items: center;
    position: sticky; top: 0; background: var(--surface);
}
.notif-item {
    display: flex; gap: var(--sp-3); padding: var(--sp-3) var(--sp-4);
    border-bottom: 1px solid var(--border-color); cursor: pointer;
    text-decoration: none; color: var(--text); transition: background var(--t);
}
.notif-item:last-child { border-bottom: none; }
.notif-item:hover { background: var(--surface-2); }
.notif-dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 6px; flex-shrink: 0; }
.notif-dot.rojo { background: var(--danger-color); }
.notif-dot.naranja { background: var(--warning-color); }
.notif-dot.verde { background: var(--success-color); }
.notif-body { min-width: 0; }
.notif-title { font-size: 13px; font-weight: 600; margin-bottom: 1px; }
.notif-desc { font-size: 12px; color: var(--text-muted); line-height: 1.4; }

/* ---------------- MENÚ DE USUARIO ---------------- */
.user-menu-wrap { position: relative; }
.user-btn {
    display: flex; align-items: center; gap: var(--sp-2);
    background: none; border: 1px solid transparent; cursor: pointer;
    padding: 4px 8px 4px 4px; border-radius: var(--r-md); font-family: inherit;
    transition: background var(--t), border-color var(--t);
}
.user-btn:hover { background: var(--surface-2); border-color: var(--border-color); }
.user-btn .avatar {
    width: 30px; height: 30px; border-radius: var(--r-full); flex-shrink: 0;
    background: var(--primary-color); color: #fff;
    display: flex; align-items: center; justify-content: center; font-size: 11.5px; font-weight: 700;
}
.user-btn-info { text-align: left; line-height: 1.25; }
.user-btn-nombre { font-size: 12.5px; font-weight: 600; color: var(--text); max-width: 130px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-btn-rol { font-size: 10.5px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .4px; }

.dropdown-panel {
    position: absolute; top: calc(100% + 8px); right: 0; min-width: 210px;
    background: var(--surface); border: 1px solid var(--border-color);
    border-radius: var(--r-md); box-shadow: var(--shadow-lg); z-index: 70;
    padding: var(--sp-2); display: none;
}
.dropdown-panel.open { display: block; }
.dropdown-head { padding: var(--sp-2) var(--sp-3) var(--sp-3); border-bottom: 1px solid var(--border-color); margin-bottom: var(--sp-2); }
.dropdown-head .n { font-size: 13px; font-weight: 600; }
.dropdown-head .r { font-size: 11.5px; color: var(--text-muted); }
.dropdown-item {
    display: flex; align-items: center; gap: var(--sp-3); width: 100%;
    padding: 8px var(--sp-3); border: none; background: none; cursor: pointer;
    border-radius: var(--r-sm); font-size: 13px; font-family: inherit; color: var(--text);
    text-align: left; text-decoration: none; transition: background var(--t);
}
.dropdown-item:hover { background: var(--surface-2); }
.dropdown-item.peligro { color: var(--danger-color); }
.dropdown-item.peligro:hover { background: var(--danger-bg); }

/* ---------------- ÁREA DE CONTENIDO ---------------- */
.content-area { flex: 1; overflow-y: auto; padding: var(--sp-6); }
.seccion-titulo {
    font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .8px;
    color: var(--text-muted); margin-bottom: var(--sp-3);
}
.page-intro { margin-bottom: var(--sp-6); }
.page-intro h1 { font-size: 22px; font-weight: 700; letter-spacing: -.3px; margin-bottom: 2px; }
.page-intro p { font-size: 13.5px; color: var(--text-muted); }

/* Overlay para el sidebar en móvil */
.sidebar-overlay {
    position: fixed; inset: 0; background: rgba(15,23,42,.45);
    z-index: 35; display: none; backdrop-filter: blur(1px);
}
.sidebar-overlay.open { display: block; }

/* =========================================================
   COMPONENTES
   ========================================================= */

/* ---------------- CARD ---------------- */
.card {
    background: var(--surface);
    border: 1px solid var(--border-color);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-xs);
    padding: var(--sp-5);
    margin-bottom: var(--sp-5);
}
.card-header {
    border-bottom: 1px solid var(--border-color);
    padding-bottom: var(--sp-4); margin-bottom: var(--sp-4);
}
.card-header h2 { font-size: 15px; font-weight: 600; color: var(--text); margin: 0; }

/* ---------------- KPI / STAT CARD ---------------- */
.dashboard-grid {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(215px, 1fr));
    gap: var(--sp-4); margin-bottom: var(--sp-6);
}
.stat-card {
    background: var(--surface); border: 1px solid var(--border-color);
    border-radius: var(--r-lg); box-shadow: var(--shadow-xs);
    padding: var(--sp-5); position: relative; overflow: hidden;
    transition: box-shadow var(--t), transform var(--t), border-color var(--t);
}
.stat-card::before {
    content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--brand);
}
.stat-card.warning::before { background: var(--warning-color); }
.stat-card.danger::before  { background: var(--danger-color); }
.stat-card.success::before { background: var(--success-color); }

.stat-number { font-size: 30px; font-weight: 700; color: var(--text); line-height: 1.15; letter-spacing: -.8px; }
.stat-card.warning .stat-number { color: var(--warning-color); }
.stat-card.danger  .stat-number { color: var(--danger-color); }
.stat-card.success .stat-number { color: var(--success-color); }
.stat-label {
    font-size: 11.5px; color: var(--text-muted); text-transform: uppercase;
    letter-spacing: .6px; font-weight: 600; margin-top: var(--sp-1);
}
.stat-hint { font-size: 12px; color: var(--text-muted); margin-top: var(--sp-2); }

/* Tarjeta KPI clickeable */
.stat-card.clickable { cursor: pointer; }
.stat-card.clickable:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); border-color: var(--border-strong); }
.stat-card.clickable:focus-visible { box-shadow: var(--ring); }
.stat-link {
    display: inline-flex; align-items: center; gap: 4px; margin-top: var(--sp-3);
    font-size: 12px; font-weight: 600; color: var(--brand);
}
.stat-card.clickable:hover .stat-link { text-decoration: underline; }

/* ---------------- NAV CARDS (hub de módulos) ---------------- */
.nav-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(238px, 1fr)); gap: var(--sp-4); margin-bottom: var(--sp-6); }
.nav-card {
    display: block; width: 100%; text-align: left;
    background: var(--surface); border: 1px solid var(--border-color);
    border-radius: var(--r-lg); box-shadow: var(--shadow-xs);
    padding: var(--sp-5); text-decoration: none; color: inherit; cursor: pointer;
    font-family: inherit; transition: transform var(--t), box-shadow var(--t), border-color var(--t);
}
.nav-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: var(--primary-light); }
.nav-card-icon { font-size: 24px; margin-bottom: var(--sp-3); line-height: 1; }
.nav-card-title { font-size: 14.5px; font-weight: 600; color: var(--text); margin-bottom: var(--sp-1); }
.nav-card-desc { font-size: 12.5px; color: var(--text-muted); line-height: 1.5; }

/* ---------------- BOTONES ---------------- */
.btn, .btn-primary, .btn-secondary {
    display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2);
    padding: 8px var(--sp-4); border-radius: var(--r-md);
    font-size: 13px; font-weight: 500; font-family: inherit;
    cursor: pointer; border: 1px solid var(--border-color); background: var(--surface); color: var(--text);
    transition: background var(--t), border-color var(--t), box-shadow var(--t), color var(--t);
    white-space: nowrap; text-decoration: none; line-height: 1.5;
}
.btn:hover { background: var(--surface-2); border-color: var(--border-strong); }

.btn-primary { background: var(--primary-color); color: #fff; border-color: var(--primary-color); font-weight: 500; }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.btn-primary:active { transform: translateY(1px); }

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

.btn-danger { background: var(--danger-color); color: #fff; border-color: var(--danger-color); }
.btn-danger:hover { background: #991b1b; border-color: #991b1b; }

.btn-sm { padding: 5px var(--sp-3); font-size: 12px; }

.btn:disabled, .btn-primary:disabled, .btn-secondary:disabled {
    opacity: .5; cursor: not-allowed; pointer-events: none;
}

.btn-icon {
    display: inline-flex; align-items: center; justify-content: center;
    background: none; border: none; cursor: pointer; font-size: 14px;
    width: 30px; height: 30px; border-radius: var(--r-sm); color: var(--text-muted);
    text-decoration: none; transition: background var(--t), color var(--t);
    position: relative; font-family: inherit;
}
.btn-icon:hover { background: var(--surface-2); color: var(--text); }
.btn-icon:disabled { opacity: .4; cursor: not-allowed; }

/* Tooltip genérico (data-tip) */
[data-tip] { position: relative; }
[data-tip]::after {
    content: attr(data-tip);
    position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%);
    background: var(--text); color: #fff; padding: 5px 9px; border-radius: var(--r-sm);
    font-size: 11.5px; font-weight: 500; white-space: nowrap;
    opacity: 0; pointer-events: none; transition: opacity var(--t); z-index: 80;
    box-shadow: var(--shadow-md);
}
[data-tip]:hover::after { opacity: 1; }

/* ---------------- FORMULARIOS ---------------- */
.form-group { margin-bottom: var(--sp-4); text-align: left; }
.form-group label { display: block; font-size: 12.5px; font-weight: 500; margin-bottom: 5px; color: var(--text); }

.form-control, .form-group input, .filtros input, .filtros select {
    width: 100%; padding: 8px var(--sp-3);
    border: 1px solid var(--border-color); border-radius: var(--r-md);
    font-size: 13.5px; font-family: inherit; color: var(--text); background: var(--surface);
    transition: border-color var(--t), box-shadow var(--t);
}
.form-control:focus, .form-group input:focus, .filtros input:focus, .filtros select:focus {
    outline: none; border-color: var(--brand); box-shadow: var(--ring);
}
.form-control:disabled { background: var(--surface-2); color: var(--text-muted); cursor: not-allowed; }
select.form-control { cursor: pointer; }
textarea.form-control { resize: vertical; min-height: 62px; }

/* ---------------- FILTROS ---------------- */
.filtros { display: flex; gap: var(--sp-3); align-items: center; flex-wrap: wrap; margin-bottom: var(--sp-4); }
.filtros input { flex: 1; min-width: 210px; }
.filtros select { width: auto; min-width: 150px; }

/* Chips de filtro rápido */
.filtro-chips { display: flex; gap: var(--sp-2); flex-wrap: wrap; margin-bottom: var(--sp-4); }
.chip {
    padding: 6px var(--sp-4); border: 1px solid var(--border-color); background: var(--surface);
    border-radius: var(--r-full); font-size: 12.5px; font-weight: 500; font-family: inherit;
    cursor: pointer; color: var(--text-muted);
    transition: background var(--t), color var(--t), border-color var(--t);
    display: inline-flex; align-items: center; gap: 6px;
}
.chip:hover { border-color: var(--border-strong); color: var(--text); }
.chip.active { background: var(--primary-color); border-color: var(--primary-color); color: #fff; }
.chip .n {
    background: rgba(15,23,42,.08); border-radius: var(--r-full); padding: 0 6px;
    font-size: 11px; font-weight: 700;
}
.chip.active .n { background: rgba(255,255,255,.22); }

/* ---------------- TABLAS ---------------- */
.table-responsive { overflow-x: auto; border-radius: var(--r-md); }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead th {
    background: var(--surface-2); text-align: left;
    padding: 10px var(--sp-3);
    font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .6px;
    color: var(--text-muted); border-bottom: 1px solid var(--border-color); white-space: nowrap;
}
tbody td { padding: 11px var(--sp-3); border-bottom: 1px solid var(--border-color); color: var(--text); vertical-align: middle; }
tbody tr { transition: background var(--t); }
tbody tr:hover { background: var(--primary-50); }
tbody tr:last-child td { border-bottom: none; }
td .sub { font-size: 11.5px; color: var(--text-muted); }

/* ---------------- ACCIONES RÁPIDAS ---------------- */
.acciones-rapidas {
    display: flex; gap: var(--sp-2); flex-wrap: wrap; margin-bottom: var(--sp-5);
}
.accion-rapida {
    display: inline-flex; align-items: center; gap: var(--sp-2);
    padding: 8px var(--sp-4);
    background: var(--surface); border: 1px solid var(--border-color);
    border-radius: var(--r-full); font-size: 13px; font-weight: 500;
    color: var(--text); text-decoration: none; white-space: nowrap;
    transition: background var(--t), border-color var(--t), transform var(--t);
}
.accion-rapida:hover {
    background: var(--primary-50); border-color: var(--primary-light);
    color: var(--primary-color); transform: translateY(-1px);
}

@media (max-width: 768px) {
    .acciones-rapidas { overflow-x: auto; flex-wrap: nowrap; padding-bottom: 4px; }
    .accion-rapida { padding: 9px var(--sp-4); }
}

/* ---------------- FICHA 360° DEL TRABAJADOR ---------------- */
.perfil-cabecera {
    display: flex; align-items: center; gap: var(--sp-4);
    background: var(--surface); border: 1px solid var(--border-color);
    border-radius: var(--r-lg); box-shadow: var(--shadow-xs);
    padding: var(--sp-5); margin-bottom: var(--sp-3);
}
.perfil-avatar {
    width: 56px; height: 56px; border-radius: var(--r-full); flex-shrink: 0;
    background: var(--primary-color); color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: 19px; font-weight: 700; letter-spacing: .5px;
}
.perfil-info { flex: 1; min-width: 0; }
.perfil-info h1 { font-size: 20px; font-weight: 700; letter-spacing: -.3px; margin-bottom: 3px; }
.perfil-sub {
    font-size: 13px; color: var(--text-muted);
    display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap;
}
.perfil-sep { color: var(--text-subtle); }
.perfil-estado { flex-shrink: 0; }
.perfil-chips { display: flex; gap: var(--sp-2); flex-wrap: wrap; margin-bottom: var(--sp-4); }

.evento-ficha { padding: 9px 0; border-bottom: 1px solid var(--border-color); }
.evento-ficha:last-child { border-bottom: none; }

.linea-tiempo-ficha { position: relative; padding-left: 20px; }
.linea-tiempo-ficha::before {
    content: ''; position: absolute; left: 5px; top: 8px; bottom: 8px;
    width: 2px; background: var(--border-color);
}
.linea-tiempo-ficha .evento-ficha { position: relative; }
.linea-tiempo-ficha .evento-ficha::before {
    content: ''; position: absolute; left: -19px; top: 14px;
    width: 8px; height: 8px; border-radius: 50%;
    background: var(--surface); border: 2px solid var(--primary-light);
}

@media (max-width: 768px) {
    .perfil-cabecera { flex-wrap: wrap; }
    .perfil-estado { width: 100%; }
}

/* ---------------- PAGINACIÓN ---------------- */
.paginacion {
    display: flex; align-items: center; justify-content: space-between;
    gap: var(--sp-4); flex-wrap: wrap;
    padding-top: var(--sp-4); margin-top: var(--sp-2);
    border-top: 1px solid var(--border-color);
}
.paginacion-info { font-size: 12.5px; color: var(--text-muted); }
.paginacion-controles { display: flex; align-items: center; gap: 4px; }
.paginacion-btn {
    min-width: 32px; height: 32px; padding: 0 8px;
    border: 1px solid var(--border-color); background: var(--surface);
    border-radius: var(--r-sm); font-size: 12.5px; font-weight: 500;
    font-family: inherit; color: var(--text); cursor: pointer;
    transition: background var(--t), border-color var(--t), color var(--t);
}
.paginacion-btn:hover:not(:disabled):not(.active) { background: var(--surface-2); border-color: var(--border-strong); }
.paginacion-btn.active {
    background: var(--primary-color); border-color: var(--primary-color);
    color: #fff; font-weight: 600;
}
.paginacion-btn:disabled { opacity: .4; cursor: not-allowed; }
.paginacion-puntos { padding: 0 4px; color: var(--text-subtle); font-size: 12.5px; }

@media (max-width: 768px) {
    .paginacion { justify-content: center; }
    .paginacion-info { width: 100%; text-align: center; }
    .paginacion-btn { min-width: 38px; height: 38px; }
}

/* ---------------- BADGES DE ESTADO ---------------- */
.table-status, .badge {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 3px 9px; border-radius: var(--r-full);
    font-size: 11px; font-weight: 700; letter-spacing: .3px; white-space: nowrap;
    border: 1px solid transparent;
}
/* Punto de color: el estado no depende solo del color (accesibilidad) */
.table-status::before, .badge::before {
    content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex-shrink: 0;
}
.table-status.vigente, .badge.ok {
    background: var(--success-bg); color: var(--success-color); border-color: var(--success-border);
}
.table-status.por-vencer, .badge.warn {
    background: var(--warning-bg); color: var(--warning-color); border-color: var(--warning-border);
}
.table-status.vencido, .badge.danger {
    background: var(--danger-bg); color: var(--danger-color); border-color: var(--danger-border);
}
.badge.info { background: var(--info-bg); color: var(--info-color); border-color: var(--info-border); }
.badge.neutro { background: var(--surface-2); color: var(--text-muted); border-color: var(--border-color); }

/* ---------------- ALERTAS ---------------- */
.alert {
    padding: var(--sp-3) var(--sp-4); border-radius: var(--r-md);
    margin-bottom: var(--sp-4); font-size: 13.5px; border-left: 3px solid; border-radius: var(--r-md);
}
.alert-success { background: var(--success-bg); color: var(--success-color); border-color: var(--success-color); }
.alert-danger  { background: var(--danger-bg);  color: var(--danger-color);  border-color: var(--danger-color); }
.alert-warning { background: var(--warning-bg); color: var(--warning-color); border-color: var(--warning-color); }
.alert-info    { background: var(--info-bg);    color: var(--info-color);    border-color: var(--info-color); }

/* Panel "Atención requerida" — alerta accionable */
.panel-atencion {
    background: var(--surface); border: 1px solid var(--danger-border);
    border-left: 3px solid var(--danger-color);
    border-radius: var(--r-lg); box-shadow: var(--shadow-xs);
    margin-bottom: var(--sp-6); overflow: hidden;
}
.panel-atencion.ok { border-color: var(--success-border); border-left-color: var(--success-color); }
.panel-atencion-head {
    display: flex; align-items: center; gap: var(--sp-3);
    padding: var(--sp-4) var(--sp-5); border-bottom: 1px solid var(--border-color);
}
.panel-atencion.ok .panel-atencion-head { border-bottom: none; }
.panel-atencion-titulo { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .7px; color: var(--danger-color); }
.panel-atencion.ok .panel-atencion-titulo { color: var(--success-color); }
.panel-atencion-sub { font-size: 13px; color: var(--text-muted); margin-left: auto; }

.atencion-item {
    display: flex; align-items: center; gap: var(--sp-4);
    padding: var(--sp-4) var(--sp-5); border-bottom: 1px solid var(--border-color);
    flex-wrap: wrap;
}
.atencion-item:last-child { border-bottom: none; }
.atencion-datos { display: flex; gap: var(--sp-8); flex: 1; flex-wrap: wrap; min-width: 0; }
.atencion-campo { min-width: 0; }
.atencion-campo .k { font-size: 10.5px; text-transform: uppercase; letter-spacing: .6px; color: var(--text-subtle); font-weight: 600; }
.atencion-campo .v { font-size: 13.5px; font-weight: 500; color: var(--text); }
.atencion-campo .v.critico { color: var(--danger-color); font-weight: 600; }

/* ---------------- MODAL / DRAWER ---------------- */
.modal-overlay {
    position: fixed; inset: 0; background: rgba(15,23,42,.5);
    display: none; align-items: center; justify-content: center; z-index: 100;
    padding: var(--sp-4); backdrop-filter: blur(2px);
}
.modal-overlay.open { display: flex; }
.modal-box {
    background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow-lg);
    padding: var(--sp-6); width: 100%; max-width: 520px; max-height: 88vh; overflow-y: auto;
    animation: modalIn .18s ease;
}
@keyframes modalIn { from { opacity: 0; transform: translateY(10px) scale(.99); } to { opacity: 1; transform: none; } }
.modal-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: var(--sp-5); padding-bottom: var(--sp-4); border-bottom: 1px solid var(--border-color);
}
.modal-header h3 { font-size: 16px; font-weight: 600; margin: 0; }
.modal-close {
    background: none; border: none; cursor: pointer; font-size: 17px; color: var(--text-muted);
    padding: 4px 8px; border-radius: var(--r-sm); line-height: 1; transition: background var(--t);
}
.modal-close:hover { background: var(--surface-2); color: var(--text); }
.modal-actions {
    display: flex; justify-content: flex-end; gap: var(--sp-3);
    margin-top: var(--sp-6); padding-top: var(--sp-4); border-top: 1px solid var(--border-color);
}

/* Drawer lateral */
.drawer-overlay {
    position: fixed; inset: 0; background: rgba(15,23,42,.5);
    display: none; z-index: 100; backdrop-filter: blur(2px);
}
.drawer-overlay.open { display: block; }
.drawer {
    position: fixed; top: 0; right: 0; bottom: 0; width: 100%; max-width: 440px;
    background: var(--surface); box-shadow: var(--shadow-lg);
    display: flex; flex-direction: column; z-index: 101;
    transform: translateX(100%); transition: transform .22s cubic-bezier(.4,0,.2,1);
}
.drawer.open { transform: none; }
.drawer-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: var(--sp-5); border-bottom: 1px solid var(--border-color); flex-shrink: 0;
}
.drawer-header h3 { font-size: 16px; font-weight: 600; }
.drawer-body { flex: 1; overflow-y: auto; padding: var(--sp-5); }
.drawer-footer { padding: var(--sp-4) var(--sp-5); border-top: 1px solid var(--border-color); display: flex; gap: var(--sp-3); justify-content: flex-end; flex-shrink: 0; }

/* ---------------- TOASTS ---------------- */
.toast-stack {
    position: fixed; bottom: var(--sp-6); right: var(--sp-6);
    display: flex; flex-direction: column; gap: var(--sp-3); z-index: 200; pointer-events: none;
}
.toast {
    display: flex; align-items: flex-start; gap: var(--sp-3);
    background: var(--surface); border: 1px solid var(--border-color);
    border-left: 3px solid var(--brand);
    border-radius: var(--r-md); box-shadow: var(--shadow-lg);
    padding: var(--sp-3) var(--sp-4); min-width: 290px; max-width: 400px;
    pointer-events: auto; animation: toastIn .22s ease;
}
@keyframes toastIn { from { opacity: 0; transform: translateX(24px); } to { opacity: 1; transform: none; } }
.toast.saliendo { animation: toastOut .18s ease forwards; }
@keyframes toastOut { to { opacity: 0; transform: translateX(24px); } }
.toast.ok     { border-left-color: var(--success-color); }
.toast.error  { border-left-color: var(--danger-color); }
.toast.warn   { border-left-color: var(--warning-color); }
.toast-ico { font-size: 15px; line-height: 1.3; flex-shrink: 0; }
.toast-body { flex: 1; min-width: 0; }
.toast-title { font-size: 13px; font-weight: 600; }
.toast-desc { font-size: 12.5px; color: var(--text-muted); margin-top: 1px; line-height: 1.45; }
.toast-close { background: none; border: none; cursor: pointer; color: var(--text-subtle); font-size: 14px; padding: 0 2px; line-height: 1; }
.toast-close:hover { color: var(--text); }

/* ---------------- ESTADO VACÍO ---------------- */
.empty-state { text-align: center; padding: var(--sp-10) var(--sp-5); }
.empty-state .ico { font-size: 34px; margin-bottom: var(--sp-3); opacity: .85; }
.empty-state h3 { font-size: 15px; font-weight: 600; color: var(--text); margin-bottom: var(--sp-2); }
.empty-state p { font-size: 13px; color: var(--text-muted); max-width: 380px; margin: 0 auto var(--sp-4); line-height: 1.55; }
td .empty-state { padding: var(--sp-8) var(--sp-4); }

/* ---------------- SKELETON ---------------- */
.skeleton {
    background: linear-gradient(90deg, var(--surface-2) 25%, #eaeff5 50%, var(--surface-2) 75%);
    background-size: 200% 100%; animation: shimmer 1.3s infinite; border-radius: var(--r-sm);
}
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.skeleton-line { height: 12px; margin: 6px 0; }
.skeleton-card { height: 96px; border-radius: var(--r-lg); }

/* ---------------- TABS ---------------- */
.tabs { display: flex; gap: var(--sp-1); border-bottom: 1px solid var(--border-color); margin-bottom: var(--sp-5); overflow-x: auto; }
.tab-btn {
    padding: 9px var(--sp-4); background: none; border: none; border-bottom: 2px solid transparent;
    cursor: pointer; font-size: 13.5px; font-weight: 500; color: var(--text-muted);
    font-family: inherit; white-space: nowrap; transition: color var(--t), border-color var(--t);
}
.tab-btn:hover { color: var(--text); }
.tab-btn.active { color: var(--primary-color); border-bottom-color: var(--primary-color); font-weight: 600; }
.tab-panel { display: none; }
.tab-panel.active { display: block; animation: fadeIn .18s ease; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* ---------------- BARRAS DE PROGRESO / GRÁFICO SIMPLE ---------------- */
.chart-bar-row { display: grid; grid-template-columns: 150px 1fr 62px; align-items: center; gap: var(--sp-3); margin-bottom: 9px; }
.chart-bar-label { font-size: 12.5px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chart-bar-track { background: var(--surface-2); border-radius: var(--r-full); height: 9px; overflow: hidden; }
.chart-bar-fill { height: 100%; background: var(--brand); border-radius: var(--r-full); transition: width .5s cubic-bezier(.4,0,.2,1); }
.chart-bar-fill.ok    { background: var(--success-color); }
.chart-bar-fill.warn  { background: var(--warning-color); }
.chart-bar-fill.danger{ background: var(--danger-color); }
.chart-bar-value { font-size: 12.5px; font-weight: 600; text-align: right; color: var(--text); }

/* Barra apilada de estado documental */
.stacked-bar { display: flex; height: 12px; border-radius: var(--r-full); overflow: hidden; background: var(--surface-2); margin-bottom: var(--sp-3); }
.stacked-seg { transition: width .5s cubic-bezier(.4,0,.2,1); }
.stacked-seg.ok { background: var(--success-color); }
.stacked-seg.warn { background: var(--warning-color); }
.stacked-seg.danger { background: var(--danger-color); }
.stacked-leyenda { display: flex; gap: var(--sp-5); flex-wrap: wrap; font-size: 12.5px; }
.stacked-leyenda span { display: inline-flex; align-items: center; gap: 6px; color: var(--text-muted); }
.stacked-leyenda i { width: 9px; height: 9px; border-radius: 2px; display: inline-block; }

/* ---------------- REPORTES ---------------- */
.modulo-section { margin-bottom: var(--sp-8); }
.modulo-titulo {
    font-size: 14px; font-weight: 600; color: var(--text);
    padding-bottom: var(--sp-3); margin-bottom: var(--sp-4);
    border-bottom: 1px solid var(--border-color);
    display: flex; align-items: center; gap: var(--sp-2);
}
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(175px, 1fr)); gap: var(--sp-3); margin-bottom: var(--sp-4); }
.kpi-card {
    background: var(--surface); border: 1px solid var(--border-color);
    border-radius: var(--r-md); padding: var(--sp-4); border-left: 3px solid var(--border-strong);
}
.kpi-card.ok    { border-left-color: var(--success-color); }
.kpi-card.warning { border-left-color: var(--warning-color); }
.kpi-card.alert { border-left-color: var(--danger-color); }
.kpi-value { font-size: 22px; font-weight: 700; color: var(--text); line-height: 1.2; letter-spacing: -.5px; }
.kpi-card.ok .kpi-value { color: var(--success-color); }
.kpi-card.warning .kpi-value { color: var(--warning-color); }
.kpi-card.alert .kpi-value { color: var(--danger-color); }
.kpi-label { font-size: 11.5px; color: var(--text-muted); margin-top: 2px; font-weight: 500; }

/* ---------------- BADGES AUXILIARES (documentación / catálogos) -------- */
.codigo-badge {
    display: inline-block; background: var(--primary-color); color: #fff;
    font-weight: 700; font-size: 11.5px; padding: 3px 9px; border-radius: var(--r-sm);
    min-width: 32px; text-align: center;
}
.cat-badge {
    display: inline-block; font-size: 11px; padding: 2px 9px; border-radius: var(--r-full);
    background: var(--surface-2); color: var(--text-muted); border: 1px solid var(--border-color);
    text-transform: capitalize; font-weight: 500;
}
.archivos-badge { font-weight: 600; color: var(--brand); }
.archivos-badge.vacio { color: var(--text-subtle); font-weight: 400; }

.catalogo-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--sp-4); }

/* =========================================================
   RESPONSIVE
   ========================================================= */
@media (max-width: 1100px) {
    .global-search { max-width: 260px; }
    .user-btn-info { display: none; }
}

@media (max-width: 900px) {
    .catalogo-grid { grid-template-columns: 1fr; }
    .atencion-datos { gap: var(--sp-5); }
}

@media (max-width: 768px) {
    /* Sidebar como panel deslizante */
    .sidebar {
        position: fixed; top: 0; bottom: 0; left: 0;
        transform: translateX(-100%); transition: transform var(--t);
        width: var(--sidebar-w) !important;
    }
    .sidebar.mobile-open { transform: none; }
    .sidebar.collapsed { width: var(--sidebar-w) !important; }
    .sidebar.collapsed .sidebar-brand-sub,
    .sidebar.collapsed .sidebar-group-label,
    .sidebar.collapsed .sidebar-menu a .txt,
    .sidebar.collapsed .sidebar-user-info { display: revert; }
    .sidebar.collapsed .sidebar-brand img { max-width: 168px; }
    .sidebar.collapsed .sidebar-menu a { justify-content: flex-start; padding: 9px var(--sp-3); }
    .sidebar.collapsed .sidebar-menu a::after { display: none; }

    .content-area { padding: var(--sp-4); }
    .top-bar { padding: 0 var(--sp-3); gap: var(--sp-2); }
    .breadcrumb a, .breadcrumb-sep { display: none; }
    .breadcrumb .actual { font-size: 14px; }

    /* Buscador global: se despliega a ancho completo bajo el header */
    .global-search {
        position: absolute; top: var(--header-h); left: 0; right: 0; max-width: none;
        margin: 0; padding: var(--sp-3); background: var(--surface);
        border-bottom: 1px solid var(--border-color); box-shadow: var(--shadow); display: none;
    }
    .global-search.mobile-open { display: block; }
    .search-results { left: var(--sp-3); right: var(--sp-3); }

    .dashboard-grid { grid-template-columns: 1fr; gap: var(--sp-3); }
    .nav-cards { grid-template-columns: 1fr; }
    .kpi-grid { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }

    .card { padding: var(--sp-4); border-radius: var(--r-md); }
    .stat-card { padding: var(--sp-4); }
    .stat-number { font-size: 26px; }

    .modal-box { padding: var(--sp-5); max-height: 92vh; }
    .modal-actions { flex-direction: column-reverse; }
    .modal-actions .btn, .modal-actions .btn-primary, .modal-actions .btn-secondary { width: 100%; }

    .toast-stack { left: var(--sp-3); right: var(--sp-3); bottom: var(--sp-3); }
    .toast { min-width: 0; max-width: none; }

    .drawer { max-width: none; }

    /* Tablas: scroll horizontal con indicador */
    .table-responsive { -webkit-overflow-scrolling: touch; }
    thead th, tbody td { padding: 9px var(--sp-2); font-size: 12.5px; }

    .chart-bar-row { grid-template-columns: 110px 1fr 48px; }
    .atencion-item { flex-direction: column; align-items: stretch; gap: var(--sp-3); }
    .atencion-item .btn, .atencion-item .btn-primary { width: 100%; }
    .filtros input, .filtros select { width: 100%; flex: none; min-width: 0; }

    /* Objetivos táctiles más grandes */
    .btn-icon { width: 36px; height: 36px; }
    .chip { padding: 8px var(--sp-4); }
}

@media (max-width: 420px) {
    .content-area { padding: var(--sp-3); }
    .page-intro h1 { font-size: 19px; }
    .filtro-chips { overflow-x: auto; flex-wrap: nowrap; padding-bottom: 4px; }
}

/* =========================================================
   IMPRESIÓN
   ========================================================= */
@media print {
    .sidebar, .top-bar, .toast-stack, .sidebar-overlay, .filtro-chips, .filtros { display: none !important; }
    .app-layout { display: block; height: auto; }
    .main-content { overflow: visible; }
    .content-area { overflow: visible; padding: 0; }
    .card { box-shadow: none; border: 1px solid #ccc; break-inside: avoid; }
    body { background: #fff; }
}

/* Utilidades mínimas */
.text-muted { color: var(--text-muted); }
.mb-0 { margin-bottom: 0 !important; }
.flex-between { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); flex-wrap: wrap; }
.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;
}
