/* ==========================================================================
   ESTILOS COMMAND CENTER 3D — GEO-EPIDEMIA COLOMBIA (EDICIÓN SUSTENTACIÓN PRO)
   Tema: Cyber-Analytics Dark Glassmorphism · 100% Responsivo (Proyector → Móvil)
   ========================================================================== */

:root {
    --bg-dark: #060a13;
    --panel-bg: rgba(11, 18, 34, 0.84);
    --panel-bg-strong: rgba(9, 15, 29, 0.94);
    --panel-border: rgba(56, 189, 248, 0.24);
    --panel-border-glow: rgba(56, 189, 248, 0.5);

    --text-primary: #f8fafc;
    --text-secondary: #cbd5e1;
    --text-muted: #7e8fa6;

    --color-cyan: #38bdf8;
    --color-blue: #3b82f6;
    --color-red: #ef4444;
    --color-amber: #f59e0b;
    --color-green: #10b981;
    --color-purple: #a855f7;
    --color-gold: #f2a900;

    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;

    --radius-lg: 14px;
    --radius-md: 10px;
    --radius-sm: 6px;
    --blur-glass: blur(16px);
}

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

body,
html {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: var(--bg-dark);
    font-family: var(--font-sans);
    color: var(--text-primary);
    user-select: none;
    -webkit-font-smoothing: antialiased;
}

#app-container {
    position: relative;
    width: 100vw;
    height: 100dvh;
    overflow: hidden;
}

#map-container {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

/* --------------------------------------------------------------------------
   PANTALLA DE CARGA CINEMATOGRÁFICA
   -------------------------------------------------------------------------- */
.loading-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: radial-gradient(circle at 50% 45%, #0d1a33 0%, #050811 75%);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

.loading-overlay.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.loading-card {
    text-align: center;
    padding: 32px 40px;
    border-radius: 18px;
    background: rgba(13, 21, 38, 0.78);
    border: 1px solid rgba(56, 189, 248, 0.3);
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.65);
    max-width: 90vw;
}

.loading-radar {
    position: relative;
    width: 68px;
    height: 68px;
    margin: 0 auto 18px;
    border-radius: 50%;
    background: rgba(56, 189, 248, 0.14);
    border: 1.5px solid var(--color-cyan);
    display: flex;
    align-items: center;
    justify-content: center;
}

.loading-icon {
    width: 32px;
    height: 32px;
    color: var(--color-cyan);
    animation: spin-slow 8s linear infinite;
}

