/* Custom styling for the PPP Concessions Dashboard (CALTEC) */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&family=Plus+Jakarta+Sans:wght@300;400;500;600;700&display=swap');

:root {
    /* Fonts */
    --font-heading: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;

    /* Colors (tema claro único) */
    --bg-app: #f3f4f6;
    --bg-sidebar: #ffffff;
    --bg-card: rgba(255, 255, 255, 0.8);
    --bg-card-hover: rgba(255, 255, 255, 0.95);
    --border-color: rgba(0, 0, 0, 0.08);
    --border-color-focus: rgba(37, 99, 235, 0.5);

    --text-primary: #111827;
    --text-secondary: #4b5563;
    --text-muted: #9ca3af;

    /* Brand & Accents */
    --primary: #2563eb;
    --primary-gradient: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    --accent: #7c3aed;
    --accent-gradient: linear-gradient(135deg, #6366f1 0%, #a855f7 100%);
    --accent-glow: rgba(124, 58, 237, 0.08);

    /* Status Colors */
    --success: #10b981;
    --success-bg: rgba(16, 185, 129, 0.12);
    --warning: #f59e0b;
    --warning-bg: rgba(245, 158, 11, 0.12);
    --danger: #ef4444;
    --danger-bg: rgba(239, 68, 68, 0.12);
    --info: #0ea5e9;
    --info-bg: rgba(14, 165, 233, 0.12);

    /* Misc */
    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 20px;
    --shadow-main: 0 8px 24px rgba(0, 0, 0, 0.04);
    --shadow-inset: inset 0 2px 4px rgba(0, 0, 0, 0.01);
    --transition-fast: 0.15s ease;
    --transition-normal: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Base resets & layout */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html,
body {
    height: 100vh;
    overflow: hidden;
    background-color: var(--bg-app);
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 14px;
    line-height: 1.4;
    -webkit-font-smoothing: antialiased;
    transition: background-color var(--transition-normal), color var(--transition-normal);
    display: flex;
    flex-direction: column;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: var(--font-heading);
    font-weight: 600;
    letter-spacing: -0.02em;
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: var(--radius-sm);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* Main Layout - Single Screen Viewport */
.app-container {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    width: 100vw;
    padding: 0;
    overflow: hidden;
    background-color: var(--bg-app);
}

/* Top Navigation Banner */
.top-navbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.25rem;
    height: 38px;
    min-height: 38px;
    background: linear-gradient(90deg, #1e3a6e 0%, #1a3460 60%, #1b3055 100%);
    border-bottom: 1px solid rgba(59, 130, 246, 0.25);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.35);
    position: relative;
    z-index: 2500;
    flex-shrink: 0;
}

.top-navbar-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

/* Logos del navbar como enlace de vuelta al landing (index.html) */
.top-navbar-home {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    transition: opacity var(--transition-fast);
}

.top-navbar-home:hover {
    opacity: 0.8;
}

.top-navbar-logo {
    height: 26px;
    width: auto;
    display: block;
    object-fit: contain;
    filter: brightness(0) invert(1);
    opacity: 0.92;
}

.top-navbar-logo-udec {
    height: 26px;
    width: auto;
    display: block;
    object-fit: contain;
}

/* Subheader View Selector Bar */
.view-subheader {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 1px;
    height: 36px;
    min-height: 36px;
    background: #1e3a6e;
    border-bottom: 2px solid #2563eb;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.25);
    flex-shrink: 0;
    z-index: 150;
}

.view-subheader.mop-tabs,
.view-subheader.three-tabs {
    grid-template-columns: repeat(3, 1fr);
}

.view-subheader.four-tabs {
    grid-template-columns: repeat(4, 1fr);
}

.view-subheader.five-tabs {
    grid-template-columns: repeat(5, 1fr);
}

.view-tab-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    height: 100%;
    border: none;
    background: rgba(15, 29, 61, 0.85);
    color: #93c5fd;
    font-family: var(--font-heading);
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    cursor: pointer;
    transition: all 0.2s ease;
    border-right: 1px solid rgba(59, 130, 246, 0.2);
}

.view-tab-btn:last-child {
    border-right: none;
}

.view-tab-btn:hover {
    color: #ffffff;
    background: rgba(37, 99, 235, 0.35);
}

.view-tab-btn.active {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    color: #ffffff !important;
    font-weight: 700;
    box-shadow: inset 0 -3px 0 #60a5fa, 0 2px 8px rgba(37, 99, 235, 0.4);
}

/* Nav Menu (Seleccionar Base de Datos) */
.nav-menu {
    position: relative;
    display: flex;
    align-items: center;
    margin-right: 0.5rem;
}

.nav-menu-btn {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.25);
    border-radius: 8px;
    color: #93c5fd;
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 0.72rem;
    font-weight: 500;
    padding: 0.2rem 0.6rem;
    cursor: pointer;
    transition: all 0.15s ease;
}

.nav-menu-btn:hover {
    background: rgba(59, 130, 246, 0.18);
    border-color: rgba(59, 130, 246, 0.4);
}

.nav-db-logo {
    width: 15px !important;
    height: 15px !important;
    max-width: 15px !important;
    max-height: 15px !important;
    object-fit: contain;
    flex-shrink: 0;
    display: inline-block;
    vertical-align: middle;
}

/* Animación tipo carpeta: al abrir, las filas crecen su alto desde 0 (el panel se
   despliega hacia abajo) y al cerrar se pliegan hacia arriba. CatlecNav.open/close
   ponen las clases temporales .expanding/.collapsing (overflow:hidden solo mientras
   dura la animación, para no recortar los submenús laterales). Los submenús se
   despliegan en horizontal hacia la izquierda. */
.nav-menu {
    --ms-ease: cubic-bezier(0.2, 0.8, 0.2, 1);
}

.nav-menu:has(.nav-menu-dropdown.open:not(.collapsing)) .nav-menu-btn {
    background: rgba(59, 130, 246, 0.18);
    border-color: rgba(59, 130, 246, 0.5);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.nav-menu-chevron {
    transition: transform 0.28s var(--ms-ease), color 0.15s ease;
}

.nav-menu:has(.nav-menu-dropdown.open:not(.collapsing)) .nav-menu-chevron {
    transform: rotate(180deg);
    color: #ffffff;
}

.nav-menu-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    background: #0f1626;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
    min-width: 220px;
    max-width: 320px;
    z-index: 3000;
}

.nav-menu-dropdown.open {
    display: block;
}

.nav-menu-dropdown.expanding > .nav-menu-group {
    overflow: hidden;
    animation: nav-row-in 0.22s var(--ms-ease);
}

.nav-menu-dropdown.collapsing {
    pointer-events: none;
    animation: nav-panel-out 0.2s ease forwards;
}

.nav-menu-dropdown.collapsing > .nav-menu-group {
    overflow: hidden;
    animation: nav-row-out 0.2s ease forwards;
}

/* 64px = alto de una fila con la etiqueta en dos líneas */
@keyframes nav-row-in {
    from { max-height: 0; opacity: 0; }
    to   { max-height: 64px; opacity: 1; }
}

@keyframes nav-row-out {
    from { max-height: 64px; }
    to   { max-height: 0; opacity: 0; }
}

/* El borde del panel se desvanece al final del pliegue */
@keyframes nav-panel-out {
    70% { opacity: 1; }
    to  { opacity: 0; }
}

.nav-menu-group {
    position: relative;
}

.nav-menu-has-sub {
    justify-content: space-between;
}

/* Submenú lateral: se revela desde el borde del menú hacia la izquierda y se
   repliega hacia la derecha. Los insets negativos del clip-path dejan pasar la
   sombra y el puente de hover (::after). */
.nav-submenu {
    display: block;
    visibility: hidden;
    opacity: 0;
    clip-path: inset(-40px -40px -40px 100%);
    transition:
        clip-path 0.16s ease,
        opacity 0.16s ease,
        visibility 0s linear 0.16s;
    position: absolute;
    top: 0;
    right: 100%;
    background: #0f1626;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
    min-width: 200px;
    z-index: 520;
    overflow: visible;
    padding: 0.25rem 0;
}

.nav-menu-group::after {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    right: 90%;
    width: 30px;
    pointer-events: auto;
    z-index: 515;
}

