.hidden { display: none !important; }

:root {
    --bg-primary: #f4f7fa;
    --bg-secondary: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #475569;
    --minsal-blue: #0f69b4;
    --minsal-blue-dark: #0054a6;
    --minsal-teal: #06b6d4; /* Replaced red with a complementary teal */
    --glass-bg: rgba(255, 255, 255, 0.95);
    --glass-border: rgba(15, 105, 180, 0.15);
    --glow: 0 0 15px rgba(15, 105, 180, 0.1);
    --bg-dark: #0f172a;
    --bg-card: rgba(30, 41, 59, 0.85);
    --border-glass: rgba(255, 255, 255, 0.15);
    --text-main: #f8fafc;
    --text-dim: #94a3b8;
    --accent-glow: rgba(59, 130, 246, 0.5);
    --color-critical: #ef4444;
    --color-warning: #f59e0b;
    --color-success: #10b981;
    --border-radius: 20px;
    --border-radius-sm: 12px;
}

.btn-export {
    margin-left: auto;
    display: flex;
    align-items: center;
    background: var(--minsal-blue-dark);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.btn-export:hover {
    background: #0054a6;
    transform: translateY(-1px);
    box-shadow: 0 4px 6px rgba(0,0,0,0.15);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-primary);
    background-image: radial-gradient(rgba(15, 105, 180, 0.08) 1.5px, transparent 1.5px);
    background-size: 24px 24px;
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden; /* Prevent scrollbar from glowing orbs */
}

/* Animated Glowing Orbs (Fluent Design) */
body::before, body::after {
    content: '';
    position: fixed;
    width: 70vw;
    height: 70vw;
    border-radius: 50%;
    filter: blur(100px);
    z-index: -1;
    animation: floatOrb 25s infinite alternate ease-in-out;
    opacity: 0.6;
    pointer-events: none; /* Crucial para evitar interferencias */
    will-change: transform;
}

body::before {
    background: rgba(15, 105, 180, 0.15); /* Azul Minsal */
    top: -20vh;
    left: -20vw;
}

body::after {
    background: rgba(52, 211, 153, 0.12); /* Verde Mint */
    bottom: -20vh;
    right: -20vw;
    animation-delay: -12s;
}

@keyframes floatOrb {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(10vw, 10vh) scale(1.1); }
}

.dashboard-container {
    max-width: 1440px;
    margin: 0 auto;
    padding: 2rem;
}

/* Glassmorphism Classes */
.glass {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.9);
    border-top: 1px solid rgba(255, 255, 255, 1);
    border-left: 1px solid rgba(255, 255, 255, 1);
    box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.05);
    border-radius: var(--border-radius);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.glass:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 40px 0 rgba(31, 38, 135, 0.1);
}

.minsal-border {
    border-top: 4px solid var(--minsal-blue);
    border-top-left-radius: var(--border-radius);
    border-top-right-radius: var(--border-radius);
}

/* Header */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2.5rem;
    animation: fadeInDown 0.8s ease-out;
}

h1 {
    font-size: 2.25rem;
    font-weight: 800;
    color: var(--minsal-blue);
    margin-bottom: 0.25rem;
    letter-spacing: -0.02em;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 1.1rem;
    font-weight: 500;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.main-filter {
    font-size: 1rem;
    padding: 0.6rem 1.2rem;
    border: 1px solid var(--minsal-blue);
    border-radius: var(--border-radius-sm);
    box-shadow: 0 2px 4px rgba(15, 105, 180, 0.1);
    color: var(--minsal-blue-dark);
    font-weight: 600;
    cursor: pointer;
    background-color: white;
}

.main-filter:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(15, 105, 180, 0.3);
}

.badge {
    background: rgba(15, 105, 180, 0.1);
    color: var(--minsal-blue-dark);
    padding: 0.5rem 1rem;
    border-radius: 9999px;
    font-size: 0.875rem;
    font-weight: 600;
    border: 1px solid rgba(15, 105, 180, 0.2);
}

/* KPIs */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
    margin-bottom: 2.5rem;
    overflow: visible;
    position: relative;
    z-index: 10; /* Prioridad base sobre el contenido inferior */
}

.kpi-card {
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1.5rem;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    animation: fadeInUp 0.8s ease-out backwards;
    border-radius: var(--border-radius);
    overflow: visible;
}

.kpi-card:nth-child(1) { animation-delay: 0.1s; border-top-color: var(--minsal-blue); }
.kpi-card:nth-child(2) { animation-delay: 0.2s; }
.kpi-card:nth-child(3) { animation-delay: 0.3s; }

.kpi-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--glow);
    z-index: 100; /* Elevar tarjeta activa sobre las demás */
}

.kpi-icon {
    font-size: 2.5rem;
    background: rgba(15, 105, 180, 0.1);
    width: 64px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
}

.kpi-card:nth-child(2) .kpi-icon {
    background: rgba(6, 182, 212, 0.1);
}

.kpi-info {
    width: 100%;
}

.kpi-info h3 {
    font-size: 0.9rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.25rem;
    font-weight: 700;
}

