/* ============================================
   PADEL — minimal sports-app design
   Light by default. Dark via body.dark.
   Mobile-first → tablet portrait (768+) → landscape (1024+) → wide (1600+)
   ============================================ */

:root {
    /* Surfaces */
    --bg: #FAFAF8;
    --surface: #FFFFFF;
    --surface-2: #F4F4F1;

    /* Text */
    --text: #1A1A19;
    --text-2: #6B6B66;
    --text-3: #9C9C95;

    /* Borders */
    --border: rgba(0, 0, 0, 0.08);
    --border-2: rgba(0, 0, 0, 0.15);

    /* Brand */
    --primary: #0F6E56;
    --primary-2: #0A4D3D;
    --primary-soft: #E1F5EE;

    /* Court identity */
    --court-1: #378ADD;
    --court-1-soft: #E6F1FB;
    --court-2: #7F77DD;
    --court-2-soft: #EEEDFE;
    --court-3: #1D9E75;
    --court-3-soft: #E1F5EE;

    /* Semantic */
    --win: #1D9E75;
    --loss: #E24B4A;
    --loss-soft: rgba(226, 75, 74, 0.08);
    --gold: #BA7517;
    --gold-text: #854F0B;
    --gold-soft: #FAEEDA;
    --silver: #888888;
    --bronze: #A0612C;

    /* Radii */
    --radius-card: 16px;
    --radius-btn: 12px;
    --radius-input: 10px;

    /* Backwards-compat aliases — gamle inline-styles fra script.js bruger disse */
    --txt: var(--text);
    --txt-m: var(--text-2);
    --txt-d: var(--text-3);
    --gl: var(--surface-2);
    --gl-2: var(--surface);
    --gl-b: var(--border);
    --gl-b-2: var(--border-2);
    --g: var(--primary);
    --g-lt: var(--primary-2);
    --g-dk: var(--primary-2);
    --p: var(--primary);
    --p-dk: var(--primary-2);
    --r: var(--loss);
    --bg-2: var(--bg);
    --teamA: var(--court-1);
    --teamB: var(--court-2);
}

body.dark {
    --bg: #0E1411;
    --surface: #19211C;
    --surface-2: #1F2924;
    --text: #ECEFEC;
    --text-2: #9AA49D;
    --text-3: #6B756E;
    --border: rgba(255, 255, 255, 0.08);
    --border-2: rgba(255, 255, 255, 0.15);
    --primary: #1D9E75;
    --primary-2: #5DCAA5;
    --primary-soft: rgba(29, 158, 117, 0.18);
    --court-1-soft: rgba(55, 138, 221, 0.15);
    --court-2-soft: rgba(127, 119, 221, 0.15);
    --court-3-soft: rgba(29, 158, 117, 0.15);
    --gold-soft: rgba(186, 117, 23, 0.18);
    --gold-text: #E5C58E;
    --silver: #C2C2C2;
    --bronze: #D4905A;
    --loss-soft: rgba(226, 75, 74, 0.14);
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

::-webkit-scrollbar { display: none; }
* { scrollbar-width: none; -ms-overflow-style: none; }

body {
    font-family: 'Poppins', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--text);
    margin: 0;
    padding: 12px;
    padding-bottom: calc(56px + env(safe-area-inset-bottom));
    min-height: 100vh;
    -webkit-tap-highlight-color: transparent;
    overflow-x: hidden;
    font-size: 14px;
    font-weight: 400;
    line-height: 1.5;
    letter-spacing: 0;
    transition: background 0.2s, color 0.2s;
}

@media (min-width: 768px) {
    body {
        padding: 16px;
        padding-bottom: calc(80px + env(safe-area-inset-bottom));
    }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}

/* ============================================
   APP CONTAINER
   ============================================ */
.app {
    max-width: 100%;
    margin: 0 auto;
    display: block;
}

/* ============================================
   HEADER
   ============================================ */