@keyframes spin-slow {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

.loading-card h2 {
    font-size: 1.2rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    margin-bottom: 6px;
}

.loading-card p {
    font-size: 0.82rem;
    color: var(--text-secondary);
}

/* Atribución discreta */
.maplibregl-ctrl-bottom-right {
    bottom: 2px !important;
    right: 8px !important;
    z-index: 5 !important;
}

.maplibregl-ctrl-attrib {
    background: rgba(7, 11, 20, 0.7) !important;
    color: var(--text-muted) !important;
    font-size: 10px !important;
    border-radius: 4px !important;
}

.maplibregl-ctrl-attrib a {
    color: var(--text-secondary) !important;
}

/* --------------------------------------------------------------------------
   MODO CINE / ZEN & BANNER NARRATIVO DEL TOUR
   -------------------------------------------------------------------------- */
body.zen-mode .hud-overlay {
    opacity: 0;
    pointer-events: none;
    transform: scale(0.985);
}

.btn-exit-zen {
    position: fixed;
    top: 14px;
    right: 18px;
    z-index: 60;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border-radius: 999px;
    background: rgba(11, 18, 34, 0.88);
    backdrop-filter: blur(12px);
    border: 1px solid var(--color-cyan);
    color: #ffffff;
    font-family: var(--font-sans);
    font-size: 0.78rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 8px 28px rgba(56, 189, 248, 0.35);
    transition: all 0.25s ease;
}

.btn-exit-zen:hover {
    background: rgba(56, 189, 248, 0.25);
    transform: translateY(-1px);
}

.btn-exit-zen svg {
    width: 15px;
    height: 15px;
    color: var(--color-cyan);
}

.btn-exit-zen.hidden {
    opacity: 0;
    pointer-events: none;
    transform: translateY(-12px);
}

.story-banner {
    position: fixed;
    top: 82px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 30;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    max-width: min(560px, calc(100vw - 32px));
    border-color: rgba(168, 85, 247, 0.55);
    box-shadow: 0 14px 40px rgba(0, 0, 0, 0.65), 0 0 24px rgba(168, 85, 247, 0.2);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.story-banner.hidden {
    opacity: 0;
    pointer-events: none;
    transform: translate(-50%, -14px);
}

.story-step-tag {
    display: inline-block;
    padding: 4px 9px;
    border-radius: 6px;
    background: linear-gradient(135deg, #6366f1, #a855f7);
    color: #ffffff;
    font-family: var(--font-mono);
    font-size: 0.66rem;
    font-weight: 800;
    letter-spacing: 0.05em;
    white-space: nowrap;
}

.story-text-col {
    flex: 1;
    min-width: 0;
}

.story-text-col h3 {
    font-size: 0.85rem;
    font-weight: 800;
    color: #ffffff;
    margin-bottom: 2px;
}

.story-text-col p {
    font-size: 0.73rem;
    color: var(--text-secondary);
    line-height: 1.35;
}

.btn-story-close {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.3rem;
    line-height: 1;
    cursor: pointer;
    padding: 2px 4px;
}

.btn-story-close:hover {
    color: #ffffff;
}

/* --------------------------------------------------------------------------
   CONTENEDOR PRINCIPAL HUD (Flexbox por zonas: cero superposiciones)
   -------------------------------------------------------------------------- */
.hud-overlay {
    position: absolute;
    inset: 0;
    padding: 12px 16px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 10px;
    pointer-events: none;
    z-index: 10;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.glass-panel {
    pointer-events: auto;
    background: var(--panel-bg);
    backdrop-filter: var(--blur-glass);
    -webkit-backdrop-filter: var(--blur-glass);
    border: 1px solid var(--panel-border);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-lg);
}

/* Scrollbars sutiles */
.hud-left::-webkit-scrollbar,
.hud-right::-webkit-scrollbar,
.inspector-panel::-webkit-scrollbar {
    width: 4px;
}

.hud-left::-webkit-scrollbar-track,
.hud-right::-webkit-scrollbar-track,
.inspector-panel::-webkit-scrollbar-track {
    background: transparent;
}

.hud-left::-webkit-scrollbar-thumb,
.hud-right::-webkit-scrollbar-thumb,
.inspector-panel::-webkit-scrollbar-thumb {
    background: rgba(56, 189, 248, 0.32);
    border-radius: 999px;
}

/* --------------------------------------------------------------------------
   ZONA SUPERIOR: HUD HEADER
   -------------------------------------------------------------------------- */
.hud-header {
    flex-shrink: 0;
    padding: 8px 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: nowrap;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.logo-radar {
    position: relative;
    width: 36px;
    height: 36px;
    flex-shrink: 0;
    border-radius: 50%;
    background: rgba(56, 189, 248, 0.15);
    border: 1px solid var(--color-cyan);
    display: flex;
    align-items: center;
    justify-content: center;
}

.icon-brand {
    color: var(--color-cyan);
    width: 19px;
    height: 19px;
}

.radar-ping {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 2px solid var(--color-cyan);
    animation: radar-pulse 2.1s infinite ease-out;
}

.radar-ping.delay {
    animation-delay: 1.05s;
}

@keyframes radar-pulse {
    0% {
        transform: scale(0.9);
        opacity: 0.9;
    }

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

.brand-text {
    min-width: 0;
}

.brand-title {
    font-size: 1rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: #ffffff;
    display: flex;
    align-items: center;
    gap: 7px;
    white-space: nowrap;
}

.badge-ai {
    font-size: 0.58rem;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 10px;
    background: linear-gradient(135deg, #6366f1, #a855f7);
    color: white;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.brand-sub {
    font-size: 0.69rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 300px;
}

.header-filters {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.selector-container {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.78rem;
    color: var(--text-secondary);
    flex-shrink: 0;
}

.selector-container label {
    display: flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}

.selector-container label svg {
    width: 14px;
    height: 14px;
    color: var(--color-cyan);
}

.glass-input {
    background: rgba(7, 11, 20, 0.88);
    border: 1px solid var(--panel-border);
    color: #ffffff;
    padding: 6px 10px;
    border-radius: var(--radius-md);
    font-size: 0.78rem;
    font-family: var(--font-sans);
    outline: none;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 600;
    max-width: 175px;
}

.glass-input-jump {
    max-width: 155px;
    color: #cbd5e1;
}

.glass-input:hover,
.glass-input:focus {
    border-color: var(--color-cyan);
    box-shadow: 0 0 12px rgba(56, 189, 248, 0.28);
}

.glass-input option {
    background: #0f172a;
    color: white;
}

.kpi-group {
    display: flex;
    align-items: center;
    gap: 7px;
    flex-shrink: 0;
}

.kpi-card {
    background: rgba(15, 23, 42, 0.78);
    border: 1px solid rgba(255, 255, 255, 0.07);
    padding: 4px 10px;
    border-radius: var(--radius-md);
    display: flex;
    flex-direction: column;
    min-width: 74px;
}

.kpi-label {
    font-size: 0.57rem;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 0.04em;
    font-weight: 700;
    white-space: nowrap;
}

.kpi-val-row {
    display: flex;
    align-items: baseline;
    gap: 5px;
}

.kpi-val {
    font-family: var(--font-mono);
    font-size: 0.96rem;
    font-weight: 700;
    line-height: 1.25;
}

.kpi-delta {
    font-family: var(--font-mono);
    font-size: 0.67rem;
    font-weight: 700;
    padding: 1px 5px;
    border-radius: 4px;
}

.kpi-delta.up {
    background: rgba(239, 68, 68, 0.22);
    color: #fca5a5;
}

.kpi-delta.down {
    background: rgba(16, 185, 129, 0.22);
    color: #6ee7b7;
}

.kpi-delta.hidden {
    display: none;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.btn-icon-hdr {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: rgba(15, 23, 42, 0.78);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-icon-hdr svg {
    width: 15px;
    height: 15px;
}

.btn-icon-hdr:hover {
    color: #ffffff;
    border-color: var(--color-cyan);
    background: rgba(56, 189, 248, 0.2);
}

.uni-badge {
    background: rgba(255, 255, 255, 0.94);
    padding: 4px 8px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    border: 1px solid rgba(242, 169, 0, 0.55);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
}

.uni-badge img {
    height: 22px;
    width: auto;
    display: block;
}

/* Colores de acento */
.text-cyan {
    color: var(--color-cyan);
}

.text-blue {
    color: var(--color-blue);
}

.text-red {
    color: var(--color-red);
}

.text-amber {
    color: var(--color-amber);
}

.text-green {
    color: var(--color-green);
}

/* --------------------------------------------------------------------------
   ZONA CENTRAL: HUD MIDDLE
   -------------------------------------------------------------------------- */
.hud-middle {
    flex: 1;
    min-height: 0;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 14px;
    pointer-events: none;
}

.hud-left {
    width: 304px;
    max-height: 100%;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 9px;
    overflow-y: auto;
    pointer-events: none;
    padding-right: 2px;
}

.hud-right {
    width: 230px;
    max-height: 100%;
    min-height: 0;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 9px;
    overflow-y: auto;
    pointer-events: none;
    padding-left: 2px;
}

.mobile-drawer-bar,
.mobile-drawer-head {
    display: none;
}

/* --------------------------------------------------------------------------
   WIDGETS LATERALES COLAPSABLES (Tour del Jurado + Top 5 Ranking)
   -------------------------------------------------------------------------- */
.side-widget {
    flex-shrink: 0;
    padding: 9px 12px;
}

.widget-header {
    width: 100%;
    background: transparent;
    border: none;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    padding: 0;
}

.widget-title {
    font-size: 0.74rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 6px;
    color: #ffffff;
}

.widget-title svg {
    width: 14px;
    height: 14px;
    color: var(--color-cyan);
}

.widget-chevron {
    width: 14px;
    height: 14px;
    color: var(--text-muted);
    transition: transform 0.2s ease;
}

.side-widget.collapsed .widget-chevron {
    transform: rotate(-90deg);
}

.widget-body {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.side-widget.collapsed .widget-body {
    display: none;
}

/* Botones del Tour Guiado */
.tour-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
}

.btn-tour {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 6px 8px;
    border-radius: var(--radius-sm);
    background: rgba(15, 23, 42, 0.78);
    border: 1px solid rgba(168, 85, 247, 0.25);
    color: var(--text-secondary);
    font-family: var(--font-sans);
    font-size: 0.71rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
}

.btn-tour:hover,
.btn-tour.active {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.28), rgba(168, 85, 247, 0.28));
    border-color: #c084fc;
    color: #ffffff;
    box-shadow: 0 0 12px rgba(168, 85, 247, 0.3);
}

.tour-num {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    border-radius: 5px;
    background: rgba(168, 85, 247, 0.25);
    color: #e9d5ff;
    font-family: var(--font-mono);
    font-size: 0.66rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-tour.active .tour-num {
    background: #a855f7;
    color: #ffffff;
}

/* Top 5 Ranking */
.ranking-list {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.rank-row {
    width: 100%;
    background: rgba(15, 23, 42, 0.65);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 7px;
    padding: 6px 8px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 4px;
    transition: all 0.18s ease;
    text-align: left;
    color: var(--text-primary);
}

.rank-row:hover {
    border-color: var(--color-cyan);
    background: rgba(56, 189, 248, 0.12);
    transform: translateX(2px);
}

.rank-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    font-size: 0.72rem;
}

.rank-name {
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.rank-meta {
    font-family: var(--font-mono);
    font-size: 0.68rem;
    font-weight: 700;
    white-space: nowrap;
}

.rank-bar-bg {
    width: 100%;
    height: 4px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    overflow: hidden;
}

.rank-bar-fill {
    height: 100%;
    border-radius: 999px;
    transition: width 0.35s ease;
}

/* --------------------------------------------------------------------------
   INSPECTOR DEPARTAMENTAL (Columna Izquierda)
   -------------------------------------------------------------------------- */
.inspector-panel {
    flex-shrink: 0;
    padding: 13px 14px;
    position: relative;
    transition: opacity 0.25s ease, transform 0.25s ease;
}

.inspector-panel.hidden {
    display: none;
}

.btn-close {
    position: absolute;
    top: 9px;
    right: 11px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.35rem;
    line-height: 1;
    cursor: pointer;
}

.btn-close:hover {
    color: white;
}

.inspector-badges-row {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 4px;
}

.badge-status {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.64rem;
    font-weight: 800;
    letter-spacing: 0.04em;
}

.status-critico {
    background: rgba(239, 68, 68, 0.22);
    color: var(--color-red);
    border: 1px solid var(--color-red);
}

.status-alerta {
    background: rgba(245, 158, 11, 0.22);
    color: var(--color-amber);
    border: 1px solid var(--color-amber);
}

.status-estable {
    background: rgba(16, 185, 129, 0.22);
    color: var(--color-green);
    border: 1px solid var(--color-green);
}

.badge-sim-delta {
    display: inline-block;
    padding: 2px 7px;
    border-radius: 4px;
    font-family: var(--font-mono);
    font-size: 0.63rem;
    font-weight: 700;
}

.badge-sim-delta.up {
    background: rgba(239, 68, 68, 0.22);
    color: #fca5a5;
    border: 1px solid rgba(239, 68, 68, 0.5);
}

.badge-sim-delta.down {
    background: rgba(16, 185, 129, 0.22);
    color: #6ee7b7;
    border: 1px solid rgba(16, 185, 129, 0.5);
}

.badge-sim-delta.hidden {
    display: none;
}

.ins-title-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding-right: 20px;
}

#ins-depto {
    font-size: 1.08rem;
    font-weight: 800;
}

.btn-ins-fly {
    width: 24px;
    height: 24px;
    border-radius: 6px;
    background: rgba(56, 189, 248, 0.16);
    border: 1px solid rgba(56, 189, 248, 0.45);
    color: var(--color-cyan);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-ins-fly svg {
    width: 13px;
    height: 13px;
}

.btn-ins-fly:hover {
    background: var(--color-cyan);
    color: #060a13;
}

.ins-capital-text {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.74rem;
    color: var(--text-secondary);
    margin-top: 2px;
}

.ins-capital-text svg {
    width: 12px;
    height: 12px;
    color: var(--color-cyan);
}

.inspector-stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    margin: 10px 0 8px;
}

.ins-stat-box {
    background: rgba(15, 23, 42, 0.72);
    padding: 7px 8px;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.ins-label {
    display: block;
    font-size: 0.58rem;
    color: var(--text-muted);
    margin-bottom: 2px;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    font-weight: 600;
}

.ins-val {
    font-family: var(--font-mono);
    font-size: 0.88rem;
    font-weight: 700;
}

/* Sparkline 2017 - 2027 */
.inspector-spark-box,
.inspector-ml-box,
.inspector-climate-box,
.inspector-logistics-box {
    background: rgba(15, 23, 42, 0.6);
    padding: 8px 9px;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(255, 255, 255, 0.06);
    margin-top: 7px;
}

.inspector-spark-box h4,
.inspector-ml-box h4,
.inspector-climate-box h4,
.inspector-logistics-box h4 {
    font-size: 0.68rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 5px;
    margin-bottom: 5px;
}

.inspector-spark-box h4 svg,
.inspector-ml-box h4 svg,
.inspector-climate-box h4 svg,
.inspector-logistics-box h4 svg {
    width: 13px;
    height: 13px;
    color: var(--color-cyan);
}

.spark-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
}

.spark-head h4 {
    margin-bottom: 0;
}

.spark-peak-tag {
    font-family: var(--font-mono);
    font-size: 0.62rem;
    color: #c084fc;
    font-weight: 700;
}

.sparkline-canvas {
    width: 100%;
    height: 66px;
    margin-top: 5px;
    cursor: pointer;
}

.sparkline-canvas svg {
    width: 100%;
    height: 100%;
    display: block;
    overflow: visible;
}

.spark-legend {
    display: flex;
    justify-content: space-between;
    margin-top: 4px;
    font-size: 0.61rem;
    color: var(--text-muted);
}

.spark-legend span {
    display: flex;
    align-items: center;
    gap: 4px;
}

.dot-real,
.dot-ia {
    display: inline-block;
    width: 7px;
    height: 7px;
    border-radius: 50%;
}

.dot-real {
    background: var(--color-cyan);
}

.dot-ia {
    background: var(--color-purple);
}

/* Explicabilidad IA */
.ml-reasons-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 0.69rem;
    color: var(--text-secondary);
    line-height: 1.32;
}

.ml-reasons-list li {
    position: relative;
    padding-left: 11px;
}

.ml-reasons-list li::before {
    content: "▸";
    position: absolute;
    left: 0;
    color: var(--color-purple);
    font-weight: 800;
}

.climate-values {
    display: flex;
    justify-content: space-between;
    font-size: 0.71rem;
}

.climate-values .label {
    color: var(--text-muted);
}

.ins-climate-actions {
    display: flex;
    gap: 5px;
    margin-top: 7px;
}

.btn-ins-sim {
    flex: 1;
    background: rgba(15, 23, 42, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: var(--text-secondary);
    padding: 5px 6px;
    border-radius: var(--radius-sm);
    font-size: 0.69rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    transition: all 0.2s;
}

.btn-ins-sim svg {
    width: 12px;
    height: 12px;
}

.btn-ins-rain:hover,
.btn-ins-rain.active {
    background: rgba(56, 189, 248, 0.22);
    color: #7dd3fc;
    border-color: #38bdf8;
}

.btn-ins-sun:hover,
.btn-ins-sun.active {
    background: rgba(245, 158, 11, 0.22);
    color: #fcd34d;
    border-color: #f59e0b;
}

.btn-ins-clear {
    flex: 0 0 auto;
    padding: 5px 8px;
}

.btn-ins-clear:hover {
    background: rgba(239, 68, 68, 0.22);
    color: #fca5a5;
    border-color: #ef4444;
}

.btn-ins-clear.hidden {
    display: none;
}

.ins-logistics-text {
    font-size: 0.71rem;
    line-height: 1.4;
    color: var(--text-secondary);
}

/* --------------------------------------------------------------------------
   COLUMNA DERECHA: CÁMARA + SIMULADOR CLIMA + LEYENDA
   -------------------------------------------------------------------------- */
.camera-controls {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 5px;
    padding: 8px;
}

.cam-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 5px;
}

.btn-tool {
    background: rgba(15, 23, 42, 0.72);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--text-secondary);
    padding: 6px 8px;
    border-radius: var(--radius-sm);
    font-size: 0.71rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    transition: all 0.2s;
    white-space: nowrap;
}

.btn-tool-full {
    width: 100%;
}

.btn-tool:hover {
    background: rgba(56, 189, 248, 0.16);
    color: #ffffff;
    border-color: var(--color-cyan);
}

.btn-tool.active {
    background: rgba(56, 189, 248, 0.24);
    color: var(--color-cyan);
    border-color: var(--color-cyan);
    box-shadow: 0 0 10px rgba(56, 189, 248, 0.24);
}

.btn-tool svg {
    width: 13px;
    height: 13px;
    flex-shrink: 0;
}

/* SIMULADOR CLIMÁTICO 3D */
.climate-sim-panel {
    flex-shrink: 0;
    padding: 9px 11px;
    display: flex;
    flex-direction: column;
    gap: 7px;
    border-color: rgba(56, 189, 248, 0.35);
}

.sim-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
}

.sim-title {
    font-size: 0.74rem;
    font-weight: 700;
    color: #ffffff;
    display: flex;
    align-items: center;
    gap: 6px;
}

.sim-title svg {
    width: 14px;
    height: 14px;
    color: var(--color-amber);
}

.btn-sim-reset {
    background: rgba(239, 68, 68, 0.2);
    border: 1px solid rgba(239, 68, 68, 0.5);
    color: #fca5a5;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.64rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 3px;
}

.btn-sim-reset svg {
    width: 11px;
    height: 11px;
}

.btn-sim-reset:hover {
    background: rgba(239, 68, 68, 0.35);
    color: #ffffff;
}

.btn-sim-reset.hidden {
    display: none;
}

/* Macro-Escenarios 1 Clic */
.macro-scenarios-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 5px;
}

.btn-macro {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 6px 6px;
    border-radius: var(--radius-sm);
    font-size: 0.7rem;
    font-weight: 800;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-macro svg {
    width: 13px;
    height: 13px;
}

.macro-nino {
    background: rgba(245, 158, 11, 0.16);
    border: 1px solid rgba(245, 158, 11, 0.48);
    color: #fde047;
}

.macro-nino:hover,
.macro-nino.active {
    background: rgba(245, 158, 11, 0.34);
    border-color: #fbbf24;
    box-shadow: 0 0 12px rgba(245, 158, 11, 0.35);
    color: #ffffff;
}

.macro-nina {
    background: rgba(14, 165, 233, 0.16);
    border: 1px solid rgba(56, 189, 248, 0.48);
    color: #7dd3fc;
}

.macro-nina:hover,
.macro-nina.active {
    background: rgba(14, 165, 233, 0.34);
    border-color: #38bdf8;
    box-shadow: 0 0 12px rgba(56, 189, 248, 0.35);
    color: #ffffff;
}

.sim-tools-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 5px;
}

.btn-sim-tool {
    background: rgba(15, 23, 42, 0.78);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-secondary);
    padding: 5px 4px;
    border-radius: var(--radius-sm);
    font-size: 0.68rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    transition: all 0.2s;
}

.btn-sim-tool svg {
    width: 14px;
    height: 14px;
}

.btn-sim-tool.active {
    background: rgba(56, 189, 248, 0.22);
    color: var(--color-cyan);
    border-color: var(--color-cyan);
}

.btn-sim-tool.tool-rain:hover,
.btn-sim-tool.tool-rain.active {
    background: rgba(14, 165, 233, 0.28);
    color: #7dd3fc;
    border-color: #38bdf8;
}

.btn-sim-tool.tool-sun:hover,
.btn-sim-tool.tool-sun.active {
    background: rgba(245, 158, 11, 0.28);
    color: #fde047;
    border-color: #f59e0b;
}

.sim-intensity-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
}

.sim-label {
    font-size: 0.67rem;
    color: var(--text-muted);
    font-weight: 600;
}

.sim-intensity-pills {
    display: flex;
    background: rgba(15, 23, 42, 0.85);
    border-radius: 5px;
    padding: 2px;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.btn-intensity {
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 2px 8px;
    font-size: 0.67rem;
    font-weight: 700;
    cursor: pointer;
    border-radius: 4px;
}

.btn-intensity.active {
    background: rgba(56, 189, 248, 0.28);
    color: #ffffff;
}

.sim-corr-badge {
    font-family: var(--font-mono);
    font-size: 0.61rem;
    color: #cbd5e1;
    background: rgba(15, 23, 42, 0.82);
    border: 1px solid rgba(255, 255, 255, 0.06);
    padding: 4px 6px;
    border-radius: 5px;
    line-height: 1.3;
}

.sim-active-status {
    font-size: 0.66rem;
    color: var(--text-secondary);
    line-height: 1.3;
}

#map-container.cursor-rain {
    cursor: crosshair !important;
}

#map-container.cursor-sun {
    cursor: cell !important;
}

/* LEYENDA 3D COLAPSABLE */
.legend-panel {
    flex-shrink: 0;
    padding: 9px 11px;
    font-size: 0.7rem;
    display: flex;
    flex-direction: column;
}

.legend-header {
    width: 100%;
    background: transparent;
    border: none;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    padding: 0;
}

.legend-title {
    font-size: 0.73rem;
    font-weight: 700;
    color: #ffffff;
    display: flex;
    align-items: center;
    gap: 6px;
}

.legend-title svg,
.legend-chevron {
    width: 14px;
    height: 14px;
    color: var(--color-cyan);
    transition: transform 0.2s ease;
}

.legend-panel.collapsed .legend-chevron {
    transform: rotate(-90deg);
}

.legend-body {
    margin-top: 7px;
    padding-top: 7px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.legend-panel.collapsed .legend-body {
    display: none;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
}

.legend-color {
    width: 10px;
    height: 10px;
    border-radius: 3px;
    flex-shrink: 0;
}

.color-critico {
    background: var(--color-red);
    box-shadow: 0 0 6px var(--color-red);
}

.color-alerta {
    background: var(--color-amber);
    box-shadow: 0 0 6px var(--color-amber);
}

.color-estable {
    background: var(--color-green);
    box-shadow: 0 0 6px var(--color-green);
}

.legend-line {
    width: 13px;
    height: 3px;
    border-radius: 2px;
    flex-shrink: 0;
}

.line-red {
    background: #ff4d4d;
    box-shadow: 0 0 8px #ff4d4d;
}

.legend-hub {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    border: 2px solid #38bdf8;
    background: rgba(56, 189, 248, 0.45);
    box-shadow: 0 0 6px #38bdf8;
    flex-shrink: 0;
}

.legend-cube {
    width: 10px;
    height: 10px;
    border: 1px solid var(--color-cyan);
    background: rgba(56, 189, 248, 0.3);
    flex-shrink: 0;
}

.legend-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.08);
    margin: 2px 0;
}

