/* Cyber-Tactical HUD Design System - CORE ONLY */
@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@300;500;800&family=Outfit:wght@300;400;700;900&family=Rajdhani:wght@500;600;700&display=swap');

:root {
    --bg-main: #010206;
    --hud-cyan: #00f3ff;
    --hud-emerald: #00ffa3;
    --hud-border: rgba(0, 243, 255, 0.15);
    --hud-panel: rgba(0, 243, 255, 0.03);
    --glass-border: rgba(255, 255, 255, 0.1);
    --text-main: #ffffff;
    --text-dim: rgba(255, 255, 255, 0.4);

    /* Breakpoints (referencia para JS si se necesitan) */
    --bp-sm: 640px;   /* móvil máximo */
    --bp-md: 1024px;  /* tablet máximo */
}

/* Helpers responsive */
.show-mobile { display: none; }       /* visible solo ≤ 1024px */
.hide-mobile { display: initial; }    /* oculto en móvil */

@media (max-width: 1024px) {
    .show-mobile { display: initial; }
    .hide-mobile { display: none !important; }
}

/* ============================================================
   MENÚ MÓVIL (hamburger) + backdrop + drawer del sidebar
   ============================================================ */
.mobile-menu-btn {
    background: transparent;
    border: 1px solid rgba(0, 243, 255, 0.3);
    color: #00f3ff;
    width: 38px;
    height: 38px;
    border-radius: 8px;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    margin-right: 12px;
    transition: background 0.2s, border-color 0.2s;
}
.mobile-menu-btn:hover { background: rgba(0, 243, 255, 0.08); }
.mobile-menu-btn svg { width: 22px; height: 22px; }

.mobile-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}
.mobile-backdrop.is-open {
    opacity: 1;
    visibility: visible;
}

@media (max-width: 1024px) {
    /* Mostrar el hamburger */
    .mobile-menu-btn { display: inline-flex; }

    /* Ocultar el top-nav del medio (la navegación se hace por el sidebar) */
    .top-nav { display: none; }

    /* Compactar el PMO brand */
    .pmo-label { font-size: 0.55rem; letter-spacing: 2px; }
    .pmo-title { font-size: 1.1rem; }

    /* Sidebar izquierdo como DRAWER */
    .sidebar-hud {
        transform: translateX(-100%);
        transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
        z-index: 1500;
    }
    .sidebar-hud.is-open {
        transform: translateX(0);
    }

    /* HERO / HUD CENTRAL — sin offset vertical para que quede centrado en viewport móvil */
    .hero-container {
        top: 50%;                          /* sin +50px del desktop */
        padding-top: 8px;                  /* antes 30px, deja respirar al título */
        padding-bottom: 90px;              /* deja espacio bajo para los 3 tabs flotantes */
        height: calc(100vh - 96px);        /* viewport menos topbar(60) + ticker(36) */
        justify-content: center;
        gap: 8px;
    }
    .hero-title { font-size: 2.4rem; letter-spacing: 4px; margin-top: 0; align-self: center; margin-left: 0; text-align: center; }
    .hero-subtitle { font-size: 0.7rem; letter-spacing: 2px; padding: 0 20px; }
    .main-visual-container { max-width: 92vw; margin-top: 4px; }
    #cySvg, #mvcsSvg, #articulacionSvg { max-width: 92vw; }
    #map-container { max-width: 92vw; }

    /* Tabs HUD: más compactos */
    .hud-tabs { gap: 8px; padding: 8px; }
    .hud-tab { width: 40px; height: 40px; }
    .hud-tab svg, .hud-tab i[data-lucide] { width: 18px; height: 18px; }

    /* Tooltip más pequeño */
    #tooltip { padding: 10px 14px; min-width: 200px; font-size: 1.25rem; }
}

@media (max-width: 640px) {
    .hero-title { font-size: 1.8rem; letter-spacing: 3px; }
    .hero-subtitle { font-size: 0.6rem; letter-spacing: 1.5px; }
    .pmo-label { display: none; }   /* En móvil pequeño solo el OGMEI */
    .hud-tabs { gap: 6px; padding: 6px; }
    .hud-tab { width: 36px; height: 36px; }
}

/* ============================================================
   PANEL DERECHO EN MÓVIL → BOTTOM SHEET
   Tabs cuadrados se acomodan en una barra horizontal pegada al borde
   inferior derecho. Al expandir, el panel sube como sheet desde abajo.
   ============================================================ */
@media (max-width: 1024px) {
    /* Cada tab cuadrado se posiciona en barra horizontal abajo */
    #board-primary  { top: auto !important; bottom: 14px; right: 12px; }
    #board-metas    { top: auto !important; bottom: 14px; right: 70px;  --ab-panel-w: 100vw; }
    #board-prioridad{ top: auto !important; bottom: 14px; right: 128px; }
    #board-primary  { --ab-panel-w: 100vw; }
    #board-prioridad{ --ab-panel-w: 100vw; }

    /* En móvil el board ya no se desliza de derecha sino de abajo */
    .airport-board {
        right: 0 !important;
        left: 0;
        width: 100vw !important;
        max-width: 100vw;
        bottom: 0;
        top: auto !important;
        transform: translateY(100%);
        transition: transform 0.55s cubic-bezier(0.65, 0, 0.35, 1);
        border-radius: 14px 14px 0 0;
        max-height: 80vh;
        overflow-y: auto;
        padding: 22px 16px 28px;
    }
    .airport-board.expanded {
        transform: translateY(0);
    }

    /* El tab del board flotante en la barra horizontal: relocalizar el botón */
    .toggle-board-btn {
        left: auto;
        right: 0;
        top: 0;
        position: relative;       /* dentro del panel, pero el panel ya no está abierto */
        border-radius: 10px;
        border-right: 1px solid var(--ab-edge);
    }
    /* En móvil el tab debe ser fijo en el viewport (no dentro del panel cerrado) */
    .airport-board:not(.expanded) > .toggle-board-btn {
        position: fixed;
        bottom: 14px;
        width: 48px;
        height: 48px;
        z-index: 1100;
    }
    #board-primary:not(.expanded)   > .toggle-board-btn { right: 14px; }
    #board-metas:not(.expanded)     > .toggle-board-btn { right: 74px; }
    #board-prioridad:not(.expanded) > .toggle-board-btn { right: 134px; }

    /* Cerrar del bottom sheet más cómodo en móvil */
    .board-close-btn {
        top: 10px;
        right: 10px;
        width: 36px;
        height: 36px;
    }

    /* ============================================================
       MODAL CINEMÁTICO (5x3 UE) → 1 columna scrollable
       ============================================================ */
    #modal-cinematic {
        width: 100vw;
        height: 100vh;
        max-width: 100vw;
        max-height: 100vh;
        border-radius: 0;
        top: 0;
        left: 0;
        transform: translate(0, 0) scale(0.96);
    }
    #modal-cinematic.show { transform: translate(0, 0) scale(1); }

    .ultra-grid {
        grid-template-columns: 1fr;           /* 1 columna apilada */
        grid-auto-rows: auto;
        gap: 12px;
        padding: 14px;
        overflow-y: auto;
    }

    .ue-column {
        padding: 12px 10px;
    }
    .ue-title { font-size: 1rem; letter-spacing: 2px; }
    .gauge-segmented { width: 110px; height: 55px; }
    .hud-big-val { font-size: 1.4rem; }

    /* Header del modal: stack vertical para que entre el "ACTUALIZADO AL..." */
    .kpi-header {
        flex-direction: column;
        gap: 10px;
        padding: 14px 18px;
        align-items: flex-start;
    }
    .kpi-header-right { flex-wrap: wrap; gap: 10px; }
    .kpi-updated { font-size: 0.62rem; }

    /* ============================================================
       ALERT TICKER en móvil
       ============================================================ */
    .ticker-bar { height: 36px; }
    .ticker-label { font-size: 0.7rem; padding: 0 12px; gap: 6px; }
    .ticker-label svg { width: 16px; height: 16px; }
    .ticker-item { font-size: 0.78rem; gap: 10px; }
    .ticker-item .dot { width: 6px; height: 6px; }

}

/* Touch: pausar animación del ticker al tocar (compatible con todos los browsers) */
@media (hover: none) {
    .ticker-content:active { animation-play-state: paused; }
}

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

/* Restore pointer for interactive elements */
a, button, [onclick], select, input, textarea,
.hud-tab, .nav-anchor, .submenu-link, .ticker-label,
.meibot-container, .toggle-board-btn, .view-more-row,
.user-profile-trigger, .logout-btn {
    cursor: pointer;
}

body {
    background-color: var(--bg-main);
    color: var(--text-main);
    font-family: 'Outfit', sans-serif;
    height: 100vh;
    overflow: hidden;
    position: relative;
}

/* --- TRANSITION SYSTEM --- */
.page-fade-in {
    animation: page-in-anim 1.2s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

@keyframes page-in-anim {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* Overlay de entrada: blur + tinte oscuro que se desvanece sin tocar el layout */
.entry-veil {
    position: fixed;
    inset: 0;
    z-index: 99998;
    background: rgba(1, 4, 10, 0.55);
    backdrop-filter: blur(28px);
    -webkit-backdrop-filter: blur(28px);
    pointer-events: none;
    animation: entry-veil-fade 1.8s 0.05s cubic-bezier(0.4, 0, 0.2, 1) forwards;
    will-change: opacity;
}
@keyframes entry-veil-fade {
    0%   { opacity: 1; }
    100% { opacity: 0; }
}

.cinematic-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: transparent;
    z-index: 99999;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    overflow: hidden;
}

/* 1. DYNAMIC TACTICAL BACKGROUND (AURORA HACKER MODE) */
.aurora-bg {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    z-index: -1;
    overflow: hidden;
    background: #01040a;
}

/* Vibrant Aurora Energy Clouds */
.aurora-bg::before {
    content: '';
    position: absolute;
    width: 200%; height: 200%;
    top: -50%; left: -50%;
    background: 
        radial-gradient(circle at 20% 30%, rgba(0, 243, 255, 0.3) 0%, transparent 40%),
        radial-gradient(circle at 80% 20%, rgba(189, 0, 255, 0.2) 0%, transparent 40%),
        radial-gradient(circle at 50% 80%, rgba(0, 100, 255, 0.25) 0%, transparent 50%),
        radial-gradient(circle at 70% 40%, rgba(0, 255, 163, 0.15) 0%, transparent 30%);
    filter: blur(120px);
    animation: aurora-drift 25s infinite alternate ease-in-out;
    will-change: transform, filter;
    opacity: 0.8;
}

@keyframes aurora-drift {
    0% { transform: rotate(0deg) scale(1); filter: blur(120px) hue-rotate(0deg); }
    50% { transform: rotate(5deg) scale(1.1) translate(2%, 2%); filter: blur(120px) hue-rotate(180deg); }
    100% { transform: rotate(-5deg) scale(1.05) translate(-2%, -2%); filter: blur(120px) hue-rotate(360deg); }
}

/* Moving Tactical Grid (Brightened) */
.aurora-bg::after {
    content: '';
    position: absolute;
    width: 200%; height: 200%;
    top: 0; left: -50%;
    background-image: 
        linear-gradient(rgba(0, 243, 255, 0.1) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 243, 255, 0.1) 1px, transparent 1px);
    background-size: 80px 80px;
    transform: perspective(600px) rotateX(60deg);
    animation: grid-scroll 15s infinite linear;
    mask-image: radial-gradient(ellipse at center, black, transparent 90%);
}

@keyframes grid-scroll {
    from { background-position: 0 0; }
    to { background-position: 0 80px; }
}

/* Global CRT Scanline Overlay */
body::after {
    content: "";
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.05) 50%);
    background-size: 100% 4px;
    z-index: 10000;
    pointer-events: none;
    opacity: 0.3;
}

/* 2. APP CONTAINER & LAYOUT */
.app-container::after {
    content: '';
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    border: 1px solid var(--hud-border);
    pointer-events: none;
    z-index: 999;
    box-shadow: inset 0 0 100px rgba(0, 243, 255, 0.05);
}

.main-layout {
    display: flex;
    flex: 1;
    overflow: visible;
}

/* 3. TOPBAR: FLOATING HUD ISLAND */
.topbar {
    height: 60px;
    background: linear-gradient(180deg, rgba(1, 2, 6, 0.9) 0%, transparent 100%);
    backdrop-filter: blur(15px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    position: relative;
}

.topbar-left {
    position: absolute;
    left: 20px;
    display: flex;
    align-items: center;
    z-index: 1001;
}

.pmo-brand {
    display: flex;
    flex-direction: column;
}

.pmo-label {
    font-family: 'Outfit', sans-serif;
    font-size: 0.65rem;
    color: var(--text-dim);
    letter-spacing: 1.5px;
    font-weight: 400;
    line-height: 1;
}

.pmo-title {
    font-family: 'Outfit', sans-serif;
    font-size: 1.5rem;
    font-weight: 900;
    color: var(--hud-cyan);
    letter-spacing: 4px;
    line-height: 1;
    margin-top: 4px;
    text-shadow: 0 0 20px rgba(0, 243, 255, 0.4);
}

.top-nav {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
}

.nav-list {
    display: flex;
    list-style: none;
    gap: 24px;
}

.nav-item {
    position: relative;
}

.top-nav-link {
    color: rgba(255, 255, 255, 0.7); /* Mucho más visible */
    text-decoration: none;
    font-family: 'Rajdhani', sans-serif;
    font-size: 1rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 2px;
    transition: color 0.3s cubic-bezier(0.4, 0, 0.2, 1), text-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 0;
}

.nav-arrow {
    width: 14px !important;
    height: 14px !important;
    opacity: 0.6;
    transition: transform 0.3s;
}

.nav-item:hover > .top-nav-link {
    color: var(--hud-cyan);
    text-shadow: 0 0 15px var(--hud-cyan);
    opacity: 1;
}

.nav-item:hover .nav-arrow {
    transform: rotate(180deg);
    color: var(--hud-cyan);
    opacity: 1;
}

/* 2ND LEVEL: DROPDOWN MENU */
.dropdown-menu {
    position: absolute;
    top: 100%;
    left: -20px;
    background: rgba(3, 8, 18, 0.98);
    backdrop-filter: blur(30px);
    border: 1px solid rgba(0, 243, 255, 0.3);
    min-width: 240px;
    list-style: none;
    padding: 12px 0;
    opacity: 0;
    visibility: hidden;
    transform: translateY(15px);
    transition: all 0.4s cubic-bezier(0.19, 1, 0.22, 1);
    box-shadow: 0 20px 50px rgba(0,0,0,0.8), inset 0 0 20px rgba(0, 243, 255, 0.05);
}

.nav-item:hover .dropdown-menu,
.nav-item:focus-within .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-item a {
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    padding: 12px 25px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-family: 'Rajdhani', sans-serif;
    font-size: 1rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 2px;
    transition: color 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 0.8;
}

.dropdown-item:hover > a {
    color: var(--hud-cyan);
    text-shadow: 0 0 15px var(--hud-cyan);
    opacity: 1;
}

.dropdown-item:hover > a .flyout-arrow {
    opacity: 1;
    color: var(--hud-cyan);
}

.flyout-arrow {
    width: 14px !important;
    height: 14px !important;
    opacity: 0.6;
    transition: all 0.3s;
}

/* 3RD LEVEL: FLYOUT MENU */
.flyout-menu {
    position: absolute;
    top: -12px;
    left: 100%;
    background: rgba(3, 8, 18, 0.98);
    backdrop-filter: blur(30px);
    border: 1px solid rgba(0, 243, 255, 0.3);
    min-width: 220px;
    list-style: none;
    padding: 12px 0;
    opacity: 0;
    visibility: hidden;
    transform: translateX(15px);
    transition: all 0.4s cubic-bezier(0.19, 1, 0.22, 1);
    box-shadow: 0 20px 50px rgba(0,0,0,0.8);
}

.dropdown-item:hover .flyout-menu,
.dropdown-item:focus-within .flyout-menu {
    opacity: 1;
    visibility: visible;
    transform: translateX(0);
}

.flyout-menu li a {
    padding: 10px 25px;
    font-size: 0.9rem;
}

.flyout-menu li:hover > a {
    color: var(--hud-cyan);
    text-shadow: 0 0 15px var(--hud-cyan);
    opacity: 1;
}



.topbar-right {
    position: absolute;
    right: 20px;
    display: flex;
    align-items: center;
    z-index: 1001;
}

.topbar-clock {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    margin-right: 18px;
    pointer-events: none;
}

#header-time {
    font-family: 'JetBrains Mono', monospace;
    font-size: 1rem;
    color: #fff;
    font-weight: 800;
    line-height: 1;
    letter-spacing: 1px;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.2);
}

