/* ==========================================================================
   ripscore — Sistema de Diseño v4.0 SaaS Modern
   Paleta: Slate + Teal — serenidad clínica
   Tipografía: Plus Jakarta Sans / Outfit / system-ui
   ========================================================================== */

/* ==========================================================================
   1. VARIABLES GLOBALES - TEMA TEAL (POR DEFECTO)
   Fuente: Plus Jakarta Sans + Outfit (Google Fonts)
   ========================================================================== */
:root,
:root.theme-green,
:root.theme-teal {
    /* ═══════════════════════════════════════════
       SUPERFICIES (Fondos por capa)
       ═══════════════════════════════════════════ */
    --bg-main:        #F3F3F3;   /* fondo de página */
    --bg-card:        #FFFFFF;   /* tarjetas, paneles */
    --bg-elevated:    #FFFFFF;   /* modales, dropdowns, popovers */
    --bg-card-hover:  #F0F0F0;   /* hover en tarjetas */
    --bg-subtle:      rgba(15, 110, 86, 0.05);
    --bg-input:       #F0F0F0;

    /* ═══════════════════════════════════════════
       SIDEBAR
       ═══════════════════════════════════════════ */
    --sidebar-bg:          #F8F8F8;
    --sidebar-hover:       rgba(15, 110, 86, 0.06);
    --sidebar-active:      rgba(15, 110, 86, 0.12);
    --sidebar-border:      #E0E0E0;
    --sidebar-text:        #666666;
    --sidebar-active-text: #0D5C47;
    --sidebar-width:       260px;

    /* ═══════════════════════════════════════════
       TEXTO
       ═══════════════════════════════════════════ */
    --text-main:      #1A1A1A;
    --text-secondary: #555555;
    --text-tertiary:  #6B6B6B;
    --text-invert:    #FFFFFF;
    --text-light:     #6B6B6B;

    /* ═══════════════════════════════════════════
       SUPERFICIES ACRYLIC (Fluent Design)
       ═══════════════════════════════════════════ */
    --acrylic-bg:       rgba(255,255,255,0.6);   /* fondo translúcido modo claro */
    --acrylic-bg-hover: rgba(0,0,0,0.04);
    --acrylic-bg-nav:   rgba(255,255,255,0.7); /* navegación */
    --acrylic-blur:     16px;
    --acrylic-blur-lg:  20px;
    --acrylic-border:   rgba(0,0,0,0.06);

    /* ═══════════════════════════════════════════
       COLOR DE MARCA — #0F6E56 sólido / #4DBDB2 acento
       ═══════════════════════════════════════════ */
    --primary:        #0F6E56;
    --interactive:    #0F6E56;
    --highlight:      #0D5C47;

    --green:          #0F6E56;
    --green-hover:    #0D5C47;
    --green-dark:     #0C5A46;
    --green-light:    rgba(15, 110, 86, 0.10);
    --green-dim:      rgba(15, 110, 86, 0.06);

    /* ═══════════════════════════════════════════
       ESTADOS — Sistema Acrylic: bg con opacidad, border, text
       ═══════════════════════════════════════════ */
    --state-success-bg:     rgba(77, 189, 178, 0.12);
    --state-success-border: rgba(77, 189, 178, 0.25);
    --state-success-text:   #0D5C47;

    --state-warning-bg:     rgba(201, 155, 92, 0.12);
    --state-warning-border: rgba(201, 155, 92, 0.25);
    --state-warning-text:   #8A6420;

    --state-error-bg:       rgba(224, 96, 95, 0.12);
    --state-error-border:   rgba(224, 96, 95, 0.25);
    --state-error-text:     #C04540;

    /* ═══════════════════════════════════════════
       ESTADO AUTO-FIX (purple — validador medicamentos)
       ═══════════════════════════════════════════ */
    --state-auto-bg:     #F9F0FF;
    --state-auto-border: #E8CFFF;
    --state-auto-text:   #8B3FA0;

    /* ═══════════════════════════════════════════
       SEMÁNTICOS (Estados heredados — compatibilidad)
       ═══════════════════════════════════════════ */
    --success:        #0D5C47;
    --success-light:  rgba(77, 189, 178, 0.10);
    --success-dark:   #0D5C47;
    --warning:        #8A6420;
    --warning-light:  rgba(201, 155, 92, 0.10);
    --error:          #C04540;
    --error-light:    rgba(224, 96, 95, 0.10);
    --info:           #0D5C47;

    --red:            #C04540;
    --red-light:      rgba(224, 96, 95, 0.10);
    --amber:          #8A6420;
    --amber-light:    rgba(201, 155, 92, 0.10);

    /* ═══════════════════════════════════════════
       ALIASES LEGACY — actualizados a nuevo brand
       ═══════════════════════════════════════════ */
    --primary-color:  #0F6E56;
    --teal:           #0F6E56;
    --teal-light:     rgba(15, 110, 86, 0.10);
    --violet:         #0F6E56;
    --violet-light:   rgba(15, 110, 86, 0.10);
    --border-light:   rgba(15, 110, 86, 0.14);

    /* macOS compat */
    --mac-blue:           #0F6E56;
    --mac-blue-hover:     #0D5C47;
    --mac-red:            #C04540;
    --mac-green:          #0D5C47;
    --mac-amber:          #8A6420;
    --mac-text-secondary: #555555;

    /* ═══════════════════════════════════════════
       ALIASES CORTOS (heredados — reemplazar gradualmente por semánticos)
       ═══════════════════════════════════════════ */
    --az:    #0F6E56;
    --azlt:  rgba(15, 110, 86, 0.10);
    --azdk:  #0F6E56;
    --gr:    #6B6B6B;
    --grlt:  #F0F0F0;
    --vd:    #0D5C47;
    --nr:    #8A6420;
    --ro:    #C04540;
    --w:     #FFFFFF;
    --sh:    0 2px 10px rgba(0, 0, 0, 0.06);

    /* ═══════════════════════════════════════════
       ALIASES SEMÁNTICOS — reemplazo de los cortos crípticos
       ═══════════════════════════════════════════ */
    --brand:          #0F6E56;
    --brand-subtle:   rgba(15, 110, 86, 0.10);
    --brand-dark:     #0F6E56;
    --neutral:        #6B6B6B;
    --neutral-subtle: #F0F0F0;
    --accent:         #0D5C47;
    --surface:        #FFFFFF;
    --shadow-default: 0 2px 10px rgba(15, 110, 86, 0.08);
    --purple:         #8B3FA0;

    /* ═══════════════════════════════════════════
       BORDES
       ═══════════════════════════════════════════ */
    --border-soft:  #E0E0E0;
    --border-med:   #CCCCCC;
    --border-focus: #0F6E56;

    /* ═══════════════════════════════════════════
       RADIOS — Windows 11 Fluent (8px estándar)
       ═══════════════════════════════════════════ */
    --radius-xl:    12px;
    --radius-lg:    10px;
    --radius-md:    8px;
    --radius-sm:    8px;
    --radius-xs:    6px;
    --radius-round: 9999px;

    /* ═══════════════════════════════════════════
       SOMBRAS — Suaves, sin opacidad alta
       ═══════════════════════════════════════════ */
    --shadow-sm:    0 1px 3px rgba(15, 110, 86, 0.06);
    --shadow-md:    0 4px 12px rgba(15, 110, 86, 0.08);
    --shadow-mac:   0 4px 12px rgba(15, 110, 86, 0.08);
    --shadow-lg:    0 8px 24px rgba(15, 110, 86, 0.10);
    --shadow-xl:    0 12px 40px rgba(15, 110, 86, 0.12);
    --shadow-green: 0 4px 12px rgba(15, 110, 86, 0.15);

    /* ═══════════════════════════════════════════
       ESPACIADO
       ═══════════════════════════════════════════ */
    --spacing-xs: 4px;
    --spacing-sm: 8px;
    --spacing-md: 16px;
    --spacing-lg: 24px;
    --spacing-xl: 32px;

    /* ═══════════════════════════════════════════
       TIPOGRAFÍA — Plus Jakarta Sans + Outfit + JetBrains Mono
       ═══════════════════════════════════════════ */
    --font-xs:   13px;
    --font-sm:   14px;
    --font-base: 15px;
    --font-md:   17px;
    --font-lg:   22px;
    --font-xl:   26px;
    --font-xxl:  32px;

    --font-body:    'Outfit', 'Segoe UI Variable', 'Segoe UI', system-ui, -apple-system, sans-serif;
    --font-mono:    'JetBrains Mono', 'Cascadia Code', 'Fira Code', ui-monospace, monospace;
    --font-display: 'Plus Jakarta Sans', 'Outfit', 'Segoe UI', system-ui, sans-serif;

    --transition: 350ms cubic-bezier(0.32, 0.72, 0, 1);
}

