:root {
    --stats-bg: var(--bg, #1a1b1e);
    --stats-surface: var(--bg-surface, #242529);
    --stats-border: var(--border, #3a3b40);
    --stats-text: var(--text, #e4e4e7);
    --stats-muted: var(--text-secondary, #b0b0b8);
    --stats-accent: var(--primary, #9147ff);
}

html, body {
    background: var(--stats-bg);
    color: var(--stats-text);
}

.stats-page {
    min-height: 100vh;
    padding: 14px;
}

.stats-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
}

.stats-header h1 {
    font-size: 20px;
    margin: 0;
}

.stats-back {
    color: var(--stats-muted);
    text-decoration: none;
    font-size: 13px;
    border: 1px solid var(--stats-border);
    border-radius: 8px;
    padding: 6px 10px;
}

.stats-back:hover {
    color: var(--stats-text);
    border-color: var(--stats-accent);
}

.stats-header-links {
    display: flex;
    align-items: center;
    gap: 10px;
}

.stats-header-links a {
    color: var(--stats-muted);
    text-decoration: none;
    font-size: 13px;
}

.stats-header-links a:hover {
    color: var(--stats-text);
}

.stats-content {
    display: grid;
    gap: 14px;
}

.stats-cards {
    display: grid;
    grid-template-columns: repeat(4, minmax(150px, 1fr));
    gap: 10px;
}

.stats-card {
    border: 1px solid var(--stats-border);
    background: var(--stats-surface);
    border-radius: 10px;
    padding: 12px;
}

.stats-card-label {
    color: var(--stats-muted);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.7px;
    margin-bottom: 8px;
}

.stats-card-value {
    font-size: 22px;
    font-weight: 700;
    color: var(--stats-text);
}

.stats-section {
    border: 1px solid var(--stats-border);
    background: var(--stats-surface);
    border-radius: 10px;
    padding: 12px;
}

.stats-section-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 10px;
}

.stats-section h2 {
    margin: 0;
    font-size: 15px;
}

.stats-meta {
    color: var(--stats-muted);
    font-size: 11px;
}

.stats-table-wrap {
    overflow: auto;
}

.stats-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.stats-table th,
.stats-table td {
    border-bottom: 1px solid var(--stats-border);
    padding: 9px 8px;
    text-align: left;
}

.stats-table th {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.7px;
    color: var(--stats-muted);
}

.stats-empty {
    color: var(--stats-muted);
    text-align: center;
}

.stats-footnote {
    margin-top: 10px;
    color: var(--stats-muted);
    font-size: 12px;
}

.stats-error {
    border: 1px solid #ef4444;
    background: rgba(239, 68, 68, 0.12);
    color: #fecaca;
    border-radius: 10px;
    padding: 12px;
}

@media (max-width: 980px) {
    .stats-cards {
        grid-template-columns: repeat(2, minmax(140px, 1fr));
    }
}

@media (max-width: 620px) {
    .stats-header {
        flex-wrap: wrap;
    }

    .stats-cards {
        grid-template-columns: 1fr;
    }
}