.nav-submenu::after {
    content: '';
    position: absolute;
    top: -15px;
    bottom: -15px;
    left: -15px;
    right: -25px;
    z-index: -1;
    pointer-events: auto;
}

.nav-menu-group:hover .nav-submenu,
.nav-menu-group.open .nav-submenu,
.nav-menu-group:focus-within .nav-submenu {
    visibility: visible;
    opacity: 1;
    clip-path: inset(-40px);
    z-index: 521; /* el que se abre queda sobre el que se está replegando */
    transition:
        clip-path 0.22s var(--ms-ease),
        opacity 0.18s ease,
        visibility 0s;
}

@media (prefers-reduced-motion: reduce) {
    .nav-menu-chevron,
    .nav-submenu,
    .nav-menu-group:hover .nav-submenu,
    .nav-menu-group.open .nav-submenu,
    .nav-menu-group:focus-within .nav-submenu {
        transition: none;
    }

    .nav-menu-dropdown.expanding > .nav-menu-group,
    .nav-menu-dropdown.collapsing,
    .nav-menu-dropdown.collapsing > .nav-menu-group {
        animation: none;
    }
}

.nav-submenu-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.85rem;
    font-size: 0.74rem;
    font-weight: 500;
    color: #94a3b8;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.15s, color 0.15s;
}

.nav-submenu-item:hover {
    background: rgba(59, 130, 246, 0.18);
    color: #ffffff;
}

.nav-menu-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.85rem;
    font-size: 0.75rem;
    font-weight: 500;
    color: #94a3b8;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.15s, color 0.15s;
}

.nav-menu-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: #f8fafc;
}

.nav-menu-item.active {
    color: #3b82f6;
    background: rgba(59, 130, 246, 0.08);
}

.nav-menu-parent-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: 1;
    text-decoration: none;
    color: inherit;
}

.nav-submenu-trigger-icon {
    width: 12px;
    height: 12px;
    opacity: 0.7;
    cursor: pointer;
    padding: 2px;
}

.top-navbar-title {
    font-family: var(--font-heading);
    font-size: 0.8rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.88);
    letter-spacing: 0.02em;
    white-space: nowrap;
}

.top-navbar-brand {
    font-family: var(--font-heading);
    font-size: 0.88rem;
    font-weight: 700;
    color: #ffffff;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    background: linear-gradient(135deg, #60a5fa, #a78bfa);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.top-navbar-right {
    display: flex;
    align-items: center;
}

.top-navbar-author {
    font-family: var(--font-sans);
    font-size: 0.7rem;
    font-weight: 400;
    color: rgba(255, 255, 255, 0.4);
    letter-spacing: 0.01em;
    font-style: italic;
}

/* Dashboard Body Wrapper */
.dashboard-content {
    flex: 1;
    min-height: 0;
    width: 100%;
    padding: 0.5rem;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Dashboard Grid: 3-Column Single Screen (Left Filters, Center MAP, Right KPIs+Table) */
.dashboard-grid {
    display: grid;
    grid-template-columns: 240px 1fr 500px;
    gap: 0.5rem;
    flex: 1;
    min-height: 0;
    width: 100%;
    overflow: hidden;
    align-items: stretch;
}

@media (max-width: 1200px) {
    .dashboard-grid {
        grid-template-columns: 220px 1fr 300px;
    }
}

/* Section Containers */
.left-panel {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    height: 100%;
    min-height: 0;
    position: relative;
    z-index: 10;
}

/* DGC, EFE y MOP: en pantallas bajas la columna hace scroll en vez de aplastar los gráficos de Análisis */
.left-panel-scroll {
    overflow-x: hidden;
    overflow-y: auto;
}

.panel-card-filters {
    flex-shrink: 0;
    position: relative;
    z-index: 1000;
    overflow: visible !important;
}

/* Base auto: nunca más baja que sus gráficos + leyendas; crece con el espacio sobrante */
.panel-card-analytics {
    flex: 1 0 auto;
    position: relative;
    z-index: 1;
}

.center-panel,
.map-panel {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
    position: relative;
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-main);
    background-color: var(--bg-card);
}

.right-panel,
.results-panel {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    height: 100%;
    min-height: 0;
    overflow: hidden;
}

/* ─── Separador arrastrable mapa ↔ tabla (CatlecPanelResizer) ──────────────
   Compartido por DGC, EFE y Metro (static/js/common/panel-resizer.js).
   Cada módulo define su grid-template-columns en su addon con la última
   columna = var(--catlec-table-width, <ancho por defecto>). El separador es
   absoluto sobre el área de la última columna y ocupa exactamente el gap entre
   el mapa y la tabla: no agrega columnas a la grilla. */
.catlec-resizable-grid {
    position: relative;
}

.catlec-panel-resizer {
    position: absolute;
    grid-column: -2 / -1;
    grid-row: 1;
    top: 0;
    bottom: 0;
    left: -0.5rem;
    width: 0.5rem;
    cursor: col-resize;
    z-index: 5;
    touch-action: none;
    outline: none;
}

.catlec-panel-resizer::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 3px;
    height: 36px;
    border-radius: 3px;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.14);
    transition: background-color var(--transition-fast), height var(--transition-fast);
}

.catlec-panel-resizer:hover::after,
.catlec-panel-resizer:focus-visible::after,
.catlec-panel-resizer.dragging::after {
    background: var(--primary);
    height: 56px;
}

.catlec-panel-resizer[hidden] {
    display: none;
}

body.catlec-resizing {
    cursor: col-resize;
    user-select: none;
}

body.catlec-resizing .map-panel,
body.catlec-resizing .right-panel {
    pointer-events: none;
}

/* KPI Compact 2x2 Grid */
.kpi-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.4rem;
}

.card-kpi {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-main);
    border-radius: var(--radius-sm);
    padding: 0.55rem 0.65rem;
    min-height: 57.56px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    position: relative;
    overflow: hidden;
    transition: transform var(--transition-normal), border-color var(--transition-normal);
}

.card-kpi:hover {
    border-color: var(--border-color-focus);
    background-color: var(--bg-card-hover);
}

/* Clickeable KPI card (triggers timeline / investment views) */
.card-kpi--interactive {
    cursor: pointer;
    position: relative;
    transition: background-color var(--transition-normal), border-color var(--transition-normal), box-shadow var(--transition-normal);
}

.card-kpi--interactive:hover {
    border-color: var(--primary);
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.08) 0%, rgba(37, 99, 235, 0.03) 100%);
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.12);
}

.card-kpi--interactive.timeline-active {
    border-color: var(--primary);
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.12) 0%, rgba(37, 99, 235, 0.05) 100%);
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.25);
}

.kpi-interactive-hint {
    width: 14px !important;
    height: 14px !important;
    color: var(--primary);
    opacity: 0.6;
    margin-left: auto;
    flex-shrink: 0;
    transition: opacity var(--transition-fast), transform var(--transition-fast);
}

.card-kpi--interactive:hover .kpi-interactive-hint {
    opacity: 1;
    transform: scale(1.2);
}

