/* NMC scoring app — one design system.
 *
 * Tokens first, then one rule per component. Nothing is defined twice: if a value needs to
 * change it changes in exactly one place. Every colour, size, space and radius used anywhere
 * in the app is a custom property declared in :root, so no template carries a literal value.
 *
 * Colours come from the two logos (static/img/). MSFI blue carries the whole interface; the
 * Brain Infinite spectrum appears once, in the rule under the header, so that colour
 * everywhere else can mean something. Contrast ratios are in docs/ui/design-system.md and
 * every text pair clears WCAG AA.
 */

/* ============================================================ tokens */
:root {
  /* brand, sampled from the logo files */
  --c-primary: #0438a6;          /* MSFI blue            9.90:1 on white */
  --c-primary-press: #032a7d;    /* pressed             12.87:1 on white */
  --c-primary-wash: #e6ecfa;     /* tinted surface */
  --c-spectrum-1: #013bff;       /* Brain Infinite, header rule only */
  --c-spectrum-2: #018699;
  --c-spectrum-3: #00c046;
  --c-spectrum-4: #fecc09;
  --c-spectrum-5: #dd7011;
  --c-spectrum-6: #ed1b24;

  /* neutrals */
  --c-page: #f4f6fb;
  --c-card: #ffffff;
  --c-ink: #14213d;              /* 15.97:1 on card */
  --c-ink-muted: #56607a;        /*  6.27:1 on card */
  --c-hairline: #d6dcec;         /* borders only, never text */
  --c-zebra: #fafbfe;
  --c-danger: #9e1318;           /*  8.20:1 on card */
  --c-danger-press: #7a0f13;
  --c-on-dark: #ffffff;

  /* status: ink / surface pairs, each with a shape so colour is never the only signal */
  --c-wait-ink: #5a4a00;   --c-wait-bg: #fdf4d2;   /* 7.89:1  waiting for the checker */
  --c-ok-ink: #14663a;     --c-ok-bg: #e3f5ea;     /* 6.19:1  verified */
  --c-bad-ink: #9e1318;    --c-bad-bg: #fdeaea;    /* 7.08:1  mismatch */
  --c-held-ink: #8a3b00;   --c-held-bg: #ffe9d3;   /* 6.97:1  held for referee */
  --c-abs-ink: #3f4759;    --c-abs-bg: #eceef3;    /* 8.02:1  absent */
  --c-recheck-ink: #015c6b; --c-recheck-bg: #e0f3f6; /* 6.68:1 rechecked by referee */
  --c-tie-ink: #6b2a8a;    --c-tie-bg: #f4e9fa;    /* 7.70:1  referee to decide */
  --c-incomplete-ink: #6a4a00; --c-incomplete-bg: #fffdf3; /* 8.31:1 row tint */

  /* projector */
  --c-stage: #031d56;            /* white on this: 15.98:1 */
  --c-stage-gold: #fecc09;       /* 10.54:1 on stage */

  /* type: six steps, nothing below 13px */
  --t-xs: 0.8125rem;   /* 13px  badge and table meta: the floor */
  --t-sm: 0.875rem;    /* 14px  labels, secondary text */
  --t-base: 1rem;      /* 16px  body, inputs, table cells */
  --t-lg: 1.125rem;    /* 18px  section headings */
  --t-xl: 1.375rem;    /* 22px  page titles, score inputs, participant name */
  --t-2xl: 1.75rem;    /* 28px  read-back, projector rank */
  --w-normal: 400;
  --w-medium: 600;
  --w-bold: 700;
  --leading: 1.5;

  --font-ui: 'Noto Sans', 'Noto Sans Devanagari', system-ui, -apple-system, 'Segoe UI',
    Roboto, sans-serif;

  /* space: one scale */
  --s-1: 4px;  --s-2: 8px;  --s-3: 12px; --s-4: 16px;
  --s-5: 24px; --s-6: 32px; --s-7: 48px;

  /* shape */
  --r-control: 8px;
  --r-card: 12px;
  --r-pill: 999px;
  --shadow: 0 1px 2px rgba(4, 56, 166, 0.08);
  --focus: 0 0 0 3px #ffffff, 0 0 0 6px var(--c-primary);

  /* controls */
  --control-h: 44px;       /* default: comfortable on a tablet */
  --control-h-sm: 36px;    /* inside a table row, pointer only */
  --control-h-lg: 52px;    /* the one action a volunteer repeats all day */

  /* layout */
  --page-w: 1120px;        /* forms and reading */
  --page-w-wide: 1600px;   /* result tables */

  font-family: var(--font-ui);
  font-size: 100%;
  color: var(--c-ink);
  background: var(--c-page);
}