.hdr {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 4px 16px;
    position: relative;
    gap: 12px;
}
.hdr-title {
    font-size: 22px;
    font-weight: 500;
    margin: 0;
    color: var(--text);
    letter-spacing: 0;
    flex: 1;
    text-align: center;
}
.theme-btn {
    background: transparent;
    border: 0.5px solid var(--border);
    border-radius: 50%;
    padding: 0;
    cursor: pointer;
    color: var(--text);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    transition: background 0.15s, color 0.15s;
    flex-shrink: 0;
}
.theme-btn:hover { background: var(--surface-2); }
.theme-btn:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--primary-soft); }
.theme-btn svg { width: 18px; height: 18px; }

.dot {
    width: 8px;
    height: 8px;
    background: var(--text-3);
    border-radius: 50%;
    flex-shrink: 0;
    transition: background 0.15s;
}
.dot.on { background: var(--primary); }

/* ============================================
   BOTTOM NAV (mobile/portrait) — slank version
   ============================================ */
.nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--surface);
    border-top: 0.5px solid var(--border);
    display: flex;
    z-index: 100;
    padding: 2px 2px;
    padding-bottom: calc(2px + env(safe-area-inset-bottom));
    gap: 0;
}
.nav button {
    flex: 1;
    background: transparent;
    border: none;
    padding: 6px 2px 4px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    color: var(--text-2);
    cursor: pointer;
    border-radius: 10px;
    font-size: 10px;
    font-weight: 400;
    font-family: inherit;
    min-height: 48px;
    letter-spacing: 0;
    position: relative;
    transition: color 0.15s, background 0.15s;
}
.nav button svg {
    width: 20px;
    height: 20px;
    stroke: currentColor;
    fill: none;
    stroke-width: 1.5;
    stroke-linecap: round;
    stroke-linejoin: round;
    flex-shrink: 0;
}

/* Aktiv tab: tydelig grøn pille-baggrund + bold tekst + topindikator */
.nav button.act {
    color: var(--primary);
    background: var(--primary-soft);
    font-weight: 500;
}
.nav button.act::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 28px;
    height: 3px;
    background: var(--primary);
    border-radius: 0 0 3px 3px;
}
.nav button:focus-visible { outline: none; box-shadow: 0 0 0 2px var(--primary-soft); }

/* På større skærme må navigationen gerne fylde lidt mere */
@media (min-width: 768px) {
    .nav {
        padding: 6px 4px;
        padding-bottom: calc(6px + env(safe-area-inset-bottom));
        gap: 2px;
    }
    .nav button {
        padding: 8px 4px;
        gap: 2px;
        font-size: 11px;
        min-height: 56px;
        border-radius: 10px;
    }
    .nav button svg { width: 22px; height: 22px; }
}

/* ============================================
   TABS / SECTIONS
   ============================================ */
.tab { display: none; }
.tab.act {
    display: block;
    animation: fadeIn 0.18s ease;
}
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ============================================
   CARDS
   ============================================ */
.card {
    background: var(--surface);
    border: 0.5px solid var(--border);
    border-radius: var(--radius-card);
    padding: 20px;
    margin-bottom: 16px;
}
.card h3 {
    font-size: 14px;
    font-weight: 500;
    margin: 0 0 4px;
    color: var(--text);
    letter-spacing: 0;
}
.card .caption {
    font-size: 12px;
    color: var(--text-2);
    margin: 0 0 16px;
    display: block;
    line-height: 1.5;
}
.card h3 + .caption { margin-top: 4px; margin-bottom: 16px; }
.card-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    gap: 12px;
}
.card-head h3 { margin: 0; flex: 1; }

.danger-card { border-color: var(--border); }