/* ==========================================================================
   1.5 VARIABLES GLOBALES - TEMA AZUL (alternativo)
   ========================================================================== */
:root.theme-blue {
    --sidebar-hover:       rgba(11, 90, 168, 0.08);
    --sidebar-active:      #DBEAFE;
    --sidebar-active-text: #1D4ED8;
    --primary-color:       #2563EB;
    --green:               #2563EB;
    --green-hover:         #1D4ED8;
    --green-dark:          #1D4ED8;
    --green-light:         #DBEAFE;
    --green-dim:           rgba(37, 99, 235, 0.08);
    --bg-subtle:           rgba(37, 99, 235, 0.05);
    --border-light:        rgba(37, 99, 235, 0.18);
    --border-soft:         rgba(37, 99, 235, 0.14);
    --border-med:          rgba(37, 99, 235, 0.22);
    --border-focus:        #2563EB;
    --shadow-green:        0 4px 16px rgba(37, 99, 235, 0.18);
}

/* ==========================================================================
   1.6 VARIABLES GLOBALES - MODO OSCURO
   ========================================================================== */
:root.theme-dark {
    /* ═══════════════════════════════════════════
       SUPERFICIES — Mica cálido (Windows 11 Fluent)
       ═══════════════════════════════════════════ */
    --bg-main:        #202020;   /* fondo de página — Mica base */
    --bg-card:        #2B2B2B;   /* tarjetas, paneles */
    --bg-elevated:    #323232;   /* modales, dropdowns, popovers */
    --bg-card-hover:  #3A3A3A;   /* hover en tarjetas */
    --bg-subtle:      rgba(15, 110, 86, 0.10);
    --bg-input:       #2C2C2C;

    /* ═══════════════════════════════════════════
       SIDEBAR
       ═══════════════════════════════════════════ */
    --sidebar-bg:          #1E1E1E;
    --sidebar-hover:       rgba(77, 189, 178, 0.10);
    --sidebar-active:      rgba(77, 189, 178, 0.15);
    --sidebar-border:      rgba(255,255,255,0.07);
    --sidebar-text:        #8A9490;
    --sidebar-active-text: #4DBDB2;
    --sidebar-width:       260px;

    /* ═══════════════════════════════════════════
       TEXTO
       ═══════════════════════════════════════════ */
    --text-main:      #E0E0E0;
    --text-secondary: #A0A0A0;
    --text-tertiary:  #808080;
    --text-invert:    #FFFFFF;
    --text-light:     #808080;

    /* ═══════════════════════════════════════════
       SUPERFICIES ACRYLIC (Fluent Design) — modo oscuro
       ═══════════════════════════════════════════ */
    --acrylic-bg:       rgba(255,255,255,0.04);
    --acrylic-bg-hover: rgba(255,255,255,0.07);
    --acrylic-bg-nav:   rgba(255,255,255,0.05);
    --acrylic-blur:     16px;
    --acrylic-blur-lg:  20px;
    --acrylic-border:   rgba(255,255,255,0.07);

    /* ═══════════════════════════════════════════
       SUPERFICIES — Mica (Windows 11 Fluent)
       ═══════════════════════════════════════════ */
    --bg-main:        #101413;   /* fondo de página sólido oscuro */
    --bg-card:        #1E242A;   /* tarjetas — tono más claro que bg pero opaco */
    --bg-elevated:    #262C33;   /* modales, dropdowns */
    --bg-card-hover:  #2A3138;   /* hover */
    --bg-subtle:      rgba(15, 110, 86, 0.10);
    --bg-input:       #1E242A;

    /* ═══════════════════════════════════════════
       SIDEBAR — Acrylic (se aplica bg + blur en .sidebar)
       ═══════════════════════════════════════════ */
    --sidebar-bg:          var(--acrylic-bg-nav);
    --sidebar-hover:       rgba(77, 189, 178, 0.10);
    --sidebar-active:      rgba(77, 189, 178, 0.15);
    --sidebar-border:      var(--acrylic-border);
    --sidebar-text:        #8A9490;
    --sidebar-active-text: #4DBDB2;
    --sidebar-width:       260px;

    /* ═══════════════════════════════════════════
       TEXTO
       ═══════════════════════════════════════════ */
    --text-main:      #EDF2F1;
    --text-secondary: #8A9490;
    --text-tertiary:  #7A8A85;
    --text-invert:    #101413;
    --text-light:     #7A8A85;

    /* ═══════════════════════════════════════════
       COLOR DE MARCA — #0F6E56 sólido / #4DBDB2 acento
       ═══════════════════════════════════════════ */
    --primary:        #1D7F64;
    --interactive:    #4DBDB2;
    --highlight:      #4DBDB2;

    --green:          #1D7F64;
    --green-hover:    #218A6E;
    --green-dark:     #2BA88A;
    --green-light:    rgba(29, 127, 100, 0.18);
    --green-dim:      rgba(29, 127, 100, 0.10);

    /* ═══════════════════════════════════════════
       ESTADOS — Sistema Acrylic: bg con opacidad, border, text
       ═══════════════════════════════════════════ */
    --state-success-bg:     rgba(77, 189, 178, 0.12);
    --state-success-border: rgba(77, 189, 178, 0.25);
    --state-success-text:   #4DBDB2;

    --state-warning-bg:     rgba(201, 155, 92, 0.12);
    --state-warning-border: rgba(201, 155, 92, 0.25);
    --state-warning-text:   #C99B5C;

    --state-error-bg:       rgba(224, 96, 95, 0.12);
    --state-error-border:   rgba(224, 96, 95, 0.25);
    --state-error-text:     #E0605F;

    /* ═══════════════════════════════════════════
       ESTADO AUTO-FIX (purple — validador medicamentos)
       ═══════════════════════════════════════════ */
    --state-auto-bg:     rgba(175, 82, 222, 0.15);
    --state-auto-border: rgba(175, 82, 222, 0.25);
    --state-auto-text:   #AF52DE;

    /* ═══════════════════════════════════════════
       SEMÁNTICOS — Solo para estado, no decoración
       ═══════════════════════════════════════════ */
    --success:        #4DBDB2;
    --success-light:  rgba(77, 189, 178, 0.15);
    --success-dark:   #4DBDB2;
    --warning:        #C99B5C;
    --warning-light:  rgba(201, 155, 92, 0.15);
    --error:          #E0605F;
    --error-light:    rgba(224, 96, 95, 0.15);
    --info:           #4DBDB2;

    --red:            #E0605F;
    --red-light:      rgba(224, 96, 95, 0.15);
    --amber:          #C99B5C;
    --amber-light:    rgba(201, 155, 92, 0.15);

    /* ═══════════════════════════════════════════
       ALIASES LEGACY — actualizados a nuevo brand
       ═══════════════════════════════════════════ */
    --primary-color:  #1D7F64;
    --teal:           #1D7F64;
    --teal-light:     rgba(29, 127, 100, 0.18);
    --violet:         #1D7F64;
    --violet-light:   rgba(29, 127, 100, 0.18);
    --border-light:   rgba(15, 110, 86, 0.2);

    /* macOS compat */
    --mac-blue:           #1D7F64;
    --mac-blue-hover:     #218A6E;
    --mac-red:            #E0605F;
    --mac-green:          #4DBDB2;
    --mac-amber:          #C99B5C;
    --mac-text-secondary: #8A9490;

    /* ═══════════════════════════════════════════
       ALIASES CORTOS (heredados — reemplazar gradualmente por semánticos)
       ═══════════════════════════════════════════ */
    --az:    #1D7F64;
    --azlt:  rgba(29, 127, 100, 0.18);
    --azdk:  #1D7F64;
    --gr:    #7A8A85;
    --grlt:  #262C33;
    --vd:    #4DBDB2;
    --nr:    #C99B5C;
    --ro:    #E0605F;
    --w:     #1E242A;
    --sh:    0 2px 8px rgba(0, 0, 0, 0.25);

    /* ═══════════════════════════════════════════
       ALIASES SEMÁNTICOS — reemplazo de los cortos crípticos
       ═══════════════════════════════════════════ */
    --brand:          #1D7F64;
    --brand-subtle:   rgba(29, 127, 100, 0.18);
    --brand-dark:     #1D7F64;
    --neutral:        #7A8A85;
    --neutral-subtle: #262C33;
    --accent:         #4DBDB2;
    --surface:        #1E242A;
    --shadow-default: 0 2px 8px rgba(29, 127, 100, 0.20);
    --purple:         #AF52DE;

    /* ═══════════════════════════════════════════
       BORDES — Translúcidos blancos (Fluent)
       ═══════════════════════════════════════════ */
    --border-soft:  rgba(255,255,255,0.07);
    --border-med:   rgba(255,255,255,0.12);
    --border-focus: #4DBDB2;

    /* ═══════════════════════════════════════════
       SOMBRAS — Suaves, sin opacidad alta
       ═══════════════════════════════════════════ */
    --shadow-sm:    0 1px 3px rgba(29, 127, 100, 0.15);
    --shadow-md:    0 4px 12px rgba(29, 127, 100, 0.20);
    --shadow-mac:   0 4px 12px rgba(29, 127, 100, 0.20);
    --shadow-lg:    0 8px 24px rgba(29, 127, 100, 0.25);
    --shadow-xl:    0 12px 40px rgba(29, 127, 100, 0.30);
    --shadow-green: 0 4px 16px rgba(29, 127, 100, 0.3);
}

