:root {
    /* Sprint 24: Light es el default, Dark via [data-theme="dark"] */
    color-scheme: light dark;

    /* Colores Principales (invariantes de tema) */
    --primary: #667eea;
    --primary-dark: #764ba2;
    --secondary: #4facfe;

    /* Estados (invariantes) */
    --success: #16a34a;
    --warning: #d97706;
    --error: #dc2626;
    --info: #0284c7;

    /* ── Paleta Light (Default) ── */
    --bg-dark: #F8FAFC;
    --bg-card: #f1f5f9;
    --bg-surface: #e2e8f0;
    --text-primary: #1E293B;
    --text-secondary: #475569;
    --border: #E2E8F0;

    /* Efectos Light */
    --glass: #FFFFFF;
    --glass-border: #E2E8F0;
    --shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.08);

    /* Radios */
    --radius-lg: 16px;
    --radius-md: 12px;
    --radius-sm: 8px;

    /* Fuentes */
    --font-main: 'Inter', system-ui, -apple-system, sans-serif;
    --font-title: 'Outfit', sans-serif;

    /* Light-specific tokens para hovers y tablas */
    --hover-bg: #F1F5F9;
    --hover-bg-subtle: #F8FAFC;
    --table-header-bg: #F8FAFC;
    --table-border: #E2E8F0;
    --input-bg: #F1F5F9;
    --input-focus-bg: #E2E8F0;
    --select-arrow-color: %2364748B;
    --option-bg: #FFFFFF;
    --option-color: #1E293B;
    --option-checked-bg: #F1F5F9;
    --option-checked-color: #667eea;
    --optgroup-bg: #F8FAFC;
    --optgroup-color: #64748B;
    --sidebar-bg: #FFFFFF;
    --sidebar-width: 14rem;
    --sidebar-collapsed: 4rem;
    --modal-overlay: rgba(0, 0, 0, 0.4);
    --btn-outline-hover: #F1F5F9;
    --text-gradient-start: #1E293B;
    --bg-global: #ffffff;
    --border-color: #e2e8f0;

    /* Escala de espaciado */
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 20px;
    --space-6: 24px;
    --space-7: 32px;
    --space-8: 48px;

    /* Escala tipográfica */
    --text-xs:   0.75rem;
    --text-sm:   0.875rem;
    --text-base: 1rem;
    --text-lg:   1.125rem;
    --text-xl:   1.25rem;
    --text-2xl:  1.5rem;
    --text-3xl:  1.875rem;
    --text-4xl:  2rem;

    /* Tokens de botón */
    --btn-padding:    var(--space-3) var(--space-5);
    --btn-padding-sm: var(--space-2) var(--space-3);
    --btn-font:       var(--text-base);
}

    /* ── Paleta Dark ── */
[data-theme="dark"] {
    color-scheme: dark;

    --bg-dark: #0f172a;
    --bg-card: #1e293b;
    --bg-surface: #1e293b;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --border: #334155;

    --glass: rgba(15, 23, 42, 0.7);
    --glass-border: rgba(255, 255, 255, 0.1);
    --shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);

    /* Estados oscuros más brillantes */
    --success: #38ef7d;
    --warning: #fee140;
    --error: #f5576c;
    --info: #00d4ff;

    --hover-bg: rgba(255, 255, 255, 0.05);
    --hover-bg-subtle: rgba(255, 255, 255, 0.02);
    --table-header-bg: rgba(255, 255, 255, 0.02);
    --table-border: rgba(255, 255, 255, 0.04);
    --input-bg: rgba(0, 0, 0, 0.2);
    --input-focus-bg: rgba(0, 0, 0, 0.3);
    --select-arrow-color: %2394a3b8;
    --option-bg: #0f172a;
    --option-color: #f8fafc;
    --option-checked-bg: #1e293b;
    --option-checked-color: #667eea;
    --optgroup-bg: #020617;
    --optgroup-color: #94a3b8;
    --sidebar-bg: #020617;
    --modal-overlay: rgba(0, 0, 0, 0.8);
    --btn-outline-hover: rgba(255, 255, 255, 0.05);
    --text-gradient-start: #fff;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-main);
    background-color: var(--bg-dark);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden; /* hidden respeta elementos con position:fixed/absolute — clip los cortaría */
}

