.statistics-page {
    gap: 18px;
}

.statistics-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.statistics-header h1 {
    margin-bottom: 4px;
}

.statistics-header p {
    margin-top: 0;
    color: #52606d;
}

.statistics-status {
    min-width: 150px;
    padding: 8px 10px;
    border: 1px solid rgba(31, 41, 51, 0.18);
    border-radius: 8px;
    color: #334155;
    background: #f8fafc;
    text-align: center;
}

.statistics-status[data-tone="error"] {
    color: #991b1b;
    background: #fef2f2;
    border-color: #fecaca;
}

.statistics-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.statistics-panel {
    min-width: 0;
    padding: 14px;
    border: 1px solid rgba(31, 41, 51, 0.14);
    border-radius: 8px;
    background: #f8fafc;
}

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

.statistics-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 34px;
    margin-bottom: 10px;
}

.statistics-panel-header h2 {
    margin: 0;
    font-size: 1.2rem;
}

.statistics-kpi {
    flex-shrink: 0;
    padding: 5px 8px;
    border-radius: 6px;
    background: rgba(37, 99, 235, 0.1);
    color: #1d4ed8;
    font-size: 0.95rem;
    font-weight: 700;
}

.statistics-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.statistics-season-stepper {
    display: grid;
    grid-template-columns: 34px minmax(120px, 180px) 34px;
    gap: 6px;
}

.statistics-actions button,
.statistics-panel-header-actions select {
    max-width: 180px;
    padding: 6px 8px;
    border: 1px solid rgba(31, 41, 51, 0.24);
    border-radius: 6px;
    background: #ffffff;
    color: #1f2933;
}

.statistics-season-stepper button {
    width: 34px;
    max-width: 34px;
    font-weight: 700;
}

.statistics-season-stepper button:disabled {
    opacity: 0.45;
    cursor: default;
}

.statistics-actions button {
    cursor: pointer;
}

.statistics-actions button[aria-pressed="true"] {
    background: #2563eb;
    border-color: #2563eb;
    color: #ffffff;
}

.statistics-chart-frame {
    position: relative;
    height: 360px;
}

.statistics-chart-frame-small {
    height: 320px;
}

.statistics-chart-frame-tall {
    height: 560px;
}

.statistics-chart-frame canvas {
    width: 100% !important;
    height: 100% !important;
}

body.dark .statistics-header p {
    color: rgba(221, 224, 238, 0.72);
}

body.dark .statistics-status {
    color: #dde0ee;
    background: #252540;
    border-color: rgba(255, 255, 255, 0.12);
}

body.dark .statistics-status[data-tone="error"] {
    color: #fecaca;
    background: #451a1a;
    border-color: rgba(254, 202, 202, 0.24);
}

body.dark .statistics-panel {
    background: #1e2035;
    border-color: rgba(255, 255, 255, 0.12);
}

body.dark .statistics-kpi {
    background: rgba(96, 165, 250, 0.16);
    color: #93c5fd;
}

body.dark .statistics-actions button,
body.dark .statistics-panel-header-actions select {
    color: #dde0ee;
    background: #12121f;
    border-color: rgba(255, 255, 255, 0.18);
}

body.dark .statistics-actions button[aria-pressed="true"] {
    color: #ffffff;
    background: #3b82f6;
    border-color: #3b82f6;
}

@media only screen and (max-width: 850px) {
    .statistics-header {
        flex-direction: column;
    }

    .statistics-status {
        width: 100%;
        box-sizing: border-box;
    }

    .statistics-grid {
        grid-template-columns: 1fr;
    }
}

@media only screen and (max-width: 520px) {
    .statistics-panel {
        padding: 10px;
    }

    .statistics-panel-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .statistics-actions {
        width: 100%;
        flex-direction: column;
        align-items: stretch;
    }

    .statistics-season-stepper {
        width: 100%;
        grid-template-columns: 34px minmax(0, 1fr) 34px;
    }

    .statistics-actions button,
    .statistics-panel-header-actions select {
        width: 100%;
        max-width: none;
    }

    .statistics-chart-frame,
    .statistics-chart-frame-small {
        height: 300px;
    }

    .statistics-chart-frame-tall {
        height: 620px;
    }
}