/* ============================================
   BUTTONS
   ============================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius-btn);
    padding: 12px 20px;
    font-size: 14px;
    font-weight: 500;
    letter-spacing: 0;
    text-transform: none;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.15s, transform 0.1s, color 0.15s;
    min-height: 44px;
    width: 100%;
}
.btn:hover { background: var(--primary-2); }
.btn:active { transform: scale(0.98); }
.btn:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--primary-soft); }

.btn.sec {
    background: transparent;
    color: var(--text);
    border: 0.5px solid var(--border-2);
}
.btn.sec:hover { background: var(--surface-2); }

.btn.sml {
    background: var(--surface-2);
    color: var(--text);
    border: none;
    padding: 8px 14px;
    font-size: 13px;
    border-radius: var(--radius-input);
    width: auto;
    min-height: 36px;
}
.btn.sml.sec {
    background: transparent;
    border: 0.5px solid var(--border-2);
}
.btn.sml:hover { background: var(--border); }

.btn.danger {
    color: var(--loss);
    border: 0.5px solid var(--loss);
    background: transparent;
}
.btn.danger:hover { background: var(--loss-soft); color: var(--loss); }

.btn-meta {
    font-size: 12px;
    font-weight: 400;
    opacity: 0.75;
    margin-left: 4px;
    font-variant-numeric: tabular-nums;
}

/* ============================================
   FORMS
   ============================================ */
input, select, textarea {
    background: var(--surface-2);
    border: 0.5px solid var(--border);
    border-radius: var(--radius-input);
    padding: 12px 14px;
    font-size: 14px;
    color: var(--text);
    font-family: inherit;
    font-weight: 400;
    width: 100%;
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
    min-height: 44px;
    letter-spacing: 0;
}
input:focus, select:focus, textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-soft);
}
select {
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='none' stroke='%236B6B66' stroke-width='1.4' stroke-linecap='round' stroke-linejoin='round' d='M3 4.5L6 7.5L9 4.5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 32px;
    cursor: pointer;
}
body.dark select {
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='none' stroke='%239AA49D' stroke-width='1.4' stroke-linecap='round' stroke-linejoin='round' d='M3 4.5L6 7.5L9 4.5'/%3E%3C/svg%3E");
}

label {
    display: block;
    font-size: 12px;
    color: var(--text-2);
    margin-bottom: 6px;
    letter-spacing: 0;
}

/* ============================================
   TIMER (på "I dag"-fanen)
   ============================================ */
.timer-card { text-align: center; }
.timer-display {
    font-size: 56px;
    font-weight: 500;
    color: var(--text);
    font-variant-numeric: tabular-nums;
    line-height: 1;
    margin: 16px 0 18px;
    letter-spacing: -0.5px;
    transition: color 0.2s;
}
.timer-display.warning { color: var(--loss); }
.timer-setup {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--text-2);
    font-size: 12px;
}
.timer-min-input {
    width: 56px;
    text-align: center;
    padding: 6px 8px;
    font-size: 14px;
    min-height: 0;
    font-weight: 500;
    color: var(--text);
}
.timer-controls {
    display: flex;
    gap: 8px;
}
.timer-controls .btn { flex: 1; width: auto; }

/* ============================================
   COURT CARDS (Kamp tab)
   ============================================ */
.courts-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 16px;
}

.court-card {
    background: var(--surface);
    border: 0.5px solid var(--border);
    border-left: 3px solid var(--court-1);
    border-radius: 0 14px 14px 0;
    padding: 16px;
}
.court-card.court-2 { border-left-color: var(--court-2); }
.court-card.court-3 { border-left-color: var(--court-3); }

.court-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
    gap: 8px;
}
.court-name {
    font-size: 12px;
    color: var(--text-2);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 500;
    margin: 0;
}

.serve-info {
    font-size: 12px;
    color: var(--primary);
    text-align: center;
    height: 16px;
    margin-bottom: 8px;
    font-weight: 500;
}

.team-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 8px;
}
.team-row select { font-size: 13px; padding: 10px 12px; padding-right: 28px; min-height: 40px; }