h1,
h2,
h3,
h4,
.brand-font {
    font-family: var(--font-title);
    font-weight: 700;
}

a {
    text-decoration: none;
    color: inherit;
    transition: 0.3s;
}

ul {
    list-style: none;
}

/* Utils */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
}

.btn {
    padding: 12px 28px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-primary);
}

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

.glass-card {
    background: var(--glass);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: 24px;
}

.text-gradient {
    background: linear-gradient(135deg, var(--text-gradient-start) 0%, var(--primary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Animaciones */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.8s ease forwards;
}

/* ── Sidebar — Dock macOS ── */
.sidebar {
    position: fixed;
    left: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 48px;
    background: none;
    border: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    z-index: 100;
    padding: 8px 0;
    overflow: visible !important;
}

.sidebar .logo {
    font-family: var(--font-title);
    font-size: 1.5rem;
    margin-bottom: 40px;
}

.sidebar .nav-section {
    margin: 32px 0 16px;
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.nav-item {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    background: var(--bg-card);
    border: 1px solid var(--border);
    transition: transform 0.15s ease;
    position: relative;
    cursor: pointer;
    text-decoration: none;
    flex-shrink: 0;
    overflow: visible;
    /* reset button defaults */
    font-size: inherit;
    font-family: inherit;
    padding: 0;
    box-sizing: border-box;
}

.nav-item:hover {
    transform: scale(1.4);
    color: var(--text-primary);
    background: var(--bg-surface);
    z-index: 10;
}

.nav-item.active {
    background: rgba(102, 126, 234, 0.15);
    color: #667eea;
    border-color: rgba(102, 126, 234, 0.3);
}

/* Efecto magnético — ítems adyacentes */
.nav-item:hover + .nav-item,
.nav-item:has(+ .nav-item:hover) {
    transform: scale(1.2);
}

/* Label tooltip */
/* .nav-label — fuente de datos para #dock-tooltip. No se muestra directamente. */
.nav-label {
    display: none;
}

/* ── Main Content Base ── */
/* Sidebar es dock flotante — solo reservar 64px para el dock */
.main-content,
.main {
    margin-left: 64px;
    transition: none;
}

.main-content {
    flex: 1;
    padding: 40px;
}

/* ── Dashboard Layout ── */
body.dashboard-layout {
    display: flex;
    min-height: 100vh;
    background-color: var(--bg-dark);
}

/* Mobile header — oculto en desktop, !important para pisar dashboard_empresa.css */
.mobile-header {
    display: none !important;
}

/* Sidebar dock: pisar dashboard_empresa.css que pone padding:12px 16px */
.sidebar .nav-item {
    padding: 0 !important;
    width: 40px !important;
    height: 40px !important;
    margin-bottom: 0 !important;
}

/* ── Form Inputs ── */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px 16px;
    background: var(--input-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.95rem;
    font-family: var(--font-main);
    transition: all 0.2s ease;
    outline: none;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.15);
    background: var(--input-focus-bg);
}

/* ── Fix Global Efecto Fantasma en select/option ── */
select,
.form-group select {
    background-color: var(--bg-card);
    color: var(--text-primary);
    cursor: pointer;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='var(--select-arrow-color)' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

select:hover,
.form-group select:hover {
    border-color: var(--text-secondary);
}

/* Reset CRÍTICO: fondo y color de cada <option> — !important para vencer estilos nativos del SO */
select option,
.form-group select option,
.glass-card select option {
    background-color: var(--option-bg) !important;
    color: var(--option-color) !important;
    padding: 8px 12px;
}

select option:checked {
    background-color: var(--option-checked-bg);
    color: var(--option-checked-color);
}

select option:hover,
select option:focus {
    background-color: var(--option-checked-bg);
}

/* optgroup headers */
select optgroup {
    background-color: var(--optgroup-bg);
    color: var(--optgroup-color);
    font-style: normal;
    font-weight: 600;
}

/* Select dentro de tablas, modales y otros contextos fuera de .form-group */
td select,
.modal select,
.glass-card select,
.action-bar select,
div select {
    background-color: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 8px 36px 8px 12px;
    font-size: 0.9rem;
    font-family: var(--font-main);
    outline: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='var(--select-arrow-color)' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
}

/* Disabled state */
select:disabled,
.form-group select:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.form-group input::placeholder {
    color: rgba(148, 163, 184, 0.5);
}

/* ── Tables Base ── */
table {
    width: 100%;
    border-collapse: collapse;
}

th {
    text-align: left;
    padding: 12px 16px;
    color: var(--text-secondary);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border);
    background: var(--table-header-bg);
}

td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--table-border);
    font-size: 0.9rem;
}