/* --------------------------------------------------------------------------
   ZONA INFERIOR: HUD TIMELINE
   -------------------------------------------------------------------------- */
.hud-timeline {
    flex-shrink: 0;
    padding: 9px 18px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.timeline-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

.btn-media {
    background: rgba(15, 23, 42, 0.84);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: #ffffff;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.btn-media svg {
    width: 15px;
    height: 15px;
}

.btn-media:hover {
    background: var(--color-blue);
    border-color: var(--color-cyan);
    box-shadow: 0 0 12px rgba(59, 130, 246, 0.45);
}

.btn-play-main {
    width: 38px;
    height: 38px;
    background: linear-gradient(135deg, #0284c7, #2563eb);
    border: 1px solid var(--color-cyan);
    box-shadow: 0 0 14px rgba(56, 189, 248, 0.45);
}

.btn-play-main:hover {
    transform: scale(1.06);
}

.speed-toggle-group {
    display: flex;
    background: rgba(15, 23, 42, 0.85);
    border-radius: var(--radius-sm);
    padding: 2px;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.btn-speed {
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 4px 8px;
    font-size: 0.7rem;
    font-weight: 700;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s;
}

.btn-speed.active {
    background: rgba(56, 189, 248, 0.25);
    color: var(--color-cyan);
}

.timeline-display {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 9px;
}

.periodo-badge {
    font-family: var(--font-mono);
    font-size: 1.15rem;
    font-weight: 800;
    letter-spacing: 0.05em;
    color: #ffffff;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.35);
}

.tipo-badge {
    font-size: 0.65rem;
    font-weight: 800;
    padding: 4px 9px;
    border-radius: 6px;
    letter-spacing: 0.04em;
    white-space: nowrap;
}

.badge-real {
    background: rgba(16, 185, 129, 0.2);
    color: var(--color-green);
    border: 1px solid var(--color-green);
}

.badge-ia {
    background: rgba(168, 85, 247, 0.25);
    color: #d8b4fe;
    border: 1px solid var(--color-purple);
    box-shadow: 0 0 12px rgba(168, 85, 247, 0.4);
    animation: pulse-ai 2s infinite ease-in-out;
}

@keyframes pulse-ai {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.72;
    }
}

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

#timeline-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 7px;
    border-radius: 4px;
    background: linear-gradient(to right, #0284c7 0%, #2563eb 55%, #9333ea 70%, #ec4899 100%);
    outline: none;
    cursor: pointer;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.6);
}

#timeline-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 19px;
    height: 19px;
    border-radius: 50%;
    background: #ffffff;
    cursor: pointer;
    border: 3px solid var(--color-cyan);
    box-shadow: 0 0 14px rgba(56, 189, 248, 0.9);
    transition: transform 0.12s;
}

