@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600;700&display=swap');

/* ==========================================================
   PALETA MODO CLARO CALIBRADA (CORPORATIVO / SAAS LIMPIO)
   ========================================================== */
:root {
    /* 1. Fondo de la Pantalla: Celeste/Grisáceo muy claro y limpio */
    --bg-main: #F0F4FA;
    
    /* 2. Superficies: Blanco puro */
    --bg-surface: #FFFFFF;
    --bg-surface-elevated: #F8FAFC;
    --bg-surface-glass: rgba(255, 255, 255, 0.98);
    
    /* 3. Botón de Acción Principal (Guardar Ficha): Ámbar Dorado */
    --primary: #D97706;
    --primary-hover: #B45309;
    --primary-light: #FEF3C7;
    --primary-text: #FFFFFF;
    --primary-glow: rgba(217, 119, 6, 0.25);

    /* 4. Acentos de Marca */
    --brand-navy: #262953;
    --brand-navy-hover: #1D1F3F;
    --brand-indigo-light: #EEF2FF;
    --brand-indigo-text: #4338CA;

    --accent-mint: #0D9488;
    --accent-mint-hover: #0F766E;
    --accent-mint-light: #F0FDFA;
    --accent-mint-text: #0F172A;

    --accent-pink: #F43F5E;
    --accent-pink-hover: #E11D48;
    --accent-pink-light: #FFF1F2;
    --accent-pink-text: #0F172A;

    /* Acentos de estado técnico */
    --accent-emerald: #059669;
    --accent-emerald-light: #ECFDF5;
    --accent-cyan: #0D9488;
    --accent-cyan-light: #F0FDFA;
    --accent-amber: #D97706;
    --accent-amber-light: #FFFBEB;
    --accent-rose: #DC2626;

    /* 5. Textos y Contornos */
    --text-primary: #0F172A;
    --text-secondary: #475569;
    --text-muted: #64748B;

    --border-subtle: #E2E8F0;
    --border-focus: #262953;

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 18px;
    --radius-full: 9999px;

    --font-sans: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
    --shadow-card: 0 1px 3px rgba(15, 23, 42, 0.05), 0 1px 2px rgba(15, 23, 42, 0.03);
    --shadow-elevated: 0 10px 25px -3px rgba(15, 23, 42, 0.08), 0 4px 6px -4px rgba(15, 23, 42, 0.04);
}

/* ==========================================================
   TEMA OSCURO CALIBRADO (CARBÓN PROFUNDO / HIGH TECH DARK)
   ========================================================== */
body.theme-dark, :root:has(.theme-dark), .theme-dark {
    /* 1. Fondo de la Pantalla: Negro Carbón Técnico Profundo */
    --bg-main: #0c0d10;
    
    /* 2. Superficies: Carbón Sólido Limpio */
    --bg-surface: #15171c;
    --bg-surface-elevated: #111216;
    --bg-surface-glass: #15171c;
    
    /* 3. Acentos */
    --primary: #10b981;
    --primary-hover: #059669;
    --primary-light: rgba(16, 185, 129, 0.15);
    --primary-text: #ffffff;
    --primary-glow: rgba(16, 185, 129, 0.25);

    --brand-navy: #15171c;
    --brand-navy-hover: #1f2229;
    --brand-indigo-light: rgba(16, 185, 129, 0.15);
    --brand-indigo-text: #10b981;

    --accent-mint: #10b981;
    --accent-mint-hover: #059669;
    --accent-mint-light: rgba(16, 185, 129, 0.15);
    --accent-mint-text: #ffffff;

    --accent-pink: #f43f5e;
    --accent-pink-hover: #e11d48;
    --accent-pink-light: rgba(244, 63, 94, 0.15);
    --accent-pink-text: #ffffff;

    --accent-emerald: #10b981;
    --accent-emerald-light: rgba(16, 185, 129, 0.15);
    --accent-cyan: #38bdf8;
    --accent-cyan-light: rgba(56, 189, 248, 0.15);
    --accent-amber: #fbbf24;
    --accent-amber-light: rgba(251, 191, 36, 0.15);
    --accent-rose: #ef4444;

    /* 4. Textos y Contornos */
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;

    --border-subtle: #242731;
    --border-focus: #10b981;

    --shadow-card: 0 4px 20px rgba(0, 0, 0, 0.5);
    --shadow-elevated: 0 12px 32px rgba(0, 0, 0, 0.7);
}

