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

        /* ============================================================
           DESIGN TOKENS — una sola fuente de verdad para el look & feel
           ============================================================ */
        :root {
            --surface:        #f6f7fb;
            --surface-raised: #ffffff;
            --border:         #e9ecf3;
            --border-strong:  #dfe3ec;
            --text:           #1e293b;
            --text-muted:     #64748b;
            --text-faint:     #94a3b8;
            --accent:         #244884;
            --radius-sm:      .5rem;
            --radius:         .75rem;
            --radius-lg:      1rem;
            --radius-xl:      1.25rem;
            --nav-w:          16rem;
            --nav-w-collapsed:4.5rem;
        }

        * { box-sizing: border-box; }
        body {
            font-family: 'Inter', system-ui, sans-serif;
            background: var(--surface);
            -webkit-font-smoothing: antialiased;
            text-rendering: optimizeLegibility;
        }

        /* Foco visible y consistente en toda la app (accesibilidad) */
        :where(button, a, input, select, textarea, [tabindex]):focus-visible {
            outline: 2px solid var(--accent);
            outline-offset: 2px;
            border-radius: 6px;
        }

        /* Tipografía tabular para métricas: los números no "bailan" al actualizarse */
        .tabular { font-variant-numeric: tabular-nums; }

        .tab-content { display: none; }
        .tab-content.active { display: block; }
        /* Las vistas con tabla larga se estiran hasta el borde inferior de la
           ventana y hacen scroll POR DENTRO. Con una altura fija en `calc` la
           última fila quedaba cortada por la mitad en cuanto la pantalla no era
           la del diseño: el alto lo tiene que decidir la ventana, no un número
           escrito a mano. */
        .tab-content.active.vista-alta { display: flex; flex-direction: column; }
        .vista-alta > .panel-alto {
            display: flex; flex-direction: column;
            height: calc(100vh - 3rem);   /* sólo el margen de la vista */
            min-height: 22rem;
        }
        .vista-alta .panel-alto > .cuerpo-scroll { flex: 1 1 auto; min-height: 0; overflow: auto; }
        .vista-alta .panel-alto > .fijo { flex: 0 0 auto; }

        ::-webkit-scrollbar { width: 5px; height: 5px; }
        ::-webkit-scrollbar-track { background: #f1f5f9; }
        ::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 10px; }
        ::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

        /* ===== TOAST NOTIFICATIONS ===== */
        /* Abajo a la derecha: arriba tapaba los botones de acción del header. */
        #toast-container {
            position: fixed; bottom: 1.25rem; right: 1.25rem;
            z-index: 99999;
            display: flex; flex-direction: column-reverse; gap: 0.5rem;
            pointer-events: none;
        }
        .toast {
            padding: 0.8rem 1.1rem;
            border-radius: 0.85rem;
            color: white;
            font-size: 0.82rem;
            font-weight: 500;
            min-width: 260px; max-width: 380px;
            box-shadow: 0 12px 32px -8px rgba(15,23,42,0.4);
            animation: toastIn 0.35s cubic-bezier(0.34,1.56,0.64,1);
            display: flex; align-items: center; gap: 0.65rem;
            pointer-events: all; cursor: pointer;
            border: 1px solid rgba(255,255,255,.14);
        }
        .toast.success { background: linear-gradient(135deg,#16a34a,#15803d); }
        .toast.error   { background: linear-gradient(135deg,#dc2626,#b91c1c); }
        .toast.warning { background: linear-gradient(135deg,#d97706,#b45309); }
        .toast.info    { background: linear-gradient(135deg,#244884,#1c3c70); }
        .toast.fade-out { animation: toastOut 0.3s ease forwards; }
        @keyframes toastIn  { from{transform:translateX(110%);opacity:0} to{transform:translateX(0);opacity:1} }
        @keyframes toastOut { from{transform:translateX(0);opacity:1} to{transform:translateX(110%);opacity:0} }

        /* ===== MOBILE SIDEBAR ===== */
        @media (max-width: 768px) {
            #sidebar {
                position: fixed; left: -270px; height: 100vh;
                transition: left 0.3s ease; z-index: 40;
            }
            #sidebar.open { left: 0; }
            #sidebar-overlay { display: none; }
            #sidebar-overlay.active {
                display: block; position: fixed; inset: 0;
                background: rgba(0,0,0,0.55); z-index: 39;
                backdrop-filter: blur(2px);
            }
        }

        /* ===== BADGE ===== */
        .badge {
            display: inline-flex; align-items: center;
            padding: 0.2rem 0.6rem; border-radius: 9999px;
            font-size: 0.7rem; font-weight: 600;
        }

        /* Remove number input arrows */
        input[type=number]::-webkit-inner-spin-button,
        input[type=number]::-webkit-outer-spin-button { -webkit-appearance:none; margin:0; }
        input[type=number] { -moz-appearance: textfield; }

        /* Nav button active state */
        .nav-btn {
            position: relative;
            border-left: 4px solid transparent;
        }
        /* ============================================================
           MENÚ LATERAL
           ------------------------------------------------------------
           Fondo azul, más claro que el gris pizarra que traía la plantilla, y
           opción activa en naranja con texto blanco.
           POR QUÉ ESTOS TRES VALORES Y NO EL NARANJA EXACTO DEL LOGO
           El #ff7b00 del logotipo con texto blanco encima da 2.6:1: ilegible.
           El naranja más claro que aguanta blanco en AA es este #c25d00
           (4.32:1), y con él se rellena el bloque entero, sin filete de otro
           tono ni sombra: la selección tiene que leerse como una superficie
           plana, no como un botón en relieve.
           Con el fondo en #1b3a6b, el texto blanco del resto del menú va a
           11.3:1 y el bloque activo se despega del fondo con holgura.
           ============================================================ */
        #sidebar { background: #1b3a6b; }
        #sidebar,
        #sidebar [class*="border-slate-"] { border-color: rgba(255,255,255,.13); }
        /* Los grises de la plantilla se reinterpretan sobre azul: un slate-800
           sobre un fondo azul se ve sucio, un blanco translúcido no.
           OJO CON LA FORMA DEL SELECTOR. Buscar la subcadena "bg-slate-8" a
           secas alcanza también a `hover:bg-slate-800`, y entonces el fondo se
           aplicaba SIEMPRE, no al pasar el ratón: de ahí el recuadro fijo
           alrededor del botón de contraer y del de cerrar sesión, que sólo
           debían iluminarse al pasar por encima.
           Exigir un espacio delante —o el principio del atributo— limita la
           coincidencia a las clases de verdad y deja fuera las variantes, que
           siempre van precedidas de dos puntos. */
        #sidebar [class*=" bg-slate-8"]:not(.nav-btn),
        #sidebar [class^="bg-slate-8"]:not(.nav-btn),
        #sidebar [class*=" bg-slate-9"]:not(.nav-btn),
        #sidebar [class^="bg-slate-9"]:not(.nav-btn) { background-color: rgba(255,255,255,.09); }
        /* Y el equivalente para las variantes: iluminar SÓLO al pasar el ratón. */
        #sidebar [class*="hover:bg-slate-8"]:not(.nav-btn):hover,
        #sidebar [class*="hover:bg-slate-9"]:not(.nav-btn):hover { background-color: rgba(255,255,255,.14); }
        #sidebar .text-slate-300 { color: rgba(255,255,255,.86); }
        #sidebar .text-slate-400 { color: rgba(255,255,255,.62); }
        #sidebar .text-slate-500,
        #sidebar .text-slate-600 { color: rgba(255,255,255,.48); }
        #sidebar .text-slate-200 { color: #fff; }
        #sidebar .nav-btn:hover { background-color: rgba(255,255,255,.08); }

        /* Bloque naranja PLANO. Antes llevaba un filete de 4 px en el naranja
           puro del logo y una sombra: juntos leían como un relieve, no como una
           selección, y el filete claro parecía un borde a medio pintar. El
           borde se conserva en la misma geometría —para que el elemento activo
           no se desplace respecto a los demás— pero del color del relleno. */
        #sidebar .nav-btn.active,
        #sidebar .nav-btn.active:hover {
            background-color: #c25d00;
            border-left-color: #c25d00;
            box-shadow: none;
        }
        /* Gana a las utilidades de Tailwind por especificidad, sin !important. */
        #sidebar .nav-btn.active,
        #sidebar .nav-btn.active i,
        #sidebar .nav-btn.active .nav-label { color: #fff; }
        #sidebar .nav-btn.active .nav-label[id$="-badge"] {
            background-color: rgba(0,0,0,.26);
            color: #fff;
        }

/* ===== ESTILOS DEL MODAL PRO ===== */
        .modal-tab-content { display: none; }
        .modal-tab-content.active { display: block; animation: fadeIn 0.3s ease; }
        @keyframes fadeIn { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }
        
        /* Custom Sliders */
        input[type=range] { -webkit-appearance: none; background: transparent; }
        input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; height: 16px; width: 16px; border-radius: 50%; background: #2563eb; cursor: pointer; border: 2px solid white; box-shadow: 0 1px 3px rgba(0,0,0,0.3); margin-top: -6px; }
        input[type=range]::-webkit-slider-runnable-track { width: 100%; height: 6px; cursor: pointer; background: #e2e8f0; border-radius: 99px; }
        input[type=range]:focus { outline: none; }
        
        /* Stepper Path */
        .step-line { position: absolute; top: 12px; left: 15%; right: 15%; height: 3px; background: #e2e8f0; z-index: 0; }
        .step-line-fill { position: absolute; top: 12px; left: 15%; height: 3px; background: #2563eb; z-index: 0; transition: width 0.4s ease; }

        /* ============================================================
           CAMPO RELLENADO POR LA MÁQUINA
           ------------------------------------------------------------
           Lo escribe la lectura del CV por IA (34-gemini-cv.js) o la consulta
           del DNI al padrón (31-dni-reniec.js). Se marca porque un dato que nadie
           tecleó hay que mirarlo antes de guardarlo; la marca se va al
           reabrir el expediente, cuando ya está verificado y guardado.
           ============================================================ */
        .campo-autocompletado {
            background-color: #fffbea;
            border-color: #f0c000;
        }

        /* ============================================================
           SKELETONS — evitan el "flash de app vacía" mientras carga
           ============================================================ */
        .sk { position: relative; overflow: hidden; background: #eceff5; border-radius: 6px; }
        .sk::after {
            content: ''; position: absolute; inset: 0;
            transform: translateX(-100%);
            background: linear-gradient(90deg, transparent, rgba(255,255,255,.75), transparent);
            animation: shimmer 1.35s infinite;
        }
        @keyframes shimmer { 100% { transform: translateX(100%); } }

        /* ============================================================
           PALETA DE COMANDOS (Ctrl/⌘ + K)
           ============================================================ */
        #cmdk-overlay { backdrop-filter: blur(6px); background: rgba(15,23,42,.45); }
        .cmdk-item[aria-selected="true"] { background: #eef4ff; box-shadow: inset 3px 0 0 var(--accent); }
        kbd {
            font-family: inherit; font-size: .625rem; font-weight: 700;
            background: #fff; border: 1px solid var(--border-strong);
            border-bottom-width: 2px; border-radius: 5px;
            padding: .1rem .3rem; color: var(--text-muted); line-height: 1.4;
        }

        /* ============================================================
           TIMELINE DE ACTIVIDAD
           ============================================================ */
        .tl-item { position: relative; padding-left: 1.75rem; padding-bottom: 1.05rem; }
        .tl-item::before {
            content: ''; position: absolute; left: 6px; top: 18px; bottom: -2px;
            width: 2px; background: var(--border-strong);
        }
        .tl-item:last-child { padding-bottom: .25rem; }
        .tl-item:last-child::before { display: none; }
        .tl-dot {
            position: absolute; left: 0; top: 4px;
            width: 14px; height: 14px; border-radius: 50%;
            border: 3px solid #fff; box-shadow: 0 0 0 1.5px var(--dot, #cbd5e1);
            background: var(--dot, #cbd5e1);
        }

        /* ============================================================
           TABLA — cabecera fija, filas clicables, densidad
           ============================================================ */
        .data-table thead th {
            position: sticky; top: 0; z-index: 1;
            background: #f8fafc; border-bottom: 1px solid var(--border-strong);
        }
        .data-table tbody tr { transition: background .12s ease; }
        .data-table th.sortable { cursor: pointer; user-select: none; }
        .data-table th.sortable:hover { color: var(--accent); }
        .row-selected { background: #eef4ff !important; }

        /* Barra flotante de acciones masivas */
        #bulk-bar {
            position: fixed; bottom: 1.5rem; left: 50%;
            transform: translate(-50%, 150%);
            transition: transform .3s cubic-bezier(.2,.9,.3,1);
            z-index: 45;
        }
        #bulk-bar.show { transform: translate(-50%, 0); }

        /* Sidebar colapsable en escritorio. Sin botón a la vista: se contrae
           pulsando el logo, con Ctrl/⌘ + B o desde la paleta de comandos. */
        @media (min-width: 769px) {
            #sidebar { transition: width .22s cubic-bezier(.2,.9,.3,1); }
            body.nav-collapsed #sidebar { width: var(--nav-w-collapsed); }
            body.nav-collapsed .nav-label { display: none; }
            body.nav-collapsed #sidebar .nav-btn { justify-content: center; padding-left: 0; padding-right: 0; }
            body.nav-collapsed #sidebar-foot-text { display: none; }
            /* Con la barra estrecha el logo se queda solo: se centra y suelta el
               padding, o quedaría pegado al borde izquierdo. */
            body.nav-collapsed #sidebar-header { justify-content: center; padding-left: 0; padding-right: 0; }
            /* Con 72 px no cabe la marca extendida: se cambia por el isotipo,
               que es la misma marca sin la palabra. */
            body.nav-collapsed #logo-nav-extendido { display: none; }
            body.nav-collapsed #logo-nav-compacto  { display: block; }
        }

        /* ============================================================
           TABLERO — TALENT INTELLIGENCE
           ------------------------------------------------------------
           Todo el bloque cuelga de #tab-dashboard a propósito: son nombres
           genéricos (.panel, .metric, .legend, .footer) y sueltos chocarían
           con el resto de la aplicación. El azul es el de la marca, no el
           del boceto: el tablero no puede ser de otro color que el logo.
           ============================================================ */
        #tab-dashboard {
            --d-ink:      #10223A;
            --d-ink-2:    #31435B;
            --d-muted:    #7F90A5;
            --d-line:     #E2E8EF;
            --d-blue:     #244884;   /* brand-600 */
            --d-blue-2:   #2C5B96;
            --d-surface-2:#F7F9FB;
            --d-green:    #29D39B;
            --d-green-2:  #19B56B;
            --d-shadow:   0 18px 55px rgba(20,42,70,.07);
            --d-radius:   22px;
            color: var(--d-ink);
        }

        /* ---------- Cabecera y barra de filtros ---------- */
        #tab-dashboard .topbar {
            display: grid; grid-template-columns: 1fr auto;
            gap: 24px; align-items: end; margin-bottom: 18px;
        }
        #tab-dashboard .topbar h1 {
            margin: 0; font-size: 32px; line-height: 1; letter-spacing: -.04em; font-weight: 800;
        }
        #tab-dashboard .period { color: var(--d-ink-2); font-size: 12px; font-weight: 750; white-space: nowrap; }

        #tab-dashboard .toolbar {
            display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 16px;
        }
        #tab-dashboard .toolchip { position: relative; }
        #tab-dashboard .toolchip select {
            appearance: none; border: 1px solid var(--d-line); background: rgba(255,255,255,.90);
            color: var(--d-ink-2); border-radius: 11px; padding: 9px 30px 9px 11px; outline: none;
            font-size: 11px; font-weight: 750; cursor: pointer;
        }
        #tab-dashboard .toolchip select:focus { border-color: var(--d-blue); }
        #tab-dashboard .toolchip:after {
            content: "\2304"; position: absolute; right: 10px; top: 4px;
            color: var(--d-muted); font-size: 15px; pointer-events: none;
        }
        #tab-dashboard .filter-summary {
            margin-left: auto; color: var(--d-muted); font-size: 11px; font-weight: 700;
        }
        #tab-dashboard .filter-summary b { color: var(--d-ink-2); }

        /* ---------- Superficies ---------- */
        #tab-dashboard .surface {
            background: rgba(255,255,255,.94); border: 1px solid rgba(225,232,239,.96);
            border-radius: var(--d-radius); box-shadow: var(--d-shadow);
        }
        #tab-dashboard .panel { padding: 22px; }
        #tab-dashboard .section-head {
            display: flex; align-items: flex-start; justify-content: space-between;
            gap: 16px; margin-bottom: 18px;
        }
        #tab-dashboard .section-kicker {
            color: var(--d-muted); font-size: 9px; font-weight: 900;
            text-transform: uppercase; letter-spacing: .13em; margin-bottom: 6px;
        }
        #tab-dashboard .section-title { margin: 0; font-size: 16px; letter-spacing: -.02em; font-weight: 800; }
        #tab-dashboard .section-subtitle { margin: 5px 0 0; color: var(--d-muted); font-size: 11px; line-height: 1.45; }

        /* ---------- Franja de inteligencia ---------- */
        #tab-dashboard .intelligence {
            position: relative; overflow: hidden; min-height: 230px; margin-bottom: 16px;
            display: grid; grid-template-columns: 1.5fr 1fr;
            background:
                linear-gradient(135deg, rgba(255,255,255,.055), rgba(255,255,255,0) 38%),
                linear-gradient(135deg,#2B548A 0%, #244884 48%, #193B68 100%);
            color: #fff; border: 1px solid rgba(255,255,255,.08);
            border-radius: 24px; box-shadow: 0 22px 55px rgba(33,71,119,.18);
        }
        #tab-dashboard .intelligence:before {
            content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .62;
            background:
                repeating-linear-gradient(135deg, transparent 0, transparent 32px, rgba(255,255,255,.025) 32px, rgba(255,255,255,.025) 33px),
                repeating-linear-gradient(90deg, transparent 0, transparent 46px, rgba(255,255,255,.017) 46px, rgba(255,255,255,.017) 47px);
        }
        #tab-dashboard .intel-main {
            position: relative; z-index: 1; padding: 24px 26px 20px;
            border-right: 1px solid rgba(255,255,255,.09); display: flex; flex-direction: column;
        }
        #tab-dashboard .intel-top { display: flex; justify-content: space-between; align-items: center; gap: 18px; }
        #tab-dashboard .intel-label {
            color: #C7D6E7; font-size: 10px; font-weight: 900; letter-spacing: .14em; text-transform: uppercase;
        }
        #tab-dashboard .status {
            display: inline-flex; align-items: center; gap: 7px; color: #F7FAFF;
            font-size: 9px; font-weight: 900; letter-spacing: .08em; text-transform: uppercase;
        }
        #tab-dashboard .status i { width: 7px; height: 7px; border-radius: 2px; background: var(--d-green); }
        #tab-dashboard .score-row { display: flex; align-items: flex-end; gap: 14px; margin-top: 22px; }
        #tab-dashboard .score { font-size: 72px; line-height: .82; font-weight: 900; letter-spacing: -.065em; }
        #tab-dashboard .score-caption { margin-top: 9px; color: #C7D6E7; font-size: 11px; }
        #tab-dashboard .goal { margin-top: auto; padding-top: 24px; }
        #tab-dashboard .goal-head {
            display: flex; justify-content: space-between; gap: 12px; color: #B7CBE0;
            font-size: 9px; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; margin-bottom: 8px;
        }
        #tab-dashboard .goal-head strong { color: #fff; }
        #tab-dashboard .goal-track { height: 5px; background: rgba(130,167,214,.27); position: relative; }
        #tab-dashboard .goal-fill { height: 100%; background: #7A97FF; transition: width .35s ease; }
        #tab-dashboard .goal-mark { position: absolute; top: -5px; width: 2px; height: 15px; background: #57E5B9; }

        #tab-dashboard .intel-side { position: relative; z-index: 1; display: grid; grid-template-columns: 1fr 1fr; }
        #tab-dashboard .metric { padding: 18px 20px; border-bottom: 1px solid rgba(255,255,255,.085); }
        #tab-dashboard .metric:nth-child(odd) { border-right: 1px solid rgba(255,255,255,.085); }
        #tab-dashboard .metric:nth-last-child(-n+2) { border-bottom: 0; }
        #tab-dashboard .metric-label {
            color: #9FB7D1; font-size: 9px; font-weight: 900; text-transform: uppercase; letter-spacing: .10em;
        }
        #tab-dashboard .metric-value {
            margin-top: 8px; color: #fff; font-size: 26px; line-height: 1; font-weight: 900; letter-spacing: -.04em;
        }
        #tab-dashboard .metric-value.corto { font-size: 17px; }
        #tab-dashboard .metric-note { margin-top: 6px; color: #BDD0E3; font-size: 9px; }

        /* ---------- Rejillas ---------- */
        #tab-dashboard .main-grid {
            display: grid; grid-template-columns: minmax(0,2.15fr) minmax(320px,.85fr);
            gap: 16px; margin-bottom: 16px;
        }
        #tab-dashboard .ops-grid,
        #tab-dashboard .bottom-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; }
        #tab-dashboard .bottom-grid { grid-template-columns: .82fr 1.18fr; }

        /* Control segmentado (6/12 meses, filtros de la bandeja). */
        #tab-dashboard .segmented {
            display: flex; gap: 3px; padding: 3px; flex-shrink: 0;
            background: var(--d-surface-2); border: 1px solid #EEF2F6; border-radius: 10px;
        }
        #tab-dashboard .segmented button {
            border: 0; background: transparent; color: var(--d-muted); cursor: pointer;
            padding: 7px 10px; border-radius: 7px; font-size: 10px; font-weight: 850; white-space: nowrap;
        }
        #tab-dashboard .segmented button:hover { color: var(--d-ink-2); }
        #tab-dashboard .segmented button.active {
            background: #fff; color: var(--d-ink); box-shadow: 0 4px 10px rgba(16,34,58,.06);
        }

        #tab-dashboard .chart-wrap { height: 300px; position: relative; }
        /* El plot y su tabla gemela vienen de la capa de visualización, que los
           coloca con un inset pensado para la tarjeta antigua: aquí llenan la
           caja del gráfico, que ya tiene el aire del panel. */
        #tab-dashboard .chart-wrap .viz-plot,
        #tab-dashboard .chart-wrap .viz-tabla { inset: 0; }

        /* ---------- Lo que requiere atención ---------- */
        #tab-dashboard .attention-list { display: grid; gap: 0; max-height: 330px; overflow-y: auto; }
        #tab-dashboard .attention-item {
            display: grid; grid-template-columns: 26px 1fr auto; gap: 12px;
            align-items: start; padding: 14px 0; border-top: 1px solid #EDF1F5;
        }
        #tab-dashboard .attention-item:first-child { border-top: 0; padding-top: 2px; }
        #tab-dashboard .attention-index {
            color: #A7B4C3; font-size: 11px; font-weight: 900; letter-spacing: .06em; padding-top: 2px;
        }
        #tab-dashboard .attention-copy > strong { display: block; font-size: 12px; margin-bottom: 3px; }
        #tab-dashboard .attention-copy p strong { font-weight: 800; color: var(--d-ink-2); }
        #tab-dashboard .attention-copy p { margin: 0; color: var(--d-muted); font-size: 10.5px; line-height: 1.5; }
        /* La señal entera es el botón: así la fila se queda en tres líneas como
           en la maqueta, en vez de crecer con dos botones debajo de cada una. */
        #tab-dashboard .attention-item { cursor: pointer; border-radius: 10px; padding-left: 6px; padding-right: 6px; }
        #tab-dashboard .attention-item:hover { background: #F7FAFD; }
        #tab-dashboard .attention-item:focus-visible { outline: 2px solid var(--d-blue); outline-offset: 2px; }
        #tab-dashboard .attention-lado { display: flex; flex-direction: column; align-items: flex-end; gap: 5px; }
        #tab-dashboard .attention-x {
            border: 0; background: transparent; color: #C3CDD9; cursor: pointer;
            font-size: 11px; line-height: 1; padding: 2px 4px;
        }
        #tab-dashboard .attention-x:hover { color: #B44141; }
        #tab-dashboard .signal {
            min-width: 50px; padding: 5px 7px; border-radius: 999px; background: #F2F6FA;
            color: var(--d-ink-2); font-size: 9px; font-weight: 850; text-align: center;
        }
        #tab-dashboard .signal.good { background: #EAF8F3; color: #15845A; }
        #tab-dashboard .signal.warn { background: #FFF6E8; color: #A66D17; }
        #tab-dashboard .signal.risk { background: #FDEEEE; color: #B44141; }
        #tab-dashboard .executive-note {
            margin-top: 12px; padding: 14px 15px; border-radius: 14px;
            background: linear-gradient(135deg,#F1F5FA,#F8FAFC); border: 1px solid #E8EDF3;
        }
        #tab-dashboard .executive-note small {
            display: block; color: var(--d-blue); font-size: 8px; font-weight: 900;
            text-transform: uppercase; letter-spacing: .12em; margin-bottom: 6px;
        }
        #tab-dashboard .executive-note p { margin: 0; color: var(--d-ink-2); font-size: 10.5px; line-height: 1.55; }

        /* ---------- De dónde vienen los candidatos ---------- */
        #tab-dashboard .src-legend {
            display: flex; gap: 14px; margin: -6px 0 14px;
            color: var(--d-ink-2); font-size: 9px; font-weight: 750;
        }
        #tab-dashboard .src-legend span { display: inline-flex; align-items: center; gap: 6px; }
        #tab-dashboard .src-legend i { width: 9px; height: 9px; border-radius: 2px; }
        #tab-dashboard .src-legend i.vol  { background: #C7D6E7; }
        #tab-dashboard .src-legend i.hire { background: #19B56B; }

        #tab-dashboard .src-list { display: grid; gap: 15px; }
        #tab-dashboard .src-row { display: grid; grid-template-columns: 92px 1fr 62px; gap: 12px; align-items: center; }
        #tab-dashboard .src-name {
            color: var(--d-ink-2); font-size: 11px; font-weight: 800;
            overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
        }
        #tab-dashboard .src-bar { height: 9px; background: #EEF2F6; overflow: hidden; }
        /* El verde va DENTRO de la barra del canal: es una parte de lo que
           llegó por ahí, no una segunda medida independiente. */
        #tab-dashboard .src-bar i { display: block; height: 100%; background: #C7D6E7; }
        #tab-dashboard .src-bar b { display: block; height: 100%; background: linear-gradient(90deg,#16A468,#34C98A); }
        #tab-dashboard .src-value { text-align: right; font-size: 10.5px; font-weight: 900; color: var(--d-ink); }
        #tab-dashboard .src-value small {
            display: block; color: var(--d-muted); font-size: 9px; font-weight: 700; margin-top: 2px;
        }
        #tab-dashboard .src-pie {
            margin-top: 4px; padding-top: 12px; border-top: 1px solid #EDF1F5;
            color: var(--d-muted); font-size: 10px; line-height: 1.5;
        }

        /* ---------- Embudo operativo ---------- */
        #tab-dashboard .funnel { display: grid; gap: 13px; }
        #tab-dashboard .funnel-row { display: grid; grid-template-columns: 115px 1fr 70px; gap: 12px; align-items: center; }
        #tab-dashboard .funnel-label { color: var(--d-ink-2); font-size: 11px; font-weight: 800; }
        #tab-dashboard .funnel-track { height: 11px; background: #EEF2F6; overflow: hidden; }
        #tab-dashboard .funnel-fill { height: 100%; background: linear-gradient(90deg,#244884,#5B7FC0); }
        #tab-dashboard .funnel-fill.success { background: linear-gradient(90deg,#16A468,#34C98A); }
        #tab-dashboard .funnel-value { text-align: right; font-size: 11px; font-weight: 900; color: var(--d-ink); }
        #tab-dashboard .funnel-value small {
            display: block; color: var(--d-muted); font-size: 9px; font-weight: 700; margin-top: 2px;
        }

        /* ---------- Rendimiento por posición ---------- */
        #tab-dashboard .position-head,
        #tab-dashboard .position-row {
            display: grid; grid-template-columns: 1.4fr .48fr .48fr 1fr; gap: 12px; align-items: center;
        }
        #tab-dashboard .position-head {
            padding: 0 0 10px; color: var(--d-muted); font-size: 8px;
            font-weight: 900; letter-spacing: .09em; text-transform: uppercase;
        }
        #tab-dashboard .position-row { padding: 12px 0; border-top: 1px solid #EDF1F5; font-size: 10.5px; }
        #tab-dashboard .position-name { font-weight: 800; color: var(--d-ink-2); }
        #tab-dashboard .conversion { display: flex; align-items: center; gap: 8px; }
        #tab-dashboard .conversion-track { flex: 1; height: 5px; background: #EEF2F6; }
        #tab-dashboard .conversion-fill { height: 100%; background: var(--d-green-2); }
        #tab-dashboard .conversion strong { width: 31px; text-align: right; font-size: 10px; }

        /* ---------- Volumen por cliente ---------- */
        #tab-dashboard .client-list { display: grid; gap: 16px; }
        #tab-dashboard .client-row { display: grid; grid-template-columns: 92px 1fr 70px; gap: 12px; align-items: center; }
        #tab-dashboard .client-name { color: var(--d-ink-2); font-size: 11px; font-weight: 800; }
        #tab-dashboard .client-bar { height: 7px; background: #EEF2F6; overflow: hidden; }
        #tab-dashboard .client-bar i { display: block; height: 100%; background: linear-gradient(90deg,#244884,#7796C8); }
        #tab-dashboard .client-value { color: var(--d-muted); font-size: 9.5px; text-align: right; font-weight: 700; }

        #tab-dashboard .vacio {
            color: var(--d-muted); font-size: 11px; font-style: italic; padding: 18px 0; text-align: center;
        }

        #tab-dashboard .footer {
            display: flex; justify-content: space-between; gap: 20px; margin-top: 16px;
            color: #9AA8B8; font-size: 9px; font-weight: 750; letter-spacing: .05em; text-transform: uppercase;
        }

        @media (max-width: 1180px) {
            #tab-dashboard .intelligence { grid-template-columns: 1fr; }
            #tab-dashboard .intel-main { border-right: 0; border-bottom: 1px solid rgba(255,255,255,.09); }
            #tab-dashboard .main-grid,
            #tab-dashboard .ops-grid,
            #tab-dashboard .bottom-grid { grid-template-columns: 1fr; }
        }
        @media (max-width: 760px) {
            #tab-dashboard .topbar { grid-template-columns: 1fr; }
            #tab-dashboard .topbar h1 { font-size: 26px; }
            #tab-dashboard .period { white-space: normal; }
            #tab-dashboard .filter-summary { width: 100%; margin-left: 0; }
            #tab-dashboard .score { font-size: 58px; }
            #tab-dashboard .position-head, #tab-dashboard .position-row { grid-template-columns: 1.3fr .45fr .45fr 1fr; }
        }
        @media (max-width: 520px) {
            #tab-dashboard .intel-side { grid-template-columns: 1fr; }
            #tab-dashboard .metric { border-right: 0 !important; border-bottom: 1px solid rgba(255,255,255,.085) !important; }
            #tab-dashboard .metric:last-child { border-bottom: 0 !important; }
            #tab-dashboard .funnel-row { grid-template-columns: 85px 1fr 60px; }
            #tab-dashboard .position-head, #tab-dashboard .position-row { grid-template-columns: 1fr .45fr .45fr; }
            #tab-dashboard .position-head > :last-child,
            #tab-dashboard .position-row > :last-child { display: none; }
            #tab-dashboard .client-row { grid-template-columns: 76px 1fr 58px; }
        }

        /* ============================================================
           DASHBOARD — TOKENS DE VISUALIZACIÓN
           ------------------------------------------------------------
           Paleta validada contra la superficie real (#ffffff en las
           tarjetas, #0f172a en el hero): banda de luminosidad, suelo de
           croma, separación bajo protanopia/deuteranopia y contraste.

           Revalidada al adoptar la marca Blauer. Frente a la paleta
           anterior: banda 34.0 → 33.3, peor separación con daltonismo
           20.1 → 22.5 y contraste mínimo 2.17 → 2.29, todos a mejor. El
           único criterio que baja es el croma mínimo (52 → 44), y es
           deliberado: el azul de Blauer es un navy apagado, no el azul
           eléctrico anterior. Sigue muy por encima del suelo de 30.

           El slot 1 (#2b559c) está a ΔE 8.1 del azul exacto del logo
           (#244884) y comparte su tono: el logo puro es demasiado oscuro
           para convivir en la misma banda que el amarillo.
           Los gráficos se escriben contra ROLES, no contra hex sueltos:
           cambiar un color aquí lo cambia en todo el tablero.
           ============================================================ */
        :root {
            /* Categóricas — orden FIJO, se asignan en secuencia, nunca se ciclan.
               Slot 1 es el azul de marca; el resto sale de la paleta de referencia. */
            --viz-1: #2b559c;   /* azul de marca (familia del logo) */
            --viz-2: #d35422;   /* naranja         */
            --viz-3: #1baf7a;   /* aqua            */
            --viz-4: #e59d06;   /* amarillo        */

            /* Ordinal de un solo tono (magnitud/orden): oscuro → claro.
               No aclarar más allá de --viz-ord-3: perdería contraste con el blanco. */
            --viz-ord-1: #153b79;
            --viz-ord-2: #2669d9;
            --viz-ord-3: #749fe7;

            /* Estado — significado reservado, SIEMPRE con icono o etiqueta */
            --viz-good:     #0ca30c;
            --viz-warning:  #fab219;
            --viz-serious:  #ec835a;
            --viz-critical: #d03b3b;

            /* Cromo: rejilla y ejes recesivos, un paso por encima de la superficie */
            --viz-surface:  #ffffff;
            --viz-grid:     #eef1f6;
            --viz-axis:     #dfe3ec;
            --viz-ink:      #334155;
            --viz-ink-soft: #94a3b8;
            --viz-neutral:  #cbd5e1;   /* series de contexto (forma «énfasis») */
        }

        /* ---- Tarjeta de gráfico ---- */
        .viz-card {
            background: var(--surface-raised);
            border: 1px solid var(--border);
            border-radius: var(--radius-xl);
            display: flex; flex-direction: column;
            overflow: hidden;
            transition: border-color .2s ease;
        }
        .viz-card:hover { border-color: #d9deea; }
        .viz-card__head {
            display: flex; align-items: flex-start; justify-content: space-between;
            gap: .75rem; padding: 1.1rem 1.25rem .35rem;
        }
        .viz-card__title { font-size: .8125rem; font-weight: 800; color: var(--text); line-height: 1.25; }
        .viz-card__sub   { font-size: .6875rem; color: var(--text-faint); margin-top: .15rem; line-height: 1.35; }
        .viz-card__tools { display: flex; align-items: center; gap: .25rem; flex-shrink: 0; }
        .viz-tool {
            display: inline-flex; align-items: center; gap: .35rem;
            font-size: .625rem; font-weight: 800; letter-spacing: .04em; text-transform: uppercase;
            color: var(--text-faint); background: transparent;
            border: 1px solid transparent; border-radius: .5rem;
            padding: .3rem .5rem; cursor: pointer;
            transition: background .15s ease, color .15s ease, border-color .15s ease;
        }
        .viz-tool:hover  { background: #f4f6fb; color: var(--accent); border-color: var(--border); }
        .viz-tool[aria-pressed="true"] { background: #eef4ff; color: var(--accent); border-color: #cddbfb; }

        /* El cuerpo reserva altura para el plot MÁS la banda de ejes: si se
           dimensiona sólo el área de trazado, las etiquetas del eje X quedan
           fuera y la tarjeta gana un scroll interno diminuto.
           El plot va en posición absoluta a propósito: un canvas responsive
           necesita una caja RESUELTA; con `height:100%` sobre un padre de
           altura automática, Chart.js cae a sus 150px por defecto. */
        .viz-card__body { position: relative; flex: 1 1 auto; }
        .viz-plot,
        .viz-tabla { position: absolute; inset: .25rem 1.25rem 1.1rem; }
        .viz-card--sm .viz-card__body { min-height: 15.5rem; }
        .viz-card--md .viz-card__body { min-height: 18rem; }
        .viz-card--lg .viz-card__body { min-height: 20.5rem; }

        /* ---- Vista de tabla (gemela accesible de cada gráfico) ---- */
        .viz-tabla { overflow: auto; }
        .viz-tabla table { width: 100%; border-collapse: collapse; font-size: .6875rem; }
        .viz-tabla th, .viz-tabla td { padding: .4rem .5rem; text-align: right; white-space: nowrap; }
        .viz-tabla th:first-child, .viz-tabla td:first-child { text-align: left; white-space: normal; }
        .viz-tabla thead th {
            position: sticky; top: 0; background: var(--surface-raised);
            font-size: .625rem; font-weight: 800; text-transform: uppercase; letter-spacing: .05em;
            color: var(--text-faint); border-bottom: 1px solid var(--border-strong);
        }
        .viz-tabla tbody tr + tr td { border-top: 1px solid var(--border); }
        .viz-tabla td { color: var(--text); font-variant-numeric: tabular-nums; }
        .viz-tabla .viz-swatch {
            display: inline-block; width: .5rem; height: .5rem; border-radius: 2px;
            margin-right: .4rem; vertical-align: baseline;
        }

        /* ---- Ficha de métrica (stat tile) ---- */
        .stat {
            background: var(--surface-raised);
            border: 1px solid var(--border);
            border-radius: var(--radius-lg);
            padding: .85rem .95rem;
            display: flex; flex-direction: column; gap: .1rem;
            transition: border-color .2s ease, transform .2s ease;
        }
        .stat:hover { border-color: #d9deea; transform: translateY(-1px); }
        .stat__label {
            font-size: .625rem; font-weight: 800; letter-spacing: .06em;
            text-transform: uppercase; color: var(--text-faint);
            display: flex; align-items: center; gap: .35rem;
        }
        /* Cifras grandes con figuras PROPORCIONALES: tabular-nums a este tamaño
           deja los números sueltos (un «121» parece separado). */
        .stat__value { font-size: 1.5rem; font-weight: 800; color: var(--text); line-height: 1.15; letter-spacing: -.02em; }
        .stat__foot  { font-size: .625rem; color: var(--text-faint); line-height: 1.3; }
        .stat__spark { height: 1.75rem; margin-top: .3rem; }

        /* ---- Hero: la única cifra que encabeza el tablero ---- */
        .hero {
            position: relative; overflow: hidden;
            background: #0f172a; color: #fff;
            border: 1px solid #1e293b; border-radius: var(--radius-xl);
            padding: 1.35rem 1.5rem;
            display: flex; flex-direction: column;
        }
        .hero__glow {
            position: absolute; top: -5rem; right: -5rem;
            width: 16rem; height: 16rem; border-radius: 9999px;
            filter: blur(72px); opacity: .28;
            transition: background-color .8s ease;
            pointer-events: none;
        }
        .hero__eyebrow {
            font-size: .625rem; font-weight: 800; letter-spacing: .1em;
            text-transform: uppercase; color: #94a3b8;
        }
        .hero__figure {
            font-size: 3.5rem; font-weight: 800; line-height: 1;
            letter-spacing: -.045em; margin: .5rem 0 .15rem;
        }
        .hero__sub { font-size: .6875rem; color: #cbd5e1; }

        /* Medidor: el hueco es un paso más claro del MISMO tono, no un gris neutro,
           para que el estado se lea a lo largo de toda la barra. */
        .meter { position: relative; height: .5rem; border-radius: 9999px; background: rgba(148,163,184,.22); margin-top: 1rem; }
        .meter__fill { height: 100%; border-radius: 9999px; transition: width .7s cubic-bezier(.2,.9,.3,1), background-color .5s ease; }
        /* Marca de la meta: sin ella el relleno no dice contra qué se compara. */
        .meter__meta {
            position: absolute; top: -3px; bottom: -3px; width: 2px;
            background: rgba(255,255,255,.75); border-radius: 1px;
            transform: translateX(-1px);
            transition: left .5s cubic-bezier(.2,.9,.3,1);
        }
        .hero__nota { font-size: .625rem; color: #94a3b8; margin-top: .45rem; }

        .hero__rows { margin-top: auto; padding-top: 1.1rem; display: flex; flex-direction: column; gap: .5rem; }
        .hero__row {
            display: flex; align-items: center; justify-content: space-between; gap: .75rem;
            font-size: .6875rem; color: #cbd5e1;
        }
        .hero__row b { color: #fff; font-weight: 700; }
        .hero__chip {
            display: inline-flex; align-items: center; gap: .3rem;
            font-size: .625rem; font-weight: 800; letter-spacing: .03em;
            padding: .15rem .5rem; border-radius: .375rem; border: 1px solid;
        }

        /* Al refrescar NO se parpadea con un skeleton: se atenúa lo ya pintado. */
        .viz-refrescando { opacity: .55; transition: opacity .15s ease; }

        /* ============================================================
           EL EDITOR DE INFORMES

           Estas reglas son el ESPEJO de las que `cssInforme()` mete en el PDF
           (js/26-informes.js). Se escribe sobre lo que se va a imprimir, así
           que si allí cambia el aspecto de una tabla o de un cuadro, aquí
           también: verlo de una forma y que salga de otra es peor que no
           verlo.

           Van al final del archivo, después de todo lo demás, para que ganen
           sin necesidad de !important.
           ============================================================ */
        .editor-rico {
            overflow-y: auto;
            max-height: 60vh;
            white-space: pre-wrap;   /* respeta los saltos que teclea el usuario */
            word-break: break-word;
        }
        .editor-rico { position: relative; }
        .editor-rico:focus { outline: none; }

        /* La pista NO vive en el DOM: si fuera un párrafo de verdad, el usuario
           escribiría encima de él y acabaría guardado dentro del informe. */
        .editor-rico:empty::before {
            content: attr(data-ph);
            color: #a3adbf; font-style: italic; pointer-events: none;
        }

        /* Vacío no es lo mismo que en blanco: el marcador dice que ese apartado
           está sin consignar, igual que lo dirá el informe. */
        .editor-rico .vacio { color: #a3adbf; font-style: italic; margin: 0; }
        .editor-rico:focus .vacio { opacity: .55; }

        .editor-rico > p { margin: 0 0 .55em; }
        .editor-rico > p:last-child { margin-bottom: 0; }

        .editor-rico .r-sub {
            font-size: 12px; font-weight: 700; letter-spacing: .4px; color: #20293a;
            text-transform: none; margin: .9em 0 .35em;
        }
        .editor-rico > .r-sub:first-child { margin-top: 0; }

        .editor-rico .r-lista { margin: .4em 0 .7em; padding-left: 1.35em; }
        .editor-rico ul.r-lista { list-style: disc; }
        .editor-rico ol.r-lista { list-style: decimal; }
        .editor-rico .r-lista li { margin-bottom: .2em; }

        .editor-rico .r-cuadro {
            border-left: 3px solid #2b559c; background: #f6f8fc;
            padding: .55em .8em; margin: .7em 0; border-radius: 0 6px 6px 0;
        }
        .editor-rico .r-cuadro p { margin: 0 0 .25em; }
        .editor-rico .r-cuadro p:last-child { margin-bottom: 0; }

        .editor-rico .r-tabla {
            width: 100%; border-collapse: collapse; margin: .8em 0; font-size: 12.5px;
        }
        .editor-rico .r-tabla th {
            text-align: left; font-size: 9.5px; letter-spacing: 1.1px; text-transform: uppercase;
            color: #8a93a6; font-weight: 700; padding: 0 .6em .35em 0;
            border-bottom: 1.5px solid #20293a;
        }
        .editor-rico .r-tabla td {
            padding: .35em .6em .35em 0; border-bottom: 1px solid #eef1f6;
            vertical-align: top; color: #374151;
        }
        .editor-rico .r-tabla td:first-child { font-weight: 600; color: #1f2937; }
        /* Una celda vacía no se puede pinchar si no ocupa nada. */
        .editor-rico .r-tabla td:empty::after,
        .editor-rico .r-tabla th:empty::after { content: ''; display: inline-block; min-height: 1.2em; }
        /* Al escribir dentro se marca la celda: en una tabla sin bordes
           verticales, si no, no se sabe en cuál está el cursor. */
        .editor-rico .r-tabla td:focus,
        .editor-rico .r-tabla th:focus { outline: 2px solid rgba(55,97,166,.25); outline-offset: -2px; }

        .editor-rico strong, .editor-rico b { font-weight: 700; color: #1f2937; }
        .editor-rico em, .editor-rico i { font-style: italic; }

        /* Impresión: sólo el expediente del candidato */
        @media print {
            body * { visibility: hidden; }
            #contenido-pdf, #contenido-pdf * { visibility: visible; }
            #contenido-pdf { position: absolute; left: 0; top: 0; width: 100%; box-shadow: none; }
            [data-html2canvas-ignore] { display: none !important; }
        }

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

/* ------------------------------------------------------------
   Bloques plegables (<details>)
   ------------------------------------------------------------
   La chuleta de comportamientos del pipeline se pliega: es material de
   consulta, no algo que mirar cada vez, y abierta metía media pantalla
   entre la tabla de etapas y la lista de flujos de abajo.

   Safari y algunos WebKit siguen pintando su propio triángulo aunque el
   summary lleve `list-style:none`, así que hay que quitárselo aparte. */
summary::-webkit-details-marker { display: none; }
details[open] > summary .fa-chevron-down { transform: rotate(180deg); }