tr:hover {
    background: var(--hover-bg-subtle);
}

/* ── Badges ── */
.badge {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.badge-supervisor {
    background: rgba(168, 85, 247, 0.15);
    color: #9333ea;
}

.badge-encargado {
    background: rgba(59, 130, 246, 0.15);
    color: #2563eb;
}

.badge-empleado {
    background: rgba(16, 185, 129, 0.15);
    color: #059669;
}

[data-theme="dark"] .badge-supervisor {
    background: rgba(168, 85, 247, 0.2);
    color: #c084fc;
}

[data-theme="dark"] .badge-encargado {
    background: rgba(59, 130, 246, 0.2);
    color: #60a5fa;
}

[data-theme="dark"] .badge-empleado {
    background: rgba(16, 185, 129, 0.2);
    color: #4ade80;
}

/* ── Stat Grid ── */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 15px;
    margin-bottom: 30px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    text-align: center;
}

.stat-card .num {
    display: block;
    font-size: 2.2rem;
    font-weight: 700;
    color: var(--primary);
    font-family: var(--font-title);
}

.stat-card .label {
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-top: 4px;
}

/* ── Tabs Base ── */
.tab-btn {
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.tab-btn:hover:not(.active) {
    background: var(--hover-bg);
    color: var(--text-primary);
}

.tab-btn.active {
    background: var(--bg-surface);
    color: var(--primary);
    font-weight: 600;
}

.tab-content {
    display: none;
    animation: fadeIn 0.3s ease;
}

.tab-content.active {
    display: block;
}

/* ── Modal Base ── */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    background: var(--modal-overlay);
    backdrop-filter: blur(6px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    padding: 30px;
    animation: modalIn 0.3s ease;
}

@keyframes modalIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* ── Sidebar Dock — Nav ── */
.sidebar nav {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    overflow-y: auto;
    overflow-x: visible;
    padding: 8px 0;
    /* scrollbar oculta — solo scroll funcional */
    scrollbar-width: none;
}

/* Forzar que el nav no corte tooltips absolutos */
.sidebar > nav {
    overflow-x: visible !important;
}

.sidebar nav::-webkit-scrollbar {
    display: none;
}

/* ── Sidebar Nav Icon ── */
.sidebar .nav-icon {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
}

/* nav-text oculto — reemplazado por .nav-label tooltip */
.nav-text {
    display: none;
}

/* ── Nav Badge (solicitudes pendientes) ── */
.nav-badge {
    background: var(--warning);
    color: #000;
    padding: 2px 6px;
    border-radius: 10px;
    font-size: 0.65rem;
    font-weight: 700;
    margin-left: auto;
    flex-shrink: 0;
}

/* ── Nav Item Danger (logout) ── */
.nav-item-danger {
    color: var(--error) !important;
}

.nav-item-danger:hover {
    background: rgba(239, 68, 68, 0.1) !important;
    color: var(--error) !important;
}

/* ── Sidebar Overlay (mobile) ── */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: var(--modal-overlay);
    z-index: 99;
}

.sidebar-overlay.active {
    display: block;
}

/* ── Feature Gating — Lock Badge ── */
.nav-item-locked {
    opacity: 0.5;
}

.nav-item-locked:hover {
    opacity: 0.7;
}

.lock-badge {
    margin-left: auto;
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
    border-radius: 6px;
    padding: 2px 6px;
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
}

/* ── Upgrade Plan Modal ── */
.upgrade-modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9999;
    align-items: center;
    justify-content: center;
}

.upgrade-modal-overlay.active {
    display: flex;
}

.upgrade-modal {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 40px;
    max-width: 420px;
    width: 90%;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.upgrade-modal h3 {
    font-family: var(--font-title);
    font-size: 1.4rem;
    margin: 15px 0 10px;
    color: var(--text-primary);
}

.upgrade-modal p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 20px;
}

