*, *::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;
}

.header-logo {
    display: flex;
    align-items: center;
    gap: .5rem;
    color: #B897D8;
    font-family: 'Pixelify Sans', monospace;
    font-size: 1.1rem;
    letter-spacing: 0;
}

.header-logo[hidden] { display: none; }

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;
}

.bottom-nav {
    display: none;
}

.bottom-nav[hidden] { display: none; }

.bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .25rem;
    padding: .5rem .5rem;
    color: var(--text-muted);
    font-size: .65rem;
    font-weight: 500;
    text-decoration: none;
    transition: color .15s;
    position: relative;
    flex: 1;
}

.bottom-nav-item[hidden] { display: none; }

.bottom-nav-item.active,
.bottom-nav-item:hover {
    color: var(--accent);
}

.bottom-nav-badge {
    position: absolute;
    top: .3rem;
    right: calc(50% - 1.1rem);
    background: var(--accent);
    color: #000;
    font-size: .6rem;
    font-weight: 700;
    min-width: 15px;
    height: 15px;
    border-radius: 999px;
    padding: 0 .25rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.bottom-nav-badge[hidden] { display: none; }

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

.upload-info-block__body a:not([class]),
.notice a:not([class]),
.empty a:not([class]) {
    color: var(--accent);
    text-decoration: none;
    transition: color .15s;
}

.upload-info-block__body a:not([class]):hover,
.upload-info-block__body a:not([class]):focus-visible,
.notice a:not([class]):hover,
.notice a:not([class]):focus-visible,
.empty a:not([class]):hover,
.empty a:not([class]):focus-visible {
    color: var(--text);
}

/* Notices */
.notice {
    display: flex;
    align-items: flex-start;
    gap: .6rem;
    padding: .75rem 1rem;
    border-radius: var(--radius);
    font-size: .875rem;
    line-height: 1.5;
    border: 1px solid;
}
.notice[hidden] { display: none; }

.notice--warning {
    background: color-mix(in srgb, var(--accent) 10%, transparent);
    border-color: color-mix(in srgb, var(--accent) 30%, transparent);
    color: var(--text);
}

.notice--warning svg {
    flex-shrink: 0;
    margin-top: .15rem;
    color: var(--accent);
}

.notice--info {
    background: color-mix(in srgb, #6b9fff 10%, transparent);
    border-color: color-mix(in srgb, #6b9fff 30%, transparent);
    color: var(--text);
}

.notice--info svg {
    flex-shrink: 0;
    margin-top: .15rem;
    color: #6b9fff;
}

.notice a {
    color: inherit;
    text-decoration: underline;
}

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

.upload-section {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.onboarding-panel {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 280px;
    gap: 1.5rem;
    align-items: center;
    background: radial-gradient(circle at top left, rgba(245, 166, 35, .14), transparent 38%), var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
}

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

.onboarding-panel__content {
    display: flex;
    flex-direction: column;
    gap: .85rem;
}

.onboarding-panel__content[hidden] { display: none; }

.onboarding-panel__eyebrow {
    color: #7dd3a8;
    font-size: .75rem;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.onboarding-panel h1 {
    font-size: clamp(1.6rem, 3vw, 2.35rem);
    line-height: 1.1;
}

.onboarding-panel p:not(.onboarding-panel__eyebrow) {
    color: var(--text-muted);
    max-width: 680px;
}

.onboarding-steps {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
}

.onboarding-steps[hidden] { display: none; }

.onboarding-steps__item {
    border: 1px solid var(--border);
    border-radius: 999px;
    color: var(--text-muted);
    font-size: .8rem;
    font-weight: 700;
    padding: .35rem .7rem;
}

.onboarding-steps__item--done {
    color: #7dd3a8;
    border-color: rgba(125, 211, 168, .35);
}

.onboarding-steps__item--active {
    color: #101014;
    background: var(--accent);
    border-color: var(--accent);
}

.onboarding-example {
    display: flex;
    justify-content: center;
}

.onboarding-example[hidden] { display: none; }

.onboarding-phone {
    width: 220px;
    border: 1px solid rgba(255, 255, 255, .12);
    border-radius: 20px;
    background: #15151d;
    padding: 1rem;
    box-shadow: 0 18px 50px rgba(0, 0, 0, .28);
}

.onboarding-phone__header {
    color: var(--text-muted);
    font-size: .75rem;
    font-weight: 800;
    text-align: center;
    text-transform: uppercase;
}

.onboarding-phone__avatar {
    width: 68px;
    height: 68px;
    border-radius: 50%;
    margin: .9rem auto;
    background: linear-gradient(135deg, #7dd3a8, var(--accent));
}

.onboarding-phone__row {
    display: flex;
    justify-content: space-between;
    gap: .8rem;
    border-top: 1px solid var(--border);
    padding: .55rem 0;
    font-size: .82rem;
}

.onboarding-phone__row[hidden] { display: none; }

.onboarding-phone__row span {
    color: var(--text-muted);
}

.onboarding-phone__row strong {
    color: var(--text);
}

.upload-info-blocks {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
}

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

.upload-info-block {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
    display: flex;
    flex-direction: column;
    gap: .5rem;
}

.upload-info-block__title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text);
    margin: 0;
    display: flex;
    align-items: center;
    gap: .4rem;
}

.upload-info-block__body {
    font-size: .875rem;
    color: var(--text-muted);
    line-height: 1.5;
    margin: 0;
}

.drop-zone__hint {
    font-size: .8rem;
    color: var(--text-muted);
}

.analysis-progress {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: .875rem;
}
.analysis-progress[hidden] { display: none; }

.analysis-progress__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
}

.analysis-progress__title {
    color: var(--text);
    font-size: 1rem;
    font-weight: 700;
    margin: 0 0 .25rem;
}

.analysis-progress__summary,
.analysis-progress__counts {
    color: var(--text-muted);
    font-size: .85rem;
    line-height: 1.4;
    margin: 0;
}

.analysis-progress__counts {
    flex-shrink: 0;
    text-align: right;
}

.analysis-progress__track {
    height: .5rem;
    overflow: hidden;
    border-radius: 999px;
    background: var(--surface-2);
    border: 1px solid var(--border);
}

.analysis-progress__bar {
    width: 0;
    height: 100%;
    background: linear-gradient(90deg, var(--accent), #50c878);
    transition: width .25s ease;
}

.analysis-stream {
    display: flex;
    flex-direction: column;
    gap: .375rem;
    list-style: none;
    margin: 0;
    max-height: 12rem;
    overflow: auto;
    padding: 0;
}
.analysis-stream[hidden] { display: none; }

.analysis-stream__item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: .5rem .625rem;
    border-radius: var(--radius);
    background: var(--surface-2);
    border: 1px solid var(--border);
    animation: fade-in-row .2s ease;
}

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

a.analysis-stream__file:hover,
a.analysis-stream__file:focus-visible {
    color: var(--text);
}

.analysis-stream__status {
    flex-shrink: 0;
    font-size: .8rem;
    font-weight: 700;
}

.analysis-stream__item--pending .analysis-stream__status { color: var(--accent); }
.analysis-stream__item--done .analysis-stream__status { color: #50c878; }
.analysis-stream__item--review .analysis-stream__status { color: #e8a030; }
.analysis-stream__item--failed .analysis-stream__status { color: var(--red); }

@media (max-width: 700px) {
    .onboarding-panel {
        grid-template-columns: 1fr;
    }

    .upload-next-steps {
        align-items: stretch;
        flex-direction: column;
    }

    .upload-next-steps__actions {
        justify-content: flex-start;
    }

    .analysis-progress__header,
    .analysis-stream__item {
        align-items: stretch;
        flex-direction: column;
        gap: .375rem;
    }

    .analysis-progress__counts {
        text-align: left;
    }
}

.upload-next-steps {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
}

.upload-next-steps[hidden] { display: none; }

.upload-next-steps h2 {
    color: var(--text);
    font-size: 1rem;
    margin-bottom: .25rem;
}

.upload-next-steps p {
    color: var(--text-muted);
    font-size: .875rem;
}

.upload-next-steps__actions {
    display: flex;
    gap: .6rem;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.upload-next-steps__actions[hidden] { display: none; }

.uploads-table-section {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}
.uploads-table-section[hidden] { display: none; }

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

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

.view-toggle {
    display: flex;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.view-toggle[hidden] { display: none; }

.view-toggle-btn {
    padding: .3rem .8rem;
    font-size: .8rem;
    font-weight: 600;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    transition: background .15s, color .15s;
}

.view-toggle-btn + .view-toggle-btn {
    border-left: 1px solid var(--border);
}

.view-toggle-btn.is-active {
    background: var(--surface-2);
    color: var(--text);
}

.category-filter {
    display: flex;
    gap: .25rem;
    flex-wrap: wrap;
}

.category-filter-btn {
    padding: .25rem .65rem;
    font-size: .75rem;
    font-weight: 600;
    background: none;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-muted);
    cursor: pointer;
    transition: background .15s, color .15s, border-color .15s;
}

.category-filter-btn.is-active {
    background: var(--surface-2);
    border-color: var(--border);
    color: var(--text);
}

.leaderboard-totals {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: .75rem;
}

.leaderboard-totals[hidden] { display: none; }

.leaderboard-totals__profile-count {
    grid-column: 1 / -1;
    font-size: .85rem;
    color: var(--text-muted);
    margin: 0;
}

.leaderboard-totals__card {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-top: 3px solid var(--card-accent, var(--border));
    border-radius: 10px;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: .2rem;
}

.leaderboard-totals__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: .15rem;
}

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

.leaderboard-totals__icon {
    color: var(--card-accent, var(--text-muted));
    opacity: .35;
    flex-shrink: 0;
    margin-top: -.1rem;
}

.leaderboard-totals__value {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text);
    font-variant-numeric: tabular-nums;
}

.leaderboard-totals__avg {
    font-size: .7rem;
    color: var(--text-muted);
    margin-top: .1rem;
}

.leaderboard-ranking {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.leaderboard-ranking[hidden] { display: none; }

.leaderboard-all-metrics {
    display: flex;
    flex-direction: column;
    gap: 2.5rem;
}

.leaderboard-all-metrics[hidden] { display: none; }

.metric-category-section {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.metric-category-title {
    font-size: .7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--text-muted);
    padding-bottom: .5rem;
    border-bottom: 1px solid var(--border);
}

.metric-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1rem;
}

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

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

.metric-card-header {
    padding: .55rem .85rem;
    font-size: .75rem;
    font-weight: 600;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
    text-transform: uppercase;
    letter-spacing: .05em;
}

.metric-card-row {
    display: flex;
    align-items: center;
    gap: .6rem;
    padding: .55rem .85rem;
}

.metric-card-row + .metric-card-row {
    border-top: 1px solid var(--border);
}

.metric-card-rank {
    font-size: .75rem;
    font-weight: 700;
    width: 1.5rem;
    text-align: center;
    flex-shrink: 0;
    white-space: nowrap;
    overflow: hidden;
}

.metric-card-name {
    display: flex;
    align-items: center;
    gap: .4rem;
    flex: 1;
    font-size: .9rem;
    overflow: hidden;
}

.metric-card-name[hidden] { display: none; }

.metric-card-name a {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}

.metric-card-value {
    font-size: .85rem;
    font-variant-numeric: tabular-nums;
    color: var(--text-muted);
    flex-shrink: 0;
}

.metric-card-row--gold   { background: rgba(255, 215, 0, .03); }
.metric-card-row--silver { background: rgba(192, 192, 192, .03); }
.metric-card-row--bronze { background: rgba(205, 127, 50, .03); }

.metric-card-row--gold   .metric-card-rank { color: #ffd700; }
.metric-card-row--silver .metric-card-rank { color: #b8b8c8; }
.metric-card-row--bronze .metric-card-rank { color: #cd7f32; }

.metric-card-row--gold   .metric-card-rank::after { content: ' ★'; }
.metric-card-row--silver .metric-card-rank::after { content: ' ★'; }
.metric-card-row--bronze .metric-card-rank::after { content: ' ★'; }

.medals-page {
    width: 100%;
    max-width: 1200px;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}
.medals-page[hidden] { display: none; }

.missing-medals-panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
    display: flex;
    flex-direction: column;
}
.missing-medals-panel[hidden] { display: none; }

.missing-medals-panel__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    cursor: pointer;
    list-style: none;
}
.missing-medals-panel__header[hidden] { display: none; }

.missing-medals-panel__header::-webkit-details-marker {
    display: none;
}

.missing-medals-panel__header::after {
    content: '›';
    color: var(--text-muted);
    flex: 0 0 auto;
    font-size: 1.25rem;
    line-height: 1;
    margin-top: .15rem;
    transition: transform .15s, color .15s;
}

.missing-medals-panel[open] .missing-medals-panel__header::after {
    color: var(--accent);
    transform: rotate(90deg);
}

.missing-medals-panel__content {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-top: 1rem;
}
.missing-medals-panel__content[hidden] { display: none; }

.missing-medals-panel__header h2 {
    font-size: 1rem;
    font-weight: 700;
    margin: 0 0 .15rem;
}

.missing-medals-panel__summary {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: .4rem .7rem;
    color: var(--text-muted);
    font-size: .85rem;
    margin: 0;
}
.missing-medals-panel__summary[hidden] { display: none; }

.missing-medals-panel__count {
    display: inline-flex;
    align-items: center;
    gap: .25rem;
    color: var(--accent);
    font-weight: 700;
    white-space: nowrap;
}
.missing-medals-panel__count[hidden] { display: none; }

.missing-medals-list {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
}
.missing-medals-list[hidden] { display: none; }

.missing-medal-groups {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}
.missing-medal-groups[hidden] { display: none; }

.missing-medal-group {
    display: flex;
    flex-direction: column;
    gap: .55rem;
}
.missing-medal-group[hidden] { display: none; }

.missing-medal-group__title {
    display: flex;
    align-items: center;
    gap: .5rem;
    color: var(--text-muted);
    font-size: .75rem;
    font-weight: 700;
    letter-spacing: .05em;
    text-transform: uppercase;
}
.missing-medal-group__title[hidden] { display: none; }

.missing-medal-group__title span:last-child {
    color: var(--accent);
    font-size: .7rem;
}

.missing-medal-chip {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    max-width: 100%;
    padding: .35rem .55rem;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface-2);
    color: var(--text);
    font-size: .85rem;
}
.missing-medal-chip[hidden] { display: none; }

.missing-medal-chip__label {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.missing-medals-complete {
    display: flex;
    align-items: center;
    color: #50c878;
    font-size: .9rem;
}
.missing-medals-complete[hidden] { display: none; }

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

.profile-hero {
    background: linear-gradient(135deg,
        color-mix(in srgb, var(--team-color, var(--accent)) 12%, var(--surface)) 0%,
        var(--surface) 65%
    );
    border: 1px solid color-mix(in srgb, var(--team-color, var(--border)) 30%, var(--border));
    border-radius: 12px;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: .75rem;
}

.profile-hero__name {
    display: flex;
    align-items: center;
    gap: .5rem;
    color: var(--text);
    font-size: 1.75rem;
    font-weight: 700;
    margin: 0;
    line-height: 1.2;
}

.profile-hero__team-icon {
    width: 28px;
    height: 28px;
    object-fit: contain;
    flex-shrink: 0;
}

.profile-hero__badges {
    display: flex;
    align-items: center;
    gap: .4rem;
    flex-wrap: wrap;
}

.profile-hero__rank {
    display: inline-flex;
    align-items: center;
    background: color-mix(in srgb, var(--team-color, var(--accent)) 15%, transparent);
    color: var(--team-color, var(--accent));
    border: 1px solid color-mix(in srgb, var(--team-color, var(--accent)) 35%, transparent);
    border-radius: .3rem;
    font-size: .8rem;
    font-weight: 700;
    padding: .2rem .5rem;
}

.profile-hero__flag {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: .3rem;
    font-size: .75rem;
    color: var(--text-muted);
    padding: .2rem .5rem;
}

.profile-highlights {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: .75rem;
}

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

.profile-highlights__card {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-top: 3px solid var(--card-accent, var(--border));
    border-radius: 10px;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: .2rem;
}

.profile-highlights__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: .15rem;
}

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

.profile-highlights__icon {
    color: var(--card-accent, var(--text-muted));
    opacity: .35;
    flex-shrink: 0;
}

.profile-highlights__value {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text);
    font-variant-numeric: tabular-nums;
}

.profile-flag {
    font-size: .8rem;
    color: var(--text-muted);
    display: inline-flex;
    align-items: center;
    gap: .25rem;
    line-height: 1;
}
.profile-flag[hidden] { display: none; }

.profile-flag svg {
    flex: 0 0 auto;
}

.profile-metric-section {
    display: flex;
    flex-direction: column;
    gap: .75rem;
}

.profile-metric-category-title {
    font-size: .75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--text-muted);
    margin: 0;
}

.profile-stats-table td:first-child {
    color: var(--text-muted);
    font-size: .9rem;
}

.profile-updated {
    font-size: .8rem;
    color: var(--text-muted);
    text-align: right;
}

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

.backoffice-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.backoffice-sections {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 1.5rem;
    align-items: start;
}

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

.backoffice-flag-list {
    display: flex;
    flex-direction: column;
}

.backoffice-flag-list[hidden] { display: none; }

.backoffice-flag-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: .65rem 0;
    border-bottom: 1px solid var(--border);
}

.backoffice-flag-row:first-child { padding-top: 0; }
.backoffice-flag-row:last-child { border-bottom: none; padding-bottom: 0; }

.backoffice-flag-label {
    font-size: .9rem;
}

.toggle-switch {
    display: inline-flex;
    cursor: pointer;
    flex-shrink: 0;
}

.toggle-switch[hidden] { display: none; }

.toggle-switch input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-switch__track {
    width: 2.5rem;
    height: 1.4rem;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 999px;
    position: relative;
    transition: background .2s, border-color .2s;
}

.toggle-switch__track::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 16px;
    height: 16px;
    background: var(--text-muted);
    border-radius: 50%;
    transition: transform .2s, background .2s;
}

