:root {
    --bg: #f4f1ea;
    --panel: #ffffff;
    --ink: #171717;
    --muted: #6c6a65;
    --line: #ded9cf;
    --red: #b8242f;
    --red-dark: #7f111a;
    --green: #1b7652;
    --gold: #d7a72c;
    --black: #151515;
    --shadow: 0 18px 45px rgba(23, 23, 23, .09);
    --radius: 18px;
    --radius-small: 11px;
    --shell-max: 1440px;
}

.subs-settings-grid {
    display: grid;
    grid-template-columns: minmax(180px, .7fr) minmax(260px, 1.2fr) minmax(180px, .8fr);
    gap: 22px;
    align-items: end;
}
.subs-match-types {
    border: 0;
    padding: 0;
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 10px 20px;
}
.subs-match-types legend {
    width: 100%;
    margin-bottom: 8px;
    font-weight: 800;
}
.subs-summary-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 18px;
    margin: 0 0 24px;
}
.subs-summary-card {
    padding: 20px 22px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: white;
    box-shadow: var(--shadow);
}
.subs-summary-card span {
    display: block;
    color: var(--muted);
    font-size: .86rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .07em;
}
.subs-summary-card strong {
    display: block;
    margin-top: 7px;
    font-size: clamp(1.65rem, 3vw, 2.25rem);
    color: var(--red);
}
.subs-ledger .table-wrap { max-width: 100%; }
.subs-table {
    min-width: 760px;
    border-collapse: separate;
    border-spacing: 0;
}
.subs-table th,
.subs-table td {
    text-align: center;
    vertical-align: middle;
    min-width: 112px;
}
.subs-table .subs-player-column {
    position: sticky;
    left: 0;
    z-index: 2;
    min-width: 180px;
    text-align: left;
    background: white;
    box-shadow: 1px 0 var(--line);
}
.subs-table thead .subs-player-column {
    z-index: 4;
    background: var(--black);
}
.subs-table .subs-match-column span,
.subs-table .subs-match-column strong,
.subs-table .subs-match-column small { display: block; }
.subs-table .subs-match-column span,
.subs-table .subs-match-column small {
    font-size: .72rem;
    font-weight: 700;
    opacity: .8;
}
.subs-table .subs-match-column strong { margin: 3px 0; }
.subs-table .subs-total-column { min-width: 105px; }
.subs-player-column small {
    display: block;
    margin-top: 2px;
    color: var(--muted);
    font-size: .72rem;
}
.subs-check-cell input {
    width: 22px;
    height: 22px;
    accent-color: var(--red);
    cursor: pointer;
}
.subs-row-games,
.subs-row-total { font-weight: 900; }

@media (max-width: 800px) {
    .subs-settings-grid {
        grid-template-columns: 1fr;
        align-items: stretch;
    }
    .subs-summary-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    .subs-summary-card {
        padding: 15px 18px;
        display: flex;
        align-items: center;
        justify-content: space-between;
    }
    .subs-summary-card strong {
        margin-top: 0;
        font-size: 1.55rem;
    }
    .subs-table .subs-player-column { min-width: 145px; }
}

@media (min-width: 801px) and (max-width: 1100px) {
    .subs-summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    margin: 0;
    min-width: 320px;
    background: var(--bg);
    color: var(--ink);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    line-height: 1.5;
}
body.modal-open { overflow: hidden; }

button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
a { color: inherit; }
.shell { width: min(var(--shell-max), calc(100% - 32px)); margin: 0 auto; }

.site-header {
    position: sticky;
    top: 0;
    z-index: 40;
    background: rgba(21, 21, 21, .96);
    color: white;
    backdrop-filter: blur(14px);
    border-bottom: 1px solid rgba(255,255,255,.08);
}
.header-inner {
    min-height: 76px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}
.brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    color: inherit;
    text-decoration: none;
}
.brand strong, .brand small { display: block; }
.brand strong { font-size: 1rem; letter-spacing: .01em; }
.brand small { color: #bdbdbd; font-size: .75rem; }
.brand-mark {
    width: 46px;
    height: 46px;
    display: block;
    flex: 0 0 46px;
    border-radius: 50%;
    object-fit: cover;
}
.top-nav { display: flex; align-items: center; gap: 22px; }
.top-nav > a:not(.button) { color: #dedede; text-decoration: none; font-size: .92rem; }
.top-nav > a:hover { color: white; }

.button {
    border: 0;
    border-radius: 999px;
    padding: 11px 20px;
    background: var(--red);
    color: white;
    font-weight: 800;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: none;
}
.button:hover { background: var(--red-dark); }
.button-small { padding: 8px 14px; font-size: .86rem; }
.button-secondary { background: var(--black); }
.button-secondary:hover { background: #333; }
.button-ghost { background: transparent; border: 1px solid rgba(255,255,255,.35); }
.button-ghost:hover { background: rgba(255,255,255,.1); }
.admin-section .button-ghost { color: var(--ink); border-color: var(--line); }
.button-danger { background: #8c1c24; }

.hero {
    min-height: 390px;
    display: flex;
    align-items: center;
    overflow: hidden;
    color: white;
    background:
        linear-gradient(110deg, rgba(12,12,12,.98), rgba(22,22,22,.84)),
        repeating-linear-gradient(45deg, transparent 0 16px, rgba(255,255,255,.025) 17px 18px);
}
.hero-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 360px;
    align-items: center;
    gap: 60px;
    padding: 60px 0;
}
.subpage-hero { background: var(--black); color: white; }
.subpage-hero-grid {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 28px;
    padding: 48px 0;
}
.subpage-hero h1 { margin: 7px 0 0; font-size: clamp(2.3rem, 6vw, 4.4rem); letter-spacing: -.055em; }
.subpage-hero p { max-width: 650px; margin: 12px 0 0; color: #c5c5c5; }
.fixtures-page-content { padding-top: 52px; padding-bottom: 76px; }
.fixtures-archive { padding-top: 0; }
.fixtures-archive .fixture-panel-controls { display: flex; align-items: center; justify-content: flex-end; }
.fixtures-archive .fixture-list { max-width: 1180px; }
.hero h1 {
    max-width: 760px;
    margin: 10px 0 16px;
    font-size: clamp(2.45rem, 6vw, 5rem);
    line-height: .95;
    letter-spacing: -.055em;
}
.hero p { max-width: 680px; margin: 0; color: #c8c8c8; font-size: 1.05rem; }
.eyebrow {
    color: var(--gold);
    font-size: .76rem;
    font-weight: 900;
    letter-spacing: .16em;
    text-transform: uppercase;
}
.dartboard-art {
    width: 340px;
    aspect-ratio: 1;
    position: relative;
    justify-self: end;
}
.dartboard-art img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    opacity: .96;
    -webkit-mask-image: radial-gradient(circle at center, #000 0 58%, rgba(0,0,0,.96) 62%, rgba(0,0,0,.58) 68%, transparent 76%);
    mask-image: radial-gradient(circle at center, #000 0 58%, rgba(0,0,0,.96) 62%, rgba(0,0,0,.58) 68%, transparent 76%);
    filter: drop-shadow(0 24px 28px rgba(0, 0, 0, .36));
}


.page-content { padding: 44px 0 80px; }
.stats-grid {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 14px;
    margin-top: -82px;
    position: relative;
    z-index: 2;
}
.stat-card {
    min-height: 132px;
    padding: 20px;
    border-radius: var(--radius);
    background: var(--panel);
    box-shadow: var(--shadow);
    border: 1px solid rgba(0,0,0,.04);
}
.stat-card small {
    display: block;
    color: var(--muted);
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .08em;
    font-size: .68rem;
}
.stat-card strong {
    display: block;
    margin-top: 8px;
    font-size: 2rem;
    line-height: 1;
}
.stat-card span { color: var(--muted); font-size: .8rem; }

.content-section { padding-top: 72px; }
.dashboard-content-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 3fr);
    align-items: start;
    gap: 24px;
    padding-top: 72px;
}
.dashboard-content-grid > .content-section { min-width: 0; padding-top: 0; }
.match-centre-panel {
    position: sticky;
    top: 100px;
    max-height: calc(100vh - 120px);
    overflow-y: auto;
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #ebe6dc;
    scrollbar-width: thin;
}
.match-centre-panel .section-heading {
    align-items: stretch;
    flex-direction: column;
    gap: 14px;
    margin-bottom: 16px;
}
.match-centre-panel .section-heading h2 { font-size: 1.55rem; }
.fixture-panel-controls { display: grid; gap: 9px; }
.match-centre-panel .segmented {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    width: 100%;
}
.match-centre-panel .segmented button { min-width: 0; padding: 7px 5px; font-size: .71rem; }
.fixture-list-toggle {
    justify-self: end;
    border: 0;
    border-bottom: 1px solid currentColor;
    padding: 1px 0;
    background: transparent;
    color: var(--red-dark);
    font-size: .76rem;
    font-weight: 900;
}
.fixture-list-toggle[hidden] { display: none; }
.calendar-download-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 34px;
    border: 1px solid var(--red);
    border-radius: 999px;
    padding: 7px 13px;
    background: white;
    color: var(--red-dark);
    font-size: .76rem;
    font-weight: 900;
    line-height: 1.15;
    text-align: center;
    text-decoration: none;
}
.calendar-download-link:hover { background: var(--red); color: white; }
.match-centre-panel .calendar-download-link { width: 100%; }
.section-heading {
    display: flex;
    justify-content: space-between;
    align-items: end;
    gap: 24px;
    margin-bottom: 24px;
}
.section-heading.compact { align-items: center; }
.section-heading h2, .admin-toolbar h1 { margin: 5px 0 0; font-size: clamp(1.7rem, 4vw, 2.45rem); letter-spacing: -.04em; }
.section-heading p { margin: 4px 0 0; color: var(--muted); }
.segmented {
    display: inline-flex;
    padding: 4px;
    border-radius: 999px;
    background: #e6e1d8;
}
.segmented button {
    border: 0;
    background: transparent;
    color: var(--muted);
    border-radius: 999px;
    padding: 8px 14px;
    font-weight: 800;
    font-size: .82rem;
}
.segmented button.active { background: white; color: var(--ink); box-shadow: 0 3px 12px rgba(0,0,0,.08); }

.fixture-list { display: grid; gap: 14px; }
.fixture-card {
    display: grid;
    grid-template-columns: 165px minmax(0, 1fr) 150px 44px;
    align-items: center;
    gap: 20px;
    padding: 18px 20px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    transition: transform .2s ease, box-shadow .2s ease;
}
.fixture-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.fixture-date strong, .fixture-date span { display: block; }
.fixture-date strong { font-size: 1rem; }
.fixture-date span { color: var(--muted); font-size: .82rem; }
.fixture-title { min-width: 0; }
.fixture-title strong { display: block; font-size: 1.08rem; }
.fixture-title span { color: var(--muted); font-size: .86rem; }
.fixture-result { text-align: right; }
.fixture-result strong { display: block; font-size: 1.8rem; line-height: 1; }
.fixture-result span { font-size: .72rem; font-weight: 900; text-transform: uppercase; letter-spacing: .1em; }
.result-win { color: var(--green); }
.result-loss { color: var(--red); }
.result-draw { color: #76610d; }
.fixture-open {
    width: 38px;
    height: 38px;
    border: 1px solid var(--line);
    border-radius: 50%;
    background: white;
    font-size: 1.2rem;
}
.match-centre-panel .fixture-list { gap: 10px; }
.match-centre-panel .fixture-card {
    grid-template-columns: minmax(0, 1fr) 34px;
    gap: 6px 9px;
    padding: 13px;
    border-radius: 13px;
}
.match-centre-panel .fixture-card:hover { transform: none; }
.match-centre-panel .fixture-date,
.match-centre-panel .fixture-title,
.match-centre-panel .fixture-result { grid-column: 1; min-width: 0; }
.match-centre-panel .fixture-date strong { font-size: .84rem; }
.match-centre-panel .fixture-date span,
.match-centre-panel .fixture-title span { font-size: .72rem; }
.match-centre-panel .fixture-title strong {
    overflow-wrap: anywhere;
    font-size: .92rem;
    line-height: 1.25;
}
.match-centre-panel .fixture-result {
    display: flex;
    align-items: baseline;
    gap: 7px;
    text-align: left;
}
.match-centre-panel .fixture-result strong { font-size: 1.25rem; }
.match-centre-panel .fixture-result span { font-size: .62rem; }
.match-centre-panel .fixture-open {
    grid-column: 2;
    grid-row: 1 / span 3;
    align-self: center;
    width: 32px;
    height: 32px;
    font-size: 1rem;
}
.match-centre-panel .empty-state { padding: 24px 12px; background: rgba(255,255,255,.62); }
.empty-state {
    padding: 42px;
    text-align: center;
    color: var(--muted);
    border: 1px dashed #c9c2b5;
    border-radius: var(--radius);
    background: rgba(255,255,255,.4);
}

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: white; }
.data-table { width: 100%; border-collapse: collapse; min-width: 920px; }
.data-table th, .data-table td { padding: 14px 15px; text-align: left; border-bottom: 1px solid #ece8df; white-space: nowrap; }
.data-table th { color: var(--muted); font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; background: #faf9f6; }
.stats-sort {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    width: 100%;
    padding: 0;
    border: 0;
    background: transparent;
    color: inherit;
    font: inherit;
    font-weight: 800;
    letter-spacing: inherit;
    text-align: left;
    text-transform: inherit;
    white-space: nowrap;
}
.stats-sort:hover { color: var(--black); }
.stats-sort:focus-visible { outline: 2px solid var(--gold); outline-offset: 4px; border-radius: 2px; }
.stats-sort span { display: inline-block; min-width: 10px; color: var(--red); font-size: .62rem; }
#player-stats-table th[aria-sort="ascending"],
#player-stats-table th[aria-sort="descending"] { color: var(--black); background: #f2eee4; }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table tbody tr:hover { background: #fcfbf8; }
.player-name-cell strong { display: block; }
.player-name-cell small { color: var(--muted); }
.search-field input { min-width: 240px; }
.squad-panel .data-table { min-width: 780px; }
.squad-panel .data-table th,
.squad-panel .data-table td { padding: 12px 10px; font-size: .82rem; }

.player-card-grid { display: none; gap: 12px; }
.player-card {
    background: white;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 18px;
}
.player-card h3 { margin: 0 0 12px; }
.player-card-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.player-card-stats div { background: #f7f4ee; padding: 10px; border-radius: 10px; }
.player-card-stats small, .player-card-stats strong { display: block; }
.player-card-stats small { color: var(--muted); font-size: .65rem; text-transform: uppercase; }
.player-card-stats strong { font-size: 1.15rem; margin-top: 2px; }

.fixture-dialog {
    width: min(960px, calc(100% - 24px));
    max-height: calc(100vh - 36px);
    border: 0;
    border-radius: 22px;
    padding: 0;
    box-shadow: 0 30px 90px rgba(0,0,0,.35);
}
.fixture-dialog::backdrop { background: rgba(0,0,0,.65); backdrop-filter: blur(3px); }
.dialog-close {
    position: sticky;
    float: right;
    top: 12px;
    margin: 12px 12px -48px 0;
    z-index: 2;
    width: 38px;
    height: 38px;
    border: 0;
    border-radius: 50%;
    background: var(--black);
    color: white;
    font-size: 1.4rem;
}
.dialog-content-header { background: var(--black); color: white; padding: 30px 34px; }
.dialog-content-header h2 { margin: 4px 0; font-size: 2rem; }
.dialog-content-header p { margin: 0; color: #bebebe; }
.dialog-body { padding: 26px 34px 34px; }
.game-group + .game-group { margin-top: 28px; }
.game-group h3 { margin: 0 0 10px; }
.game-result-row {
    display: grid;
    grid-template-columns: 130px minmax(0,1fr) 100px minmax(0,1fr);
    gap: 12px;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid var(--line);
}
.game-result-row:last-child { border-bottom: 0; }
.game-result-row small { display: block; color: var(--muted); }
.game-score { font-size: 1.1rem; font-weight: 900; text-align: center; }
.game-player-list { display: grid; gap: 10px; }
.game-player-performance {
    min-width: 0;
    padding: 9px 11px;
    border-left: 3px solid #ded8cd;
    border-radius: 0 10px 10px 0;
    background: #faf8f4;
}
.game-player-name { display: block; }
.performance-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.tag { padding: 3px 7px; border-radius: 999px; background: #f0ece4; font-size: .7rem; font-weight: 800; }
.tag.checkout { background: #e1f2e9; color: var(--green); }

.site-footer { background: var(--black); color: #bfbfbf; padding: 28px 0; }
.footer-inner { display: flex; justify-content: space-between; gap: 20px; font-size: .82rem; }
.app-version {
    color: #e5c964;
    font-weight: 800;
    white-space: nowrap;
}

/* Forms and admin */
input, select, textarea {
    width: 100%;
    border: 1px solid #cfc9be;
    border-radius: var(--radius-small);
    padding: 10px 12px;
    background: white;
    color: var(--ink);
}
input:focus, select:focus, textarea:focus { outline: 3px solid rgba(184,36,47,.12); border-color: var(--red); }
label { display: grid; gap: 6px; font-size: .78rem; font-weight: 800; color: #4d4b47; }
.field-label { display: block; margin-bottom: 8px; font-size: .78rem; font-weight: 800; color: #4d4b47; }
.club-admin-grid { display: grid; grid-template-columns: minmax(240px, 1fr) minmax(360px, 1.4fr); gap: 24px; align-items: start; }
.club-logo-controls { display: flex; gap: 16px; align-items: center; }
.club-logo-controls > div { display: grid; gap: 9px; justify-items: start; }
.club-logo-preview { width: 84px; height: 84px; object-fit: contain; border: 1px solid var(--line); border-radius: 16px; padding: 6px; background: white; }
.club-logo-controls input[type="file"] { width: min(100%, 420px); padding: 9px; }
.club-admin-fieldset { margin: 24px 0 0; padding: 18px; border: 1px solid var(--line); border-radius: 14px; }
.club-admin-fieldset legend { padding: 0 8px; color: var(--ink); font-size: .9rem; font-weight: 900; }
.theme-colour-grid { display: grid; grid-template-columns: repeat(4, minmax(130px, 1fr)); gap: 14px; }
.theme-colour-grid input[type="color"] { width: 100%; min-height: 48px; padding: 5px; cursor: pointer; }
.access-toggle { display: flex; grid-template-columns: none; align-items: center; gap: 9px; font-size: .9rem; }
.access-toggle input { width: 18px; height: 18px; }
.password-settings-grid { margin-top: 16px; }
.password-settings-grid[hidden] { display: none; }
input[type="checkbox"] { width: 18px; height: 18px; }
.alert { padding: 13px 16px; border-radius: 12px; margin-bottom: 18px; background: #e8f5ed; color: #155f42; border: 1px solid #b9ddc9; }
.alert-error { background: #fae8e9; color: #861b24; border-color: #e9bcc0; }
.alert-warning { background: #fff5d6; color: #765b00; border-color: #ead58a; }
.login-page { min-height: 100vh; display: grid; place-items: center; background: var(--black); padding: 24px; }
.login-panel { width: min(430px, 100%); background: white; padding: 34px; border-radius: 22px; box-shadow: 0 30px 90px rgba(0,0,0,.35); }
.brand-centred { color: var(--ink); }
.brand-centred small { color: var(--muted); }
.login-panel h1 { margin: 30px 0 4px; }
.login-panel p { margin-top: 0; color: var(--muted); }
.stack-form { display: grid; gap: 16px; margin: 24px 0; }
.text-link { color: var(--red); font-weight: 800; text-decoration: none; font-size: .86rem; }
.login-version {
    display: block;
    margin-top: 20px;
    color: var(--muted);
    font-size: .72rem;
    font-weight: 800;
    letter-spacing: .04em;
    text-align: center;
}

.admin-page { min-height: 100vh; display: flex; flex-direction: column; }
.admin-page main { flex: 1; }
.admin-content { padding-top: 38px; }
.admin-toolbar { display: flex; justify-content: space-between; align-items: end; gap: 20px; margin-bottom: 26px; }
.toolbar-actions { display: flex; align-items: center; gap: 15px; }
.save-status { color: var(--muted); font-size: .82rem; }
.save-status.dirty { color: #805f00; font-weight: 800; }
.admin-section {
    background: white;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 20px;
}
.admin-section > .section-heading {
    position: relative;
    padding-right: 116px;
}
.admin-section > .section-heading h2 { font-size: clamp(1.35rem, 2.6vw, 1.85rem); }
.admin-section.is-collapsed > .section-heading { margin-bottom: 0; }
.admin-section.is-collapsed { box-shadow: 0 3px 12px rgba(0,0,0,.035); }
.admin-section-body[hidden] { display: none; }
.section-toggle {
    position: absolute;
    top: 50%;
    right: 0;
    transform: translateY(-50%);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--ink);
    white-space: nowrap;
}
.section-toggle span[aria-hidden="true"] {
    width: 16px;
    font-size: 1.05rem;
    line-height: 1;
    text-align: center;
}
.admin-fixture-dialog {
    width: min(1380px, calc(100% - 28px));
    max-width: none;
    height: min(920px, calc(100vh - 28px));
    max-height: none;
    border: 0;
    border-radius: 22px;
    padding: 0;
    overflow: hidden;
    background: white;
    box-shadow: 0 30px 100px rgba(0,0,0,.42);
}
.admin-fixture-dialog::backdrop {
    background: rgba(0,0,0,.72);
    backdrop-filter: blur(4px);
}
.admin-dialog-shell {
    height: 100%;
    display: grid;
    grid-template-rows: auto auto minmax(0,1fr);
}
.admin-dialog-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 24px;
    padding: 22px 28px;
    background: var(--black);
    color: white;
}
.admin-dialog-header h2 { margin: 3px 0; font-size: clamp(1.6rem, 3vw, 2.3rem); }
.admin-dialog-header p { margin: 0; color: #bebebe; }
.admin-dialog-actions { flex: 0 0 auto; align-items: center; }
.admin-dialog-body {
    min-height: 0;
    overflow-y: auto;
    padding: 26px 28px 38px;
    overscroll-behavior: contain;
}
#fixture-editor-alert { margin: 18px 28px 0; }
.form-grid { display: grid; gap: 16px; }
.form-grid.two { grid-template-columns: repeat(2, minmax(0,1fr)); }
.admin-table { min-width: 650px; }
.admin-table input[type="text"] { min-width: 240px; }
.member-leadership { min-width: 150px; }
.icon-button {
    border: 1px solid var(--line);
    background: white;
    border-radius: 10px;
    padding: 7px 10px;
    font-weight: 800;
}
.icon-button.danger { color: var(--red); }
.admin-fixture-list { display: grid; gap: 10px; }
.admin-fixture-row {
    display: grid;
    grid-template-columns: 130px minmax(0,1fr) 130px auto;
    gap: 14px;
    align-items: center;
    padding: 14px;
    border-radius: 13px;
    background: #f7f5f0;
}
.admin-fixture-row strong, .admin-fixture-row span { display: block; }
.admin-fixture-row span { color: var(--muted); font-size: .8rem; }
.row-actions { display: flex; gap: 8px; }
.fixture-list-controls { align-items: end; }
.fixture-season-filter {
    display: grid;
    gap: 5px;
    min-width: 210px;
    color: var(--muted);
    font-size: .75rem;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
}
.fixture-season-filter select {
    width: 100%;
    min-width: 0;
    background: #fff;
    color: var(--ink);
    letter-spacing: normal;
    text-transform: none;
}
.fixture-form { display: grid; gap: 24px; }
.fixture-games { display: grid; gap: 18px; }
.fixture-type-group {
    border: 1px solid var(--line);
    border-radius: 16px;
    overflow: hidden;
}
.fixture-type-header {
    padding: 13px 16px;
    background: var(--black);
    color: white;
    display: flex;
    justify-content: space-between;
    gap: 14px;
}
.fixture-type-header h3 { margin: 0; }
.fixture-type-header span { color: #c6c6c6; font-size: .8rem; }
.game-editor {
    padding: 16px;
    border-bottom: 1px solid var(--line);
}
.game-editor:last-child { border-bottom: 0; }
.game-editor-top {
    display: grid;
    grid-template-columns: 150px minmax(0,1fr) minmax(120px,150px) minmax(120px,150px);
    gap: 12px;
    align-items: end;
}
.game-editor-title strong, .game-editor-title small { display: block; }
.game-editor-title small { color: var(--muted); }
.game-score-clear {
    border: 0;
    border-bottom: 1px solid currentColor;
    margin-top: 8px;
    padding: 1px 0;
    background: transparent;
    color: var(--red-dark);
    font-size: .72rem;
    font-weight: 900;
}
.game-score-clear[hidden] { display: none; }
.leg-score-selector {
    min-width: 0;
    margin: 0;
    padding: 0;
    border: 0;
}
.leg-score-selector legend {
    margin-bottom: 6px;
    color: #4d4b47;
    font-size: .78rem;
    font-weight: 800;
}
.leg-score-options {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: 1fr;
    gap: 6px;
}
.leg-score-button {
    min-width: 0;
    min-height: 42px;
    border: 1px solid #cfc9be;
    border-radius: 11px;
    background: white;
    color: var(--ink);
    font-size: 1rem;
    font-weight: 900;
}
.leg-score-button:hover { border-color: var(--red); }
.leg-score-button.is-selected {
    border-color: var(--red-dark);
    background: var(--red-dark);
    color: white;
    box-shadow: 0 4px 12px rgba(128, 24, 34, .2);
}
.leg-score-button:focus-visible {
    outline: 3px solid rgba(184,36,47,.2);
    outline-offset: 2px;
}

.fixture-ko-cup {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 48px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.04);
}

.fixture-ko-cup input {
    width: 20px;
    height: 20px;
    margin: 0;
    flex: 0 0 auto;
}

.recorded-result {
    color: var(--gold);
}

.import-divider {
    height: 1px;
    margin: 24px 0;
    background: var(--line);
}

.import-subheading {
    margin-bottom: 12px;
}
.player-select-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0,1fr));
    gap: 10px;
}
.performance-editor {
    display: grid;
    gap: 10px;
    margin-top: 14px;
    padding: 13px;
    border-radius: 12px;
    background: #f7f5f0;
}
.performance-row {
    display: grid;
    grid-template-columns: 160px minmax(0,1fr) minmax(0,1fr);
    gap: 12px;
    align-items: end;
}
.performance-row strong { padding-bottom: 10px; }
.performance-score-entry { display: grid; gap: 7px; }
.performance-label-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.performance-label-row > label { flex: 0 0 auto; }
.quick-score-buttons { display: flex; flex: 1 1 280px; flex-wrap: wrap; gap: 5px; }
.quick-score-button {
    min-width: 38px;
    min-height: 28px;
    padding: 3px 8px;
    border: 1px solid #cfc7b8;
    border-radius: 999px;
    background: white;
    color: var(--ink);
    font-size: .7rem;
    font-weight: 800;
}
.quick-score-button:hover { border-color: var(--gold); background: #fff8e4; }
.quick-score-button:active { transform: translateY(1px); }
.quick-score-button:focus-visible { outline: 3px solid rgba(215,167,44,.28); outline-offset: 2px; }
.help-text { color: var(--muted); font-size: .75rem; margin: 0; }

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0,0,0,0);
    white-space: nowrap;
    border: 0;
}

@media (max-width: 1000px) {
    .stats-grid { grid-template-columns: repeat(3, 1fr); margin-top: -64px; }
    .hero-grid { grid-template-columns: 1fr 260px; }
    .dartboard-art { width: 250px; }
}
@media (max-width: 900px) {
    .dashboard-content-grid { grid-template-columns: 1fr; padding-top: 54px; }
    .match-centre-panel {
        position: static;
        max-height: none;
        overflow: visible;
    }
    .match-centre-panel .section-heading { flex-direction: row; align-items: end; }
    .fixture-panel-controls { min-width: 300px; }
}
@media (max-width: 760px) {
    .club-admin-grid, .theme-colour-grid { grid-template-columns: 1fr; }
    .club-logo-controls { align-items: flex-start; }
    .shell { width: calc(100% - 22px); }
    .top-nav > a:not(.button) { display: none; }
    .hero { min-height: 430px; }
    .hero-grid { grid-template-columns: 1fr; padding: 46px 0 84px; }
    .subpage-hero-grid { align-items: stretch; flex-direction: column; padding: 34px 0; }
    .fixtures-page-content { padding-top: 34px; padding-bottom: 52px; }
    .fixtures-archive .section-heading { gap: 16px; }
    .fixtures-archive .fixture-panel-controls { justify-content: flex-start; }
    .dartboard-art { display: none; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); margin-top: -62px; }
    .stat-card { min-height: 112px; }
    .section-heading, .admin-toolbar { align-items: stretch; flex-direction: column; }
    .match-centre-panel .section-heading { align-items: stretch; flex-direction: column; }
    .fixture-panel-controls { min-width: 0; }
    .calendar-download-link { width: 100%; }
    .fixture-card { grid-template-columns: 110px minmax(0,1fr) 42px; gap: 12px; }
    .fixture-result { grid-column: 2; text-align: left; }
    .fixture-open { grid-column: 3; grid-row: 1 / span 2; }
    .data-table { display: none; }
    .mobile-table-wrap {
        overflow: visible;
        border: 0;
        border-radius: 0;
        background: transparent;
    }
    .mobile-admin-table {
        display: block;
        width: 100%;
        min-width: 0;
    }
    .mobile-admin-table thead { display: none; }
    .mobile-admin-table tbody {
        display: grid;
        gap: 12px;
    }
    .mobile-admin-table tbody tr {
        display: grid;
        grid-template-columns: repeat(2, minmax(0,1fr));
        gap: 12px;
        padding: 14px;
        border: 1px solid var(--line);
        border-radius: 14px;
        background: #faf9f6;
    }
    .mobile-admin-table tbody td {
        display: block;
        min-width: 0;
        padding: 0;
        border: 0;
        white-space: normal;
    }
    .mobile-admin-table tbody td::before {
        content: attr(data-label);
        display: block;
        margin-bottom: 6px;
        color: var(--muted);
        font-size: .66rem;
        font-weight: 900;
        letter-spacing: .08em;
        text-transform: uppercase;
    }
    .mobile-admin-table tbody td[data-label="Season name"],
    .mobile-admin-table tbody td[data-label="Name"],
    .mobile-admin-table tbody td[data-label="Actions"] {
        grid-column: 1 / -1;
    }
    .mobile-admin-table input[type="text"] {
        width: 100%;
        min-width: 0;
    }
    .player-card-grid { display: grid; }
    .form-grid.two { grid-template-columns: 1fr; }
    .admin-fixture-row { grid-template-columns: 1fr auto; }
    .admin-fixture-row > :nth-child(3) { display: none; }
    .game-editor-top { grid-template-columns: 1fr 1fr; }
    .player-select-grid { grid-template-columns: 1fr; }
    .performance-row { grid-template-columns: 1fr; }
    .performance-row strong { padding: 0; }
    .toolbar-actions { align-items: stretch; flex-direction: column; }
    .admin-section { padding: 18px; }
    .admin-section > .section-heading { padding-right: 0; padding-top: 44px; }
    .admin-section > .section-heading .row-actions {
        width: 100%;
        flex-direction: column;
        align-items: stretch;
    }
    .section-toggle { top: 0; right: 0; transform: none; }
    .admin-fixture-dialog {
        width: calc(100% - 10px);
        height: calc(100vh - 10px);
        border-radius: 16px;
    }
    .admin-dialog-header { align-items: stretch; flex-direction: column; padding: 18px; }
    .admin-dialog-actions { flex-wrap: wrap; }
    .admin-dialog-actions .button { flex: 1 1 auto; }
    .admin-dialog-body { padding: 18px; }
    #fixture-editor-alert { margin: 12px 18px 0; }
    .footer-inner { flex-direction: column; }
    .game-result-row { grid-template-columns: 1fr 70px; }
    .game-result-row > :nth-child(4) { grid-column: 1; }
}

/* Season controls */
.season-picker {
    width: fit-content;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 7px 8px 7px 13px;
    border: 1px solid rgba(255,255,255,.2);
    border-radius: 999px;
    background: rgba(255,255,255,.08);
    color: white;
}
.season-picker span {
    color: var(--gold);
    font-size: .7rem;
    font-weight: 900;
    letter-spacing: .13em;
    text-transform: uppercase;
}
.season-picker select {
    width: auto;
    min-width: 145px;
    padding: 7px 34px 7px 12px;
    border: 0;
    border-radius: 999px;
    background: white;
    color: var(--ink);
    font-weight: 900;
}
.season-table { min-width: 620px; }
.season-table input[type="text"] { min-width: 260px; }
.season-table input[type="radio"] { width: 19px; height: 19px; }
.icon-button:disabled {
    cursor: not-allowed;
    opacity: .42;
}

@media (max-width: 760px) {
    .season-picker { width: 100%; justify-content: space-between; }
    .season-picker select { flex: 1; }
}


/* Authentication, imports and user management */
.header-user { color: #c7c7c7; font-size: .78rem; white-space: nowrap; }
.import-form { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 14px; align-items: end; max-width: 760px; }
.user-table { min-width: 980px; }
.user-table td { vertical-align: middle; }
.user-table input[type="text"], .user-table input[type="password"] { min-width: 150px; }
.user-table select { min-width: 140px; }
@media (max-width: 760px) {
    .header-user { display: none; }
    .import-form { grid-template-columns: 1fr; }
}

.user-create-form { display: grid; grid-template-columns: 1.1fr 1.2fr 160px 1.1fr auto; gap: 12px; align-items: end; margin-bottom: 18px; padding: 16px; border-radius: 14px; background: #f7f5f0; }
@media (max-width: 1000px) { .user-create-form { grid-template-columns: repeat(2, minmax(0,1fr)); } }
@media (max-width: 620px) { .user-create-form { grid-template-columns: 1fr; } }

/* Final mobile containment overrides must follow desktop season/user rules. */
@media (max-width: 760px) {
    .mobile-table-wrap,
    .mobile-admin-table,
    .mobile-admin-table.season-table,
    .mobile-admin-table.member-table {
        width: 100%;
        min-width: 0;
        max-width: 100%;
    }
    .mobile-admin-table.season-table input[type="text"],
    .mobile-admin-table.member-table input[type="text"] {
        width: 100%;
        min-width: 0;
        max-width: 100%;
    }
    .mobile-admin-table tbody tr,
    .mobile-admin-table tbody td {
        min-width: 0;
        max-width: 100%;
    }
    .admin-fixture-dialog {
        width: calc(100vw - 10px);
        max-width: calc(100vw - 10px);
        height: calc(100dvh - 10px);
        max-height: calc(100dvh - 10px);
        margin: auto;
    }
    .admin-dialog-shell,
    .admin-dialog-header,
    .admin-dialog-body,
    .fixture-form,
    .form-grid,
    .fixture-games,
    .fixture-type-group,
    .game-editor,
    .game-editor-top,
    .player-select-grid,
    .performance-editor,
    .performance-row {
        width: 100%;
        min-width: 0;
        max-width: 100%;
    }
    .admin-dialog-body { overflow-x: hidden; }
    .game-editor-top { grid-template-columns: minmax(0,1fr); }
    .admin-fixture-dialog input,
    .admin-fixture-dialog select,
    .admin-fixture-dialog textarea {
        width: 100%;
        min-width: 0;
        max-width: 100%;
    }
    .fixture-type-header { align-items: flex-start; flex-direction: column; }
}
