.stats-section {
    background: white;
    border: 1px solid #E2E8F0;
    border-radius: 1rem;
    padding: 2rem;
    margin-bottom: 1.5rem;
}
.stats-section-title {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: 1.25rem;
    color: #086F48;
    margin-bottom: 0.25rem;
}
.stats-section-desc {
    font-size: 0.875rem;
    color: #64748B;
    margin-bottom: 1.5rem;
}

/* ==========================================
   MAPA DE CALOR - DESIGN REINVENTADO
   ========================================== */

/* Container principal */
.heatmap-container {
    background: #F1F5F9;
    border-radius: 20px;
    padding: 1.5rem;
    margin-top: 1rem;
}

/* Cabeçalho do mapa com estatísticas rápidas */
.heatmap-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}
.heatmap-stats {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
}
.heatmap-stat {
    text-align: center;
}
.heatmap-stat-value {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.5rem;
    font-weight: 700;
    color: #086F48;
}
.heatmap-stat-label {
    font-size: 0.7rem;
    color: #64748B;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
}

/* Filtros */
.heatmap-filters {
    display: flex;
    gap: 8px;
}
.hm-filter-btn {
    padding: 8px 16px;
    border-radius: 999px;
    border: 1px solid #E2E8F0;
    background: white;
    font-size: 0.8rem;
    font-weight: 600;
    color: #64748B;
    cursor: pointer;
    transition: all 0.2s ease;
}
.hm-filter-btn:hover {
    border-color: #FBBF24;
    color: #FBBF24;
}
.hm-filter-btn.active {
    background: #FBBF24;
    border-color: #FBBF24;
    color: #086F48;
}

/* Grid de números - layout flexível */
.hm-numbers-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    padding: 1rem 0;
}

/* Cada número é um "pill" moderno */
.hm-pill {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 52px;
    height: 42px;
    padding: 0 12px;
    border-radius: 12px;
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    border: 2px solid transparent;
}
.hm-pill:hover {
    transform: translateY(-4px) scale(1.08);
    z-index: 10;
}
.hm-pill.selected {
    border-color: #D97706;
    box-shadow: 0 0 0 4px rgba(251, 191, 36, 0.15);
}

/* Indicador de atraso (ponto) */
.hm-delay-dot {
    position: absolute;
    top: -4px;
    right: -4px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.15);
}

/* Card de detalhes - design reestruturado */
.hm-detail-card {
    display: none;
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.1);
    margin-top: 1.5rem;
    overflow: hidden;
    animation: cardReveal .35s cubic-bezier(0.4, 0, 0.2, 1);
}
.hm-detail-card.visible { display: block; }
@keyframes cardReveal {
    from { opacity: 0; transform: translateY(-20px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

/* Header do card com gradiente dinâmico */
.hm-detail-header {
    display: flex;
    align-items: stretch;
    background: #086F48;
    position: relative;
    overflow: hidden;
}
.hm-detail-header::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 200px;
    height: 100%;
    background: none;
}

/* Lado esquerdo: número grande */
.hm-detail-num-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem 2.5rem;
    border-right: 1px solid rgba(255,255,255,0.1);
    min-width: 160px;
}
.hm-detail-num {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 4.5rem;
    font-weight: 700;
    line-height: 1;
    color: white;
    text-shadow: 0 4px 20px rgba(0,0,0,0.3);
}
.hm-detail-label {
    font-size: 0.75rem;
    color: rgba(255,255,255,0.5);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-weight: 600;
    margin-top: 8px;
}

/* Lado direito: info */
.hm-detail-info-section {
    flex: 1;
    padding: 1.5rem 2rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
}
.hm-detail-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-bottom: 12px;
    width: fit-content;
}
.hm-detail-status-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: white;
    margin-bottom: 6px;
}
.hm-detail-status-sub {
    font-size: 0.85rem;
    color: rgba(255,255,255,0.6);
}
.hm-detail-close {
    position: absolute;
    top: 12px;
    right: 12px;
    background: rgba(255,255,255,0.1);
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}
.hm-detail-close:hover {
    background: rgba(255,255,255,0.2);
    transform: scale(1.05);
}

/* Corpo do card: métricas */
.hm-detail-body {
    padding: 1.5rem 2rem;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    background: #F8FAFC;
}
.hm-metric {
    background: white;
    border-radius: 14px;
    padding: 1.25rem;
    text-align: center;
    border: 1px solid #E2E8F0;
    transition: all 0.2s;
}
.hm-metric:hover {
    border-color: #CBD5E1;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}
.hm-metric-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 0.75rem;
    font-size: 1.2rem;
}
.hm-metric-value {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.75rem;
    font-weight: 700;
    color: #086F48;
    line-height: 1.1;
}
.hm-metric-label {
    font-size: 0.7rem;
    color: #64748B;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 600;
    margin-top: 6px;
}