.toggle-switch input:checked + .toggle-switch__track {
    background: var(--accent);
    border-color: var(--accent);
}

.toggle-switch input:checked + .toggle-switch__track::after {
    transform: translateX(1.1rem);
    background: #000;
}

.backoffice-section--danger {
    border-color: var(--red);
}

.backoffice-section__title {
    font-size: 1rem;
    font-weight: 600;
}

/* Tom Select dark theme overrides */
.ts-wrapper.single .ts-control,
.ts-wrapper.multi .ts-control,
.ts-wrapper .ts-control {
    background: var(--surface-2) !important;
    border: 1px solid #4a4a5e !important;
    border-radius: 8px !important;
    color: var(--text) !important;
    box-shadow: none !important;
    padding: .45rem .75rem !important;
    align-items: flex-start !important;
    gap: .75rem !important;
}
.ts-wrapper.single .ts-control::after {
    top: .8rem !important;
    margin-top: 0 !important;
}
.ts-wrapper.focus.single .ts-control,
.ts-wrapper.focus .ts-control {
    border-color: #4a4a5e !important;
    box-shadow: none !important;
}
.ts-wrapper .ts-control input {
    color: var(--text) !important;
    background: var(--surface-2) !important;
    border: 1px solid #4a4a5e !important;
    border-radius: 6px !important;
    padding: .35rem .6rem !important;
    min-width: 8rem !important;
    margin: 0 !important;
    outline: none !important;
}
.ts-wrapper .ts-control input:focus {
    border-color: var(--accent) !important;
}
.ts-dropdown .ts-dropdown-content {
    padding-top: 0 !important;
}
.ts-wrapper .ts-dropdown input.dropdown-input,
.ts-dropdown input {
    background: var(--surface-2) !important;
    border: none !important;
    border-bottom: 1px solid var(--border) !important;
    border-radius: 0 !important;
    color: var(--text) !important;
    padding: .5rem .75rem !important;
    width: 100% !important;
    box-sizing: border-box !important;
    outline: none !important;
}
.ts-dropdown,
.ts-dropdown.single,
.ts-dropdown.multi {
    background: var(--surface) !important;
    border: 1px solid var(--border) !important;
    color: var(--text) !important;
}
.ts-dropdown .ts-dropdown-content .option,
.ts-dropdown .option {
    color: var(--text) !important;
    background: transparent !important;
}
.ts-dropdown .option:hover,
.ts-dropdown .option.active {
    background: var(--surface-2) !important;
    color: var(--text) !important;
}
.ts-dropdown .option.selected,
.ts-dropdown .option.selected.active {
    background: var(--surface-2) !important;
    color: var(--text) !important;
}
.ts-wrapper .ts-control .item {
    color: var(--text) !important;
}