.score-input {
    font-size: 32px;
    font-weight: 500;
    text-align: center;
    font-variant-numeric: tabular-nums;
    background: var(--surface-2);
    border: 0.5px dashed var(--border-2);
    color: var(--text-3);
    padding: 12px;
    margin-bottom: 8px;
    letter-spacing: 0;
    width: 100%;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.score-input:not(:placeholder-shown) {
    border-style: solid;
    color: var(--text);
    background: var(--surface);
    border-color: var(--border);
}
.score-input.winning {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    border-style: solid;
}
.score-input.losing {
    color: var(--text-3);
}
.score-input::-webkit-inner-spin-button,
.score-input::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
.score-input { -moz-appearance: textfield; }

.vs-divider {
    font-size: 11px;
    letter-spacing: 1.5px;
    color: var(--text-3);
    text-align: center;
    text-transform: uppercase;
    padding: 6px 0;
    margin: 4px 0;
    font-weight: 400;
}

.save-match-btn { margin-top: 8px; }

/* ============================================
   ROUND INDICATOR + I DAG
   ============================================ */
.round-indicator {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 16px;
    gap: 8px;
}
.round-indicator .caption { margin: 0; font-size: 12px; }
.round-text {
    font-size: 18px;
    font-weight: 500;
    color: var(--text);
    font-variant-numeric: tabular-nums;
}

#todayCourts {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
}
.today-court {
    background: var(--surface-2);
    border: 0.5px solid var(--border);
    border-left: 3px solid var(--court-1);
    border-radius: 0 12px 12px 0;
    padding: 12px 14px;
}
.today-court.court-2 { border-left-color: var(--court-2); }
.today-court.court-3 { border-left-color: var(--court-3); }
.today-court-name {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-2);
    margin-bottom: 6px;
    font-weight: 500;
}
.today-match {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.today-team {
    font-size: 14px;
    color: var(--text);
    font-weight: 500;
}
.today-vs {
    font-size: 11px;
    color: var(--text-3);
    letter-spacing: 1px;
    text-transform: uppercase;
    padding: 2px 0;
}

.action-row {
    display: flex;
    gap: 8px;
}
.action-row .btn { flex: 1; width: auto; }
.action-panel { display: flex; flex-direction: column; gap: 8px; }

.empty-msg {
    font-size: 13px;
    color: var(--text-2);
    font-style: italic;
    padding: 16px 12px;
    text-align: center;
}

/* ============================================
   LEADERBOARD (grid-baseret, ingen <table>)
   ============================================ */
.lb-table { display: flex; flex-direction: column; }
.lb-head, #lBoard > .lb-row {
    display: grid;
    /* Mobil: kun rank, navn, form, point — K/V/diff skjules nedenfor */
    grid-template-columns: 22px 1fr 64px 48px;
    gap: 8px;
    align-items: center;
    padding: 12px 0;
}
.lb-head {
    font-size: 11px;
    color: var(--text-2);
    border-bottom: 0.5px solid var(--border);
    font-weight: 500;
    letter-spacing: 0.3px;
    padding: 8px 0;
    text-transform: uppercase;
}

/* På mobil: skjul K, V og +/- — for lidt plads til 7 kolonner */
.lb-head > span:nth-child(3),
.lb-head > span:nth-child(4),
.lb-head > span:nth-child(6),
.lb-row .lb-k,
.lb-row .lb-w,
.lb-row .lb-diff { display: none; }

/* På synlige kolonner: justering */
.lb-head > span:nth-child(5) { text-align: center; }
.lb-head > span:nth-child(7) { text-align: right; }

#lBoard > .lb-row {
    border-bottom: 0.5px solid var(--border);
    font-size: 14px;
}
#lBoard > .lb-row:last-child { border-bottom: none; }

.lb-row .lb-rank {
    font-weight: 500;
    color: var(--text-2);
    font-variant-numeric: tabular-nums;
}
.lb-row.r1 .lb-rank { color: var(--gold-text); font-weight: 500; }
.lb-row.r2 .lb-rank { color: var(--silver); }
.lb-row.r3 .lb-rank { color: var(--bronze); }