#timeline-slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

.slider-markers {
    display: flex;
    justify-content: space-between;
    margin-top: 3px;
    font-size: 0.66rem;
    color: var(--text-muted);
    font-family: var(--font-mono);
}

.marker-ai {
    color: #c084fc;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 4px;
}

.marker-ai svg {
    width: 12px;
    height: 12px;
}

/* --------------------------------------------------------------------------
   MODAL DE ATAJOS DE TECLADO
   -------------------------------------------------------------------------- */
.shortcuts-modal {
    position: fixed;
    inset: 0;
    z-index: 80;
    background: rgba(4, 7, 15, 0.72);
    backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.shortcuts-modal.hidden {
    display: none;
}

.shortcuts-card {
    width: min(440px, 100%);
    padding: 18px 20px;
    border-color: rgba(56, 189, 248, 0.45);
}

.shortcuts-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}

.shortcuts-head h3 {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.95rem;
    font-weight: 800;
}

.shortcuts-head h3 svg {
    width: 18px;
    height: 18px;
    color: var(--color-cyan);
}

.btn-close-modal {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
    line-height: 1;
}

.btn-close-modal:hover {
    color: #ffffff;
}

.shortcuts-grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.sc-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 7px 10px;
    border-radius: 8px;
    background: rgba(15, 23, 42, 0.72);
    font-size: 0.78rem;
    color: var(--text-secondary);
}