.kpi-info p {
    font-size: 2rem;
    font-weight: 800;
    color: var(--minsal-blue-dark);
    line-height: 1.1;
}

/* Map Highlights for Critical Coverage */

.commune-label-permanent {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    color: #475569 !important;
    font-weight: 800 !important;
    font-size: 0.75rem !important;
    text-shadow: 0 0 4px #ffffff, 0 0 4px #ffffff;
    pointer-events: none !important;
    text-transform: uppercase;
    letter-spacing: 1px;
}

#kpi-top-grupo, #kpi-worst-grupo {
    font-size: 1.15rem;
    line-height: 1.3;
    color: var(--minsal-blue-dark);
    margin-top: 0.25rem;
}

/* Charts & Legend */
.legend-container {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px dashed rgba(15, 105, 180, 0.15);
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.legend-color {
    width: 10px;
    height: 10px;
    border-radius: 3px;
    display: inline-block;
}

.charts-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 2.5rem;
}

.full-width {
    grid-column: 1 / -1;
}

@media (max-width: 1024px) {
    .charts-grid, .kpi-grid {
        grid-template-columns: 1fr;
    }
    .full-width {
        grid-column: auto;
    }
}

.chart-card {
    padding: 1.5rem;
    animation: fadeIn 1s ease-out 0.3s backwards;
    border-radius: var(--border-radius);
}

.chart-card h2 {
    font-size: 1.25rem;
    margin-bottom: 1.5rem;
    font-weight: 700;
    color: var(--minsal-blue-dark);
    border-bottom: 2px solid rgba(15, 105, 180, 0.1);
    padding-bottom: 0.5rem;
}

.chart-container {
    position: relative;
    width: 100%;
}

.doughnut-container {
    height: 350px;
}

.bar-container {
    height: 350px;
}

.criterio-container {
    height: 450px;
}

/* Table */
.table-section {
    padding: 1.5rem;
    animation: fadeIn 1s ease-out 0.5s backwards;
    border-radius: var(--border-radius);
}

.table-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    border-bottom: 2px solid rgba(15, 105, 180, 0.1);
    padding-bottom: 0.5rem;
}

.table-header h2 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--minsal-blue-dark);
}

.table-responsive {
    overflow-x: hidden;
    overflow-y: auto;
    max-height: 500px;
}

table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    white-space: normal;
    table-layout: fixed;
    word-wrap: break-word;
}

thead {
    position: sticky;
    top: 0;
    z-index: 10;
}

th {
    background: #f1f5f9;
    padding: 0.3rem 0.1rem;
    font-weight: 700;
    color: var(--minsal-blue-dark);
    font-size: 0.55rem;
    line-height: 1.1;
    border-bottom: 2px solid rgba(15, 105, 180, 0.1);
    border-right: 1px solid rgba(0,0,0,0.05);
    text-align: center;
    vertical-align: middle;
    word-break: break-word;
}

th:nth-child(1) { width: 8%; }
th:nth-child(2) { width: 15%; }

/* Reverting sticky for simplicity and cross-browser stability */
th:nth-child(1), td:nth-child(1) { position: static; }
th:nth-child(2), td:nth-child(2) { position: static; }

td {
    padding: 0.2rem 0.1rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    border-right: 1px solid rgba(0,0,0,0.05);
    font-size: 0.65rem;
    color: var(--text-primary);
    word-break: break-word;
    text-align: center;
}

tbody tr {
    transition: background-color 0.2s;
}

tbody tr:hover {
    background-color: rgba(15, 105, 180, 0.05);
}

.value-col {
    text-align: right;
    font-variant-numeric: tabular-nums;
    font-weight: 500;
    font-size: 0.8rem;
}