#header-date {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.75rem;             /* ligeramente más grande (antes 0.6rem) */
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 1.2px;
    margin-top: 3px;
}

.header-divider {
    height: 25px;
    width: 1px;
    background: linear-gradient(to bottom, transparent, rgba(0, 243, 255, 0.4), transparent);
    margin-right: 18px;
}

/* Buscador de proyectos por CUI (topbar) */
/* Botón "Buscar código" del topbar — abre el modal de consulta por CUI.
   Mantiene el lenguaje HUD del antiguo buscador (alto 36px, borde cian). */
.cui-search-trigger {
    display: flex;
    align-items: center;
    gap: 9px;
    height: 36px;
    padding: 0 16px;
    margin-right: 18px;
    background: rgba(0, 243, 255, 0.05);
    border: 1px solid rgba(0, 243, 255, 0.25);
    border-radius: 8px;
    color: #fff;
    cursor: pointer;
    font-family: 'Rajdhani', sans-serif;
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 1.2px;
    text-transform: uppercase;
    transition: border-color 0.3s, box-shadow 0.3s, background 0.3s, transform 0.2s;
}
.cui-search-trigger:hover {
    border-color: var(--hud-cyan);
    background: rgba(0, 243, 255, 0.1);
    box-shadow: 0 0 14px rgba(0, 243, 255, 0.25);
    transform: translateY(-1px);
}
.cui-search-trigger-icon {
    width: 16px !important;
    height: 16px !important;
    color: var(--hud-cyan);
    flex-shrink: 0;
    opacity: 0.9;
}
.cui-search-trigger-text { white-space: nowrap; }

.cui-search {
    display: flex;
    align-items: center;
    gap: 6px;
    height: 36px;
    padding: 0 6px 0 12px;
    margin-right: 18px;
    background: rgba(0, 243, 255, 0.05);
    border: 1px solid rgba(0, 243, 255, 0.25);
    border-radius: 8px;
    transition: border-color 0.3s, box-shadow 0.3s, background 0.3s;
}
.cui-search:focus-within {
    border-color: var(--hud-cyan);
    background: rgba(0, 243, 255, 0.08);
    box-shadow: 0 0 14px rgba(0, 243, 255, 0.25);
}
.cui-search-icon {
    width: 16px !important;
    height: 16px !important;
    color: var(--hud-cyan);
    flex-shrink: 0;
    opacity: 0.85;
}
.cui-search-input {
    border: none;
    background: transparent;
    outline: none;
    color: #fff;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8rem;
    letter-spacing: 0.5px;
    width: 150px;
}
.cui-search-input::placeholder {
    color: var(--text-dim);
    letter-spacing: 0.5px;
}
/* Oculta la "x" nativa del input type=search para mantener el estilo HUD */
.cui-search-input::-webkit-search-cancel-button { -webkit-appearance: none; }
.cui-search-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border: none;
    border-radius: 6px;
    background: rgba(0, 243, 255, 0.12);
    color: var(--hud-cyan);
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.3s, transform 0.2s, color 0.3s;
}
.cui-search-btn:hover {
    background: var(--hud-cyan);
    color: #02121a;
    transform: scale(1.05);
}
.cui-search-btn svg { width: 15px; height: 15px; }

/* En móvil el top-nav se oculta; el buscador del topbar muestra solo el icono */
@media (max-width: 1024px) {
    .cui-search { display: none; }
    .cui-search-trigger-text { display: none; }
    .cui-search-trigger { padding: 0 10px; }
}

/* ==========================================
   CONTADOR DE VISITAS — widget inferior izquierdo
   ========================================== */
.visits-widget {
    position: fixed;
    bottom: 30px;
    left: 30px;
    z-index: 1200;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 18px 12px 14px;
    background: linear-gradient(135deg, rgba(0, 243, 255, 0.12), rgba(3, 8, 18, 0.85));
    border: 1px solid rgba(0, 243, 255, 0.45);
    border-radius: 10px;
    backdrop-filter: blur(6px);
    box-shadow: 0 0 22px rgba(0, 243, 255, 0.25), inset 0 0 12px rgba(0, 243, 255, 0.08);
    cursor: default;
    animation: visits-in 0.6s cubic-bezier(0.19, 1, 0.22, 1) both, visits-breathe 3.2s ease-in-out infinite;
}

.visits-widget:hover {
    box-shadow: 0 0 30px rgba(0, 243, 255, 0.5), inset 0 0 16px rgba(0, 243, 255, 0.12);
    border-color: var(--hud-cyan);
}

/* Punto pulsante "en vivo" en la esquina */
.visits-widget-pulse {
    position: absolute;
    top: -5px;
    right: -5px;
    width: 12px;
    height: 12px;
    background: var(--hud-emerald);
    border-radius: 50%;
    box-shadow: 0 0 10px var(--hud-emerald);
}
.visits-widget-pulse::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: var(--hud-emerald);
    animation: visits-ping 1.8s cubic-bezier(0, 0, 0.2, 1) infinite;
}

.visits-widget-icon {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: rgba(0, 243, 255, 0.1);
    border: 1px solid rgba(0, 243, 255, 0.3);
}
.visits-widget-icon svg {
    width: 22px;
    height: 22px;
    stroke: var(--hud-cyan);
    filter: drop-shadow(0 0 5px rgba(0, 243, 255, 0.6));
}

.visits-widget-body {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    line-height: 1;
}

.visits-widget-label {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.7rem;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 4px;
}

.visits-widget-value {
    font-family: 'JetBrains Mono', monospace;
    font-size: 1.6rem;
    color: var(--hud-cyan);
    font-weight: 800;
    letter-spacing: 1.5px;
    text-shadow: 0 0 14px rgba(0, 243, 255, 0.7);
}

@keyframes visits-in {
    from { opacity: 0; transform: translateX(-30px); }
    to   { opacity: 1; transform: translateX(0); }
}
@keyframes visits-breathe {
    0%, 100% { box-shadow: 0 0 22px rgba(0, 243, 255, 0.25), inset 0 0 12px rgba(0, 243, 255, 0.08); }
    50%      { box-shadow: 0 0 30px rgba(0, 243, 255, 0.45), inset 0 0 16px rgba(0, 243, 255, 0.14); }
}
@keyframes visits-ping {
    0%   { transform: scale(1);   opacity: 0.7; }
    75%, 100% { transform: scale(2.6); opacity: 0; }
}

/* Resaltado breve cuando el número se actualiza */
.visits-widget-value.bump {
    animation: visits-bump 0.5s ease;
}
@keyframes visits-bump {
    0%   { transform: scale(1); }
    40%  { transform: scale(1.25); color: var(--hud-emerald); text-shadow: 0 0 18px var(--hud-emerald); }
    100% { transform: scale(1); }
}

@media (max-width: 640px) {
    .visits-widget { bottom: 16px; left: 16px; padding: 9px 13px 9px 10px; gap: 9px; }
    .visits-widget-icon { width: 32px; height: 32px; }
    .visits-widget-icon svg { width: 18px; height: 18px; }
    .visits-widget-value { font-size: 1.25rem; }
}

.user-profile-trigger {
    width: 42px;
    height: 42px;
    background: rgba(0, 243, 255, 0.05);
    border: 1px solid rgba(0, 243, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.3s cubic-bezier(0.19, 1, 0.22, 1), border-color 0.3s cubic-bezier(0.19, 1, 0.22, 1), box-shadow 0.3s cubic-bezier(0.19, 1, 0.22, 1), transform 0.3s cubic-bezier(0.19, 1, 0.22, 1);
    position: relative;
    box-shadow: 0 0 15px rgba(0, 243, 255, 0.05);
}

.user-profile-trigger:hover {
    background: rgba(0, 243, 255, 0.15);
    border-color: var(--hud-cyan);
    box-shadow: 0 0 20px rgba(0, 243, 255, 0.2);
    transform: scale(1.05);
}

.user-icon {
    color: var(--hud-cyan);
    width: 22px !important;
    height: 22px !important;
    filter: drop-shadow(0 0 5px rgba(0, 243, 255, 0.5));
}

.user-status-dot {
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 10px;
    height: 10px;
    background: var(--hud-emerald);
    border: 2px solid var(--bg-main);
    border-radius: 50%;
    box-shadow: 0 0 10px var(--hud-emerald);
    z-index: 2;
}

.user-card {
    position: absolute;
    top: 60px;
    right: 0;
    width: 280px;
    background: rgba(3, 8, 18, 0.95);
    backdrop-filter: blur(25px);
    border: 1px solid rgba(0, 243, 255, 0.2);
    border-radius: 16px;
    padding: 20px;
    display: none;
    flex-direction: column;
    gap: 15px;
    z-index: 2000;
    box-shadow: 0 20px 50px rgba(0,0,0,0.8), inset 0 0 20px rgba(0, 243, 255, 0.05);
}

.user-card.active {
    display: flex;
    animation: user-card-in 0.4s cubic-bezier(0.19, 1, 0.22, 1) forwards;
}

@keyframes user-card-in {
    0% { opacity: 0; transform: translateY(-15px) scale(0.95); filter: blur(10px); }
    100% { opacity: 1; transform: translateY(0) scale(1); filter: blur(0); }
}

.user-card-header {
    display: flex;
    align-items: center;
    gap: 15px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    padding-bottom: 15px;
}

.user-avatar-large {
    width: 54px;
    height: 54px;
    background: linear-gradient(135deg, rgba(0, 243, 255, 0.15), rgba(189, 0, 255, 0.05));
    border: 1px solid rgba(0, 243, 255, 0.3);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--hud-cyan);
    box-shadow: 0 0 15px rgba(0, 243, 255, 0.1);
}

.user-avatar-large i {
    width: 28px !important;
    height: 28px !important;
}

.user-info {
    display: flex;
    flex-direction: column;
}

.user-name {
    font-family: 'Rajdhani', sans-serif;
    font-weight: 700;
    color: #fff;
    font-size: 1.1rem;
    letter-spacing: 0.5px;
}

.user-role {
    font-family: 'Rajdhani', sans-serif;
    font-size: 0.7rem;
    color: var(--hud-cyan);
    text-transform: uppercase;
    letter-spacing: 1px;
    opacity: 0.8;
}

.user-card-body {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.user-data-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 12px 15px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.user-data-item:hover {
    background: rgba(0, 243, 255, 0.05);
    border-color: rgba(0, 243, 255, 0.1);
}

.user-data-item i {
    color: var(--hud-cyan);
    width: 20px !important;
    height: 20px !important;
    opacity: 0.8;
}

.user-data-info {
    display: flex;
    flex-direction: column;
}

.user-data-label {
    font-family: 'Rajdhani', sans-serif;
    font-size: 0.65rem;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin-bottom: 2px;
}

.user-data-value {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.95rem;
    color: #fff;
    font-weight: 500;
}

#session-timer {
    color: var(--hud-emerald);
    text-shadow: 0 0 10px rgba(0, 255, 163, 0.3);
}

.user-card-divider {
    border: none;
    border-top: 1px solid rgba(255,255,255,0.08);
    margin: 5px 0;
}

.logout-btn {
    background: rgba(255, 0, 60, 0.1);
    border: 1px solid rgba(255, 0, 60, 0.3);
    color: #ff003c;
    padding: 14px;
    border-radius: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    font-family: 'Rajdhani', sans-serif;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 3px;
    transition: background-color 0.3s, color 0.3s, box-shadow 0.3s, transform 0.3s;
    margin-top: 5px;
}

.logout-btn:hover {
    background: #ff003c;
    color: #fff;
    box-shadow: 0 0 25px rgba(255, 0, 60, 0.5);
    transform: translateY(-2px);
}

.logout-btn i {
    width: 18px !important;
    height: 18px !important;
}


/* 4. ALERT TICKER: EMERGENCY STREAM */
.ticker-bar {
    height: 40px;
    background: rgba(3, 8, 18, 0.95);
    backdrop-filter: blur(20px);
    border-top: 2px solid rgba(0, 243, 255, 0.3);
    border-bottom: 2px solid rgba(0, 243, 255, 0.1);
    display: flex;
    align-items: center;
    overflow: hidden;
    position: relative;
    z-index: 50;
    /* Clean background, no dots */
}

/* Digital Data Blocks Effect */
.ticker-bar::before {
    content: '';
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background-image: linear-gradient(90deg, rgba(0, 243, 255, 0.05) 1px, transparent 1px);
    background-size: 40px 100%;
    animation: data-flicker 5s infinite steps(10);
    pointer-events: none;
}

@keyframes data-flicker {
    0% { opacity: 0.1; transform: translateX(0); }
    50% { opacity: 0.2; transform: translateX(20px); }
    100% { opacity: 0.1; transform: translateX(0); }
}

/* Dual Horizontal Laser Sweep */
.ticker-bar::after {
    content: '';
    position: absolute;
    top: 0; left: -100%; width: 60%; height: 100%;
    background: linear-gradient(90deg, 
        transparent 0%, 
        rgba(0, 243, 255, 0.05) 45%, 
        rgba(0, 243, 255, 0.2) 50%, 
        rgba(0, 243, 255, 0.05) 55%, 
        transparent 100%);
    animation: bar-scan 5s infinite cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
}

@keyframes bar-scan {
    0% { left: -100%; }
    100% { left: 100%; }
}

/* Red Pulsing Label */
.ticker-label {
    background: #ff003c;
    color: #fff;
    height: 100%;
    padding: 0 35px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-family: 'Rajdhani', sans-serif;
    font-weight: 700;
    font-size: 1.1rem; /* Aumentado */
    letter-spacing: 3px;
    clip-path: polygon(0 0, 88% 0, 100% 100%, 0 100%);
    animation: emergency-pulse 1.5s infinite alternate;
    z-index: 2;
    box-shadow: 15px 0 30px rgba(255, 0, 60, 0.5);
}

.ticker-label i {
    width: 24px !important;
    height: 24px !important;
}

