/* ===== Design tokens ===== */
:root {
    color-scheme: light;

    --color-navy: #0b1f3a;
    --color-navy-light: #14305c;
    --color-navy-dark: #071426;

    --color-text: #1a1a1a;
    --color-text-muted: #5b6472;
    --color-bg: #fafafa;
    --color-surface: #ffffff;
    --color-border: #dde1e6;

    /* Separate from --color-navy: that stays a dark brand surface for the
       header and buttons in both themes, while these have to flip. */
    --color-heading: var(--color-navy);
    --color-link: var(--color-navy);

    --color-error-text: #b91c1c;
    --color-error-bg: #fee2e2;
    --color-error-border: #fca5a5;
    --color-success-text: #166534;
    --color-success-bg: #dcfce7;
    --color-success-border: #86efac;

    --color-role-volunteer: #4ade80;
    --color-role-manager: #60a5fa;
    --color-role-developer: #fbbf24;
    --color-role-grant: #7c3aed;

    --font-sans: system-ui, -apple-system, "Segoe UI", sans-serif;

    --text-sm: 0.875rem;
    --text-base: 1rem;
    --text-lg: 1.125rem;
    --text-xl: 1.5rem;
    --text-2xl: 2rem;

    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-5: 1.5rem;
    --space-6: 2rem;
    --space-8: 3rem;

    --radius-sm: 4px;
    --radius-md: 8px;

    --shadow-sm: 0 1px 2px rgba(11, 31, 58, 0.08);
    --shadow-md: 0 4px 12px rgba(11, 31, 58, 0.1);

    --max-width: 1000px;
    --max-width-narrow: 420px;
}

/* ===== Base ===== */
* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: var(--font-sans);
    font-size: var(--text-base);
    line-height: 1.5;
    color: var(--color-text);
    background: var(--color-bg);
}

h1, h2, h3 {
    line-height: 1.25;
    color: var(--color-heading);
}

h1 {
    font-size: var(--text-2xl);
}

h2 {
    font-size: var(--text-xl);
}

p {
    margin: 0 0 var(--space-4);
}

a {
    color: var(--color-link);
}

.container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 var(--space-5);
}

main {
    min-height: 60vh;
    padding: var(--space-6) var(--space-5) var(--space-8);
}

/* ===== Header =====
   Two tiers: identity and account on top, site navigation below. Keeping
   "who am I" separate from "where am I going" stops the row becoming a
   jumble once the name, role and log out are all competing for space. */
.site-header {
    background: var(--color-navy);
    color: #fff;
    /* Coloured when signed in with elevated access — see .role-* below. */
    border-top: 5px solid transparent;
}

.header-top .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: var(--space-3);
    padding-top: var(--space-4);
    padding-bottom: var(--space-4);
}

.logo {
    color: #fff;
    font-weight: bold;
    text-decoration: none;
    font-size: var(--text-lg);
    letter-spacing: -0.01em;
}

/* ----- Account cluster ----- */
.account {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    font-size: var(--text-sm);
}

.account a.account-name {
    color: #cbd5e1;
    text-decoration: none;
}

.account a.account-name:hover {
    color: #fff;
    text-decoration: underline;
}

.account a {
    color: #fff;
    text-decoration: none;
}

.account a:hover {
    text-decoration: underline;
}

/* Colour is reinforcement only — the role is always spelled out, so this
   still reads correctly without colour vision. */
.role-chip {
    display: inline-block;
    border-radius: var(--radius-sm);
    padding: 1px var(--space-2);
    font-size: 0.6875rem;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--color-navy-dark);
    background: #cbd5e1;
}

.role-chip--volunteer {
    background: var(--color-role-volunteer);
}

.role-chip--manager {
    background: var(--color-role-manager);
}

.role-chip--developer {
    background: var(--color-role-developer);
}

.role-chip--grant {
    background: var(--color-role-grant);
    color: #fff;
}

body.role-volunteer .site-header {
    border-top-color: var(--color-role-volunteer);
}