/* Animations */
@keyframes fadeInDown {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Technical Notes Footer */
.technical-notes {
    margin-top: 2.5rem;
    padding: 1.5rem;
    border-left: 4px solid var(--minsal-blue);
    animation: fadeIn 1s ease-out 0.8s backwards;
}

.technical-notes h4 {
    font-size: 1rem;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 700;
}

.technical-notes ul {
    list-style-type: none;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.technical-notes li {
    margin-bottom: 0.5rem;
    line-height: 1.5;
}

.technical-notes strong {
    color: var(--minsal-blue-dark);
}

/* Visitor Counter */
.footer-bottom {
    display: flex;
    justify-content: flex-end;
    margin-top: 1rem;
    padding: 0 0.5rem;
    animation: fadeIn 1s ease-out 1s backwards;
}

.visitor-counter {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.75rem;
    color: var(--text-secondary);
    background: rgba(15, 105, 180, 0.03);
    padding: 0.4rem 0.8rem;
    border-radius: 9999px;
    border: 1px solid rgba(15, 105, 180, 0.1);
}

.visitor-counter svg {
    color: var(--minsal-blue);
    opacity: 0.8;
}

.visitor-counter span span {
    font-weight: 700;
    color: var(--minsal-blue-dark);
}


/* ====================================================
   Responsive Design / Mobile Adaptability
   ==================================================== */
@media (max-width: 768px) {
    /* Container & Layout */
    .dashboard-container {
        padding: 1rem;
    }

    /* Header adaptations */
    header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1.25rem;
        margin-bottom: 1.5rem;
    }

    h1 {
        font-size: 1.75rem;
    }
    
    .subtitle {
        font-size: 1rem;
    }

    .header-actions {
        width: 100%;
        justify-content: space-between;
        flex-wrap: wrap;
    }
    
    .main-filter {
        width: 100%;
        max-width: none;
    }

    /* KPIs */
    .kpi-card {
        padding: 1.2rem;
        gap: 1rem;
    }

    .kpi-icon {
        width: 50px;
        height: 50px;
        font-size: 1.75rem;
    }

    .kpi-info p {
        font-size: 1.4rem;
    }

    .legend-container {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }

    /* Charts scaling */
    .doughnut-container,
    .bar-container,
    .criterio-container {
        height: 320px;
    }

    .chart-card h2 {
        font-size: 1.1rem;
        margin-bottom: 1rem;
    }
    
    .chart-card {
        padding: 1rem;
    }

    /* Table adaptations */
    .table-section {
        padding: 1rem;
    }
    
    th, td {
        padding: 0.35rem 0.5rem;
        font-size: 0.7rem;
    }
    
    th {
        font-size: 0.65rem;
    }
}

@media (max-width: 480px) {
    /* Phones specifically */
    .header-actions {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
    }
    
    .badge {
        text-align: center;
        padding: 0.75rem;
    }
    
    h1 {
        font-size: 1.5rem;
    }
    
    .kpi-grid {
        gap: 1rem;
    }
    
    .doughnut-container,
    .bar-container,
    .criterio-container {
        height: 280px;
    }
}

/* ==========================================================================
   ESTILOS PREMIUM - TABLERO GEOESPACIAL "MISSION CONTROL"
   ========================================================================== */

/* Contenedor del Mapa - Dark Mode */

/* Tooltip Inteligente Personalizado */
/* ==========================================
   MISSION CONTROL SIDE-BY-SIDE LAYOUT
   ========================================== */
.mission-control-row {
    display: flex;
    gap: 1.5rem;
    margin-top: 1rem;
    margin-bottom: 3rem;
    flex-wrap: wrap;
    align-items: stretch; /* Esto estira las columnas */
}

.spatial-col, .trend-col {
    flex: 1;
    min-width: 450px;
    display: flex;
    flex-direction: column;
}

.map-dashboard.compact, .chart-card.no-margin {
    flex: 1;
    min-height: 600px;
    height: 600px; /* Keep fixed to avoid chart resizing loops */
    position: relative;
    border-radius: 20px;
    overflow: hidden;
}

.map-dashboard.compact {
    background: rgba(255, 255, 255, 0.4);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(0, 0, 0, 0.08);
}

#territoryMap {
    height: 100%;
    width: 100%;
    z-index: 1;
}

/* COMPACT FLOATING KPIs */
.map-kpi-overlay.compact {
    position: absolute;
    top: 15px;
    left: 40px;
    z-index: 1000;
    display: flex;
    gap: 10px;
    pointer-events: none;
}

.map-kpi-card {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(0, 0, 0, 0.1);
    padding: 10px 15px;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    pointer-events: auto;
}

.map-kpi-card.mini {
    text-align: center;
    min-width: 85px;
}

.map-kpi-label {
    font-size: 0.65rem;
    text-transform: uppercase;
    color: #64748b;
    font-weight: 700;
    margin-bottom: 2px;
}

.map-kpi-value {
    font-size: 1.1rem;
    font-weight: 800;
    color: #0f172a;
}

.map-select-filter {
    background: #fff;
    border: 1px solid #e2e8f0;
    color: #0f172a;
    font-size: 0.85rem;
    padding: 6px 12px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    width: 100%;
}

.selector-card {
    min-width: 200px;
    background: #ffffff !important;
    border: 1px solid #e2e8f0 !important;
    color: #0f172a !important;
}

/* SIDE PANEL: SLIDE-IN (LIGHT THEME) */
.map-side-panel {
    position: absolute;
    top: 0;
    right: -450px;
    width: 400px;
    height: 100%;
    background: rgba(15, 23, 42, 0.9);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    z-index: 1001;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    padding: 30px;
    border-left: 1px solid rgba(255, 255, 255, 0.1);
    color: #fff;
    box-shadow: -10px 0 30px rgba(0,0,0,0.5);
}

.map-side-panel.active {
    right: 0;
}

.panel-close {
    position: absolute;
    top: 20px;
    left: -15px;
    width: 30px;
    height: 30px;
    background: var(--minsal-blue);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.5rem;
    color: white;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
}

/* PANEL COMPONENTS */
.panel-stat-card {
    background: rgba(255, 255, 255, 0.05);
    padding: 20px;
    border-radius: 15px;
    margin-bottom: 15px;
}

.panel-stat-card label {
    display: block;
    font-size: 0.8rem;
    color: #94a3b8;
    margin-bottom: 5px;
}

.panel-stat-card .value {
    font-size: 2rem;
    font-weight: 800;
}

