*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body { line-height: 1.5; -webkit-font-smoothing: antialiased; }
img, picture, video { display: block; max-width: 100%; }
input, button, textarea, select { font: inherit; }
p, h1, h2, h3, h4, h5, h6 { overflow-wrap: break-word; }
a { text-decoration: none; }

:root {
    --bg: #0f0f13;
    --surface: #1a1a23;
    --surface-2: #22222e;
    --border: #2e2e3e;
    --accent: #f5a623;
    --accent-dim: rgba(245,166,35,.15);
    --text: #e8e8f0;
    --text-muted: #8888a8;
    --red: #e05555;
    --radius: 12px;
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: system-ui, -apple-system, sans-serif;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

:root:has(dialog:modal) body {
    overflow: hidden;
}

header {
    padding: 1rem 2rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 2rem;
}

header a {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--accent);
    letter-spacing: .03em;
    transition: opacity .15s;
}

header a:hover {
    opacity: .75;
}

nav {
    display: flex;
    gap: 1.5rem;
}


nav a {
    font-size: .9rem;
    font-weight: 500;
    color: var(--text-muted);
    transition: color .15s;
}

nav a:hover,
nav a.active {
    color: var(--text);
}

.nav-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--accent);
    color: #000;
    font-size: .65rem;
    font-weight: 700;
    min-width: 16px;
    height: 16px;
    border-radius: 999px;
    padding: 0 .3rem;
    margin-left: .3rem;
    vertical-align: middle;
}

main {
    flex: 1;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 3rem 1rem;
}

