/* TKTG apps v2. Palette from the competition hall: floor-blue carpet, chalk, navy. Status colours always come with text. */
/* Fonts are self-hosted (P3): works offline and needs no third party. 750 falls back to 700. */
@font-face { font-family: "Archivo"; font-weight: 400; font-display: swap; src: url("fonts/archivo-latin-400-normal.9246d621d7f0.woff2") format("woff2"); }
@font-face { font-family: "Archivo"; font-weight: 500; font-display: swap; src: url("fonts/archivo-latin-500-normal.562c73adab45.woff2") format("woff2"); }
@font-face { font-family: "Archivo"; font-weight: 600; font-display: swap; src: url("fonts/archivo-latin-600-normal.7ab89eedd1b0.woff2") format("woff2"); }
@font-face { font-family: "Archivo"; font-weight: 700 800; font-display: swap; src: url("fonts/archivo-latin-700-normal.8574a5d7eebc.woff2") format("woff2"); }
@font-face { font-family: "Archivo Narrow"; font-weight: 700; font-display: swap; src: url("fonts/archivo-narrow-latin-700-normal.b1df10292e50.woff2") format("woff2"); }
@view-transition { navigation: auto; } /* P4: page changes cross-fade like an app */
@media (prefers-reduced-motion: reduce) { @view-transition { navigation: none; } }
@font-face {
  font-family: "teamgym12";
  src: url("fonts/teamgym12.2201bf1243df.woff2") format("woff2"), url("fonts/teamgym12.b29721b9f8b2.woff") format("woff");
  font-display: swap;
}

:root {
  --blue: #1e4fa3;
  --blue-ink: #163d80;
  --blue-wash: #e6edf8;
  --chalk: #f5f7fa;
  --surface: #ffffff;
  --ink: #14213d;
  --muted: #56617a;
  --line: #d9dee7;
  --green: #1f8a4c;
  --green-wash: #e3f3ea;
  --amber: #d99a00;
  --amber-wash: #fbf1d6;
  --red: #c0392b;
  --red-wash: #f8e4e1;
  --radius-s: 4px;
  --radius-m: 8px;
  --font: "Archivo", system-ui, sans-serif;
  --font-narrow: "Archivo Narrow", "Archivo", system-ui, sans-serif;
  --rail: 15rem;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --blue: #7aa5f0;
    --blue-ink: #a9c5f6;
    --blue-wash: #1b2b4d;
    --chalk: #0e1626;
    --surface: #16213a;
    --ink: #e7ecf4;
    --muted: #9ba7bd;
    --line: #2b3a5a;
    --green: #5cc98a;
    --green-wash: #143524;
    --amber: #f0c04a;
    --amber-wash: #3a2f10;
    --red: #f07a6c;
    --red-wash: #3d1c19;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font: 400 1rem/1.55 var(--font);
  color: var(--ink);
  background: var(--chalk);
  font-variant-numeric: tabular-nums;
}
a { color: var(--blue); text-underline-offset: 0.15em; }
a:hover { color: var(--blue-ink); }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; border-radius: 2px; }
img, svg { max-width: 100%; }
h1, h2, h3 { line-height: 1.15; margin: 0 0 0.5em; letter-spacing: -0.01em; }
h1 { font-size: clamp(1.75rem, 1.2rem + 2vw, 2.5rem); font-weight: 750; }
h2 { font-size: 1.375rem; font-weight: 700; margin-top: 2rem; }
h3 { font-size: 1.0625rem; font-weight: 700; }
p { margin: 0 0 1rem; max-width: 70ch; }
.muted { color: var(--muted); }
.small { font-size: 0.875rem; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 1rem; top: 1rem; z-index: 10; background: var(--surface); padding: 0.5rem 1rem; }