.kpi-icon {
    background-color: var(--border-color);
    color: var(--primary);
    width: 32px;
    height: 32px;
    min-width: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.kpi-icon svg {
    width: 16px;
    height: 16px;
}

.kpi-val-container {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.kpi-label {
    text-transform: uppercase;
    font-size: 0.62rem;
    font-weight: 600;
    color: var(--text-secondary);
    letter-spacing: 0.03em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.kpi-value {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.1;
    /* Dígitos de ancho fijo: el contador animado (CatlecKpiAnimate) no hace temblar la tarjeta */
    font-variant-numeric: tabular-nums;
}

.kpi-notes {
    display: none;
}

.panel-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-main);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    transition: background-color var(--transition-normal), border-color var(--transition-normal);
}

.panel-title {
    font-size: 1rem;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.75rem;
    margin-bottom: 0.25rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.panel-title svg {
    color: var(--primary);
    width: 18px;
    height: 18px;
}

/* Forms & Inputs */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.search-wrapper {
    position: relative;
    width: 100%;
}

.search-wrapper svg {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    color: var(--text-muted);
    pointer-events: none;
    transition: color var(--transition-fast);
}

.form-input {
    width: 100%;
    background-color: rgba(255, 255, 255, 0.8);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 0.9rem;
    padding: 0.75rem 1rem 0.75rem 2.25rem;
    border-radius: var(--radius-sm);
    outline: none;
    transition: all var(--transition-fast);
}

.form-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

/* Custom Multi-Select Dropdown Component
   Se abre/cierra con la clase .open en .custom-multiselect (CatlecUtils.setupMultiselect
   / closeAllMultiselects): la lista aparece con fundido + leve desplazamiento/escala y
   la flecha gira 180°. No usar style.display ni display:none inline en la lista. */
.custom-multiselect {
    --ms-ease: cubic-bezier(0.2, 0.8, 0.2, 1);
    position: relative;
    width: 100%;
}

.multiselect-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    user-select: none;
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding-right: 0.65rem !important;
}

/* Trigger abierto: mismo borde y halo que .form-input:focus */
.custom-multiselect.open .multiselect-trigger {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

/* Flecha (svg Lucide del trigger): gira 180° al abrir */
.multiselect-trigger svg {
    transition: transform 0.28s var(--ms-ease), color 0.15s ease;
}

.custom-multiselect.open .multiselect-trigger svg {
    transform: rotate(180deg);
    color: var(--primary);
}

.multiselect-dropdown {
    opacity: 0;
    visibility: hidden;
    transform: translateY(-6px) scale(0.97);
    transform-origin: top left;
    transition:
        opacity 0.16s ease,
        transform 0.2s var(--ms-ease),
        visibility 0s linear 0.2s;
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    width: 100%;
    max-height: none;
    background-color: var(--bg-sidebar);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    box-shadow: 0 10px 35px rgba(0, 0, 0, 0.5);
    z-index: 99999 !important;
    display: flex;
    flex-direction: column;
    overflow: visible;
}

.custom-multiselect.open .multiselect-dropdown {
    opacity: 1;
    visibility: visible;
    transform: none;
    transition:
        opacity 0.18s ease,
        transform 0.24s var(--ms-ease),
        visibility 0s;
}

@media (prefers-reduced-motion: reduce) {
    .multiselect-dropdown,
    .custom-multiselect.open .multiselect-dropdown,
    .multiselect-trigger svg {
        transition: none;
    }
}

.multiselect-actions {
    padding: 0.3rem 0.6rem;
    border-bottom: 1px solid var(--border-color);
    background-color: rgba(240, 243, 248, 0.9);
}

.multiselect-options-list {
    overflow-y: visible;
    max-height: none;
    padding: 0.2rem 0;
}

.multiselect-option {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.25rem 0.6rem;
    font-size: 0.74rem;
    color: var(--text-primary);
    cursor: pointer;
    transition: background-color var(--transition-fast);
}

.multiselect-option:hover {
    background-color: var(--border-color);
}

.multiselect-option input[type="checkbox"] {
    accent-color: var(--primary);
    width: 14px;
    height: 14px;
    cursor: pointer;
}

/* Custom Select Dropdowns */
.select-wrapper {
    position: relative;
    width: 100%;
}

.select-wrapper select {
    appearance: none;
    -webkit-appearance: none;
    cursor: pointer;
    padding-left: 1rem;
    padding-right: 2.25rem;
}

.select-wrapper::after {
    content: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    transition: transform var(--transition-fast);
}

.select-wrapper:hover::after {
    filter: brightness(1.2);
}

/* Interactive Charts Panel */
.chart-container {
    position: relative;
    width: 100%;
    height: 240px;
    margin-top: 0.5rem;
}

.results-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
}

.results-count {
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.results-count span {
    color: var(--primary);
    font-weight: 700;
}

/* ─── Global Button Utilities ──────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.35rem 0.75rem;
    border-radius: var(--radius-sm);
    font-family: var(--font-sans);
    font-size: 0.74rem;
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: all var(--transition-fast);
}

.btn-xs {
    padding: 0.25rem 0.5rem;
    font-size: 0.72rem;
}

.btn-ghost {
    background: #ffffff;
    border: 1px solid #d1d5db;
    color: #4b5563;
}

.btn-ghost:hover {
    border-color: #2563eb;
    color: #2563eb;
    background: #f8fafc;
}

.btn-primary {
    background: var(--primary-gradient);
    color: #ffffff;
}

.btn-primary:hover {
    opacity: 0.9;
}

/* Floating Map Controls & Legend Overlay */
.btn-floating-map {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 1000;
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 0.35rem 0.65rem;
    font-size: 0.75rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    box-shadow: var(--shadow-main);
    display: flex;
    align-items: center;
    gap: 0.35rem;
    transition: all var(--transition-fast);
}

.btn-floating-map:hover {
    background-color: var(--primary);
    border-color: var(--primary);
    color: #ffffff;
}

.map-legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-secondary);
    font-weight: 500;
}

.map-legend-badge,
.map-legend-icon-badge {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
}

/* ─── Leyenda de mapas MapLibre (DGC, EFE, Metro) ───────────────────────────
   Control de CatlecMapGL.addLegendControl (abajo a la izquierda). La cabecera
   es un botón que repliega el cuerpo: el recuadro anima su ancho y alto
   (.is-animating, tamaños fijados por JS) y el cuerpo se desvanece. */
.catlec-map-legend {
    box-sizing: border-box;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: var(--radius-sm);
    padding: 0.45rem 0.65rem;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08);
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    color: #1e293b;
    font-family: var(--font-sans);
    font-size: 0.72rem;
    /* Anula el margen por defecto de .maplibregl-ctrl-bottom-left .maplibregl-ctrl */
    margin: 0 0 0.8rem 0.8rem !important;
    pointer-events: auto;
}

.catlec-map-legend.is-animating {
    overflow: hidden;
    transition: width 0.28s cubic-bezier(0.4, 0, 0.2, 1), height 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}

.catlec-map-legend-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    width: 100%;
    margin: 0 0 0.1rem;
    padding: 0 0 0.2rem;
    border: none;
    border-bottom: 1px solid #e2e8f0;
    background: none;
    font: inherit;
    color: #64748b;
    cursor: pointer;
    text-align: left;
    /* Sin transición de padding/margin: el JS mide el tamaño final al instante */
    transition: color var(--transition-fast), border-color 0.28s ease;
}

.catlec-map-legend-header:hover {
    color: var(--primary);
}

.catlec-map-legend-header:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
    border-radius: 3px;
}

.catlec-map-legend-title {
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    white-space: nowrap;
}

.catlec-map-legend-chevron {
    width: 13px;
    height: 13px;
    flex-shrink: 0;
    transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}

.catlec-map-legend-body {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

/* Replegada: solo la cabecera, sin separador */
.catlec-map-legend.collapsed .catlec-map-legend-header {
    border-bottom-color: transparent;
    padding-bottom: 0;
    margin-bottom: 0;
}

.catlec-map-legend.collapsed .catlec-map-legend-chevron {
    transform: rotate(180deg);
}

.catlec-map-legend.collapsed .catlec-map-legend-body {
    display: none;
}

/* Durante la animación el cuerpo sigue visible (lo recorta el recuadro) */
.catlec-map-legend.is-animating .catlec-map-legend-body {
    display: flex;
    animation: catlec-legend-body-in 0.24s ease 0.04s both;
}

.catlec-map-legend.is-animating.collapsed .catlec-map-legend-body {
    animation: catlec-legend-body-out 0.18s ease both;
}

@keyframes catlec-legend-body-in {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: none; }
}

@keyframes catlec-legend-body-out {
    from { opacity: 1; transform: none; }
    to { opacity: 0; transform: translateY(4px); }
}

@media (prefers-reduced-motion: reduce) {
    .catlec-map-legend.is-animating,
    .catlec-map-legend-header,
    .catlec-map-legend-chevron {
        transition: none;
    }
    .catlec-map-legend.is-animating .catlec-map-legend-body {
        animation: none;
    }
}

/* Custom UI Buttons */
.btn-reset {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 0.4rem 0.8rem;
    border-radius: var(--radius-sm);
    font-family: var(--font-sans);
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    transition: all var(--transition-fast);
}

.btn-reset:hover {
    background-color: var(--primary);
    border-color: var(--primary);
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.25);
}

/* Dedicated Project Detail View Styling */
.project-detail-view {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-main);
    overflow: hidden;
}