@keyframes emergency-pulse {
    from { background: #80001e; box-shadow: 0 0 5px #ff003c; }
    to { background: #ff003c; box-shadow: 0 0 20px #ff003c; }
}

.ticker-content-wrapper {
    flex: 1;
    overflow: hidden;
    position: relative;
}

.ticker-content {
    display: flex;
    white-space: nowrap;
    animation: ticker-scroll 15s linear infinite;
}

/* Detener el desplazamiento al pasar el cursor */
.ticker-content:hover {
    animation-play-state: paused;
}

@keyframes ticker-scroll {
    0% { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}

.ticker-item {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 0 40px;
    color: rgba(255, 255, 255, 0.9);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.9rem; /* Aumentado */
    letter-spacing: 1.5px;
    text-transform: uppercase;
    font-weight: 500;
}

/* Pulsing Dots */
.dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    box-shadow: 0 0 10px currentColor;
    animation: dot-glow 1s infinite alternate;
}

.dot.red { color: #ff003c; background: #ff003c; }
.dot.orange { color: #ff8c00; background: #ff8c00; }
.dot.yellow { color: #ffd700; background: #ffd700; }

/* Sincronización de color de texto con el punto */
.ticker-item:has(.dot.red) span {
    color: #ff003c;
    text-shadow: 0 0 10px rgba(255, 0, 60, 0.5);
}

.ticker-item:has(.dot.orange) span {
    color: #ff8c00;
    text-shadow: 0 0 10px rgba(255, 140, 0, 0.5);
}

.ticker-item:has(.dot.yellow) span {
    color: #ffd700;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
}

@keyframes dot-glow {
    from { opacity: 0.4; transform: scale(0.8); }
    to { opacity: 1; transform: scale(1.2); }
}

/* Glitch effect on items */
.ticker-item:hover {
    color: #00f3ff;
    animation: glitch-text 0.3s infinite;
}

@keyframes glitch-text {
    0% { transform: translate(0); }
    20% { transform: translate(-2px, 1px); }
    40% { transform: translate(-2px, -1px); }
    60% { transform: translate(2px, 1px); }
    80% { transform: translate(2px, -1px); }
    100% { transform: translate(0); }
}



/* 5. SIDEBAR: REACTIVE HUD */
.sidebar-hud {
    position: fixed;
    top: 280px;
    left: 20px;
    width: auto;
    min-width: 60px;
    z-index: 9999;
    overflow: visible;
    background: transparent;
    padding: 0;
}

.nav-container {
    display: flex;
    flex-direction: column;
    gap: 20px; /* Increased gap for better floating feel */
}

.nav-group {
    position: relative;
    display: flex;
    align-items: center;
}

.nav-anchor {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    padding-left: 13px;
    width: 50px;
    height: 50px;
    background: transparent;
    border: none;
    color: var(--hud-cyan);
    text-decoration: none;
    transition: all 0.5s cubic-bezier(0.19, 1, 0.22, 1);
    overflow: hidden;
    white-space: nowrap;
    position: relative;
    z-index: 10;
    mix-blend-mode: lighten;
}

.nav-anchor::before, .nav-anchor::after {
    content: '';
    position: absolute;
    width: 1px;
    height: 10px;
    background: var(--hud-cyan);
    box-shadow: 0 0 10px var(--hud-cyan);
    opacity: 0;
    transition: 0.3s;
    pointer-events: none;
}

.nav-anchor::before { top: 0; left: 0; border-right: none; border-bottom: none; }
.nav-anchor::after { bottom: 0; right: 0; border-left: none; border-top: none; }

.hud-icon {
    width: 22px !important;
    height: 22px !important;
    flex-shrink: 0;
    opacity: 0.8;
    color: var(--hud-cyan) !important;
    filter: drop-shadow(0 0 3px rgba(0, 243, 255, 0.3));
    transition: all 0.3s;
    animation: icon-pulse 2s infinite ease-in-out;
}

.hud-icon svg {
    stroke-width: 0.8px !important;
}

@keyframes icon-pulse {
    0%, 100% { filter: drop-shadow(0 0 2px var(--hud-cyan)); opacity: 0.8; }
    50% { filter: drop-shadow(0 0 10px var(--hud-cyan)); opacity: 1; transform: scale(1.05); }
}

.hud-text {
    opacity: 0;
    transform: translateX(-10px);
    font-family: 'Rajdhani', sans-serif; /* Cambiado a Rajdhani */
    font-size: 1.2rem; /* Aumentado un poco más */
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 2px;
    transition: 0.4s;
    color: var(--hud-cyan);
    text-shadow: 0 0 15px var(--hud-cyan);
}

/* HOVER EFFECT: Holographic Overlay */
.nav-group:hover .nav-anchor {
    width: 250px;
    background: rgba(0, 243, 255, 0.02);
    backdrop-filter: blur(4px);
    border-left: 2px solid var(--hud-cyan);
    clip-path: polygon(0 0, 98% 0, 100% 20%, 100% 80%, 98% 100%, 0 100%);
    box-shadow: 
        inset 20px 0 20px -10px rgba(0, 243, 255, 0.1),
        0 0 30px rgba(0, 243, 255, 0.05);
}

.nav-group:hover .nav-anchor::before, 
.nav-group:hover .nav-anchor::after {
    opacity: 1;
    height: 100%;
}

.nav-group:hover .hud-text {
    opacity: 1;
    transform: translateX(18px);
}

/* Subtle Laser Interference Scan */
.nav-group:hover .nav-anchor::after {
    content: '';
    position: absolute;
    top: 0; left: -100%; width: 100%; height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    animation: laser-scan 3s infinite linear;
    border: none;
    opacity: 1;
    z-index: -1;
}

@keyframes laser-scan {
    0% { left: -100%; }
    100% { left: 100%; }
}

/* 6. SUBMENU: CIRCUIT STREAM FINAL */
.submenu-hud {
    position: absolute;
    left: 125px; 
    top: 100%;
    width: 220px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 100;
    padding: 10px 0 5px 0;
    pointer-events: none;
    height: fit-content;
}

.nav-group:hover .submenu-hud {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    transition-delay: 0.15s;
    pointer-events: auto;
}

/* Invisible bridge to maintain hover state */
.submenu-hud::before {
    content: '';
    position: absolute;
    top: -20px; left: -50px; width: 100%; height: 40px;
    background: transparent;
}

.submenu-link {
    position: relative;
    display: flex;
    align-items: center;
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    font-size: 0.9rem;
    font-family: 'Rajdhani', sans-serif;
    padding: 12px 30px;
    transition: all 0.3s;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin-bottom: 0;
    background: rgba(3, 8, 18, 0.5);
    backdrop-filter: blur(10px);
}

.submenu-link:last-child {
    border-left: 1px solid transparent; /* This might break the continuity, wait */
}

/* Better way: The line comes from the container, but the container height is fit-content */
.submenu-hud {
    border-left: 1px solid rgba(0, 243, 255, 0.2);
}

.submenu-link {
    border-left: none; /* Move border to parent */
}

/* The Circuit Node (Dot) */
.submenu-link::after {
    content: '';
    position: absolute;
    left: 8px;
    top: 50%;
    width: 7px;
    height: 7px;
    background: var(--hud-cyan);
    border-radius: 50%;
    transform: translateY(-50%);
    box-shadow: 0 0 10px var(--hud-cyan);
    animation: node-pulse 2s infinite ease-in-out;
}

@keyframes node-pulse {
    0%, 100% { opacity: 0.4; transform: translateY(-50%) scale(1); }
    50% { opacity: 1; transform: translateY(-50%) scale(1.3); }
}



.submenu-link:hover {
    color: var(--hud-cyan);
    text-shadow: 0 0 15px var(--hud-cyan);
    opacity: 1;
}

/* Vertical Laser Scan along the circuit */
.submenu-hud-scan {
    position: absolute;
    top: 0; left: -1px; width: 3px; height: 100%;
    background: linear-gradient(transparent, var(--hud-cyan), transparent);
    opacity: 0;
    pointer-events: none;
    z-index: 101;
}

.nav-group:hover .submenu-hud-scan {
    animation: laser-circuit 2.5s infinite linear;
    opacity: 0.6;
    transition-delay: 0.5s;
}

@keyframes laser-circuit {
    0% { top: -50px; opacity: 0; }
    50% { opacity: 1; }
    100% { top: 100%; opacity: 0; }
}

/* 7. MAIN CONTENT AREA */
.main-content {
    flex: 1;
    position: relative;
    z-index: 1;
}

/* 7. HERO CENTER TITLE */
.hero-container {
    position: fixed;
    top: calc(50% + 50px);
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100vw;
    height: calc(100vh - 100px);
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    text-align: center;
    pointer-events: none;
    z-index: 5;
    padding-top: 8px;
}

.hero-container * {
    pointer-events: auto;
}

.hero-title {
    font-family: 'Rajdhani', sans-serif;
    font-size: 3.2rem;
    font-weight: 900;
    letter-spacing: -2px;
    text-transform: uppercase;
    color: var(--hud-cyan);
    text-shadow: 0 0 20px rgba(0, 243, 255, 0.4);
    position: relative;
    z-index: 10;
    margin-top: 0;
    align-self: flex-start;   /* mueve el título a la izquierda */
    margin-left: 30px;        /* pegado a la izquierda */
    text-align: left;
}

.hero-subtitle {
    font-size: 0.9rem;
    color: var(--text-dim);
    letter-spacing: 4px;          /* reducido (antes 8px) para que el Title Case se vea bien */
    text-transform: none;         /* quitar uppercase para respetar el Title Case del HTML */
    max-width: 1000px;
    text-align: center;
    margin: 0;
    font-weight: 600;
}


/* ==========================================
   HUD VISUALS & SVG COMPONENTS
   ========================================== */
.main-visual-container {
    position: relative;
    width: 100%;
    height: 760px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 0px;
}

#cySvg, #mvcsSvg, #articulacionSvg {
    margin-top: 60px;
    transition: all 0.3s ease;
    width: 100%;
    height: 100%;
    max-width: 680px;
    max-height: 680px;
    margin-right: auto;
}

/* ==========================================================================
   SISTEMA HUD TÁCTICO - TORRE DE CONTROL
   ========================================================================== */
:root {
    --hud-active: #3b82f6;
    --hud-off: #1e293b;
    --hud-dark: #05080c;
    --hud-glow: rgba(59, 130, 246, 0.6);
}

/* Animaciones */
@keyframes rotate-horario { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
@keyframes text-flicker { 0% { opacity: 0.3; } 20% { opacity: 1; } 40% { opacity: 0.4; } 100% { opacity: 1; } }

/* Anillo de Flechas Giratorias */
.rotating-arrows-ring {
    transform-origin: 200px 200px; /* Centro absoluto del SVG */
    animation: rotate-horario 40s linear infinite;
    pointer-events: none;
}

.hud-arrow-path {
    fill: none;
    stroke: var(--hud-active);
    stroke-width: 4;
    stroke-opacity: 0.25;
    stroke-linecap: round;
}

.hud-arrow-tip {
    fill: var(--hud-active);
    opacity: 0.5;
}

/* Sectores Interactivos */
.sector-group {
    transition: transform 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    transform-origin: center;
    cursor: pointer;
}

.sector-group:hover {
    transform: scale(1.03);
}

.interactive-sector {
    fill: rgba(48, 68, 100, 0.36); /* Slate-azul Standby (ligeramente más claro que el fondo para contrastar) */
    stroke: rgba(120, 175, 235, 0.2);
    stroke-width: 0.85;
    transition: all 0.4s ease;
}

/* Sub-anillos clickeables (con data-link, vacío o con URL) */
.interactive-sector[data-link] {
    cursor: pointer;
}

/* Hover INDIVIDUAL: sólo el sub-anillo (y su segmento padre) que estén con .hot */
.interactive-sector.hot {
    fill: rgba(59, 130, 246, 0.4);
    stroke: var(--hud-active);
    stroke-opacity: 1;
    filter: drop-shadow(0 0 10px var(--hud-glow));
}

/* Textos del HUD */
.hud-static-text {
    font-family: 'Rajdhani', sans-serif;
    font-weight: 700;
    fill: #64748b;
    pointer-events: none;
    text-transform: uppercase;
    transition: all 0.3s ease;
}

/* Iluminar también los textos cuando el grupo tenga al menos un .hot */
.sector-group.hot-group .hud-static-text {
    fill: #ffffff;
    text-shadow: 0 0 10px var(--hud-active);
    animation: text-flicker 0.2s linear;
}

/* Asegurar que el SVG sea responsivo y NO gire */
#cySvg, #mvcsSvg, #articulacionSvg {
    width: 100%;
    height: auto;
    max-width: 820px;
    max-height: 820px;
    overflow: visible !important;
    animation: none !important;
    display: block;
    margin: 0 auto;
    transform: translateY(0px); /* Ajuste final perfecto */
}



.cy-quad {
    cursor: pointer;
    transition: all 0.3s ease;
}


.cy-quad:hover {
    filter: brightness(1.25) drop-shadow(0 0 15px rgba(0,243,255,0.4));
}

@keyframes hud-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.qc-sector {
    pointer-events: auto;
}

.qc-sub {
    transition: all 0.3s;
}

.qc-sub:hover {
    filter: brightness(1.4) drop-shadow(0 0 8px #0ea5e9);
}

/* --- MVCS SPECIFIC CLASSES --- */
.mv-quad { cursor: pointer; transition: all 0.3s ease; }
.mv-quad:hover { filter: brightness(1.2) drop-shadow(0 0 15px rgba(56,189,248,0.4)); }
.mv-sub-grp .mv-sub { pointer-events: auto; }
.mv-sub { transition: all 0.3s; }
.mv-sub:hover { filter: brightness(1.4) drop-shadow(0 0 8px #38bdf8); }

/* --- TAB SYSTEM --- */
.hud-tabs {
    display: flex;
    gap: 15px;
    justify-content: center;
    position: fixed;
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2000;
    width: 100%;
}

.hud-tab {
    background: transparent;
    border: none;
    color: rgba(0, 243, 255, 0.7);
    padding: 10px 12px;
    font-family: 'Rajdhani', sans-serif;
    font-size: 0.9rem;
    font-weight: 800;
    letter-spacing: 4px;
    text-transform: uppercase;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 48px;
    min-height: 48px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    backdrop-filter: blur(10px);
    margin: 0 5px;
}

/* Sin corner brackets ni scanline — icon only estilo sidebar */
.hud-tab::before, .hud-tab::after { display: none; }

/* Hover: solo glow del icono, sin caja */
.hud-tab:hover {
    background: transparent;
    color: #00f3ff;
}
.hud-tab:hover svg, .hud-tab:hover i[data-lucide] {
    filter: drop-shadow(0 0 10px #00f3ff) drop-shadow(0 0 18px rgba(0,243,255,0.5));
    transform: scale(1.12);
}

/* Active: icon más brillante */
.hud-tab.active {
    background: transparent;
    color: #ffffff;
}
.hud-tab.active svg, .hud-tab.active i[data-lucide] {
    color: #ffffff;
    filter: drop-shadow(0 0 8px #00f3ff) drop-shadow(0 0 20px var(--hud-cyan, #00f3ff));
}

/* Icon dentro de los tabs (mismo tratamiento que .hud-icon del sidebar) */
.hud-tab svg, .hud-tab i[data-lucide] {
    width: 26px;
    height: 26px;
    display: block;
    pointer-events: none;
    transition: all 0.3s ease;
    filter: drop-shadow(0 0 4px rgba(0,243,255,0.4));
}
.hud-tab svg { stroke-width: 1.2px; }

/* Tooltip al hover */
.hud-tab .tab-tooltip {
    position: absolute;
    top: calc(100% + 12px);
    left: 50%;
    transform: translateX(-50%) translateY(-6px);
    background: rgba(3, 8, 18, 0.95);
    border: 1px solid rgba(0, 243, 255, 0.45);
    border-radius: 6px;
    color: #00f3ff;
    font-family: 'Rajdhani', sans-serif;
    font-size: 1.25rem;
    letter-spacing: 2px;
    padding: 6px 14px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
    box-shadow: 0 6px 18px rgba(0,0,0,0.5), 0 0 18px rgba(0,243,255,0.15);
    z-index: 2100;
    text-transform: uppercase;
}
.hud-tab:hover .tab-tooltip,
.hud-tab:focus-visible .tab-tooltip {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.visual-layer {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.6s ease;
    transform: scale(0.95);
}

.visual-layer.active {
    opacity: 1;
    visibility: visible;
    transform: scale(1);
}

/* ===== Mapa coroplético (monocromático + spotlight + retícula) ===== */
#map-container { position: relative; margin-top: -60px; }   /* mapa un poco más arriba */
.map-dept {
    transition: fill-opacity 0.2s ease, filter 0.2s ease, stroke 0.2s ease;
}
#peruMapSvg { cursor: none; }   /* la retícula reemplaza al cursor */

/* Capas superpuestas del mapa: NUNCA capturan el cursor.
   El !important vence a la regla global ".hero-container * { pointer-events:auto }",
   que si no obliga a la retícula/resaltado a interceptar el hover (causaba el parpadeo). */
.map-reticle, .map-reticle *, .map-hl-layer, .map-hl { pointer-events: none !important; }

/* Retícula de objetivo que sigue el cursor */
.map-reticle line { stroke: rgba(0, 243, 255, 0.55); stroke-width: 1; stroke-dasharray: 4 4; }
.map-reticle circle { fill: none; stroke: #00f3ff; stroke-width: 1.2; }
.map-reticle .map-reticle-dot { fill: #00f3ff; stroke: none; }

/* Leyenda HORIZONTAL, centrada debajo del mapa */
.map-legend {
    position: absolute;
    left: 50%;
    bottom: 26px;
    transform: translateX(-50%);
    background: rgba(3, 8, 18, 0.85);
    border: 1px solid rgba(0, 243, 255, 0.3);
    border-radius: 8px;
    padding: 9px 16px;
    font-family: 'JetBrains Mono', monospace;
    z-index: 5;
    backdrop-filter: blur(6px);
    pointer-events: none;
}
.map-legend-title {
    display: block;
    font-size: 0.6rem;
    color: rgba(255, 255, 255, 0.6);
    letter-spacing: 1px;
    text-transform: uppercase;
    text-align: center;
    margin-bottom: 6px;
}
.map-legend-bar {
    width: 180px;
    height: 10px;
    border-radius: 5px;
    background: linear-gradient(90deg, #062430, #8df0ff);
}
.map-legend-scale {
    display: flex;
    justify-content: space-between;
    font-size: 0.58rem;
    color: #9fdcc9;
    margin-top: 4px;
}

/* Tooltip Táctico */
#tooltip {
    position: fixed;
    background: rgba(5, 10, 25, 0.96);
    border-top: 2px solid #00f3ff;
    padding: 16px 20px;
    font-family: 'Rajdhani', sans-serif;
    color: #fff;
    pointer-events: none;
    z-index: 99999;
    opacity: 0;
    transition: opacity 0.2s ease;
    backdrop-filter: blur(12px);
    min-width: 240px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}

.tt-title-min {
    font-family: 'Rajdhani', sans-serif;
    font-size: 25px;
    font-weight: 800;
    color: #00f3ff;
    text-transform: uppercase;
    border-bottom: 1px solid rgba(0, 243, 255, 0.3);
    padding-bottom: 8px;
    margin-bottom: 15px;
    display: block;
}

.tt-item-min {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
    padding-bottom: 5px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

.tt-lab-min {
    font-size: 20px;
    color: #94a3b8;
    text-transform: uppercase;
}

/* Icono pequeño Lucide al inicio de cada línea de tooltip */
.tt-item-min i[data-lucide],
.tt-item-min svg {
    width: 23px;
    height: 23px;
    flex-shrink: 0;
    color: #00f3ff;
    opacity: 0.85;
    stroke-width: 2;
}

.tt-val-min {
    font-size: 22px;
    font-weight: 600;
    color: #ffffff;
    flex: 1;
    line-height: 1.3;
}

/* Estilos de Modal Cinematic para Index */
#modal-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 3, 10, 0.75);
    backdrop-filter: blur(25px); 
    z-index: 3000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.6s cubic-bezier(0.2, 0.8, 0.2, 1);
}
#modal-overlay.show { opacity: 1; visibility: visible; }

#modal-cinematic {
    position: fixed;
    top: 50%; left: 50%;
    width: 95vw; 
    height: 90vh;
    max-width: 1400px;
    max-height: 900px;
    z-index: 3001;
    background: radial-gradient(circle at center, #0a111a 0%, #05080c 100%);
    background-image: 
        linear-gradient(rgba(0, 243, 255, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 243, 255, 0.03) 1px, transparent 1px);
    background-size: 40px 40px;
    backdrop-filter: blur(20px);
    border: 1px solid rgba(0, 243, 255, 0.2);
    border-radius: 4px; 
    box-shadow: 0 0 150px rgba(0,0,0,1);
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transform: translate(-50%, -50%) scale(0.9);
    transition: all 0.6s cubic-bezier(0.19, 1, 0.22, 1);
}
#modal-cinematic.show { visibility: visible; opacity: 1; transform: translate(-50%, -50%) scale(1); }
#modal-cinematic::after {
    content: '';
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: repeating-linear-gradient(0deg, rgba(0,0,0,0.1) 0px, transparent 1px, transparent 2px);
    pointer-events: none;
    z-index: 10;
}

/* Wrapper del modal: flex column → header arriba, grid ocupa el resto */
.modal-content-wrapper {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    box-sizing: border-box;
}

.ultra-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);   /* 5 UE = 5 columnas */
    grid-template-rows: 1fr;
    gap: 16px;
    padding: 22px;
    flex: 1;                                 /* ocupa todo el alto restante */
    min-height: 0;                           /* permite encogerse correctamente */
    width: 100%;
    box-sizing: border-box;
    justify-items: stretch;
    align-items: stretch;
}

/* Columna UE: título + 3 gauges apilados */
.ue-column {
    position: relative;
    display: grid;
    grid-template-rows: auto 1fr 1fr 1fr;
    gap: 10px;
    padding: 14px 10px 12px;
    background: rgba(0, 243, 255, 0.025);
    border: 1px solid rgba(0, 243, 255, 0.1);
    opacity: 0;
    transform: scale(0.95);
}

/* L-Corners en la columna (no en cada widget) */
.ue-column::before, .ue-column::after {
    content: '';
    position: absolute;
    width: 14px; height: 14px;
    border: 2px solid var(--hud-cyan);
}
.ue-column::before { top: -1px; left: -1px; border-right: none; border-bottom: none; }
.ue-column::after  { bottom: -1px; right: -1px; border-left: none; border-top: none; }

.ue-title {
    font-family: 'Rajdhani', sans-serif;
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--hud-cyan);
    text-align: center;
    letter-spacing: 2.5px;
    text-transform: uppercase;
    text-shadow: 0 0 14px rgba(0, 243, 255, 0.45);
    padding-bottom: 8px;
    border-bottom: 1px dashed rgba(0, 243, 255, 0.22);
    margin: 0;
}

.hud-kpi-widget {
    position: relative;
    padding: 8px 6px;
    border: 1px solid rgba(0, 243, 255, 0.06);
    background: rgba(0, 0, 0, 0.25);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    overflow: hidden;
}

.widget-title {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--hud-cyan);
    letter-spacing: 2px;
    text-transform: uppercase;
    text-shadow: 0 0 8px rgba(0, 243, 255, 0.4);
    opacity: 0.85;
}

.gauge-hud-container {
    position: relative;
    margin: 2px 0 -8px;
}

.gauge-segmented {
    width: 130px; height: 65px;
}

.seg-bg {
    fill: none;
    stroke: rgba(255, 255, 255, 0.28);   /* gris claro visible — track completo del 100% */
    stroke-width: 12;
    stroke-dasharray: 4 2;               /* look segmentado */
}

/* El path .seg-grid (overlay oscuro con dasharray 2 2) ya no es necesario:
   el segmentado lo da el dasharray del .seg-bg. El grid causaba huecos
   negros al pintarse encima del bg ahora visible. */
.seg-grid {
    display: none;
}

.seg-fill {
    fill: none;
    stroke: var(--hud-cyan);
    stroke-width: 12;
    stroke-dasharray: 126;
    stroke-dashoffset: 126;
    transition: all 2.5s cubic-bezier(0.19, 1, 0.22, 1);
    filter: none !important; /* Glow completely removed */
}

.hud-big-val {
    font-family: 'JetBrains Mono', monospace;
    font-size: 1.6rem;
    font-weight: 800;
    color: #fff;
    line-height: 1;
    margin-top: 2px;
}

/* Animación de entrada por columna UE (5 columnas escalonadas) */
#modal-cinematic.show .ue-column { animation: hud-entry 0.7s cubic-bezier(0.19, 1, 0.22, 1) forwards; }
.ue-column:nth-child(1) { animation-delay: 0.10s; }
.ue-column:nth-child(2) { animation-delay: 0.20s; }
.ue-column:nth-child(3) { animation-delay: 0.30s; }
.ue-column:nth-child(4) { animation-delay: 0.40s; }
.ue-column:nth-child(5) { animation-delay: 0.50s; }

@keyframes hud-entry {
    to { opacity: 1; transform: scale(1); }
}

.kpi-header {
    background: rgba(0, 0, 0, 0.4);
    padding: 25px 35px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}
.kpi-header .left-group {
    display: flex; align-items: center; gap: 15px;
    font-family: 'Rajdhani', sans-serif; 
    font-size: 1.2rem; letter-spacing: 3px; color: #fff;
}
.kpi-header .square {
    width: 8px; height: 8px; border-radius: 50%; background: #ff003c;
    box-shadow: 0 0 15px #ff003c; animation: pulse-dot 2s infinite;
}

@keyframes pulse-dot {
    0%, 100% { transform: scale(1); box-shadow: 0 0 15px #ff003c; }
    50% { transform: scale(1.3); box-shadow: 0 0 25px #ff003c; }
}

.close-btn {
    background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.1);
    color: rgba(255,255,255,0.6); cursor: pointer; transition: 0.3s;
    display: flex; align-items: center; justify-content: center;
    border-radius: 50%; width: 32px; height: 32px;
}
.close-btn:hover { background: rgba(255,0,60,0.2); color: #ff003c; border-color: #ff003c; }

/* Lado derecho del header del modal: "ACTUALIZADO AL ..." + close-btn */
.kpi-header-right {
    display: flex;
    align-items: center;
    gap: 22px;
}

.kpi-updated {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.72rem;
    letter-spacing: 2px;
    color: rgba(0, 243, 255, 0.65);
    text-transform: uppercase;
    white-space: nowrap;
}
.kpi-updated #modal-updated-date {
    color: #fff;
    font-weight: 700;
    margin: 0 4px;
}

/* Mientras el modal cinemático está abierto: ocultar sidebar izq, tabs der y MEIBOT
   Se activa con la clase .modal-open añadida al body por openCinematicModal() */
body.modal-open .sidebar-hud,
body.modal-open .airport-side-panel,
body.modal-open .visits-widget,
body.modal-open .meibot-container {
    opacity: 0 !important;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.35s ease, visibility 0.35s ease;
}

/* ==========================================================
   MODAL CARTERA PRIORIZADA — DETALLE POR PROYECTO
   MISMO estilo que #modal-cinematic (Ejecución por UE): fondo
   cuadriculado + cian, scanlines, borde cian, tarjetas HUD con
   L-corners. Grilla 4×4 = 16 proyectos, sin scroll.
   ========================================================== */
#modal-cartera-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 3, 10, 0.75);
    backdrop-filter: blur(25px);
    z-index: 3000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.6s cubic-bezier(0.2, 0.8, 0.2, 1);
}
#modal-cartera-overlay.show { opacity: 1; visibility: visible; }

#modal-cartera {
    position: fixed;
    top: 50%; left: 50%;
    width: 98vw;
    height: 97vh;
    max-width: 2200px;
    max-height: 1320px;
    z-index: 3001;
    background: radial-gradient(circle at center, #0a111a 0%, #05080c 100%);
    background-image:
        linear-gradient(rgba(0, 243, 255, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 243, 255, 0.03) 1px, transparent 1px);
    background-size: 40px 40px;
    backdrop-filter: blur(20px);
    border: 1px solid rgba(0, 243, 255, 0.2);
    border-radius: 4px;
    box-shadow: 0 0 150px rgba(0, 0, 0, 1);
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transform: translate(-50%, -50%) scale(0.9);
    transition: all 0.6s cubic-bezier(0.19, 1, 0.22, 1);
}
#modal-cartera.show { visibility: visible; opacity: 1; transform: translate(-50%, -50%) scale(1); }
#modal-cartera::after {
    content: '';
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: repeating-linear-gradient(0deg, rgba(0,0,0,0.1) 0px, transparent 1px, transparent 2px);
    pointer-events: none;
    z-index: 10;
}

/* Botón "MÁS DETALLES" (reemplaza la fecha; redirige al landing de obras) */
.cp-detail-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-family: 'Rajdhani', sans-serif;
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    text-decoration: none;
    color: var(--hud-cyan);
    background: rgba(0, 243, 255, 0.08);
    border: 1px solid rgba(0, 243, 255, 0.45);
    border-radius: 3px;
    padding: 9px 18px;
    text-shadow: 0 0 8px rgba(0, 243, 255, 0.35);
    transition: all 0.25s ease;
}
.cp-detail-btn:hover {
    background: rgba(0, 243, 255, 0.16);
    border-color: var(--hud-cyan);
    box-shadow: 0 0 16px rgba(0, 243, 255, 0.3);
}
.cp-detail-btn i { width: 15px; height: 15px; }

/* Filtros (Sector / Tipo / Estado) — dropdowns HUD personalizados */
.cp-filters {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}
.cp-filter { position: relative; flex: 0 0 auto; }   /* nunca se encoge: ancho fijo estable */

/* Botón disparador */
.cp-filter-btn {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    font-family: 'Rajdhani', sans-serif;
    font-weight: 700;
    font-size: 0.8rem;
    letter-spacing: 1.2px;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.72);
    background: rgba(0, 243, 255, 0.05);
    border: 1px solid rgba(0, 243, 255, 0.28);
    border-radius: 4px;
    padding: 9px 13px;
    width: 168px;            /* ancho uniforme para todos los filtros (≈ el de PROGRAMA) */
    box-sizing: border-box;
    cursor: pointer;
    transition: all 0.22s ease;
}
.cp-filter-btn:hover {
    background: rgba(0, 243, 255, 0.1);
    border-color: rgba(0, 243, 255, 0.55);
    color: #dffbff;
}
.cp-filter-ic { width: 15px; height: 15px; color: var(--hud-cyan, #00f3ff); opacity: 0.85; flex-shrink: 0; }
/* Texto (etiqueta o valor): ocupa el espacio disponible y recorta con elipsis */
.cp-filter-label, .cp-filter-val {
    flex: 1;
    min-width: 0;
    text-align: left;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.cp-filter-val { display: none; }
.cp-filter-caret { width: 14px; height: 14px; opacity: 0.7; flex-shrink: 0; transition: transform 0.25s ease; }
.cp-filter.open .cp-filter-caret { transform: rotate(180deg); }
.cp-filter.open .cp-filter-btn {
    background: rgba(0, 243, 255, 0.12);
    border-color: var(--hud-cyan, #00f3ff);
    box-shadow: 0 0 14px rgba(0, 243, 255, 0.25);
    color: #dffbff;
}

/* Estado "con valor": el botón se ilumina (chip activo) y muestra el valor */
.cp-filter.has-value .cp-filter-btn {
    color: #021018;
    background: var(--hud-cyan, #00f3ff);
    border-color: var(--hud-cyan, #00f3ff);
    box-shadow: 0 0 16px rgba(0, 243, 255, 0.45);
}
.cp-filter.has-value .cp-filter-ic { color: #021018; opacity: 1; }
.cp-filter.has-value .cp-filter-label { display: none; }
.cp-filter.has-value .cp-filter-val { display: block; }

/* Menú desplegable */
.cp-filter-menu {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    min-width: 100%;
    list-style: none;
    margin: 0;
    padding: 6px;
    background: rgba(7, 14, 22, 0.97);
    border: 1px solid rgba(0, 243, 255, 0.35);
    border-radius: 5px;
    box-shadow: 0 14px 44px rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(12px);
    z-index: 50;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-6px);
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
}
.cp-filter.open .cp-filter-menu { opacity: 1; visibility: visible; transform: translateY(0); }
.cp-filter-opt {
    display: flex;
    align-items: center;
    gap: 9px;
    font-family: 'Rajdhani', sans-serif;
    font-weight: 600;
    font-size: 0.82rem;
    letter-spacing: 0.8px;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.72);
    padding: 8px 12px;
    border-radius: 3px;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.16s ease, color 0.16s ease;
}
.cp-filter-opt:hover { background: rgba(0, 243, 255, 0.12); color: #eafcff; }
.cp-filter-opt.is-active {
    color: var(--hud-cyan, #00f3ff);
    background: rgba(0, 243, 255, 0.08);
    box-shadow: inset 2px 0 0 var(--hud-cyan, #00f3ff);
}
.cp-opt-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }

/* Botón "Limpiar filtros" — aparece solo cuando hay algún filtro activo */
.cp-clear {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-family: 'Rajdhani', sans-serif;
    font-weight: 700;
    font-size: 0.78rem;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: rgba(255, 120, 120, 0.92);
    background: rgba(255, 60, 60, 0.06);
    border: 1px solid rgba(255, 60, 60, 0.3);
    border-radius: 4px;
    padding: 9px 13px;
    flex: 0 0 auto;
    cursor: pointer;
    transition: all 0.2s ease;
}
.cp-clear:hover {
    background: rgba(255, 60, 60, 0.15);
    border-color: rgba(255, 90, 90, 0.7);
    color: #ffdada;
    box-shadow: 0 0 14px rgba(255, 60, 60, 0.25);
}
.cp-clear i { width: 14px; height: 14px; }
.cp-clear.is-hidden { display: none; }

/* Grilla — TODAS las tarjetas en una sola pantalla, sin scroll.
   Flujo continuo: las tarjetas quedan agrupadas por estado (una a continuación
   de otra) porque el JS las ordena por grupo, de menor a mayor cantidad. */
.cp-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    grid-template-rows: repeat(3, 1fr);   /* filas fijas → las cards no se agrandan al filtrar */
    grid-auto-flow: row;
    align-content: stretch;
    gap: 18px;
    padding: 24px 28px 28px;
    flex: 1;
    min-height: 0;
    width: 100%;
    box-sizing: border-box;
}
/* Mensaje cuando ningún proyecto coincide con los filtros */
.cp-empty {
    grid-column: 1 / -1;
    grid-row: 1 / -1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Rajdhani', sans-serif;
    font-weight: 700;
    font-size: 1.15rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.45);
}

/* Tarjeta HUD (mismo lenguaje que .ue-column): borde + L-corners — diseño
   ORIGINAL. --cp-accent: triplete RGB del color (default cian); lo sobreescribe
   .cp-card.est-* para teñir todo el recuadro según el ESTADO del proyecto. */
.cp-card {
    --cp-accent: 0, 243, 255;
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 15px;
    padding: 20px 22px;
    background:
        linear-gradient(160deg, rgba(var(--cp-accent), 0.16) 0%, rgba(var(--cp-accent), 0.05) 55%, rgba(var(--cp-accent), 0.02) 100%);
    border: 1px solid rgba(var(--cp-accent), 0.45);
    box-shadow: inset 0 0 22px rgba(var(--cp-accent), 0.12), 0 0 14px rgba(var(--cp-accent), 0.1);
    min-height: 0;
    overflow: hidden;
    opacity: 0;
    transform: scale(0.96);
}
#modal-cartera.show .cp-card { animation: hud-entry 0.55s cubic-bezier(0.19, 1, 0.22, 1) forwards; }

/* Acento por ESTADO (doble clase → más específico que .cp-card, igual que el
   diseño original que teñía por programa con .cp-card.cp-PNSU, etc.) */
.cp-card.est-ejecucion   { --cp-accent: 0, 230, 118; }   /* verde    (en ejecución) */
.cp-card.est-previos     { --cp-accent: 250, 204, 21; }   /* amarillo (actos previos) */
.cp-card.est-elaboracion { --cp-accent: 255, 140, 66; }   /* naranja  (en elaboración) */

/* L-corners (idénticos a .ue-column), teñidos con el acento del estado */
.cp-card::before, .cp-card::after {
    content: '';
    position: absolute;
    width: 14px; height: 14px;
    border: 2px solid rgba(var(--cp-accent), 1);
    pointer-events: none;
}
.cp-card::before { top: -1px; left: -1px; border-right: none; border-bottom: none; }
.cp-card::after  { bottom: -1px; right: -1px; border-left: none; border-top: none; }

.cp-head {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding-bottom: 12px;
    border-bottom: 1px dashed rgba(var(--cp-accent), 0.45);
}
/* Título en UNA sola línea: nombre (elipsis si excede) + CUI siempre visible */
.cp-title {
    display: flex;
    align-items: baseline;
    min-width: 0;
    white-space: nowrap;
}
.cp-name {
    font-family: 'Rajdhani', sans-serif;
    font-weight: 800;
    font-size: 1.18rem;
    letter-spacing: 0.5px;
    color: #dffbff;
    text-shadow: 0 0 12px rgba(var(--cp-accent), 0.45);
    overflow: hidden;
    text-overflow: ellipsis;
}
.cp-cuinum {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    color: rgba(255, 255, 255, 0.6);
    white-space: nowrap;
    flex-shrink: 0;
}
.cp-cuinum::before { content: "·"; margin: 0 7px; opacity: 0.5; }
.cp-tags { display: flex; align-items: center; gap: 8px; }
.cp-prog {
    font-family: 'Rajdhani', sans-serif;
    font-weight: 800;
    font-size: 0.7rem;
    letter-spacing: 1.5px;
    color: rgba(255, 255, 255, 0.85);
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 3px;
    padding: 2px 9px;
    flex-shrink: 0;
}
/* Etiqueta de ESTADO (tag pro, coloreada por el estado) */
.cp-estado {
    font-family: 'Rajdhani', sans-serif;
    font-weight: 800;
    font-size: 0.72rem;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: rgba(var(--cp-accent), 1);
    background: rgba(var(--cp-accent), 0.12);
    border: 1px solid rgba(var(--cp-accent), 0.6);
    border-radius: 3px;
    padding: 4px 11px;
    text-shadow: 0 0 8px rgba(var(--cp-accent), 0.45);
    white-space: nowrap;
    flex-shrink: 0;
}
.cp-metric {
    display: grid;
    grid-template-columns: 132px 1fr 64px;
    align-items: center;
    gap: 13px;
}
.cp-mlabel {
    font-size: 0.82rem;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.55);
    white-space: nowrap;
}
.cp-bar {
    position: relative;
    height: 9px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 5px;
    overflow: hidden;
}
.cp-bar i {
    position: absolute;
    inset: 0 auto 0 0;
    height: 100%;
    border-radius: 5px;
    transition: width 0.6s cubic-bezier(0.19, 1, 0.22, 1);
}
.cp-mval {
    font-family: 'JetBrains Mono', monospace;
    font-size: 1rem;
    font-weight: 800;
    text-align: right;
    color: #dffbff;
}

@media (max-width: 900px) {
    .cp-grid {
        grid-template-columns: repeat(2, 1fr);
        grid-template-rows: none;
        grid-auto-rows: auto;
        gap: 10px;
        padding: 12px;
        overflow-y: auto;
    }
    .cp-filters { gap: 8px; width: 100%; }
    .cp-filter-btn { font-size: 0.72rem; padding: 7px 11px; }
    .cp-card { justify-content: flex-start; }
    .cp-name { font-size: 1.05rem; }
    .cp-metric { grid-template-columns: 110px 1fr 54px; gap: 10px; }
}

/* Cuando el panel de Usuario (.user-card) está expandido: ocultar los tabs
   derechos que se superponen con él. Se activa con body.user-card-open. */
body.user-card-open .toggle-board-btn {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.st-green { color: #00ff88; } .st-red { color: #ff003c; } .st-yellow { color: #ffcc00; }
.bg-green { background: #00ff88; } .bg-red { background: #ff003c; } .bg-yellow { background: #ffcc00; }
/* ==========================================
   AIRPORT TACTICAL BOARD (SPLIT-FLAP STYLE)
   ========================================== */
.airport-side-panel {
    position: fixed;
    inset: 0;
    pointer-events: none; /* el aside es solo wrapper; hijos reciben eventos */
    z-index: 1000;
}

.airport-side-panel > * {
    pointer-events: auto;
}

/* ============================================
   AIRPORT BOARD — Rediseño integral
   Botones tab + panel deslizante con borde cian
   continuo entre el tab y el panel expandido.
   ============================================ */

/* Variables locales (alcance: paneles laterales derechos) */
.airport-side-panel {
    --ab-tab-w: 42px;                /* ancho del tab */
    --ab-tab-h: 60px;                /* alto del tab (rectangular vertical) */
    --ab-panel-offscreen: 30px;      /* buffer del panel fuera del viewport (oculta sombra) */
    --ab-tab-edge: 0px;              /* 0 = pegado al borde derecho del viewport */
    --ab-tab-gap: calc(var(--ab-panel-offscreen) + var(--ab-tab-edge)); /* = 30px */
    --ab-panel-w: 380px;
    --ab-edge: rgba(0, 243, 255, 0.28);
    --ab-edge-strong: rgba(0, 243, 255, 0.65);
    --ab-bg-1: #060a14;
    --ab-bg-2: #02050a;
    --ab-radius: 10px;
    --ab-ease: cubic-bezier(0.65, 0, 0.35, 1);
}

/* --- TAB BUTTON: HÍBRIDO. Conserva la PESTAÑA sólida visible original
   (fondo, borde y esquina redondeada del tab), pero al hover se expande hacia
   la izquierda y el TÍTULO se despliega con el estilo del sidebar (.hud-text:
   Rajdhani cian con glow) + barrido láser. Sin cajita de tooltip, sin submenú. --- */
.toggle-board-btn {
    --tbb-w-open: 420px;                /* ancho del tab ya expandido */
    position: absolute;
    left: calc((var(--ab-tab-w) + var(--ab-tab-gap)) * -1);
    top: 0;
    display: flex;
    flex-direction: row-reverse;        /* icono a la derecha; el texto fluye a la izquierda */
    align-items: center;
    justify-content: flex-start;
    gap: 12px;
    padding-right: 10px;
    width: var(--ab-tab-w);
    height: var(--ab-tab-h);
    background: linear-gradient(135deg, var(--ab-bg-1) 0%, var(--ab-bg-2) 100%);  /* pestaña sólida original */
    border: 1px solid var(--ab-edge);
    border-right: none;                 /* pegado al borde del viewport → sin línea derecha */
    color: var(--hud-cyan);
    cursor: pointer;
    border-radius: var(--ab-radius) 0 0 var(--ab-radius);   /* esquina redondeada solo del lado visible */
    box-shadow:
        0 6px 18px rgba(0, 0, 0, 0.5),
        0 0 0 1px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.04);
    transition: all 0.5s cubic-bezier(0.19, 1, 0.22, 1);
    overflow: hidden;
    white-space: nowrap;
    z-index: 10;
}

/* Barrido láser de interferencia (idéntico al del sidebar) */
.toggle-board-btn::after {
    content: '';
    position: absolute;
    top: 0; left: -100%;
    width: 100%; height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    opacity: 0;
    pointer-events: none;
    z-index: 1;
}

/* HOVER: la pestaña sólida DESAPARECE y adopta el estilo transparente del
   sidebar (sin fondo ni borde; solo acento cian + blur + glow). Se expande
   manteniendo fijo el borde derecho: right = left + width = -gap (constante). */
.toggle-board-btn:hover {
    width: var(--tbb-w-open);
    left: calc((var(--tbb-w-open) + var(--ab-tab-gap)) * -1);
    background: rgba(0, 243, 255, 0.02);
    backdrop-filter: blur(4px);
    border: none;
    border-radius: 0;
    clip-path: polygon(2% 0, 100% 0, 100% 100%, 2% 100%, 0 80%, 0 20%);
    box-shadow:
        inset -20px 0 20px -10px rgba(0, 243, 255, 0.1),
        0 0 30px rgba(0, 243, 255, 0.05);
}
.toggle-board-btn:hover::after {
    opacity: 1;
    animation: laser-scan 3s infinite linear;
}

/* Título: mismo tratamiento que .hud-text del sidebar (Rajdhani cian con glow) */
.toggle-board-btn .tbb-text {
    position: relative;
    z-index: 2;
    opacity: 0;
    transform: translateX(10px);
    font-family: 'Rajdhani', sans-serif;
    font-size: 1.2rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 2px;
    transition: 0.4s;
    color: var(--hud-cyan);
    text-shadow: 0 0 15px var(--hud-cyan);
    pointer-events: none;
}
.toggle-board-btn:hover .tbb-text {
    opacity: 1;
    transform: translateX(0);
}

/* Icono dentro de la pestaña (a la derecha por el row-reverse) */
.toggle-board-btn svg,
.toggle-board-btn i[data-lucide] {
    position: relative;
    z-index: 2;
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    color: var(--hud-cyan);
    filter: drop-shadow(0 0 3px rgba(0, 243, 255, 0.3));
    transition: transform 0.4s var(--ab-ease);
}

/* Ancho de la barra expandida a medida de cada título (consecuente al texto) */
#board-primary   .toggle-board-btn { --tbb-w-open: 420px; }  /* Ejecución presupuestal por UE */
#board-metas     .toggle-board-btn { --tbb-w-open: 290px; }  /* Metas y compromisos */
#board-prioridad .toggle-board-btn { --tbb-w-open: 280px; }  /* Cartera priorizada */

/* PANEL EXPANDIDO → su propio tab se desvanece */
.airport-board.expanded .toggle-board-btn {
    opacity: 0;
    transform: translateX(-16px) scale(0.7);
    pointer-events: none;
}

/* Si CUALQUIER panel del aside está expandido, ocultar TODOS los tabs
   (evita que el tab del segundo panel se superponga al primero expandido) */
.airport-side-panel:has(.airport-board.expanded) .toggle-board-btn {
    opacity: 0;
    transform: translateX(-16px) scale(0.7);
    pointer-events: none;
}

/* --- CLOSE BUTTON: badge circular que asoma fuera del panel --- */
.board-close-btn {
    position: absolute;
    top: -13px;
    right: -13px;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--ab-bg-2);
    border: 1px solid var(--ab-edge);
    border-radius: 50%;                 /* círculo */
    color: rgba(255, 255, 255, 0.55);
    cursor: pointer;
    padding: 0;
    opacity: 0;
    pointer-events: none;
    transform: scale(0.6) rotate(-90deg);
    box-shadow:
        0 4px 12px rgba(0, 0, 0, 0.5),
        0 0 0 1px rgba(0, 0, 0, 0.4);
    transition:
        opacity 0.35s var(--ab-ease) 0.2s,
        transform 0.4s var(--ab-ease) 0.2s,
        background 0.2s,
        border-color 0.2s,
        color 0.2s;
    z-index: 5;
}

.board-close-btn svg,
.board-close-btn i[data-lucide] {
    width: 13px;
    height: 13px;
    stroke-width: 2.5;
}

.board-close-btn:hover {
    background: #1a0408;
    border-color: rgba(255, 59, 59, 0.6);
    color: #ff5b5b;
}

.airport-board.expanded .board-close-btn {
    opacity: 1;
    transform: scale(1) rotate(0);
    pointer-events: auto;
}

/* --- PANEL DESLIZANTE --- */
.airport-board {
    position: fixed;
    right: calc((var(--ab-panel-w) + var(--ab-panel-offscreen)) * -1);
    width: var(--ab-panel-w);
    background: linear-gradient(180deg, var(--ab-bg-1) 0%, var(--ab-bg-2) 100%);
    border: 1px solid var(--ab-edge);
    border-radius: var(--ab-radius);
    padding: 22px 22px 24px;            /* padding normal, sin extra */
    box-shadow:
        0 24px 60px rgba(0, 0, 0, 0.7),
        0 0 0 1px rgba(0, 0, 0, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.04);
    font-family: 'JetBrains Mono', monospace;
    transition: right 0.55s var(--ab-ease), top 0.55s var(--ab-ease);
    z-index: 1000;
}

/* Posiciones: 3 tabs rectangulares (42×60) con gap 10px → tops 200 / 270 / 340 */
#board-primary  { top: 200px; }
#board-metas {
    top: 270px;
    --ab-panel-w: 440px;          /* tabla metas más ancha (override local) */
}
#board-prioridad { top: 340px; }

.airport-board.expanded {
    right: 30px;
}

/* Contenido aparece con fade-in escalonado al expandir */
.airport-board > .board-header,
.airport-board > .board-section-title,
.airport-board > .board-rows {
    opacity: 0;
    transform: translateX(8px);
    transition: opacity 0.4s var(--ab-ease), transform 0.4s var(--ab-ease);
}
.airport-board.expanded > .board-section-title { transition-delay: 0.15s; opacity: 1; transform: none; }
.airport-board.expanded > .board-header        { transition-delay: 0.20s; opacity: 1; transform: none; }
.airport-board.expanded > .board-rows          { transition-delay: 0.28s; opacity: 1; transform: none; }

/* --- HEADER de columnas (% / UE / STATUS) --- */
.board-header {
    display: grid;
    grid-template-columns: 110px 1fr 90px;   /* fijo % + label expandible + badge — IDÉNTICO en ambas tablas */
    place-items: center;
    margin-bottom: 18px;
    padding: 0 4px 12px;
    border-bottom: 1px solid rgba(0, 243, 255, 0.12);
}

.board-label {
    color: rgba(255, 255, 255, 0.45);
    font-size: 0.7rem;
    letter-spacing: 3px;
    text-transform: uppercase;
    text-align: center;
}

/* --- FILAS --- */
.board-rows {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.board-row {
    display: grid;
    grid-template-columns: 110px 1fr 90px;   /* alineado con .board-header */
    place-items: center;
    gap: 12px;
    background: rgba(255, 255, 255, 0.02);
    padding: 10px 14px;
    border: 1px solid rgba(0, 243, 255, 0.06);
    border-radius: 6px;
    position: relative;
    transition: background 0.25s var(--ab-ease), border-color 0.25s var(--ab-ease);
}

.board-row:hover {
    background: rgba(0, 243, 255, 0.04);
    border-color: rgba(0, 243, 255, 0.18);
}

.board-time {
    color: #ffd700;
    font-size: 1.2rem;
    font-weight: 800;
    width: 70px;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.4);
}

.board-dest {
    color: #ffd700;
    font-size: 1.2rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 2px;
    flex: 1;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.4);
}

.board-status {
    font-size: 0.6rem;
    padding: 2px 6px;
    border-radius: 2px;
    font-weight: 900;
    align-self: center;
}

.status-on-time { color: #00ff88; border: 1px solid #00ff88; }
.status-delayed { color: #ff003c; border: 1px solid #ff003c; animation: board-blink 1s infinite; }

/* --- Progress bar in % column --- */
.board-progress {
    position: relative;
    width: 110px;
    height: 22px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 5px;
    overflow: hidden;
    flex-shrink: 0;
}

.board-progress-fill {
    position: absolute;
    inset: 0 auto 0 0;
    width: var(--p, 0%);
    height: 100%;
    background: linear-gradient(90deg, var(--hud-cyan), var(--hud-emerald));
    box-shadow: 0 0 10px rgba(0, 243, 255, 0.5);
    border-radius: 5px 0 0 5px;
    transition: width 0.6s cubic-bezier(0.19, 1, 0.22, 1);
}

/* % como pill/badge sobre la barra — blanco difuminado, sin bordes,
   con un fundido muy suave (no brusco) */
.board-progress-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    padding: 2px 11px;
    background: rgba(255, 255, 255, 0.38);
    color: #0a1424;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.66rem;
    font-weight: 800;
    letter-spacing: 0.5px;
    border-radius: 999px;
    border: none;                                   /* sin borde */
    backdrop-filter: blur(14px) saturate(160%);     /* mucho blur → fundido suave con el fill */
    -webkit-backdrop-filter: blur(14px) saturate(160%);
    /* glow muy difuminado, sin sombras duras */
    box-shadow:
        0 0 22px 4px rgba(255, 255, 255, 0.28),
        0 0 40px 8px rgba(255, 255, 255, 0.10);
    text-shadow: 0 0 6px rgba(255, 255, 255, 0.85);  /* legibilidad del texto */
    z-index: 5;
    pointer-events: none;
    white-space: nowrap;
}

/* El truco de doble texto invertido ya no es necesario con el badge */
.board-progress-text--inverted {
    display: none;
}

/* --- UE column (replaces visual role of .board-dest) --- */
.board-ue {
    color: #ffd700;
    font-size: 1rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 2px;
    text-align: center;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.4);
}

/* --- STATUS badges (pill style) --- */
.board-status.status-critico,
.board-status.status-bajo,
.board-status.status-proceso,
.board-status.status-avanzado,
.board-status.status-optimo {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.68rem;
    padding: 4px 12px;
    border-radius: 999px;
    font-weight: 900;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    white-space: nowrap;
}

.status-critico {
    color: #ff3b3b;
    background: rgba(255, 59, 59, 0.15);
    border: 1px solid rgba(255, 59, 59, 0.5);
    box-shadow: 0 0 6px rgba(255, 59, 59, 0.35);
}

.status-bajo {
    color: #ff8c42;
    background: rgba(255, 140, 66, 0.15);
    border: 1px solid rgba(255, 140, 66, 0.5);
    box-shadow: 0 0 6px rgba(255, 140, 66, 0.3);
}

.status-proceso {
    color: #f5d300;
    background: rgba(245, 211, 0, 0.15);
    border: 1px solid rgba(245, 211, 0, 0.5);
    box-shadow: 0 0 6px rgba(245, 211, 0, 0.3);
}

.status-avanzado {
    color: #4ade80;
    background: rgba(74, 222, 128, 0.15);
    border: 1px solid rgba(74, 222, 128, 0.5);
    box-shadow: 0 0 6px rgba(74, 222, 128, 0.3);
}

.status-optimo {
    color: #22c55e;
    background: rgba(34, 197, 94, 0.2);
    border: 1px solid rgba(34, 197, 94, 0.6);
    box-shadow: 0 0 8px rgba(34, 197, 94, 0.4);
}

/* --- Boards secundarios (METAS Y COMPROMISOS, CARTERA PRIORIZADA) ---
   Centrado completo en todas las celdas (% / label / STATUS). */
.airport-board--metas .board-header,
.airport-board--metas .board-row,
.airport-board--prioridad .board-header,
.airport-board--prioridad .board-row {
    text-align: center;
    place-items: center;
    justify-items: center;
    align-items: center;
}
.airport-board--metas .board-label,
.airport-board--metas .board-meta,
.airport-board--metas .board-progress,
.airport-board--metas .board-status,
.airport-board--prioridad .board-label,
.airport-board--prioridad .board-meta,
.airport-board--prioridad .board-progress,
.airport-board--prioridad .board-status {
    text-align: center;
    justify-self: center;
    align-self: center;
}

/* CARTERA PRIORIZADA: 4 columnas (% ejecución 2026 | programa | n° proy. | status).
   La fila "VER MÁS" se excluye (mantiene su 1 columna a todo el ancho). */
#board-prioridad { --ab-panel-w: 440px; }   /* algo más ancho para que entren 4 columnas */
#board-prioridad .board-header,
#board-prioridad .board-row:not(.view-more-row) {
    grid-template-columns: 110px 1fr 60px 88px;
    gap: 8px;
}
#board-prioridad .board-label {
    font-size: 0.58rem;
    letter-spacing: 0.5px;
    line-height: 1.2;
}
#board-prioridad .board-nproy {
    color: rgba(255, 255, 255, 0.9);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.95rem;
    font-weight: 700;
    text-align: center;
    justify-self: center;
    align-self: center;
}

/* Título de sección: sin contenedor, sólo tipografía + glow + línea decorativa */
.board-section-title {
    display: block;
    position: relative;
    width: 100%;
    margin: 0 0 16px;
    padding: 0 0 12px;
    font-family: 'Rajdhani', sans-serif;
    font-size: 1.05rem;
    font-weight: 800;
    color: var(--hud-cyan);
    letter-spacing: 4px;
    text-align: center;
    text-transform: uppercase;
    text-shadow: 0 0 18px rgba(0, 243, 255, 0.55), 0 0 4px rgba(0, 243, 255, 0.3);
    background: none;
    border: none;
    border-radius: 0;
}

/* Título largo de "Ejecución presupuestal por UE": forzar una sola línea */
#board-primary .board-section-title {
    white-space: nowrap;
    font-size: 0.82rem;
    letter-spacing: 1.8px;
}

.board-section-title::after {
    content: '';
    position: absolute;
    left: 50%;
    bottom: 0;
    transform: translateX(-50%);
    width: 70px;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--hud-cyan), transparent);
    opacity: 0.7;
    box-shadow: 0 0 8px rgba(0, 243, 255, 0.45);
}

.board-meta {
    color: #ffd700;
    font-size: 0.72rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    line-height: 1.25;
    text-align: center;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.4);
    max-width: 100%;
    overflow-wrap: break-word;
}