/* --- shell: left rail on desktop, bottom bar on mobile ------------------------------------- */
.shell { display: grid; grid-template-columns: var(--rail) 1fr; min-height: 100vh; }
.rail {
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  background: var(--ink); color: #dfe6f3; padding: 1.25rem 0.75rem;
  display: flex; flex-direction: column; gap: 1.5rem;
}
@media (prefers-color-scheme: dark) { .rail { background: #0a101d; border-right: 1px solid var(--line); } }
.brand { display: flex; align-items: center; gap: 0.6rem; color: #fff; text-decoration: none; font-weight: 750; padding: 0 0.5rem; }
.brand img { width: 36px; height: 36px; border-radius: 50%; background: #fff; }
.brand:hover { color: #fff; }
.nav-group h2 { font-size: 0.8125rem; font-weight: 600; color: #93a2bf; margin: 0 0 0.25rem; padding: 0 0.5rem; }
.nav-group ul { list-style: none; margin: 0; padding: 0; }
.nav-group a {
  display: flex; align-items: center; gap: 0.6rem; padding: 0.45rem 0.5rem; border-radius: var(--radius-s);
  color: #dfe6f3; text-decoration: none; font-size: 0.9375rem;
}
.nav-group a:hover { background: rgba(255, 255, 255, 0.08); color: #fff; }
.nav-group a[aria-current="page"] { background: var(--blue); color: #fff; font-weight: 600; }
.nav-group .icon { display: none; } /* icons only in the phone tab bar; the side menu has room for words */
.rail-foot { margin-top: auto; font-size: 0.875rem; display: grid; gap: 0.5rem; padding: 0 0.5rem; }
.rail-foot a { color: #b9c5dc; }
.rail-foot select { width: 100%; background: #22304f; color: #fff; border: 1px solid #3a4b70; }

.main { padding: 2rem clamp(1rem, 3vw, 3rem) 4rem; min-width: 0; max-width: 78rem; overflow-wrap: anywhere; } /* long URLs and emails break instead of widening the page */

@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  /* One row of tabs across both apps, always: every tab gets an equal share, icon over a short label. */
  .rail {
    position: fixed; inset: auto 0 0 0; height: auto; z-index: 5;
    display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 0;
    padding: 0.25rem env(safe-area-inset-right) calc(0.25rem + env(safe-area-inset-bottom)) env(safe-area-inset-left);
    border-top: 1px solid #2b3a5a;
  }
  .brand, .nav-group h2, .rail-foot, .nav-group li.secondary { display: none; } /* reports and lists live under "Mer i Trippel" on the home page */
  .nav-group, .nav-group ul { display: contents; }
  .nav-group li { display: flex; min-width: 0; }
  .nav-group a { flex: 1; min-width: 0; flex-direction: column; justify-content: center; gap: 0.15rem; padding: 0.4rem 0.1rem; font-size: 0.6875rem; line-height: 1.15; text-align: center; }
  .nav-group a span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .nav-group .icon { display: block; width: 22px; height: 22px; flex: none; }
  .main { padding-bottom: calc(5.5rem + env(safe-area-inset-bottom)); /* room for the tab bar */ padding-top: calc(1rem + env(safe-area-inset-top)); }
  .main .topbar { display: flex; }
}
.topbar { display: none; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1.25rem; }
.topbar .brand { display: flex; color: var(--ink); padding: 0; }
.topbar .brand { white-space: nowrap; }
.icon-btn { display: inline-grid; place-items: center; width: 2.75rem; height: 2.75rem; border-radius: 50%; color: var(--ink); border: 1px solid var(--line); background: var(--surface); }
.icon-btn:hover { color: var(--blue); border-color: var(--blue); }
.icon-btn .icon { width: 24px; height: 24px; }

/* --- page header ------------------------------------------------------------------------------ */
.page-head { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 1rem; margin-bottom: 1.5rem; }
.page-head h1 { margin: 0; }
.page-head p { margin: 0.35rem 0 0; color: var(--muted); }
.actions { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }

/* --- buttons ---------------------------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
  min-height: 2.5rem; padding: 0.5rem 1rem; border-radius: var(--radius-s);
  font: 600 0.9375rem/1.2 var(--font); text-decoration: none; cursor: pointer;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
}
.btn:hover { border-color: var(--blue); color: var(--blue); }
.btn-primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn-primary:hover { background: var(--blue-ink); color: #fff; }
@media (prefers-color-scheme: dark) { .btn-primary, .btn-primary:hover { color: #0e1626; } }
.btn-danger { background: var(--red); border-color: var(--red); color: #fff; }
.btn-danger:hover { color: #fff; filter: brightness(0.92); }
.btn-link { border: 0; background: none; padding: 0; min-height: 0; color: var(--blue); font-weight: 600; text-decoration: underline; }
.btn[disabled] { opacity: 0.45; cursor: not-allowed; }
.btn-big { min-height: 3.25rem; font-size: 1.0625rem; padding: 0.75rem 1.5rem; }
form.inline { display: inline; }

/* --- messages ----------------------------------------------------------------------------------- */
.messages { list-style: none; padding: 0; margin: 0 0 1.5rem; display: grid; gap: 0.5rem; }
.messages li { padding: 0.75rem 1rem; border-radius: var(--radius-s); background: var(--blue-wash); border-left: 4px solid var(--blue); }
.messages .success { background: var(--green-wash); border-color: var(--green); }
.messages .error, .messages .warning { background: var(--red-wash); border-color: var(--red); }

/* --- forms ------------------------------------------------------------------------------------- */
.form { display: grid; gap: 1.25rem; max-width: 36rem; }
.field label, .field legend { display: block; font-weight: 600; margin-bottom: 0.3rem; }
.field .help, .helptext { display: block; color: var(--muted); font-size: 0.875rem; margin-top: 0.3rem; }
.field .errorlist, .errorlist { color: var(--red); list-style: none; padding: 0; margin: 0.3rem 0 0; font-size: 0.9rem; font-weight: 600; }
.errorlist.nonfield { padding: 0.75rem 1rem; background: var(--red-wash); border-radius: var(--radius-s); }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=url], input[type=date],
input[type=datetime-local], input[type=search], input[type=tel], select, textarea {
  width: 100%; font: inherit; color: var(--ink); background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius-s); padding: 0.55rem 0.7rem; min-height: 2.5rem;
}
input:focus, select:focus, textarea:focus { border-color: var(--blue); outline: 2px solid var(--blue-wash); }
input[type=checkbox], input[type=radio] { width: 1.15rem; height: 1.15rem; accent-color: var(--blue); vertical-align: -0.2em; margin: 0 0.5rem 0 0; }
.field fieldset, fieldset.field { border: 0; padding: 0; margin: 0; }
.choices { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.choices label { font-weight: 500; display: flex; align-items: center; border: 1px solid var(--line); border-radius: var(--radius-s); padding: 0.55rem 0.8rem; background: var(--surface); cursor: pointer; }
.choices label:has(input:checked) { border-color: var(--blue); background: var(--blue-wash); }
.check { display: flex; align-items: flex-start; gap: 0.25rem; font-weight: 500 !important; }
.filters { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: end; margin-bottom: 1.25rem; }
.filters .field { min-width: 12rem; flex: 0 1 16rem; }
.filters label { font-size: 0.875rem; }

/* --- panels, tables -------------------------------------------------------------------------- */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m); padding: 1.25rem; }
.split { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 1.5rem; align-items: start; }
@media (max-width: 1100px) { .split { grid-template-columns: 1fr; } }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 0.35rem 1.25rem; margin: 0; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; font-weight: 600; }

.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m); }
table { width: 100%; border-collapse: collapse; font-size: 0.9375rem; }
th, td { text-align: left; padding: 0.65rem 0.9rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-weight: 600; color: var(--muted); font-size: 0.8125rem; background: var(--chalk); white-space: nowrap; }
th[data-sort] { cursor: pointer; }
th[data-sort]::after { content: " ↕"; opacity: 0.4; }
th[aria-sort=ascending]::after { content: " ↑"; opacity: 1; }
th[aria-sort=descending]::after { content: " ↓"; opacity: 1; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--blue-wash); }
td.num, th.num { text-align: right; }
.empty { padding: 2.5rem 1.5rem; text-align: left; color: var(--muted); }
.empty strong { display: block; color: var(--ink); font-size: 1.0625rem; margin-bottom: 0.25rem; }

/* --- status chips: colour + text + shape -------------------------------------------------------- */
.chip { display: inline-flex; align-items: center; gap: 0.35rem; padding: 0.1rem 0.55rem; border-radius: 999px; font-size: 0.8125rem; font-weight: 600; white-space: nowrap; background: var(--chalk); border: 1px solid var(--line); }
.chip::before { content: ""; width: 0.55rem; height: 0.55rem; border-radius: 50%; background: var(--muted); }
.chip.cleared { background: var(--green-wash); border-color: transparent; }
.chip.cleared::before { background: var(--green); }
.chip.waiting, .chip.quarantine, .chip.running { background: var(--amber-wash); border-color: transparent; }
.chip.waiting::before, .chip.quarantine::before, .chip.running::before { background: var(--amber); }
.chip.blocked, .chip.refused { background: var(--red-wash); border-color: transparent; }
.chip.blocked::before, .chip.refused::before { background: var(--red); border-radius: 1px; }
.chip.pending::before, .chip.ready::before { background: transparent; border: 2px solid var(--blue); }
.chip.done { background: var(--green-wash); border-color: transparent; }
.chip.done::before { background: var(--green); }

/* --- tabs ---------------------------------------------------------------------------------------- */
.tabs { display: flex; gap: 0.25rem; border-bottom: 2px solid var(--line); margin-bottom: 1.25rem; overflow-x: auto; }
.tabs a { padding: 0.6rem 0.9rem; text-decoration: none; color: var(--muted); font-weight: 600; border-bottom: 3px solid transparent; margin-bottom: -2px; white-space: nowrap; }
.tabs a[aria-current="page"] { color: var(--ink); border-color: var(--blue); }
.tabs .count { font-weight: 500; color: var(--muted); margin-left: 0.25rem; }

/* --- the element ladder (signature, Trippel) -----------------------------------------------------
   Each apparatus is a ladder: lowest D-value at the bottom, every rung steps right as difficulty rises.
   Approval cascades down the ladder, refusal cascades up, so the picture mirrors the rule. */
.ladders { display: grid; grid-template-columns: repeat(auto-fit, minmax(23rem, 1fr)); gap: 1.5rem 2rem; }
.ladder h3 { margin-bottom: 0.75rem; }
.ladder ol { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column-reverse; gap: 0.3rem; }
.rung {
  --step: 0;
  margin-left: calc(var(--step) * 1.5rem);
  border-radius: var(--radius-s);
  background: var(--surface); border: 1px solid var(--line); border-left-width: 5px;
}
.rung summary { display: grid; grid-template-columns: 9.5rem 1fr auto; align-items: center; gap: 0.75rem; padding: 0.4rem 0.6rem; cursor: pointer; list-style: none; }
.rung summary::-webkit-details-marker { display: none; }
.rung details[open] summary { border-bottom: 1px dashed var(--line); }
.rung-facts { padding: 0.6rem 0.75rem; font-size: 0.875rem; }
.rung .symb { font-family: "teamgym12"; font-size: 1.75rem; line-height: 1; color: var(--ink); white-space: nowrap; }
.rung .name { font-size: 0.8125rem; line-height: 1.25; color: var(--muted); }
.rung .name small { display: block; color: var(--muted); }
.rung .val { font-family: var(--font-narrow); font-weight: 700; font-size: 1.0625rem; }
.rung.cleared { border-left-color: var(--green); background: var(--green-wash); }
.rung.waiting { border-left-color: var(--amber); background: var(--amber-wash); }
.rung.blocked { border-left-color: var(--red); background: var(--red-wash); border-left-style: double; border-left-width: 6px; }
.rung.open { border-left-color: var(--line); }
.rung.open .symb { color: var(--muted); }
.legend { display: flex; flex-wrap: wrap; gap: 0.5rem 1rem; margin: 0 0 1rem; padding: 0; list-style: none; font-size: 0.875rem; }

/* --- timeline ------------------------------------------------------------------------------------ */
.timeline { list-style: none; margin: 0; padding: 0 0 0 1.25rem; border-left: 2px solid var(--line); }
.timeline li { position: relative; padding: 0 0 1.1rem 0.75rem; }
.timeline li::before { content: ""; position: absolute; left: -1.25rem; top: 0.35rem; width: 0.8rem; height: 0.8rem; margin-left: -0.45rem; border-radius: 50%; background: var(--surface); border: 2px solid var(--muted); }
.timeline li.cleared::before { background: var(--green); border-color: var(--green); }
.timeline li.waiting::before { background: var(--amber); border-color: var(--amber); }
.timeline li.blocked::before { background: var(--red); border-color: var(--red); border-radius: 2px; }
.timeline li.future { color: var(--muted); }
.timeline li.future::before { border-style: dashed; background: var(--surface); }
.timeline time { display: block; font-size: 0.8125rem; color: var(--muted); }
.timeline strong { display: block; }

/* --- home portal ------------------------------------------------------------------------------- */
.apps { display: grid; grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr)); gap: 1.25rem; margin-top: 1.5rem; }
.app-door { display: grid; gap: 0.5rem; padding: 1.5rem; background: var(--surface); border: 1px solid var(--line); border-top: 6px solid var(--blue); border-radius: var(--radius-m); color: var(--ink); text-decoration: none; }
.app-door.oneshot { border-top-color: var(--ink); }
.app-door h2 { margin: 0; }
.app-door ul { margin: 0.25rem 0 0; padding-left: 1.1rem; color: var(--muted); }
.app-door:hover { border-color: var(--blue); color: var(--ink); }
.login-box { max-width: 26rem; }
.hero-mark { width: 64px; height: 64px; border-radius: 50%; background: #fff; border: 1px solid var(--line); margin-bottom: 1rem; }

/* --- OneShot attempt cards --------------------------------------------------------------------- */
.attempts { display: grid; grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); gap: 1rem; }
.attempt-card { display: grid; gap: 0.75rem; align-content: start; padding: 1.25rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m); }
.attempt-card h3 { font-size: 1.375rem; margin: 0; }
.attempt-card .clock-mini { font-family: var(--font-narrow); font-weight: 700; font-size: 2.25rem; line-height: 1; }
.attempt-card.running { border-color: var(--amber); box-shadow: inset 0 4px 0 var(--amber); }
.attempt-card.done { box-shadow: inset 0 4px 0 var(--green); }