.lb-row .lb-name {
    color: var(--text);
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.lb-row .lb-k,
.lb-row .lb-w {
    color: var(--text-2);
    text-align: center;
    font-variant-numeric: tabular-nums;
}
.lb-row .lb-form { display: flex; justify-content: center; }
.lb-row .lb-pts {
    color: var(--text);
    font-weight: 500;
    text-align: right;
    font-variant-numeric: tabular-nums;
}
.lb-row .lb-diff {
    font-size: 12px;
    color: var(--text-2);
    text-align: center;
    font-variant-numeric: tabular-nums;
}
.lb-row .lb-diff.pos { color: var(--win); }
.lb-row .lb-diff.neg { color: var(--loss); }

/* Form-prikker */
.form-wrap {
    display: inline-flex;
    gap: 4px;
    align-items: center;
    justify-content: center;
}
.form-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}
.form-dot.win { background: var(--win); }
.form-dot.loss { background: var(--loss); }
.form-empty {
    color: var(--text-3);
    font-size: 12px;
    font-variant-numeric: tabular-nums;
}

/* ============================================
   LOG ROWS
   ============================================ */
#logList { display: flex; flex-direction: column; gap: 8px; }
.log-row {
    background: var(--surface-2);
    border: 0.5px solid var(--border);
    border-radius: 12px;
    padding: 14px 16px;
    font-size: 13px;
    line-height: 1.6;
    color: var(--text-2);
    position: relative;
}
.log-time {
    position: absolute;
    top: 14px;
    right: 16px;
    color: var(--text-2);
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.3px;
}
.log-content { margin-top: 22px; color: var(--text); }
.log-content b { font-weight: 500; }

/* ============================================
   STAT BOX (insights)
   ============================================ */
.stat-box {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--surface-2);
    padding: 14px 16px;
    border-radius: 12px;
    margin-bottom: 8px;
    border: 0.5px solid var(--border);
    border-left: 3px solid var(--primary);
    gap: 12px;
}
.stat-box.bad { border-left-color: var(--loss); }
.stat-lbl {
    color: var(--text-2);
    font-size: 12px;
    font-weight: 500;
}
.stat-val {
    color: var(--text);
    font-size: 14px;
    font-weight: 500;
    text-align: right;
}
.stat-val span {
    display: block;
    color: var(--text-2);
    font-size: 11px;
    font-weight: 400;
    margin-top: 2px;
}

/* ============================================
   PLAN UI
   ============================================ */
#planWrap { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.plan-rnd-box {
    background: var(--surface-2);
    border: 0.5px solid var(--border);
    border-radius: 12px;
    padding: 14px;
}
.plan-rnd-hdr {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    font-weight: 500;
    color: var(--text);
    font-size: 13px;
}
.plan-lbl {
    font-size: 11px;
    color: var(--text-2);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 500;
}
.flex-row {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr 1fr;
    gap: 6px;
    margin-bottom: 8px;
}
.flex-row select { font-size: 12px; padding: 8px 22px 8px 10px; min-height: 36px; }
.plan-rnd-box + .btn { margin-top: 8px; }

/* ============================================
   EXPORT / SCHEDULE OVERLAY
   ============================================ */
.export-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 10000;
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 20px;
}
body.dark .export-overlay { background: rgba(0, 0, 0, 0.65); }