.progress-bg {
    background: rgba(255,255,255,0.1);
    height: 6px;
    border-radius: 3px;
    margin-top: 10px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    transition: width 1s ease-out;
}

.panel-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 15px;
}

.panel-mini-card {
    background: rgba(255, 255, 255, 0.03);
    padding: 15px;
    border-radius: 12px;
    border: 1px solid rgba(255,255,255,0.05);
}

.panel-mini-card.featured {
    background: rgba(239, 68, 68, 0.05);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.panel-mini-card label {
    font-size: 0.7rem;
    color: #94a3b8;
    display: block;
}

.panel-mini-card .value {
    font-size: 1.2rem;
    font-weight: 700;
}

.btn-action-panel {
    width: 100%;
    padding: 12px;
    background: var(--minsal-blue);
    color: white;
    border: none;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.btn-action-panel:hover {
    background: var(--minsal-blue-dark);
    transform: translateY(-2px);
}

/* CUSTOM MARKERS */
.marker-container {
    display: flex;
    align-items: center;
    justify-content: center;
}

.marker-icon {
    border-radius: 50%;
    border: 2px solid #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 0.8rem;
    box-shadow: 0 0 15px rgba(0,0,0,0.5);
    transition: transform 0.2s;
}

.marker-icon:hover {
    transform: scale(1.3);
}

.estab-marker {
    border-radius: 50%;
    border: 2px solid #ffffff;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
    font-size: 12px;
    font-weight: bold;
}

.estab-marker.hospital {
    border-radius: 6px; /* Squares for hospitals, circles for others to differentiate them */
}

/* Formal highlight for critical centers (soft red static halo) */
.pulse-critical {
    box-shadow: 0 0 0 6px rgba(239, 68, 68, 0.3), 0 2px 6px rgba(0, 0, 0, 0.25) !important;
}

/* INTEL TOOLTIP */
.intel-tooltip {
    background: rgba(15, 23, 42, 0.9) !important;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
    color: white !important;
    border-radius: 8px !important;
    padding: 10px !important;
    box-shadow: 0 10px 15px rgba(0,0,0,0.3) !important;
}

.tooltip-badge {
    margin-top: 5px;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 700;
    display: inline-block;
}

/* CUSTOM POPUPS (Dark Mode) */
.leaflet-popup-content-wrapper {
    background: #1e293b !important;
    color: #f8fafc !important;
    border-radius: 12px !important;
}

.leaflet-popup-tip {
    background: #1e293b !important;
}

.map-popup-custom h3 {
    margin: 0 0 10px 0;
    color: #38bdf8;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    padding-bottom: 5px;
}

.popup-stat {
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
    margin-bottom: 5px;
}

@keyframes slideInDown {
    from { transform: translateY(-50px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}
.custom-tooltip {
    background: rgba(15, 23, 42, 0.98) !important;
    border: 1px solid var(--border-glass) !important;
    color: white !important;
    border-radius: 12px !important;
    padding: 15px !important;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.5) !important;
    font-family: 'Inter', sans-serif !important;
}

.tooltip-header {
    border-bottom: 1px solid rgba(255,255,255,0.1);
    padding-bottom: 8px;
    margin-bottom: 8px;
    font-weight: 700;
    font-size: 1rem;
}

.tooltip-stat {
    display: flex;
    justify-content: space-between;
    margin: 4px 0;
    font-size: 0.85rem;
}

.tooltip-label { color: var(--text-dim); }
.tooltip-value { font-weight: 600; color: #fff; }

/* Legenda Estilizada */
.info.legend {
    background: var(--bg-card) !important;
    backdrop-filter: blur(8px);
    border: 1px solid var(--border-glass) !important;
    color: white !important;
    padding: 15px !important;
    border-radius: 12px !important;
    box-shadow: 0 10px 15px rgba(0,0,0,0.3) !important;
}

.legend i {
    width: 18px;
    height: 18px;
    float: left;
    margin-right: 8px;
    opacity: 0.9;
    border-radius: 3px;
}

/* Cursor pointer sobre marcadores divIcon */
/* COMPACT INTERCULTURAL CARDS */
.pueblos-grid-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1rem;
    margin-top: 0.5rem;
}

.pueblo-card {
    position: relative;
    padding: 0.75rem 1rem;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.5);
    border: 1px solid rgba(15, 105, 180, 0.1);
    cursor: pointer;
    transition: all 0.3s ease;
    min-height: auto;
    display: flex;
    flex-direction: column;
}

.pueblo-card:hover {
    background: white;
    transform: translateY(-3px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.05);
}

.pueblo-card h3 {
    font-size: 0.95rem;
    font-weight: 700;
}

.pueblo-card .pueblo-count {
    font-size: 1.3rem;
    font-weight: 800;
}

.pueblo-card .pueblo-label {
    font-size: 0.6rem;
}

.pueblo-card .distribution-mini {
    max-height: 0;
    overflow: hidden;
    transition: all 0.4s ease;
    border-top: none;
    padding-top: 0;
    margin-top: 0;
}

.pueblo-card:hover .distribution-mini {
    max-height: 150px;
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px dashed rgba(0,0,0,0.1);
}

.dist-row {
    font-size: 0.7rem;
    margin-bottom: 0.2rem;
}

/* Reset featured size to normal for compactness */
.pueblo-card.featured {
    grid-column: auto;
    background: rgba(15, 105, 180, 0.05);
}

@media print {
    body::before, body::after { display: none !important; }
    .btn-export, .header-actions select { display: none !important; }
    .dashboard-container { max-width: 100%; padding: 0; background: white; }
    body { background: white; }
    .kpi-card, .chart-card, .map-container { box-shadow: none !important; border: 1px solid #e2e8f0 !important; }
}

/* ── DECORACIONES VISUALES PREMIUM ── */
.badge-ocurrencia {
    background: rgba(15, 105, 180, 0.1);
    color: var(--minsal-blue);
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 700;
    border: 1px solid rgba(15, 105, 180, 0.2);
    animation: pulseBadge 2s infinite;
}

#reportDate {
    background: #e2e8f0;
    color: #475569;
    padding: 3px 10px;
    border-radius: 6px;
    font-weight: 600;
    font-family: monospace;
}

.badge {
    background: #1e293b;
    color: white;
    padding: 5px 10px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    margin-left: 10px;
}

@keyframes pulseBadge {
    0% { box-shadow: 0 0 0 0 rgba(15, 105, 180, 0.4); }
    70% { box-shadow: 0 0 0 6px rgba(15, 105, 180, 0); }
    100% { box-shadow: 0 0 0 0 rgba(15, 105, 180, 0); }
}

/* TOOLTIP ESTRATÉGICO PARA ICONOS KPI */
.kpi-icon {
    position: relative;
    cursor: help;
}

.strategic-tooltip {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translate(-50%, 10px);
    width: 200px;
    background: #0f172a;   /* Fondo sólido 100% opaco — sin blur que distorsione */
    color: #f1f5f9 !important;
    padding: 12px 14px;
    border-radius: 10px;
    box-shadow: 0 12px 30px rgba(0,0,0,0.5);
    z-index: 99999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease, transform 0.25s ease;
    pointer-events: none;
    border: 1px solid rgba(255,255,255,0.12);
    text-align: left !important;
    /* Texto nítido en todos los navegadores */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    will-change: opacity, transform;
    font-size: 0.82rem;
    line-height: 1.5;
}

.kpi-icon:hover .strategic-tooltip {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, 15px);
}

.strategic-tooltip h4 {
    margin: 0 0 8px 0;
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #94a3b8;
    text-align: left; /* Título también a la izquierda */
}

/* PANEL TÁCTICO MAPA */
.map-tactical-panel {
    position: absolute;
    top: 15px;
    right: 15px;
    z-index: 1000;
    width: 180px;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(8px);
    padding: 15px;
    border-radius: 15px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    border: 1px solid rgba(15, 105, 180, 0.1);
}

.map-legend {
    margin-top: 10px;
    border-top: 1px solid #e2e8f0;
    padding-top: 10px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.7rem;
    font-weight: 600;
    color: #64748b;
    margin-bottom: 5px;
}

.dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}
.dot.green { background: #10b981; }
.dot.yellow { background: #fbbf24; }
.dot.red { background: #ef4444; }

/* Animación para marcadores críticos */
@keyframes pulse-red {
    0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7); }
    70% { box-shadow: 0 0 0 10px rgba(239, 68, 68, 0); }
    100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}
.pulse-marker-ef4444 {
    animation: pulse-red 2s infinite;
}

/* GRÁFICO FULL-WIDTH */
.epi-chart-full {
    padding: 1.6rem;
    border-radius: 20px;
    position: relative;
}

/* TOOLTIP EPIDEMIOLÓGICO PERSONALIZADO */
.epi-custom-tooltip {
    position: absolute;
    background: white;
    border: 1px solid rgba(15,105,180,0.15);
    border-radius: 16px;
    padding: 1rem 1.1rem;
    box-shadow: 0 12px 40px rgba(15,105,180,0.15), 0 2px 8px rgba(0,0,0,0.08);
    min-width: 220px;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.18s ease;
    z-index: 100;
    font-family: 'Inter', sans-serif;
}

.ectt-badge {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 10px;
    margin-bottom: 6px;
    letter-spacing: 0.2px;
}

.ectt-name {
    font-size: 0.85rem;
    font-weight: 700;
    color: #1e293b;
    line-height: 1.3;
    margin-bottom: 8px;
}

.ectt-divider {
    height: 1px;
    background: #f1f5f9;
    margin: 8px 0;
}

.ectt-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 1rem;
    margin-bottom: 5px;
}

