.stats-page {
    max-width: 1100px;
}

.stats-kpis {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.6rem;
    margin-bottom: 1.5rem;
}

.stats-kpi {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    padding: 1rem 1.25rem;
    text-align: center;
}

.stats-kpi-value {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--color-accent);
}

.stats-kpi-label {
    color: var(--color-text-muted);
    font-size: 0.85rem;
}

.stats-map {
    height: 420px;
    border-radius: 8px;
    border: 1px solid var(--color-border);
    overflow: hidden;
    margin-bottom: 1.5rem;
}

/* MapLibre popup: dark theme (default popup is bright white) */
.maplibregl-popup-content {
    background: var(--color-surface);
    color: var(--color-text);
    border-radius: 8px;
    padding: 0.5rem 0.75rem;
    font-size: 0.85rem;
}

.maplibregl-popup-tip {
    border-top-color: var(--color-surface);
}

.maplibregl-popup-close-button {
    color: var(--color-text-muted);
}

.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.6rem;
    margin-bottom: 1.5rem;
}

.stats-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    padding: 1.25rem;
}

.stats-card h2 {
    font-size: 1.05rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

.stats-card-note {
    float: right;
    font-size: 0.8rem;
    font-weight: 400;
    color: var(--color-text-muted);
}

.stats-empty {
    color: var(--color-text-muted);
    font-size: 0.9rem;
    padding: 0.5rem 0;
}

/* Breakdown bars */
.breakdown {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.bd-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 60% auto;
    align-items: center;
    gap: 0.6rem;
    font-size: 0.9rem;
}

.bd-label {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--color-text);
}

.bd-track {
    background: var(--color-border);
    border-radius: 3px;
    height: 8px;
    overflow: hidden;
}

.bd-fill {
    height: 100%;
    background: var(--color-accent);
    border-radius: 3px;
}

.bd-count {
    color: var(--color-text-muted);
    font-variant-numeric: tabular-nums;
    text-align: right;
    min-width: 3.5ch;
}

/* Weekly hour-of-day heatmap */
.heatmap {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.hm-row {
    display: flex;
    gap: 2px;
}

.hm-day {
    width: 1.4rem;
    flex-shrink: 0;
    font-size: 0.7rem;
    color: var(--color-text-muted);
    line-height: 1;
    display: flex;
    align-items: center;
}

.hm-cells {
    display: grid;
    grid-template-columns: repeat(24, 1fr);
    gap: 2px;
    flex: 1;
}

.hm-cell {
    aspect-ratio: 1;
    border-radius: 2px;
    background: rgba(108, 155, 207, 0.05);
    min-width: 0;
}

.hm-hour {
    font-size: 0.6rem;
    color: var(--color-text-muted);
    text-align: center;
    line-height: 1;
}

.hm-tooltip {
    position: absolute;
    z-index: 10;
    pointer-events: none;
    background: var(--color-surface-hover);
    border: 1px solid var(--color-border);
    border-radius: 6px;
    padding: 0.4rem 0.6rem;
    font-size: 0.8rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.hm-tooltip.hidden {
    display: none;
}

.tt-row {
    display: flex;
    gap: 0.5rem;
}

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

.tt-value {
    color: var(--color-text);
    font-variant-numeric: tabular-nums;
}

.heatmap-wrap {
    position: relative;
}

@media (max-width: 768px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
    .stats-kpis {
        grid-template-columns: 1fr;
    }
    .stats-map {
        height: 300px;
    }
}