/* ============================================================ base */
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; line-height: var(--leading); font-size: var(--t-base); }
main { max-width: var(--page-w); margin: 0 auto; padding: var(--s-5) var(--s-4) var(--s-6); }
main:has(table.results) { max-width: var(--page-w-wide); }

a { color: var(--c-primary); }
a:hover { color: var(--c-primary-press); }
h1 { font-size: var(--t-xl); font-weight: var(--w-bold); margin: 0 0 var(--s-4); }
h2 { font-size: var(--t-lg); font-weight: var(--w-medium); margin: var(--s-6) 0 var(--s-3); }
h3 { font-size: var(--t-base); font-weight: var(--w-medium); margin: var(--s-4) 0 var(--s-2); }
p { margin: 0 0 var(--s-3); }
code { font-size: var(--t-sm); overflow-wrap: anywhere; }
.muted { color: var(--c-ink-muted); font-weight: var(--w-normal); }

/* every number the eye has to compare: same width per digit, so columns line up */
.num, td.num, .typed-value, .readback, table.results td, .rank { font-variant-numeric: tabular-nums; }

:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
  outline: none;
  box-shadow: var(--focus);
  border-radius: var(--r-control);
}

/* ============================================================ header */
.topbar {
  display: flex; flex-wrap: wrap; gap: var(--s-3);
  align-items: center; justify-content: space-between;
  padding: var(--s-2) var(--s-4);
  background: var(--c-card);
  border-bottom: 4px solid var(--c-primary);
  /* the one flourish: the organiser's six colours, in one place */
  border-image: linear-gradient(90deg, var(--c-spectrum-1), var(--c-spectrum-2),
    var(--c-spectrum-3), var(--c-spectrum-4), var(--c-spectrum-5), var(--c-spectrum-6)) 1;
}
.brand { display: flex; align-items: center; gap: var(--s-3); text-decoration: none; }
.brand img { height: 48px; width: auto; display: block; }  /* never stretched */
.brand-name { display: flex; flex-direction: column; line-height: 1.2; }
.brand-name strong { color: var(--c-primary); font-size: var(--t-base); font-weight: var(--w-bold); }
.brand-name span { color: var(--c-ink-muted); font-size: var(--t-xs); }

.topbar nav { display: flex; flex-wrap: wrap; gap: var(--s-2); align-items: center; }
.topbar nav > a {
  font-size: var(--t-sm); font-weight: var(--w-medium); text-decoration: none;
  color: var(--c-primary); padding: 0 var(--s-3); border-radius: var(--r-control);
  display: inline-flex; align-items: center; min-height: var(--control-h-sm);
}
.topbar nav > a:hover { background: var(--c-primary-wash); }
.who {
  background: var(--c-primary-wash); color: var(--c-primary-press);
  border-radius: var(--r-pill); padding: var(--s-1) var(--s-3);
  font-size: var(--t-sm); font-weight: var(--w-medium);
}

.site-footer {
  max-width: var(--page-w); margin: var(--s-6) auto 0;
  padding: var(--s-3) var(--s-4) var(--s-5); border-top: 1px solid var(--c-hairline);
  display: flex; align-items: center; justify-content: center; gap: var(--s-2);
  color: var(--c-ink-muted); font-size: var(--t-xs);
}
.site-footer img { height: 32px; width: auto; }  /* defers to the header logo */

