/* My Swimlynx — "pool deck" look. Phone first; a sidebar replaces the tab bar on wide screens. */

:root {
    --ground: #F4F7FA;
    --surface: #FFFFFF;
    --panel: #F4F7FA;
    --ink: #0E2233;
    --muted: #4A5D70;
    --faint: #8494A5;
    --line: #E1E8EF;
    --line-soft: #EEF2F6;
    --line-strong: #D5DEE7;
    --blue: #1B75BB;
    --blue-dark: #125A91;
    --blue-wash: #EAF2FA;
    --amber: #F2B33D;
    --amber-ink: #3A2600;
    --amber-wash: #FFF6E3;
    --amber-line: #F2D49A;
    --amber-text: #6B4300;
    --due: #9A5B00;
    --green: #136C3A;
    --green-wash: #DFF3E7;
    --red: #8C1D17;
    --red-wash: #F9DEDC;
    --navy-text: #B8C7D6;

    --heading: 'Sora', system-ui, sans-serif;
    --body: 'IBM Plex Sans', system-ui, sans-serif;
    --mono: 'IBM Plex Mono', ui-monospace, monospace;

    --radius: 20px;
    --radius-small: 12px;
    --tabbar: 64px;
}

*, *::before, *::after { box-sizing: border-box; }

[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    background: var(--ground);
    color: var(--ink);
    font: 400 16px/1.45 var(--body);
}

/* Fill the screen on short pages, or some phone browsers float the bottom tabs up under the content. */
body.app {
    min-height: 100vh;
    min-height: 100dvh;
}

a { color: var(--blue); }
a:hover { color: var(--blue-dark); }

h1, h2, h3 { font-family: var(--heading); font-weight: 600; margin: 0; letter-spacing: -0.01em; }
h1 { font-size: 26px; }
h2 { font-size: 17px; }

:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }

.muted { color: var(--muted); }
.small { font-size: 13px; }

.eyebrow {
    font-size: 12px;
    font-weight: 500;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.wordmark {
    font-family: var(--heading);
    font-weight: 700;
    font-size: 20px;
    letter-spacing: -0.01em;
    color: var(--ink);
    text-decoration: none;
}
.wordmark span { color: var(--blue); }
.wordmark.large { font-size: 34px; }

/* ---------- Layout ---------- */

.page {
    max-width: 760px;
    margin: 0 auto;
    padding: 14px 16px calc(var(--tabbar) + 28px + env(safe-area-inset-bottom));
    display: flex;
    flex-direction: column;
    gap: 14px;
}

/* The hero holds each page's heading. On phones it's plain; on desktop it becomes the navy pool band. */
.hero-inner {
    max-width: 760px;
    margin: 0 auto;
    padding: calc(16px + env(safe-area-inset-top)) 16px 0;
}


.page-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 12px;
    padding: 4px 4px 2px;
}
.page-head h1 { margin-top: 10px; }
.page-head p { margin: 2px 0 0; font-size: 14px; }

.head-actions { display: flex; gap: 8px; }

.tabs {
    position: fixed;
    inset: auto 0 0 0;
    z-index: 10;
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(0, 1fr);
    background: var(--surface);
    border-top: 1px solid var(--line);
    padding: 6px 8px calc(8px + env(safe-area-inset-bottom));
}
.tabs a {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    min-height: 48px;
    justify-content: center;
    color: var(--muted);
    text-decoration: none;
    font-size: 12px;
    font-weight: 500;
}
.tabs a[aria-current="page"] { color: var(--blue); font-weight: 600; }

.desktop-only { display: none; }