.theme-dark, 
.theme-dark .app-container, 
.theme-dark .main-content, 
.theme-dark .page-body {
    background-color: var(--bg-main) !important;
    color: var(--text-primary);
}

body.theme-dark {
    background-color: #0c0d10 !important;
    color: #f8fafc !important;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-main);
    color: var(--text-primary);
    font-family: var(--font-sans);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    transition: background-color 0.25s ease, color 0.25s ease;
}

/* Evitar contorno de foco predeterminado del navegador al navegar (FocusOnNavigate) */
h1:focus, h2:focus, h3:focus, h4:focus, h5:focus, h6:focus,
.page-title:focus, [tabindex="-1"]:focus {
    outline: none !important;
    box-shadow: none !important;
}

/* ==========================================================
   LAYOUT RESPONSIVO (ESCRITORIO & MÓVIL)
   ========================================================== */
.app-container {
    display: flex;
    min-height: 100vh;
    position: relative;
    background-color: var(--bg-main);
    color: var(--text-primary);
    transition: background-color 0.25s ease;
}

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    background-color: var(--bg-main);
    transition: background-color 0.25s ease;
}

.page-body {
    padding: 1.75rem;
    flex: 1;
    background-color: var(--bg-main);
    transition: background-color 0.25s ease;
}

/* Sidebar Desktop */
.sidebar {
    width: 270px;
    background: var(--bg-surface);
    border-right: 1px solid var(--border-subtle);
    display: flex;
    flex-direction: column;
    padding: 1.5rem 1.1rem;
    flex-shrink: 0;
    z-index: 100;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Colapso de Sidebar en Escritorio a Columna Compacta (72px) con Tooltips */
@media (min-width: 1025px) {
    .sidebar {
        width: 270px;
        transition: width 0.25s cubic-bezier(0.4, 0, 0.2, 1), padding 0.25s ease;
    }

    .sidebar-collapsed .sidebar {
        width: 72px !important;
        padding: 1.25rem 0.5rem !important;
        overflow: visible !important;
    }

    .sidebar-collapsed .brand-header {
        justify-content: center !important;
        padding: 0.25rem 0 1rem !important;
        gap: 0 !important;
    }

    .sidebar-collapsed .brand-header > div:not(.brand-logo-badge) {
        display: none !important;
    }

    .sidebar-collapsed .brand-logo-badge {
        margin: 0 auto !important;
    }

    .sidebar-collapsed .nav-group {
        align-items: center !important;
    }

    .sidebar-collapsed .nav-link-custom {
        justify-content: center !important;
        padding: 0.75rem 0 !important;
        width: 46px !important;
        height: 46px !important;
        position: relative !important;
    }

    .sidebar-collapsed .nav-link-custom span {
        display: none !important;
    }

    .sidebar-collapsed .nav-link-custom.active {
        border-left: none !important;
        outline: 2px solid var(--primary);
    }

    /* Tooltip flotante al pasar el cursor en modo colapsado */
    .sidebar-collapsed .nav-link-custom::after {
        content: attr(data-tooltip);
        position: absolute;
        left: calc(100% + 12px);
        top: 50%;
        transform: translateY(-50%) scale(0.95);
        background: var(--bg-surface-elevated);
        color: var(--text-primary);
        padding: 0.4rem 0.75rem;
        border-radius: var(--radius-sm);
        font-size: 0.8rem;
        font-weight: 600;
        white-space: nowrap;
        box-shadow: var(--shadow-elevated);
        border: 1px solid var(--border-subtle);
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.15s ease, transform 0.15s ease;
        pointer-events: none;
        z-index: 9999;
    }

    .sidebar-collapsed .nav-link-custom:hover::after {
        opacity: 1;
        visibility: visible;
        transform: translateY(-50%) scale(1);
    }

    .sidebar-collapsed .sidebar-footer-content {
        display: none !important;
    }

    .sidebar-collapsed .sidebar-footer-collapsed {
        display: flex !important;
        justify-content: center !important;
        align-items: center !important;
        padding: 0.5rem 0 !important;
    }

    .sidebar-close-btn {
        display: none !important;
    }
}

.brand-header {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.25rem 0.5rem 1.25rem;
    border-bottom: 1px solid var(--border-subtle);
    margin-bottom: 1.25rem;
}

.brand-logo-badge {
    width: 42px;
    height: 42px;
    border-radius: var(--radius-md);
    background: var(--brand-navy);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 1.3rem;
    color: #FFFFFF;
    box-shadow: 0 3px 10px rgba(38, 41, 83, 0.25);
    border: 1px solid rgba(38, 41, 83, 0.2);
    transition: all 0.2s ease;
}

.theme-dark .brand-logo-badge {
    background: linear-gradient(135deg, var(--accent-emerald), #059669);
    color: #0c0d10;
    box-shadow: 0 3px 12px rgba(16, 185, 129, 0.3);
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.brand-title {
    font-size: 1.15rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--text-primary);
}

.brand-subtitle {
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--brand-indigo-text);
    font-weight: 700;
}

.theme-dark .brand-subtitle {
    color: var(--accent-emerald);
}

.nav-group {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    flex: 1;
}

.nav-link-custom {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.92rem;
    font-weight: 600;
    transition: all 0.18s ease;
}

.nav-link-custom:hover {
    color: var(--brand-indigo-text);
    background: var(--brand-indigo-light);
}

.nav-link-custom.active {
    color: var(--brand-indigo-text);
    background: var(--brand-indigo-light);
    border: 1px solid rgba(67, 56, 202, 0.15);
    border-left: 4px solid var(--brand-indigo-text);
    font-weight: 700;
    box-shadow: 0 2px 6px rgba(67, 56, 202, 0.08);
}

.theme-dark .nav-link-custom:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.05);
}

