/* =========================================================
   BillardsScore - design system (dark/warm, inspired by cph3d.dk)
   ========================================================= */

:root {
    --bg: #1A1612;
    --surface: #221E18;
    --surface-2: #2A251E;
    --text: #F5F0EA;
    --muted: #AEA9A2;
    --border: #2E2A22;
    --border-mid: #3A3630;

    --accent: #FF5500;
    --accent-btn: #C84200;
    --accent-dim: rgba(255, 85, 0, 0.08);
    --accent-border: rgba(255, 85, 0, 0.25);

    --success: #00D475;
    --danger: #FF3B3B;
    --felt: #1F6B4A;

    --r-s: 8px;
    --r-m: 10px;
    --r: 12px;

    --sans: 'Syne', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    --mono: 'JetBrains Mono', 'SF Mono', 'Cascadia Code', 'Fira Code', Consolas, monospace;

    --grid-line: rgba(245, 240, 234, 0.035);
    --nav-bg: rgba(26, 22, 18, 0.95);

    color-scheme: dark;
}

[data-theme="light"] {
    --bg: #F2ECE0;
    --surface: #FBF7EE;
    --surface-2: #F5EFE3;
    --text: #1A1814;
    --muted: #6B6762;
    --border: #D5CCB9;
    --border-mid: #D0C6B2;
    --grid-line: rgba(26, 24, 20, 0.05);
    --nav-bg: rgba(242, 236, 224, 0.95);
    color-scheme: light;
}

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

html, body { margin: 0; padding: 0; }

html {
    background: var(--bg);
    color: var(--text);
    font-family: var(--sans);
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
}

body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background-image:
        linear-gradient(var(--grid-line) 1px, transparent 1px),
        linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
    background-size: 48px 48px;
    background-attachment: fixed;
}

main.page { flex: 1; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3 { font-family: var(--sans); font-weight: 800; letter-spacing: -0.03em; line-height: 1.02; margin: 0 0 16px; }
h1 { font-size: clamp(2.6rem, 7vw, 5.2rem); }
h2 { font-size: clamp(1.8rem, 4vw, 2.6rem); }
h3 { font-size: 1.25rem; letter-spacing: -0.01em; }
h1:focus { outline: none; }

p { line-height: 1.6; }

.container { width: 100%; max-width: 1200px; margin: 0 auto; padding: 0 24px; }
.section { padding-top: 72px; }

.mono { font-family: var(--mono); }
.muted { color: var(--muted); }
.accent { color: var(--accent); }

/* Eyebrow: "—— TEXT · TEXT" */
.eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    font-family: var(--mono);
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: 24px;
}
.eyebrow::before { content: ""; width: 24px; height: 1px; background: currentColor; }

.lead { font-size: 18px; color: var(--muted); max-width: 560px; }

/* Note block with orange left border */
.note {
    border-left: 2px solid var(--accent);
    padding: 4px 0 4px 16px;
    font-family: var(--mono);
    font-size: 12px;
    line-height: 1.6;
    color: var(--muted);
    max-width: 560px;
}
.note strong { color: var(--text); font-weight: 600; }

/* ---------- Navigation ---------- */
.topnav {
    position: sticky;
    top: 0;
    z-index: 50;
    height: 64px;
    background: var(--nav-bg);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--border);
}
.nav-inner { height: 100%; display: flex; align-items: center; gap: 32px; }

.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand-icon { width: 24px; height: 24px; color: var(--accent); }
.brand-mark { font-family: var(--sans); font-weight: 800; font-size: 15px; letter-spacing: 0.02em; }
.brand-mark.small { font-size: 12px; }

.nav-links { display: flex; gap: 4px; }
.nav-links a {
    font-family: var(--mono);
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--muted);
    padding: 8px 12px;
    border-radius: var(--r-s);
}
.nav-links a:hover { color: var(--text); text-decoration: none; background: var(--accent-dim); }
.nav-links a.active { color: var(--accent); }

.nav-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }

.icon-btn {
    background: transparent;
    border: 1px solid var(--border-mid);
    color: var(--muted);
    font-family: var(--mono);
    font-size: 13px;
    height: 32px;
    min-width: 32px;
    padding: 0 9px;
    border-radius: 4px;
    cursor: pointer;
}
.icon-btn:hover { color: var(--accent); border-color: var(--accent-border); }

.mobile-only { display: none; }