body.role-manager .site-header {
    border-top-color: var(--color-role-manager);
}

body.role-developer .site-header {
    border-top-color: var(--color-role-developer);
}

/* ----- Navigation tier ----- */
.header-nav {
    background: var(--color-navy-dark);
    position: sticky;
    top: 0;
    z-index: 20;
}

/* One row that scrolls sideways, rather than three rows of wrapped links.
   On a 375px phone the wrapped version ate 140px of screen before any content
   appeared. */
.header-nav .container {
    display: flex;
    gap: var(--space-1);
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
}

.header-nav .container::-webkit-scrollbar {
    display: none;
}

.header-nav a {
    color: #cbd5e1;
    text-decoration: none;
    font-size: var(--text-sm);
    padding: var(--space-3) var(--space-3);
    border-bottom: 3px solid transparent;
    white-space: nowrap;
}

.header-nav a:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.06);
}

.header-nav a.is-active {
    color: #fff;
    font-weight: bold;
    border-bottom-color: #fff;
}

/* ===== Footer ===== */

.site-footer {
    margin-top: var(--space-6);
    background: var(--color-navy);
    color: #cbd5e1;
    text-align: center;
    padding: var(--space-4) 0;
    font-size: var(--text-sm);
}

/* ===== Buttons ===== */
.btn {
    display: inline-block;
    background: var(--color-navy);
    color: #fff;
    text-decoration: none;
    padding: var(--space-3) var(--space-5);
    border: none;
    border-radius: var(--radius-sm);
    font-size: var(--text-base);
    font-family: inherit;
    cursor: pointer;
    text-align: center;
}

.btn:hover {
    background: var(--color-navy-light);
}

.btn-block {
    display: block;
    width: 100%;
}

/* ===== Card ===== */
.card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    padding: var(--space-5);
    margin-bottom: var(--space-4);
}

.card:last-child {
    margin-bottom: 0;
}

.card-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

/* ===== Alerts ===== */
.alert {
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    margin-bottom: var(--space-4);
    font-size: var(--text-sm);
}

.alert-error {
    color: var(--color-error-text);
    background: var(--color-error-bg);
    border-color: var(--color-error-border);
}

.alert-success {
    color: var(--color-success-text);
    background: var(--color-success-bg);
    border-color: var(--color-success-border);
}

/* ===== Forms ===== */
.form-group {
    margin-bottom: var(--space-4);
}

.form-group label {
    display: block;
    margin-bottom: var(--space-1);
    font-weight: bold;
    font-size: var(--text-sm);
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: var(--space-2) var(--space-3);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-size: var(--text-base);
    font-family: inherit;
    background: var(--color-surface);
    color: var(--color-text);
}

.form-group input:focus,
.form-group textarea:focus {
    outline: 2px solid var(--color-navy-light);
    outline-offset: 1px;
}

.form-actions {
    margin-top: var(--space-5);
}

/* ===== Page-specific layout ===== */
.landing {
    max-width: 640px;
    margin: 0 auto;
    text-align: center;
    padding: var(--space-6) 0;
}

.landing-intro {
    font-size: var(--text-lg);
    color: var(--color-text-muted);
}

.auth-card {
    max-width: var(--max-width-narrow);
    margin: 0 auto;
}

.text-muted {
    color: var(--color-text-muted);
}

/* ===== Phones =====
   Tighter gutters and padding: 24px each side of a 375px screen is a lot of
   nothing when someone is reading a fixture list one-handed. */
@media (max-width: 640px) {
    .container {
        padding: 0 var(--space-4);
    }

    main {
        padding: var(--space-5) var(--space-4) var(--space-6);
    }

    .card {
        padding: var(--space-4);
    }

    h1 {
        font-size: 1.625rem;
    }

    h2 {
        font-size: var(--text-lg);
    }

    /* Buttons go full width so they are easy to hit with a thumb. */
    .form-actions .btn {
        display: block;
        width: 100%;
    }

    .page-head {
        gap: var(--space-3);
    }
}