/* Barra de progresso dentro do card */
.hm-progress-bar {
    height: 6px;
    background: #E2E8F0;
    border-radius: 999px;
    margin-top: 10px;
    overflow: hidden;
}
.hm-progress-fill {
    height: 100%;
    border-radius: 999px;
    transition: width 0.5s ease;
}

/* Seção de contexto adicional */
.hm-detail-context {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1px;
    background: #E2E8F0;
    border-top: 1px solid #E2E8F0;
}
.hm-context-item {
    background: white;
    padding: 1rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 12px;
}
.hm-context-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.hm-context-text {
    flex: 1;
}
.hm-context-label {
    font-size: 0.7rem;
    color: #64748B;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
}
.hm-context-value {
    font-size: 0.9rem;
    color: #086F48;
    font-weight: 600;
    margin-top: 2px;
}

/* Legenda do mapa */
.hm-legend {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2rem;
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid #E2E8F0;
    flex-wrap: wrap;
}
.hm-legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
    color: #64748B;
}
.hm-legend-color {
    width: 24px;
    height: 24px;
    border-radius: 6px;
}
.hm-legend-gradient {
    display: flex;
    border-radius: 6px;
    overflow: hidden;
}
.hm-legend-gradient span {
    width: 20px;
    height: 24px;
}

/* Tooltip minimalista */
.hm-tooltip {
    display: none;
    position: fixed;
    z-index: 9999;
    background: #086F48;
    color: white;
    border-radius: 10px;
    padding: 10px 14px;
    font-size: 0.8rem;
    pointer-events: none;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    white-space: nowrap;
}
.hm-tooltip.visible { display: block; }
.hm-tooltip-num {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: 1rem;
}
.hm-tooltip-info {
    color: #94A3B8;
    margin-top: 2px;
}

/* Responsivo */
@media (max-width: 768px) {
    .heatmap-header {
        flex-direction: column;
        align-items: flex-start;
    }
    .hm-numbers-grid {
        gap: 6px;
    }
    .hm-pill {
        min-width: 44px;
        height: 36px;
        font-size: 0.85rem;
    }
    .hm-detail-body {
        grid-template-columns: repeat(2, 1fr);
    }
    .hm-legend {
        gap: 1rem;
    }
    /* Card responsivo */
    .hm-detail-header {
        flex-direction: column;
    }
    .hm-detail-num-section {
        border-right: none;
        border-bottom: 1px solid rgba(255,255,255,0.1);
        padding: 1.5rem;
    }
    .hm-detail-num {
        font-size: 3.5rem;
    }
    .hm-detail-info-section {
        padding: 1.25rem 1.5rem;
    }
    .hm-detail-context {
        grid-template-columns: 1fr;
    }
    .stats-section { padding: 1.25rem; }
    .hm-legend { gap: 0.75rem; }
    .hm-legend-item { font-size: 0.7rem; }
}

/* Bar */
.stat-bar-track { background: #F1F5F9; border-radius: 999px; height: 10px; overflow: hidden; }
.stat-bar-fill { height: 100%; border-radius: 999px; transition: width .4s ease; }
.stat-bar-fill.blue { background: #FBBF24; }
.stat-bar-fill.red { background: #EF4444; }
.stat-bar-fill.green { background: #10B981; }
.stat-bar-fill.amber { background: #F59E0B; }

/* Metric card */
.metric-card {
    background: #F8FAFC;
    border-radius: 12px;
    padding: 1.25rem;
    text-align: center;
}
.metric-label { font-size: 0.75rem; color: #64748B; text-transform: uppercase; letter-spacing: .05em; font-weight: 600; }
.metric-value { font-family: 'Space Grotesk', sans-serif; font-size: 1.5rem; font-weight: 700; margin-top: 4px; }

/* Delay badge */
.delay-badge {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}
.delay-badge .delay-num {
    width: 52px; height: 52px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 12px; font-weight: 700; font-size: 1rem;
}
.delay-badge .delay-text { font-size: 0.7rem; color: #64748B; }

@media (max-width: 768px) {
    .hm-grid { grid-template-columns: repeat(5, 1fr) !important; }
    .hm-cell { font-size: 0.85rem; }
    .hm-cell .hm-info { display: none; }
    .stats-section { padding: 1.25rem; }
}

@media (max-width: 768px) {
    .stats-grid-2col { grid-template-columns: 1fr !important; }
    .stats-grid-4col { grid-template-columns: repeat(2, 1fr) !important; }
}

@media (max-width: 640px) {
    .hm-detail-num-section { padding: 1rem; }
    .hm-detail-num { font-size: 2.5rem; }
    .hm-detail-info-section { padding: 1rem 1.25rem; }
    .hm-detail-body { padding: 1rem; }
    .hm-detail-context { padding: 0; }
    .hm-metric { padding: 0.875rem; }
    .hm-metric-value { font-size: 1.25rem; }
    .hm-detail-status-title { font-size: 1.1rem; }
}
@media (max-width: 480px) {
    .hm-pill { min-width: 36px; height: 30px; font-size: 0.75rem; padding: 0 6px; }
    .hm-numbers-grid { gap: 4px; }
}