@media (max-width: 760px) {
    .desktop-only { display: none !important; }
    .mobile-only { display: inline-flex; align-items: center; justify-content: center; }
}

/* The menu links need ~1160px; below that they fold into the burger menu. */
@media (max-width: 1180px) {
    .icon-btn.burger { display: inline-flex; align-items: center; justify-content: center; }
    .nav-links {
        display: none;
        position: absolute;
        top: 64px; left: 0; right: 0;
        flex-direction: column;
        background: var(--bg);
        border-bottom: 1px solid var(--border);
        padding: 12px 24px 20px;
    }
    .nav-links.open { display: flex; }
}

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-family: var(--mono);
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    padding: 15px 22px;
    border-radius: var(--r-m);
    border: 1px solid transparent;
    cursor: pointer;
    transition: background .15s, border-color .15s, color .15s, transform .05s;
    text-decoration: none !important;
    white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }

.btn-primary { background: var(--accent-btn); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--accent); }

.btn-ghost { background: transparent; color: var(--text); border-color: var(--border-mid); }
.btn-ghost:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }

.btn-danger { background: transparent; color: var(--danger); border-color: rgba(255,59,59,.35); }
.btn-danger:hover:not(:disabled) { background: rgba(255,59,59,.1); }

.btn-sm { padding: 9px 16px; font-size: 12px; text-transform: none; letter-spacing: 0; }

.btn-row { display: flex; gap: 12px; flex-wrap: wrap; }

/* ---------- Hero ---------- */
.hero { padding-top: 96px; padding-bottom: 40px; }
.hero h1 { color: var(--text); margin-bottom: 28px; }
.hero h1 .hl { color: var(--accent); }
.hero .lead { margin-bottom: 28px; }
.hero .note { margin-bottom: 36px; }

/* ---------- Cards / surfaces ---------- */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r);
    padding: 24px;
}
.card-title {
    font-family: var(--mono);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--muted);
    margin: 0 0 16px;
}

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1px; background: var(--border); border: 1px solid var(--border); border-radius: var(--r); overflow: hidden; }
.stat { background: var(--surface); padding: 24px; }
.stat-value { font-family: var(--sans); font-weight: 800; font-size: 44px; letter-spacing: -0.03em; line-height: 1; }
.stat-label { font-family: var(--mono); font-size: 11px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted); margin-top: 10px; }

.features { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }
.feature .num { font-family: var(--mono); font-size: 11px; color: var(--accent); letter-spacing: .1em; }
.feature h3 { margin-top: 12px; }
.feature p { color: var(--muted); margin: 0; font-size: 15px; }

/* ---------- Page header ---------- */
.page-head { padding-top: 64px; padding-bottom: 32px; display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; flex-wrap: wrap; }
.page-head h1 { font-size: clamp(2.2rem, 5vw, 3.6rem); margin: 0; }
.page-head .eyebrow { margin-bottom: 16px; }

/* ---------- Forms ---------- */
.form-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); align-items: end; }
.field { display: flex; flex-direction: column; gap: 8px; }
.field label {
    font-family: var(--mono);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--muted);
}
.input, .field input, .field select {
    background: var(--bg);
    color: var(--text);
    border: 1px solid var(--border-mid);
    border-radius: var(--r-s);
    padding: 12px 14px;
    font-family: var(--mono);
    font-size: 14px;
    width: 100%;
}
.field input:focus, .field select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-dim); }

.valid.modified:not([type=checkbox]) { border-color: var(--success); }
.invalid { border-color: var(--danger) !important; }
.validation-message, .validation-errors { color: var(--danger); font-family: var(--mono); font-size: 12px; }
.validation-errors { margin: 0 0 12px; padding-left: 18px; }

.alert {
    font-family: var(--mono);
    font-size: 13px;
    padding: 12px 16px;
    border-radius: var(--r-s);
    border: 1px solid var(--accent-border);
    background: var(--accent-dim);
    color: var(--text);
    margin-bottom: 16px;
}
.alert-error { border-color: rgba(255,59,59,.4); background: rgba(255,59,59,.08); }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 15px; }
.table th {
    text-align: left;
    font-family: var(--mono);
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--muted);
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-mid);
}
.table td { padding: 14px 16px; border-bottom: 1px solid var(--border); }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: var(--accent-dim); }
.table .num { font-family: var(--mono); text-align: right; }

