body {
    margin: 0;
    background: #f4f7fb;
    font-family: Arial, sans-serif;
}

.muted {
    color: #52607a;
}

button,
.button {
    appearance: none;
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 0.65rem 1rem;
    border: 0;
    border-radius: 8px;
    background: #1c7cd6;
    color: #fff;
    cursor: pointer;
    font-family: Arial, sans-serif;
    font-size: 0.95rem;
    font-weight: 600;
    line-height: 1.2;
    text-align: center;
    text-decoration: none;
}

.button.primary {
    background: #1c7cd6;
}

.button.edit {
    background: #0f8c7b;
}

.button.secondary {
    background: #475467;
}

.button.delete {
    background: #d92d20;
}

.button.logout-button {
    background: #e11d48;
}

button:hover,
.button:hover {
    filter: brightness(0.93);
}

button:focus-visible,
.button:focus-visible {
    outline: 3px solid #98c7f3;
    outline-offset: 2px;
}

button:disabled {
    cursor: not-allowed;
    opacity: 0.6;
}

.statistics-brand-link { color: #fff; font-weight: 700; text-decoration: none; }
.logo { width: 120px; border-radius: 35px; }
.dashboard-topbar { background: #163d66; color: #fff; padding: 1rem 2rem; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 1rem; }
.dashboard-topbar > div:first-child { justify-self: start; }
.dashboard-topbar > span { justify-self: center; font-weight: 600; }
.dashboard-topbar > div:last-child { display: flex; align-items: center; justify-self: end; gap: 0.75rem; }
.data-warning { margin: 1rem 0; padding: 1rem; border: 1px solid #f0b429; border-radius: 8px; background: #fff8e1; color: #6b4e00; }
.statistics-page { width: 90%; max-width: none; margin: 0 auto; padding: clamp(1rem, 3vw, 2rem); box-sizing: border-box; }
.statistics-page .card { background: #fff; border: 1px solid #e3ebf5; border-radius: 12px; padding: 1rem 1.25rem; margin-bottom: 1rem; }
.statistics-heading, .statistics-section-heading { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.statistics-heading { margin-bottom: 1.25rem; }
.statistics-heading h1, .statistics-section-heading h2, .statistics-section-heading p { margin-top: 0; }
.eyebrow { margin-bottom: 0.35rem; color: #1c7cd6; font-size: 0.78rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; }
.statistics-filters { display: flex; align-items: end; gap: 1rem; flex-wrap: wrap; }
.statistics-filters label { display: grid; gap: 0.35rem; min-width: 170px; font-weight: 600; }
.statistics-filters select, .statistics-search { box-sizing: border-box; min-height: 42px; padding: 0.65rem 0.75rem; border: 1px solid #cbd5e1; border-radius: 8px; background: #fff; font: inherit; }
.statistics-grid { display: grid; gap: 1rem; }
.statistics-summary { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); margin: 1.25rem 0; }
.statistic-card { display: flex; min-height: 105px; flex-direction: column; gap: 0.3rem; justify-content: center; margin-bottom: 0; }
.statistic-card strong { color: #163d66; font-size: 2rem; }
.statistic-card small { color: #52607a; }
.statistics-section { margin-bottom: 1.25rem; }
.statistics-diagnostics { margin-bottom: 1.25rem; }
.statistics-diagnostics summary { margin-top: 0.75rem; cursor: pointer; color: #163d66; font-weight: 600; }
.statistics-diagnostics-table { min-width: 560px; margin-top: 0.75rem; }
.statistics-status { display: inline-block; padding: 0.25rem 0.5rem; border-radius: 999px; font-size: 0.8rem; font-weight: 700; }
.statistics-status-used { background: #dcfce7; color: #166534; }
.statistics-status-ignored { background: #fef3c7; color: #92400e; }
.statistics-badge { padding: 0.4rem 0.7rem; border-radius: 999px; background: #e8f1fb; color: #163d66; font-size: 0.85rem; white-space: nowrap; }
.statistics-table-wrapper { overflow-x: auto; }
.statistics-table { width: 100%; min-width: 680px; border-collapse: collapse; }
.statistics-table th, .statistics-table td { padding: 0.7rem 0.6rem; border-bottom: 1px solid #e3ebf5; text-align: left; vertical-align: middle; }
.statistics-table th { color: #52607a; font-size: 0.82rem; white-space: nowrap; }
.statistics-sortable-header { cursor: pointer; user-select: none; }
.statistics-sortable-header::after { content: ' ↕'; color: #9aa8bc; }
.statistics-sortable-header[data-sort-direction="ascending"]::after { content: ' ↑'; color: #1f5f9f; }
.statistics-sortable-header[data-sort-direction="descending"]::after { content: ' ↓'; color: #1f5f9f; }
.statistics-table tbody tr:hover { background: #f9fbff; }
.statistics-table tr[hidden] { display: none; }
.button-small { min-height: 32px; padding: 0.4rem 0.65rem; font-size: 0.82rem; }
.statistics-modal { width: min(620px, calc(100vw - 2rem)); max-height: min(720px, calc(100vh - 2rem)); border: 0; border-radius: 12px; padding: 1.4rem; color: #1b2a41; box-shadow: 0 18px 60px rgba(18, 39, 71, 0.3); }
.statistics-modal::backdrop { background: rgba(15, 31, 54, 0.48); }
.statistics-modal h2 { margin: 0; }
.statistics-modal ul { margin: 1rem 0 0; padding-left: 1.2rem; }
.statistics-modal li { margin-bottom: 0.85rem; }
.statistics-modal li span { color: #52607a; }
.statistics-modal-close { position: absolute; top: 0.55rem; right: 0.7rem; border: 0; background: transparent; color: #52607a; font-size: 1.7rem; cursor: pointer; }
.statistics-columns { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.25rem; }
.statistics-section-heading .statistics-search { width: 150px; }
.statistics-mission-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.statistics-mission-grid > div { padding: 1rem; border: 1px solid #e3ebf5; border-radius: 10px; background: #f9fbff; }
.statistics-mission-grid h3 { margin-top: 0; }

@media (max-width: 900px) {
    .statistics-columns, .statistics-mission-grid { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 600px) {
    .dashboard-topbar { padding: 0.75rem 1rem; grid-template-columns: 1fr auto; }
    .dashboard-topbar > span { display: none; }
    .dashboard-topbar > div:last-child { gap: 0.4rem; }
    .dashboard-topbar .logout-button { margin-left: 0; }
    .statistics-heading, .statistics-section-heading { align-items: flex-start; flex-direction: column; }
    .statistics-section-heading .statistics-search { width: 100%; }
}

.excel-export-dialog {
    width: min(460px, calc(100vw - 2rem));
    border: 0;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.25);
}

.excel-export-dialog::backdrop {
    background: rgba(15, 30, 50, 0.55);
}

.excel-export-dialog h2 {
    margin-top: 0;
}

.excel-export-dialog-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    margin-top: 1.25rem;
}