.detail-view-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.4rem 0.65rem;
    border-bottom: 1px solid var(--border-color);
    background-color: rgba(240, 243, 248, 0.85);
}

.detail-view-body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

/* Data Table Elements */
.table-responsive {
    width: 100%;
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    background-color: var(--bg-card);
    box-shadow: var(--shadow-main);
    position: relative;
    overflow: hidden;
}

.table-header-wrapper {
    width: 100%;
    flex-shrink: 0;
    background-color: #e5e7eb;
    scrollbar-gutter: stable;
}

.table-body-wrapper {
    width: 100%;
    flex: 1;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    scrollbar-gutter: stable;
}

.data-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    text-align: left;
    font-size: 0.72rem;
    table-layout: fixed;
}

/* Column widths without Código */
.data-table th:nth-child(1),
.data-table td:nth-child(1) {
    width: 180px;
}

.data-table th:nth-child(2),
.data-table td:nth-child(2) {
    width: 95px;
}

.data-table th:nth-child(3),
.data-table td:nth-child(3) {
    width: 120px;
}

.data-table th:nth-child(4),
.data-table td:nth-child(4) {
    width: 85px;
}

.data-table th {
    color: var(--text-secondary);
    font-family: var(--font-heading);
    font-weight: 600;
    padding: 0.6rem 0.75rem;
    border-bottom: 2px solid var(--border-color);
    text-transform: uppercase;
    font-size: 0.68rem;
    letter-spacing: 0.05em;
    user-select: none;
    white-space: nowrap;
    vertical-align: middle;
    background-color: #e5e7eb;
}