.theme-dark .nav-link-custom.active {
    color: var(--accent-emerald);
    background: var(--primary-light);
    border: 1px solid rgba(16, 185, 129, 0.25);
    border-left: 4px solid var(--accent-emerald);
    font-weight: 700;
    box-shadow: 0 2px 10px rgba(16, 185, 129, 0.15);
}

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0; /* Previene desbordamiento flex */
}

/* Top Bar */
.top-bar {
    height: 64px;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.75rem;
}

.menu-toggle-btn {
    background: var(--bg-surface-elevated);
    border: 1.5px solid var(--border-subtle);
    color: var(--text-primary);
    cursor: pointer;
    padding: 0.45rem 0.6rem;
    border-radius: var(--radius-md);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.menu-toggle-btn:hover {
    background: var(--accent-mint-light);
    border-color: #2A2738;
}

.sidebar-close-btn {
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-subtle);
    color: var(--text-primary);
    cursor: pointer;
    padding: 0.4rem;
    border-radius: var(--radius-sm);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-left: auto;
    transition: all 0.15s ease;
}

.sidebar-close-btn:hover {
    background: var(--accent-pink-light);
    color: var(--accent-rose);
    border-color: var(--accent-pink);
}

.mobile-menu-btn {
    display: none;
}

.theme-toggle-btn {
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-subtle);
    color: var(--text-primary);
    padding: 0.45rem 0.85rem;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.theme-toggle-btn:hover {
    border-color: var(--primary);
}

.page-body {
    padding: 1.75rem;
    flex: 1;
}

/* Backdrop para Drawer Móvil */
.mobile-backdrop {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
    z-index: 90;
}

/* ==========================================================
   TIPOGRAFÍA Y ENCABEZADOS
   ========================================================== */
.page-title {
    font-size: 1.65rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.page-desc {
    color: var(--text-secondary);
    font-size: 0.92rem;
    margin-bottom: 1.25rem;
}

/* ==========================================================
   TARJETAS Y CONTENEDORES
   ========================================================== */
.card-glass {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow-card);
    margin-bottom: 1.5rem;
    transition: all 0.2s ease;
}

.card-title-sm {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 1.1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.5rem;
}

/* ==========================================================
   GRID DE KPIS FINANCIEROS
   ========================================================== */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.kpi-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-card);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.kpi-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--brand-navy);
}

.kpi-card.kpi-emerald::before { background: var(--accent-emerald); }
.kpi-card.kpi-cyan::before { background: var(--accent-cyan); }
.kpi-card.kpi-amber::before { background: var(--accent-amber); }
.kpi-card.kpi-slate::before { background: var(--brand-navy); }