/* ============================================================ buttons: one component */
button, .button {
  font: inherit; font-size: var(--t-base); font-weight: var(--w-medium);
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s-2);
  min-height: var(--control-h); padding: 0 var(--s-4);
  border: 1px solid var(--c-hairline); border-radius: var(--r-control);
  background: var(--c-card); color: var(--c-ink);
  cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background-color .12s ease, border-color .12s ease;
}
button:hover, .button:hover { background: var(--c-primary-wash); border-color: var(--c-primary); }
button:active, .button:active { background: var(--c-hairline); transform: translateY(1px); }

button.primary, .button.primary {
  background: var(--c-primary); border-color: var(--c-primary); color: var(--c-on-dark);
}
button.primary:hover, .button.primary:hover {
  background: var(--c-primary-press); border-color: var(--c-primary-press);
}
button.primary:active, .button.primary:active { background: var(--c-primary-press); }

button.danger, .button.danger {
  background: var(--c-danger); border-color: var(--c-danger); color: var(--c-on-dark);
}
button.danger:hover, .button.danger:hover {
  background: var(--c-danger-press); border-color: var(--c-danger-press);
}
button.danger:active, .button.danger:active { background: var(--c-danger-press); }

/* a text button is still a button: it keeps a real hit area */
button.link, .button.link {
  border-color: transparent; background: none; color: var(--c-primary);
  text-decoration: underline; padding: 0 var(--s-2); min-height: var(--control-h-sm);
}
button.link:hover, .button.link:hover { background: var(--c-primary-wash); border-color: transparent; }
button[disabled], .button[disabled] { opacity: .5; cursor: not-allowed; transform: none; }
button[disabled]:hover { background: var(--c-card); border-color: var(--c-hairline); }

form.inline { display: inline-flex; }
.actions { display: flex; flex-wrap: wrap; gap: var(--s-2); margin: var(--s-4) 0; }
/* in a table row a pointer is doing the clicking, so a smaller target is safe */
td button, td .button, td form.inline button { min-height: var(--control-h-sm); font-size: var(--t-sm); }

/* ============================================================ forms */
.field { margin-bottom: var(--s-4); display: flex; flex-direction: column; gap: var(--s-1); }
label { font-size: var(--t-sm); font-weight: var(--w-medium); color: var(--c-ink); }
.field small, .field .help { color: var(--c-ink-muted); font-size: var(--t-xs); }
input, select, textarea {
  font: inherit; font-size: var(--t-base); color: var(--c-ink);
  min-height: var(--control-h); padding: 0 var(--s-3);
  border: 1px solid var(--c-hairline); border-radius: var(--r-control);
  background: var(--c-card); max-width: 100%;
}
textarea { padding: var(--s-2) var(--s-3); line-height: var(--leading); }
input[type="checkbox"] { min-height: 0; width: 20px; height: 20px; accent-color: var(--c-primary); }
label:has(input[type="checkbox"]) {
  flex-direction: row; align-items: center; gap: var(--s-2); min-height: var(--control-h);
}
select { padding-right: var(--s-2); }

.errors, .error { color: var(--c-danger); }
.error { font-size: var(--t-sm); }
.errors {
  border: 1px solid var(--c-danger); border-left-width: 4px; background: var(--c-bad-bg);
  border-radius: var(--r-control); padding: var(--s-2) var(--s-3); margin-bottom: var(--s-4);
}
.errors p { margin: 0; }
.has-error input, .has-error select, .has-error textarea { border-color: var(--c-danger); }

.messages { list-style: none; padding: 0; margin: 0 0 var(--s-4); }
.messages li {
  padding: var(--s-2) var(--s-3); border-radius: var(--r-control); margin-bottom: var(--s-2);
  background: var(--c-primary-wash); border-left: 4px solid var(--c-primary);
}
.messages .msg-success { background: var(--c-ok-bg); border-left-color: var(--c-ok-ink); }
.messages .msg-error { background: var(--c-bad-bg); border-left-color: var(--c-danger); color: var(--c-danger); }