.badge {
    display: inline-block;
    font-family: var(--mono);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .05em;
    text-transform: uppercase;
    padding: 4px 8px;
    border-radius: 4px;
    border: 1px solid var(--border-mid);
    color: var(--muted);
}
.badge-live { color: var(--accent); border-color: var(--accent-border); background: var(--accent-dim); }
.badge-live::before { content: "● "; animation: blink 1.4s infinite; }
.badge-done { color: var(--success); border-color: rgba(0,212,117,.3); }

@keyframes blink { 50% { opacity: .25; } }

.empty { text-align: center; padding: 48px 24px; color: var(--muted); font-family: var(--mono); font-size: 13px; }

/* ---------- Scoreboard ---------- */
.scoreboard { display: grid; grid-template-columns: 1fr auto 1fr; gap: 16px; align-items: stretch; }
.score-side {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r);
    padding: 32px 24px;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 20px;
}
.score-side.leading { border-color: var(--accent-border); box-shadow: inset 0 0 0 1px var(--accent-border); }
.score-side.winner { border-color: rgba(0,212,117,.5); }
.score-name { font-weight: 800; font-size: 24px; letter-spacing: -0.02em; }
.score-value { font-family: var(--sans); font-weight: 800; font-size: clamp(5rem, 14vw, 9rem); line-height: 1; letter-spacing: -0.05em; font-variant-numeric: tabular-nums; }
.score-side.leading .score-value { color: var(--accent); }
.score-controls { display: flex; gap: 10px; justify-content: center; }
.score-controls .btn { min-width: 64px; font-size: 18px; }
.score-vs { align-self: center; font-family: var(--mono); color: var(--muted); font-size: 13px; letter-spacing: .1em; }
.match-meta { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; margin-bottom: 24px; }

@media (max-width: 900px) {
    .scoreboard { grid-template-columns: 1fr; }
    .score-vs { justify-self: center; }
}

/* ---------- Blazor errors ---------- */
.blazor-error-boundary {
    background: var(--danger);
    padding: 1rem 1.25rem;
    color: white;
    font-family: var(--mono);
    border-radius: var(--r-s);
}
.blazor-error-boundary::after { content: "Der opstod en fejl."; }

/* ---------- Admin ---------- */
.admin-tile { color: var(--text); transition: border-color .15s; }
.admin-tile:hover { text-decoration: none; border-color: var(--accent-border); }

/* ---------- Language menu ---------- */
.lang-menu { position: relative; }
.lang-toggle { font-size: 11px; font-weight: 600; letter-spacing: 0.04em; gap: 4px; display: inline-flex; align-items: center; }
.lang-toggle .caret { font-size: 9px; opacity: .7; }
.lang-backdrop { position: fixed; inset: 0; z-index: 60; }
.lang-list {
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    z-index: 61;
    min-width: 170px;
    list-style: none;
    margin: 0;
    padding: 6px;
    background: var(--surface);
    border: 1px solid var(--border-mid);
    border-radius: var(--r-m);
    box-shadow: 0 12px 32px rgba(0, 0, 0, .35);
}
.lang-option {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 12px;
    background: transparent;
    border: 0;
    border-radius: var(--r-s);
    color: var(--text);
    font-family: var(--sans);
    font-size: 14px;
    text-align: left;
    padding: 9px 10px;
    cursor: pointer;
}
.lang-option:hover { background: var(--accent-dim); }
.lang-option.selected { color: var(--accent); }
.lang-code { font-family: var(--mono); font-size: 11px; font-weight: 600; color: var(--muted); width: 22px; }
.lang-option.selected .lang-code { color: var(--accent); }

/* ---------- Texts admin ---------- */
.texts-toolbar { position: sticky; top: 76px; z-index: 20; margin-bottom: 16px; }
.texts-status { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; margin-top: 16px; font-size: 12px; }
.field.checks { gap: 10px; justify-content: flex-end; }
.check { display: flex; align-items: center; gap: 8px; cursor: pointer; text-transform: none !important; letter-spacing: 0 !important; font-size: 13px !important; color: var(--text) !important; }
.field .check input[type=checkbox] { width: 16px; height: 16px; padding: 0; accent-color: var(--accent); }