.glances { grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 14px; }
.glance {
    background: var(--surface);
    border: 1px solid var(--line);
    border-left: 4px solid var(--line-strong);
    border-radius: 16px;
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}
.glance-label { font-size: 12px; font-weight: 500; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
.glance strong { font-family: var(--heading); font-weight: 700; font-size: 22px; letter-spacing: -0.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.glance-note { font-size: 13px; color: var(--muted); }
.glance.due { border-left-color: var(--amber); }
.glance.due .glance-note { color: var(--due); font-weight: 600; }
.glance.good { border-left-color: #2E9E5B; }

/* ---------- Pieces ---------- */

.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 16px;
}

.swimmers { display: flex; flex-direction: column; gap: 14px; }

.swimmer { display: flex; flex-direction: column; gap: 12px; }

.swimmer-head { display: flex; align-items: center; gap: 12px; }
.swimmer-name { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.swimmer-name .muted { font-size: 13px; }

.avatar {
    width: 44px;
    height: 44px;
    flex: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--heading);
    font-weight: 600;
    font-size: 15px;
    color: #FFFFFF;
    background: var(--blue);
}
.avatar.navy { background: var(--ink); }
.avatar.small { width: 32px; height: 32px; font-size: 12px; background: #24384B; }

.panel {
    background: var(--panel);
    border-radius: 14px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.panel p { margin: 0; font-size: 14px; }
.panel strong { font-size: 15px; font-weight: 600; }
.panel .muted svg { vertical-align: -3px; }
.panel.live { background: var(--blue-wash); }
.panel.live .eyebrow { color: var(--blue-dark); }

.panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.due { color: var(--due); font-weight: 600; }

.chips { list-style: none; margin: 2px 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
    font-size: 13px;
    background: var(--surface);
    border: 1px solid var(--line-strong);
    border-radius: 999px;
    padding: 4px 10px;
    white-space: nowrap;
}
.chip.empty { color: var(--muted); border-style: dashed; }
.chip.amber { background: var(--amber-wash); border-color: var(--amber-line); color: var(--amber-text); font-weight: 600; font-size: 12px; }

.results-block { display: flex; flex-direction: column; gap: 4px; }

.results { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.results li { display: flex; align-items: center; gap: 10px; min-height: 32px; border-top: 1px solid var(--line-soft); }
.results li:first-child { border-top: none; }
.result-event { flex: 1; font-size: 14px; }
.time { font-family: var(--mono); font-weight: 600; font-size: 15px; font-variant-numeric: tabular-nums; }
.time.pending { font-family: var(--body); font-weight: 400; font-size: 13px; color: var(--faint); }

.flag { font-size: 11px; font-weight: 600; border-radius: 6px; padding: 2px 6px; }
.flag.pb { background: var(--amber); color: var(--amber-ink); }
.flag.pr { background: var(--blue); color: #FFFFFF; }
.flag.dq { background: var(--red-wash); color: var(--red); }

.notice {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--amber-wash);
    border: 1px solid var(--amber-line);
    border-radius: 14px;
    padding: 10px 12px;
    color: var(--amber-text);
    text-decoration: none;
    font-size: 14px;
}
.notice span { flex: 1; }
.notice:hover { color: var(--amber-text); border-color: var(--amber); }

.fee {
    background: var(--ink);
    color: #FFFFFF;
    border-radius: var(--radius);
    padding: 14px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}
.fee > div { display: flex; flex-direction: column; gap: 2px; }
.fee .eyebrow { color: var(--navy-text); }
.fee strong { font-weight: 500; font-size: 15px; }
.fee-why { font-size: 13px; color: var(--navy-text); }

.empty { display: flex; flex-direction: column; gap: 10px; }
.empty p { margin: 0; }
.empty-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.empty-actions form { margin: 0; }

.account { display: flex; flex-direction: column; gap: 14px; }
.account p { margin: 0; }

/* ---------- Buttons ---------- */

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 44px;
    padding: 0 16px;
    border-radius: var(--radius-small);
    border: 1px solid transparent;
    font: 600 15px var(--body);
    text-decoration: none;
    cursor: pointer;
    white-space: nowrap;
}
.button.primary { background: var(--blue); color: #FFFFFF; }
.button.primary:hover { background: var(--blue-dark); color: #FFFFFF; }
.button.light { background: #FFFFFF; color: var(--ink); }
.button.light:hover { background: var(--blue-wash); color: var(--ink); }
.button.ghost { background: var(--surface); color: var(--ink); border-color: var(--line-strong); font-weight: 500; }
.button.ghost:hover { border-color: var(--blue); color: var(--ink); }
.button.wide { width: 100%; }

.page-head .button.ghost span { display: none; }
.page-head .button.ghost { width: 44px; padding: 0; border-radius: 50%; }
@media (min-width: 900px) {
    .page-head .button.ghost span { display: inline; }
    .page-head .button.ghost { width: auto; padding: 0 16px; border-radius: var(--radius-small); }
}

.icon-button {
    width: 44px;
    height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    color: var(--muted);
    border-radius: 10px;
    cursor: pointer;
}
.icon-button[aria-pressed="true"] { color: var(--blue); }

/* ---------- Forms ---------- */

.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 14px; font-weight: 500; }
.field-label-row { display: flex; justify-content: space-between; align-items: baseline; font-size: 14px; }
.field input:not([type="radio"]):not([type="checkbox"]) {
    min-height: 48px;
    width: 100%;
    padding: 0 14px;
    border-radius: var(--radius-small);
    border: 1px solid #C9D4DF;
    background: var(--surface);
    font: 400 16px var(--body);
    color: var(--ink);
}
.field input:not([type="radio"]):not([type="checkbox"]):focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(27, 117, 187, 0.18); }
.field input.input-validation-error { border-color: var(--red); }
.field-error { font-size: 13px; color: var(--red); }
.field-error:empty { display: none; }

.password { position: relative; }
.password input { padding-right: 52px; }
.password .icon-button { position: absolute; right: 2px; top: 2px; }

.check { display: flex; align-items: center; gap: 10px; font-size: 14px; min-height: 44px; cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--blue); }

.alert {
    margin: 0;
    background: var(--red-wash);
    color: var(--red);
    border-radius: var(--radius-small);
    padding: 10px 12px;
    font-size: 14px;
}

/* ---------- Sign in ---------- */

.bare .page { padding-bottom: 32px; }

.signin {
    min-height: calc(100vh - 64px);
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 24px;
    max-width: 420px;
    width: 100%;
    margin: 0 auto;
}
.signin-brand { text-align: center; display: flex; flex-direction: column; gap: 6px; }
.signin-brand p { margin: 0; color: var(--muted); font-size: 15px; }
.signin-card { display: flex; flex-direction: column; gap: 16px; padding: 22px 20px; }
.signin-card h1 { font-size: 22px; }
.signin-card p { margin: 0; }
.signin-foot { text-align: center; font-size: 14px; color: var(--muted); }

/* ---------- Desktop: the pool band ---------- */

@media (min-width: 900px) {
    .tabs, .phone-only { display: none; }
    span.desktop-only { display: inline; }
    .glances.desktop-only { display: grid; }

    .hero {
        position: relative;
        color: #FFFFFF;
        padding-bottom: 84px;
        background-color: var(--ink);
        background-image:
            repeating-linear-gradient(90deg, transparent 0 176px, rgba(255, 255, 255, 0.045) 176px 180px),
            linear-gradient(180deg, rgba(27, 117, 187, 0.38), rgba(14, 34, 51, 0) 75%);
    }
    /* The lane rope along the bottom of the band. */
    .hero::after {
        content: "";
        position: absolute;
        left: 0;
        right: 0;
        bottom: 0;
        height: 6px;
        background: repeating-linear-gradient(90deg, var(--blue) 0 22px, #FFFFFF 22px 26px, var(--amber) 26px 48px, #FFFFFF 48px 52px);
        opacity: 0.9;
    }
    .hero-inner { max-width: 1280px; padding: 0 40px; }

    .topbar { display: flex; align-items: center; gap: 28px; height: 76px; }
    .topbar .wordmark { color: #FFFFFF; font-size: 22px; }
    .topbar .wordmark span { color: #5FB0EE; }
    .topnav { flex: 1; display: flex; gap: 4px; }
    .topnav a {
        padding: 8px 16px;
        border-radius: 999px;
        color: #DCE6EF;
        text-decoration: none;
        font-size: 15px;
        font-weight: 500;
    }
    .topnav a:hover { background: rgba(255, 255, 255, 0.1); color: #FFFFFF; }
    .topnav a[aria-current="page"] { background: #FFFFFF; color: var(--ink); }
    .me {
        display: flex;
        align-items: center;
        gap: 10px;
        padding: 4px 4px 4px 14px;
        border-radius: 999px;
        color: #DCE6EF;
        text-decoration: none;
        font-size: 14px;
    }
    .me:hover, .me[aria-current="page"] { background: rgba(255, 255, 255, 0.1); color: #FFFFFF; }
    .me .avatar { width: 36px; height: 36px; font-size: 13px; background: var(--blue); }

    .hero .page-head { padding: 34px 0 0; }
    .hero .page-head h1 { font-size: 40px; letter-spacing: -0.02em; margin-top: 0; color: #FFFFFF; }
    .hero .page-head p { font-size: 15px; color: var(--navy-text); }
    .hero .button.ghost,
    .hero .page-head .button.ghost {
        width: auto;
        padding: 0 16px;
        border-radius: var(--radius-small);
        background: transparent;
        color: #FFFFFF;
        border-color: rgba(255, 255, 255, 0.32);
    }
    .hero .page-head .button.ghost span { display: inline; }
    .hero .button.ghost:hover { border-color: #FFFFFF; color: #FFFFFF; }
    .hero .button.strong { background: #FFFFFF; color: var(--ink); border-color: #FFFFFF; font-weight: 600; }
    .hero .button.strong:hover { background: var(--blue-wash); color: var(--ink); }

    .page { position: relative; max-width: 1280px; padding: 0 40px 56px; margin: -52px auto 0; gap: 20px; }

    .glance {
        border: none;
        border-top: 4px solid var(--line-strong);
        border-radius: 18px;
        padding: 16px 18px;
        box-shadow: 0 10px 30px rgba(14, 34, 51, 0.12);
    }
    .glance strong { font-size: 24px; }
    .glance.due { border-top-color: var(--amber); }
    .glance.good { border-top-color: #2E9E5B; }

    /* Cards in a row share one height; the column count follows the family size so rows split evenly. */
    .page .swimmers { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 20px; align-items: stretch; }
    .page .swimmers[data-count="2"], .page .swimmers[data-count="4"] { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .page .swimmer { padding: 20px; gap: 14px; }
    .swimmer .avatar { width: 52px; height: 52px; font-size: 17px; }
    .swimmer h2 { font-size: 19px; }
    .fee { padding: 18px 22px; }
    .fee strong { font-size: 17px; }

    .bare .page { margin-top: 0; padding-top: 32px; }
}

/* ---------- Payments ---------- */

.banner {
    margin: 0;
    padding: 12px 16px;
    border-radius: 14px;
    background: var(--amber-wash);
    border: 1px solid var(--amber-line);
    color: var(--amber-text);
    font-size: 15px;
    font-weight: 500;
}
.banner.good { background: var(--green-wash); border-color: #A9DDBD; color: var(--green); }

.chip.good { background: var(--green-wash); border-color: #A9DDBD; color: var(--green); font-weight: 600; font-size: 12px; }

.pay-grid { display: flex; flex-direction: column; gap: 14px; }
.pay-card { display: flex; flex-direction: column; gap: 14px; }
.pay-card form { margin: 0; }
.pay-card p { margin: 0; }
.pay-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.pay-head h2 { margin-top: 2px; }
.pay-amount { font-family: var(--heading); font-weight: 700; font-size: 26px; letter-spacing: -0.01em; }
.pay-swimmers { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.pay-swimmers li { display: flex; align-items: center; justify-content: space-between; min-height: 40px; border-top: 1px solid var(--line-soft); font-size: 15px; }

.pay-history { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-direction: column; }
.pay-history li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line-soft); }
.pay-history li > div { display: flex; flex-direction: column; }
.pay-history strong { font-weight: 600; font-size: 15px; }

@media (min-width: 900px) {
    .page .pay-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(380px, 1fr)); gap: 20px; align-items: start; }
    .page .pay-card { padding: 22px; }
}
/* ---------- Nominations & carnivals ---------- */

.back {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    /* A finger-sized target (44px tall, padded sideways); the negative margins keep it where it was on screen. */
    margin: 0 0 -4px -12px;
    padding: 0 16px 0 8px;
    min-height: 44px;
    color: var(--blue);
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
}

.banner { display: flex; align-items: center; gap: 10px; }
.banner.closed { background: var(--line-soft); border-color: var(--line-strong); color: var(--muted); }

.warn { color: var(--amber-text); }

.event-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.event {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 16px;
    overflow: hidden;
}
.event:has(.event-main input:checked) { border-color: var(--blue); box-shadow: 0 0 0 1px var(--blue) inset; }
.event.locked { opacity: 0.75; }
.event-main {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 12px 12px 16px;
    min-height: 64px;
    cursor: pointer;
}
.event.locked .event-main { cursor: default; }
.event-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.event-text strong { font-weight: 600; font-size: 15px; }
.lock { color: var(--faint); display: flex; padding: 0 6px; }
.event-assist {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 12px 10px 16px;
    border-top: 1px dashed var(--line);
    font-size: 14px;
    color: var(--muted);
    cursor: pointer;
}

/* Toggle switch built from a real checkbox, so it works with no script and with a keyboard. */
.switch {
    appearance: none;
    -webkit-appearance: none;
    flex: none;
    position: relative;
    width: 52px;
    height: 32px;
    margin: 0;
    border-radius: 16px;
    background: #C9D4DF;
    cursor: pointer;
    transition: background 0.15s ease;
}
.switch::before {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: #FFFFFF;
    box-shadow: 0 1px 3px rgba(14, 34, 51, 0.3);
    transition: transform 0.15s ease;
}
.switch:checked { background: var(--blue); }
.switch:checked::before { transform: translateX(20px); }
.switch:disabled { opacity: 0.5; cursor: default; }
.switch.small { width: 44px; height: 26px; }
.switch.small::before { width: 20px; height: 20px; }
.switch.small:checked::before { transform: translateX(18px); }
@media (prefers-reduced-motion: reduce) { .switch, .switch::before { transition: none; } }

.save-bar {
    position: sticky;
    bottom: calc(var(--tabbar) + 14px + env(safe-area-inset-bottom));
    margin-top: 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 10px 10px 16px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 16px;
    box-shadow: 0 8px 24px rgba(14, 34, 51, 0.12);
}
.save-bar .button { min-width: 120px; }

.nominate { display: flex; flex-direction: column; }

.button.small { min-height: 38px; padding: 0 14px; font-size: 14px; }

.selections { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.selections li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line-soft); flex-wrap: wrap; }
.selection-actions { display: flex; gap: 8px; align-items: center; }
.selection-actions form { margin: 0; }

@media (min-width: 900px) {
    .hero .back { color: #9FD0F5; }
    .page .event-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; align-items: start; }
    .save-bar { bottom: 20px; }
}
/* ---------- Swimmers & stats ---------- */

.icon-link {
    width: 44px;
    height: 44px;
    flex: none;
    border-radius: 12px;
    background: var(--blue-wash);
    color: var(--blue);
    display: flex;
    align-items: center;
    justify-content: center;
}
.icon-link:hover { background: #D6E7F6; }

.swimmer-link {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: var(--ink);
}
.swimmer-link:hover { border-color: var(--blue); color: var(--ink); }
.swimmer-link strong { font-family: var(--heading); font-weight: 600; font-size: 17px; }
.swimmer-link svg { color: var(--faint); }

.chip-row {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 2px 2px 4px;
    margin: 0 -2px;
    scrollbar-width: none;
}
.chip-row::-webkit-scrollbar { display: none; }
.pill {
    flex: none;
    display: inline-flex;
    align-items: center;
    min-height: 40px;
    padding: 0 14px;
    border-radius: 999px;
    border: 1px solid var(--line-strong);
    background: var(--surface);
    color: var(--ink);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
}
.pill:hover { border-color: var(--blue); color: var(--ink); }
.pill[aria-current="page"] { background: var(--blue); border-color: var(--blue); color: #FFFFFF; }
.pill.dark[aria-current="page"] { background: var(--ink); border-color: var(--ink); }

.stats-tiles { display: grid; grid-auto-flow: row; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.stats-tiles .glance strong { font-size: 20px; }

.stats-grid { display: flex; flex-direction: column; gap: 14px; }
.side-stack { display: flex; flex-direction: column; gap: 14px; }

.focus { display: flex; flex-direction: column; gap: 14px; }
.focus-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.focus-head > div { display: flex; flex-direction: column; gap: 2px; }
.big-time { font-family: var(--mono); font-weight: 600; font-size: 38px; letter-spacing: -0.02em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.change { font-size: 13px; font-weight: 600; border-radius: 999px; padding: 4px 10px; background: var(--line-soft); color: var(--muted); }
.change.good { background: var(--green-wash); color: var(--green); }

.chart { position: relative; margin: 0; padding: 0 0 4px 0; }
.chart svg { display: block; width: 100%; height: 180px; overflow: visible; }
.chart .grid { stroke: var(--line-soft); stroke-width: 1; vector-effect: non-scaling-stroke; }
.chart .line { fill: none; stroke: var(--blue); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.chart-dots { position: absolute; inset: 0 0 auto 0; height: 180px; pointer-events: none; }
.chart-dots span {
    position: absolute;
    width: 12px;
    height: 12px;
    margin: -6px 0 0 -6px;
    border-radius: 50%;
    background: var(--amber);
    border: 2px solid #FFFFFF;
    box-shadow: 0 1px 2px rgba(14, 34, 51, 0.25);
}
.chart figcaption { display: flex; justify-content: space-between; align-items: center; font-size: 12px; color: var(--muted); margin-top: 6px; }
.chart .legend { display: inline-flex; align-items: center; gap: 6px; }
.chart .legend i { width: 10px; height: 10px; border-radius: 50%; background: var(--amber); display: inline-block; }
.chart-scale { position: absolute; top: -2px; right: 0; height: 180px; display: flex; flex-direction: column; justify-content: space-between; font-family: var(--mono); font-size: 11px; color: var(--faint); pointer-events: none; }

.rank {
    margin: 0;
    padding: 10px 12px;
    border-radius: 12px;
    background: var(--blue-wash);
    color: var(--blue-dark);
    font-size: 14px;
    font-weight: 500;
}

.bests a.result-event { color: var(--ink); text-decoration: none; }
.bests a.result-event:hover { color: var(--blue); text-decoration: underline; }
.bests .muted { white-space: nowrap; }

.season-meets { display: flex; flex-direction: column; gap: 16px; margin-top: 10px; }
.season-meet { display: flex; flex-direction: column; gap: 2px; }

@media (min-width: 900px) {
    .page .stats-tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
    .page .stats-tiles .glance strong { font-size: 24px; }
    .page .stats-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 20px; align-items: start; }
    .page .focus { padding: 22px; }
    .big-time { font-size: 46px; }
    .chart svg, .chart-dots, .chart-scale { height: 220px; }
    .page .season-meets { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 20px 28px; }
    .hero .chip-row .pill { border-color: rgba(255, 255, 255, 0.3); }
}
.js .no-js-only { display: none; }

.season-picker { display: flex; align-items: center; gap: 10px; margin: 0; }
/* Label kept for screen readers only — the dropdown speaks for itself. */
.season-picker label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.season-picker select {
    min-height: 40px;
    padding: 0 36px 0 14px;
    border-radius: 999px;
    border: 1px solid var(--line-strong);
    background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%230E2233' stroke-width='2.5' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") no-repeat right 14px center;
    appearance: none;
    -webkit-appearance: none;
    font: 600 14px var(--body);
    color: var(--ink);
    cursor: pointer;
}

details.more { margin-top: 10px; }
details.more summary {
    display: inline-flex;
    align-items: center;
    min-height: 40px;
    color: var(--blue);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    list-style: none;
}
details.more summary::-webkit-details-marker { display: none; }
details.more summary::after { content: "›"; margin-left: 6px; transition: transform 0.15s; }
details.more[open] summary::after { transform: rotate(90deg); }
details.more[open] summary { margin-bottom: 6px; }
/* ---------- Swimmer overview ---------- */

.card-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 10px 16px; flex-wrap: wrap; margin-bottom: 8px; }
.card-head h2 { margin-top: 2px; }
.cohort { max-width: 320px; }
.footnote { margin: 10px 0 0; }

.last-list, .standing-list, .link-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.last-list li, .standing-list li, .link-list li { border-top: 1px solid var(--line-soft); }
.last-list li:first-child, .standing-list li:first-child, .link-list li:first-child { border-top: none; }
.last-list a, .standing-list a, .link-list a, .link-list .row {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 56px;
    padding: 8px 0;
    color: var(--ink);
    text-decoration: none;
}
.last-list a:hover strong, .standing-list a:hover strong, .link-list a:hover strong { color: var(--blue); }
.link-list svg, .drill svg { color: var(--faint); flex: none; }

.last-event, .standing-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.last-event strong, .standing-text strong { font-weight: 600; font-size: 15px; }
.last-place { font-size: 13px; color: var(--muted); min-width: 34px; text-align: right; }
.change-text { color: var(--muted); }
.change-text.good { color: var(--green); font-weight: 600; }
.change-text.bad { color: var(--red); font-weight: 600; }

.place {
    width: 52px;
    height: 52px;
    flex: none;
    border-radius: 14px;
    background: var(--line-soft);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    line-height: 1.1;
}
.place strong { font-family: var(--heading); font-weight: 700; font-size: 17px; }
.place small { font-size: 11px; color: var(--muted); }
.place.gold { background: var(--amber); }
.place.gold small { color: var(--amber-ink); }
.place.podium { background: var(--blue-wash); }
.place.podium strong { color: var(--blue-dark); }

.drill { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
.drill a { display: flex; align-items: center; gap: 14px; text-decoration: none; color: var(--ink); padding: 14px 16px; }
.drill a:hover { border-color: var(--blue); color: var(--ink); }
.drill-count { font-family: var(--heading); font-weight: 700; font-size: 26px; min-width: 44px; color: var(--blue); }
.drill-text { flex: 1; display: flex; flex-direction: column; }
.drill-text strong { font-weight: 600; font-size: 15px; }

.meet-cards { display: flex; flex-direction: column; gap: 14px; }
.meet-cards .card { display: flex; flex-direction: column; gap: 4px; }

@media (min-width: 900px) {
    .hero .season-picker select { border-color: #FFFFFF; }
    .page .drill { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
    .page .standing-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 40px; }
    .page .standing-list li:nth-child(2) { border-top: none; }
    .page .meet-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 20px; align-items: start; }
    .page .last-meet, .page .standings { padding: 22px; }
}
/* ---------- Results table (one table, a header row per meet) ---------- */

.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.table-card { padding: 0; overflow: hidden; }
.results-table { width: 100%; border-collapse: collapse; font-size: 15px; }
.results-table thead th {
    text-align: left;
    padding: 12px 8px;
    font-size: 12px;
    font-weight: 600;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.results-table th:first-child, .results-table td:first-child { padding-left: 16px; }
.results-table th:last-child, .results-table td:last-child { padding-right: 16px; }
.results-table td { padding: 10px 8px; border-top: 1px solid var(--line-soft); vertical-align: middle; }
.results-table td a { color: var(--ink); text-decoration: none; font-weight: 500; }
.results-table td a:hover { color: var(--blue); text-decoration: underline; }
.results-table .meet-row th {
    text-align: left;
    padding: 12px 16px;
    background: var(--panel);
    border-top: 1px solid var(--line-strong);
    font-weight: 400;
    font-size: 13px;
}
.meet-name { font-family: var(--heading); font-weight: 600; font-size: 15px; color: var(--ink); margin-right: 8px; }
.col-place { width: 64px; }
.col-num { width: 64px; text-align: center; color: var(--muted); font-family: var(--mono); }
.results-table thead .col-num { text-align: center; }
.col-time { width: 104px; text-align: right; }
.results-table thead .col-time { text-align: right; }
.col-flag { width: 48px; text-align: right; }
.place-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 38px;
    height: 28px;
    padding: 0 6px;
    border-radius: 8px;
    background: var(--line-soft);
    font-weight: 600;
    font-size: 13px;
}
.place-num.won { background: var(--amber); color: var(--amber-ink); }

.wide-only { display: none; }
@media (min-width: 700px) {
    .wide-only { display: table-cell; }
}
.table-title { padding: 16px 16px 4px; }
.table-more { margin: 0; padding: 0 16px 12px; }
.table-more[open] { padding: 0 0 12px; }
.table-more[open] summary { padding-left: 16px; }
.col-diff { width: 96px; text-align: right; }
.results-table thead .col-diff { text-align: right; }
.diff { font-family: var(--mono); font-size: 14px; color: var(--muted); white-space: nowrap; }
.diff.good { color: var(--green); font-weight: 600; }
.diff.bad { color: var(--red); font-family: var(--body); font-weight: 600; font-size: 13px; }
/* Phone-friendly tables and headings */
.col-date { white-space: nowrap; }
.col-diff { white-space: nowrap; }
.col-diff .flag { margin-left: 6px; }
.swim-history .col-diff { width: auto; }
.fold-button {
    display: block;
    width: 100%;
    min-height: 48px;
    border: none;
    border-top: 1px solid var(--line-soft);
    background: transparent;
    color: var(--blue);
    font: 600 14px var(--body);
    cursor: pointer;
}
.fold-button:hover { background: var(--blue-wash); }

.page-head { flex-wrap: wrap; }
.page-head > div:first-child { flex: 1 1 220px; min-width: 0; }

@media (max-width: 599px) {
    .results-table { font-size: 14px; }
    .results-table th, .results-table td { padding-left: 6px; padding-right: 6px; }
    .results-table th:first-child, .results-table td:first-child { padding-left: 14px; }
    .results-table th:last-child, .results-table td:last-child { padding-right: 14px; }
    .results-table .time { font-size: 14px; }
    .col-place { width: 48px; }
    .col-time { width: auto; }
    .place-num { min-width: 34px; height: 26px; font-size: 12px; }
    .season-picker { width: 100%; }
    .season-picker select { flex: 1; }
    .big-time { font-size: 34px; }
}

.name-link { color: inherit; text-decoration: none; }
.name-link:hover { color: var(--blue); text-decoration: underline; }

/* ---------- Forms, filters, documents ---------- */

.form-grid { display: flex; flex-direction: column; gap: 14px; }
.form-card { display: flex; flex-direction: column; gap: 14px; }
.form-card h2 { margin-top: 4px; }
.form-card form { margin: 0; }
.form-card.narrow { max-width: 640px; width: 100%; }
.field-row { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; }
@media (min-width: 600px) { .field-row { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
fieldset.field { border: none; margin: 0; padding: 0; min-width: 0; }
fieldset.field legend { font-size: 14px; font-weight: 500; margin-bottom: 6px; padding: 0; }
.field select, .field textarea, .filter select {
    min-height: 48px;
    width: 100%;
    padding: 0 14px;
    border-radius: var(--radius-small);
    border: 1px solid #C9D4DF;
    background: var(--surface);
    font: 400 16px var(--body);
    color: var(--ink);
}
.field textarea { padding: 10px 14px; min-height: 90px; resize: vertical; }
.field input[type="date"] { appearance: none; -webkit-appearance: none; }
.check span { line-height: 1.4; }
.check { align-items: flex-start; padding: 8px 0; }
.check input { margin-top: 1px; flex: none; }
.center { text-align: center; margin: 0; }

.segmented { display: inline-flex; border: 1px solid #C9D4DF; border-radius: 12px; overflow: hidden; background: var(--surface); }
.segmented label { position: relative; }
.segmented input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.segmented span { display: inline-flex; align-items: center; min-height: 46px; padding: 0 18px; font-size: 15px; font-weight: 500; }
.segmented input:checked + span { background: var(--ink); color: #FFFFFF; }
.segmented input:focus-visible + span { outline: 3px solid var(--blue); outline-offset: -3px; }
fieldset.segmented { padding: 0; margin: 0; }

.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; margin: 0; }
.filter { display: flex; flex-direction: column; gap: 4px; flex: 1 1 200px; font-size: 13px; color: var(--muted); font-weight: 500; }
.table-empty { padding: 0 16px 16px; margin: 0; }

.file-kind { position: relative; display: flex; flex-direction: column; align-items: center; color: var(--blue); width: 40px; flex: none; }
.file-kind small { font-size: 10px; font-weight: 700; letter-spacing: 0.04em; color: var(--muted); }

.quiet-action { margin: 0; text-align: right; }
.link-button { border: none; background: none; padding: 6px 0; color: var(--muted); font: 500 13px var(--body); text-decoration: underline; cursor: pointer; }
.link-button:hover { color: var(--red); }

.terms { max-width: 760px; margin: 0 auto; line-height: 1.6; }
.terms h1 { margin-bottom: 12px; }

@media (min-width: 900px) {
    .page .form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; align-items: start; }
    .page .form-card { padding: 22px; }
}
/* ---------- Phones: the same navy pool band as desktop, more compact ---------- */

@media (max-width: 899px) {
    .app .hero {
        position: relative;
        color: #FFFFFF;
        padding-bottom: 44px;
        background-color: var(--ink);
        background-image:
            repeating-linear-gradient(90deg, transparent 0 88px, rgba(255, 255, 255, 0.045) 88px 90px),
            linear-gradient(180deg, rgba(27, 117, 187, 0.4), rgba(14, 34, 51, 0) 80%);
    }
    .app .hero::after {
        content: "";
        position: absolute;
        left: 0;
        right: 0;
        bottom: 0;
        height: 5px;
        background: repeating-linear-gradient(90deg, var(--blue) 0 18px, #FFFFFF 18px 21px, var(--amber) 21px 39px, #FFFFFF 39px 42px);
        opacity: 0.9;
    }
    .app .hero-inner { padding-top: calc(10px + env(safe-area-inset-top)); }

    .topbar { display: flex; align-items: center; justify-content: space-between; height: 48px; }
    .topbar .wordmark { color: #FFFFFF; font-size: 20px; }
    .topbar .wordmark span { color: #5FB0EE; }
    .topnav { display: none; }
    .me { display: flex; align-items: center; text-decoration: none; border-radius: 50%; }
    .me > span:first-child { display: none; }
    .me .avatar { width: 36px; height: 36px; font-size: 13px; background: var(--blue); }

    .hero .page-head { padding: 6px 0 0; }
    .hero .page-head h1 { color: #FFFFFF; margin-top: 4px; }
    .hero .page-head p { color: var(--navy-text); }
    .hero .back { color: #9FD0F5; margin-top: 0; }
    .hero .season-picker select { border-color: #FFFFFF; }
    .hero .page-head .button.ghost { background: transparent; color: #FFFFFF; border-color: rgba(255, 255, 255, 0.35); }
    .hero .page-head .button.ghost.strong { background: #FFFFFF; color: var(--ink); border-color: #FFFFFF; }

    /* Cards rise over the bottom of the band. */
    .app .page { position: relative; margin-top: -26px; padding-top: 0; }
}
/* ---------- App prompts and offline ---------- */

.prompt { display: flex; align-items: flex-start; gap: 14px; flex-wrap: wrap; border-color: var(--blue); background: linear-gradient(180deg, var(--blue-wash), var(--surface)); }
.prompt-icon { width: 44px; height: 44px; border-radius: 12px; background: var(--blue); color: #FFFFFF; display: flex; align-items: center; justify-content: center; flex: none; }
.prompt-text { flex: 1 1 220px; display: flex; flex-direction: column; gap: 4px; }
.prompt-text p { margin: 0; }
.prompt-actions { display: flex; align-items: center; gap: 14px; margin-left: auto; }
.ios-steps { margin: 6px 0 0; padding-left: 20px; display: flex; flex-direction: column; gap: 4px; }
.ios-steps svg { vertical-align: -3px; color: var(--blue); }

.offline-banner {
    position: sticky;
    top: 0;
    z-index: 20;
    margin: 0;
    padding: 8px 16px calc(8px);
    padding-top: calc(8px + env(safe-area-inset-top));
    background: var(--amber);
    color: var(--amber-ink);
    font-size: 14px;
    font-weight: 600;
    text-align: center;
}
/* ---------- Choice buttons (girl/boy and similar): a big tap target with a visible selector ---------- */

.choices { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; border: none; margin: 0; padding: 0; min-width: 0; }
.choice {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 52px;
    padding: 0 14px;
    border: 1.5px solid #C9D4DF;
    border-radius: var(--radius-small);
    background: var(--surface);
    color: var(--ink);
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: border-color 0.12s ease, background 0.12s ease;
}
.choice:hover { border-color: var(--blue); }
.choice input {
    appearance: none;
    -webkit-appearance: none;
    flex: none;
    width: 22px;
    height: 22px;
    margin: 0;
    border: 2px solid #8494A5;
    border-radius: 50%;
    background: var(--surface);
    display: grid;
    place-content: center;
    cursor: pointer;
}
.choice input::before {
    content: "";
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--blue);
    transform: scale(0);
    transition: transform 0.12s ease;
}
.choice input:checked { border-color: var(--blue); }
.choice input:checked::before { transform: scale(1); }
.choice input:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }
.choice:has(input:checked) { border-color: var(--blue); background: var(--blue-wash); color: var(--blue-dark); font-weight: 600; }
.choices.compact .choice { min-height: 46px; }
@media (prefers-reduced-motion: reduce) { .choice, .choice input::before { transition: none; } }
.filters .choices { flex: 1 1 200px; }

@media (min-width: 1150px) {
    .page .swimmers[data-count="3"], .page .swimmers[data-count="6"] { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
/* Anything at the foot of a swimmer card (e.g. removing a registration) sits at the bottom. */
.swimmer .quiet-action { margin-top: auto; }
/* Clickable table rows */
.row-link { cursor: pointer; }
.row-link:hover td { background: var(--blue-wash); }
.row-link:hover td a { color: var(--blue); }
.col-go { width: 32px; text-align: right; color: var(--faint); }
.col-go svg { vertical-align: middle; }
.row-link:hover .col-go { color: var(--blue); }
/* Lists whose rows open another page: same hover as clickable table rows. The row widens slightly into the
   card's padding so the highlight has breathing room without moving the text. */
.last-list a, .standing-list a, .link-list a {
    margin: 0 -10px;
    padding-left: 10px;
    padding-right: 10px;
    border-radius: 10px;
    cursor: pointer;
    transition: background 0.12s ease;
}
.last-list a:hover, .standing-list a:hover, .link-list a:hover { background: var(--blue-wash); }
.last-list a:hover svg, .standing-list a:hover svg, .link-list a:hover svg { color: var(--blue); }
@media (prefers-reduced-motion: reduce) { .last-list a, .standing-list a, .link-list a { transition: none; } }