/* --- OneShot scoreboard (signature, OneShot) ----------------------------------------------------
   Full-bleed navy so it films well; clock and token are sized for a phone video at a few metres. */
body.scoreboard { background: #0d1830; color: #fff; }
body.scoreboard.time-up { background: #9c2418; }
.board { min-height: 100vh; min-height: 100dvh; display: grid; grid-template-rows: auto 1fr auto; padding: max(clamp(1rem, 3vw, 2.5rem), env(safe-area-inset-top)) max(clamp(1rem, 3vw, 2.5rem), env(safe-area-inset-right)) max(clamp(1rem, 3vw, 2.5rem), env(safe-area-inset-bottom)) max(clamp(1rem, 3vw, 2.5rem), env(safe-area-inset-left)); gap: 1rem; }
.board-head { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; font-size: clamp(1rem, 0.6rem + 1.4vw, 1.75rem); font-weight: 600; }
.board-head .label { font-size: 1.6em; font-weight: 750; display: block; line-height: 1.1; }
.board-head .meta { color: #a9b8d6; }
.board-body { display: grid; align-content: center; gap: clamp(0.5rem, 2vh, 2rem); }
.clock {
  font-family: var(--font-narrow); font-weight: 700; line-height: 0.85; letter-spacing: -0.02em;
  font-size: clamp(6rem, 30vw, 26rem); font-variant-numeric: tabular-nums; color: #fff;
}
.clock.is-ending { color: #ff6b5b; }
.token-label { font-size: clamp(1rem, 0.7rem + 1vw, 1.5rem); color: #a9b8d6; font-weight: 600; }
.token { font-family: var(--font-narrow); font-weight: 700; font-size: clamp(3rem, 13vw, 10rem); line-height: 1; letter-spacing: 0.06em; background: #fff; color: #0d1830; padding: 0.05em 0.25em; border-radius: 6px; justify-self: start; }
.expired { font-family: var(--font-narrow); font-weight: 700; font-size: clamp(4rem, 18vw, 16rem); line-height: 0.9; color: #ff6b5b; }
.board-foot { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 1rem; color: #a9b8d6; font-size: 1rem; }
.board-foot a { color: #fff; }
@media (prefers-reduced-motion: no-preference) {
  .clock.is-ending { animation: pulse 1s steps(2, start) infinite; }
  @keyframes pulse { 50% { opacity: 0.55; } }
}

/* --- dialog ------------------------------------------------------------------------------------- */
dialog { border: 0; border-radius: var(--radius-m); padding: 0; max-width: min(34rem, calc(100vw - 2rem)); background: var(--surface); color: var(--ink); box-shadow: 0 20px 60px rgba(13, 24, 48, 0.35); }
dialog::backdrop { background: rgba(13, 24, 48, 0.6); }
dialog .dialog-body { padding: 1.5rem; display: grid; gap: 1rem; }
dialog h2 { margin: 0; }
.checklist { display: grid; gap: 0.6rem; margin: 0; padding: 0; border: 0; }
.checklist label { display: flex; gap: 0.25rem; align-items: flex-start; font-weight: 500; }

/* --- QR poster + print ------------------------------------------------------------------------- */
.poster { max-width: 34rem; margin: 2rem auto; text-align: left; }
.poster svg { width: 100%; height: auto; background: #fff; padding: 1rem; border-radius: var(--radius-m); }
@media print {
  .rail, .topbar, .no-print, .filters, .actions { display: none !important; }
  .shell { display: block; }
  .main { padding: 0; max-width: none; }
  body { background: #fff; color: #000; }
  .table-wrap { border: 0; overflow: visible; }
  th { background: #fff; }
  a { color: #000; text-decoration: none; }
}

/* --- admin restyle (S3) ------------------------------------------------------------------------ */
.admin-theme { --primary: #1e4fa3; --secondary: #14213d; --accent: #f0c04a; --header-bg: #14213d; --breadcrumbs-bg: #1e4fa3; --link-fg: #1e4fa3; --link-selected-fg: #163d80; --button-bg: #1e4fa3; --button-hover-bg: #163d80; --default-button-bg: #14213d; --font-family-primary: var(--font); }

/* Django's default <div> form rendering ({{ form }}) styled as fields. */
.form > div { display: grid; gap: 0.3rem; }
.form > div > label { font-weight: 600; }
.form > div > div:has(> div > label > input[type=radio]) { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.form label:has(> input[type=radio]) { font-weight: 500; display: flex; align-items: center; border: 1px solid var(--line); border-radius: var(--radius-s); padding: 0.55rem 0.8rem; background: var(--surface); cursor: pointer; }
.form label:has(> input[type=radio]:checked) { border-color: var(--blue); background: var(--blue-wash); }
.form > div:has(> input[type=checkbox]) { grid-template-columns: auto 1fr; align-items: start; }
.form > div:has(> input[type=checkbox]) > input { order: -1; margin-top: 0.2rem; }
.form > div:has(> input[type=checkbox]) > .helptext, .form > div:has(> input[type=checkbox]) > .errorlist { grid-column: 2; }
.cascade { padding: 0.75rem 1rem; border-radius: var(--radius-s); background: var(--blue-wash); }
.form > p { display: grid; gap: 0.3rem; margin: 0; }
.form > p > label { font-weight: 600; }
.attempt-card .chip { justify-self: start; }
@media (max-width: 560px) {
  .rung { margin-left: calc(var(--step) * 0.6rem); }
  .rung summary { grid-template-columns: 7rem 1fr auto; gap: 0.5rem; }
  .rung .symb { font-size: 1.35rem; }
}
.btn-link { white-space: nowrap; }
[hidden] { display: none !important; }

/* Element reference: the TeamGym symbol is what coaches and judges read; the name is secondary, the D-value barely matters. */
.el { display: inline-flex; flex-direction: column; gap: 0.1rem; vertical-align: top; }
.el .symb { font-family: "teamgym12"; font-size: 1.6rem; line-height: 1.1; color: var(--ink); white-space: nowrap; }
.el .el-name { font-size: 0.8125rem; color: var(--muted); line-height: 1.3; }
.el-row { display: flex; flex-wrap: wrap; gap: 0.75rem 1.5rem; align-items: flex-start; margin: 0.25rem 0; }
.d-val { font-size: 0.75rem; color: var(--muted); font-weight: 400; }
.element-choices { display: grid; gap: 1rem; }
.element-choices fieldset { border: 0; padding: 0; margin: 0; }
.element-choices legend { font-weight: 600; font-size: 0.875rem; color: var(--muted); margin-bottom: 0.35rem; }
.element-choices .opts { display: grid; grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr)); gap: 0.4rem; }
.element-choices label { display: flex; gap: 0.5rem; align-items: center; border: 1px solid var(--line); border-radius: var(--radius-s); padding: 0.5rem 0.6rem; background: var(--surface); cursor: pointer; font-weight: 400; }
.element-choices label:has(input:checked) { border-color: var(--blue); background: var(--blue-wash); }
.cascade .el-row { margin-top: 0.4rem; }

/* --- v2.1: PWA banners, first steps, stats, gallery ------------------------------------------- */
.banner { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 1rem; padding: 0.75rem 1rem; margin: 0 0 1.25rem; border-radius: var(--radius-s); background: var(--blue-wash); border-left: 4px solid var(--blue); }
.stale { margin: 0 0 1rem; padding: 0.5rem 0.75rem; border-radius: var(--radius-s); background: var(--amber-wash); font-size: 0.875rem; }
.steps ol { margin: 0; padding-left: 1.25rem; display: grid; gap: 0.35rem; }
.steps li.done { color: var(--muted); text-decoration: line-through; text-decoration-color: var(--green); }
.steps { margin-bottom: 1.25rem; max-width: 36rem; }
.more-links ul { margin: 0; padding-left: 1.1rem; display: grid; gap: 0.25rem; }
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr)); gap: 1rem; margin: 0 0 1rem; }
.stat-row dt { color: var(--muted); font-size: 0.875rem; }
.stat-row dd { margin: 0; font-family: var(--font-narrow); font-weight: 700; font-size: 2.5rem; line-height: 1.1; }
.bar { display: inline-block; min-width: 4.5rem; padding: 0 0.4rem; background: linear-gradient(90deg, var(--green-wash) var(--pct), transparent var(--pct)); border-radius: 2px; }
.decision-list { list-style: none; margin: 0 0 1rem; padding: 0; display: grid; gap: 0.5rem; }
.decision-list li { display: grid; grid-template-columns: 1fr auto; gap: 0.25rem 1rem; align-items: start; padding: 0.75rem 1rem; }
.decision-list details { grid-column: 1 / -1; }
.videos { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 22rem), 1fr)); gap: 1rem; }
.video-card { display: grid; gap: 0.75rem; align-content: start; }
.video-card h2 { font-size: 1.0625rem; margin: 0; }
.video-card header p { margin: 0.2rem 0 0; }
.video-card.is-off { display: none; }
.player { aspect-ratio: 16 / 9; background: #0d1830; border-radius: var(--radius-s); overflow: hidden; }
.player iframe { width: 100%; height: 100%; border: 0; }
.break { overflow-wrap: anywhere; }
.form #id_gymnasts, .form div:has(> div > label > input[name=gymnasts]) { display: grid; grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr)); gap: 0.4rem; }
.form label:has(> input[name=gymnasts]) { display: flex; gap: 0.5rem; align-items: center; padding: 0.5rem 0.6rem; border: 1px solid var(--line); border-radius: var(--radius-s); background: var(--surface); font-weight: 500; cursor: pointer; }
.form label:has(> input[name=gymnasts]:checked) { border-color: var(--blue); background: var(--blue-wash); }

.account { display: grid; gap: 0.75rem; align-content: start; }
.account form { display: grid; gap: 0.3rem; justify-items: start; }
.account p { margin: 0; }
/* Phone lists: on small screens a list page shows .rows instead of its table (.wide). Each row is two lines,
   one fixed height, and the whole row opens the item; the title link stretches over it. */
.narrow { display: none; }
.rows { list-style: none; margin: 0 0 1.25rem; padding: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m); overflow: hidden; }
.row { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; column-gap: 0.75rem; min-height: 3.75rem; padding: 0.55rem 0.75rem 0.55rem 0.9rem; }
.row + .row { border-top: 1px solid var(--line); }
.row:has(.row-title:active) { background: var(--blue-wash); }
.row-title { grid-column: 1; font-weight: 650; color: var(--ink); text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-title::after { content: ""; position: absolute; inset: 0; }
.row-meta { grid-column: 1; font-size: 0.8125rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-meta .warn { color: var(--amber); font-weight: 600; }
.row-meta .bad { color: var(--red); font-weight: 600; }
.row-side { grid-column: 2; grid-row: 1 / span 2; display: flex; align-items: center; gap: 0.6rem; }
.row-side::after { content: ""; width: 0.45rem; height: 0.45rem; border: solid var(--muted); border-width: 2px 2px 0 0; transform: rotate(45deg); margin-right: 0.15rem; }
.row-side form, .row-side button { position: relative; z-index: 1; } /* sits above the stretched link */
.btn-s { min-height: 2.25rem; padding: 0.3rem 0.75rem; font-size: 0.875rem; }
.row-count { font-family: var(--font-narrow); font-weight: 700; font-size: 1.5rem; line-height: 1; color: var(--ink); }
.row-count.zero { color: var(--muted); }
.row-count small { display: block; font-family: var(--font); font-weight: 500; font-size: 0.6875rem; color: var(--muted); margin-top: 0.15rem; }
.row-count { text-align: center; }
@media (max-width: 560px) {
  .wide { display: none; }
  .narrow { display: block; }
  .tabs { flex-wrap: wrap; overflow-x: visible; }
  .tabs a { padding: 0.5rem 0.6rem; }
  .filters-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem 0.75rem; align-items: center; } /* two fields side by side, checkbox and button below: the list starts higher */
  .filters-2 .field { min-width: 0; }
  .filters-2 .btn { justify-self: end; }
  th, td { padding: 0.6rem 0.5rem; }
}
table { overflow-wrap: normal; } /* names break between words; a too-wide table scrolls inside .table-wrap */