.text-list { display: flex; flex-direction: column; gap: 12px; }
.text-row { display: grid; grid-template-columns: minmax(200px, 260px) 1fr; gap: 24px; padding: 20px; }
.text-row.dirty { border-color: var(--accent-border); }
.text-meta { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.text-key { font-family: var(--mono); font-size: 12px; color: var(--accent); word-break: break-all; }
.text-desc { font-size: 12px; line-height: 1.5; }
.text-actions { display: flex; align-items: center; gap: 8px; margin-top: 4px; }
.text-langs { display: grid; grid-template-columns: repeat(var(--lang-count, 2), minmax(0, 1fr)); gap: 16px; }
.text-langs label { display: flex; align-items: center; gap: 8px; }
.text-input {
    background: var(--bg);
    color: var(--text);
    border: 1px solid var(--border-mid);
    border-radius: var(--r-s);
    padding: 10px 12px;
    font-family: var(--sans);
    font-size: 14px;
    line-height: 1.5;
    width: 100%;
    resize: vertical;
}
.text-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-dim); }
.text-input.is-missing { border-style: dashed; border-color: var(--accent-border); }

.badge-live-static { color: var(--accent); border-color: var(--accent-border); background: var(--accent-dim); }
.badge-missing { color: var(--danger); border-color: rgba(255,59,59,.35); font-size: 10px; padding: 2px 6px; }

@media (max-width: 900px) {
    .text-row { grid-template-columns: 1fr; gap: 12px; }
    .text-langs { grid-template-columns: 1fr; }
    .texts-toolbar { position: static; }
}

/* ---------- Tournaments ---------- */
.rename-form { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.rename-form .input { flex: 1; min-width: 220px; padding: 9px 12px; }

/* ---------- Events ---------- */
.list-toolbar { display: flex; justify-content: flex-end; margin-bottom: 12px; }
.inline-field { flex-direction: row !important; align-items: center; gap: 12px !important; }
.inline-field select { width: auto; min-width: 220px; padding: 9px 12px; }
.edit-grid { display: grid; grid-template-columns: 150px 1fr 1fr 170px 90px auto auto; gap: 10px; align-items: center; }
.edit-grid .input { padding: 9px 12px; }
.edit-tournament { font-size: 12px; }
@media (max-width: 900px) { .edit-grid { grid-template-columns: 1fr; } }

/* ---------- Matches within events ---------- */
.cell-sub { font-size: 12px; margin-top: 2px; }
.row-actions { justify-content: flex-end; flex-wrap: nowrap; gap: 8px; }
.match-context { font-size: 12px; margin: 0; }
.field-wide { grid-column: 1 / -1; }
.field-wide select { max-width: 560px; }
.field-hint { font-family: var(--mono); font-size: 11px; }

/* ---------- Scoreboard: race to ---------- */
.race-badge {
    font-family: var(--mono);
    font-size: 13px;
    font-weight: 600;
    letter-spacing: .06em;
    text-transform: uppercase;
    padding: 5px 12px;
    border-radius: 4px;
    color: var(--text);
    background: var(--accent-dim);
    border: 1px solid var(--accent-border);
}

/* ---------- Scoreboard: point entry ---------- */
.score-entry { display: flex; flex-direction: column; gap: 12px; align-items: stretch; max-width: 320px; width: 100%; margin: 0 auto; }
.score-entry-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.score-field { display: flex; flex-direction: column; gap: 6px; text-align: left; }
.score-field span { font-family: var(--mono); font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.score-field.plus span { color: var(--success); }
.score-field.minus span { color: var(--danger); }
.score-field input {
    background: var(--bg);
    color: var(--text);
    border: 1px solid var(--border-mid);
    border-radius: var(--r-s);
    padding: 12px;
    font-family: var(--mono);
    font-size: 22px;
    font-weight: 600;
    text-align: center;
    width: 100%;
}
.score-field input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-dim); }
.score-field input:disabled { opacity: .4; }
.score-entry .btn { width: 100%; font-size: 15px; }