/* ===== Page head ===== */
.page-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
    flex-wrap: wrap;
    margin-bottom: var(--space-5);
}

.page-head h1 {
    margin: 0;
}

/* ===== Tags ===== */
.tag {
    display: inline-block;
    background: var(--color-navy);
    color: #fff;
    border-radius: var(--radius-sm);
    padding: 0 var(--space-2);
    font-size: var(--text-sm);
}

.tag-warn {
    background: var(--color-error-text);
}

/* ===== Fixture / session rows =====
   Date as a calendar chip on the left so a season's worth of rows can be
   scanned down the left edge on a phone. */
.fixture {
    display: flex;
    align-items: flex-start;
    gap: var(--space-4);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    padding: var(--space-4);
    margin-bottom: var(--space-3);
}

.fixture-date {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex-shrink: 0;
    min-width: 52px;
    padding: var(--space-2);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-bg);
    line-height: 1.15;
}

.fixture-dow,
.fixture-mon,
.fixture-year {
    font-size: 0.6875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-text-muted);
}

.fixture-day {
    font-size: var(--text-xl);
    font-weight: bold;
    color: var(--color-heading);
}

.fixture-body {
    flex: 1;
    min-width: 0;
}

.fixture-club {
    font-size: var(--text-lg);
    font-weight: bold;
    color: var(--color-heading);
    text-decoration: none;
}

.fixture-club:hover {
    text-decoration: underline;
}

.fixture-edit {
    flex-shrink: 0;
    font-size: var(--text-sm);
    white-space: nowrap;
}

.pill {
    display: inline-block;
    margin-left: var(--space-2);
    padding: 0 var(--space-2);
    border: 1px solid var(--color-border);
    border-radius: 999px;
    background: var(--color-bg);
    color: var(--color-text-muted);
    font-size: 0.6875rem;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    vertical-align: middle;
}

.pill-warn {
    background: var(--color-error-bg);
    border-color: var(--color-error-border);
    color: var(--color-error-text);
}

.is-cancelled .fixture-club {
    text-decoration: line-through;
}

/* The sentence a coach reads on the way to training. */
.concussion-summary {
    font-size: var(--text-lg);
    line-height: 1.4;
    margin-bottom: var(--space-3);
}

.gates {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    margin-bottom: var(--space-3);
}

.gates .pill {
    margin-left: 0;
}

/* ===== Timeline ===== */
.timeline {
    list-style: none;
    margin: 0;
    padding: 0;
}

.timeline li {
    position: relative;
    padding-left: var(--space-6);
    padding-bottom: var(--space-5);
}

.timeline li::before {
    content: '';
    position: absolute;
    left: 7px;
    top: 1.35rem;
    bottom: 0;
    width: 2px;
    background: var(--color-border);
}

.timeline li:last-child {
    padding-bottom: 0;
}

.timeline li:last-child::before {
    display: none;
}

.timeline-dot {
    position: absolute;
    left: 0;
    top: 0.3rem;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid var(--color-border);
    background: var(--color-surface);
}

.timeline .is-done .timeline-dot {
    background: var(--color-navy);
    border-color: var(--color-navy);
}

.timeline .is-current .timeline-dot {
    background: var(--color-role-developer);
    border-color: var(--color-role-developer);
}

.timeline .is-due .timeline-dot {
    background: var(--color-role-volunteer);
    border-color: var(--color-role-volunteer);
}

.action-banner {
    font-size: var(--text-lg);
}

.restart-form {
    margin-top: var(--space-5);
    padding-top: var(--space-4);
    border-top: 1px solid var(--color-border);
}

/* Bulk contact entry: one guardian per row, wrapping to stacked on a phone. */
.guardian-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: var(--space-3);
    align-items: end;
    padding-bottom: var(--space-4);
    margin-bottom: var(--space-4);
    border-bottom: 1px solid var(--color-border);
}

.guardian-grid:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.guardian-grid-name {
    grid-column: 1 / -1;
}