.data-table td {
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
    vertical-align: middle;
    transition: background-color var(--transition-fast);
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.data-table tbody tr.row-main {
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.15s ease, box-shadow 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.data-table tbody tr.row-main:hover:not(.row-selected),
.data-table tbody tr.row-main:hover:not(.row-selected) td {
    background-color: rgba(37, 99, 235, 0.08) !important;
}

.data-table tbody tr.row-main.expanded {
    background-color: rgba(59, 130, 246, 0.04);
}

/* La selección (click) debe verse instantánea en el fondo, sin animar background-color —
   pero el borde izquierdo (box-shadow) sí anima tanto al aparecer como al desaparecer. */
.data-table tbody tr.row-main.row-selected {
    transition: color 0.15s ease, box-shadow 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Las celdas también reciben el fondo de hover; al seleccionar deben soltarlo al instante
   para que no se vea un destello mientras se desvanece sobre el fondo de selección. */
.data-table tbody tr.row-main.row-selected td {
    transition: none;
}

/* Sort Icons */
.sortable {
    cursor: pointer;
    position: relative;
    padding-right: 1.5rem !important;
}

.sortable::after {
    content: '↕';
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.sortable.asc::after {
    content: '▲';
    color: var(--primary);
}

.sortable.desc::after {
    content: '▼';
    color: var(--primary);
}

/* Detail Drawer Row */
.row-detail {
    display: none;
    background-color: rgba(0, 0, 0, 0.01);
}

.row-detail.active {
    display: table-row;
    animation: fadeIn var(--transition-fast) forwards;
}

.detail-content {
    padding: 1.5rem 2rem;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    border-bottom: 1px solid var(--border-color);
}

@media (max-width: 768px) {
    .detail-content {
        grid-template-columns: 1fr;
    }
}

.detail-section {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.detail-title {
    font-size: 0.85rem;
    text-transform: uppercase;
    font-weight: 700;
    color: var(--primary);
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.25rem;
}

.detail-desc {
    color: var(--text-secondary);
    font-size: 0.85rem;
    line-height: 1.6;
    text-align: justify;
}

/* Foto del proyecto en la vista de detalle (compartida por EFE y DGC) */
.detail-photo-wrapper {
    margin-top: 0.55rem;
    margin-bottom: 0.65rem;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    position: relative;
    width: 100%;
    flex-shrink: 0;
}
.detail-project-photo {
    width: 100%;
    height: 220px;
    max-height: 250px;
    object-fit: cover;
    display: block;
    cursor: default;
    user-select: none;
    -webkit-user-drag: none;
}
.detail-photo-caption {
    font-size: 0.68rem;
    color: var(--text-muted);
    padding: 0.28rem 0.6rem;
    text-align: right;
    background: var(--bg-card);
    border-top: 1px solid var(--border-color);
    font-style: italic;
    font-weight: 500;
}

/* Fotos de referencia de las fichas (DGC y MOP, CatlecPhotoViewer en
   static/js/common/photo-viewer.js): carrusel de la ficha y visor a tamaño completo.
   Etiquetas sobre la foto: nombre de la infraestructura, contador y aviso de IA. */
.catlec-photo-ai-note,
.catlec-photo-label,
.catlec-photo-counter {
    padding: 0.18rem 0.45rem;
    border-radius: var(--radius-sm);
    background: rgba(15, 23, 42, 0.68);
    color: #fff;
    font-size: 0.62rem;
    font-weight: 500;
    line-height: 1.3;
    pointer-events: none;
}

.catlec-photo-overlay {
    position: absolute;
    left: 0.4rem;
    right: 0.4rem;
    bottom: 0.4rem;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 0.4rem;
    pointer-events: none;
}

.catlec-photo-label {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 600;
}

.catlec-photo-label[hidden] {
    display: none;
}

.catlec-photo-ai-note {
    flex-shrink: 0;
    margin-left: auto;
}

.catlec-photo-counter {
    position: absolute;
    top: 0.4rem;
    left: 0.4rem;
    font-variant-numeric: tabular-nums;
}

.catlec-photo-carousel {
    height: 220px;
    touch-action: pan-y;
}

.catlec-photo-carousel .catlec-photo-slide {
    position: absolute;
    inset: 0;
    height: 100%;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease, transform 0.25s ease;
}

.catlec-photo-carousel .catlec-photo-slide.active {
    opacity: 1;
    pointer-events: auto;
}

.detail-project-photo.catlec-photo-zoomable {
    cursor: zoom-in;
    transition: transform 0.25s ease;
}

.detail-project-photo.catlec-photo-zoomable:hover {
    transform: scale(1.02);
}

.catlec-photo-nav {
    position: absolute;
    top: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: rgba(15, 23, 42, 0.45);
    color: #fff;
    cursor: pointer;
    opacity: 0;
    transform: translateY(-50%);
    transition: opacity 0.2s ease, background 0.15s ease;
}

.catlec-photo-nav--prev { left: 0.4rem; }
.catlec-photo-nav--next { right: 0.4rem; }

.catlec-photo-nav svg {
    width: 16px;
    height: 16px;
}

.catlec-photo-carousel:hover .catlec-photo-nav,
.catlec-photo-nav:focus-visible {
    opacity: 1;
}

.catlec-photo-nav:hover {
    background: rgba(15, 23, 42, 0.68);
}

/* En pantallas táctiles no hay hover: flechas siempre visibles */
@media (hover: none) {
    .catlec-photo-nav { opacity: 1; }
}

/* Con una sola foto no hay flechas ni contador */
.catlec-photo-carousel:not(.catlec-photo-carousel--multi) .catlec-photo-nav,
.catlec-photo-carousel:not(.catlec-photo-carousel--multi) .catlec-photo-counter,
.catlec-photo-lightbox:not(.catlec-photo-lightbox--multi) .catlec-photo-lightbox-nav,
.catlec-photo-lightbox:not(.catlec-photo-lightbox--multi) .catlec-photo-counter {
    display: none;
}

/* Visor a tamaño completo de la foto */
.catlec-photo-lightbox {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    cursor: zoom-out;
    touch-action: pinch-zoom;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0s linear 0.2s;
}

.catlec-photo-lightbox.open {
    opacity: 1;
    visibility: visible;
    transition: opacity 0.2s ease;
}

.catlec-photo-lightbox-figure {
    position: relative;
    margin: 0;
    transform: scale(0.96);
    transition: transform 0.2s ease;
}

.catlec-photo-lightbox.open .catlec-photo-lightbox-figure {
    transform: scale(1);
}

.catlec-photo-lightbox-img {
    display: block;
    max-width: calc(100vw - 3rem);
    max-height: calc(100vh - 3rem);
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 25px 65px rgba(0, 0, 0, 0.45);
    cursor: default;
}

.catlec-photo-lightbox .catlec-photo-overlay {
    left: 0.6rem;
    right: 0.6rem;
    bottom: 0.6rem;
}

.catlec-photo-lightbox .catlec-photo-counter {
    top: 0.6rem;
    left: 0.6rem;
}

.catlec-photo-lightbox .catlec-photo-ai-note,
.catlec-photo-lightbox .catlec-photo-label,
.catlec-photo-lightbox .catlec-photo-counter {
    font-size: 0.72rem;
}

.catlec-photo-lightbox-close {
    top: 1rem;
    right: 1rem;
}

.catlec-photo-lightbox-nav {
    top: 50%;
    transform: translateY(-50%);
}

.catlec-photo-lightbox-nav--prev { left: 1rem; }
.catlec-photo-lightbox-nav--next { right: 1rem; }

.catlec-photo-lightbox-btn {
    position: absolute;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.45rem;
    border: none;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    cursor: pointer;
    transition: background 0.15s ease;
}

.catlec-photo-lightbox-btn:hover {
    background: rgba(255, 255, 255, 0.25);
}

.catlec-photo-lightbox-btn svg {
    width: 20px;
    height: 20px;
}

.detail-grid {
    display: grid;
    grid-template-columns: auto 1fr;
    column-gap: 1.5rem;
    row-gap: 0.5rem;
    font-size: 0.85rem;
}

.detail-label {
    font-weight: 600;
    color: var(--text-secondary);
}

.detail-value {
    color: var(--text-primary);
}

.detail-actions {
    grid-column: span 2;
    display: flex;
    gap: 1rem;
    margin-top: 0.5rem;
}

@media (max-width: 768px) {
    .detail-actions {
        grid-column: span 1;
        flex-direction: column;
    }
}

/* Badges styling */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.6rem;
    border-radius: 30px;
    font-size: 0.65rem;
    font-weight: 600;
    line-height: 1;
    text-transform: capitalize;
}

.badge-success {
    background-color: var(--success-bg);
    color: var(--success);
}

.badge-warning {
    background-color: var(--warning-bg);
    color: var(--warning);
}

.badge-info {
    background-color: var(--info-bg);
    color: var(--info);
}

.badge-danger {
    background-color: var(--danger-bg);
    color: var(--danger);
}

.badge-neutral {
    background-color: var(--border-color);
    color: var(--text-secondary);
}

.badge-licitacion {
    background-color: rgba(124, 58, 237, 0.1);
    color: var(--accent);
    border: 1px solid rgba(124, 58, 237, 0.25);
}

.btn-action-link {
    background-color: var(--border-color);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    text-decoration: none;
    font-size: 0.8rem;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: all var(--transition-fast);
}

.btn-action-link:hover {
    background-color: var(--bg-card-hover);
    border-color: var(--text-muted);
}

.btn-action-link svg {
    width: 14px;
    height: 14px;
}

/* Empty states */
.empty-state {
    padding: 4rem 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: var(--text-secondary);
    gap: 1rem;
}

.empty-state svg {
    width: 48px;
    height: 48px;
    color: var(--text-muted);
}

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

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

.fade-in-quick {
    animation: fadeIn var(--transition-fast) forwards;
}

/* Transición tabla ↔ ficha de detalle de proyecto (CatlecUtils.swapView):
   fundido cruzado + desplazamiento horizontal simétrico (DGC, EFE, Metro, MOP).
   La salida es corta y acelera; la entrada es algo más larga y desacelera, así
   la vista nueva "se asienta" en vez de frenar en seco. */
@keyframes catlecViewOutToLeft {
    from { opacity: 1; transform: translateX(0); }
    to { opacity: 0; transform: translateX(-12px); }
}

@keyframes catlecViewOutToRight {
    from { opacity: 1; transform: translateX(0); }
    to { opacity: 0; transform: translateX(12px); }
}

@keyframes catlecViewInFromRight {
    from { opacity: 0; transform: translateX(16px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes catlecViewInFromLeft {
    from { opacity: 0; transform: translateX(-16px); }
    to { opacity: 1; transform: translateX(0); }
}

.catlec-view-out-left,
.catlec-view-out-right {
    animation-duration: 0.16s;
    animation-timing-function: cubic-bezier(0.4, 0, 1, 1);
    animation-fill-mode: forwards;
    will-change: opacity, transform;
}

.catlec-view-in-left,
.catlec-view-in-right {
    animation-duration: 0.26s;
    animation-timing-function: cubic-bezier(0.22, 1, 0.36, 1);
    animation-fill-mode: both;
    will-change: opacity, transform;
}

.catlec-view-out-left { animation-name: catlecViewOutToLeft; }
.catlec-view-out-right { animation-name: catlecViewOutToRight; }
.catlec-view-in-right { animation-name: catlecViewInFromRight; }
.catlec-view-in-left { animation-name: catlecViewInFromLeft; }

/* Pagination panel */
.pagination-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    background-color: var(--bg-sidebar);
    border: 1px solid var(--border-color);
    border-top: none;
    border-radius: 0 0 var(--radius-md) var(--radius-md);
    font-size: 0.82rem;
    color: var(--text-secondary);
}

.pagination-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-paged {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 0.4rem 0.8rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.82rem;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    transition: all var(--transition-fast);
}

.btn-paged:hover:not(:disabled) {
    background-color: var(--primary);
    color: #ffffff;
    border-color: var(--primary);
}

.btn-paged:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* Footer Section */
footer {
    text-align: center;
    padding: 1.5rem;
    color: var(--text-muted);
    font-size: 0.8rem;
    border-top: 1px solid var(--border-color);
    margin-top: auto;
}

/* Tab Navigation Styles */
.tab-navigation {
    display: flex;
    gap: 0.5rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.75rem;
    margin-bottom: 0.5rem;
}

.nav-tab {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 0.6rem 1.25rem;
    border-radius: var(--radius-sm);
    font-family: var(--font-heading);
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all var(--transition-fast);
    outline: none;
}

.nav-tab:hover {
    background-color: var(--bg-card-hover);
    color: var(--text-primary);
    border-color: var(--text-muted);
}

.nav-tab.active {
    background-color: var(--primary);
    border-color: var(--primary);
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.25);
}

.nav-tab svg {
    width: 16px;
    height: 16px;
    transition: transform var(--transition-fast);
}

.nav-tab.active svg {
    transform: scale(1.1);
}

/* Vector SVG Map Specific Styling */
.map-view-card {
    transition: background-color var(--transition-normal), border-color var(--transition-normal);
}

.map-wrapper {
    box-shadow: var(--shadow-inset);
    background-color: #f8fafc;
}

/* Chile Region Path styling inside vector SVG */
.chile-region-path {
    fill: var(--bg-card);
    stroke: var(--border-color);
    stroke-width: 1px;
    cursor: pointer;
    transition: fill var(--transition-fast), stroke var(--transition-fast), stroke-width var(--transition-fast);
}

/* Highlight regions containing filtered projects */
.chile-region-path.region-has-projects {
    fill: var(--bg-card-hover);
    stroke: var(--text-muted);
    stroke-width: 1.2px;
}

/* Hover highlights */
.chile-region-path:hover {
    fill: rgba(59, 130, 246, 0.25) !important;
    stroke: var(--primary) !important;
    stroke-width: 1.8px !important;
}

/* Selected region highlight */
.chile-region-path.region-selected {
    fill: rgba(59, 130, 246, 0.15) !important;
    stroke: var(--primary) !important;
    stroke-width: 2.2px !important;
}

/* Map Dot Marker Animations */
@keyframes markerPulseAnimation {
    0% {
        transform: scale(0.9);
        opacity: 0.95;
    }

    100% {
        transform: scale(2.8);
        opacity: 0;
    }
}

.marker-pulse {
    animation: markerPulseAnimation 2s infinite cubic-bezier(0.16, 1, 0.3, 1);
    transform-origin: center center;
}

.marker-core {
    transition: r var(--transition-fast), stroke-width var(--transition-fast);
}

/* --- Grouped Linear Timeline Styles --- */
.linear-timeline {
    position: relative;
    padding: 0.5rem 0 0.5rem 2.5rem;
    margin-left: 1rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.timeline-item {
    position: relative;
    display: flex;
    flex-direction: column;
    min-height: 50px;
}

.timeline-connector {
    position: absolute;
    left: -2.05rem;
    /* center on the 10px offset marker */
    top: 20px;
    bottom: -1.75rem;
    /* link down to the next node */
    width: 2px;
    background-color: var(--border-color);
    z-index: 1;
}

.timeline-item.completed .timeline-connector {
    background-color: var(--primary);
}

.timeline-marker {
    position: absolute;
    left: -2.35rem;
    /* aligns perfectly to center of connector */
    top: 4px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background-color: var(--bg-card);
    border: 2px solid var(--border-color);
    z-index: 2;
    transition: all var(--transition-fast);
}

/* Completed Milestones (Past) */
.timeline-item.completed .timeline-marker {
    border-color: var(--primary);
    background-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

/* Today Moment (Present) */
.timeline-item.today .timeline-marker {
    left: -2.55rem;
    top: 0px;
    width: 18px;
    height: 18px;
    border-color: var(--warning);
    background-color: var(--warning);
    box-shadow: 0 0 0 5px rgba(245, 158, 11, 0.25);
    animation: markerPulseAnimation 2s infinite cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 3;
}

.timeline-item.today .timeline-marker::after {
    content: '';
    position: absolute;
    left: 4px;
    top: 4px;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: #ffffff;
}

/* Future Milestones (Pending) */
.timeline-item.future .timeline-marker {
    border-color: var(--text-muted);
    background-color: var(--bg-sidebar);
}

.timeline-item:last-child .timeline-connector {
    display: none;
}

.timeline-info {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    padding-bottom: 0.25rem;
}

.timeline-date-label {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.timeline-date-label svg,
.timeline-date-label i {
    width: 13px;
    height: 13px;
}

.timeline-item.completed .timeline-date-label {
    color: var(--primary);
}

.timeline-item.today .timeline-date-label {
    color: var(--warning);
    font-weight: 800;
}

.timeline-title-label {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.timeline-desc-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    line-height: 1.4;
}

/* Extra badge for current active selection */
.badge-timeline-current {
    font-size: 0.65rem;
    background-color: rgba(59, 130, 246, 0.1);
    color: var(--primary);
    border: 1px solid rgba(59, 130, 246, 0.2);
    padding: 0.1rem 0.4rem;
    border-radius: 30px;
    font-weight: 600;
}

#leaflet-map {
    width: 100%;
    height: 100%;
    background-color: var(--bg-sidebar);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

/* Créditos del mapa contraíbles tras un botón "i" (CatlecMapGL.addCollapsibleAttribution).
   El recorte anima su max-width entre el ancho medido del texto (--catlec-attr-w) y 0. */
.maplibregl-map .maplibregl-ctrl.catlec-attribution {
    display: flex;
    align-items: center;
    margin: 0 8px 8px 0;
    padding: 2px;
    background: var(--bg-card-hover);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
    border-radius: 999px;
    box-shadow: var(--shadow-main);
    color: var(--text-secondary);
    font-size: 0.68rem;
    line-height: 1.3;
}

.catlec-attribution-clip {
    max-width: var(--catlec-attr-w, 480px);
    overflow: hidden;
    transition: max-width 0.35s ease;
}

.catlec-attribution.collapsed .catlec-attribution-clip {
    max-width: 0;
    transition-duration: 0.3s;
}

.catlec-attribution-text {
    display: block;
    padding: 0 4px 0 8px;
    white-space: nowrap;
    opacity: 1;
    transition: opacity 0.2s ease 0.12s;
}

.catlec-attribution.collapsed .catlec-attribution-text {
    opacity: 0;
    transition-delay: 0s;
}

/* Enlaces de créditos: sin subrayado, subrayado al pasar el mouse */
.maplibregl-map .catlec-attribution a {
    color: var(--primary);
    text-decoration: none;
}

.maplibregl-map .catlec-attribution a:hover,
.maplibregl-map .catlec-attribution a:focus {
    text-decoration: underline;
}

.catlec-attribution-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    transition: background-color var(--transition-fast), color var(--transition-fast);
}

.catlec-attribution-toggle svg {
    width: 14px;
    height: 14px;
}

.catlec-attribution-toggle:hover,
.catlec-attribution:not(.collapsed) .catlec-attribution-toggle {
    color: var(--primary);
}

.catlec-attribution-toggle:hover {
    background: rgba(37, 99, 235, 0.08);
}

.catlec-attribution-toggle:focus-visible {
    outline: 2px solid var(--border-color-focus);
    outline-offset: 1px;
}

/* ─── Mapas MapLibre GL (CatlecMapGL, static/js/common/map-gl.js) ─────────── */
.maplibregl-map {
    background: var(--bg-sidebar);
    font-family: var(--font-sans);
}

/* Los íconos HTML (z-index hasta 10000) quedan contenidos en el lienzo y nunca
   tapan la leyenda, el zoom ni los créditos */
.maplibregl-canvas-container {
    isolation: isolate;
}

/* Control de zoom con el mismo aspecto que tenía el de Leaflet */
.maplibregl-ctrl-group {
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-main) !important;
}

.maplibregl-ctrl-group button + button {
    border-top: 1px solid var(--border-color);
}

/* Tooltip flotante del mapa: CatlecMapGL lo posiciona; el aspecto lo da
   .catlec-map-tooltip (u otra clase de tooltip del módulo) */
.catlec-gl-tooltip {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 11000;
    display: none;
}

/* Ícono de proyecto como marcador HTML de MapLibre (EFE y Metro: 26 px) */
.catlec-gl-marker {
    width: 26px;
    height: 26px;
}

/* Centroid marker styling for small polygons and project icons */
.polygon-centroid-marker {
    background: transparent !important;
    border: none !important;
}

.centroid-marker-pulse {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #ffffff;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.35);
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}

.centroid-marker-pulse:hover {
    transform: scale(1.25);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.5);
    z-index: 1000 !important;
}

.centroid-marker-pulse.active-selected {
    transform: scale(1.35);
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.4), 0 8px 20px rgba(0, 0, 0, 0.5);
}

.centroid-marker-pulse svg {
    display: block;
    pointer-events: none;
}

/* ─── Estados de ícono y clusters desplegables (EFE, Metro y MOP) ─────────── */
/* Los íconos a menos de ~80 m se agrupan: el badge cuenta los proyectos; al
   desplegarse cada ícono se separa (.deployed) y el punto de origen dibuja sus
   patas en un SVG en píxeles (CatlecMapGL.createClusterOrigin), así que no
   dependen del zoom. El color de hover/selección del ícono es de cada módulo. */
.marker-cluster-badge {
    position: absolute;
    top: -6px;
    right: -6px;
    background-color: #ef4444;
    color: #ffffff;
    font-size: 0.65rem;
    font-weight: 800;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1.5px solid #ffffff;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.4);
    pointer-events: none;
    z-index: 10;
    transition: opacity 0.25s ease, transform 0.25s ease;
}
.centroid-marker-pulse.deployed .marker-cluster-badge,
.centroid-marker-pulse.active-selected .marker-cluster-badge {
    opacity: 0 !important;
    transform: scale(0.5) !important;
    pointer-events: none;
}
.cluster-origin-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: #059669;
    border: 1.5px solid #ffffff;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
    cursor: pointer;
    transition: transform 0.25s ease, background-color 0.25s ease;
}
.cluster-origin-dot:hover {
    transform: scale(1.4);
    background-color: #047857;
}
.centroid-marker-pulse.is-hovered {
    transform: scale(1.25);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.5);
    z-index: 1000 !important;
}
.centroid-marker-pulse.dimmed {
    opacity: 0.48 !important;
}
.centroid-marker-pulse.deployed {
    opacity: 1.0 !important;
    z-index: 9000 !important;
}
.catlec-gl-cluster-origin {
    position: relative;
    width: 8px;
    height: 8px;
}

.catlec-gl-cluster-origin svg {
    position: absolute;
    left: 4px;
    top: 4px;
    overflow: visible;
    pointer-events: none;
}

.catlec-gl-cluster-origin .cluster-origin-dot {
    position: relative;
}

/* Cluster Marker for Multiple Concessions sharing location (Spiderfy) */
.cluster-marker-pulse {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);
    border: 2.5px solid #ffffff;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.3), 0 6px 16px rgba(0, 0, 0, 0.4);
    cursor: pointer;
    color: #ffffff;
    font-weight: 700;
    font-size: 0.82rem;
    font-family: var(--font-heading);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    animation: clusterGlowPulse 2.5s infinite ease-in-out;
}

.cluster-marker-pulse:hover {
    transform: scale(1.2);
    box-shadow: 0 0 0 6px rgba(139, 92, 246, 0.4), 0 8px 20px rgba(0, 0, 0, 0.5);
}

.cluster-marker-pulse.is-expanded {
    background: linear-gradient(135deg, #ef4444 0%, #f59e0b 100%);
    box-shadow: 0 0 0 5px rgba(239, 68, 68, 0.4), 0 6px 16px rgba(0, 0, 0, 0.4);
}

@keyframes clusterGlowPulse {

    0%,
    100% {
        box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.3), 0 6px 16px rgba(0, 0, 0, 0.4);
    }

    50% {
        box-shadow: 0 0 0 6px rgba(139, 92, 246, 0.5), 0 8px 22px rgba(0, 0, 0, 0.5);
    }
}

/* Spiderfy Connector Lines */
.spider-leg-line {
    stroke-dasharray: 4, 4;
    animation: spiderLegDash 20s linear infinite;
}

@keyframes spiderLegDash {
    to {
        stroke-dashoffset: -100;
    }
}

/* Concession & CATLEC Tooltip Styling */
.catlec-map-tooltip {
    background: #1e293b !important;
    border: 1px solid rgba(59, 130, 246, 0.3) !important;
    color: #ffffff !important;
    font-family: var(--font-sans, system-ui, -apple-system, sans-serif) !important;
    font-size: 0.72rem !important;
    line-height: 1.35 !important;
    border-radius: 6px !important;
    padding: 0.35rem 0.6rem !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15) !important;
    pointer-events: none !important;
    width: max-content !important;
    min-width: 120px !important;
    max-width: 260px !important;
    white-space: normal !important;
    overflow-wrap: break-word !important;
}