/* Fix VER MÁS centering — single full-width cell, place-items: center inherited */
.board-row.view-more-row {
    grid-template-columns: 1fr;
    transition: all 0.3s;
    text-decoration: none;   /* el de Cartera es un <a>: sin subrayado */
}

.view-more-row:hover {
    background: rgba(0, 243, 255, 0.15) !important;
    border-color: var(--hud-cyan) !important;
    box-shadow: 0 0 15px rgba(0, 243, 255, 0.2);
}

.view-more-row:hover .board-dest {
    color: var(--hud-cyan) !important;
    text-shadow: 0 0 10px var(--hud-cyan);
}

@keyframes board-blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

/* ==========================================
   CARTERA PRIORIZADA — desagregado por proyecto
   ========================================== */
/* La cartera priorizada se queda a la altura de su botón (top:340 heredado),
   igual que las otras dos tablas (antes subía a 126px para la lista larga). */

/* Listado scrollable dentro del board */
#board-prioridad .board-rows {
    max-height: calc(100vh - 356px);
    overflow-y: auto;
    padding-right: 6px;
}
#board-prioridad .board-rows::-webkit-scrollbar { width: 6px; }
#board-prioridad .board-rows::-webkit-scrollbar-thumb {
    background: rgba(0, 243, 255, 0.3);
    border-radius: 3px;
}