.guardian-grid .form-group {
    margin-bottom: 0;
}

@media (max-width: 640px) {
    .guardian-grid {
        grid-template-columns: 1fr;
    }
}

.page-head span {
    display: flex;
    align-items: center;
    gap: var(--space-4);
}

/* ===== Directions ===== */
.directions-wrap {
    margin: var(--space-3) 0;
}

/* Sized as a proper touch target: this gets tapped in a car park, one-handed,
   probably in the rain. */
.directions {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    min-height: 44px;
    /* A postcode split across two lines is unreadable at a glance. */
    white-space: nowrap;
    padding: var(--space-2) var(--space-4);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-surface);
    color: var(--color-link);
    text-decoration: none;
    font-size: var(--text-sm);
    font-weight: bold;
}

.directions::before {
    content: '➜';
    transform: rotate(-45deg);
}

.directions:hover {
    border-color: var(--color-link);
}

/* ===== Sub-tabs ===== */
.subtabs {
    position: relative;
    z-index: 1;
    display: flex;
    gap: var(--space-1);
    margin-bottom: var(--space-5);
    border-bottom: 1px solid var(--color-border);
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
}

.subtabs::-webkit-scrollbar {
    display: none;
}

.subtabs a {
    white-space: nowrap;
}

.subtabs a {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-4);
    color: var(--color-text-muted);
    text-decoration: none;
    font-size: var(--text-sm);
    border-bottom: 3px solid transparent;
    margin-bottom: -1px;
}

.subtabs a:hover {
    color: var(--color-text);
}

.subtabs a.is-active {
    color: var(--color-heading);
    font-weight: bold;
    border-bottom-color: var(--color-heading);
}

.subtab-count {
    display: inline-block;
    min-width: 1.4em;
    text-align: center;
    padding: 0 var(--space-1);
    border-radius: 999px;
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    font-size: 0.6875rem;
}

.subtab-count--warn {
    background: var(--color-error-bg);
    border-color: var(--color-error-border);
    color: var(--color-error-text);
}

/* ===== Collapsible rows ===== */
details.card > summary {
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: var(--space-2);
    flex-wrap: wrap;
    /* The default triangle is lost once summary becomes a flex container, so
       the chevron below replaces it — without one, nothing says "tap me". */
    list-style: none;
    min-height: 44px;
}

details.card > summary::-webkit-details-marker {
    display: none;
}

details.card > summary::after {
    content: '⌄';
    margin-left: auto;
    font-size: var(--text-lg);
    line-height: 1;
    color: var(--color-text-muted);
    transform: translateY(-0.2em);
    transition: transform 0.15s ease;
}

details.card[open] > summary::after {
    transform: rotate(180deg) translateY(0.1em);
}

details.card[open] > summary {
    padding-bottom: var(--space-4);
    margin-bottom: var(--space-4);
    border-bottom: 1px solid var(--color-border);
}

.guardian-summary-name {
    font-weight: bold;
}

.matrix-row {
    display: grid;
    grid-template-columns: 2fr auto 2fr auto;
    gap: var(--space-3);
    align-items: center;
    padding: var(--space-2) 0;
    border-top: 1px solid var(--color-border);
}

@media (max-width: 640px) {
    .matrix-row {
        grid-template-columns: 1fr auto;
    }
}

.guardian-actions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-3);
    margin-top: var(--space-4);
    padding-top: var(--space-4);
    border-top: 1px solid var(--color-border);
}

.guardian-actions form {
    margin: 0;
}

/* A link meant to be copied out and pasted into WhatsApp. */
.copy-link {
    margin-top: var(--space-2);
    padding: var(--space-2);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-surface);
    color: var(--color-text);
    font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
    font-size: var(--text-sm);
    word-break: break-all;
}

/* ===== List row actions ===== */
.row-actions {
    margin-top: var(--space-3);
    font-size: var(--text-sm);
}

.is-cancelled strong,
.is-cancelled .text-muted {
    text-decoration: line-through;
}