.kpi-label {
    font-size: 0.76rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.kpi-value {
    font-size: 1.7rem;
    font-weight: 800;
    font-family: var(--font-mono);
    color: var(--text-primary);
    margin: 0.35rem 0;
}

.kpi-card.kpi-emerald .kpi-value { color: var(--accent-emerald); }
.kpi-card.kpi-cyan .kpi-value { color: var(--accent-cyan); }
.kpi-card.kpi-amber .kpi-value { color: var(--accent-amber); }
.kpi-card.kpi-slate .kpi-value { color: var(--brand-navy); }

.theme-dark .kpi-card.kpi-slate::before { background: #818cf8; }
.theme-dark .kpi-card.kpi-slate .kpi-value { color: #818cf8; }

.kpi-subtitle {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* ==========================================================
   TABLAS DINÁMICAS RESPONSIVAS
   ========================================================== */
.table-container {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-subtle);
    background: var(--bg-surface);
    scrollbar-width: thin;
    scrollbar-color: var(--accent-mint) var(--bg-surface-elevated);
}

.table-container::-webkit-scrollbar {
    height: 7px;
}

.table-container::-webkit-scrollbar-track {
    background: var(--bg-surface-elevated);
    border-radius: 4px;
}

.table-container::-webkit-scrollbar-thumb {
    background: var(--accent-mint);
    border-radius: 4px;
}

.table-container::-webkit-scrollbar-thumb:hover {
    background: var(--accent-mint-hover);
}

.table-custom {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
    text-align: left;
    min-width: 650px; /* Asegura scroll en móviles si es ancha */
}

.table-custom th {
    background: var(--bg-surface-elevated);
    color: var(--text-secondary);
    padding: 0.8rem 1rem;
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.72rem;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--border-subtle);
}

.table-custom td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-subtle);
    color: var(--text-primary);
    vertical-align: middle;
}

.table-custom tr:hover td {
    background: rgba(134, 207, 151, 0.16);
}

.table-custom tr.selected td {
    background: rgba(134, 207, 151, 0.28);
    border-bottom: 2px solid var(--accent-mint);
}

/* ==========================================================
   FORMULARIOS E INPUTS
   ========================================================== */
.input-custom, .select-custom {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    padding: 0.6rem 0.85rem;
    font-size: 0.88rem;
    width: 100%;
    font-family: var(--font-sans);
    min-height: 42px;
    transition: all 0.2s ease;
}

.input-custom:focus, .select-custom:focus {
    outline: none;
    border-color: #2A2738;
    box-shadow: 0 0 0 3px rgba(134, 207, 151, 0.5); /* Anillo de selección en menta pastel */
}

.theme-dark .input-custom,
.theme-dark .select-custom {
    background-color: #1c1e24 !important;
    border-color: #2b2e38 !important;
    color: #f8fafc !important;
}

.theme-dark .input-custom:focus,
.theme-dark .select-custom:focus {
    border-color: #10b981 !important;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.25) !important;
}

.theme-dark select option {
    background-color: #15171c !important;
    color: #f8fafc !important;
}

.theme-dark .table-container {
    background-color: var(--bg-surface) !important;
    border-color: var(--border-subtle) !important;
}

.theme-dark .table-custom th {
    background-color: #111216 !important;
    color: var(--text-secondary) !important;
    border-color: var(--border-subtle) !important;
}

.theme-dark .table-custom td {
    border-color: var(--border-subtle) !important;
    color: var(--text-primary) !important;
}

.theme-dark .table-custom tr:hover td {
    background-color: rgba(16, 185, 129, 0.08) !important;
}

.theme-dark .table-custom tr.selected td {
    background-color: rgba(16, 185, 129, 0.18) !important;
    border-bottom: 2px solid var(--accent-emerald) !important;
}

.input-mono {
    font-family: var(--font-mono);
    text-align: right;
}

/* Form Layout Grids */
.form-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.form-grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.form-label {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--text-secondary);
}

/* ==========================================================
   BOTONES
   ========================================================== */
/* Botón de Acción Principal (Guardar Ficha) */
.btn-primary-custom {
    background: var(--primary);
    color: var(--primary-text);
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: var(--radius-md);
    padding: 0.65rem 1.35rem;
    font-weight: 800;
    font-size: 0.9rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    min-height: 42px;
    transition: all 0.2s ease;
    box-shadow: 0 3px 12px var(--primary-glow);
}

.btn-primary-custom:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
}