/* Encabezado-píldora de cada proyecto (CUI: NOMBRE) */
.proj-head {
    display: block;
    width: 100%;
    text-align: center;
    margin: 14px 0 4px;
    font-family: 'JetBrains Mono', monospace;
    font-weight: 700;
    font-size: 0.8rem;
    color: #dffbff;
    letter-spacing: 0.5px;
    line-height: 1.3;
    border: 1.5px solid var(--hud-cyan);
    border-radius: 14px;
    padding: 7px 12px;
    background: rgba(0, 243, 255, 0.08);
    box-shadow: 0 0 12px rgba(0, 243, 255, 0.18);
    white-space: normal;
    overflow-wrap: break-word;
    word-break: break-word;
}
.proj-head:first-child { margin-top: 0; }

/* ==========================================
   MEIBOT ASSISTANT WIDGET
   ========================================== */
.meibot-container {
    position: fixed;
    bottom: 12px;
    right: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    cursor: pointer;
    transition: all 0.3s ease;
}

.meibot-icon {
    width: 55px;
    height: 55px;
    background: rgba(5, 8, 12, 0.9);
    border: 1px solid var(--hud-cyan);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 15px rgba(0, 243, 255, 0.3);
    animation: meibot-hover 4s infinite ease-in-out;
    overflow: hidden;
}