.upgrade-modal .plan-badge {
    display: inline-block;
    padding: 4px 14px;
    border-radius: 16px;
    background: rgba(139, 92, 246, 0.12);
    color: var(--primary);
    font-weight: 600;
    font-size: 0.85rem;
    margin-bottom: 20px;
}

.upgrade-modal-btns {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.upgrade-modal-btns a,
.upgrade-modal-btns button {
    padding: 10px 22px;
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    border: none;
}

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

.upgrade-btn-secondary {
    background: var(--bg-surface);
    color: var(--text-secondary);
}

/* ── Mobile — Dock abajo ── */
/* ── Mobile — Hamburguesa + panel lateral ── */
@media (max-width: 640px) {

    /* ── Prevenir overflow horizontal (body es flex-container) ── */
    html {
        overflow-x: hidden !important;
    }

    /* ── Mobile header: hamburguesa izquierda, logo compacto ── */
    .mobile-header {
        display: flex !important;
        position: fixed !important;
        top: 0 !important; left: 0 !important; right: 0 !important;
        height: 40px !important;
        background: var(--bg-card) !important;
        border-bottom: 1px solid var(--border) !important;
        align-items: center !important;
        padding: 0 10px !important;
        z-index: 9998 !important;
        gap: 6px !important;
    }
    .mobile-header #mobileMenuBtn {
        flex-shrink: 0 !important;
        font-size: 1.2rem !important;
        min-width: 32px !important;
        min-height: 32px !important;
        padding: 0 !important;
    }
    .mobile-header .logo {
        flex: 0 0 auto !important;
        max-width: 120px !important;
        text-align: left !important;
        font-size: 0.85rem !important;
        margin-bottom: 0 !important;
        letter-spacing: 0.03em !important;
    }

    /* ── Sidebar: panel lateral oculto por defecto ── */
    .sidebar {
        top: 0 !important;
        left: -300px !important;
        bottom: 0 !important;
        right: auto !important;
        height: 100% !important;
        width: 260px !important;
        border-radius: 0 !important;
        flex-direction: column !important;
        align-items: flex-start !important;
        padding: 64px 8px 16px !important;
        background: var(--bg-card) !important;
        border-right: 1px solid var(--border) !important;
        transform: none !important;
        transition: left 0.25s ease !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
        box-shadow: 4px 0 24px rgba(0,0,0,0.3) !important;
        z-index: 9999 !important;
        visibility: hidden !important;
    }
    .sidebar.active {
        left: 0 !important;
        visibility: visible !important;
    }
    .sidebar nav {
        flex-direction: column !important;
        align-items: stretch !important;
        overflow-x: hidden !important;
        overflow-y: visible !important;
        width: 100% !important;
        gap: 2px !important;
    }

    /* Nav-items: ancho completo con texto */
    .sidebar .nav-item {
        width: 100% !important;
        height: auto !important;
        min-height: 44px !important;
        justify-content: flex-start !important;
        padding: 0 14px !important;
        gap: 12px !important;
        border-radius: 8px !important;
        transform: none !important;
    }
    .sidebar .nav-item:hover,
    .sidebar .nav-item:hover + .nav-item,
    .sidebar .nav-item:has(+ .nav-item:hover) { transform: none !important; }

    /* Labels visibles en sidebar mobile */
    .nav-label {
        display: inline !important;
        position: static !important;
        opacity: 1 !important;
        visibility: visible !important;
        background: none !important;
        border: none !important;
        box-shadow: none !important;
        padding: 0 !important;
        font-size: 0.875rem !important;
        color: inherit !important;
        white-space: nowrap !important;
    }

    /* Ocultar tooltip flotante (labels ya visibles) */
    #dock-tooltip { display: none !important; }

    /* ── Top-header interno oculto en mobile (mobile-header lo reemplaza) ── */
    .top-header { display: none !important; }

    /* ── Content: flex shrink + constrain width ── */
    .main-content,
    .main {
        flex: 1 !important;
        min-width: 0 !important;
        width: 100% !important;
        max-width: 100vw !important;
        margin-left: 0 !important;
        padding-top: 50px !important;
        padding-bottom: 16px !important;
        padding-left: 8px !important;
        padding-right: 8px !important;
        overflow-x: hidden !important;
        box-sizing: border-box !important;
    }

    /* ── Grids ── */
    .stat-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 6px !important;
    }
    .main [style*="minmax(300"],
    .main [style*="minmax(250"] {
        grid-template-columns: 1fr !important;
        display: grid !important;
    }

    /* ── Cards ── */
    .glass-card, .card {
        padding: 10px !important;
        max-width: 100% !important;
        overflow-x: hidden !important;
    }

    /* ── Tablas ── */
    .glass-card table,
    .card table,
    .main table {
        display: block !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
        white-space: nowrap !important;
    }

    /* ── Botones globales ── */
    .btn {
        min-height: 36px !important;
        padding: 7px 10px !important;
        font-size: 0.72rem !important;
    }

    /* ── Charts ── */
    canvas {
        max-height: 180px !important;
    }

    /* ── Textos grandes ── */
    .brand-font[style*="2rem"]  { font-size: 1.15rem !important; }
    .brand-font[style*="1.5rem"]{ font-size: 0.95rem !important; }
    h2.brand-font               { font-size: 1rem !important; }

    /* ── Page header ── */
    .page-header {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 8px !important;
        margin-bottom: 10px !important;
    }
    .page-header .brand-font { font-size: 1.1rem !important; }
    .page-header p           { font-size: 0.78rem !important; }

    /* ── Action bar: 2 columnas ── */
    .action-bar {
        width: 100% !important;
        flex-wrap: wrap !important;
        gap: 6px !important;
    }
    .action-bar .btn {
        flex: 1 1 calc(50% - 3px) !important;
        min-width: 0 !important;
        justify-content: center !important;
        text-align: center !important;
        font-size: 0.7rem !important;
        padding: 7px 6px !important;
        min-height: 34px !important;
    }

    /* ── Stats panel — ancho explícito para evitar overflow ── */
    .stats-panel {
        padding: 10px !important;
        margin-bottom: 12px !important;
        width: calc(100vw - 16px) !important;
        max-width: calc(100vw - 16px) !important;
        box-sizing: border-box !important;
        overflow: hidden !important;
        border-radius: 12px !important;
    }
    .stats-panel-header {
        flex-wrap: wrap !important;
        gap: 8px !important;
        margin-bottom: 12px !important;
        align-items: flex-start !important;
    }
    .stats-panel-header h2 {
        font-size: 0.95rem !important;
        flex: 1 1 100% !important;
    }
    .stats-panel-header > div {
        width: 100% !important;
        justify-content: flex-end !important;
    }

    /* ── Stat grid: ancho completo dentro del panel ── */
    .stat-grid {
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
    }

    /* ── Metric cards ── */
    .metric-card {
        padding: 8px !important;
        gap: 6px !important;
        overflow: hidden !important;
        min-width: 0 !important;
    }
    .metric-card .num   { font-size: 1.1rem !important; }
    .metric-card .label { font-size: 0.6rem !important; }
    .metric-icon        { width: 32px !important; height: 32px !important; font-size: 0.9rem !important; flex-shrink: 0 !important; }

    /* ── Dropdown notificaciones: ancho viewport ── */
    #notifDropdown {
        width: calc(100vw - 32px) !important;
        right: -40px !important;
    }

    /* ── Search container: 1 fila search+filtros, ocultar densidad ── */
    .search-container {
        flex-wrap: wrap !important;
        gap: 6px !important;
    }
    .search-container .search-bar {
        flex: 1 !important;
        min-width: 0 !important;
    }
    /* Ocultar botones de densidad (no útiles en mobile) */
    .search-container > div[style*="border-radius:10px"],
    .search-container > div[style*="border-radius: 10px"] {
        display: none !important;
    }

    /* ── Charts containers: 1 columna (todos los minmax) ── */
    .charts-container {
        grid-template-columns: 1fr !important;
        gap: 8px !important;
    }
    .main [style*="minmax(450"],
    .main [style*="minmax(400"],
    .main [style*="minmax(300"],
    .main [style*="minmax(250"] {
        grid-template-columns: 1fr !important;
        display: grid !important;
    }

    /* ── Chart boxes (clase .chart-box): reducir altura ── */
    .chart-box {
        height: 150px !important;
        padding: 10px !important;
    }
    .chart-box h4 { font-size: 0.72rem !important; margin-bottom: 4px !important; }

    /* ── Charts en .card: reducir min-height y padding inline ── */
    .charts-container .card {
        min-height: 0 !important;
        padding: 10px !important;
    }
    /* Canvas wrapper height dentro de .card */
    .charts-container .card > div {
        height: 150px !important;
        overflow: hidden !important;
    }

    /* ── Action bars genéricas: wrap ── */
    .main > div > [style*="display:flex; gap"] {
        flex-wrap: wrap !important;
    }

    /* ═══════════════════════════════
       AJUSTES — mobile
    ════════════════════════════════ */
    #sectionAjustes .tabs {
        gap: 0 !important;
        overflow-x: auto !important;
    }
    #sectionAjustes .tab-btn {
        padding: 8px 14px !important;
        font-size: 0.8rem !important;
        white-space: nowrap !important;
    }
    #sectionAjustes .settings-card {
        padding: 14px !important;
        margin-bottom: 12px !important;
    }
    #sectionAjustes .settings-card h3 {
        font-size: 0.9rem !important;
        margin-bottom: 4px !important;
    }
    #sectionAjustes .settings-card p.desc {
        font-size: 0.75rem !important;
        margin-bottom: 12px !important;
    }
    #sectionAjustes .form-row,
    #sectionAjustes .form-row.three {
        grid-template-columns: 1fr !important;
        gap: 10px !important;
        margin-bottom: 10px !important;
    }
    #sectionAjustes .f-group label {
        font-size: 0.72rem !important;
        margin-bottom: 4px !important;
    }
    #sectionAjustes .f-group input,
    #sectionAjustes .f-group select {
        font-size: 0.85rem !important;
        padding: 9px 10px !important;
    }
    #sectionAjustes .btn-group {
        flex-wrap: wrap !important;
        gap: 8px !important;
        margin-top: 12px !important;
    }
    #sectionAjustes .btn-group .btn {
        flex: 1 1 calc(50% - 4px) !important;
        justify-content: center !important;
    }
    #sectionAjustes .toggle-row {
        flex-direction: row !important;
        align-items: center !important;
        padding: 10px 0 !important;
        gap: 8px !important;
    }
    #sectionAjustes .toggle-info {
        gap: 10px !important;
        flex: 1 !important;
        min-width: 0 !important;
    }
    #sectionAjustes .toggle-info .icon-wrap {
        width: 32px !important;
        height: 32px !important;
        flex-shrink: 0 !important;
    }
    #sectionAjustes .toggle-info h4 {
        font-size: 0.8rem !important;
    }
    #sectionAjustes .toggle-info small {
        font-size: 0.7rem !important;
    }
    #sectionAjustes .toggle-controls {
        flex-shrink: 0 !important;
        gap: 8px !important;
    }
    #sectionAjustes .dias-input {
        width: 46px !important;
        padding: 4px 6px !important;
        font-size: 0.8rem !important;
    }
}