.theme-dark .btn-primary-custom {
    background: #1c1f24;
    color: #f8fafc;
    border: 1px solid #2e323c;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

.theme-dark .btn-primary-custom:hover {
    background: #262a32;
    border-color: #3e4452;
}

/* Botón de Pestañas / Herramientas Secundarias (Mint Green #86CF97) */
.btn-mint-custom {
    background: var(--accent-mint);
    color: var(--accent-mint-text);
    border: 1.5px solid rgba(42, 39, 56, 0.22);
    border-radius: var(--radius-md);
    padding: 0.65rem 1.25rem;
    font-weight: 700;
    font-size: 0.88rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    min-height: 42px;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(13, 148, 136, 0.2);
}

.btn-mint-custom:hover {
    background: var(--accent-mint-hover);
    transform: translateY(-1px);
}

/* Botón de Favoritos / Likes / Emocionales */
.btn-pink-custom, .btn-favorite-custom {
    background: var(--accent-pink);
    color: var(--accent-pink-text);
    border: 1.5px solid rgba(42, 39, 56, 0.22);
    border-radius: var(--radius-md);
    padding: 0.65rem 1.25rem;
    font-weight: 700;
    font-size: 0.88rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    min-height: 42px;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(244, 63, 94, 0.2);
}

.btn-pink-custom:hover, .btn-favorite-custom:hover {
    background: var(--accent-pink-hover);
    transform: translateY(-1px);
}

.btn-secondary-custom {
    background: var(--bg-surface);
    color: var(--text-primary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 0.65rem 1.25rem;
    font-weight: 600;
    font-size: 0.88rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    min-height: 42px;
    transition: all 0.2s ease;
}

.btn-secondary-custom:hover {
    background: var(--bg-surface-elevated);
    border-color: var(--text-muted);
}

.theme-dark .btn-secondary-custom {
    background: #14161a;
    color: #94a3b8;
    border: 1px solid #262932;
}

.theme-dark .btn-secondary-custom:hover {
    background: #1c1f24;
    color: #f8fafc;
}

/* Botón de Exportar PDF / Imprimir */
.btn-success-custom {
    background: var(--brand-navy);
    color: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: var(--radius-md);
    padding: 0.65rem 1.25rem;
    font-weight: 700;
    font-size: 0.88rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    min-height: 42px;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(38, 41, 83, 0.25);
}

.btn-success-custom:hover {
    background: var(--brand-navy-hover);
    transform: translateY(-1px);
}

.theme-dark .btn-success-custom {
    background: var(--accent-emerald);
    color: #0c0d10;
    border: none;
    font-weight: 800;
    box-shadow: 0 3px 12px rgba(16, 185, 129, 0.35);
}

.theme-dark .btn-success-custom:hover {
    background: #059669;
    color: #ffffff;
}

.btn-danger-sm {
    background: rgba(220, 38, 38, 0.1);
    color: var(--accent-rose);
    border: 1px solid rgba(220, 38, 38, 0.2);
    border-radius: var(--radius-sm);
    padding: 0.45rem 0.75rem;
    font-size: 0.8rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    min-height: 36px;
    transition: all 0.15s ease;
}

.btn-danger-sm:hover {
    background: var(--accent-rose);
    color: white;
}

/* ==========================================================
   BADGES & ALERTAS
   ========================================================== */
.badge-custom {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.3rem 0.65rem;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 700;
}

.badge-cyan {
    background: var(--accent-cyan-light);
    color: var(--accent-cyan);
    border: 1px solid rgba(51, 92, 103, 0.25);
}

.badge-emerald {
    background: var(--accent-emerald-light);
    color: var(--accent-emerald);
    border: 1px solid rgba(45, 106, 79, 0.25);
}

.badge-amber {
    background: var(--accent-amber-light);
    color: var(--accent-amber);
    border: 1px solid rgba(184, 115, 16, 0.25);
}

.alert-custom {
    padding: 0.9rem 1.2rem;
    border-radius: var(--radius-md);
    font-size: 0.88rem;
    font-weight: 500;
    margin-bottom: 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.alert-info {
    background: var(--primary-light);
    border: 1px solid rgba(246, 208, 77, 0.5);
    color: var(--text-primary);
}

.alert-warning {
    background: var(--accent-amber-light);
    border: 1px solid rgba(217, 119, 6, 0.25);
    color: var(--accent-amber);
}

/* ==========================================================
   RESPONSIVE (MÓVIL, CELULAR, TABLET Y PANTALLAS <= 1024px)
   EL MENÚ SE OCULTA COMPLETAMENTE PARA DEJAR EL 100% A LAS GRILLAS
   ========================================================== */
@media (max-width: 1024px) {
    .sidebar {
        position: fixed !important;
        top: 0 !important;
        left: -320px !important;
        height: 100vh !important;
        width: 280px !important;
        max-width: 85vw !important;
        z-index: 1000 !important;
        box-shadow: var(--shadow-elevated) !important;
        transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
        display: flex !important;
    }

    .sidebar.mobile-open {
        left: 0 !important;
    }

    .mobile-backdrop.show {
        display: block !important;
    }

    .main-content {
        width: 100% !important;
        min-width: 0 !important;
    }

    .top-bar {
        padding: 0 0.85rem !important;
        height: 56px !important;
    }

    .page-body {
        padding: 0.75rem !important;
    }

    .card-glass {
        padding: 1rem !important;
        margin-bottom: 1rem !important;
    }

    .form-grid-3, .form-grid-2 {
        grid-template-columns: 1fr !important;
    }

    .page-title {
        font-size: 1.3rem !important;
    }

    .kpi-grid {
        grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)) !important;
    }

    .kpi-value {
        font-size: 1.4rem !important;
    }

    .online-badge {
        display: none !important;
    }
}

/* Optimización extrema para pantallas de celular (<= 640px) */
@media (max-width: 640px) {
    .page-body {
        padding: 0.4rem !important;
    }

    .card-glass {
        padding: 0.65rem 0.5rem !important;
        border-radius: var(--radius-sm) !important;
        margin-bottom: 0.75rem !important;
    }

    .page-title {
        font-size: 1.15rem !important;
    }

    .page-desc {
        font-size: 0.8rem !important;
        margin-bottom: 0.75rem !important;
    }

    .table-container {
        border-radius: var(--radius-sm) !important;
        margin-left: -0.25rem;
        margin-right: -0.25rem;
        width: calc(100% + 0.5rem) !important;
    }

    .table-custom {
        font-size: 0.8rem !important;
    }

    .table-custom th, .table-custom td {
        padding: 0.45rem 0.5rem !important;
    }

    .kpi-grid {
        grid-template-columns: 1fr 1fr !important;
        gap: 0.5rem !important;
    }

    .kpi-card {
        padding: 0.75rem 0.6rem !important;
    }

    .kpi-label {
        font-size: 0.68rem !important;
    }

    .kpi-value {
        font-size: 1.15rem !important;
        margin: 0.2rem 0 !important;
    }

    .kpi-subtitle {
        font-size: 0.68rem !important;
        line-height: 1.2 !important;
    }

    .theme-label {
        display: none !important;
    }

    .btn-primary-custom, .btn-secondary-custom, .btn-success-custom, .btn-mint-custom, .btn-pink-custom {
        padding: 0.45rem 0.75rem !important;
        font-size: 0.8rem !important;
        min-height: 36px !important;
        flex: 1 1 auto !important;
        justify-content: center !important;
    }
}

/* ==========================================================
   PRINT / EXPORTACIÓN A PDF (A4 OFICIAL)
   ========================================================== */
@media print {
    body {
        background: white !important;
        color: black !important;
        font-size: 10pt;
    }

    .sidebar, .top-bar, .no-print, .btn-primary-custom, .btn-secondary-custom, .btn-success-custom, .btn-danger-sm, .theme-toggle-btn {
        display: none !important;
    }

    .app-container {
        display: block !important;
    }

    .main-content {
        overflow: visible !important;
    }

    .page-body {
        padding: 0 !important;
    }

    .card-glass {
        background: white !important;
        border: 1px solid #999 !important;
        box-shadow: none !important;
        padding: 0.6rem !important;
        margin-bottom: 0.8rem !important;
    }

    .table-container {
        border: 1px solid #999 !important;
        background: white !important;
    }

    .table-custom {
        min-width: 100% !important;
    }

    .table-custom th {
        background: #f1f5f9 !important;
        color: black !important;
        border-bottom: 1px solid #666 !important;
    }

    .table-custom td {
        color: black !important;
        border-bottom: 1px solid #ddd !important;
    }

    .kpi-grid {
        display: flex !important;
        flex-direction: row !important;
        gap: 0.5rem !important;
    }

    .kpi-card {
        border: 1px solid #888 !important;
        background: white !important;
        flex: 1 !important;
        padding: 0.5rem !important;
    }

    .kpi-value, .kpi-label, .kpi-subtitle {
        color: black !important;
    }

    .print-only-header {
        display: block !important;
        margin-bottom: 1.25rem;
        border-bottom: 2px solid #1E293B;
        padding-bottom: 0.5rem;
    }
}

.print-only-header {
    display: none;
}