.meibot-img {
    width: 120%;
    height: 120%;
    object-fit: cover;
    mix-blend-mode: screen;
}

.meibot-icon svg {
    width: 26px;
    height: 26px;
    stroke: var(--hud-cyan);
    filter: drop-shadow(0 0 5px var(--hud-cyan));
    transition: all 0.3s ease;
}

.meibot-label {
    margin-top: 10px;
    font-family: 'Rajdhani', sans-serif;
    font-size: 14px;
    font-weight: 700;
    color: var(--hud-cyan);
    letter-spacing: 2px;
    text-shadow: 0 0 5px rgba(0, 243, 255, 0.5);
    text-transform: uppercase;
    animation: meibot-glow 2s infinite alternate;
}

@keyframes meibot-hover {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

@keyframes meibot-glow {
    from { opacity: 0.6; }
    to { opacity: 1; text-shadow: 0 0 10px rgba(0, 243, 255, 0.8); }
}

.meibot-container:hover .meibot-icon {
    box-shadow: 0 0 25px rgba(0, 243, 255, 0.8);
    background: rgba(0, 243, 255, 0.1);
}

.meibot-container:hover .meibot-icon svg {
    transform: scale(1.1);
}

/* ==========================================
   ACCESSIBILITY: REDUCED MOTION
   ========================================== */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    .aurora-bg::before,
    .aurora-bg::after,
    .ticker-content,
    .rotating-arrows-ring,
    .meibot-container {
        animation: none !important;
    }
}

/* ============================================================
   ALERT DETAIL MODAL — antes inline en index.html
   ============================================================ */
#alert-modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.78);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 9999;
    animation: alert-overlay-in 0.25s ease forwards;
}
@keyframes alert-overlay-in { from { opacity: 0; } to { opacity: 1; } }

#alert-modal {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.96);
    opacity: 0;
    background: #0a1424;
    border: 1px solid rgba(0, 243, 255, 0.25);
    border-radius: 10px;
    padding: 0;
    z-index: 10000;
    width: min(700px, 90vw);
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 30px 70px rgba(0, 0, 0, 0.75), 0 0 40px rgba(0, 243, 255, 0.08);
}
#alert-modal.open {
    display: block;
    animation: alert-modal-in 0.3s ease forwards;
}
@keyframes alert-modal-in { to { transform: translate(-50%, -50%) scale(1); opacity: 1; } }