/* History */
.snapshots-page {
    width: 100%;
    max-width: 1200px;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.highscore-page {
    width: 100%;
    max-width: 1200px;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.highscore-page[hidden] { display: none; }

.rank-cell {
    width: 2.5rem;
    text-align: center;
    color: var(--text-muted);
}

.snapshots-table th.sortable {
    cursor: pointer;
    user-select: none;
}

.snapshots-table th.sortable:hover {
    color: var(--text);
}

.snapshots-table th.sortable::after {
    content: ' ↕';
    opacity: 0.35;
    font-size: .8em;
}

.snapshots-table th.sortable[data-sort-dir="asc"]::after {
    content: ' ↑';
    opacity: 1;
}

.snapshots-table th.sortable[data-sort-dir="desc"]::after {
    content: ' ↓';
    opacity: 1;
}

.snapshots-header {
    display: flex;
    align-items: baseline;
    gap: 1rem;
}

.header-actions {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: .5rem;
}

.snapshots-header h1,
.snapshots-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
}

.count {
    font-size: .85rem;
    color: var(--text-muted);
}

.empty {
    color: var(--text-muted);
    font-size: .9rem;
}

.empty a {
    color: var(--accent);
}

.empty-state {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.empty-state p {
    font-size: 1rem;
    color: var(--text-muted);
}

.empty-state-actions {
    display: flex;
    gap: 1rem;
}

.empty-state-actions .btn--small {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    padding: .65rem 1.25rem;
    font-size: .9rem;
    font-weight: 600;
    border-radius: var(--radius);
    transition: opacity .15s, background .15s, border-color .15s, color .15s;
}

.btn--outline {
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text-muted);
    font-weight: 600;
}

.btn--outline:hover {
    opacity: 1;
    background: var(--surface-2);
    border-color: var(--text-muted);
    color: var(--text);
}

.snapshots-table-wrap {
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.snapshots-table-wrap[hidden] { display: none; }

.snapshots-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .9rem;
}

.snapshots-table th {
    text-align: left;
    padding: .75rem 1rem;
    color: var(--text-muted);
    font-weight: 500;
    font-size: .75rem;
    text-transform: uppercase;
    letter-spacing: .05em;
    border-bottom: 1px solid var(--border);
    background: var(--surface);
    white-space: nowrap;
}

.snapshots-table td {
    padding: .75rem 1rem;
    border-bottom: 1px solid var(--border);
    color: var(--text);
    white-space: nowrap;
}

.snapshots-table tbody tr:last-child td {
    border-bottom: none;
}

.snapshots-table tbody tr:hover td {
    background: var(--surface-2);
}

.stat-cell {
    text-align: right;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.snapshots-table th.stat-cell {
    text-align: right;
}

.snapshots-table th.col-wrap {
    white-space: normal;
}

.date {
    color: var(--text-muted);
    white-space: nowrap;
}

.filename {
    font-family: 'Menlo', 'Monaco', 'Consolas', monospace;
    font-size: .8rem;
    color: var(--text-muted);
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.delta {
    font-size: .75em;
    color: #50c878;
    margin-left: .3em;
    font-weight: 500;
}

.delta--neg {
    color: var(--red);
}

/* Checkbox column */
.checkbox-cell {
    width: 1px;
    padding-left: 1rem !important;
    padding-right: .5rem !important;
}

.row-checkbox {
    accent-color: var(--accent);
    width: 15px;
    height: 15px;
    cursor: pointer;
}

.row--selected td {
    background: var(--accent-dim);
}

/* Comparison panel */
.dated-snapshots .snapshots-header {
    margin-bottom: .75rem;
}

.comparison-panel {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.comparison-panel[hidden] { display: none; }

.comparison-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.comparison-actions {
    display: flex;
    align-items: center;
    gap: .5rem;
}

.comparison-clear {
    background: none;
    border: 1px solid var(--border);
    color: var(--text-muted);
    font-size: .875rem;
    font-weight: 500;
    padding: .5rem 1.25rem;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    cursor: pointer;
    transition: color .15s, border-color .15s;
}

.comparison-clear:hover {
    color: var(--text-muted);
    border-color: var(--text-muted);
}

.comparison-title {
    font-size: .85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--text-muted);
}


.comparison-table td:first-child {
    color: var(--text-muted);
    font-size: .85rem;
}

.comparison-table .delta-col {
    text-align: center;
    padding-left: .5rem;
    padding-right: .5rem;
    color: var(--text-muted);
}

.comparison-table th.delta-col {
    padding-left: .5rem;
    padding-right: .5rem;
}

.comparison-table th small {
    display: block;
    font-weight: 400;
    font-size: .7rem;
    color: var(--text-muted);
    text-transform: none;
    letter-spacing: 0;
}

.action-cell {
    width: 1px;
    white-space: nowrap;
    padding-right: .75rem !important;
}

.btn-detail {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    background: none;
    border: 1px solid var(--border);
    color: var(--text-muted);
    font-size: .78rem;
    padding: .25rem .6rem;
    border-radius: 6px;
    white-space: nowrap;
    transition: color .15s, border-color .15s;
}

.btn-detail:hover {
    color: var(--accent);
    border-color: var(--accent);
}

.btn-detail--primary {
    font-size: .875rem;
    padding: .45rem 1rem;
    border-color: var(--accent);
    color: var(--accent);
}

.btn-detail--primary:hover {
    background: var(--accent-dim);
}

.btn-delete--primary {
    padding: .45rem .65rem;
    border: 1px solid var(--border);
    border-radius: 6px;
}

.btn-delete--primary:hover {
    border-color: var(--red);
}

.btn-delete {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    padding: .25rem;
    border-radius: 6px;
    display: flex;
    align-items: center;
    transition: color .15s, background .15s;
}

.btn-delete:hover {
    color: var(--red);
    background: rgba(224,85,85,.1);
}

.badge {
    display: inline-block;
    padding: .2rem .6rem;
    border-radius: 999px;
    font-size: .75rem;
    font-weight: 600;
    text-transform: capitalize;
}

.badge--done       { background: rgba(80,200,120,.15); color: #50c878; }
.badge--start      { background: rgba(100,160,255,.15); color: #64a0ff; }

.row--favourite td {
    background: rgba(245,166,35,.06);
}

.row-settings {
    position: relative;
    display: flex;
    justify-content: flex-end;
}

.btn-settings {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    padding: .25rem;
    border-radius: 6px;
    display: flex;
    align-items: center;
    transition: color .15s, background .15s;
}

.btn-settings:hover {
    color: var(--text);
    background: var(--surface-2);
}

.row-settings-dropdown {
    position: fixed;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: .35rem;
    min-width: 160px;
    z-index: 100;
    box-shadow: 0 8px 24px rgba(0,0,0,.4);
}

.settings-item {
    display: flex;
    align-items: center;
    gap: .5rem;
    width: 100%;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    font-size: .85rem;
    padding: .45rem .65rem;
    border-radius: 7px;
    text-align: left;
    transition: background .1s, color .1s;
}

.settings-item:hover {
    background: var(--surface-2);
    color: var(--text);
}

.settings-item--delete:hover {
    color: var(--red);
}
.badge--pending    { background: rgba(245,166,35,.15);  color: var(--accent); }
.badge--processing { background: rgba(100,160,255,.15); color: #64a0ff; }
.badge--failed     { background: rgba(224,85,85,.15);   color: var(--red); }

/* Upload card */
.upload-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2rem;
    width: 100%;
    max-width: 480px;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.upload-card h1 {
    font-size: 1.25rem;
    font-weight: 600;
}

/* Drop zone */
.drop-zone {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 2rem 1rem;
    text-align: center;
    cursor: pointer;
    transition: border-color .15s, background .15s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .75rem;
    color: var(--text-muted);
    font-size: .9rem;
}

.drop-zone:hover,
.drop-zone.has-file {
    border-color: var(--accent);
    background: var(--accent-dim);
    color: var(--text);
}

.drop-zone input[type="file"] {
    display: none;
}

.drop-zone svg {
    opacity: .5;
}

.drop-zone.has-file svg {
    opacity: 1;
    color: var(--accent);
}

/* Preview */
.preview-thumb {
    border-radius: 8px;
    height: 120px;
    width: auto;
    display: block;
    margin: 0 auto;
    box-shadow: 0 4px 16px rgba(0,0,0,.4);
}

/* Button */
.btn {
    width: 100%;
    padding: .75rem 1rem;
    background: var(--accent);
    color: #000;
    font-weight: 700;
    font-size: 1rem;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    transition: opacity .15s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .4rem;
}

.btn[hidden] { display: none; }

.btn:hover { opacity: .75; }
.btn:disabled { opacity: .4; cursor: not-allowed; }

/* Status */
.status-msg {
    display: flex;
    align-items: center;
    gap: .6rem;
    font-size: .9rem;
    color: var(--text-muted);
    padding: .75rem 1rem;
    background: var(--surface-2);
    border-radius: 8px;
}

.status-msg.error {
    color: var(--red);
    background: rgba(224,85,85,.1);
}

.status-msg.info {
    color: var(--text-muted);
    background: var(--surface-2);
}

.spinner {
    width: 16px;
    height: 16px;
    border: 2px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin .7s linear infinite;
    flex-shrink: 0;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* Results */
.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: .75rem;
}

.stat-card {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: .25rem;
}

.stat-card .label {
    font-size: .75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .05em;
}

.stat-card .value {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--accent);
}

/* History row link */
.row-link {
    color: var(--text);
}
.row-link:hover {
    color: var(--accent);
}

/* Detail page */
.detail-page {
    width: 100%;
    max-width: 1100px;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.detail-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.back-link {
    display: flex;
    align-items: center;
    gap: .35rem;
    color: var(--text-muted);
    font-size: .9rem;
    transition: color .15s;
}
.back-link:hover { color: var(--text); }

.detail-filename {
    font-size: .85rem;
    color: var(--text-muted);
    font-family: monospace;
}

.detail-date {
    font-size: .85rem;
    color: var(--text-muted);
    margin-left: auto;
}

.detail-grid {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 1.5rem;
    align-items: start;
}

@media (max-width: 800px) {
    .detail-grid {
        grid-template-columns: 1fr;
    }
}

.detail-image-wrap {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.detail-image {
    max-width: 100%;
    max-height: 75vh;
    border-radius: 8px;
    display: block;
}

.detail-sidebar {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.detail-section {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.detail-section--primary {
    border-color: var(--accent);
}

.detail-section--primary .detail-section-title {
    color: var(--accent);
    border-bottom-color: rgba(245,166,35,.2);
    background: var(--accent-dim);
}

.detail-section-title {
    font-size: .75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--text-muted);
    padding: .65rem 1rem;
    border-bottom: 1px solid var(--border);
    background: var(--surface);
}

.ocr-details {
    display: flex;
    flex-direction: column;
}

.ocr-summary {
    cursor: pointer;
    list-style: none;
    border-bottom: none;
    user-select: none;
}

.ocr-details[open] .ocr-summary {
    border-bottom: 1px solid var(--border);
}

.ocr-summary::-webkit-details-marker { display: none; }

.ocr-summary::after {
    content: '▸';
    float: right;
    font-size: .7rem;
    line-height: 1.8;
    color: var(--text-muted);
}

.ocr-details[open] .ocr-summary::after {
    content: '▾';
}

.detail-section .stats-grid {
    padding: .75rem;
}

/* Metadata form */
.metadata-form {
    padding: .75rem 1rem;
    display: flex;
    flex-direction: column;
    gap: .85rem;
}

.metadata-field {
    display: flex;
    flex-direction: column;
    gap: .35rem;
}

.metadata-field label:first-child {
    font-size: .75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .05em;
}

.metadata-field input[type="date"] {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-size: .9rem;
    padding: .45rem .75rem;
    width: 100%;
    color-scheme: dark;
}


.metadata-field--confirm {
    flex-direction: row;
    align-items: center;
}

.confirm-label {
    display: flex;
    align-items: center;
    gap: .5rem;
    font-size: .9rem;
    cursor: pointer;
}

.confirm-label input[type="checkbox"] {
    accent-color: var(--accent);
    width: 15px;
    height: 15px;
}

.btn--small {
    width: auto;
    padding: .5rem 1.25rem;
    font-size: .875rem;
}

.btn--inline {
    width: auto;
    display: inline-flex;
    align-items: center;
    gap: .4rem;
}

.raw-text {
    font-family: 'Menlo', 'Monaco', 'Consolas', monospace;
    font-size: .78rem;
    line-height: 1.6;
    color: var(--text-muted);
    padding: 1rem;
    white-space: pre-wrap;
    word-break: break-word;
    margin: 0;
    max-height: 400px;
    overflow-y: auto;
}

/* File queue cards (multi-upload) */
[data-upload-target="queue"] {
    display: flex;
    flex-direction: column;
    gap: .375rem;
}

.file-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: .5rem .875rem;
    border-radius: var(--radius);
    background: var(--surface-2);
    border: 1px solid var(--border);
    animation: slide-down .18s ease;
}

@keyframes slide-down {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}

.row--new td {
    animation: fade-in-row .2s ease;
}

@keyframes fade-in-row {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.file-card--error {
    background: color-mix(in srgb, var(--red) 8%, var(--surface-2));
    border-color: color-mix(in srgb, var(--red) 25%, var(--border));
}

.file-card-name {
    font-size: .85rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}

.file-card--error .file-card-name {
    color: var(--text);
}

.file-card-status {
    font-size: .8rem;
    white-space: nowrap;
    flex-shrink: 0;
}

.file-card-status--working { color: var(--accent); }
.file-card-status--error   { color: var(--red); }

/* Charts */
.charts-page {
    width: 100%;
    max-width: 1200px;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.charts-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
}

.charts-grid[hidden] { display: none; }

body.is-drag-selecting { user-select: none; cursor: cell; }

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

.chart-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem 1.5rem;
}

.chart-card h2 {
    font-size: .85rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .06em;
    margin-bottom: 1rem;
}

.charts-empty {
    color: var(--text-muted);
    margin-bottom: 1rem;
}

.chart-skeleton {
    display: block;
    width: 100%;
    height: 180px;
    border-radius: 6px;
    background: linear-gradient(90deg, var(--surface-2) 25%, var(--border) 50%, var(--surface-2) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s ease-in-out infinite;
}

@keyframes shimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ── Login ─────────────────────────────────────────────────── */
.login-page {
    width: 100%;
    max-width: 400px;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.login-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.login-card h1 {
    font-size: 1.4rem;
    color: var(--accent);
    letter-spacing: .03em;
}

.login-error {
    color: var(--red);
    font-size: .875rem;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.login-field {
    display: flex;
    flex-direction: column;
    gap: .4rem;
}

.login-field label {
    font-size: .8rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .05em;
}

.login-field input {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: .65rem .85rem;
    color: var(--text);
    font-size: .95rem;
    outline: none;
    transition: border-color .15s;
}

.login-field input:focus {
    border-color: var(--accent);
}

.btn--full {
    width: 100%;
    justify-content: center;
    margin-top: .25rem;
}

/* ── Profile menu ───────────────────────────────────────────── */
.profile-menu {
    margin-left: auto;
    position: relative;
}

.profile-menu-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: .9rem;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: .35rem;
    padding: 0;
    transition: color .15s;
}

.profile-menu-btn:hover { color: var(--text); }

.profile-menu-dropdown {
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    min-width: 160px;
    padding: .35rem;
    z-index: 100;
}

.profile-menu-dropdown[hidden] { display: none; }

.profile-menu-item {
    display: flex;
    align-items: center;
    gap: .5rem;
    width: 100%;
    padding: .45rem .65rem;
    font-size: .875rem;
    color: var(--text);
    background: none;
    border: none;
    border-radius: 7px;
    text-align: left;
    cursor: pointer;
    transition: background .15s;
}

.profile-menu-item:hover { background: var(--surface-2); }

.profile-menu-item--signout { color: var(--text-muted); }

.profile-menu-item--danger:hover {
    color: var(--red);
    background: rgba(224,85,85,.1);
}


.upload-countdown {
    color: var(--text-muted);
    font-size: .9rem;
    margin-top: .5rem;
}

.upload-countdown-dots span {
    animation: dot-fade 1.2s infinite;
    opacity: 0;
}

.upload-countdown-dots span:nth-child(2) { animation-delay: .3s; }
.upload-countdown-dots span:nth-child(3) { animation-delay: .6s; }

@keyframes dot-fade {
    0%, 100% { opacity: 0; }
    50%       { opacity: 1; }
}

/* Confirmation dialog */
.confirm-dialog {
    position: fixed;
    inset: 0;
    margin: auto;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    padding: 1.5rem;
    max-width: 360px;
    width: 100%;
}

.confirm-dialog::backdrop {
    background: rgba(0, 0, 0, .6);
}

.confirm-dialog__message {
    font-size: 1rem;
    margin-bottom: 1.25rem;
}

.confirm-dialog__actions {
    display: flex;
    gap: .75rem;
    justify-content: flex-end;
}

.confirm-dialog__actions .btn {
    width: auto;
    padding: .5rem 1.25rem;
    font-size: .875rem;
}

.btn--ghost {
    background: var(--surface-2);
    color: var(--text);
}

.btn--ghost:hover { opacity: .75; }

.btn--danger {
    background: var(--red);
    color: #fff;
}

/* ── Mobile (≤ 600px) ────────────────────────────────────── */
@media (max-width: 600px) {
    header {
        padding: .75rem 1rem;
        flex-wrap: wrap;
        gap: .5rem;
        position: sticky;
        top: 0;
        z-index: 100;
        background: var(--bg);
    }

    nav {
        order: 3;
        flex-basis: 100%;
        margin-left: 0;
        padding-top: .75rem;
        border-top: 1px solid var(--border);
        gap: 1.25rem;
    }

    main {
        padding: 1.5rem 1rem;
    }

    .snapshots-header {
        flex-wrap: wrap;
    }

    .header-actions {
        margin-left: 0;
        width: 100%;
    }

    /* Checkboxes are not practical on mobile */
    .checkbox-cell { display: none; }

    /* Hide stat columns in the uploads table on mobile */
    [data-upload-target="tableWrapper"] .stat-cell { display: none; }

    /* Delta values make columns too narrow on mobile, except in the comparison table */
    .delta { display: none; }
    .comparison-panel .delta { display: inline; }

    .upload-card {
        padding: 1.25rem;
    }

    .detail-date {
        margin-left: 0;
    }
}