.field-hint {
    font-size: .8rem;
    color: var(--text-muted);
    font-family: monospace;
}
.field-hint[hidden] { display: none; }

/* Copy field (inline input + copy button) */
.copy-field {
    display: flex;
    gap: .4rem;
    align-items: center;
}
.copy-field input {
    flex: 1;
    min-width: 0;
}

/* Copy button */
.btn-copy {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 2rem;
    height: 2rem;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-muted);
    cursor: pointer;
    transition: color .15s, background .15s;
}
.btn-copy:hover { color: var(--text); background: var(--surface); }
.btn-copy--copied { color: var(--accent); border-color: var(--accent); }

/* Onboarding rows */
.onboarding-rows {
    display: flex;
    flex-direction: column;
    gap: .75rem;
}

.onboarding-row {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .65rem .75rem;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.onboarding-row__label {
    font-size: .75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--text-muted);
    width: 6rem;
    flex-shrink: 0;
}

.onboarding-row__value {
    flex: 1;
    font-family: monospace;
    font-size: .9rem;
    word-break: break-all;
}

.role-badge {
    display: inline-block;
    margin-left: .4rem;
    font-size: .7rem;
    font-weight: 600;
    padding: .2rem .5rem;
    border-radius: 999px;
    text-transform: uppercase;
    letter-spacing: .05em;
}

.role-badge--admin {
    background: var(--accent-dim);
    color: var(--accent);
}

.role-badge--developer {
    background: rgba(100, 160, 255, .15);
    color: #6aa0ff;
}

.text-muted {
    color: var(--text-muted);
}

.table-actions {
    text-align: right;
    white-space: nowrap;
}

.impersonation-label {
    font-size: .8rem;
    color: #6aa0ff;
    font-weight: 500;
    margin-left: auto;
}

.rank-cell {
    text-align: center;
    color: var(--text-muted);
    position: sticky;
    left: 0;
    z-index: 1;
    white-space: nowrap;
    width: 3rem;
    min-width: 3rem;
    max-width: 3rem;
}

.name-cell {
    position: sticky;
    left: 3rem;
    z-index: 1;
    width: max-content;
    min-width: max-content;
    box-shadow: 2px 0 6px -2px rgba(0, 0, 0, .15);
}

.name-cell[hidden] { display: none; }