.ectt-lbl {
    font-size: 0.68rem;
    color: #94a3b8;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    white-space: nowrap;
}

.ectt-val {
    font-size: 0.85rem;
    font-weight: 800;
    color: #1e293b;
    text-align: right;
}

.ectt-progress-bg {
    height: 5px;
    background: #f1f5f9;
    border-radius: 3px;
    overflow: hidden;
    margin: 4px 0 10px;
}

.ectt-progress-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.4s ease;
}
/* ==========================================================================
   CENTRO DE INTELIGENCIA EPIDEMIOLÓGICA — Análisis por Grupo Objetivo
   ========================================================================== */

/* HEADER DE SECCIÓN */
.epi-section-header {
    display: flex;
    align-items: center;
    gap: 1.2rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.epi-section-icon {
    font-size: 2rem;
    background: linear-gradient(135deg, rgba(15,105,180,0.1), rgba(14,165,233,0.1));
    width: 56px;
    height: 56px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(15,105,180,0.15);
    flex-shrink: 0;
}

.epi-section-title {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--minsal-blue-dark);
    letter-spacing: -0.01em;
    margin: 0 0 2px 0;
}

.epi-section-subtitle {
    font-size: 0.82rem;
    color: #64748b;
    font-weight: 500;
    margin: 0;
}