/* ---------- Scoreboard: history (placed towards the centre) ---------- */
.score-side.side-1, .score-side.side-2 {
    display: grid;
    gap: 20px;
    align-items: start;
    text-align: center;
}
.score-side.side-1 { grid-template-columns: minmax(0, 1fr) 120px; grid-template-areas: "main history"; }
.score-side.side-2 { grid-template-columns: 120px minmax(0, 1fr); grid-template-areas: "history main"; }
.score-main { grid-area: main; display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.score-history {
    grid-area: history;
    align-self: stretch;
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-height: 0;
    max-height: 360px;
    padding: 0 0 0 16px;
    border-left: 1px solid var(--border);
}
.score-side.side-2 .score-history { padding: 0 16px 0 0; border-left: 0; border-right: 1px solid var(--border); }
.score-history-title {
    font-family: var(--mono);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .1em;
    color: var(--muted);
}
.score-history-empty { font-family: var(--mono); font-size: 11px; color: var(--muted); opacity: .7; }
.score-history-list {
    list-style: none;
    margin: 0;
    padding: 0;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-family: var(--mono);
    font-size: 13px;
}
.score-history-list li {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 8px;
    padding: 4px 6px;
    border-radius: 4px;
}
.score-history-list li:first-child { background: var(--accent-dim); }
.h-change { display: inline-flex; gap: 6px; }
.h-plus { color: var(--success); font-weight: 600; }
.h-minus { color: var(--danger); font-weight: 600; }
.h-total { color: var(--muted); }

@media (max-width: 900px) {
    .score-side.side-1, .score-side.side-2 { grid-template-columns: 1fr; grid-template-areas: "main" "history"; }
    .score-history, .score-side.side-2 .score-history { padding: 16px 0 0; border: 0; border-top: 1px solid var(--border); max-height: 220px; }
}

/* ---------- Scoreboard: turn clock ---------- */
.turn-clock {
    align-self: center;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 5px 12px;
    border-radius: 99px;
    border: 1px solid var(--accent-border);
    background: var(--accent-dim);
    font-family: var(--mono);
    font-size: 13px;
}
.turn-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); animation: blink 1.4s infinite; }
.turn-label { text-transform: uppercase; letter-spacing: .08em; font-size: 11px; color: var(--muted); }
.turn-time { font-weight: 600; color: var(--accent); font-variant-numeric: tabular-nums; min-width: 3ch; text-align: right; }
.h-time { color: var(--muted); font-size: 11px; opacity: .8; margin-left: auto; margin-right: 8px; }
.turn-slot { min-height: 30px; display: flex; justify-content: center; align-items: center; margin-top: -8px; }
.h-zero { color: var(--muted); font-weight: 600; }

/* ---------- Scoreboard: pause ---------- */
.badge-paused { color: var(--text); border-color: var(--border-mid); background: var(--surface-2); }
.badge-paused::before { content: "❚❚ "; font-size: 9px; }
.turn-clock.paused { border-color: var(--border-mid); background: var(--surface-2); }
.turn-clock.paused .turn-dot { animation: none; background: var(--muted); }
.turn-clock.paused .turn-time { color: var(--muted); }

/* ---------- Account menu (login popover) ---------- */
.account-menu { position: relative; }
.account-toggle { display: inline-flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 600; }
.account-toggle .caret { font-size: 9px; opacity: .7; }
.account-avatar {
    display: inline-flex; align-items: center; justify-content: center;
    width: 20px; height: 20px; border-radius: 50%;
    background: var(--accent-btn); color: #fff; font-size: 11px; font-weight: 700;
}
.account-name { max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu-backdrop { position: fixed; inset: 0; z-index: 60; }
.account-panel {
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    z-index: 61;
    width: min(340px, calc(100vw - 32px));
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: var(--surface);
    border: 1px solid var(--border-mid);
    border-radius: var(--r);
    box-shadow: 0 16px 40px rgba(0, 0, 0, .4);
    animation: panel-in .12s ease-out;
}
.account-panel .card-title { margin: 0; }
.account-panel form { margin: 0; }
.account-who { display: flex; flex-direction: column; gap: 4px; padding-bottom: 12px; border-bottom: 1px solid var(--border); }
.account-who .mono { font-size: 12px; overflow-wrap: anywhere; }
.account-logout { width: 100%; }
@keyframes panel-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }

/* ---------- Account pages / forms ---------- */
.auth-page { max-width: 560px; }
.auth-form { display: flex; flex-direction: column; gap: 16px; }
.auth-submit { width: 100%; }
.auth-links {
    display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap;
    font-family: var(--mono); font-size: 12px;
}
.field-hint { font-family: var(--mono); font-size: 11px; color: var(--muted); }
.field input:disabled { opacity: .6; }

/* Narrow phones: the brand name doesn't fit next to the menu buttons, so show only the logo. */
@media (max-width: 520px) {
    .nav-inner { gap: 12px; }
    .nav-actions { gap: 6px; }
    .brand .brand-mark { display: none; }
}
@media (max-width: 520px) {
    .account-panel { position: fixed; top: 64px; left: 16px; right: 16px; width: auto; }
}