.rank-cell__content {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.rank-cell__content[hidden] { display: none; }

.rank-cell__number {
    flex-shrink: 0;
}

.rank-cell__mobile-label,
.rank-cell__mobile-name {
    display: none;
}

.rank-cell__mobile-label[hidden],
.rank-cell__mobile-name[hidden] { display: none; }

.data-table th.rank-cell,
.data-table th.name-cell {
    background: var(--surface);
    z-index: 2;
}

.data-table td.rank-cell,
.data-table td.name-cell {
    background: var(--bg);
}

.name-cell__content {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    width: max-content;
}

.name-cell__content[hidden] { display: none; }

.name-cell__content a {
    color: inherit;
}

.rank-cell__mobile-name a {
    color: inherit;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}

.team-icon {
    width: 16px;
    height: 16px;
    object-fit: contain;
    flex-shrink: 0;
    vertical-align: middle;
    opacity: .85;
}

.name-cell a,
.metric-card-name a {
    color: inherit;
    transition: color .15s;
}

.name-cell a:hover,
.metric-card-name a:hover {
    color: var(--team-color, var(--accent));
}

.tr--rank-1 td.rank-cell, .tr--rank-1 td.name-cell { background: color-mix(in srgb, #ffd700 4%, var(--bg)); }
.tr--rank-2 td.rank-cell, .tr--rank-2 td.name-cell { background: color-mix(in srgb, #c0c0c0 4%, var(--bg)); }
.tr--rank-3 td.rank-cell, .tr--rank-3 td.name-cell { background: color-mix(in srgb, #cd7f32 4%, var(--bg)); }

.data-table tbody tr:hover td.rank-cell,
.data-table tbody tr:hover td.name-cell {
    background: var(--surface-2);
}

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

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

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

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

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

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

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

.header-actions[hidden] { display: none; }

.section-header h1,
.section-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);
}

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

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

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

.data-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;
}

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

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

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

.tr--rank-1 td { background: rgba(255, 215, 0, .04); }
.tr--rank-2 td { background: rgba(192, 192, 192, .04); }
.tr--rank-3 td { background: rgba(205, 127, 50, .04); }

.tr--rank-1 .rank-cell { color: #ffd700; }
.tr--rank-2 .rank-cell { color: #b8b8c8; }
.tr--rank-3 .rank-cell { color: #cd7f32; }

.tr--rank-1 .rank-cell__number::after { content: ' ★'; color: #ffd700; font-size: .9em; }
.tr--rank-2 .rank-cell__number::after { content: ' ★'; color: #b8b8c8; font-size: .9em; }
.tr--rank-3 .rank-cell__number::after { content: ' ★'; color: #cd7f32; font-size: .9em; }

.stat-cell--gold { color: #ffd700; }
.stat-cell--gold::after { content: ' ★'; font-size: .9em; color: #ffd700; }

.stat-cell--silver { color: #b8b8c8; }
.stat-cell--silver::after { content: ' ★'; font-size: .9em; color: #b8b8c8; }

.stat-cell--bronze { color: #cd7f32; }
.stat-cell--bronze::after { content: ' ★'; font-size: .9em; color: #cd7f32; }

.defit-flag { font-size: .75em; }
.defit-flag[hidden] { display: none; }
.manual-catch-flag {
    display: inline-flex;
    align-items: center;
    vertical-align: -0.18em;
}
.manual-catch-flag[hidden] { display: none; }

.highscore-page .manual-catch-flag {
    color: var(--text-muted);
}

.profile-flag svg,
.manual-catch-flag svg {
    flex: 0 0 auto;
}

.metric-value {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: .3rem;
    white-space: nowrap;
}
.metric-value[hidden] { display: none; }

.metric-value__award {
    order: 3;
    font-size: .9em;
}
.metric-value__award[hidden] { display: none; }

.metric-value__number {
    order: 1;
}
.metric-value__number[hidden] { display: none; }

.metric-value .manual-catch-flag {
    order: 2;
}

.metric-value .defit-flag {
    order: 2;
}

.metric-value__award--gold { color: #ffd700; }
.metric-value__award--silver { color: #b8b8c8; }
.metric-value__award--bronze { color: #cd7f32; }

.stat-cell:has(.metric-value)::after,
.stat-cell:has(.metric-value)::before {
    content: none;
}

.flag--mobile { display: none; }
.flag--mobile[hidden] { display: none; }

.combined-cell__value { display: none; }
.combined-cell__value[hidden] { display: none; }

.combined-cell__meta {
    display: none;
    justify-content: space-between;
    align-items: baseline;
    gap: .5rem;
    color: var(--text-muted);
    font-size: .75em;
    letter-spacing: .05em;
    margin-bottom: .5rem;
}
.combined-cell__meta[hidden] { display: none; }

.combined-cell__row { display: contents; }
.combined-cell__row[hidden] { display: none; }

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

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

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

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

.date-short { display: none; }
.date-short[hidden] { display: none; }

.medal-date-cell {
    display: flex;
    flex-direction: column;
    gap: .15rem;
}

.medal-date-cell[hidden] { display: none; }

/* Combined content column — hidden on stats desktop, revealed on mobile */
.stats-page .combined-cell { display: none; }
.stats-page .combined-cell[hidden] { display: none; }

.stats-page .data-table td.combined-cell {
    white-space: normal;
    padding: .5rem 1rem;
    min-width: 10rem;
}

.combined-cell__row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: .5rem;
    line-height: 1.7;
}

.combined-cell__meta {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: .5rem;
    color: var(--text-muted);
    font-size: .75em;
    letter-spacing: .05em;
    margin-bottom: .5rem;
}

.combined-cell__meta-primary {
    color: var(--text);
}

.combined-cell__label {
    color: var(--text-muted);
    font-size: .75em;
    min-width: 4.5rem;
    flex-shrink: 0;
    text-transform: uppercase;
    letter-spacing: .05em;
}

.combined-cell__value {
    font-variant-numeric: tabular-nums;
    text-align: right;
}

.medals-page .combined-cell__meta {
    display: none;
}

.medals-page .combined-cell__meta[hidden] { display: none; }

.medals-page .combined-cell__row {
    display: contents;
}

.medals-page .combined-cell__row[hidden] { display: none; }

.medal-value-badge {
    display: inline-flex;
    align-items: baseline;
    justify-content: flex-end;
    padding: .15rem .45rem;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface-2);
    line-height: 1.4;
    font-variant-numeric: tabular-nums;
}
.medal-value-badge[hidden] { display: none; }

.medals-page .combined-cell--bronze .combined-cell__label { color: #cd7f32; }
.medals-page .combined-cell--silver .combined-cell__label { color: #b8b8c8; }
.medals-page .combined-cell--gold .combined-cell__label { color: #ffd700; }
.medals-page .combined-cell--platinum .combined-cell__label { color: #d9e7ff; }

.medals-page .medal-tier--bronze .medal-value-badge,
.profile-stats-table .medal-tier--bronze .medal-value-badge,
.medals-page .combined-cell--bronze .combined-cell__value {
    border-color: color-mix(in srgb, #cd7f32 55%, var(--border));
    background: color-mix(in srgb, #cd7f32 12%, var(--surface-2));
}

.medals-page .medal-tier--silver .medal-value-badge,
.profile-stats-table .medal-tier--silver .medal-value-badge,
.medals-page .combined-cell--silver .combined-cell__value {
    border-color: color-mix(in srgb, #b8b8c8 55%, var(--border));
    background: color-mix(in srgb, #b8b8c8 12%, var(--surface-2));
}

.medals-page .medal-tier--gold .medal-value-badge,
.profile-stats-table .medal-tier--gold .medal-value-badge,
.medals-page .combined-cell--gold .combined-cell__value {
    border-color: color-mix(in srgb, #ffd700 55%, var(--border));
    background: color-mix(in srgb, #ffd700 12%, var(--surface-2));
}

.medals-page .medal-tier--platinum .medal-value-badge,
.profile-stats-table .medal-tier--platinum .medal-value-badge,
.medals-page .combined-cell--platinum .combined-cell__value {
    border-color: color-mix(in srgb, #d9e7ff 60%, var(--border));
    background: color-mix(in srgb, #d9e7ff 14%, var(--surface-2));
}

.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);
}

.combined-cell__select-hint {
    color: var(--text-muted);
    font-size: .75rem;
    font-weight: 600;
    letter-spacing: 0;
    text-transform: none;
    white-space: nowrap;
}

.combined-cell__select-hint[hidden] { display: none; }

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

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

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

.comparison-page {
    gap: 1.25rem;
}

.comparison-page-header {
    align-items: flex-start;
}

.comparison-title-block {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: .5rem .75rem;
}

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

.comparison-meta {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
}

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

.comparison-date-range {
    color: var(--text-muted);
    font-size: .875rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

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

.comparison-back-link {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    color: var(--text-muted);
    font-size: .875rem;
    font-weight: 600;
    transition: color .15s;
}

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

.comparison-back-link:hover {
    color: var(--text);
}

.comparison-summary {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}

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

.comparison-summary-card {
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    padding: 1rem 1.1rem;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .025);
}

.comparison-summary-card--total {
    border-color: color-mix(in srgb, var(--accent) 24%, var(--border));
}

.comparison-summary-card--average {
    border-color: color-mix(in srgb, #6b9fff 24%, var(--border));
    background: color-mix(in srgb, var(--surface-2) 35%, var(--surface));
}

.comparison-summary-card h2 {
    margin: 0 0 .85rem;
    font-size: .85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--text-muted);
}

.comparison-summary-card dl {
    display: flex;
    flex-direction: column;
    gap: .7rem;
    margin: 0;
}

.comparison-summary-card dl[hidden] { display: none; }

.comparison-summary-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
    min-height: 1.7rem;
}

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

.comparison-summary-row dt {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    color: var(--text-muted);
    font-size: .85rem;
}

.comparison-summary-row dt[hidden] { display: none; }

.comparison-summary-row dd {
    margin: 0;
    color: var(--text);
    font-size: 1rem;
    font-weight: 750;
    text-align: right;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.comparison-metric-dot {
    width: .5rem;
    height: .5rem;
    border-radius: 999px;
    background: var(--metric-color, var(--accent));
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--metric-color, var(--accent)) 16%, transparent);
    flex: 0 0 auto;
}

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

.comparison-summary-row--distanceWalked { --metric-color: #6b9fff; }
.comparison-summary-row--pokemonCaught { --metric-color: #50c878; }
.comparison-summary-row--pokestopsVisited { --metric-color: #f5a623; }
.comparison-summary-row--totalXp { --metric-color: #d88cff; }

.comparison-detail-section {
    display: flex;
    flex-direction: column;
    gap: .75rem;
}

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

.comparison-section-heading {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
}

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

.comparison-section-heading h2 {
    color: var(--text-muted);
    font-size: .8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0;
}

.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[hidden] { display: none; }

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

.stats-selection-actions[hidden] { display: none; }

.month-filter {
    font-size: .875rem;
    padding: .5rem .75rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    color: var(--text);
    cursor: pointer;
}

.month-filter[hidden] { display: none; }

.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--missing td {
    background: rgba(224,85,85,.12);
}

.icon-missing {
    color: var(--red);
    vertical-align: -0.15em;
}

.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.has-error {
    border-color: var(--red);
    background: color-mix(in srgb, var(--red) 10%, transparent);
    color: var(--red);
}

.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;
    justify-content: flex-end;
}

.detail-header-actions {
    display: flex;
    gap: .5rem;
}

.detail-image-meta {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 1rem;
    margin-bottom: .5rem;
}
.detail-image-meta[hidden] { display: none; }

.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);
}

.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 {
        order: 1;
    }
}

.detail-image-wrap {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    padding: 1rem;
    gap: .75rem;
}

.detail-image-wrap .detail-image {
    align-self: center;
}

.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--danger {
    border-color: var(--red);
}

.detail-section--danger .detail-section-title {
    color: var(--red);
    border-bottom-color: color-mix(in srgb, var(--red) 20%, transparent);
    background: color-mix(in srgb, var(--red) 8%, transparent);
}

.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);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.btn-section-edit {
    font-size: .7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--text-muted);
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    transition: color .15s;
}
.btn-section-edit[hidden] { display: none; }

.btn-section-edit-group {
    display: flex;
    gap: .6rem;
}
.btn-section-edit-group[hidden] { display: none; }
.btn-section-edit:hover { color: var(--accent); }

.btn-section-edit--cancel {
    color: var(--text-muted);
}

.detail-view {
    padding: .75rem 1rem;
    display: flex;
    flex-direction: column;
    gap: .5rem;
}
.detail-view[hidden] { display: none; }

.detail-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: .5rem;
}

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

.detail-row-value {
    font-size: .9rem;
    color: var(--text);
}

.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;
}

.detail-section-body {
    padding: .75rem 1rem;
    display: flex;
    flex-direction: column;
    gap: .5rem;
}

.btn-row {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
}

.btn-row .btn {
    width: auto;
}

.btn-row[hidden] { display: none; }

/* Metadata form */
.metadata-form[hidden] { display: none; }
.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 .ts-wrapper {
    width: 100%;
}

.metadata-field input[type="date"],
.metadata-field input[type="number"],
.metadata-field select {
    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-uploads-target="queue"] {
    display: flex;
    flex-direction: column;
    gap: .375rem;
}

.upload-summary {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    display: flex;
    flex-direction: column;
    gap: .75rem;
    padding: 1rem;
}

.upload-summary__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
}

.upload-summary__title {
    color: var(--text);
    font-size: 1rem;
    font-weight: 700;
    margin: 0 0 .25rem;
}

.upload-summary__meta,
.upload-summary__counts {
    color: var(--text-muted);
    font-size: .85rem;
    line-height: 1.4;
    margin: 0;
}

.upload-summary__counts {
    flex-shrink: 0;
    text-align: right;
}

.upload-summary__track {
    height: .45rem;
    overflow: hidden;
    border-radius: 999px;
    background: var(--surface-2);
    border: 1px solid var(--border);
}

.upload-summary__bar {
    width: 0;
    height: 100%;
    background: var(--accent);
    transition: width .2s ease;
}

.upload-summary__details {
    display: flex;
    flex-direction: column;
    gap: .375rem;
    list-style: none;
    margin: 0;
    padding: 0;
}
.upload-summary__details[hidden] { display: none; }

.upload-summary__detail {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: .45rem .625rem;
    border-radius: var(--radius);
    background: var(--surface-2);
    border: 1px solid var(--border);
}

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

.upload-summary__status {
    flex-shrink: 0;
    font-size: .8rem;
    font-weight: 700;
}

.upload-summary__detail--existing .upload-summary__status { color: #e8a030; }
.upload-summary__detail--failed .upload-summary__status { color: var(--red); }

@media (max-width: 700px) {
    .upload-summary__header,
    .upload-summary__detail {
        align-items: stretch;
        flex-direction: column;
        gap: .375rem;
    }

    .upload-summary__counts {
        text-align: left;
    }
}

.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--done     { color: #50c878; }
.file-card-status--warning  { color: #e8a030; }
.file-card-status--error    { color: var(--red); }

.file-card--done {
    background: color-mix(in srgb, #50c878 8%, var(--surface-2));
    border-color: color-mix(in srgb, #50c878 30%, var(--border));
}

.file-card--warning {
    background: color-mix(in srgb, #e8a030 8%, var(--surface-2));
    border-color: color-mix(in srgb, #e8a030 30%, var(--border));
}

.file-card-dismiss {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    padding: 0 .2rem;
    font-size: .9rem;
    line-height: 1;
    flex-shrink: 0;
}
.file-card-dismiss:hover { color: var(--text); }
.file-card-dismiss[hidden] { display: none; }

/* 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;
    align-self: center;
}

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

.login-card-logo {
    position: absolute;
    top: -30px;
    left: 2rem;
}

.login-card-logo svg {
    width: 60px;
    height: auto;
}

.login-card h1,
.login-card__brand {
    font-size: 2.4rem;
    color: #B897D8;
    font-family: 'Pixelify Sans', monospace;
    letter-spacing: .03em;
}

.login-card__brand:hover { opacity: .75; }
.login-card-logo:hover { opacity: .75; }

.login-card__intro,
.login-card__footnote {
    color: var(--text-muted);
    font-size: .9rem;
    line-height: 1.5;
}

.login-card__intro a,
.login-card__footnote a {
    color: var(--accent);
    font-weight: 700;
}

.login-card__intro a:hover,
.login-card__footnote a:hover {
    opacity: .75;
}

.login-form .btn {
    background: linear-gradient(to bottom, #CAADEA, #9B6DC8);
    color: #1a0a2e;
    letter-spacing: 0.05rem;
    margin-top: 1rem;
    margin-bottom: 0.5rem;
}

.backoffice-section .login-form .btn {
    background: var(--accent);
    color: #000;
    letter-spacing: normal;
    margin-top: 0;
    margin-bottom: 0;
}

.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--honeypot {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

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

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

.login-field select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='none' viewBox='0 0 24 24' stroke='%238888a8' stroke-width='2.5'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M19.5 8.25l-7.5 7.5-7.5-7.5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right .85rem center;
    padding-right: 2.25rem;
    cursor: pointer;
}

.login-field input:focus,
.login-field select:focus {
    border-color: #B897D8;
}

.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;
    font-weight: 400;
    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:hover {
    color: var(--red);
    background: rgba(224,85,85,.08);
}

.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);
    border: 1px solid var(--border);
    color: var(--text);
}

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


.btn--blue {
    background: #4a8fff;
    color: #fff;
}

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

.btn--xs {
    display: inline-flex;
    width: auto;
    padding: .25rem .75rem;
    font-size: .75rem;
}

.btn--xs[hidden] { display: none; }

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

/* ── Mobile (≤ 600px) ────────────────────────────────────── */
@media (max-width: 600px) {
    .highscore-page .section-header {
        flex-direction: column;
        align-items: stretch;
        gap: .75rem;
    }

    .highscore-page .header-actions {
        margin-left: 0;
    }

    .view-toggle {
        width: 100%;
    }

    .view-toggle-btn {
        flex: 1;
        padding: .55rem .5rem;
    }

    .metric-cards-grid {
        grid-template-columns: 1fr;
    }

    .comparison-summary {
        grid-template-columns: 1fr;
    }

    .comparison-page-header {
        align-items: flex-start;
        gap: .75rem;
    }

    .comparison-title-block {
        flex-direction: column;
        align-items: flex-start;
        gap: .35rem;
        min-width: 0;
        padding-right: 1rem;
    }

    .comparison-page-header .header-actions {
        margin-left: auto;
        flex: 0 0 auto;
    }

    .comparison-page-header .comparison-back-link {
        width: auto;
        justify-content: flex-end;
        white-space: nowrap;
    }

    .comparison-summary-card {
        padding: .95rem 1rem;
    }

    .comparison-summary-row {
        gap: .75rem;
    }

    .comparison-summary-row dd {
        font-size: .95rem;
    }

    header {
        padding: .75rem 1rem;
        flex-wrap: wrap;
        gap: .5rem;
        position: sticky;
        top: 0;
        z-index: 100;
        background: var(--bg);
    }

    header nav {
        display: none;
    }

    main {
        padding: 1.5rem 1rem;
        padding-bottom: calc(4rem + env(safe-area-inset-bottom));
    }

    .bottom-nav {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: var(--bg);
        border-top: 1px solid var(--border);
        padding: 0 .5rem env(safe-area-inset-bottom);
        z-index: 100;
    }

    .page-title {
        display: none;
    }

    .section-header:has(> .page-title:only-child) {
        display: none;
    }

    .header-actions {
        margin-left: auto;
    }

    .stats-page .section-header {
        flex-direction: column;
        align-items: stretch;
    }

    .stats-page .header-actions {
        margin-left: 0;
        flex-direction: column;
        align-items: stretch;
    }

    .stats-page .month-filter {
        width: 100%;
    }

    .login-page {
        max-width: 100%;
    }

    body:has(.login-page) {
        min-height: 100dvh;
    }

    body:has(.login-page) main {
        padding-top: 2rem;
        padding-bottom: 2rem;
    }

    .login-card {
        border-radius: 0;
        border-left: none;
        border-right: none;
        margin: 0 -1rem;
    }

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

    .date-full { display: none; }
    .date-short { display: inline; }

/* Delta values move below the stat value on mobile */
    .delta { display: block; margin-left: 0; }
    .comparison-panel .delta { display: inline; margin-left: .3em; }

    /* Stats table: hide individual columns and date, show combined cell */
    .col-xp, .col-catches, .col-pokestops, .col-distance { display: none; }
    .col-date { display: none; }
    .stats-page .combined-cell { display: table-cell; }
    .stats-page .combined-cell[hidden] { display: none; }
    .combined-cell .delta {
        display: inline;
        margin-left: 0;
        font-size: .72em;
        font-weight: 600;
        color: color-mix(in srgb, #50c878 75%, var(--text-muted));
    }

    .combined-cell .delta--neg {
        color: color-mix(in srgb, var(--red) 80%, var(--text-muted));
    }

    /* Medals: hide Value column, show inline value inside medal name cell */
    .medals-page .stat-cell { display: none; }
    .combined-cell__value {
        display: inline-flex;
        align-items: baseline;
        justify-content: flex-end;
        gap: .35rem;
        min-width: 0;
    }
    .combined-cell__value[hidden] { display: none; }
    .stats-page .combined-cell__meta,
    .medals-page .combined-cell__meta { display: flex; }
    .stats-page .combined-cell__meta[hidden],
    .medals-page .combined-cell__meta[hidden] { display: none; }
    .stats-page .combined-cell__row,
    .medals-page .combined-cell__row {
        display: flex;
        justify-content: space-between;
        align-items: baseline;
        gap: .5rem;
        line-height: 1.7;
    }
    .stats-page .combined-cell__row[hidden],
    .medals-page .combined-cell__row[hidden] { display: none; }
    .combined-cell__label {
        color: var(--text-muted);
        font-size: .75em;
        text-transform: uppercase;
        letter-spacing: .05em;
        flex-shrink: 0;
    }

    .medals-page .combined-cell__label {
        color: var(--text);
        font-size: .9rem;
        font-weight: 600;
        letter-spacing: 0;
        text-transform: none;
    }

    .medals-page .combined-cell--bronze .combined-cell__label,
    .medals-page .combined-cell--silver .combined-cell__label,
    .medals-page .combined-cell--gold .combined-cell__label,
    .medals-page .combined-cell--platinum .combined-cell__label {
        color: var(--text);
    }

    .medals-page .combined-cell__value {
        padding: .15rem .45rem;
        border: 1px solid var(--border);
        border-radius: 999px;
        background: var(--surface-2);
        line-height: 1.4;
    }

    /* Stars move to the left on mobile */
    .stat-cell--gold::after, .stat-cell--silver::after, .stat-cell--bronze::after { content: none; }
    .stat-cell--gold::before { content: '★ '; font-size: .9em; color: #ffd700; }
    .stat-cell--silver::before { content: '★ '; font-size: .9em; color: #b8b8c8; }
    .stat-cell--bronze::before { content: '★ '; font-size: .9em; color: #cd7f32; }

    .highscore-page .metric-value__award {
        order: 1;
    }

    .highscore-page .metric-value .manual-catch-flag {
        order: 2;
    }

    .highscore-page .metric-value__number {
        order: 3;
    }

    /* Flags move to the left on mobile */
    .flag--desktop { display: none; }
    .flag--mobile { display: inline-flex; }
    .flag--mobile[hidden] { display: none; }

    .leaderboard-totals {
        grid-template-columns: 1fr;
    }

    .profile-highlights {
        grid-template-columns: 1fr;
    }

    .profile-highlights__card,
    .leaderboard-totals__card {
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
        column-gap: .5rem;
        row-gap: .15rem;
        padding: .65rem .85rem;
    }

    .profile-highlights__header,
    .leaderboard-totals__header {
        display: contents;
    }

    .profile-highlights__icon,
    .leaderboard-totals__icon {
        order: -2;
        display: flex;
        flex-shrink: 0;
    }

    .profile-highlights__card {
        position: relative;
    }

    .profile-highlights__icon {
        position: absolute;
        top: .65rem;
        right: .85rem;
    }

    .profile-highlights__value,
    .leaderboard-totals__value {
        order: -1;
        font-size: 1.1rem;
        flex-shrink: 0;
    }

    .profile-highlights__label,
    .leaderboard-totals__label {
        text-transform: none;
        letter-spacing: 0;
        font-size: .85rem;
        align-self: flex-end;
    }

    .leaderboard-totals__icon {
        order: 1;
        margin-left: auto;
        align-self: flex-start;
    }

    .leaderboard-totals__avg {
        order: 2;
        flex-basis: 100%;
    }

    .highscore-page .table-scroll {
        margin-left: -1rem;
        margin-right: -1rem;
        border-radius: 0;
        border-left: none;
        border-right: none;
    }

    .highscore-page .rank-cell {
        width: auto;
        min-width: max-content;
        max-width: none;
        padding-right: .5rem;
        text-align: left;
    }

    .highscore-page .name-cell {
        display: none;
    }

    .highscore-page .rank-cell__desktop-label {
        display: none;
    }

    .highscore-page .rank-cell__mobile-label {
        display: inline;
    }

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

    .highscore-page .rank-cell__content {
        display: inline-flex;
        align-items: center;
        justify-content: flex-start;
    }

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

    .highscore-page .rank-cell__number {
        display: none;
    }

    .highscore-page .rank-cell__mobile-name {
        display: inline-flex;
        align-items: center;
        gap: .4rem;
        width: max-content;
        max-width: calc(16px + .4rem + 120px);
        overflow: hidden;
        color: var(--text);
    }

    .highscore-page .rank-cell__mobile-name a {
        display: block;
        flex: 0 1 auto;
        max-width: 120px;
    }

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

    .highscore-page .rank-cell__mobile-name a:hover {
        color: var(--team-color, var(--accent));
    }

    /* Stats + Medals: card list instead of table on mobile */
    .stats-page .table-scroll,
    .medals-page .table-scroll {
        overflow: visible;
        background: transparent;
        border: none;
        border-radius: 0;
    }

    .stats-page .data-table,
    .medals-page .data-table {
        display: block;
    }

    .stats-page .data-table thead,
    .medals-page .data-table thead {
        display: none;
    }

    .stats-page .data-table tbody,
    .medals-page .data-table tbody {
        display: flex;
        flex-direction: column;
        gap: .75rem;
    }

    .stats-page .data-table tr,
    .medals-page .data-table tr {
        display: block;
        position: relative;
        background: var(--surface);
        border-radius: var(--radius);
        border: 1px solid var(--border);
        overflow: hidden;
    }

    .stats-page .data-table tr[hidden],
    .medals-page .data-table tr[hidden] { display: none; }

    .stats-page .data-table tr:hover,
    .medals-page .data-table tr:hover {
        background: var(--surface);
    }

    .stats-page .data-table tr.row--selected,
    .stats-page .data-table tr.row--selected:hover {
        background: var(--accent-dim);
    }

    .stats-page .data-table tbody tr:hover td,
    .medals-page .data-table tbody tr:hover td {
        background: transparent;
    }

    .stats-page .data-table tbody tr.row--selected:hover td {
        background: var(--accent-dim);
    }

    .stats-page .data-table td,
    .medals-page .data-table td {
        display: none;
        border: none;
        padding: 0;
    }

    /* Content cell: takes full width */
    .stats-page .data-table .combined-cell,
    .medals-page .data-table .combined-cell {
        display: block;
        padding: .75rem 1rem;
        white-space: normal;
    }

    /* Header area inside card: filename + date stacked vertically, right padding for the button */
    .stats-page .data-table .combined-cell__meta,
    .medals-page .data-table .combined-cell__meta {
        display: block;
        padding-right: 2.5rem;
        padding-bottom: .5rem;
        margin-bottom: .5rem;
        border-bottom: 1px solid var(--border);
    }

    .stats-page .data-table .combined-cell__meta-primary,
    .medals-page .data-table .combined-cell__meta-primary {
        display: inline;
        font-size: .85rem;
        color: var(--text);
        font-weight: 500;
    }

    .stats-page .data-table .combined-cell__select-hint {
        display: inline-flex;
        align-items: center;
        margin-left: .3rem;
        background: var(--surface-2);
        color: var(--text-muted);
        font-size: .7rem;
        font-weight: 600;
        padding: .15rem .45rem;
        border-radius: .3rem;
        line-height: 1.4;
    }

    .stats-page .data-table .combined-cell__select-hint[hidden] { display: none; }

    /* Settings button: absolute top-right, padding compensates for btn-settings' own .25rem padding */
    .stats-page .data-table .action-cell,
    .medals-page .data-table .action-cell {
        display: block;
        position: absolute;
        top: 0;
        right: 0;
        padding: .5rem .75rem;
        border: none;
        background: transparent;
    }

    .stats-page .data-table tbody tr:hover .action-cell,
    .medals-page .data-table tbody tr:hover .action-cell,
    .stats-page .data-table tbody tr.row--selected:hover .action-cell {
        background: transparent;
    }

    .upload-card {
        padding: 1.25rem;
    }

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

    .detail-filename {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        min-width: 0;
    }
}

@media (max-width: 700px) {
    .settings-danger-grid {
        grid-template-columns: 1fr;
    }
}

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

.settings-flash {
    color: #4caf7d;
    font-size: .875rem;
}

.settings-form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.settings-section {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: .75rem;
}

.settings-section__title {
    font-size: 1rem;
    font-weight: 700;
}

.settings-section__desc {
    font-size: .875rem;
    color: var(--text-muted);
}

.settings-section__desc strong {
    color: var(--text);
}

.settings-actions {
    max-width: 280px;
}

.settings-check {
    display: flex;
    align-items: flex-start;
    gap: .65rem;
    color: var(--text);
    font-size: .9rem;
    font-weight: 600;
}

.settings-check[hidden] { display: none; }

.settings-check input {
    margin-top: .2rem;
    accent-color: var(--accent);
}

.settings-trust-list {
    display: grid;
    gap: .55rem;
    color: var(--text-muted);
    font-size: .875rem;
    padding-left: 1.2rem;
}

.settings-trust-list[hidden] { display: none; }

.settings-danger-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}

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

.settings-section--trust {
    border-color: color-mix(in srgb, #7dd3a8 25%, var(--border));
}

.settings-section--danger {
    border-color: color-mix(in srgb, var(--red) 35%, var(--border));
}

.settings-section--danger .btn {
    align-self: flex-start;
}

/* Location search */
.city-search {
    position: relative;
    max-width: 420px;
}

.city-search__field {
    position: relative;
    display: flex;
    align-items: center;
}

.city-search__input {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-size: .9rem;
    padding: .45rem 2rem .45rem .75rem;
    width: 100%;
}

.city-search__input:focus {
    outline: none;
    border-color: var(--accent, var(--border));
}

.city-search__input:invalid {
    border-color: #f87171;
}

.city-search__clear {
    position: absolute;
    right: .6rem;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
    padding: 0 .2rem;
}

.city-search__clear:hover {
    color: var(--text);
}

.city-search__clear[hidden] { display: none; }

.city-search__dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 8px;
    list-style: none;
    margin: 0;
    padding: .25rem 0;
    z-index: 100;
    max-height: 240px;
    overflow-y: auto;
}

.city-search__dropdown[hidden] { display: none; }

.city-search__option {
    padding: .45rem .75rem;
    font-size: .9rem;
    cursor: pointer;
}

.city-search__option:hover {
    background: var(--surface-3, var(--surface));
}

/* Team selector */
.team-selector {
    display: flex;
    gap: .65rem;
    flex-wrap: wrap;
}

.team-card {
    display: flex;
    align-items: center;
    gap: .55rem;
    padding: .5rem .9rem;
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: border-color .15s, background .15s;
}

.team-card:has(input:checked) {
    border-color: var(--team-color, var(--text-muted));
    background: color-mix(in srgb, var(--team-color, var(--text-muted)) 12%, transparent);
}

.team-card input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    pointer-events: none;
}

.team-card__dot {
    width: 11px;
    height: 11px;
    border-radius: 50%;
    background: var(--team-color, transparent);
    border: 1.5px solid var(--team-color, var(--text-muted));
    flex-shrink: 0;
}

.team-card__name {
    font-size: .875rem;
    font-weight: 600;
}

/* Profile menu divider */
.profile-menu-divider {
    height: 1px;
    background: var(--border);
    margin: .3rem .35rem;
}

/* Public landing */
.landing-page {
    width: 100%;
    max-width: 1200px;
    display: flex;
    flex-direction: column;
    gap: 5rem;
}

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

.landing-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    width: 100%;
}

.landing-nav[hidden] { display: none; }

.landing-brand {
    display: inline-flex;
    align-items: center;
    gap: .55rem;
    color: #caa6ea;
    font-family: 'Pixelify Sans', monospace;
    font-size: 1.15rem;
    font-weight: 700;
}

.landing-brand[hidden] { display: none; }

.landing-nav__links {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.landing-nav__links[hidden] { display: none; }

.landing-nav__links a {
    color: var(--text-muted);
    font-size: .9rem;
    font-weight: 600;
}

.landing-nav__links a:hover,
.landing-nav__links a:focus-visible {
    color: var(--text);
}

.landing-nav__links .landing-nav__cta {
    color: #0f0f13;
    background: var(--accent);
    border-radius: 999px;
    padding: .55rem .9rem;
}

.landing-hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(320px, .86fr);
    align-items: center;
    gap: 3rem;
    min-height: min(720px, calc(100vh - 10rem));
}

.landing-hero[hidden] { display: none; }

.landing-hero__content {
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
}

.landing-hero__content[hidden] { display: none; }

.landing-kicker {
    color: #7dd3a8;
    font-size: .78rem;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.landing-hero h1,
.landing-section h2,
.landing-final-cta h2,
.legal-page h1 {
    color: var(--text);
    letter-spacing: 0;
    line-height: 1.05;
}

.landing-hero h1 {
    max-width: 760px;
    font-size: clamp(2.55rem, 5vw, 5rem);
}

.landing-hero__lead {
    max-width: 680px;
    color: #c5c5d8;
    font-size: clamp(1.05rem, 2vw, 1.25rem);
    line-height: 1.65;
}

.landing-actions {
    display: flex;
    gap: .85rem;
    flex-wrap: wrap;
    align-items: center;
    margin-top: .3rem;
}

.landing-actions[hidden] { display: none; }

.landing-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 46px;
    border-radius: 999px;
    padding: .75rem 1.1rem;
    font-weight: 800;
    border: 1px solid transparent;
}

.landing-btn[hidden] { display: none; }

.landing-btn--primary {
    background: linear-gradient(135deg, var(--accent), #7dd3a8);
    color: #101014;
}

.landing-btn--secondary {
    color: var(--text);
    border-color: var(--border);
    background: rgba(255, 255, 255, .04);
}

.landing-btn:hover,
.landing-btn:focus-visible {
    transform: translateY(-1px);
}

.landing-trust-line {
    color: var(--text-muted);
    font-size: .92rem;
}

.landing-demo {
    display: flex;
    justify-content: center;
}

.landing-demo[hidden] { display: none; }

.landing-demo__window {
    width: min(100%, 460px);
    border: 1px solid rgba(255, 255, 255, .12);
    border-radius: 18px;
    overflow: hidden;
    background: linear-gradient(160deg, rgba(34, 34, 46, .98), rgba(20, 20, 28, .98));
    box-shadow: 0 28px 80px rgba(0, 0, 0, .45);
}

.landing-demo__window[hidden] { display: none; }

.landing-demo__topbar {
    display: flex;
    gap: .4rem;
    padding: .85rem 1rem;
    border-bottom: 1px solid var(--border);
}

.landing-demo__topbar[hidden] { display: none; }

.landing-demo__topbar span {
    width: .65rem;
    height: .65rem;
    border-radius: 999px;
    background: var(--text-muted);
    opacity: .5;
}

.landing-demo__body {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 1rem;
}

.landing-demo__body[hidden] { display: none; }

.landing-demo__panel {
    background: rgba(255, 255, 255, .045);
    border: 1px solid rgba(255, 255, 255, .09);
    border-radius: 10px;
    padding: 1rem;
}

.landing-demo__panel--wide {
    display: flex;
    flex-direction: column;
    gap: .9rem;
}

.landing-demo__panel--wide[hidden] { display: none; }

.landing-demo__label {
    display: block;
    color: var(--text-muted);
    font-size: .72rem;
    font-weight: 800;
    letter-spacing: .06em;
    text-transform: uppercase;
}

.landing-demo__label[hidden] { display: none; }

.landing-demo__panel strong {
    display: block;
    color: var(--text);
    font-size: 1.45rem;
    margin-top: .15rem;
}

.landing-demo__panel strong[hidden] { display: none; }

.landing-demo__chart {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    align-items: end;
    gap: .45rem;
    height: 120px;
}

.landing-demo__chart[hidden] { display: none; }

.landing-demo__chart span {
    display: block;
    min-height: 32px;
    border-radius: 7px 7px 3px 3px;
    background: linear-gradient(180deg, #7dd3a8, var(--accent));
}

.landing-demo__chart span[hidden] { display: none; }

.landing-demo__chart span:nth-child(1) { height: 42%; }
.landing-demo__chart span:nth-child(2) { height: 64%; }
.landing-demo__chart span:nth-child(3) { height: 52%; }
.landing-demo__chart span:nth-child(4) { height: 82%; }
.landing-demo__chart span:nth-child(5) { height: 100%; }

.landing-demo__grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}

.landing-demo__grid[hidden] { display: none; }

.landing-demo__upload {
    display: flex;
    align-items: center;
    gap: .55rem;
    color: #7dd3a8;
    background: rgba(125, 211, 168, .1);
    border: 1px solid rgba(125, 211, 168, .2);
    border-radius: 10px;
    padding: .85rem 1rem;
    font-size: .9rem;
    font-weight: 700;
}

.landing-demo__upload[hidden] { display: none; }

.landing-section {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.landing-section[hidden] { display: none; }

.landing-section__header {
    display: flex;
    flex-direction: column;
    gap: .65rem;
    max-width: 760px;
}

.landing-section__header[hidden] { display: none; }

.landing-section h2,
.landing-final-cta h2 {
    font-size: clamp(1.85rem, 3.2vw, 3rem);
}

.landing-section__header p:not(.landing-kicker),
.landing-trust p,
.landing-final-cta p,
.legal-page p {
    color: #b8b8cb;
    font-size: 1rem;
    line-height: 1.65;
}

.landing-card-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1rem;
}

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

.landing-card-grid--four {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.landing-card {
    display: flex;
    flex-direction: column;
    gap: .7rem;
    min-height: 190px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: linear-gradient(180deg, rgba(255, 255, 255, .05), rgba(255, 255, 255, .02));
    padding: 1.2rem;
}

.landing-card[hidden] { display: none; }

.landing-card svg {
    color: var(--accent);
}

.landing-card h3 {
    color: var(--text);
    font-size: 1.05rem;
}

.landing-card p {
    color: var(--text-muted);
    font-size: .95rem;
    line-height: 1.55;
}

.landing-card--compact {
    min-height: 165px;
}

.landing-section--split,
.landing-trust {
    display: grid;
    grid-template-columns: minmax(0, .9fr) minmax(280px, 1fr);
    gap: 2rem;
    align-items: start;
    border: 1px solid var(--border);
    border-radius: 18px;
    background: radial-gradient(circle at top left, rgba(245, 166, 35, .12), transparent 34%), var(--surface);
    padding: 2rem;
}

.landing-section--split[hidden],
.landing-trust[hidden] { display: none; }

.landing-feature-list,
.landing-trust-list {
    display: grid;
    gap: .8rem;
    list-style: none;
}

.landing-feature-list[hidden],
.landing-trust-list[hidden] { display: none; }

.landing-feature-list div,
.landing-trust-list li {
    display: flex;
    align-items: center;
    gap: .75rem;
    color: var(--text);
    background: rgba(255, 255, 255, .045);
    border: 1px solid rgba(255, 255, 255, .08);
    border-radius: 10px;
    padding: .9rem 1rem;
    font-weight: 700;
}

.landing-feature-list div[hidden],
.landing-trust-list li[hidden] { display: none; }

.landing-feature-list svg,
.landing-trust-list svg {
    color: #7dd3a8;
    flex-shrink: 0;
}

.landing-results {
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    padding: 2.5rem 0;
}

.landing-result-list {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: .8rem;
    list-style: none;
}

.landing-result-list[hidden] { display: none; }

.landing-result-list li {
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    padding: 1rem;
    font-weight: 700;
}

.landing-trust a,
.legal-back {
    color: var(--accent);
    font-weight: 800;
}

.legal-back:hover { opacity: .75; }

.landing-trust-links {
    display: flex;
    flex-wrap: wrap;
    gap: .8rem;
    margin-top: .8rem;
}

.landing-trust-links[hidden] { display: none; }

.legal-page a:not(.legal-back),
.settings-section__desc a {
    color: var(--accent);
    font-weight: 700;
}

.legal-page a:not(.legal-back):hover,
.settings-section__desc a:hover {
    opacity: .75;
}

.landing-disclaimer {
    border: 1px solid rgba(245, 166, 35, .35);
    border-radius: 12px;
    background: rgba(245, 166, 35, .08);
    padding: 1rem 1.2rem;
}

.landing-disclaimer[hidden] { display: none; }

.landing-disclaimer p {
    color: #ded5c5;
    font-size: .92rem;
}

.landing-final-cta {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    text-align: center;
    border-radius: 18px;
    background: linear-gradient(135deg, rgba(245, 166, 35, .16), rgba(125, 211, 168, .1));
    border: 1px solid rgba(255, 255, 255, .1);
    padding: 3rem 1.5rem;
}

.landing-final-cta[hidden] { display: none; }

.landing-final-cta span {
    color: var(--text-muted);
    font-size: .9rem;
}

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

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

.legal-page h1 {
    font-size: clamp(2rem, 4vw, 3.4rem);
}

.legal-page section {
    display: flex;
    flex-direction: column;
    gap: .55rem;
    border-top: 1px solid var(--border);
    padding-top: 1.2rem;
}

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

.legal-page h2 {
    color: var(--text);
    font-size: 1.15rem;
}

@media (max-width: 980px) {
    .landing-page {
        gap: 4rem;
    }

    .landing-hero,
    .landing-section--split,
    .landing-trust {
        grid-template-columns: 1fr;
    }

    .landing-card-grid,
    .landing-card-grid--four,
    .landing-result-list {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 720px) {
    main {
        padding: 1.25rem 1rem 2rem;
    }

    .landing-nav {
        align-items: flex-start;
        flex-direction: column;
    }

    .landing-nav__links {
        justify-content: flex-start;
    }

    .landing-nav__links a:not(.landing-nav__cta) {
        display: none;
    }

    .landing-nav__links a:not(.landing-nav__cta)[hidden] { display: none; }

    .landing-hero {
        min-height: 0;
        gap: 2rem;
    }

    .landing-actions,
    .landing-btn {
        width: 100%;
    }

    .landing-demo__grid,
    .landing-card-grid,
    .landing-card-grid--four,
    .landing-result-list {
        grid-template-columns: 1fr;
    }

    .landing-section--split,
    .landing-trust,
    .landing-final-cta {
        border-radius: 14px;
        padding: 1.25rem;
    }
}