/* ===== Forms: extras ===== */
.form-group select {
    width: 100%;
    padding: var(--space-2) var(--space-3);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-size: var(--text-base);
    font-family: inherit;
    background: var(--color-surface);
    color: var(--color-text);
}

.form-group small {
    display: block;
    margin-top: var(--space-1);
    font-size: var(--text-sm);
}

.form-check label {
    font-weight: normal;
    display: flex;
    gap: var(--space-2);
    align-items: flex-start;
}

.consent-block .form-check {
    margin-bottom: var(--space-4);
}

/* Not a choice — reads as a statement, so it must not look like a tick box. */
.consent-notice {
    padding: var(--space-3);
    border-left: 3px solid var(--color-navy);
    background: var(--color-bg);
    font-size: var(--text-sm);
    line-height: 1.5;
}

.consent-block .form-check label {
    line-height: 1.4;
}

.form-check input {
    width: auto;
    flex-shrink: 0;
    margin-top: 0.2em;
}

fieldset {
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    padding: var(--space-4);
    margin: 0 0 var(--space-4);
}

legend {
    font-size: var(--text-sm);
    font-weight: bold;
    padding: 0 var(--space-2);
}

/* ===== Destructive actions ===== */
.danger-zone {
    border-color: var(--color-error-border);
}

.btn-danger {
    background: var(--color-error-text);
}

.btn-danger:hover {
    background: #991b1b;
}

/* ===== Theme toggle ===== */
.theme-toggle {
    background: none;
    border: 1px solid rgba(255, 255, 255, 0.35);
    border-radius: 999px;
    color: #cbd5e1;
    font-family: inherit;
    font-size: var(--text-sm);
    line-height: 1.6;
    padding: 0 var(--space-3);
    cursor: pointer;
}

.theme-toggle:hover {
    background: rgba(255, 255, 255, 0.12);
}

/* ===== Dark theme =====
   Follows the operating system unless the toggle has been used, in which case
   the stored choice wins. The token block is repeated rather than shared
   because a media query cannot be reused as a selector. */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        color-scheme: dark;

        --color-text: #e6e9ed;
        --color-text-muted: #9aa5b1;
        --color-bg: #0f151c;
        --color-surface: #18202a;
        --color-border: #2b3642;

        --color-heading: #cfe0f5;
        --color-link: #8ab4f8;

        --color-error-text: #fca5a5;
        --color-error-bg: #3f1d1d;
        --color-error-border: #7f1d1d;
        --color-success-text: #86efac;
        --color-success-bg: #14321f;
        --color-success-border: #166534;

        --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
        --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.5);
    }
}

:root[data-theme="dark"] {
    color-scheme: dark;

    --color-text: #e6e9ed;
    --color-text-muted: #9aa5b1;
    --color-bg: #0f151c;
    --color-surface: #18202a;
    --color-border: #2b3642;

    --color-heading: #cfe0f5;
    --color-link: #8ab4f8;

    --color-error-text: #fca5a5;
    --color-error-bg: #3f1d1d;
    --color-error-border: #7f1d1d;
    --color-success-text: #86efac;
    --color-success-bg: #14321f;
    --color-success-border: #166534;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.5);
}

/* ===== What to bring ===== */
.kit {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-2);
    margin: var(--space-3) 0;
}

