/* Daily statistics in the admin panel. Series colors were checked with the palette
   validator against the panel surface #0d0f16 for color-blind separation and contrast. */
.stats-root {
    --series-1: #3987e5;
    --series-2: #d95926;
    --stats-grid: rgba(242, 238, 230, 0.09);
    --stats-critical: #e66767;
    min-width: 0;
}

.stats-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
    margin-bottom: 1rem;
}

.stats-date {
    width: auto;
    color-scheme: dark;
}

.stats-summary {
    display: grid;
    gap: 0.45rem;
    margin: 0;
    padding: 1rem 1.1rem 1rem 2.1rem;
    line-height: 1.5;
}

.stats-warning {
    list-style: none;
    margin-left: -1rem;
    color: var(--color-text);
}

.stats-warning span {
    color: var(--stats-critical);
}

.stats-chart-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 22rem), 1fr));
    gap: 1.25rem;
    padding: 1rem 1.1rem;
}

.stats-chart {
    min-width: 0;
    margin: 0;
}

.stats-chart-heading {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem 0.75rem;
    align-items: baseline;
    justify-content: space-between;
    min-height: 2.6rem;
    margin-bottom: 0.35rem;
}

.stats-chart-heading strong {
    font-size: 0.92rem;
}

.stats-readout {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 0.2rem 0.65rem;
    align-items: center;
    color: var(--color-text-muted);
    font-size: 0.8rem;
}

.stats-readout b {
    color: var(--color-text);
}

.stats-readout-item {
    display: inline-flex;
    gap: 0.3rem;
    align-items: center;
}

.stats-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem 0.9rem;
    margin-bottom: 0.4rem;
    color: var(--color-text-muted);
    font-size: 0.78rem;
}

.stats-legend > span {
    display: inline-flex;
    gap: 0.35rem;
    align-items: center;
}

.stats-line-key {
    display: inline-block;
    width: 0.9rem;
    height: 2px;
    border-radius: 1px;
}

.stats-swatch {
    display: inline-block;
    width: 0.65rem;
    height: 0.65rem;
    border-radius: 2px;
}

.stats-chart-empty {
    margin: 0;
    padding: 1.5rem 1.1rem;
    color: var(--color-text-muted);
    font-size: 0.86rem;
}

.stats-plot {
    display: grid;
    grid-template-columns: 2.9rem minmax(0, 1fr);
    gap: 0.4rem;
}

.stats-y-axis {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 9.5rem;
    color: var(--color-text-subtle);
    font-size: 0.7rem;
    line-height: 1;
    text-align: right;
}

.stats-plot-area {
    min-width: 0;
}

.stats-plot-area svg {
    display: block;
    width: 100%;
    height: 9.5rem;
    overflow: visible;
    touch-action: pan-y;
}

.stats-grid-line {
    stroke: var(--stats-grid);
    stroke-width: 1;
    vector-effect: non-scaling-stroke;
}

.stats-line {
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    vector-effect: non-scaling-stroke;
    pointer-events: none;
}

.stats-dot {
    fill: none;
    stroke-width: 8;
    stroke-linecap: round;
    vector-effect: non-scaling-stroke;
    pointer-events: none;
}

.stats-crosshair {
    stroke: var(--color-text-muted);
    stroke-width: 1;
    vector-effect: non-scaling-stroke;
    pointer-events: none;
}

.stats-hit {
    fill: transparent;
}

.stats-x-axis {
    display: flex;
    justify-content: space-between;
    margin-top: 0.3rem;
    color: var(--color-text-subtle);
    font-size: 0.7rem;
}

.stats-columns {
    display: flex;
    gap: 2px;
    align-items: stretch;
    height: 9.5rem;
    border-bottom: 1px solid var(--stats-grid);
    background: linear-gradient(var(--stats-grid), var(--stats-grid)) 0 0 / 100% 1px no-repeat,
        linear-gradient(var(--stats-grid), var(--stats-grid)) 0 50% / 100% 1px no-repeat;
}

.stats-column {
    display: flex;
    flex: 1 1 0;
    flex-direction: column;
    gap: 2px;
    align-items: center;
    justify-content: flex-end;
    min-width: 0;
    padding: 0;
    border: 0;
    background: transparent;
    cursor: default;
}

.stats-column:hover,
.stats-column.active,
.stats-column:focus-visible {
    outline: none;
    background: rgba(242, 238, 230, 0.06);
}

.stats-segment {
    display: block;
    width: 100%;
    max-width: 24px;
}

.stats-segment:first-child {
    border-radius: 4px 4px 0 0;
}

.stats-bars {
    display: grid;
    gap: 0.5rem;
    padding: 1rem 1.1rem;
}

.stats-bar-row {
    display: grid;
    grid-template-columns: minmax(8rem, 15rem) minmax(0, 1fr) 3.5rem;
    gap: 0.6rem;
    align-items: center;
    font-size: 0.86rem;
}

.stats-bar-track {
    display: block;
    min-width: 0;
}

.stats-bar {
    display: block;
    min-width: 2px;
    height: 0.8rem;
    border-radius: 0 4px 4px 0;
    background: var(--series-1);
}

.stats-bar-value {
    font-variant-numeric: tabular-nums;
    text-align: right;
}

.stats-details {
    padding: 0 1.1rem 1rem;
}

.stats-details summary {
    margin-bottom: 0.5rem;
    color: var(--color-gold);
    cursor: pointer;
}

@media (max-width: 520px) {
    .stats-bar-row {
        grid-template-columns: minmax(0, 1fr) 3.5rem;
    }

    .stats-bar-label {
        grid-column: 1 / -1;
    }

    .stats-bar-track {
        grid-column: 1;
    }
}