.sc-item kbd {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 5px;
    background: rgba(56, 189, 248, 0.16);
    border: 1px solid rgba(56, 189, 248, 0.45);
    color: #ffffff;
    white-space: nowrap;
}

/* --------------------------------------------------------------------------
   BOTÓN ADN CRISP-DM + MODAL INTERACTIVO DE AUDITORÍA + LIGHTBOX + DOCK MÓVIL
   -------------------------------------------------------------------------- */
.btn-crispdm-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 11px;
    border-radius: 9px;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.34), rgba(168, 85, 247, 0.34));
    border: 1px solid rgba(192, 132, 252, 0.65);
    color: #ffffff;
    font-family: var(--font-sans);
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.02em;
    cursor: pointer;
    box-shadow: 0 0 14px rgba(168, 85, 247, 0.28);
    transition: all 0.2s ease;
    white-space: nowrap;
}

.btn-crispdm-pill svg {
    width: 14px;
    height: 14px;
    color: #e9d5ff;
}

.btn-crispdm-pill:hover {
    background: linear-gradient(135deg, #6366f1, #a855f7);
    border-color: #ffffff;
    transform: translateY(-1px);
    box-shadow: 0 4px 20px rgba(168, 85, 247, 0.52);
}

.mobile-backdrop {
    position: fixed;
    inset: 0;
    z-index: 44;
    pointer-events: auto;
    background: rgba(3, 6, 14, 0.48);
    transition: opacity 0.22s ease;
}

.mobile-backdrop.hidden {
    display: none;
}

.sheet-drag-handle,
.mobile-native-dock {
    display: none;
}

/* Modal ADN CRISP-DM */
.crispdm-modal {
    position: fixed;
    inset: 0;
    z-index: 90;
    background: rgba(3, 6, 14, 0.78);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.crispdm-modal.hidden {
    display: none;
}

.crispdm-shell {
    width: min(980px, 100%);
    max-height: min(88dvh, 760px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border-color: rgba(168, 85, 247, 0.45);
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.75), 0 0 36px rgba(168, 85, 247, 0.18);
}

.crispdm-head {
    padding: 16px 20px 12px;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    background: linear-gradient(90deg, rgba(15, 23, 42, 0.9), rgba(49, 25, 84, 0.42));
}

.crispdm-kicker {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-family: var(--font-mono);
    font-size: 0.66rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    color: #c084fc;
    margin-bottom: 4px;
}

.crispdm-kicker svg {
    width: 13px;
    height: 13px;
}

.crispdm-title-group h2 {
    font-size: clamp(0.98rem, 1.5vw, 1.24rem);
    font-weight: 800;
    color: #ffffff;
    line-height: 1.2;
}

.crispdm-tabs {
    display: flex;
    gap: 6px;
    padding: 10px 18px;
    background: rgba(7, 11, 20, 0.68);
    border-bottom: 1px solid rgba(255, 255, 255, 0.07);
    overflow-x: auto;
    flex-shrink: 0;
}

.crisp-tab {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 13px;
    border-radius: 8px;
    background: rgba(15, 23, 42, 0.72);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--text-secondary);
    font-family: var(--font-sans);
    font-size: 0.76rem;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.18s ease;
}

.crisp-tab svg {
    width: 14px;
    height: 14px;
    color: var(--color-cyan);
}

.crisp-tab:hover {
    color: #ffffff;
    border-color: rgba(56, 189, 248, 0.45);
}

.crisp-tab.active {
    background: linear-gradient(135deg, rgba(56, 189, 248, 0.22), rgba(168, 85, 247, 0.25));
    border-color: var(--color-cyan);
    color: #ffffff;
    box-shadow: 0 0 12px rgba(56, 189, 248, 0.22);
}

.crispdm-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px 20px 20px;
}