/* ==========================================================================
   3. RESET & BASE
   ========================================================================== */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html { scroll-behavior: smooth; }

/* ═══════════════════════════════════════════════════════
   ACRYLIC UTILITY — Efecto Fluent Design
   backdrop-filter progresivo: solo en navegación, modales y overlays
   ═══════════════════════════════════════════════════════ */

/* ── Fallback: navegadores sin backdrop-filter ── */
@supports not (backdrop-filter: blur(1px)) and not (-webkit-backdrop-filter: blur(1px)) {
    .sidebar,
    .main-header,
    .modal-overlay,
    .sidebar-flyout,
    .loading-overlay {
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
    }
    .sidebar {
        background: #1E1E1E !important;
    }
    .main-header {
        background: #262626 !important;
    }
    .sidebar-flyout {
        background: #2A2A2A !important;
    }
}

body {
    font-family: var(--font-body);
    background-color: var(--bg-main);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    flex-direction: row;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-size: var(--font-base);
    transition: background-color var(--transition), color var(--transition);
}

body:not(.login-page) {
    background-color: var(--bg-main);
}

/* ── Layout SaaS Principal ── */
/* Login page overrides the row layout */
body.login-page {
    flex-direction: column;
}

/* Evaluación RIPS / Editor: header + contenido apilados (sin sidebar SaaS) */
body.eval-page {
    flex-direction: column;
    overflow-x: hidden;
}