.catlec-map-tooltip br {
    display: none !important;
}

.catlec-map-tooltip strong {
    display: block !important;
    white-space: normal !important;
    overflow-wrap: break-word !important;
    font-size: 0.76rem !important;
    line-height: 1.25 !important;
    margin: 0 0 2px 0 !important;
}

.catlec-map-tooltip span {
    display: block !important;
    white-space: normal !important;
    overflow-wrap: break-word !important;
    line-height: 1.25 !important;
    margin: 0 !important;
}

/* =============================================================
   TIMELINE PANEL — Full-width Gantt chart view
   ============================================================= */

.timeline-full-panel {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-main);
    overflow: hidden;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

/* Timeline Header */
.timeline-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0.85rem;
    border-bottom: 1px solid var(--border-color);
    background-color: rgba(255, 255, 255, 0.6);
    flex-shrink: 0;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.timeline-header-left {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.timeline-header-right {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    flex-wrap: wrap;
}

.timeline-back-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-family: var(--font-sans);
    font-size: 0.75rem;
    font-weight: 500;
    padding: 0.3rem 0.65rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    color: var(--text-primary);
    cursor: pointer;
    transition: all var(--transition-fast);
    box-shadow: var(--shadow-main);
}

.timeline-back-btn:hover {
    background-color: var(--primary);
    border-color: var(--primary);
    color: #ffffff;
}