.crisp-pane {
    display: none;
    flex-direction: column;
    gap: 14px;
}

.crisp-pane.active {
    display: flex;
}

/* Medallion Pipeline Flow */
.medallion-flow {
    display: grid;
    grid-template-columns: 1fr auto 1fr auto 1fr auto 1fr;
    align-items: stretch;
    gap: 8px;
}

.med-step {
    background: rgba(15, 23, 42, 0.78);
    border: 1px solid rgba(255, 255, 255, 0.09);
    border-radius: 11px;
    padding: 11px 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.med-step.bronze {
    border-top: 3px solid #f59e0b;
}

.med-step.silver {
    border-top: 3px solid #38bdf8;
}

.med-step.gold {
    border-top: 3px solid #eab308;
}

.med-step.prod {
    border-top: 3px solid #a855f7;
}

.med-tag {
    font-family: var(--font-mono);
    font-size: 0.6rem;
    font-weight: 800;
    color: var(--text-muted);
    letter-spacing: 0.04em;
}

.med-step strong {
    font-family: var(--font-mono);
    font-size: 1rem;
    color: #ffffff;
}

.med-step p {
    font-size: 0.72rem;
    color: var(--text-secondary);
    line-height: 1.38;
}

.med-step code {
    font-family: var(--font-mono);
    font-size: 0.68rem;
    color: #7dd3fc;
}

.med-arrow {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-cyan);
    font-weight: 900;
    font-size: 1.1rem;
}

.crisp-two-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.crisp-card {
    background: rgba(15, 23, 42, 0.72);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 13px 15px;
}

.crisp-card.accent-cyan {
    border-left: 3px solid var(--color-cyan);
}

.crisp-card.accent-purple {
    border-left: 3px solid var(--color-purple);
}

.crisp-card h4 {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 0.82rem;
    font-weight: 800;
    color: #ffffff;
    margin-bottom: 9px;
}

.crisp-card h4 svg {
    width: 15px;
    height: 15px;
    color: var(--color-cyan);
}

.crisp-card h4 code {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: #7dd3fc;
}

.crisp-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 7px;
    font-size: 0.76rem;
    color: var(--text-secondary);
    line-height: 1.42;
}

.crisp-list li {
    position: relative;
    padding-left: 12px;
}

.crisp-list li::before {
    content: "•";
    position: absolute;
    left: 0;
    color: var(--color-cyan);
    font-weight: 900;
}

.crisp-list code {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: #93c5fd;
    background: rgba(56, 189, 248, 0.12);
    padding: 1px 4px;
    border-radius: 4px;
}

.crisp-kpi-strip {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 9px;
}