.export-card-wrap {
    width: 100%;
    max-width: 420px;
}
.export-card {
    background: var(--surface);
    border: 0.5px solid var(--border);
    border-radius: 20px;
    padding: 28px 24px;
    text-align: center;
}
.export-card.scrollable {
    max-height: 80vh;
    overflow-y: auto;
}
.export-title {
    font-size: 22px;
    font-weight: 500;
    margin: 0 0 4px;
    color: var(--text);
    letter-spacing: 0;
}
.export-date {
    font-size: 13px;
    color: var(--text-2);
    margin: 0 0 24px;
    text-transform: capitalize;
}
.export-podium {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 12px;
    align-items: end;
    margin-bottom: 24px;
}
.podium-step {
    background: var(--surface-2);
    border: 0.5px solid var(--border);
    border-radius: 14px;
    padding: 16px 8px 14px;
    text-align: center;
    min-height: 108px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
}
.podium-step.p1 {
    background: var(--gold-soft);
    border-color: var(--gold);
    transform: translateY(-12px);
    min-height: 124px;
}
.podium-step.p1 .podium-name,
.podium-step.p1 .podium-pts { color: var(--gold-text); }
.podium-rank {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--surface);
    border: 0.5px solid var(--border-2);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-2);
    font-variant-numeric: tabular-nums;
}
.podium-step.p1 .podium-rank {
    background: var(--gold);
    color: white;
    border-color: var(--gold);
}
.podium-step.p2 .podium-rank { color: var(--silver); }
.podium-step.p3 .podium-rank { color: var(--bronze); }
.podium-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--text);
    word-break: break-word;
    line-height: 1.3;
}
.podium-pts {
    font-size: 12px;
    color: var(--text-2);
    font-variant-numeric: tabular-nums;
}
.export-list {
    text-align: left;
    font-size: 13px;
    border-top: 0.5px solid var(--border);
    padding-top: 16px;
}
.export-list-item {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 0.5px solid var(--border);
    color: var(--text);
    font-variant-numeric: tabular-nums;
}
.export-list-item:last-child { border-bottom: none; }
.export-list-item span:first-child { font-weight: 400; color: var(--text); }
.export-list-item b { font-weight: 500; color: var(--text-2); margin-right: 4px; }

.export-actions {
    display: flex;
    gap: 8px;
    width: 100%;
    max-width: 420px;
    margin-top: 16px;
}
.export-actions .btn { flex: 1; width: auto; }

/* Schedule overlay */
.schedule-round {
    margin-bottom: 16px;
    text-align: left;
}
.schedule-round-hdr {
    font-size: 13px;
    color: var(--text-2);
    font-weight: 500;
    letter-spacing: 0.3px;
    margin: 0 0 8px;
    padding: 4px 0;
}
.schedule-round.current .schedule-round-hdr { color: var(--primary); }
.schedule-court {
    background: var(--surface-2);
    border: 0.5px solid var(--border);
    border-left: 3px solid var(--court-1);
    border-radius: 0 10px 10px 0;
    padding: 10px 14px;
    margin-bottom: 6px;
}
.schedule-court.c2 { border-left-color: var(--court-2); }
.schedule-court.c3 { border-left-color: var(--court-3); }
.schedule-court-name {
    font-size: 11px;
    color: var(--text-2);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
    font-weight: 500;
}
.schedule-match {
    font-size: 13px;
    color: var(--text);
    font-weight: 500;
    line-height: 1.5;
}
.schedule-match .vs {
    color: var(--text-3);
    margin: 0 8px;
    font-size: 11px;
    letter-spacing: 1px;
    text-transform: uppercase;
    font-weight: 400;
}

/* ============================================
   POPUP (kept legacy class names; new design)
   ============================================ */
.vip-popup-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 10001;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    opacity: 0;
    transition: opacity 0.2s;
}
body.dark .vip-popup-overlay { background: rgba(0, 0, 0, 0.65); }
.vip-popup-overlay.show { opacity: 1; }
.vip-popup-box {
    background: var(--surface);
    border: 0.5px solid var(--border);
    border-radius: 20px;
    padding: 28px 24px;
    width: 100%;
    max-width: 360px;
    text-align: center;
    transform: translateY(8px);
    transition: transform 0.2s;
}
.vip-popup-overlay.show .vip-popup-box { transform: translateY(0); }
.vip-popup-box h3 {
    margin: 0 0 8px;
    font-size: 18px;
    font-weight: 500;
    color: var(--text);
    letter-spacing: 0;
}
.vip-popup-box p {
    color: var(--text-2);
    font-size: 14px;
    margin: 0 0 22px;
    line-height: 1.6;
}
.vip-popup-actions {
    display: flex;
    gap: 8px;
}
.vip-popup-actions .btn { flex: 1; width: auto; margin-top: 0; }