.timeline-back-btn:hover svg,
.timeline-back-btn:hover i {
    color: #ffffff !important;
}

.timeline-header-divider {
    width: 1px;
    height: 14px;
    background-color: var(--border-color);
    border-radius: 1px;
}

.timeline-header-title {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
    letter-spacing: -0.01em;
}

.timeline-count-badge {
    background: rgba(37, 99, 235, 0.10);
    color: var(--primary);
    border: 1px solid rgba(37, 99, 235, 0.20);
    border-radius: 20px;
    padding: 0.1rem 0.5rem;
    font-size: 0.65rem;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.timeline-legend-item {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.68rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.tl-legend-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 2px;
    flex-shrink: 0;
}

/* Axis sticky row */
.timeline-axis-wrapper {
    display: flex;
    flex-shrink: 0;
    border-bottom: 1px solid var(--border-color);
    background-color: rgba(248, 250, 252, 0.95);
    overflow: hidden;
}

.timeline-label-col {
    width: 210px;
    min-width: 210px;
    flex-shrink: 0;
    border-right: 1px solid var(--border-color);
    background-color: rgba(248, 250, 252, 0.95);
}

.timeline-axis-scroll {
    flex: 1;
    overflow: hidden;
}

/* Scrollable body */
.timeline-body {
    flex: 1;
    min-height: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.timeline-rows-wrapper {
    display: flex;
    height: 100%;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
}

.timeline-bars-scroll {
    flex: 1;
    position: relative;
}

.timeline-axis-scroll {
    overflow: hidden;
}

#timeline-label-col {
    width: 210px;
    flex-shrink: 0;
}

/* Tooltip */
.timeline-tooltip {
    position: fixed;
    z-index: 9999;
    background: #ffffff;
    border: 1px solid rgba(37, 99, 235, 0.18);
    border-radius: 8px;
    padding: 0.5rem 0.75rem;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.14);
    font-family: var(--font-sans);
    font-size: 0.72rem;
    color: var(--text-primary);
    pointer-events: none;
    max-width: 260px;
    line-height: 1.45;
}

.timeline-tooltip-name {
    font-weight: 700;
    font-size: 0.75rem;
    color: var(--primary);
    margin-bottom: 0.2rem;
    display: block;
}

.timeline-tooltip-row {
    display: flex;
    justify-content: space-between;
    gap: 0.75rem;
}

.timeline-tooltip-label {
    color: var(--text-secondary);
}

.timeline-tooltip-val {
    font-weight: 600;
    color: var(--text-primary);
}

/* ─── App Footer ─────────────────────────────────────────────────────────── */
.app-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.25rem;
    height: 32px;
    min-height: 32px;
    background: linear-gradient(90deg, #1e3a6e 0%, #1a3460 60%, #1b3055 100%);
    border-top: 1px solid rgba(59, 130, 246, 0.22);
    flex-shrink: 0;
    position: relative;
    z-index: 100;
}

.app-footer-left {
    display: flex;
    align-items: center;
    gap: 0.65rem;
}

.app-footer-right {
    display: flex;
    align-items: center;
}

.app-footer-brand {
    font-family: var(--font-heading);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    background: linear-gradient(135deg, #60a5fa, #a78bfa);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.app-footer-divider {
    width: 1px;
    height: 12px;
    background-color: rgba(255, 255, 255, 0.18);
    border-radius: 1px;
}

.app-footer-text {
    font-family: var(--font-sans);
    font-size: 0.68rem;
    font-weight: 400;
    color: rgba(255, 255, 255, 0.42);
    letter-spacing: 0.01em;
}

/* Interregional Project Region Pills */
.region-pills-wrap {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    align-items: center;
}

.region-pill {
    background: rgba(0, 0, 0, 0.04);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    font-size: 0.62rem;
    font-weight: 500;
    padding: 0.12rem 0.4rem;
    border-radius: 4px;
    display: inline-block;
    line-height: 1.25;
    white-space: normal;
    word-break: break-word;
}

/* Nota: .company-* (modal de Participaciones de la Empresa, vista Oferentes de
   DGC) vive en static/css/dgc_addons.css. Los @keyframes modalFadeIn/modalSlideUp
   se mantienen aquí porque también los usa el modal "Acerca de" (compartido). */
@keyframes modalFadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes modalSlideUp {
    from {
        transform: translateY(16px);
        opacity: 0;
    }

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

/* ─── Top Navbar Button (Acerca de) ─────────────────────────────────────────── */
.top-navbar-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    background: rgba(59, 130, 246, 0.12);
    border: 1px solid rgba(59, 130, 246, 0.28);
    border-radius: 8px;
    color: #93c5fd;
    font-family: var(--font-heading, 'Plus Jakarta Sans', sans-serif);
    font-size: 0.72rem;
    font-weight: 600;
    padding: 0.22rem 0.65rem;
    cursor: pointer;
    transition: all 0.18s ease;
    white-space: nowrap;
    text-decoration: none;
    line-height: 1.2;
}

.top-navbar-btn:hover {
    background: rgba(59, 130, 246, 0.25);
    border-color: rgba(59, 130, 246, 0.5);
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.25);
}