.search { display: flex; gap: var(--s-2); margin-bottom: var(--s-3); }
.search input { flex: 1; }
.lookup { display: flex; flex-wrap: wrap; gap: var(--s-2); align-items: flex-end; margin-bottom: var(--s-3); }
.lock-anyway, .unlock, .confirm {
  display: flex; flex-wrap: wrap; gap: var(--s-2); align-items: flex-end; margin-top: var(--s-2);
}
.lock-anyway input, .unlock input, .confirm input { min-width: 22ch; }

/* ============================================================ surfaces */
.card {
  background: var(--c-card); border: 1px solid var(--c-hairline);
  border-radius: var(--r-card); padding: var(--s-4) var(--s-5); box-shadow: var(--shadow);
  margin-bottom: var(--s-4);
}
.narrow { max-width: 560px; }
main > .card.narrow:only-child { margin: var(--s-6) auto; }
.heading {
  display: flex; flex-wrap: wrap; gap: var(--s-3);
  align-items: center; justify-content: space-between; margin-bottom: var(--s-4);
}
.heading h1 { margin: 0; }
.facts {
  display: grid; grid-template-columns: max-content 1fr; gap: var(--s-2) var(--s-4);
  background: var(--c-card); border: 1px solid var(--c-hairline);
  border-radius: var(--r-card); padding: var(--s-4) var(--s-5); margin: 0 0 var(--s-4);
}
.facts dt { color: var(--c-ink-muted); font-size: var(--t-sm); }
.facts dd { margin: 0; }
.choices { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: var(--s-2); }
.disciplines { margin: 0 0 var(--s-4); padding-left: var(--s-5); }
.disciplines li { margin-bottom: var(--s-1); }
.missing { overflow-wrap: anywhere; }

/* ============================================================ tables */
.table-wrap { overflow-x: auto; margin-bottom: var(--s-4); }
table {
  width: 100%; border-collapse: collapse; background: var(--c-card);
  border-radius: var(--r-card); overflow: hidden; box-shadow: var(--shadow);
}
th, td {
  text-align: left; padding: var(--s-2) var(--s-3);
  border-bottom: 1px solid var(--c-hairline); vertical-align: top;
}
th {
  font-size: var(--t-xs); font-weight: var(--w-medium); letter-spacing: .02em;
  color: var(--c-primary-press); background: var(--c-primary-wash); white-space: nowrap;
}
tbody tr:nth-child(even) td { background: var(--c-zebra); }
tbody tr:hover td { background: var(--c-primary-wash); }
tbody tr:last-child td { border-bottom: none; }
table.compact td, table.compact th { padding: var(--s-1) var(--s-2); font-size: var(--t-sm); }

table.results td.num { text-align: right; white-space: nowrap; }
table.results thead th { position: sticky; top: 0; z-index: 1; }
table.results th, table.results td { overflow-wrap: normal; word-break: normal; }
table.results td:nth-child(2) { white-space: nowrap; }
table.results td:nth-child(3) { min-width: 11rem; }
table.results td:first-child, table.results th:first-child { text-align: center; width: 5rem; }
table.results td.num strong { font-size: var(--t-lg); font-weight: var(--w-bold); color: var(--c-primary-press); }
table.results tr.incomplete td { background: var(--c-incomplete-bg); }
table.results tr.incomplete .muted { color: var(--c-incomplete-ink); font-size: var(--t-xs); }