/* ============================================
   LOGIN
   ============================================ */
.login-overlay {
    position: fixed;
    inset: 0;
    background: var(--bg);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 20px;
    transition: opacity 0.4s;
}
.login-box {
    background: var(--surface);
    border: 0.5px solid var(--border);
    border-radius: 20px;
    padding: 36px 24px 28px;
    max-width: 400px;
    width: 100%;
    text-align: center;
}
.login-box h1 {
    font-size: 24px;
    font-weight: 500;
    margin: 0 0 4px;
    color: var(--text);
    letter-spacing: 0;
}
.login-box p {
    color: var(--text-2);
    font-size: 13px;
    margin: 16px 0 24px;
}
.login-input {
    margin-bottom: 12px;
    text-align: center;
    font-size: 15px;
    letter-spacing: 0;
    text-transform: none;
}
.login-divider {
    position: relative;
    margin: 24px 0;
    font-size: 11px;
    color: var(--text-3);
    text-transform: uppercase;
    letter-spacing: 1px;
}
.login-divider span {
    background: var(--surface);
    padding: 0 12px;
    position: relative;
    z-index: 1;
}
.login-divider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 0.5px;
    background: var(--border);
}
.login-brand {
    font-size: 11px;
    color: var(--text-3);
    margin-top: 16px;
    letter-spacing: 0.5px;
}
.login-brand a {
    color: inherit;
    text-decoration: none;
    transition: color 0.15s;
}
.login-brand a:hover { color: var(--primary); }

/* ============================================
   LIVE MODE
   ============================================ */
body.live-mode .nav { display: none !important; }
body.live-mode .tab { display: none !important; }
body.live-mode #S { display: block !important; }
body.live-mode .copy-btn { display: none !important; }
body.live-mode { padding-bottom: 16px; }
body.live-mode .desktop-sidebar { display: none !important; }

.live-only { display: none; }
body.live-mode .live-only { display: block; }

/* ============================================
   DESKTOP SIDEBAR
   ============================================ */
.desktop-sidebar { display: none; }
.desktop-sidebar h3 {
    font-size: 11px;
    color: var(--text-2);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 500;
    margin: 0 0 14px;
}
.sidebar-divider {
    height: 0.5px;
    background: var(--border);
    margin: 22px 0;
}
.side-row {
    display: grid;
    grid-template-columns: 22px 1fr 60px 44px;
    gap: 6px;
    align-items: center;
    padding: 10px 0;
    border-bottom: 0.5px solid var(--border);
    font-size: 13px;
}
.side-row:last-child { border-bottom: none; }
.side-rank {
    font-weight: 500;
    color: var(--text-2);
    font-variant-numeric: tabular-nums;
}
.side-rank.r1 { color: var(--gold-text); }
.side-rank.r2 { color: var(--silver); }
.side-rank.r3 { color: var(--bronze); }
.side-name {
    color: var(--text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 500;
}
.side-form { display: flex; justify-content: center; }
.side-form .form-wrap { gap: 3px; }
.side-form .form-dot { width: 5px; height: 5px; }
.side-pts {
    text-align: right;
    color: var(--text);
    font-weight: 500;
    font-variant-numeric: tabular-nums;
}
.side-next {
    background: var(--surface-2);
    border: 0.5px solid var(--border);
    border-left: 3px solid var(--court-1);
    border-radius: 0 10px 10px 0;
    padding: 10px 14px;
    margin-bottom: 6px;
}
.side-next.c2 { border-left-color: var(--court-2); }
.side-next.c3 { border-left-color: var(--court-3); }
.side-next-name {
    font-size: 10px;
    color: var(--text-2);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
    font-weight: 500;
}
.side-next-team { font-size: 12px; color: var(--text); font-weight: 500; }
.side-next-vs {
    font-size: 10px;
    color: var(--text-3);
    letter-spacing: 1px;
    text-transform: uppercase;
    margin: 2px 0;
}

/* ============================================
   RESPONSIVE — TABLET PORTRAIT (768+)
   ============================================ */
@media (min-width: 768px) {
    body {
        padding: 24px;
        padding-bottom: calc(88px + env(safe-area-inset-bottom));
    }
    .app { max-width: 720px; margin: 0 auto; }

    .courts-grid {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 14px;
    }
    .save-match-btn { max-width: 320px; margin-left: auto; margin-right: auto; display: block; }

    .nav {
        padding: 8px 32px;
        padding-bottom: calc(8px + env(safe-area-inset-bottom));
    }

    .timer-display { font-size: 64px; }

    /* På tablet+: vis alle 7 leaderboard-kolonner igen */
    .lb-head, #lBoard > .lb-row {
        grid-template-columns: 28px 1fr 36px 36px 80px 56px 72px;
    }
    .lb-head > span:nth-child(3),
    .lb-head > span:nth-child(4),
    .lb-head > span:nth-child(6),
    .lb-row .lb-k,
    .lb-row .lb-w,
    .lb-row .lb-diff { display: block; }
    .lb-head > span:nth-child(3),
    .lb-head > span:nth-child(4),
    .lb-head > span:nth-child(6) { text-align: center; }
    .lb-row .lb-k,
    .lb-row .lb-w { text-align: center; }
    .lb-row .lb-diff { text-align: center; }
}