/* ═══════════════════════════════════════
   SECCIÓN DOCUMENTOS — Sprint 35
   ═══════════════════════════════════════ */
.doc-storage {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 16px 20px;
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    gap: 16px;
}
.storage-bar-wrap {
    flex: 1;
    height: 10px;
    background: var(--bg-surface);
    border-radius: 8px;
    overflow: hidden;
}
.storage-bar-fill {
    height: 100%;
    border-radius: 8px;
    transition: width 0.4s ease;
}
.storage-bar-fill.green { background: #22c55e; }
.storage-bar-fill.yellow { background: #f59e0b; }
.storage-bar-fill.red { background: #ef4444; }
.storage-text {
    font-size: 0.85rem;
    color: var(--text-secondary);
    white-space: nowrap;
}
.doc-toolbar {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 20px;
    align-items: center;
}
.doc-toolbar select, .doc-toolbar input[type="text"] {
    padding: 8px 12px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    color: var(--text-primary);
    border-radius: 8px;
    font-size: 0.85rem;
}
.doc-toolbar .btn-subir {
    margin-left: auto;
    padding: 10px 20px;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    font-size: 0.9rem;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.doc-toolbar .btn-subir:hover { opacity: 0.85; }
.doc-table-wrap {
    background: var(--bg-card);
    border-radius: 12px;
    overflow-x: auto;
}
.doc-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}
.doc-table th {
    text-align: left;
    padding: 12px 16px;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border);
}
.doc-table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    color: var(--text-primary);
    vertical-align: middle;
}
.doc-table tr:last-child td { border-bottom: none; }
.doc-table tr:hover { background: var(--bg-surface); }
.badge-estado {
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    display: inline-block;
}
.badge-borrador { background: rgba(148,163,184,0.15); color: var(--text-muted); }
.badge-revision { background: rgba(245,158,11,0.15); color: #f59e0b; }
.badge-aprobado { background: rgba(34,197,94,0.15); color: #22c55e; }
.badge-vencido { background: rgba(239,68,68,0.15); color: #ef4444; }
.doc-actions {
    display: flex;
    gap: 6px;
}
.doc-actions button {
    padding: 6px 10px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.8rem;
    background: var(--bg-surface);
    color: var(--text-secondary);
}
.doc-actions button:hover { color: var(--text-primary); }
.doc-actions .btn-del:hover { color: #ef4444; }
.doc-empty {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}
.doc-empty-icon { font-size: 3rem; margin-bottom: 10px; }
.doc-modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 9998;
    align-items: center;
    justify-content: center;
}
.doc-modal-overlay.active { display: flex; }
.doc-modal {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 32px;
    max-width: 520px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
.doc-modal h3 {
    font-family: 'Outfit', sans-serif;
    font-size: 1.3rem;
    margin-bottom: 20px;
    color: var(--text-primary);
}
.doc-modal .form-group { margin-bottom: 16px; }
.doc-modal label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.doc-modal input, .doc-modal select, .doc-modal textarea {
    width: 100%;
    padding: 10px 12px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    color: var(--text-primary);
    border-radius: 8px;
    font-size: 0.9rem;
    box-sizing: border-box;
}
.doc-modal textarea { resize: vertical; min-height: 60px; }
.doc-modal .form-row {
    display: flex;
    gap: 12px;
}
.doc-modal .form-row .form-group { flex: 1; }
.doc-modal-btns {
    display: flex;
    gap: 10px;
    margin-top: 24px;
}
.doc-modal-btns button {
    flex: 1;
    padding: 12px;
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
}
.btn-modal-primary { background: var(--primary); color: #fff; }
.btn-modal-secondary { background: var(--bg-surface); color: var(--text-secondary); }
.file-input-wrap {
    position: relative;
    border: 2px dashed var(--border);
    border-radius: 10px;
    padding: 24px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s;
}
.file-input-wrap:hover { border-color: var(--primary); }
.file-input-wrap input[type="file"] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}
.file-input-label {
    color: var(--text-muted);
    font-size: 0.85rem;
}
.file-input-label strong { color: var(--primary); }
.file-selected {
    color: var(--text-primary);
    font-weight: 500;
    font-size: 0.85rem;
    margin-top: 6px;
}
.new-cat-row {
    display: none;
    gap: 8px;
    margin-top: 8px;
}
.new-cat-row.active { display: flex; }
.new-cat-row input { flex: 1; }
.new-cat-row button {
    padding: 8px 14px;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.8rem;
    white-space: nowrap;
}
.estado-select {
    padding: 4px 8px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    color: var(--text-primary);
    border-radius: 6px;
    font-size: 0.8rem;
    cursor: pointer;
}

/* ═══════════════════════════════════════
   SECCIÓN AJUSTES — Sprint 35
   ═══════════════════════════════════════ */
#sectionAjustes .tabs {
    display: flex;
    gap: 0;
    border-bottom: 2px solid var(--border);
    margin-bottom: 28px;
}
#sectionAjustes .tab-btn {
    padding: 12px 24px;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
}
#sectionAjustes .tab-btn:hover { color: var(--text-primary); }
#sectionAjustes .tab-btn.active { color: #667eea; border-bottom-color: #667eea; }
#sectionAjustes .tab-content { display: none; }
#sectionAjustes .tab-content.active { display: block; }
#sectionAjustes .settings-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 28px;
    margin-bottom: 24px;
}
#sectionAjustes .settings-card h3 {
    font-size: 1.1rem;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 10px;
}
#sectionAjustes .settings-card p.desc {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 20px;
}
#sectionAjustes .form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 16px;
}
#sectionAjustes .form-row.three { grid-template-columns: 1fr 1fr 1fr; }
#sectionAjustes .btn-group {
    display: flex;
    gap: 12px;
    margin-top: 20px;
}
#sectionAjustes .btn-secondary {
    background: var(--hover-bg);
    color: var(--text-primary);
    border: 1px solid var(--border);
}
#sectionAjustes .btn-secondary:hover { background: var(--border); }
#sectionAjustes .toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 0;
    border-bottom: 1px solid var(--border);
}
#sectionAjustes .toggle-row:last-child { border-bottom: none; }
#sectionAjustes .toggle-info {
    display: flex;
    align-items: center;
    gap: 14px;
    flex: 1;
}
#sectionAjustes .toggle-info .icon-wrap {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: rgba(102, 126, 234, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #667eea;
}
#sectionAjustes .toggle-info h4 { font-size: 0.95rem; margin-bottom: 2px; }
#sectionAjustes .toggle-info small { color: var(--text-secondary); font-size: 0.8rem; }
#sectionAjustes .toggle-controls {
    display: flex;
    align-items: center;
    gap: 16px;
}
#sectionAjustes .toggle-switch {
    position: relative;
    width: 44px;
    height: 24px;
}
#sectionAjustes .toggle-switch input { opacity: 0; width: 0; height: 0; }
#sectionAjustes .toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background: var(--border);
    border-radius: 24px;
    transition: 0.3s;
}
#sectionAjustes .toggle-slider:before {
    content: '';
    position: absolute;
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background: #fff;
    border-radius: 50%;
    transition: 0.3s;
}
#sectionAjustes .toggle-switch input:checked + .toggle-slider { background: #667eea; }
#sectionAjustes .toggle-switch input:checked + .toggle-slider:before { transform: translateX(20px); }
#sectionAjustes .dias-input {
    width: 70px !important;
    padding: 6px 10px !important;
    text-align: center;
    font-size: 0.85rem !important;
}
#sectionAjustes .status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
}
#sectionAjustes .status-badge.success { background: rgba(34,197,94,0.1); color: #22c55e; }
#sectionAjustes .status-badge.warning { background: rgba(234,179,8,0.1); color: #eab308; }
#sectionAjustes .status-badge.error { background: rgba(239,68,68,0.1); color: #ef4444; }
#sectionAjustes .test-result {
    margin-top: 12px;
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 0.85rem;
    display: none;
}
#sectionAjustes .test-result.ok {
    display: block;
    background: rgba(34,197,94,0.1);
    color: #22c55e;
    border: 1px solid rgba(34,197,94,0.2);
}
#sectionAjustes .test-result.fail {
    display: block;
    background: rgba(239,68,68,0.1);
    color: #ef4444;
    border: 1px solid rgba(239,68,68,0.2);
}
@media (max-width: 768px) {
    #sectionAjustes .form-row,
    #sectionAjustes .form-row.three { grid-template-columns: 1fr; }
    #sectionAjustes .toggle-row { flex-direction: column; align-items: flex-start; gap: 12px; }
    #sectionAjustes .toggle-controls { align-self: flex-end; }
}

/* ═══════════════════════════════════════
   SECCIÓN REPORTES — Sprint 35
   ═══════════════════════════════════════ */
#sectionReportes .stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}
#sectionReportes .metric-value {
    font-size: 2rem;
    font-weight: 700;
    font-family: 'Outfit', sans-serif;
}
#sectionReportes .metric-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 4px;
}
#sectionReportes .tab-btn {
    padding: 10px 18px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: 8px;
    font-size: 0.85rem;
    transition: 0.2s;
}
#sectionReportes .tab-btn:hover { color: var(--text-primary); }
#sectionReportes .tab-btn.active { background: #667eea; color: white; }
@media (max-width: 768px) {
    #sectionReportes .stat-grid { grid-template-columns: repeat(2, 1fr); }
}