/* ─── About Modal (Fuentes & Metodología) ─────────────────────────────────────── */
.about-modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 23, 42, 0.75);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    animation: modalFadeIn 0.2s ease-out;
}

.about-modal-container {
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.12);
    border-radius: 14px;
    box-shadow: 0 25px 65px rgba(0, 0, 0, 0.35);
    width: 100%;
    max-width: 880px;
    max-height: 88vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: modalSlideUp 0.22s ease-out;
}

.about-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.4rem;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    flex-shrink: 0;
}

.about-modal-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: rgba(37, 99, 235, 0.1);
    border: 1px solid rgba(37, 99, 235, 0.22);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: #2563eb;
}

.about-modal-title {
    font-size: 0.96rem;
    font-weight: 700;
    color: #0f172a;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.about-modal-subtitle {
    font-size: 0.74rem;
    color: #64748b;
    margin: 0.15rem 0 0 0;
}

.about-modal-close-btn {
    background: transparent;
    border: none;
    color: #64748b;
    cursor: pointer;
    padding: 0.45rem;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
}

.about-modal-close-btn:hover {
    background: #e2e8f0;
    color: #0f172a;
}

.about-modal-body {
    flex: 1;
    min-height: 200px;
    overflow-y: auto;
    padding: 1.25rem 1.4rem;
    display: flex;
    flex-direction: column;
    gap: 1.4rem;
    color: #334155;
    font-size: 0.8rem;
    line-height: 1.5;
}

/* ─── About Modal: Contacto de Autores ─────────────────────────────────────── */
.about-authors-card {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 0.85rem 1.1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.02);
}

.about-authors-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.4rem;
    border-bottom: 1px dashed #cbd5e1;
    padding-bottom: 0.45rem;
}

.about-authors-title {
    font-size: 0.82rem;
    font-weight: 700;
    color: #0f172a;
    display: flex;
    align-items: center;
    gap: 0.45rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.about-authors-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 0.75rem;
}

.about-author-box {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 9px;
    padding: 0.75rem 0.9rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.about-author-box:hover {
    border-color: #93c5fd;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.08);
    transform: translateY(-1px);
}

.about-author-info {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    min-width: 0;
}

.about-author-name {
    font-size: 0.82rem;
    font-weight: 700;
    color: #1e293b;
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.about-author-role {
    font-size: 0.7rem;
    color: #64748b;
    line-height: 1.25;
}

.about-author-contacts {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    margin-top: 0.25rem;
    font-size: 0.72rem;
    color: #475569;
}

.about-author-contact-item {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    text-decoration: none;
    color: #2563eb;
    font-weight: 500;
    transition: color 0.15s ease;
}

.about-author-contact-item:hover {
    color: #1d4ed8;
    text-decoration: underline;
}

.about-author-actions {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.about-btn-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    padding: 0.4rem 0.75rem;
    border-radius: 6px;
    font-size: 0.72rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.15s ease;
    border: 1px solid transparent;
    white-space: nowrap;
}

.about-btn-email {
    background: #eff6ff;
    color: #1d4ed8;
    border-color: #bfdbfe;
}

.about-btn-email:hover {
    background: #2563eb;
    color: #ffffff;
    border-color: #2563eb;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.25);
}

/* Modal Sections */
.about-section {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.about-section-header {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    border-bottom: 1.5px solid #e2e8f0;
    padding-bottom: 0.35rem;
}

.about-section-title {
    font-size: 0.84rem;
    font-weight: 700;
    color: #0f172a;
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

/* Sources Grid */
.about-sources-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(380px, 1fr));
    gap: 0.65rem;
}

.about-source-card {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 0.75rem 0.9rem;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.about-source-card:hover {
    border-color: #93c5fd;
    box-shadow: 0 3px 12px rgba(37, 99, 235, 0.08);
}

.about-source-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.about-source-name {
    font-size: 0.8rem;
    font-weight: 700;
    color: #1e293b;
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.about-source-link {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.68rem;
    font-weight: 600;
    color: #2563eb;
    text-decoration: none;
    padding: 0.18rem 0.45rem;
    border-radius: 6px;
    background: rgba(37, 99, 235, 0.08);
    transition: background 0.15s, color 0.15s;
}

.about-source-link:hover {
    background: #2563eb;
    color: #ffffff;
}

.about-source-desc {
    font-size: 0.72rem;
    color: #64748b;
    margin: 0;
    line-height: 1.4;
}

/* Formulas Grid */
.about-formulas-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(380px, 1fr));
    gap: 0.75rem;
}

.formula-card {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 0.8rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.formula-card-title {
    font-size: 0.79rem;
    font-weight: 700;
    color: #0f172a;
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.formula-subtitle {
    font-size: 0.73rem;
    font-weight: 700;
    color: #1e293b;
    margin-top: 0.45rem;
    margin-bottom: 0.15rem;
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.formula-box {
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    padding: 0.45rem 0.75rem;
    font-family: 'JetBrains Mono', 'Fira Code', Consolas, monospace;
    font-size: 0.74rem;
    font-weight: 600;
    color: #1e3a8a;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.formula-explanation {
    font-size: 0.71rem;
    color: #475569;
    margin: 0;
    line-height: 1.4;
}

/* Glossary Grid */
.glossary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 0.65rem;
}

.glossary-card {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 0.65rem 0.8rem;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.glossary-term {
    font-size: 0.75rem;
    font-weight: 700;
    color: #1e3a8a;
}

.glossary-def {
    font-size: 0.7rem;
    color: #475569;
    margin: 0;
    line-height: 1.35;
}

/* Disclaimer Card */
.about-disclaimer-card {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: 10px;
    padding: 0.85rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.about-disclaimer-header {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.75rem;
    font-weight: 700;
    color: #1e40af;
}

.about-disclaimer-text {
    font-size: 0.71rem;
    color: #1e3a8a;
    margin: 0;
    line-height: 1.45;
}

/* ── Barra de métrica y mini-KPIs de mapas coropléticos (SNI y MOP) ──────────
   Replica el layout y diseño de .efe-table-mode-switch (EFE.html). */
.map-metric-toolbar {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.4rem 0.5rem;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-card);
    flex-shrink: 0;
    width: 100%;
    box-sizing: border-box;
}

.map-metric-btn {
    flex: 1;
    justify-content: center;
    font-size: 0.7rem;
    padding: 0.26rem 0.35rem;
    border-radius: 4px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.25rem;
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    transition: all 0.15s ease;
    white-space: nowrap;
}

.map-metric-btn:hover {
    color: var(--text-primary);
    border-color: var(--text-muted);
}

.map-metric-btn.active {
    background: var(--primary);
    color: #ffffff;
    border: 1px solid var(--primary);
}

.map-metric-mini-kpis {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.35rem;
    padding-top: 0.35rem;
    border-top: 1px solid var(--border-color);
    flex-shrink: 0;
}

.map-metric-mini-kpi {
    background: var(--bg-sidebar);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 4px 6px;
    text-align: center;
}

.map-metric-mini-kpi-label {
    font-size: 0.58rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.map-metric-mini-kpi-val {
    font-size: 0.76rem;
    font-weight: 700;
    color: var(--primary);
    margin-top: 1px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ── Mapa coroplético D3 de regiones (SNI, MOP; static/js/common/choropleth.js) ── */
.catlec-choropleth-svg {
    cursor: default;
    user-select: none;
}

/* Región: recoloreo instantáneo; el borde y la opacidad de hover los pone el JS */
.catlec-region-path {
    cursor: pointer;
    stroke: #ffffff;
    stroke-width: 1.5px;
    transition: none;
}

/* Tooltip de mapas coropléticos SVG (SNI, MOP): va directo en <body> para que
   el overflow:hidden de las tarjetas no lo recorte; se posiciona por JS
   (position:fixed) y reutiliza .catlec-map-tooltip para tipografía y colores. */
.catlec-map-tooltip--fixed {
    position: fixed;
    z-index: 2000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.1s ease;
}

.catlec-map-tooltip--fixed.visible {
    opacity: 1;
}