.rank { font-weight: var(--w-bold); }
.rank span {
  display: inline-block; min-width: 2.25rem; padding: var(--s-1) var(--s-2);
  border-radius: var(--r-pill); background: var(--c-primary-wash); color: var(--c-primary-press);
}
.rank[data-rank="1"] span { background: #fecc09; color: #3a2f00; }  /* 8.73:1 */
.rank[data-rank="2"] span { background: #dfe4ee; color: #26324d; }
.rank[data-rank="3"] span { background: #f3c89a; color: #4a2a05; }  /* 8.33:1 */
.tie-mark {
  display: inline-block; font-size: var(--t-xs); font-weight: var(--w-medium);
  color: var(--c-tie-ink); text-transform: uppercase; letter-spacing: .04em;
}

/* ============================================================ status badges */
.status {
  display: inline-flex; align-items: center; gap: var(--s-1);
  font-size: var(--t-xs); font-weight: var(--w-medium); white-space: nowrap;
  padding: var(--s-1) var(--s-2); border-radius: var(--r-pill);
  border: 1px solid currentColor; background: var(--c-card);
}
/* the shape before the text: colour is never the only signal, and it survives mono printing */
.status::before { content: ""; width: .6em; height: .6em; flex: none; background: currentColor; }
.status-pending::before { background: none; border: 2px solid currentColor; border-radius: 50%; }
.status-verified::before, .status-active::before {
  width: .5em; height: .8em; background: none; border: solid currentColor;
  border-width: 0 2px 2px 0; transform: rotate(45deg) translateY(-.1em);
}
.status-mismatch::before { clip-path: polygon(20% 0, 50% 30%, 80% 0, 100% 20%, 70% 50%, 100% 80%, 80% 100%, 50% 70%, 20% 100%, 0 80%, 30% 50%, 0 20%); }
.status-held::before { clip-path: polygon(50% 0, 100% 100%, 0 100%); }
.status-absent::before { height: 2px; width: .8em; }
.status-recheck::before { border-radius: 50%; clip-path: polygon(0 0, 100% 0, 100% 35%, 50% 35%, 50% 65%, 100% 65%, 100% 100%, 0 100%); }
.status-tie::before { clip-path: polygon(50% 0, 100% 40%, 0 40%, 50% 0, 50% 100%, 0 60%, 100% 60%); }
.status-locked::before, .status-declared::before { border-radius: 2px 2px 0 0; }
.status-draft::before { border-radius: 50%; background: none; border: 2px dotted currentColor; }

.status-pending { color: var(--c-wait-ink); background: var(--c-wait-bg); }
.status-verified, .status-active { color: var(--c-ok-ink); background: var(--c-ok-bg); }
.status-mismatch { color: var(--c-bad-ink); background: var(--c-bad-bg); }
.status-held { color: var(--c-held-ink); background: var(--c-held-bg); }
.status-absent { color: var(--c-abs-ink); background: var(--c-abs-bg); }
.status-recheck { color: var(--c-recheck-ink); background: var(--c-recheck-bg); }
.status-tie { color: var(--c-tie-ink); background: var(--c-tie-bg); }
.status-locked, .status-declared { color: var(--c-primary); background: var(--c-primary-wash); }
.status-draft { color: var(--c-ink-muted); background: var(--c-abs-bg); }

/* ============================================================ banners */
.banner {
  border-radius: var(--r-card); padding: var(--s-3) var(--s-4); margin: 0 0 var(--s-4);
  border: 1px solid var(--c-hairline); border-left: 6px solid var(--c-hairline);
  background: var(--c-card);
}
.banner-pending { border-left-color: var(--c-wait-ink); background: var(--c-wait-bg); color: var(--c-wait-ink); }
.banner-ready { border-left-color: var(--c-ok-ink); background: var(--c-ok-bg); color: var(--c-ok-ink); }
.banner summary { cursor: pointer; min-height: var(--control-h-sm); display: flex; align-items: center; }
.declared {
  border-radius: var(--r-card); padding: var(--s-3) var(--s-4); margin: 0 0 var(--s-4);
  background: var(--c-primary-wash); border-left: 6px solid var(--c-primary);
  overflow-wrap: anywhere;
}
.ok { color: var(--c-ok-ink); font-weight: var(--w-medium); }

/* ============================================================ tabs */
.tabs {
  display: flex; gap: var(--s-2); margin: 0 0 var(--s-4);
  overflow-x: auto; padding-bottom: var(--s-1);
}
.tabs a {
  display: inline-flex; align-items: center; min-height: var(--control-h-sm);
  padding: 0 var(--s-3); border: 1px solid var(--c-hairline); border-radius: var(--r-control);
  background: var(--c-card); color: var(--c-primary); text-decoration: none;
  font-size: var(--t-sm); font-weight: var(--w-medium); white-space: nowrap;
}
.tabs a:hover { background: var(--c-primary-wash); border-color: var(--c-primary); }
.tabs a[aria-current="page"] {
  background: var(--c-primary); border-color: var(--c-primary); color: var(--c-on-dark);
}
.event-tabs { margin-bottom: var(--s-5); }

/* ============================================================ entry desk */
.desk-lookup {
  display: grid; grid-template-columns: 12rem minmax(0, 1fr) auto; gap: var(--s-4);
  align-items: end; background: var(--c-card); border: 1px solid var(--c-hairline);
  border-radius: var(--r-card); padding: var(--s-4); margin-bottom: var(--s-4);
  box-shadow: var(--shadow);
}
.desk-lookup .field { margin-bottom: 0; }
.desk-lookup input, .desk-lookup select { font-size: var(--t-lg); width: 100%; }

.person {
  display: flex; flex-wrap: wrap; gap: var(--s-2) var(--s-4); align-items: baseline;
}
.person strong { font-size: var(--t-xl); font-weight: var(--w-bold); color: var(--c-primary-press); }

.entry .field input[type="text"] { font-size: var(--t-xl); max-width: 14rem; }
.entry button.primary { min-height: var(--control-h-lg); font-size: var(--t-lg); padding: 0 var(--s-6); }
.readback {
  border: 1px solid var(--c-ok-ink); border-left: 6px solid var(--c-ok-ink);
  background: var(--c-ok-bg); color: var(--c-ok-ink);
  border-radius: var(--r-card); padding: var(--s-3) var(--s-4); margin-bottom: var(--s-4);
  font-size: var(--t-lg);
}
.readback strong { font-size: var(--t-2xl); display: block; }
.progress { margin-bottom: var(--s-3); }
.progress strong { color: var(--c-primary-press); }

/* ============================================================ check screen */
.check-typed { border-left: 6px solid var(--c-primary); }
.check-typed .typed-value {
  font-size: var(--t-2xl); font-weight: var(--w-bold); color: var(--c-primary-press);
  margin: var(--s-2) 0 var(--s-4);
}

/* ============================================================ start page */
.tiles {
  list-style: none; padding: 0; margin: 0; display: grid; gap: var(--s-3);
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
}
.tile {
  display: block; background: var(--c-card); border: 1px solid var(--c-hairline);
  border-top: 4px solid var(--c-primary); border-radius: var(--r-card);
  padding: var(--s-4); text-decoration: none; color: var(--c-ink); box-shadow: var(--shadow);
}
.tile:hover { background: var(--c-primary-wash); }
.tile strong { display: block; font-size: var(--t-lg); color: var(--c-primary-press); }
.tile span { color: var(--c-ink-muted); font-size: var(--t-sm); }

/* ============================================================ tie decisions */
.tie-banner .tie-form {
  display: flex; flex-wrap: wrap; gap: var(--s-2); align-items: flex-end; margin-top: var(--s-3);
}
.tie-banner .tie-group { font-weight: var(--w-medium); align-self: center; }
.tie-banner input { min-width: 16ch; }
.exports { display: flex; flex-wrap: wrap; gap: var(--s-2); align-items: center; margin-bottom: var(--s-4); }
.declare { margin-bottom: var(--s-4); }

/* ============================================================ login */
.login-logo { display: block; margin: 0 auto var(--s-3); width: min(240px, 70%); height: auto; }
.login-title { text-align: center; }

/* ============================================================ presentation mode */
body.projector {
  background: var(--c-stage);
  --c-card: #0a2a6b;
  --c-page: #031d56;
  --c-ink: #ffffff;
  --c-ink-muted: #b9c6e8;
  --c-hairline: #1b3f86;
  --c-zebra: #082462;
  --c-primary-wash: #0d2f74;
  --c-primary-press: #ffffff;
}
body.projector .topbar nav, body.projector .site-footer, body.projector .exports,
body.projector .declare, body.projector .search, body.projector .banner details,
body.projector .tie-form { display: none; }
body.projector .topbar { background: var(--c-stage); }
body.projector .brand-name strong { color: var(--c-on-dark); }
body.projector main { max-width: none; padding: var(--s-3) var(--s-5); }
body.projector h1 { font-size: var(--t-2xl); }
body.projector table.results { font-size: var(--t-xl); }
body.projector table.results th { font-size: var(--t-base); color: var(--c-on-dark); }
body.projector table.results td.num strong { font-size: var(--t-2xl); color: var(--c-stage-gold); }
body.projector .tabs a { font-size: var(--t-lg); min-height: var(--control-h); }
.projector-toggle { margin-left: auto; }

/* ============================================================ narrow screens */
@media (max-width: 640px) {
  main { padding: var(--s-4) var(--s-3) var(--s-5); }
  .brand img { height: 36px; }
  .brand-name span { display: none; }
  .desk-lookup { grid-template-columns: 1fr; }
  .desk-lookup button { width: 100%; }
  .card { padding: var(--s-3) var(--s-4); }
  .facts { grid-template-columns: 1fr; gap: var(--s-1); }
  .facts dt { margin-top: var(--s-2); }
  .heading { align-items: flex-start; flex-direction: column; gap: var(--s-2); }
  .actions button, .actions .button { flex: 1 1 auto; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
  button:active, .button:active { transform: none; }
}

/* Ranking and category pickers, side by side */
.pickers { display: flex; flex-wrap: wrap; gap: var(--s-4); align-items: flex-end; margin-bottom: var(--s-4); }
.pickers .field { margin-bottom: 0; }
.pickers form.field { flex-direction: row; align-items: flex-end; gap: var(--s-2); }
.pickers form.field label { align-self: center; }
.pickers select { min-width: 16rem; font-size: var(--t-base); }
.all-tables { margin: calc(var(--s-4) * -1) 0 var(--s-4); }
.all-tables summary { color: var(--c-ink-muted); font-size: var(--t-sm); cursor: pointer; min-height: var(--control-h-sm); display: flex; align-items: center; }
.all-tables .tabs { flex-wrap: wrap; overflow: visible; margin-top: var(--s-2); }
body.projector .all-tables { display: none; }
body.projector .pickers select { font-size: var(--t-lg); }
@media (max-width: 640px) { .pickers { flex-direction: column; align-items: stretch; } .pickers select { min-width: 0; width: 100%; } }

/* Admin blocks on the dashboard: one stacked block each, not one wrapping row */
.banner-warning { border-left-color: var(--c-danger); background: var(--c-bad-bg); color: var(--c-bad-ink); }
.banner-warning p:last-child { margin-bottom: 0; }

.tie-banner .tie-form {
  display: block; margin-top: var(--s-3); padding-top: var(--s-3);
  border-top: 1px solid rgba(90, 74, 0, .25);
}
.tie-banner .tie-group { margin-bottom: var(--s-3); }
.tie-banner .field { max-width: 32rem; }
.tie-banner input { width: 100%; min-width: 0; background: var(--c-card); }
.tie-banner small { color: inherit; opacity: .75; }

.declare { max-width: 44rem; }
.declare h2 { margin-top: 0; }
.declare > form + form {
  margin-top: var(--s-4); padding-top: var(--s-4); border-top: 1px solid var(--c-hairline);
}
.declare .lock-anyway { display: block; }
.declare .lock-anyway .field { max-width: 24rem; }
.declare .lock-anyway input { width: 100%; min-width: 0; }
.declare form small { display: block; margin-top: var(--s-2); }