.kit-label {
    font-size: var(--text-sm);
    font-weight: bold;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.kit-item {
    display: inline-block;
    padding: var(--space-1) var(--space-3);
    border: 1px solid var(--color-border);
    border-radius: 999px;
    background: var(--color-bg);
    font-size: var(--text-sm);
}

/* Ticked for this one event, so it stands out from the three constants. */
.kit-item--extra {
    border-color: var(--color-navy);
    background: var(--color-surface);
    font-weight: bold;
}

/* A short form sitting inside an expanded row, not a page of its own. */
.inline-form {
    margin-top: var(--space-4);
    padding-top: var(--space-4);
    border-top: 1px solid var(--color-border);
}

/* Name over email, so two accounts held by the same person are told apart at a
   glance rather than after a click. */
.person-summary {
    display: flex;
    flex-direction: column;
    line-height: 1.3;
    margin-right: auto;
}

.person-email {
    font-size: var(--text-sm);
    font-weight: normal;
    color: var(--color-text-muted);
}

/* ===== View as =====
   Deliberately loud. Forgetting you are previewing and concluding the site is
   broken is the obvious failure mode. */
.viewing-as {
    background: var(--color-role-developer);
    color: var(--color-navy-dark);
    font-size: var(--text-sm);
    font-weight: bold;
    padding: var(--space-3) 0;
}

.viewing-as .container {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
}

.viewing-as a {
    color: var(--color-navy-dark);
}

.view-as-picker {
    display: inline-flex;
    gap: var(--space-1);
    font-size: var(--text-sm);
}

.view-as-picker a {
    color: #cbd5e1;
    text-decoration: none;
    padding: 0 var(--space-2);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: var(--radius-sm);
}

.view-as-picker a:hover {
    color: #fff;
    border-color: rgba(255, 255, 255, 0.6);
}

.view-as-picker a.is-active {
    background: var(--color-role-developer);
    border-color: var(--color-role-developer);
    color: var(--color-navy-dark);
}

.injury-entry {
    padding-bottom: var(--space-4);
    margin-bottom: var(--space-4);
    border-bottom: 1px solid var(--color-border);
}

.injury-entry:last-child {
    padding-bottom: 0;
    margin-bottom: 0;
    border-bottom: none;
}

/* ===== Squad selection ===== */
.squad-counts {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-5);
}

.squad-pick {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    margin-bottom: var(--space-2);
}

.squad-pick-options {
    display: flex;
    gap: var(--space-2);
}

/* Big enough to hit with a thumb while holding a clipboard. */
.squad-option {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    min-height: 40px;
    padding: 0 var(--space-3);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-size: var(--text-sm);
    cursor: pointer;
}

.squad-option:has(input:checked) {
    border-color: var(--color-heading);
    background: var(--color-bg);
    font-weight: bold;
}

.squad-option--blue:has(input:checked) {
    border-color: #2563eb;
    box-shadow: inset 0 0 0 1px #2563eb;
}

.squad-option--red:has(input:checked) {
    border-color: #dc2626;
    box-shadow: inset 0 0 0 1px #dc2626;
}

.squad-option input:disabled + span {
    color: var(--color-text-muted);
}

.inline-edit {
    margin-top: var(--space-3);
    font-size: var(--text-sm);
}

.inline-edit > summary {
    cursor: pointer;
    color: var(--color-link);
}

/* ===== Match day =====
   Built for a cold hand on a phone: big targets, no page reloads, and a save
   state you can see without reading. */
.save-state {
    position: sticky;
    /* Below the sticky nav, not underneath it. */
    top: 52px;
    z-index: 15;
    padding: var(--space-2) var(--space-4);
    border-radius: var(--radius-sm);
    background: var(--color-success-bg);
    color: var(--color-success-text);
    border: 1px solid var(--color-success-border);
    font-size: var(--text-sm);
    font-weight: bold;
    margin-bottom: var(--space-4);
}

.save-state.is-bad {
    background: var(--color-error-bg);
    color: var(--color-error-text);
    border-color: var(--color-error-border);
}

.scoreline {
    display: flex;
    justify-content: space-around;
    text-align: center;
}

.scoreline-side {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
}

.scoreline-label {
    font-size: var(--text-sm);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-text-muted);
}

.scoreline-value {
    font-size: 2.5rem;
    font-weight: bold;
    line-height: 1;
    color: var(--color-heading);
}

.their-buttons {
    display: flex;
    gap: var(--space-2);
    justify-content: center;
}

.their-buttons .btn {
    padding: var(--space-2) var(--space-3);
    min-width: 52px;
}

.player-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: var(--space-2);
    margin-bottom: var(--space-5);
}

.player-tile {
    display: flex;
    align-items: stretch;
    border: 2px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-surface);
    overflow: hidden;
}