.epi-summary-badges {
    margin-left: auto;
    display: flex;
    gap: 0.6rem;
    flex-wrap: wrap;
    align-items: center;
}

.epi-badge-pill {
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.78rem;
    font-weight: 700;
    border: 1.5px solid transparent;
}

.success-pill {
    background: rgba(16,185,129,0.1);
    color: #065f46;
    border-color: rgba(16,185,129,0.25);
}

.danger-pill {
    background: rgba(239,68,68,0.1);
    color: #991b1b;
    border-color: rgba(239,68,68,0.25);
}

/* CARDS GRID EPIDEMIOLÓGICO */
.epi-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(165px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.epi-card {
    padding: 1rem 0.9rem 0.8rem;
    border-radius: 18px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    position: relative;
    overflow: hidden;
    cursor: default;
    animation: fadeInUp 0.5s ease-out backwards;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
    border-top: 3px solid transparent;
}

.epi-card:hover {
    transform: translateY(-4px) scale(1.02);
    box-shadow: 0 16px 40px rgba(15,105,180,0.12);
}

.epi-success  { border-top-color: #10b981; background: linear-gradient(160deg, rgba(16,185,129,0.05) 0%, rgba(255,255,255,0.95) 60%); }
.epi-warning  { border-top-color: #f59e0b; background: linear-gradient(160deg, rgba(245,158,11,0.05) 0%, rgba(255,255,255,0.95) 60%); }
.epi-danger   { border-top-color: #ef4444; background: linear-gradient(160deg, rgba(239,68,68,0.05) 0%, rgba(255,255,255,0.95) 60%); }
.epi-critical { border-top-color: #dc2626; background: linear-gradient(160deg, rgba(220,38,38,0.08) 0%, rgba(255,255,255,0.95) 60%); }

.epi-card-rank {
    position: absolute;
    top: 8px;
    left: 10px;
    font-size: 0.65rem;
    font-weight: 800;
    color: #94a3b8;
    letter-spacing: 0.5px;
}

.epi-card-badge {
    font-size: 0.62rem;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 10px;
    letter-spacing: 0.3px;
    align-self: flex-end;
    margin-top: -2px;
}

.epi-success-badge  { background: rgba(16,185,129,0.12);  color: #065f46; }
.epi-warning-badge  { background: rgba(245,158,11,0.12);  color: #92400e; }
.epi-danger-badge   { background: rgba(239,68,68,0.12);   color: #991b1b; }
.epi-critical-badge { background: rgba(220,38,38,0.15);   color: #7f1d1d; }

/* ANILLO SVG CIRCULAR */
.epi-card-ring-wrap {
    width: 90px;
    height: 90px;
    margin: 0.2rem 0;
}

.epi-ring-svg {
    width: 100%;
    height: 100%;
    overflow: visible;
}

.epi-ring-progress {
    transition: stroke-dashoffset 1.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.epi-card-label {
    font-size: 0.72rem;
    font-weight: 700;
    color: #334155;
    text-align: center;
    line-height: 1.3;
    padding: 0 4px;
    min-height: 2.6em;
    display: flex;
    align-items: center;
    justify-content: center;
}

.epi-card-stats {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    gap: 4px;
    margin-top: 2px;
}

.epi-stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    gap: 1px;
}

.epi-stat-val {
    font-size: 0.82rem;
    font-weight: 800;
    color: #1e293b;
    line-height: 1;
}

.epi-stat-val.brecha {
    color: #ef4444;
}

.epi-stat-lbl {
    font-size: 0.58rem;
    color: #94a3b8;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.epi-stat-divider {
    width: 1px;
    height: 28px;
    background: #e2e8f0;
    flex-shrink: 0;
}

.epi-progress-bar {
    width: 100%;
    height: 4px;
    background: #f1f5f9;
    border-radius: 2px;
    overflow: hidden;
    margin-top: 6px;
}

.epi-progress-fill {
    height: 100%;
    border-radius: 2px;
    transition: width 1s ease-out;
}

/* PANEL INFERIOR */
.epi-bottom-row {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.epi-chart-panel {
    flex: 2;
    min-width: 320px;
    padding: 1.4rem;
}

.epi-ranking-panel {
    flex: 1;
    min-width: 260px;
    padding: 1.4rem;
    overflow: hidden;
}

.epi-panel-header {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 1.2rem;
    border-bottom: 2px solid rgba(15,105,180,0.08);
    padding-bottom: 0.7rem;
}

.epi-panel-icon { font-size: 1.1rem; }

.epi-panel-header h3 {
    font-size: 1rem;
    font-weight: 700;
    color: var(--minsal-blue-dark);
    margin: 0;
    flex: 1;
}

.epi-panel-badge {
    background: rgba(15,105,180,0.08);
    color: #0369a1;
    padding: 3px 10px;
    border-radius: 10px;
    font-size: 0.68rem;
    font-weight: 700;
    border: 1px solid rgba(15,105,180,0.12);
}

/* RANKING LIST */
.epi-ranking-list {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
    max-height: 370px;
    overflow-y: auto;
    padding-right: 4px;
}

.epi-ranking-list::-webkit-scrollbar { width: 4px; }
.epi-ranking-list::-webkit-scrollbar-track { background: #f1f5f9; border-radius: 2px; }
.epi-ranking-list::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 2px; }

.epi-rank-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 6px 8px;
    border-radius: 10px;
    transition: background 0.2s;
}

.epi-rank-item:hover { background: rgba(15,105,180,0.04); }

.epi-rank-medal {
    width: 28px;
    text-align: center;
    flex-shrink: 0;
}

.epi-rank-info { flex: 1; min-width: 0; }

.epi-rank-name {
    font-size: 0.72rem;
    font-weight: 600;
    color: #334155;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 4px;
}

.epi-rank-bar-bg {
    height: 5px;
    background: #f1f5f9;
    border-radius: 3px;
    overflow: hidden;
}

.epi-rank-bar-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 1.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.epi-rank-pct {
    font-size: 0.75rem;
    font-weight: 800;
    flex-shrink: 0;
    width: 42px;
    text-align: right;
}

/* FILA DE MÉTRICAS ESTADÍSTICAS */
.epi-stat-row {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1rem;
    margin-top: 0.5rem;
}

.epi-stat-pill {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    padding: 1rem 1.1rem;
    border-radius: 14px;
    transition: transform 0.2s ease;
}

.epi-stat-pill:hover { transform: translateY(-3px); }

.epi-stat-pill-icon { font-size: 1.6rem; flex-shrink: 0; }

.epi-stat-pill-body {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
}

.epi-stat-pill-val {
    font-size: 0.95rem;
    font-weight: 800;
    color: #1e293b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.epi-stat-pill-lbl {
    font-size: 0.65rem;
    font-weight: 700;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.epi-stat-pill-sub {
    font-size: 0.6rem;
    color: #94a3b8;
    font-weight: 500;
}

/* RESPONSIVE */
@media (max-width: 900px) {
    .epi-cards-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
    .epi-bottom-row { flex-direction: column; }
    .epi-chart-panel, .epi-ranking-panel { min-width: unset; }
    .epi-stat-row { grid-template-columns: 1fr 1fr; }
    .epi-section-title { font-size: 1.2rem; }
}
/* TOGGLE SWITCH STYLES */
.map-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border-bottom: 1px solid #e2e8f0;
}

.toggle-switch {
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 20px;
    background-color: #ccc;
    border-radius: 20px;
    transition: .4s;
}

.slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 2px;
    bottom: 2px;
    background-color: white;
    border-radius: 50%;
    transition: .4s;
}

input:checked + .slider {
    background-color: #0f69b4;
}

input:checked + .slider:before {
    transform: translateX(20px);
}

/* EXECUTIVE GOLD STYLES */
.main-val {
    font-size: 2.2rem;
    font-weight: 900;
    color: var(--minsal-blue-dark);
    line-height: 1;
}

.sub-vals {
    font-size: 0.75rem;
    color: #64748b;
    margin-top: 5px;
    font-weight: 500;
}

.sub-vals b {
    color: #1e293b;
}

.secondary-val {
    font-size: 1.1rem;
    font-weight: 700;
    color: #1e293b;
    line-height: 1.3;
}

.section-title {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
    border-bottom: 2px dashed #e2e8f0;
    padding-bottom: 0.5rem;
}

.icon-pueblos {
    font-size: 2rem;
    background: rgba(15, 105, 180, 0.05);
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
}

.footer-executive {
    margin-top: 3rem;
    padding: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
    color: #64748b;
}

.badge-v {
    background: #1e3a8a;
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-weight: 700;
    font-size: 0.65rem;
}

.badge-ocurrencia {
    font-size: 0.7rem;
    background: #f0f9ff;
    color: #0369a1;
    padding: 2px 10px;
    border-radius: 10px;
    border: 1px solid #bae6fd;
    font-weight: 700;
    vertical-align: middle;
    margin-left: 10px;
}

/* TACTICAL MAP OVERLAYS */
.map-tactical-panel {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 1000;
    width: 200px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(8px);
    padding: 15px;
    border-radius: 15px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.15);
    border: 1px solid rgba(15, 105, 180, 0.2);
}

.map-legend { margin-top: 10px; }
.legend-item { display: flex; align-items: center; gap: 8px; font-size: 0.75rem; font-weight: 600; color: #475569; margin-bottom: 6px; }
.dot { width: 10px; height: 10px; border-radius: 50%; }
.dot.green { background: #10b981; }
.dot.yellow { background: #fbbf24; }
.dot.red { background: #ef4444; }

@keyframes pulse-red {
    0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7); }
    70% { transform: scale(1.1); box-shadow: 0 0 0 10px rgba(239, 68, 68, 0); }
    100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

.pulse-marker-ef4444 {
    animation: pulse-red 2s infinite;
}

/* ── FORMATO DE IMPRESIÓN (PDF / PAPEL) ── */
@media print {
    @page {
        size: landscape;
        margin: 1cm;
    }

    /* Forzar que los colores de fondo y gráficos se impriman */
    * {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
        box-shadow: none !important;
        text-shadow: none !important;
    }

    /* Tipografía formal de libro para todo el documento */
    body {
        background: white !important;
        color: black !important;
        margin: 0 !important;
        padding: 0 !important;
        font-family: 'Georgia', 'Times New Roman', serif !important;
    }

    h1, h2, h3, h4, .subtitle, .badge-ocurrencia {
        font-family: 'Georgia', 'Times New Roman', serif !important;
        color: #1e293b !important;
    }

    .dashboard-container {
        padding: 0 !important;
        max-width: 100% !important;
        margin: 0 !important;
        background: none !important;
    }

    /* ── 1. PORTADA FORMAL (Cover Page) ── */
    header {
        height: 90vh !important;
        display: flex !important;
        flex-direction: column !important;
        justify-content: center !important;
        align-items: center !important;
        text-align: center !important;
        border-bottom: none !important;
    }

    header h1 {
        font-size: 3.5rem !important;
        border-bottom: 3px solid #1e293b !important;
        padding-bottom: 1.5rem !important;
        margin-bottom: 1.5rem !important;
        text-transform: uppercase;
        letter-spacing: 2px;
    }

    header .subtitle {
        font-size: 1.5rem !important;
        color: #475569 !important;
    }

    /* ── 2. SEPARACIÓN DE CAPÍTULOS ── */
    /* Dejar que el contenido fluya para no dejar páginas vacías, 
       pero evitar que los bloques grandes se partan a la mitad */
    .kpi-grid, .mission-control-row, .epi-section, section:has(.pueblos-grid-container), .minsal-border {
        page-break-inside: avoid !important;
        margin-bottom: 0.5cm !important;
    }
    
    .table-section {
        height: auto !important;
        max-height: none !important;
    }

    /* Ocultar elementos interactivos, botones de exportar y visitas */
    .header-actions,
    .btn-export,
    .panel-close,
    #mapSidePanel,
    #visitModal,
    [title="Detalle visitas"],
    .leaflet-control-zoom,
    div[style*="justify-content: flex-end"] {
        display: none !important;
    }

    /* ── LÓGICA: IMPRIMIR SOLO LA TABLA ── */
    body.print-table-only header,
    body.print-table-only section:not(.table-section),
    body.print-table-only .epi-section,
    body.print-table-only .minsal-border,
    body.print-table-only div[style*="justify-content: flex-end"] {
        display: none !important;
    }

    body.print-table-only .table-section {
        page-break-before: auto !important;
        padding-top: 0 !important;
    }

    /* Convertir "Glassmorphism" a bloques sólidos y limpios */
    .glass {
        background: transparent !important;
        border: none !important;
        backdrop-filter: none !important;
        box-shadow: none !important;
        margin-bottom: 20px !important;
    }

    /* Ajustar las grillas para que entren en la página A4 apaisada */
    .kpi-grid,
    .charts-grid {
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        gap: 15px !important;
    }
    
    .kpi-card {
        flex: 1 1 auto !important;
        margin-bottom: 0 !important;
        border: 1px solid #cbd5e1 !important;
        border-radius: 4px !important;
    }
    
    .chart-card {
        flex: 1 1 50% !important;
        border: 1px solid #cbd5e1 !important;
        border-radius: 4px !important;
    }

    /* Evitar cortes a mitad de página en elementos críticos */
    canvas, .epi-chart-full, tr, .kpi-card, .chart-card {
        page-break-inside: avoid !important;
        break-inside: avoid !important;
    }

    h1, h2, h3, h4, h5, h6, .section-title, .epi-section-header, .table-header {
        page-break-after: avoid !important;
        break-after: avoid !important;
    }
    }
    
    #territoryMap {
        height: 380px !important;
        border: 1px solid #94a3b8 !important;
    }
    
    /* Compactar la sección de Pueblos para que entre en la misma página */
    .pueblos-grid-container {
        grid-template-columns: repeat(5, 1fr) !important;
        gap: 8px !important;
    }
    .pueblos-card {
    body.print-table-only .charts-grid,
    body.print-table-only .mission-control-row,
    body.print-table-only .epi-section,
    body.print-table-only .epi-section + section {
        display: none !important;
    }

    body.print-table-only header .header-actions,
    body.print-table-only .table-header button {
        display: none !important;
    }

    body.print-table-only .table-section {
        page-break-before: auto !important;
        break-before: auto !important;
        margin-top: 20px !important;
    }
}