.ckpi {
    background: rgba(15, 23, 42, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    padding: 9px 11px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.ckpi span {
    font-size: 0.62rem;
    text-transform: uppercase;
    font-weight: 700;
    color: var(--text-muted);
}

.ckpi strong {
    font-family: var(--font-mono);
    font-size: 1rem;
    font-weight: 800;
}

.ckpi small {
    font-size: 0.66rem;
    color: var(--text-secondary);
}

.crisp-callout {
    background: rgba(239, 68, 68, 0.12);
    border: 1px solid rgba(239, 68, 68, 0.35);
    border-left: 3px solid var(--color-red);
    border-radius: 9px;
    padding: 10px 13px;
    font-size: 0.76rem;
    color: #fecaca;
    line-height: 1.42;
}

/* Galería de Gráficas Reales de Python */
.crisp-gallery {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
}

.crisp-fig {
    background: rgba(15, 23, 42, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
}

.crisp-fig:hover {
    border-color: var(--color-cyan);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(56, 189, 248, 0.22);
}

.crisp-fig img {
    width: 100%;
    height: 112px;
    object-fit: cover;
    background: #ffffff;
    display: block;
}

.crisp-fig figcaption {
    padding: 6px 8px;
    font-size: 0.68rem;
    color: var(--text-secondary);
    line-height: 1.25;
}

/* Tabla Torneo ML */
.crisp-table-wrap {
    overflow-x: auto;
}

.crisp-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.74rem;
}

.crisp-table th,
.crisp-table td {
    padding: 6px 8px;
    text-align: left;
    border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

.crisp-table th {
    font-size: 0.64rem;
    text-transform: uppercase;
    color: var(--text-muted);
    font-weight: 700;
}

.crisp-table tr.row-win td {
    background: rgba(16, 185, 129, 0.14);
    color: #a7f3d0;
}

.crisp-table tr.row-warn td {
    color: #fca5a5;
}

.crisp-note {
    margin-top: 8px;
    font-size: 0.72rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

/* Barras de Feature Importance */
.fi-bars {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.fi-item {
    display: grid;
    grid-template-columns: 124px 1fr 44px;
    align-items: center;
    gap: 8px;
    font-size: 0.73rem;
}

.fi-item strong {
    font-family: var(--font-mono);
    text-align: right;
    color: #ffffff;
}

.fi-track {
    height: 9px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    overflow: hidden;
}

.fi-bar {
    height: 100%;
    border-radius: 999px;
}

.fi-bar.cyan {
    background: linear-gradient(90deg, #0284c7, #38bdf8);
}

.fi-bar.amber {
    background: linear-gradient(90deg, #d97706, #fbbf24);
}

.fi-bar.blue {
    background: linear-gradient(90deg, #2563eb, #60a5fa);
}

.fi-bar.muted {
    background: #64748b;
}

/* Métodos Numéricos */
.math-formula-box {
    font-family: var(--font-mono);
    font-size: 0.94rem;
    font-weight: 800;
    color: #7dd3fc;
    background: rgba(56, 189, 248, 0.1);
    border: 1px solid rgba(56, 189, 248, 0.35);
    border-radius: 9px;
    padding: 9px 12px;
    text-align: center;
    margin-bottom: 10px;
}

.math-formula-box.purple {
    color: #e9d5ff;
    background: rgba(168, 85, 247, 0.12);
    border-color: rgba(168, 85, 247, 0.38);
}

.crisp-action-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
    padding: 12px 15px;
    border-radius: 11px;
    background: linear-gradient(90deg, rgba(56, 189, 248, 0.12), rgba(168, 85, 247, 0.16));
    border: 1px solid rgba(56, 189, 248, 0.32);
    font-size: 0.78rem;
}

.btn-fly-tolima {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 8px 14px;
    border-radius: 9px;
    border: 1px solid var(--color-cyan);
    background: linear-gradient(135deg, #0284c7, #2563eb);
    color: #ffffff;
    font-family: var(--font-sans);
    font-size: 0.76rem;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(37, 99, 235, 0.45);
    transition: transform 0.16s ease;
}

.btn-fly-tolima svg {
    width: 15px;
    height: 15px;
}

.btn-fly-tolima:hover {
    transform: translateY(-1px);
}

/* Lightbox para zoom de figuras reales */
.crispdm-lightbox {
    position: fixed;
    inset: 0;
    z-index: 100;
    background: rgba(2, 5, 12, 0.88);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 18px;
}

.crispdm-lightbox.hidden {
    display: none;
}

.lightbox-box {
    width: min(920px, 100%);
    max-height: 90dvh;
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.lightbox-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.lightbox-head h4 {
    font-size: 0.9rem;
    font-weight: 800;
    color: #ffffff;
}

.lightbox-img-wrap {
    background: #ffffff;
    border-radius: 10px;
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    min-height: 0;
}

.lightbox-img-wrap img {
    max-width: 100%;
    max-height: 76dvh;
    object-fit: contain;
}

/* --------------------------------------------------------------------------
   RESPONSIVIDAD TOTAL: PORTÁTILES, PROYECTORES Y APP NATIVA MÓVIL
   -------------------------------------------------------------------------- */
@media (max-width: 1440px) {
    .brand-sub {
        display: none;
    }

    .hud-header {
        padding: 7px 12px;
        gap: 8px;
    }

    .hud-left {
        width: 284px;
    }

    .hud-right {
        width: 218px;
    }
}

@media (max-width: 1260px) {
    .selector-container span {
        display: none;
    }

    .glass-input {
        max-width: 138px;
        font-size: 0.74rem;
        padding: 5px 8px;
    }

    .glass-input-jump {
        max-width: 122px;
    }

    .kpi-card {
        min-width: 60px;
        padding: 4px 7px;
    }

    .kpi-val {
        font-size: 0.85rem;
    }

    .btn-crispdm-pill span {
        display: none;
    }

    .btn-crispdm-pill {
        padding: 7px;
    }

    .uni-badge img {
        height: 18px;
    }
}

/* Proyectores de baja altura (720p / 768p) */
@media (max-height: 780px) {
    .hud-overlay {
        padding: 8px 12px;
        gap: 7px;
    }

    .hud-header {
        padding: 6px 12px;
    }

    .hud-timeline {
        padding: 7px 14px;
        gap: 4px;
    }

    .story-banner {
        top: 68px;
        padding: 8px 14px;
    }

    .inspector-stats-grid {
        margin: 7px 0 6px;
    }

    .sparkline-canvas {
        height: 54px;
    }
}

/* ==========================================================================
   MODO APP NATIVA PARA TABLETS Y CELULARES (<= 960px)
   >75% de pantalla 100% libre para el Mapa 3D + Bottom-Sheet + Dock Inferior
   ========================================================================== */
@media (max-width: 960px) {
    .hud-overlay {
        padding: 8px 8px calc(8px + env(safe-area-inset-bottom, 0px));
        gap: 6px;
    }

    /* Header compacto de 2 tiras ultra-delgadas (~74px total, sin fila extra) */
    .hud-header {
        display: grid;
        grid-template-columns: auto minmax(0, 1fr) auto;
        grid-template-rows: auto auto;
        align-items: center;
        gap: 6px 8px;
        padding: 7px 9px;
        border-radius: 13px;
    }

    .brand {
        grid-column: 1;
        grid-row: 1;
        gap: 6px;
    }

    .logo-radar {
        width: 26px;
        height: 26px;
    }

    .icon-brand {
        width: 14px;
        height: 14px;
    }

    .brand-title {
        font-size: 0.78rem;
        gap: 4px;
    }

    .badge-ai {
        display: none;
    }

    .header-filters {
        grid-column: 2;
        grid-row: 1;
        min-width: 0;
        width: 100%;
    }

    .header-actions {
        grid-column: 3;
        grid-row: 1;
    }

    .jump-container,
    .hide-on-mobile,
    .header-actions .uni-badge,
    .header-actions .btn-crispdm-pill {
        display: none;
    }

    .selector-container {
        width: 100%;
        gap: 4px;
    }

    .selector-container label {
        display: none;
    }

    .glass-input {
        width: 100%;
        max-width: none;
        padding: 5px 8px;
        font-size: 0.72rem;
    }

    .btn-icon-hdr {
        width: 28px;
        height: 28px;
    }

    /* Tira KPI ultra-compacta de 1 sola línea (3 métricas clave sin desborde) */
    .kpi-group {
        grid-column: 1 / -1;
        grid-row: 2;
        display: grid;
        grid-template-columns: 1.35fr 0.85fr 0.85fr;
        gap: 5px;
    }

    .kpi-hide-mobile {
        display: none;
    }

    .kpi-card {
        min-width: 0;
        padding: 3px 7px;
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        gap: 4px;
        border-radius: 7px;
        overflow: hidden;
    }

    .kpi-label {
        font-size: 0.54rem;
        flex-shrink: 0;
    }

    .kpi-val-row {
        gap: 4px;
        min-width: 0;
    }

    .kpi-val {
        font-size: 0.76rem;
    }

    .kpi-delta {
        font-size: 0.58rem;
        padding: 1px 3px;
    }

    /* Drawers laterales SIN backdrop-filter ni transform (para no atrapar el Bottom-Sheet fixed) */
    .hud-left,
    .hud-right {
        position: fixed;
        top: 0;
        bottom: 0;
        width: min(320px, 86vw);
        max-height: 100dvh;
        z-index: 55;
        padding: 12px;
        background: rgba(6, 10, 19, 0.97);
        pointer-events: auto;
        visibility: hidden;
        transition: left 0.26s cubic-bezier(0.22, 1, 0.36, 1),
            right 0.26s cubic-bezier(0.22, 1, 0.36, 1),
            visibility 0.26s;
    }

    .hud-left {
        left: -105%;
        border-right: 1px solid var(--panel-border);
    }

    .hud-right {
        right: -105%;
        border-left: 1px solid var(--panel-border);
    }

    .hud-left.drawer-open {
        left: 0;
        visibility: visible;
    }

    .hud-right.drawer-open {
        right: 0;
        visibility: visible;
    }

    /* Inspector como Bottom-Sheet Nativo (100% nítido, sale desde abajo dejando mapa libre arriba) */
    .inspector-panel {
        position: fixed !important;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        max-height: 62dvh;
        overflow-y: auto;
        overscroll-behavior: contain;
        z-index: 65;
        border-radius: 20px 20px 0 0;
        border-bottom: none;
        padding: 10px 15px calc(16px + env(safe-area-inset-bottom, 0px));
        background: rgba(8, 13, 26, 0.98);
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
        box-shadow: 0 -16px 48px rgba(0, 0, 0, 0.78);
        visibility: visible !important;
        pointer-events: auto !important;
        animation: sheet-up 0.24s cubic-bezier(0.16, 1, 0.3, 1);
    }

    .inspector-panel.hidden {
        display: none !important;
    }

    @keyframes sheet-up {
        from {
            transform: translateY(100%);
        }

        to {
            transform: translateY(0);
        }
    }

    .sheet-drag-handle {
        display: flex;
        justify-content: center;
        margin-bottom: 6px;
    }

    .sheet-drag-handle span {
        width: 40px;
        height: 4px;
        border-radius: 999px;
        background: rgba(148, 163, 184, 0.45);
    }

    .mobile-drawer-head {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding-bottom: 8px;
        margin-bottom: 4px;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
        font-size: 0.82rem;
        font-weight: 800;
        color: var(--color-cyan);
    }

    .mobile-drawer-head span {
        display: flex;
        align-items: center;
        gap: 6px;
    }

    .mobile-drawer-head svg {
        width: 15px;
        height: 15px;
    }

    .btn-drawer-close {
        background: rgba(255, 255, 255, 0.08);
        border: none;
        color: #ffffff;
        width: 28px;
        height: 28px;
        border-radius: 50%;
        font-size: 1.2rem;
        line-height: 1;
        cursor: pointer;
    }

    /* Banner narrativo arriba-centro compacto */
    .story-banner {
        top: 96px;
        bottom: auto;
        padding: 7px 11px;
        gap: 8px;
    }

    .story-text-col h3 {
        font-size: 0.78rem;
    }

    .story-text-col p {
        font-size: 0.67rem;
    }

    /* Footer compacto + Dock Nativo de 4 Tabs */
    .hud-timeline {
        padding: 7px 10px 6px;
        gap: 5px;
        border-radius: 14px;
    }

    .timeline-controls {
        gap: 7px;
    }

    .btn-media {
        width: 28px;
        height: 28px;
    }

    .btn-play-main {
        width: 32px;
        height: 32px;
    }

    .periodo-badge {
        font-size: 0.9rem;
    }

    .tipo-badge {
        font-size: 0.56rem;
        padding: 2px 6px;
    }

    .speed-toggle-group,
    .slider-markers {
        display: none;
    }

    .mobile-native-dock {
        display: grid;
        grid-template-columns: repeat(4, 1fr);
        gap: 6px;
        padding-top: 6px;
        border-top: 1px solid rgba(255, 255, 255, 0.08);
    }

    .dock-btn {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 2px;
        padding: 5px 4px;
        border-radius: 9px;
        background: rgba(15, 23, 42, 0.72);
        border: 1px solid rgba(255, 255, 255, 0.08);
        color: var(--text-secondary);
        font-family: var(--font-sans);
        font-size: 0.64rem;
        font-weight: 700;
        cursor: pointer;
        transition: all 0.18s;
    }

    .dock-btn svg {
        width: 15px;
        height: 15px;
        color: var(--color-cyan);
    }

    .dock-btn.dock-accent {
        background: linear-gradient(135deg, rgba(99, 102, 241, 0.28), rgba(168, 85, 247, 0.3));
        border-color: rgba(192, 132, 252, 0.55);
        color: #ffffff;
    }

    .dock-btn.dock-accent svg {
        color: #e9d5ff;
    }

    /* Modal ADN CRISP-DM en móviles */
    .crispdm-modal {
        padding: 8px;
    }

    .crispdm-shell {
        max-height: 92dvh;
    }

    .crispdm-head {
        padding: 12px 14px 10px;
    }

    .crispdm-tabs {
        padding: 8px 12px;
    }

    .crispdm-body {
        padding: 12px 14px 16px;
    }

    .medallion-flow {
        grid-template-columns: 1fr;
        gap: 6px;
    }

    .med-arrow {
        transform: rotate(90deg);
        height: 14px;
    }

    .crisp-two-col {
        grid-template-columns: 1fr;
    }

    .crisp-kpi-strip {
        grid-template-columns: 1fr 1fr;
    }

    .crisp-gallery {
        grid-template-columns: 1fr 1fr;
    }
}