.player-tile.is-in {
    border-color: var(--color-heading);
    background: var(--color-bg);
}

.player-tile-name,
.picker-option {
    flex: 1;
    min-height: 56px;
    padding: var(--space-2);
    border: none;
    background: none;
    font-family: inherit;
    font-size: var(--text-base);
    font-weight: bold;
    color: var(--color-text);
    cursor: pointer;
    text-align: left;
    line-height: 1.2;
}

.player-tile.is-in .player-tile-name {
    color: var(--color-heading);
}

.player-tile-surname {
    display: block;
    font-weight: normal;
    font-size: var(--text-sm);
    color: var(--color-text-muted);
}

.player-tile-star {
    width: 44px;
    border: none;
    border-left: 1px solid var(--color-border);
    background: none;
    font-size: var(--text-lg);
    color: var(--color-border);
    cursor: pointer;
}

.player-tile-star.is-on {
    color: var(--color-role-developer);
}

.try-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
}

/* Full-screen so a mis-tap hits a name rather than the page behind it. */
.picker {
    position: fixed;
    inset: 0;
    z-index: 50;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: flex-end;
}

.picker-inner {
    width: 100%;
    max-height: 85vh;
    overflow-y: auto;
    padding: var(--space-4);
    background: var(--color-bg);
    border-top-left-radius: var(--radius-md);
    border-top-right-radius: var(--radius-md);
}

.picker-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-4);
}

.picker-option {
    border: 2px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-surface);
}

/* The way into a fixture. Without this the only target was the club name,
   which is styled as a heading and doesn't read as tappable. */
.fixture-open {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    flex-shrink: 0;
    align-self: stretch;
    padding: 0 var(--space-2) 0 var(--space-3);
    border-left: 1px solid var(--color-border);
    color: var(--color-link);
    text-decoration: none;
    font-size: var(--text-sm);
    font-weight: bold;
    white-space: nowrap;
}

.fixture-open:hover {
    background: var(--color-bg);
}

.fixture-open-chevron {
    font-size: var(--text-xl);
    line-height: 1;
}

@media (max-width: 520px) {
    .fixture-open-label {
        display: none;
    }
}

.try-edit {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-height: 48px;
    padding: var(--space-2) 0;
    border: none;
    background: none;
    font-family: inherit;
    font-size: var(--text-base);
    color: var(--color-text);
    text-align: left;
    cursor: pointer;
}

.try-edit-hint {
    font-size: var(--text-sm);
    color: var(--color-link);
}

.form-actions--split {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-3);
}

.form-actions--split .btn {
    flex: 1 1 auto;
}

/* ===== Opposition teams ===== */
.opposition-list {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
}

.opposition-chip {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    min-height: 40px;
    padding: 0 var(--space-2) 0 var(--space-4);
    border: 1px solid var(--color-border);
    border-radius: 999px;
    background: var(--color-bg);
    font-weight: bold;
    font-size: var(--text-sm);
}

.opposition-chip form {
    margin: 0;
}

.opposition-chip button {
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 50%;
    background: none;
    color: var(--color-text-muted);
    font-size: var(--text-lg);
    line-height: 1;
    cursor: pointer;
}

.opposition-chip button:hover {
    background: var(--color-error-bg);
    color: var(--color-error-text);
}

/* ===== Opposition strength ===== */
.strength-row {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: var(--space-2);
    margin-bottom: var(--space-4);
}

.strength-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-1);
    min-height: 64px;
    padding: var(--space-2) var(--space-1);
    border: 2px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-surface);
    font-family: inherit;
    color: var(--color-text-muted);
    cursor: pointer;
}

.strength-btn.is-on {
    border-color: var(--color-heading);
    background: var(--color-bg);
    color: var(--color-heading);
}

.strength-num {
    font-size: var(--text-lg);
    font-weight: bold;
}

.strength-label {
    font-size: 0.6875rem;
    text-align: center;
    line-height: 1.1;
}