/* ============================================
   RESPONSIVE — TABLET LANDSCAPE / DESKTOP (1024+)
   ============================================ */
@media (min-width: 1024px) {
    body {
        padding: 32px;
        padding-bottom: 32px;
    }

    .app {
        max-width: 1400px;
        display: grid;
        grid-template-columns: 220px 1fr 320px;
        grid-template-areas:
            "header header header"
            "nav main side";
        column-gap: 24px;
        row-gap: 0;
    }

    .hdr {
        grid-area: header;
        padding: 4px 0 20px;
    }
    .hdr-title { text-align: left; flex: none; }

    .nav {
        grid-area: nav;
        position: sticky;
        top: 32px;
        bottom: auto;
        left: auto;
        right: auto;
        flex-direction: column;
        background: var(--surface);
        border: 0.5px solid var(--border);
        border-top: 0.5px solid var(--border);
        border-radius: 16px;
        padding: 10px;
        height: fit-content;
        align-self: start;
        gap: 4px;
        z-index: 10;
    }
    .nav button {
        flex-direction: row;
        justify-content: flex-start;
        text-align: left;
        padding: 12px 14px;
        font-size: 14px;
        gap: 12px;
        min-height: 44px;
    }
    .nav button.act {
        background: var(--primary-soft);
        color: var(--primary);
        font-weight: 500;
    }
    /* På sidebar: erstat top-indikator med venstre accent-bjælke */
    .nav button.act::before {
        top: 50%;
        left: 0;
        transform: translateY(-50%);
        width: 3px;
        height: 60%;
        border-radius: 0 3px 3px 0;
    }

    .main-content { grid-area: main; min-width: 0; }

    .desktop-sidebar {
        grid-area: side;
        display: block;
        position: sticky;
        top: 32px;
        background: var(--surface);
        border: 0.5px solid var(--border);
        border-radius: 16px;
        padding: 22px;
        height: fit-content;
        align-self: start;
    }

    .courts-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 16px;
    }

    body.live-mode .app {
        grid-template-columns: 1fr;
        grid-template-areas: "header" "main";
        max-width: 720px;
    }

    .timer-display { font-size: 64px; }
}

/* ============================================
   RESPONSIVE — EXTRA WIDE (Tab S10 Ultra landscape, 1600+)
   ============================================ */
@media (min-width: 1600px) {
    .app {
        max-width: 1600px;
        column-gap: 32px;
    }
    .timer-display { font-size: 72px; }
}