/* Header */
.am-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 22px 32px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.am-header-left { display: flex; align-items: center; gap: 16px; }
.am-sev {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.7rem;
    letter-spacing: 2px;
    padding: 5px 12px;
    border: 1px solid;
    border-radius: 4px;
    text-transform: uppercase;
    font-weight: 700;
}
.am-id {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.65rem;
    letter-spacing: 2px;
    color: #64748b;
}
.am-close {
    background: transparent;
    border: none;
    color: #64748b;
    cursor: pointer;
    padding: 4px 8px;
    font-size: 18px;
    line-height: 1;
    transition: color 0.2s;
}
.am-close:hover { color: #fff; }
.am-close svg { width: 18px; height: 18px; }

/* Title */
.am-title-block { padding: 24px 32px 18px; }
.am-title {
    font-family: 'Rajdhani', sans-serif;
    font-size: 1.35rem;
    font-weight: 700;
    letter-spacing: 0.8px;
    color: #fff;
    text-transform: uppercase;
    margin: 0 0 10px;
    line-height: 1.35;
}
.am-time {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.7rem;
    color: #64748b;
    letter-spacing: 1.5px;
}

/* Fields inline */
.am-fields {
    display: flex;
    padding: 0 32px 24px;
    gap: 32px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.am-field { display: flex; flex-direction: column; gap: 6px; }
.am-field-label {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.6rem;
    color: #64748b;
    letter-spacing: 1.5px;
}
.am-field-value {
    font-family: 'Rajdhani', sans-serif;
    font-size: 1rem;
    color: #cbd5e1;
    font-weight: 600;
    letter-spacing: 0.5px;
}

/* Timeline */
.am-timeline { padding: 24px 32px 18px; }
.am-timeline-label {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.6rem;
    color: #64748b;
    letter-spacing: 2px;
    margin-bottom: 18px;
}
.am-timeline-track {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    position: relative;
    padding: 0 4px;
}
.am-timeline-track::before {
    content: '';
    position: absolute;
    top: 7px;
    left: 8px;
    right: 8px;
    height: 1px;
    background: linear-gradient(90deg,
        var(--am-glow, #00f3ff) 0%,
        var(--am-glow, #00f3ff) var(--am-progress, 50%),
        rgba(255, 255, 255, 0.1) var(--am-progress, 50%));
}
.am-step { display: flex; flex-direction: column; align-items: center; gap: 10px; position: relative; z-index: 2; }
.am-step-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #0a1424;
    border: 2px solid rgba(255, 255, 255, 0.18);
    transition: all 0.3s;
}
.am-step.done .am-step-dot { background: var(--am-glow, #00f3ff); border-color: var(--am-glow, #00f3ff); }
.am-step.current .am-step-dot {
    background: #0a1424;
    border-color: var(--am-glow, #00f3ff);
    box-shadow: 0 0 10px var(--am-glow, #00f3ff);
    animation: am-blink 1.2s infinite;
}
@keyframes am-blink { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } }
.am-step-label {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.58rem;
    color: #475569;
    letter-spacing: 1.2px;
    text-transform: uppercase;
    white-space: nowrap;
}
.am-step.done .am-step-label,
.am-step.current .am-step-label { color: #cbd5e1; }

/* Description */
.am-desc { padding: 20px 32px 24px; }
.am-desc-label {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.6rem;
    color: #64748b;
    letter-spacing: 2px;
    margin-bottom: 12px;
}
.am-desc-box { font-size: 0.88rem; color: #94a3b8; line-height: 1.7; }

/* Footer */
.am-footer {
    padding: 20px 32px 22px;
    display: flex;
    justify-content: flex-end;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}
.am-btn {
    padding: 10px 24px;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 5px;
    color: #cbd5e1;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    font-family: 'JetBrains Mono', monospace;
    transition: all 0.2s;
}
.am-btn:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: #cbd5e1;
    color: #fff;
}

/* ============================================================
   WIP MODAL — antes inline en index.html
   ============================================================ */
#wip-modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 9999;
}

#wip-modal {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: linear-gradient(145deg, #1e293b, #0f172a);
    border: 1px solid rgba(0, 243, 255, 0.2);
    border-radius: 16px;
    padding: 40px 48px;
    z-index: 10000;
    text-align: center;
    min-width: 340px;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.6), 0 0 40px rgba(0, 243, 255, 0.08);
}

.wip-modal-emoji {
    font-size: 52px;
    margin-bottom: 16px;
}

.wip-modal-title {
    font-family: 'Orbitron', sans-serif;
    font-size: 20px;
    font-weight: 700;
    color: #fbbf24;
    letter-spacing: 3px;
    text-transform: uppercase;
    margin-bottom: 12px;
}

.wip-modal-text {
    font-size: 14px;
    color: #94a3b8;
    margin-bottom: 24px;
}

.wip-modal-btn {
    padding: 10px 28px;
    background: rgba(0, 243, 255, 0.1);
    border: 1px solid rgba(0, 243, 255, 0.3);
    border-radius: 8px;
    color: #00f3ff;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    letter-spacing: 1px;
    text-transform: uppercase;
    transition: background 0.2s, border-color 0.2s;
}
.wip-modal-btn:hover {
    background: rgba(0, 243, 255, 0.2);
    border-color: rgba(0, 243, 255, 0.6);
}

/* ============================================================
   Misc reglas migradas desde style="" inline del index.html
   ============================================================ */
/* Grid SVG decorativo de los gauges (display:none ahora; queda definido por si se reactiva) */
.seg-grid {
    display: none;
    stroke: #060a12;
    stroke-dasharray: 2 2;
    stroke-width: 14;
    fill: none;
}

/* Unidad pequeña dentro del .hud-big-val (el "%") */
.hud-big-val > span {
    font-size: 1rem;
}

/* Estilo extra del board-row "VER MÁS" (cuando es clickeable) */
.board-row.view-more-row {
    cursor: pointer;
    background: rgba(0, 243, 255, 0.05);
    margin-top: 10px;
    border-color: rgba(0, 243, 255, 0.3);
}

/* Texto del [ VER MÁS ] dentro de la fila */
.view-more-row .board-dest {
    text-align: center;
    font-size: 0.9rem;
    color: #fff;
    letter-spacing: 5px;
}

/* ==========================================================
   MODAL CONSULTA POR CUI — reporte de proyecto
   Mismo lenguaje HUD que #modal-cartera (fondo cuadriculado +
   cian, scanlines, borde cian). Tamaño tipo "documento/reporte".
   ========================================================== */
#modal-cui-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 3, 10, 0.75);
    backdrop-filter: blur(25px);
    z-index: 3000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.5s cubic-bezier(0.2, 0.8, 0.2, 1);
}
#modal-cui-overlay.show { opacity: 1; visibility: visible; }

#modal-cui {
    position: fixed;
    top: 50%; left: 50%;
    width: 98vw;
    height: 97vh;
    max-width: 2200px;
    max-height: 1320px;
    z-index: 3001;
    background: radial-gradient(circle at center, #0a111a 0%, #05080c 100%);
    background-image:
        linear-gradient(rgba(0, 243, 255, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 243, 255, 0.03) 1px, transparent 1px);
    background-size: 40px 40px;
    backdrop-filter: blur(20px);
    border: 1px solid rgba(0, 243, 255, 0.2);
    border-radius: 4px;
    box-shadow: 0 0 150px rgba(0, 0, 0, 1);
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transform: translate(-50%, -50%) scale(0.9);
    transition: all 0.55s cubic-bezier(0.19, 1, 0.22, 1);
}
#modal-cui.show { visibility: visible; opacity: 1; transform: translate(-50%, -50%) scale(1); }
#modal-cui::after {
    content: '';
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: repeating-linear-gradient(0deg, rgba(0,0,0,0.1) 0px, transparent 1px, transparent 2px);
    pointer-events: none;
    z-index: 10;
}

/* Cuerpo del modal: buscador arriba + reporte con scroll */
.cui-modal-body {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    padding: 22px 30px 26px;
    gap: 20px;
    position: relative;
    z-index: 11;
}

/* Buscador interno del modal */
.cui-modal-search {
    display: flex;
    align-items: center;
    gap: 10px;
    height: 48px;
    padding: 0 8px 0 16px;
    background: rgba(0, 243, 255, 0.05);
    border: 1px solid rgba(0, 243, 255, 0.3);
    border-radius: 8px;
    flex-shrink: 0;
    transition: border-color 0.3s, box-shadow 0.3s, background 0.3s;
}
.cui-modal-search:focus-within {
    border-color: var(--hud-cyan);
    background: rgba(0, 243, 255, 0.08);
    box-shadow: 0 0 16px rgba(0, 243, 255, 0.25);
}
.cui-modal-search .cui-search-icon {
    width: 18px !important; height: 18px !important;
    color: var(--hud-cyan); flex-shrink: 0; opacity: 0.85;
}
.cui-modal-input {
    flex: 1;
    border: none; background: transparent; outline: none;
    color: #fff;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.95rem;
    letter-spacing: 1px;
}
.cui-modal-input::placeholder { color: var(--text-dim); letter-spacing: 0.5px; }
.cui-modal-input::-webkit-search-cancel-button { -webkit-appearance: none; }
.cui-modal-btn {
    display: inline-flex; align-items: center; gap: 8px;
    height: 38px; padding: 0 20px;
    border: 1px solid rgba(0, 243, 255, 0.45);
    border-radius: 6px;
    background: rgba(0, 243, 255, 0.12);
    color: var(--hud-cyan);
    cursor: pointer;
    font-family: 'Rajdhani', sans-serif;
    font-weight: 700; font-size: 0.85rem; letter-spacing: 1.5px;
    text-transform: uppercase;
    flex-shrink: 0;
    transition: background 0.25s, color 0.25s, box-shadow 0.25s, transform 0.2s;
}
.cui-modal-btn:hover { background: var(--hud-cyan); color: #02121a; box-shadow: 0 0 16px rgba(0,243,255,0.4); transform: scale(1.03); }
.cui-modal-btn i { width: 15px; height: 15px; }

/* Botón LIMPIAR dentro del buscador */
.cui-clear-btn {
    display: inline-flex; align-items: center; gap: 7px;
    height: 38px; padding: 0 16px; flex-shrink: 0;
    border: 1px solid rgba(255, 255, 255, 0.2); border-radius: 6px;
    background: rgba(255, 255, 255, 0.05); color: rgba(255, 255, 255, 0.7);
    cursor: pointer; font-family: 'Rajdhani', sans-serif; font-weight: 700; font-size: 0.82rem; letter-spacing: 1px; text-transform: uppercase;
    transition: background .25s, color .25s, border-color .25s;
}
.cui-clear-btn:hover { background: rgba(255, 0, 60, 0.15); color: #ff6b88; border-color: rgba(255, 0, 60, 0.5); }
.cui-clear-btn i { width: 14px; height: 14px; }

/* VISTA DEDICADA del reporte: oculta buscador y cards, el reporte llena el modal */
.cui-modal-body.report-mode .cui-modal-search,
.cui-modal-body.report-mode .cui-carteras { display: none; }

/* ---- Tarjetas de CARTERA — FLIP CARD estilo Torre de Control ---- */
.cui-carteras { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 16px; flex-shrink: 0; }
.cui-cart-card {
    --cc: 0, 243, 255;
    height: 268px;
    perspective: 1600px;
    opacity: 0; transform: translateY(10px);
    animation: cc-appear .5s cubic-bezier(.19,1,.22,1) forwards;
    animation-delay: var(--d, 0ms);
    transition: opacity .35s, filter .35s;
}
@keyframes cc-appear { to { opacity: 1; transform: translateY(0); } }

.cui-cart-inner {
    position: relative; width: 100%; height: 100%;
    transition: transform .7s cubic-bezier(.4,.1,.2,1);
    transform-style: preserve-3d;
}
.cui-cart-card:hover .cui-cart-inner { transform: rotateY(180deg); }

.cui-cart-face {
    position: absolute; inset: 0; border-radius: 4px;
    backface-visibility: hidden; -webkit-backface-visibility: hidden;
    overflow: hidden; display: flex; flex-direction: column; padding: 20px 20px 18px;
    /* fondo SÓLIDO oscuro + tinte de color (visible sobre cualquier fondo) */
    background:
        linear-gradient(160deg, rgba(var(--cc), 0.20) 0%, rgba(var(--cc), 0.05) 60%, rgba(0,0,0,0) 100%),
        #0b1320;
    border: 1px solid rgba(var(--cc), 0.5);
    box-shadow: inset 0 0 26px rgba(var(--cc), 0.14), 0 12px 30px rgba(0,0,0,0.55), 0 0 16px rgba(var(--cc), 0.12);
}
/* L-corners (firma visual de la Torre) en ambas caras */
.cui-cart-face::before, .cui-cart-face::after {
    content: ''; position: absolute; width: 15px; height: 15px;
    border: 2px solid rgb(var(--cc)); pointer-events: none;
}
.cui-cart-face::before { top: -1px; left: -1px; border-right: none; border-bottom: none; }
.cui-cart-face::after  { bottom: -1px; right: -1px; border-left: none; border-top: none; }

/* Cara frontal */
.cc-front { align-items: flex-start; }
.cc-ftop { display: flex; align-items: center; justify-content: space-between; width: 100%; }
.cc-ic {
    width: 46px; height: 46px; flex-shrink: 0; display: grid; place-items: center; border-radius: 10px;
    background: rgba(var(--cc), 0.14); border: 1px solid rgba(var(--cc), 0.6);
    box-shadow: 0 0 16px rgba(var(--cc), 0.3), inset 0 0 12px rgba(var(--cc), 0.18);
}
.cc-ic i { width: 24px; height: 24px; color: rgb(var(--cc)); filter: drop-shadow(0 0 7px rgba(var(--cc), 0.7)); }
.cc-kicker { font-family: 'JetBrains Mono', monospace; font-size: 0.58rem; letter-spacing: 3px; color: rgba(var(--cc), 0.85); }
.cc-name { font-family: 'Rajdhani', sans-serif; font-weight: 800; font-size: 1.25rem; letter-spacing: 0.8px; color: #fff; text-transform: uppercase; text-shadow: 0 0 14px rgba(var(--cc), 0.5); margin-top: 16px; line-height: 1.12; }
.cc-desc { font-size: 0.8rem; color: #8a98a8; margin-top: 5px; }
.cc-foot { margin-top: auto; display: flex; align-items: center; gap: 7px; font-family: 'JetBrains Mono', monospace; font-size: 0.62rem; letter-spacing: 1px; color: rgba(var(--cc), 0.75); text-transform: uppercase; }
.cc-foot i { width: 13px; height: 13px; }

/* Cara trasera: 2 indicadores grandes y resaltados */
.cc-back { transform: rotateY(180deg); justify-content: flex-start; }
.cc-bnm { display: flex; align-items: center; gap: 9px; font-family: 'Rajdhani', sans-serif; font-weight: 800; font-size: 1rem; letter-spacing: 1.5px; text-transform: uppercase; color: rgb(var(--cc)); text-shadow: 0 0 10px rgba(var(--cc), 0.4); padding-bottom: 11px; border-bottom: 1px dashed rgba(var(--cc), 0.45); }
.cc-bnm i { width: 17px; height: 17px; }
.cc-stats { flex: 1; display: flex; flex-direction: column; justify-content: center; gap: 18px; }
.cc-stat { text-align: center; }
.cc-stat-val { display: block; font-family: 'JetBrains Mono', monospace; font-weight: 800; font-size: 1.7rem; line-height: 1; color: #fff; text-shadow: 0 0 18px rgba(var(--cc), 0.55); }
.cc-stat.accent .cc-stat-val { color: rgb(var(--cc)); }
.cc-stat-lbl { display: block; margin-top: 8px; font-family: 'Rajdhani', sans-serif; font-weight: 700; font-size: 0.72rem; letter-spacing: 2px; text-transform: uppercase; color: rgba(255,255,255,0.55); }

/* Encender / apagar al buscar (las que no pertenecen quedan muy apagadas) */
.cui-cart-card.off { opacity: 0.12; filter: grayscale(1) brightness(0.5); }
.cui-cart-card.on .cui-cart-face { border-color: rgb(var(--cc)); box-shadow: inset 0 0 26px rgba(var(--cc), 0.2), 0 12px 30px rgba(0,0,0,0.55), 0 0 30px rgba(var(--cc), 0.5); }

.cui-cart-error { grid-column: 1 / -1; color: rgba(255, 120, 140, 0.85); font-family: 'Rajdhani', sans-serif; padding: 10px; text-align: center; }

/* ---- Resumen del proyecto + botón "GENERAR REPORTE" ---- */
.cui-summary { padding: 8px 4px 6px; }
.cui-summary-cui {
    display: inline-block; font-family: 'JetBrains Mono', monospace;
    font-size: 0.72rem; letter-spacing: 1.5px; color: var(--hud-cyan);
    background: rgba(0, 243, 255, 0.08); border: 1px solid rgba(0, 243, 255, 0.35);
    border-radius: 4px; padding: 4px 11px; margin-bottom: 12px;
}
.cui-summary-title { font-family: 'Rajdhani', sans-serif; color: #fff; font-size: 1.2rem; font-weight: 700; margin: 0 0 12px; text-transform: uppercase; line-height: 1.3; }
.cui-summary-carteras { margin: 24px 0 10px; padding-top: 18px; border-top: 1px solid rgba(0,243,255,0.15); display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.cui-sum-label { font-family: 'JetBrains Mono', monospace; font-size: 0.7rem; letter-spacing: 1px; color: rgba(0, 243, 255, 0.7); text-transform: uppercase; }
.cui-sum-dim { color: var(--text-dim); font-style: italic; }
.cui-summary-carteras .cui-cartera-chip {
    --cc: 0, 243, 255;
    display: inline-flex; align-items: center; gap: 6px;
    color: rgb(var(--cc)); background: rgba(var(--cc), 0.12); border: 1px solid rgba(var(--cc), 0.55);
    border-radius: 4px; padding: 5px 12px; font-family: 'Rajdhani', sans-serif; font-weight: 700; font-size: 0.82rem; letter-spacing: 0.5px;
    text-decoration: none; cursor: pointer; text-transform: uppercase;
    transition: background .2s, box-shadow .2s, transform .2s;
}
.cui-summary-carteras a.cui-cartera-chip:hover {
    background: rgba(var(--cc), 0.22);
    box-shadow: 0 0 14px rgba(var(--cc), 0.45);
    transform: translateY(-1px);
}
.cui-summary-carteras .cui-cartera-chip i { width: 13px; height: 13px; }
.cui-sum-note { display: flex; align-items: center; gap: 8px; margin: 4px 0 18px; font-size: 0.82rem; color: rgba(255, 255, 255, 0.6); }
.cui-sum-note i { width: 15px; height: 15px; color: var(--hud-cyan); flex-shrink: 0; }
.cui-summary-text { font-family: 'Outfit', 'Segoe UI', sans-serif; color: rgba(255, 255, 255, 0.82); font-size: 0.96rem; line-height: 1.65; margin: 0 0 20px; text-align: justify; }
.cui-summary-text b { color: var(--hud-cyan); font-weight: 700; }
.cui-gen-btn {
    display: inline-flex; align-items: center; gap: 9px;
    height: 44px; padding: 0 26px;
    border: 1px solid rgba(0, 243, 255, 0.5); border-radius: 6px;
    background: rgba(0, 243, 255, 0.14); color: var(--hud-cyan);
    cursor: pointer; font-family: 'Rajdhani', sans-serif; font-weight: 700; font-size: 0.95rem; letter-spacing: 1.5px; text-transform: uppercase;
    transition: background .25s, color .25s, box-shadow .25s, transform .2s;
}
.cui-gen-btn:hover { background: var(--hud-cyan); color: #02121a; box-shadow: 0 0 18px rgba(0, 243, 255, 0.45); transform: scale(1.03); }
.cui-gen-btn i { width: 17px; height: 17px; }

/* Contenedor del reporte (scroll vertical) */
.cui-report {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding-right: 6px;
}
.cui-report::-webkit-scrollbar { width: 8px; }
.cui-report::-webkit-scrollbar-track { background: rgba(0,243,255,0.04); }
.cui-report::-webkit-scrollbar-thumb { background: rgba(0,243,255,0.3); border-radius: 4px; }

/* Estados: placeholder / cargando / error */
.cui-report-msg {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    height: 100%;
    min-height: 220px;
    text-align: center;
    font-family: 'Rajdhani', sans-serif;
    font-weight: 600;
    font-size: 1.05rem;
    letter-spacing: 1px;
    color: rgba(255, 255, 255, 0.5);
    padding: 20px;
}
.cui-report-msg i { width: 46px; height: 46px; color: rgba(0, 243, 255, 0.5); }
.cui-report-msg b { color: var(--hud-cyan); }
.cui-report-error i { color: rgba(255, 0, 60, 0.7); }
.cui-report-error { color: rgba(255, 120, 140, 0.85); }
.cui-report-loading i { animation: cui-spin 1s linear infinite; }
@keyframes cui-spin { to { transform: rotate(360deg); } }

/* Cabecera del reporte: nombre del proyecto + CUI */
.cui-rep-head {
    border-bottom: 1px solid rgba(0, 243, 255, 0.25);
    padding-bottom: 16px;
    margin-bottom: 20px;
}
.cui-rep-cui {
    display: inline-block;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 2px;
    color: var(--hud-cyan);
    background: rgba(0, 243, 255, 0.1);
    border: 1px solid rgba(0, 243, 255, 0.35);
    border-radius: 4px;
    padding: 4px 12px;
    margin-bottom: 12px;
}
.cui-rep-title {
    font-family: 'Rajdhani', sans-serif;
    font-size: 1.4rem;
    font-weight: 700;
    line-height: 1.3;
    color: #fff;
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Secciones del reporte */
.cui-rep-section { margin-bottom: 26px; }
.cui-rep-section-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: 'Rajdhani', sans-serif;
    font-size: 0.95rem;
    font-weight: 800;
    letter-spacing: 2.5px;
    text-transform: uppercase;
    color: var(--hud-cyan);
    text-shadow: 0 0 10px rgba(0, 243, 255, 0.35);
    margin-bottom: 14px;
}
.cui-rep-section-title::before {
    content: '';
    width: 7px; height: 7px;
    background: var(--hud-cyan);
    box-shadow: 0 0 10px var(--hud-cyan);
}
.cui-rep-section-title::after {
    content: '';
    flex: 1; height: 1px;
    background: linear-gradient(90deg, rgba(0,243,255,0.4), transparent);
}

/* Grilla de campos label / valor */
.cui-rep-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1px;
    background: rgba(0, 243, 255, 0.08);
    border: 1px solid rgba(0, 243, 255, 0.12);
}
.cui-rep-item {
    display: flex;
    flex-direction: column;
    gap: 5px;
    padding: 12px 16px;
    background: rgba(8, 16, 24, 0.85);
}
.cui-rep-item.full { grid-column: 1 / -1; }
.cui-rep-label {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.66rem;
    font-weight: 700;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: rgba(0, 243, 255, 0.7);
}
.cui-rep-value {
    font-family: 'Rajdhani', sans-serif;
    font-size: 1.05rem;
    font-weight: 600;
    color: #fff;
    word-break: break-word;
}
.cui-rep-value.num { font-family: 'JetBrains Mono', monospace; font-size: 0.98rem; }
.cui-rep-value.dim { color: var(--text-dim); }

/* Barra de avance dentro de un valor */
.cui-rep-bar {
    position: relative;
    height: 18px;
    margin-top: 4px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 3px;
    overflow: hidden;
}
.cui-rep-bar-fill {
    position: absolute;
    top: 0; left: 0; height: 100%;
    background: linear-gradient(90deg, rgba(0,243,255,0.5), var(--hud-cyan));
    box-shadow: 0 0 10px rgba(0,243,255,0.5);
}

@media (max-width: 720px) {
    .cui-modal-body { padding: 16px 16px 20px; }
    .cui-modal-search { height: 44px; flex-wrap: wrap; }
    .cui-carteras { grid-template-columns: repeat(2, 1fr); }
    .cui-rep-grid { grid-template-columns: 1fr; }
    .cui-rep-title { font-size: 1.15rem; }
}

/* ==========================================================
   REPORTE INSTITUCIONAL — "hoja oficial" dentro del modal
   Documento blanco con membrete (MVCS · OGMEI), secciones
   numeradas, carteras agrupadas y pie. Pensado para imprimir.
   ========================================================== */
:root {
    --inst-red:  #9c1b22;   /* rojo institucional (franja Perú) */
    --inst-navy: #14315c;   /* azul institucional (títulos)     */
    --inst-ink:  #1f2937;   /* texto principal                  */
    --inst-soft: #6b7280;   /* etiquetas / texto secundario     */
    --inst-line: #e3e7ec;   /* líneas / bordes                  */
}

.cui-print-btn[hidden], .cui-back-btn[hidden] { display: none !important; }

/* Lienzo: centra la hoja blanca sobre el fondo oscuro del modal */
.cui-doc {
    max-width: 860px;
    margin: 0 auto;
    background: #ffffff;
    color: var(--inst-ink);
    font-family: 'Outfit', 'Segoe UI', Arial, sans-serif;
    border-top: 5px solid var(--inst-red);
    box-shadow: 0 18px 60px rgba(0, 0, 0, 0.55);
    padding: 0 44px 34px;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
}

/* ---- Cabecera tipo TOP BAR (banda azul a todo el ancho) ---- */
.cui-doc-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin: 0 -44px;            /* rompe el padding lateral para ocupar todo el ancho */
    padding: 18px 44px;
    background: var(--inst-navy);
    color: #fff;
}
.cui-doc-org { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.cui-doc-org-1 {
    font-size: 0.9rem; font-weight: 700; letter-spacing: 0.4px;
    color: #fff; text-transform: uppercase; line-height: 1.2;
}
.cui-doc-org-2 { font-size: 0.78rem; font-weight: 500; color: rgba(255, 255, 255, 0.9); }
.cui-doc-org-3 { font-size: 0.72rem; color: rgba(255, 255, 255, 0.65); }
.cui-doc-meta { flex-shrink: 0; display: flex; flex-direction: column; align-items: flex-end; gap: 5px; text-align: right; }
.cui-doc-meta-type {
    font-size: 0.95rem; font-weight: 800; letter-spacing: 1.5px;
    color: #fff; white-space: nowrap;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 4px; padding: 5px 14px;
}
.cui-doc-meta-date { font-size: 0.7rem; color: rgba(255, 255, 255, 0.7); }

/* ---- Título del proyecto (centrado) ---- */
.cui-doc-titlebar { margin: 26px 0 6px; text-align: center; }
.cui-doc-title {
    margin: 0; font-size: 1.18rem; font-weight: 700; line-height: 1.4;
    color: var(--inst-ink); text-transform: uppercase;
}

/* ---- Secciones (más aire) ---- */
.cui-doc-section { margin-top: 30px; }
.cui-doc-section-title {
    margin: 0 0 14px;
    font-size: 0.85rem; font-weight: 800; letter-spacing: 0.8px;
    color: var(--inst-navy); text-transform: uppercase;
    padding-bottom: 7px;
    border-bottom: 2px solid var(--inst-red);
    text-align: center;
}

/* Grilla de campos tipo tabla — campos centrados y con aire */
.cui-doc-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    border: 1px solid var(--inst-line);
    border-bottom: none;
}
.cui-doc-field {
    display: flex; flex-direction: column; align-items: center; gap: 7px;
    padding: 18px 22px;
    text-align: center;
    border-bottom: 1px solid var(--inst-line);
    border-right: 1px solid var(--inst-line);
}
.cui-doc-field:nth-child(2n) { border-right: none; }
.cui-doc-field.full { grid-column: 1 / -1; border-right: none; }
.cui-doc-flabel {
    font-size: 0.66rem; font-weight: 700; letter-spacing: 0.6px;
    color: var(--inst-soft); text-transform: uppercase;
}
.cui-doc-fvalue { font-size: 0.95rem; font-weight: 600; color: var(--inst-ink); word-break: break-word; }
.cui-doc-fvalue.dim { color: var(--inst-soft); font-weight: 500; font-style: italic; }

/* Etiquetas de carteras (centradas) */
.cui-doc-chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.cui-cartera-chip {
    display: inline-block;
    font-size: 0.74rem; font-weight: 700; letter-spacing: 0.4px;
    color: var(--inst-navy);
    background: rgba(20, 49, 92, 0.08);
    border: 1px solid rgba(20, 49, 92, 0.35);
    border-radius: 3px; padding: 3px 10px;
}

/* Barra de avance */
.cui-doc-bar {
    display: block; position: relative;
    width: 180px; max-width: 100%;
    height: 8px; margin: 6px auto 0;
    background: #eef1f5; border-radius: 2px; overflow: hidden;
}
.cui-doc-bar-fill {
    position: absolute; top: 0; left: 0; height: 100%;
    background: var(--inst-navy); border-radius: 2px;
}

/* Subtexto (p. ej. "(45.2% del costo)" en Saldo por ejecutar) */
.cui-doc-sub { font-size: 0.72rem; color: var(--inst-soft); font-weight: 600; }

/* ---- Indicadores de avance (KPIs resaltados) ---- */
.cui-doc-kpis { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px; }
.cui-doc-kpi {
    --kc: 20, 49, 92;
    border: 1px solid var(--inst-line);
    border-top: 3px solid rgb(var(--kc));
    border-radius: 6px;
    padding: 16px 22px 18px;
    text-align: center;
    background: rgba(var(--kc), 0.05);
}
.cui-doc-kpi-lbl { display: block; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.8px; text-transform: uppercase; color: var(--inst-soft); }
.cui-doc-kpi-val { display: block; margin: 10px 0 12px; font-size: 2.3rem; font-weight: 800; line-height: 1; color: rgb(var(--kc)); }
.cui-doc-kpi-bar { display: block; height: 10px; border-radius: 5px; background: #eef1f5; overflow: hidden; }
.cui-doc-kpi-bar > span { display: block; height: 100%; border-radius: 5px; background: rgb(var(--kc)); }

/* ---- Pie ---- */
.cui-doc-foot {
    margin-top: 20px; padding-top: 10px;
    border-top: 1px solid var(--inst-line);
    display: flex; justify-content: space-between; flex-wrap: wrap; gap: 6px;
    font-size: 0.66rem; color: var(--inst-soft);
}

@media (max-width: 720px) {
    .cui-doc { padding: 0 18px 22px; }
    .cui-doc-head { flex-wrap: wrap; gap: 12px; margin: 0 -18px; padding: 16px 18px; }
    .cui-doc-meta { align-items: flex-start; text-align: left; }
    .cui-doc-grid { grid-template-columns: 1fr; }
    .cui-doc-field, .cui-doc-field:nth-child(2n) { border-right: none; }
}

/* Saltos de página al exportar el reporte a PDF (html2pdf):
   evita cortar secciones y filas por la mitad. */
.cui-doc-section,
.cui-doc-field,
.cui-doc-head,
.cui-doc-foot { break-inside: avoid; page-break-inside: avoid; }
