/* retoor <retoor@molodetz.nl> */

.statistics-toolbar {
    flex-wrap: wrap;
    align-items: flex-start;
    gap: var(--space-md);
}

.statistics-toolbar h2 {
    flex: 1 1 auto;
    min-width: 8rem;
}

.statistics-controls {
    flex: 1 1 16rem;
    min-width: 0;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: var(--space-sm) var(--space-lg);
}

.statistics-controls-primary {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-sm) var(--space-lg);
}

.statistics-controls label,
.statistics-compare-label {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
}

.statistics-compare-label span {
    white-space: normal;
    line-height: 1.35;
}

.statistics-generated {
    flex: 1 1 12rem;
    margin-left: 0;
    font-size: 0.75rem;
    color: var(--text-muted);
    text-align: right;
    white-space: normal;
    word-break: break-word;
    line-height: 1.35;
}

@media (max-width: 768px) {
    .statistics-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .statistics-controls {
        justify-content: flex-start;
    }

    .statistics-generated {
        flex-basis: 100%;
        text-align: left;
    }
}

.statistics-section {
    margin: var(--space-xl) 0;
}

.statistics-section h3 {
    margin: 0 0 var(--space-sm);
    font-size: 0.9375rem;
    color: var(--text-primary);
}

.statistics-delta {
    font-size: 0.6875rem;
    font-weight: 600;
    margin-top: 0.125rem;
}

.statistics-delta.up {
    color: var(--success);
}

.statistics-delta.down {
    color: var(--danger);
}

.statistics-delta.flat {
    color: var(--text-muted);
}

.statistics-charts {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-md);
    margin-bottom: var(--space-md);
}

@media (max-width: 767px) {
    .statistics-charts {
        grid-template-columns: 1fr;
    }
}

.statistics-chart-panel {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: var(--space-md);
    min-height: 16rem;
    display: flex;
    flex-direction: column;
}

.statistics-chart-panel h4 {
    margin: 0 0 var(--space-sm);
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.statistics-chart-wrap {
    position: relative;
    flex: 1;
    min-height: 12rem;
}

.statistics-breakdowns-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: var(--space-md);
}

.statistics-table-panel {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    display: flex;
    flex-direction: column;
    min-width: 0;
    overflow: hidden;
}

.statistics-table-panel.is-wide {
    grid-column: 1 / -1;
}

.statistics-table-panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-sm);
    padding: var(--space-md) var(--space-md) var(--space-sm);
    border-bottom: 1px solid var(--border);
}

.statistics-table-panel-head h4 {
    margin: 0;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.statistics-table-panel-count {
    font-size: 0.6875rem;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.statistics-table-panel .admin-table-wrap {
    overflow: visible;
    max-height: none;
}

.statistics-table-panel .admin-table td.statistics-col-name {
    font-weight: 600;
    color: var(--text-primary);
}

.statistics-table-panel .admin-table td.statistics-col-key {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--text-primary);
}

.statistics-table-panel .admin-table th.statistics-col-num,
.statistics-table-panel .admin-table td.statistics-col-num {
    text-align: right;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.statistics-table-panel .admin-table td.statistics-col-num {
    font-weight: 600;
    color: var(--text-primary);
}

.statistics-table-panel .admin-table th.statistics-col-text,
.statistics-table-panel .admin-table td.statistics-col-text {
    color: var(--text-secondary);
}

.statistics-note {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin: var(--space-sm) 0 var(--space-lg);
}

.statistics-link {
    font-size: 0.8125rem;
    color: var(--accent);
}

.statistics-link:hover {
    color: var(--accent-hover);
}