/* ---------- Player statistics ---------- */
.player-meta { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; margin-top: 12px; font-size: 13px; }
.badge-win { color: var(--success); border-color: rgba(0,212,117,.3); background: rgba(0,212,117,.08); }
.badge-loss { color: var(--danger); border-color: rgba(255,59,59,.35); }
.badge-paused-static { color: var(--muted); border-color: var(--border-mid); }
.profile-player {
    display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap;
    padding: 14px 16px; border: 1px solid var(--border-mid); border-radius: var(--r-s);
    color: var(--text); transition: border-color .15s;
}
.profile-player:hover { text-decoration: none; border-color: var(--accent); }
.profile-player .mono { font-size: 12px; }

/* ---------- Collapsible card (<details class="card collapsible">) ---------- */
.collapsible > summary {
    list-style: none;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 0;
    user-select: none;
}
.collapsible > summary::-webkit-details-marker { display: none; }
.collapsible > summary::after { content: "+"; font-size: 16px; color: var(--accent); transition: transform .15s; }
.collapsible[open] > summary::after { transform: rotate(45deg); }
.collapsible > summary:hover { color: var(--text); }
.collapsible[open] > summary { margin-bottom: 16px; }

/* ---------- Club check list (several clubs per profile) ---------- */
.check-list {
    display: flex; flex-direction: column; gap: 2px;
    max-height: 240px; overflow-y: auto;
    padding: 6px; border: 1px solid var(--border-mid); border-radius: var(--r-s); background: var(--bg);
}
.field .check-list label.check {
    display: flex; align-items: center; gap: 10px;
    padding: 8px 10px; border-radius: var(--r-s); cursor: pointer;
    font-family: var(--sans); font-size: 14px; text-transform: none; letter-spacing: 0; color: var(--text);
}
.field .check-list label.check:hover { background: var(--accent-dim); }
.check-list input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--accent); flex: none; }
.check-list .empty-note { font-family: var(--mono); font-size: 12px; color: var(--muted); padding: 8px 10px; }

/* ---------- Admin: profiles ---------- */
.confirm-row { justify-content: flex-end; flex-wrap: nowrap; gap: 8px; }
.profile-edit { align-items: start; }
.profile-edit .btn-row { margin-top: 22px; }
.head-filters { display: flex; gap: 16px; flex-wrap: wrap; align-items: flex-end; }
.account-clubs { display: flex; flex-direction: column; gap: 6px; padding-bottom: 12px; border-bottom: 1px solid var(--border); }
.account-clubs .card-title { margin: 0; }
.account-clubs ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; max-height: 180px; overflow-y: auto; }
.account-clubs li { font-size: 14px; }
.account-clubs li::before { content: "● "; color: var(--accent); font-size: 9px; vertical-align: middle; }
.account-clubs .mono { font-size: 12px; }

/* ---------- Profile page: two columns ---------- */
.profile-page { max-width: 1040px; }
.profile-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; align-items: start; }
.profile-col { display: flex; flex-direction: column; gap: 24px; min-width: 0; }
@media (max-width: 820px) {
    .profile-grid { grid-template-columns: 1fr; }
}

/* ---------- Phones: long headings and filter fields must not widen the page ---------- */
.page-head > div { min-width: 0; }
@media (max-width: 520px) {
    .page-head h1 { font-size: clamp(1.7rem, 8.5vw, 2.2rem); overflow-wrap: anywhere; }
    .head-filters, .head-filters .inline-field { width: 100%; }
    .head-filters .inline-field select, .head-filters .inline-field input { min-width: 0; flex: 1; width: auto; }
}

/* ---------- Club page ---------- */
.club-page { max-width: 1040px; }
.club-facts { display: grid; grid-template-columns: max-content 1fr; gap: 12px 20px; margin: 0; }
.club-facts dt { font-family: var(--mono); font-size: 11px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); padding-top: 3px; }
.club-facts dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.club-members { list-style: none; margin: 12px 0 0; padding: 0; }
.club-members li { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; padding: 14px 24px; border-top: 1px solid var(--border); }
.club-member-who { min-width: 0; overflow-wrap: anywhere; }
.club-member-player { display: inline-flex; gap: 10px; align-items: baseline; font-size: 14px; }
.club-member-player .mono, span.club-member-player { font-size: 12px; }
.account-clubs li a { color: inherit; }
.account-clubs li a:hover { color: var(--accent); text-decoration: none; }
@media (max-width: 520px) {
    .club-facts { grid-template-columns: 1fr; gap: 4px; }
    .club-facts dd { margin-bottom: 10px; }
}