.saas-main {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
    margin-left: 240px;
}

.workspace {
    flex: 1;
    padding: 32px 36px;
    max-width: 100%;
}

/* ── Admin panel 2-col layout ── */
.admin-layout {
    display: grid;
    grid-template-columns: 380px 1fr;
    gap: var(--spacing-lg);
    align-items: start;
}

/* ==========================================================================
   4. UTILIDADES (Reemplazo de inline styles)
   ========================================================================== */
/* Display & Flexbox */
.d-flex          { display: flex; }
.d-none          { display: none !important; }
.flex-col        { flex-direction: column; }
.align-center    { align-items: center; }
.align-start     { align-items: flex-start; }
.justify-center  { justify-content: center; }
.justify-between { justify-content: space-between; }
.justify-end     { justify-content: flex-end; }
.gap-2           { gap: 8px; }
.gap-3           { gap: 12px; }
.gap-4           { gap: 16px; }

/* Margins & Padding */
.m-0  { margin: 0; }
.mt-0 { margin-top: 0; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mt-5 { margin-top: 24px; }
.mb-0 { margin-bottom: 0; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.mb-5 { margin-bottom: 24px; }
.ml-auto { margin-left: auto; }

/* Text */
.text-center { text-align: center; }
.text-left   { text-align: left; }
.text-right  { text-align: right; }
.text-muted  { color: var(--text-secondary); }
.text-main   { color: var(--text-main); }
.text-success{ color: var(--green); }
.text-error    { color: var(--error, #E0605F) !important; }
.text-warning  { color: var(--amber, #C99B5C) !important; }
.text-green    { color: var(--green, #0F6E56) !important; }
.text-blue     { color: var(--mac-blue, #0F6E56) !important; }
.text-purple   { color: var(--purple, #AF52DE) !important; }
.text-amber    { color: var(--amber, #C99B5C) !important; }
.text-teal     { color: var(--mac-green, #4DBDB2) !important; }
.text-secondary-util { color: var(--text-secondary, #7A8288) !important; }
.text-tertiary-util  { color: var(--text-tertiary, #5C6461) !important; }
.font-mono   { font-family: var(--font-mono); }
.font-bold   { font-weight: 700; }
.font-semibold { font-weight: 600; }
.text-xs     { font-size: 12px; }
.text-sm     { font-size: 13px; }
.text-base   { font-size: 14px; }
.text-lg     { font-size: 16px; }

/* Sizes & Visuals */
.w-100       { width: 100%; }
.opacity-50  { opacity: 0.5; }
.opacity-20  { opacity: 0.2; }
.block       { display: block; }


.count-badge {
    background: var(--bg-subtle);
    color: var(--text-secondary);
    padding: 2px 8px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: var(--font-xs);
    font-family: var(--font-mono);
    border: 1px solid var(--border-soft);
}

.bad-code {
    color: var(--red);
    font-family: var(--font-mono);
    font-weight: 600;
    background: var(--red-light);
    padding: 2px 8px;
    border-radius: var(--radius-xs);
    font-size: 12px;
    border: 1px solid rgba(239,68,68,0.15);
}

/* ==========================================================================
   5. SCROLLBAR
   ========================================================================== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(77, 189, 178, 0.25); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: rgba(77, 189, 178, 0.45); }

/* ==========================================================================
   5B. STAGGERED ENTRY ANIMATIONS (Fade-up para módulos)
   ========================================================================== */
.stagger-item {
    opacity: 0;
    transform: translateY(20px);
    animation: staggerFadeUp 0.6s cubic-bezier(0.32, 0.72, 0, 1) forwards;
}
.stagger-item:nth-child(1) { animation-delay: 0.05s; }
.stagger-item:nth-child(2) { animation-delay: 0.10s; }
.stagger-item:nth-child(3) { animation-delay: 0.15s; }
.stagger-item:nth-child(4) { animation-delay: 0.20s; }
.stagger-item:nth-child(5) { animation-delay: 0.25s; }
.stagger-item:nth-child(6) { animation-delay: 0.30s; }
.stagger-item:nth-child(7) { animation-delay: 0.35s; }
.stagger-item:nth-child(8) { animation-delay: 0.40s; }
.stagger-item:nth-child(9) { animation-delay: 0.45s; }
.stagger-item:nth-child(10) { animation-delay: 0.50s; }

@keyframes staggerFadeUp {
    from { opacity: 0; transform: translateY(20px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Reduce motion: respetar preferencias del usuario */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
    .stagger-item { opacity: 1; transform: none; animation: none !important; }
    .sidebar-flyout { animation: none !important; }
    .toast { animation: none !important; }
    .modal { animation: none !important; }
    .loader { animation: none !important; }
}

/* ==========================================================================
   5C. ACCESIBILIDAD — Focus visible (navegación por teclado)
   ========================================================================== */
/* Todos los elementos interactivos deben mostrar un indicador de foco visible
   al navegar con teclado. `!important` garantiza que gana a los `outline: none`
   que usan algunos estilos legacy en :focus. */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible,
[tabindex]:focus-visible,
.btn:focus-visible,
.btn-edit:focus-visible,
.btn-del:focus-visible,
.fb:focus-visible,
.ti:focus-visible,
.tb-eval:focus-visible,
.btn-eval:focus-visible,
.drop-eval:focus-visible,
.drop-zone-eval:focus-visible,
.tab-btn:focus-visible,
.btn-undo:focus-visible,
.btn-save-rule:focus-visible,
.btn-apply-rules:focus-visible,
.btn-icon-edit:focus-visible,
.btn-icon-delete:focus-visible,
.btn-icon-duplicate:focus-visible,
.btn-detach:focus-visible,
.modal-close:focus-visible,
.pagination-btn:focus-visible,
.pagination-size:focus-visible,
.filter-select:focus-visible,
.aa-dd-btn:focus-visible,
.aa-dd-opt:focus-visible,
.aa-mode-btn:focus-visible,
.aa-search-input:focus-visible,
.btn-mac:focus-visible,
.qa-chip:focus-visible,
.file-card:focus-visible,
.permiso-row:focus-visible,
.sidebar-section-label:focus-visible,
.sidebar-flyout-item:focus-visible,
.sidebar-flyout-btn:focus-visible,
.sidebar-logout:focus-visible,
.sidebar-user:focus-visible,
.header-notif:focus-visible,
.user-pill:focus-visible,
.btn-back:focus-visible {
    outline: 2px solid var(--border-focus, #0F6E56) !important;
    outline-offset: 2px;
}

/* ==========================================================================
   6. RESPONSIVE
   ========================================================================== */
@media (max-width: 1024px) {
    .workspace { padding: 24px 28px; }
    .admin-layout { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
    .saas-main { margin-left: 0; }
    .workspace { padding: 16px 20px; }
    .admin-layout { grid-template-columns: 1fr !important; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .menu-grid  { grid-template-columns: repeat(2, 1fr); }
    .table-mac  { font-size: 12px; }
    .table-mac th, .table-mac td { padding: 10px 12px; }
    .page-header { flex-direction: column; align-items: flex-start; gap: 12px; }
    .page-subtitle { font-size: 13px; }
}

@media (max-width: 480px) {
    .workspace { padding: 12px 16px; }
    .menu-grid  { grid-template-columns: 1fr; }
    .stats-grid { grid-template-columns: 1fr; }
}

/* Wrapper para scroll horizontal en tablas */
.table-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 16px;
}
.table-scroll::-webkit-scrollbar { height: 4px; }
.table-scroll::-webkit-scrollbar-thumb { background: rgba(15,110,86,0.35); border-radius: 10px; }

/* Convertidor grid responsive */
@media (max-width: 768px) {
    .convertidor-grid {
        grid-template-columns: 1fr;
        height: auto;
    }
    .convertidor-panel { min-height: 300px; }
}

/* Login decorations — ocultar en mobile */
@media (max-width: 480px) {
    .login-deco { display: none; }
    .login-page .login-pattern { display: none; }
}

/* ==========================================================================
   7. PRINT
   ========================================================================== */
@media print {
    .sidebar, .main-header, .main-footer, .toolbar-mac,
    .btn-mac, .btn, button, .tabs-bar,
    .upload-area, .modal-overlay { display: none !important; }

    .saas-main { margin-left: 0 !important; }
    body { background: white; color: black; font-size: 11pt; }
    .workspace { padding: 0; }
    .mac-card {
        border: 1px solid #ccc;
        box-shadow: none;
        break-inside: avoid;
        margin-bottom: 16pt;
    }
    .table-mac { font-size: 9pt; }
    .table-mac th {
        background: #f0f0f0 !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
    a[href]:after { content: none; }
}

/* UTILITIES EXTRAS */
.text-micro { font-size: 10px; }
.mr-1 { margin-right: 4px; }
.mr-2 { margin-right: 8px; }
.mt-1 { margin-top: 4px; }
.flex-shrink-0 { flex-shrink: 0; }
.opacity-50 { opacity: 0.5; }
.cursor-not-allowed { cursor: not-allowed; }
.text-bold { font-weight: 700; }
.font-bold { font-weight: 600; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; }
.gap-4 { gap: 16px; }
.border-top-soft { border-top: 1px solid var(--border-soft); }
.py-2 { padding-top: 8px; padding-bottom: 8px; }
.px-3 { padding-left: 12px; padding-right: 12px; }
.mb-0 { margin-bottom: 0; }
.mb-3 { margin-bottom: 12px; }
.text-lg { font-size: 19px; }
.text-green { color: var(--green); }
.text-main { color: var(--text-main); }
.align_center { display: flex; align-items: center; }
.justify_center { display: flex; justify-content: center; }
.flex-1 { flex: 1; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mt-5 { margin-top: 24px; }
.opacity-05 { opacity: 0.5; }
.text-micro { font-size: 10px; }
.text-xs { font-size: 12px; }
