/* Round Table Tunisia voting system: the Round Table International design system (round-table.org).
   Nunito, RTI orange on white, charcoal text, warm greys, 6/12/18px corners. Light only. No inline styles anywhere (CSP).
   Every margin/padding/gap/offset uses a --s-* token (enforced by tests/Unit/CssSpacingTest.php). */

@font-face {
  font-family: "Nunito";
  font-style: normal;
  font-weight: 200 1000;
  font-display: swap;
  src: url("../fonts/nunito-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Nunito";
  font-style: normal;
  font-weight: 200 1000;
  font-display: swap;
  src: url("../fonts/nunito-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* ---------- Tokens ---------- */
/* RTI values (rti-theme tokens.css) except --muted and --control-border, darkened for WCAG AA. */
:root {
  --black: #0a0a0a; --ink: #252525; --paper: #ffffff; --paper-2: #f7f7f5; --rule: #ededeb; --grey-700: #3f3f3f;
  --muted: #6e6e6e; --control-border: #8f8f8d;
  --accent: #f5a400; --accent-hover: #e09600; --on-accent: #0a0a0a; --accent-text: #9a5f00; --tint: #fff7e5;
  --link: #805000; --link-hover: #613d00;
  --focus: var(--accent); --focus-edge: var(--black); --on-dark: #ffffff;
  --success: #1f5130; --warning: #5c3a00; --danger: #b42318;
  --success-bg: #e3f1e6; --warning-bg: #fdebc4; --danger-bg: #fdecea; --info-bg: var(--paper-2);
  --success-on-dark: #8fd19e; --danger-on-dark: #ff9b8f;
  --scrim: rgb(10 10 10 / 0.5);
  --rb-c0: #ededeb; --rb-c1: #dce9fb; --rb-c2: #d9f2e3; --rb-c3: #ebe0fa; --rb-c4: #fbe0e8;
  --rb-c5: #d5f0f0; --rb-c6: #fdebc8; --rb-c7: #e6f2cf; --rb-c8: #e3e7ee;
  --s-1: 4px; --s-2: 8px; --s-3: 12px; --s-4: 16px; --s-5: 24px; --s-6: 32px; --s-7: 48px; --s-8: 72px;
  --gutter: var(--s-7); --gutter-sm: 20px;
  --radius-sm: 6px; --radius: 12px; --radius-lg: 18px;
  --shadow: 0 12px 35px rgb(10 10 10 / 0.08);
  --container: 1240px; --container-narrow: 760px;
  --font: "Nunito", -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1); --dur: 180ms;
  --header-h: 72px;
  color-scheme: light;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.65;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
h1, h2, h3, h4 { margin: 0; font-family: var(--font); font-weight: 700; line-height: 1.15; letter-spacing: -0.018em; color: var(--black); text-wrap: balance; }
h1 { font-size: 34px; line-height: 1.1; }
h2 { font-size: 20px; }
h3 { font-size: 17px; }
h4 { font-size: 16px; }
:where(h1, h2, h3, h4):not(:last-child) { margin-bottom: var(--s-3); }
p, ul, ol, dl, dd, figure, blockquote { margin: 0; }
fieldset { margin: 0; padding: 0; border: 0; min-width: 0; }
legend { padding: 0; font-weight: 800; font-size: 14px; color: var(--black); }
fieldset > legend + * { margin-top: var(--s-3); }
a { color: var(--link); text-decoration-thickness: 1px; text-underline-offset: 0.16em; }
a:hover { color: var(--link-hover); text-decoration-thickness: 2px; }
img { max-width: 100%; display: block; }
pre { white-space: pre-wrap; word-break: break-word; }
/* Orange ring with a black inner edge: visible on white, on orange buttons and without colour vision. */
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; box-shadow: 0 0 0 2px var(--focus-edge); }
::selection { background: var(--warning-bg); color: var(--black); }
hr { border: 0; border-top: 1px solid var(--rule); margin: var(--s-5) 0; }
.num, time, td.num, .tabular { font-variant-numeric: tabular-nums; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.85em; background: var(--paper-2); padding: 0 var(--s-1); border-radius: var(--radius-sm); }

.icon {
  width: 16px; height: 16px; flex: none;
  fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round;
  vertical-align: -0.15em;
}
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link { position: absolute; left: var(--s-3); top: var(--s-3); z-index: 100; padding: var(--s-2) var(--s-4); border-radius: var(--radius-sm); background: var(--black); color: var(--on-dark); font-weight: 700; transform: translateY(calc(-100% - var(--s-5))); }
.skip-link:focus { transform: none; }
.muted { color: var(--muted); }
.meta { color: var(--muted); font-size: 13.5px; }
a.meta { font-weight: 700; text-decoration: none; }
a.meta:hover { color: var(--black); }
.lead { color: var(--grey-700); font-size: 16px; max-width: 64ch; }
.nowrap { white-space: nowrap; }
[hidden] { display: none !important; }

/* ---------- Typography ---------- */
/* Eyebrow: RTI's small orange-dark capitals above a title. */
.kicker { font-size: 12px; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; color: var(--accent-text); }
.kicker + .page-title, .kicker + h1, .kicker + h2 { margin-top: var(--s-2); }
.page-title { font: 700 34px/1.1 var(--font); letter-spacing: -0.018em; color: var(--black); }
.page-title + .meta { margin-top: var(--s-3); }
.section-title { display: flex; align-items: baseline; gap: var(--s-3); margin: 0 0 var(--s-5); padding: 0; font: 700 20px/1.2 var(--font); letter-spacing: -0.018em; color: var(--black); }
.section-title .count { font: 600 14px var(--font); color: var(--muted); font-variant-numeric: tabular-nums; letter-spacing: 0; }

/* ---------- Layout primitives ---------- */
.container { width: 100%; max-width: calc(var(--container) + 2 * var(--gutter)); margin-inline: auto; padding-inline: var(--gutter); }
.page { padding: var(--s-7) var(--gutter) var(--s-8); display: flex; flex-direction: column; gap: var(--s-7); }
/* Tighter joins: an alert sits --s-5 above what it introduces; tabs and filters attach to the list below; the page head is --s-6 from its content. */
.page > .alert + *, .page > .tabs + *, .page > .filters + * { margin-top: calc(var(--s-5) - var(--s-7)); }
.page > .page-head + *, .page > .poll-header + * { margin-top: calc(var(--s-6) - var(--s-7)); }
.page > .page-head + .alert, .page > .poll-header + .alert { margin-top: calc(var(--s-5) - var(--s-7)); }

.stack { --stack: var(--s-4); }
.stack-md { --stack: var(--s-5); }
.stack-lg { --stack: var(--s-7); }
:is(.stack, .stack-md, .stack-lg) > * + * { margin-top: var(--stack); }

.cluster { display: flex; flex-wrap: wrap; gap: var(--s-3); align-items: center; }

.page-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: var(--s-5); }
.page-head > :first-child { min-width: 0; }
/* Header rhythm (audit R6): back link → --s-4 → state line → --s-2 → title → --s-3 → meta. */
.page-head > div:first-child > * + *, .poll-header > * + * { margin-top: var(--s-3); }
/* A screen-hidden .print-only letterhead line may sit between the back link and the kicker (results and admin poll pages). */
:is(.page-head > div:first-child, .poll-header) > a.meta:first-child + *,
:is(.page-head > div:first-child, .poll-header) > a.meta:first-child + .print-only + * { margin-top: var(--s-4); }
.page-head > div:first-child > .cluster + h1, .poll-header > .cluster + h1 { margin-top: var(--s-2); }
.page-head > div:first-child > .kicker + * { margin-top: var(--s-2); }
.page-head h1, .poll-header h1 { margin-bottom: 0; overflow-wrap: anywhere; }
.page-actions { display: flex; flex-wrap: wrap; gap: var(--s-3); }

.user-chip { display: flex; align-items: center; gap: var(--s-3); min-width: 0; }
.user-chip > :last-child { min-width: 0; overflow-wrap: anywhere; }
.user-chip__sub { display: block; margin-top: var(--s-1); }

@media (max-width: 640px) {
  :root { --gutter: var(--gutter-sm); }
  h1, .page-title { font-size: 28px; }
}
@media (min-width: 641px) and (max-width: 1023px) {
  :root { --gutter: var(--s-6); }
}

/* ---------- Panels ---------- */
.panel { padding: var(--s-6); border: 1px solid var(--rule); border-radius: var(--radius); background: var(--paper); }
.panel-strong { box-shadow: var(--shadow); }
.panel > :last-child { margin-bottom: 0; }
/* A lead paragraph under a panel title keeps a gap from what follows (forms, lists). */
.panel > p + * { margin-top: var(--s-5); }
.panel-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s-3); margin-bottom: var(--s-5); }
.panel-head > :first-child { min-width: 0; }
.panel-head .search, .panel-head .input-group { flex: 1 1 220px; min-width: 0; max-width: 360px; }
/* Titles carry their own bottom gap wherever they sit (audit R2), except inside a head row. */
.panel > h2, .panel-title { margin: 0 0 var(--s-5); font: 700 20px/1.3 var(--font); letter-spacing: -0.018em; color: var(--black); }
.panel-head h2, .panel-head .panel-title { margin: 0; }
@media (max-width: 640px) {
  .panel { padding: var(--s-5); }
}

/* ---------- Buttons ---------- */
/* RTI buttons: orange with black text, black outline, bold, 6px corners. */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s-2);
  min-height: 44px; padding: var(--s-2) var(--s-5);
  font: 700 15px/1.25 var(--font); text-align: center;
  border: 2px solid transparent; border-radius: var(--radius-sm);
  background: transparent; color: var(--black);
  cursor: pointer; text-decoration: none;
  transition: background-color var(--dur) var(--ease), color var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.btn:hover { color: var(--black); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-primary, .btn-accent { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn-primary:hover, .btn-accent:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--on-accent); }
.btn-secondary, .btn-ghost { border-color: var(--black); background: var(--paper); color: var(--black); }
.btn-secondary:hover, .btn-ghost:hover { background: var(--paper-2); }
.btn-ghost.btn-icon { border-color: transparent; background: transparent; }
.btn-ghost.btn-icon:hover { background: var(--paper-2); }
.btn-danger { border-color: var(--danger); background: var(--paper); color: var(--danger); }
.btn-danger:hover { background: var(--danger-bg); color: var(--danger); }
/* Filled danger: only the confirm button of a destructive confirm dialog (app.js, data-confirm-danger). */
.btn-danger-solid { background: var(--danger); border-color: var(--danger); color: var(--on-dark); }
.btn-danger-solid:hover { background: color-mix(in srgb, var(--danger) 86%, var(--black)); color: var(--on-dark); }
/* Text buttons: bold brown links (RTI "View event →"); 44px-tall hit area when they stand alone as controls. */
.btn-text, .link-btn {
  display: inline-flex; align-items: center; gap: var(--s-1); min-height: 44px; padding: 0; border: 0; background: none;
  font: inherit; font-weight: 800; color: var(--link); cursor: pointer;
  text-decoration: none; text-underline-offset: 0.16em;
}
.btn-text:hover, .btn-text:focus-visible, .link-btn:hover, .link-btn:focus-visible { color: var(--link-hover); text-decoration: underline; }
.btn-sm { min-height: 36px; padding: var(--s-1) var(--s-4); font-size: 14px; }
.btn-lg { min-height: 48px; padding: var(--s-3) var(--s-6); font-size: 16px; }
.btn-block { width: 100%; }
.btn-icon { width: 44px; padding: 0; }
.btn-sm.btn-icon { width: 36px; }
.inline-form { display: inline; }

/* ---------- Forms ---------- */
.form-stack { display: flex; flex-direction: column; gap: var(--s-5); }
.form-stack > fieldset + fieldset { margin-top: calc(var(--s-7) - var(--s-5)); }
.field { display: flex; flex-direction: column; gap: var(--s-2); min-width: 0; }
.field > label, .label { font-weight: 800; font-size: 14px; color: var(--black); }
.label-optional { color: var(--muted); font-weight: 600; }
.hint { color: var(--muted); font-size: 13.5px; }
input[type="text"], input[type="email"], input[type="password"], input[type="tel"], input[type="number"],
input[type="search"], input[type="datetime-local"], input[type="date"], input[type="file"], select, textarea {
  width: 100%; min-height: 46px; padding: var(--s-2) var(--s-3);
  font: inherit; color: var(--ink);
  background: var(--paper);
  border: 1.5px solid var(--control-border); border-radius: var(--radius-sm);
  transition: border-color var(--dur) var(--ease);
}
textarea { min-height: 120px; resize: vertical; }
input[type="file"] { padding: var(--s-2); }
/* Text-like controls only: checkbox and radio marks have their own state rules below. */
:is(input:not([type="checkbox"], [type="radio"]), select, textarea):hover { border-color: var(--black); }
:is(input:not([type="checkbox"], [type="radio"]), select, textarea):focus-visible { border-color: var(--black); }
:is(input:not([type="checkbox"], [type="radio"]), select, textarea):disabled { background: var(--paper-2); color: var(--muted); border-color: var(--rule); cursor: not-allowed; }
::placeholder { color: var(--muted); opacity: 1; }
.has-error input, .has-error select, .has-error textarea { border-color: var(--danger); }
.field-error { color: var(--danger); font-size: 13.5px; font-weight: 700; }
.form-row { display: grid; gap: var(--s-5); grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); }
.form-actions { display: flex; flex-wrap: wrap; gap: var(--s-3); align-items: center; }
.notify-list { display: flex; flex-direction: column; gap: var(--s-5); }
.notify-row { display: grid; gap: var(--s-4); padding-bottom: var(--s-5); border-bottom: 1px solid var(--rule); }
/* One hint paragraph, --s-2 under its label (audit 27). */
.notify-row .check .hint { margin-top: var(--s-2); }
.action-stack { display: flex; flex-direction: column; gap: var(--s-3); }

/* Custom marks: rounded-square tick for checkboxes, orange dot for radios.
   Explicit input[type] selectors; the hidden full-row .choice input overrides them further down. */
input[type="checkbox"], input[type="radio"] {
  appearance: none; flex: none; display: inline-grid; place-content: center;
  width: 20px; height: 20px; margin: 0;
  border: 2px solid var(--control-border); border-radius: 4px; background: var(--paper);
  cursor: pointer; transition: background-color var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
input[type="radio"] { border-radius: 50%; }
input[type="checkbox"]::before {
  content: ""; width: 5px; height: 10px;
  border: solid var(--on-accent); border-width: 0 2px 2px 0;
  transform: translateY(-1px) rotate(45deg) scale(0);
  transition: transform var(--dur) var(--ease);
}
input[type="checkbox"]:checked { background: var(--accent); border-color: var(--accent); }
input[type="checkbox"]:checked::before { transform: translateY(-1px) rotate(45deg) scale(1); }
input[type="radio"]::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--on-accent); transform: scale(0); transition: transform var(--dur) var(--ease); }
input[type="radio"]:checked { border-color: var(--accent); }
input[type="radio"]:checked::before { transform: scale(1); }
input[type="checkbox"]:is(:hover, :focus-visible):not(:disabled), input[type="radio"]:is(:hover, :focus-visible):not(:disabled) { border-color: var(--black); }
/* Disabled marks only fade, so a checked box keeps its fill and tick (and a radio its dot). */
input[type="checkbox"]:disabled, input[type="radio"]:disabled { opacity: 0.45; cursor: not-allowed; }
/* A field in error keeps its danger border even when checked. */
.has-error input[type="checkbox"]:checked { border-color: var(--danger); }

/* The label's first line is as tall as the 20px mark, so they align without nudges. */
.check { display: flex; align-items: flex-start; gap: var(--s-3); line-height: 1.25; cursor: pointer; }
.check .hint { display: block; margin-top: var(--s-1); line-height: 1.45; }
.check-list { display: grid; gap: var(--s-3) var(--s-5); grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
/* Name and count flow as one line of text beside the box (audit 18). */
.check-list .check { display: block; position: relative; padding-left: var(--s-6); }
.check-list .check input { position: absolute; left: 0; top: 0; }
.input-group { display: flex; gap: var(--s-2); }
.input-group > input { flex: 1; min-width: 0; }
.lock-note { display: inline-flex; align-items: center; gap: var(--s-2); color: var(--warning); font-size: 13.5px; font-weight: 700; }

/* ---------- Choices (ballot options and builder radios): bordered cards ---------- */
.choice-grid { display: flex; flex-direction: column; gap: var(--s-3); }
.choice { position: relative; display: block; cursor: pointer; }
.choice input, .choice input:disabled { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.choice-body {
  display: flex; align-items: flex-start; gap: var(--s-4);
  padding: var(--s-4); border: 2px solid var(--control-border); border-radius: var(--radius); background: var(--paper);
  font-size: 16px; line-height: 1.5;
  transition: border-color var(--dur) var(--ease), background-color var(--dur) var(--ease);
}
/* A 24px cell (= one 16px/1.5 line) holding the 22px ring, the dot and the tick, so the mark sits on the first line. */
.choice-icon { display: grid; place-items: center; flex: none; width: 24px; height: 24px; }
.choice-icon > *, .choice-icon::before, .choice-icon::after { grid-area: 1 / 1; }
.choice-icon::before {
  content: ""; width: 22px; height: 22px;
  border: 2px solid var(--grey-700); border-radius: 50%; background: var(--paper);
  transition: border-color var(--dur) var(--ease), background-color var(--dur) var(--ease);
}
.choice-icon::after { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--on-accent); transform: scale(0); transition: transform var(--dur) var(--ease); }
.choice-icon .icon { display: none; }
.choice-label { font-weight: 700; color: var(--black); }
.choice:hover .choice-body { border-color: var(--black); }
.choice input:focus-visible + .choice-body { outline: 3px solid var(--focus); outline-offset: 2px; box-shadow: 0 0 0 2px var(--focus-edge); }
.choice input:checked + .choice-body { border-color: var(--accent); background: var(--tint); }
.choice input:checked + .choice-body .choice-icon::before { border-color: var(--accent); }
.choice input:checked + .choice-body .choice-icon::after { transform: scale(1); }
.choice input:checked + .choice-body .choice-label { font-weight: 800; }
.choice input[type="checkbox"] + .choice-body .choice-icon::before { border-radius: 4px; }
.choice input[type="checkbox"] + .choice-body .choice-icon::after { display: none; }
.choice input[type="checkbox"]:checked + .choice-body .choice-icon::before { background: var(--accent); border-color: var(--accent); }
.choice input[type="checkbox"]:checked + .choice-body .choice-icon .icon { display: block; width: 14px; height: 14px; stroke-width: 3; color: var(--on-accent); }
/* Disabled (preview, or max choices reached): the card and its mark fade; the input itself stays invisible. */
.choice input:disabled { cursor: not-allowed; }
.choice input:disabled + .choice-body { opacity: 0.45; }
.choice:hover input:disabled + .choice-body { border-color: var(--control-border); }

/* ---------- Status pills, alerts ---------- */
/* .state was a coloured word; it is now an RTI pill. Grey by default. */
.state {
  display: inline-flex; align-items: center; gap: var(--s-1);
  padding: var(--s-1) var(--s-3); border-radius: 999px;
  font-size: 12px; font-weight: 800; line-height: 1.2; letter-spacing: 0; text-transform: none; white-space: nowrap;
  background: var(--rule); color: var(--grey-700);
}
.state .icon { width: 13px; height: 13px; }
.state-open, .state-top { background: var(--warning-bg); color: var(--warning); }
.state-success { background: var(--success-bg); color: var(--success); }
.state-warning { background: var(--warning-bg); color: var(--warning); }
.state-danger { background: var(--danger-bg); color: var(--danger); }
.state-closed, .state-draft, .state-scheduled, .state-muted { background: var(--rule); color: var(--grey-700); }

/* Rule Book author chips: one pale palette colour per author (0 = working doc), always with the label text. */
.rb-chip {
  display: inline-flex; align-items: center; padding: var(--s-1) var(--s-2); border: 1px solid rgb(10 10 10 / 0.12); border-radius: 999px;
  font-size: 12px; font-weight: 800; line-height: 1.2; white-space: nowrap; color: var(--black); background: var(--rb-c0);
}
.rb-chip--0 { background: var(--rb-c0); }
.rb-chip--1 { background: var(--rb-c1); }
.rb-chip--2 { background: var(--rb-c2); }
.rb-chip--3 { background: var(--rb-c3); }
.rb-chip--4 { background: var(--rb-c4); }
.rb-chip--5 { background: var(--rb-c5); }
.rb-chip--6 { background: var(--rb-c6); }
.rb-chip--7 { background: var(--rb-c7); }
.rb-chip--8 { background: var(--rb-c8); }
a.rb-chip { text-decoration: none; }
a.rb-chip:hover { text-decoration: underline; text-underline-offset: 0.16em; }
/* Withdrawn: struck through and dashed, never colour alone. */
.rb-chip--withdrawn { border-style: dashed; text-decoration: line-through; }
.rb-chip--lg { padding: var(--s-2) var(--s-4); font-size: 18px; white-space: normal; }
.rb-chips { display: flex; flex-wrap: wrap; gap: var(--s-2); }

/* ---------- Rule Book admin ---------- */
.rb-text { white-space: pre-wrap; overflow-wrap: anywhere; max-width: 72ch; }
.rb-stage > * + * { margin-top: var(--s-4); }
.rb-stage > .section-title { margin-bottom: 0; }
.rb-stepper { display: flex; flex-wrap: wrap; gap: var(--s-2) var(--s-5); margin: 0; padding: 0; list-style: none; }
.rb-step { display: flex; align-items: center; gap: var(--s-2); color: var(--muted); font-size: 14.5px; font-weight: 700; }
.rb-step__num { flex: none; display: inline-grid; place-items: center; width: 26px; height: 26px; border: 2px solid var(--control-border); border-radius: 50%; font: 800 12px/1 var(--font); font-variant-numeric: tabular-nums; color: var(--grey-700); }
.rb-step.is-done { color: var(--ink); }
.rb-step.is-done .rb-step__num { background: var(--black); border-color: var(--black); color: var(--on-dark); }
.rb-step.is-current { color: var(--black); }
.rb-step.is-current .rb-step__num { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.rb-part-title { margin: var(--s-5) 0 var(--s-3); font-size: 17px; }
.rb-part-add { margin: var(--s-3) 0 0; }
.rb-part-title .meta { font-weight: 600; }
.rb-settings { container-type: inline-size; }
.rb-settings > .section-title { margin-bottom: var(--s-2); }
.rb-settings > .meta { margin-bottom: var(--s-5); }
.rb-settings__actions { padding-top: var(--s-5); border-top: 1px solid var(--rule); }
.rb-stored { padding: var(--s-4); border-radius: var(--radius-sm); background: var(--paper-2); }
.rb-stored > * + * { margin-top: var(--s-2); }
.rb-proposal-list { display: grid; gap: var(--s-2); margin: 0; padding: 0; list-style: none; }
.rb-proposal-list li { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2); }
.rb-preview { border: 1px solid var(--rule); border-radius: var(--radius-sm); background: var(--paper); }
.rb-preview + .rb-preview { margin-top: var(--s-2); }
.rb-preview > summary { padding: var(--s-3) var(--s-4); cursor: pointer; overflow-wrap: anywhere; }
.rb-preview__body { display: grid; gap: var(--s-4); padding: 0 var(--s-4) var(--s-4); }
.rb-preview__proposal { padding-top: var(--s-4); border-top: 1px solid var(--rule); }
.rb-preview__proposal > * + * { margin-top: var(--s-2); }
.rb-diff del, .rb-diff ins { display: block; padding: var(--s-2) var(--s-3); border-radius: var(--radius-sm); white-space: pre-wrap; overflow-wrap: anywhere; text-decoration: none; color: var(--ink); }
.rb-diff del { background: var(--danger-bg); }
.rb-diff ins { background: var(--success-bg); }
.rb-diff del + .sr-only + ins { margin-top: var(--s-2); }
@media (min-width: 761px) { .rb-history td.rb-diff { width: 50%; } }

/* ---------- Rule Book comparison table (members and admins) ---------- */
.rb-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s-3) var(--s-5); }
.rb-filters { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-3) var(--s-5); }
.js .rb-filters__submit, .js .rb-answer__save { display: none; }
.rb-jump { position: relative; }
.rb-jump > summary { display: inline-flex; align-items: center; min-height: 44px; font-weight: 700; color: var(--link); cursor: pointer; }
.rb-jump > ul { position: absolute; right: 0; z-index: 15; display: grid; gap: 0 var(--s-4); grid-template-columns: repeat(2, minmax(0, 1fr)); width: min(420px, 90vw); max-height: 60vh; overflow-y: auto; margin: 0; padding: var(--s-3) var(--s-4); list-style: none; border: 1px solid var(--rule); border-radius: var(--radius); background: var(--paper); box-shadow: var(--shadow); }
.rb-jump a { display: block; padding: var(--s-1) 0; font-size: 14.5px; font-weight: 700; }
.rb-table-wrap { border: 1px solid var(--rule); border-radius: var(--radius); background: var(--paper); }
.rb-table { width: 100%; border-collapse: collapse; table-layout: fixed; font-size: 14.5px; }
.rb-table thead th {
  padding: var(--s-3) var(--s-4); background: var(--paper-2); border-bottom: 1px solid var(--rule);
  text-align: left; font-size: 12px; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted);
}
/* #a<id> / #p<id> targets land below the sticky site header; the cell padding gives them air. */
.rb-table [id] { scroll-margin-top: var(--header-h); }
.rb-table thead th:nth-child(1) { width: 27%; }
.rb-table thead th:nth-child(2) { width: 30%; }
.rb-table thead th:nth-child(3) { width: 23%; }
.rb-table thead th:nth-child(4) { width: 20%; }
.rb-table--admin thead th:nth-child(1) { width: 32%; }
.rb-table--admin thead th:nth-child(2) { width: 40%; }
.rb-table--admin thead th:nth-child(3) { width: 28%; }
.rb-table td { padding: var(--s-4); border-top: 1px solid var(--rule); vertical-align: top; overflow-wrap: anywhere; }
.rb-table td > * + * { margin-top: var(--s-3); }
.rb-table .rb-row--first > td { border-top: 2px solid var(--control-border); }
.rb-original { background: var(--paper-2); }
.rb-part-row th { padding: var(--s-4); border-top: 2px solid var(--black); background: var(--paper); text-align: left; font: 800 18px/1.3 var(--font); color: var(--black); }
.rb-part-row .meta { font-size: 13.5px; font-weight: 600; }
.rb-part-end td { padding: var(--s-4); border-top: 1px solid var(--rule); }
.rb-article-label { font: 800 16px/1.35 var(--font); color: var(--black); }
.rb-table .rb-text { max-width: none; }
.rb-proposal__head { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2); }
.rb-actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-1) var(--s-4); }
.rb-actions .btn-text { min-height: 36px; font-size: 14px; }
.rb-row--withdrawn .rb-text { color: var(--muted); text-decoration: line-through; }
.rb-badges { display: flex; flex-wrap: wrap; gap: var(--s-2); }
.rb-counts { font-variant-numeric: tabular-nums; }
/* Yes / No / Abstention: one segmented radio group per proposal; the radios stay focusable (arrow keys) under the labels. */
.rb-answer > * + * { margin-top: var(--s-2); }
.rb-seg { display: flex; flex-wrap: wrap; min-inline-size: 0; margin: 0; padding: 0; border: 0; }
.rb-seg__opt { position: relative; display: flex; margin-left: -1px; cursor: pointer; }
.rb-seg > legend + .rb-seg__opt { margin-top: 0; }
.rb-seg__opt:first-of-type { margin-left: 0; }
.rb-seg__opt input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; border: 0; opacity: 0; cursor: pointer; }
.rb-seg__opt span {
  display: inline-flex; align-items: center; min-height: 40px; padding: var(--s-2) var(--s-3); border: 1.5px solid var(--control-border); background: var(--paper);
  font-size: 14px; font-weight: 700; line-height: 1.2; color: var(--ink); transition: background-color var(--dur) var(--ease), color var(--dur) var(--ease);
}
.rb-seg__opt:first-of-type span { border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.rb-seg__opt:last-of-type span { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.rb-seg__opt:hover span { background: var(--paper-2); }
.rb-seg__opt input:checked + span { position: relative; border-color: var(--black); background: var(--black); color: var(--on-dark); font-weight: 800; }
.rb-seg__opt input:focus-visible + span { position: relative; z-index: 1; outline: 3px solid var(--focus); outline-offset: 2px; box-shadow: 0 0 0 2px var(--focus-edge); }
/* Round 1 progress, and the anonymous ballot's sticky submit bar. */
.rb-progress { display: grid; gap: var(--s-2); padding: var(--s-5); border-radius: var(--radius); background: var(--paper-2); }
.rb-progress .meter { width: 100%; max-width: 420px; height: 8px; margin-top: 0; }
.rb-progress__count { font: 800 20px/1.3 var(--font); color: var(--black); font-variant-numeric: tabular-nums; }
.rb-ballot-bar { position: sticky; bottom: var(--s-3); z-index: 10; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s-3) var(--s-5); padding: var(--s-4) var(--s-5); border: 1px solid var(--rule); border-radius: var(--radius); background: var(--paper); box-shadow: var(--shadow); }
.rb-ballot-bar__text { flex: 1 1 280px; min-width: 0; }
.rb-ballot-bar .rb-progress__count { font-size: 16px; }
.rb-form { max-width: 760px; }
@media (max-width: 760px) {
  /* Phones: each article reads as a card — original text, then each proposal with its evidence and vote. */
  .rb-table-wrap { border: 0; background: none; }
  .rb-table thead { display: none; }
  .rb-table, .rb-table tbody, .rb-table tr, .rb-table td, .rb-table th { display: block; width: 100%; }
  .rb-table tbody + tbody { margin-top: var(--s-6); }
  .rb-part-row th { padding: 0 0 var(--s-3); border-top: 0; }
  .rb-table tr.rb-row { border: 1px solid var(--rule); border-top: 0; background: var(--paper); }
  .rb-table tr.rb-row--first { margin-top: var(--s-4); border-top: 1px solid var(--rule); border-radius: var(--radius) var(--radius) 0 0; overflow: hidden; }
  .rb-table td, .rb-table .rb-row--first > td { padding: var(--s-3) var(--s-4); border-top: 0; }
  .rb-table td + td { padding-top: 0; }
  .rb-table td.rb-original { border-bottom: 1px solid var(--rule); }
  .rb-table tr.rb-row:not(.rb-row--first) > td:first-child { border-top: 1px dashed var(--rule); padding-top: var(--s-3); }
  .rb-table td:empty { display: none; }
  .rb-table td[data-label]::before { content: attr(data-label); display: block; margin-bottom: var(--s-1); color: var(--muted); font-size: 11px; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; }
  .rb-table td.rb-proposal::before, .rb-table td.rb-original::before { display: none; }
  .rb-part-end td { padding: var(--s-4) 0 0; border: 0; }
  .rb-jump > ul { left: 0; right: auto; }
  .rb-ballot-bar { bottom: 0; border-radius: var(--radius) var(--radius) 0 0; }
  .rb-ballot-bar form { flex: 1 1 100%; }
  .rb-ballot-bar .btn { width: 100%; }
}

/* ---------- Rule Book results ---------- */
.rb-results > * + * { margin-top: var(--s-5); }
.rb-result { padding: var(--s-5); border: 1px solid var(--rule); border-radius: var(--radius); background: var(--paper); }
.rb-result > * + * { margin-top: var(--s-4); }
.rb-outcome { font-weight: 800; color: var(--black); }
.rb-result__round { padding-top: var(--s-4); border-top: 1px solid var(--rule); }
.rb-result__round > * + * { margin-top: var(--s-3); }
.rb-result__proposal + .rb-result__proposal { padding-top: var(--s-4); border-top: 1px dashed var(--rule); }
.rb-result__proposal > * + * { margin-top: var(--s-3); }
.rb-result .bar-row { padding: var(--s-2) 0; }
.rb-result .bar-row:first-child { padding-top: 0; }
.rb-voters { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: var(--s-1) var(--s-4); margin: 0; font-size: 13.5px; }
.rb-voters dt { font-weight: 800; color: var(--black); }
.rb-voters dd { margin: 0; color: var(--grey-700); overflow-wrap: anywhere; }

/* ---------- Rule Book live AGM (member page, projector, control card) ---------- */
.rb-live { margin-top: var(--s-6); }
.rb-live__wait { padding: var(--s-7) var(--s-5); border: 1px dashed var(--control-border); border-radius: var(--radius); background: var(--paper-2); text-align: center; }
.rb-live__wait > * + * { margin-top: var(--s-2); }
.rb-live__wait-title { font: 800 20px/1.3 var(--font); color: var(--black); }
.rb-live__item { display: grid; gap: var(--s-5); }
.rb-live__head { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2) var(--s-3); }
.rb-live__head .kicker { flex: 1 1 100%; }
.rb-live__label { font-size: 28px; overflow-wrap: anywhere; }
.rb-live__meter { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: var(--s-2) var(--s-5); padding: var(--s-4) var(--s-5); border-radius: var(--radius); background: var(--paper-2); }
.rb-live__timer { display: flex; align-items: baseline; gap: var(--s-3); }
.rb-live__clock { font: 800 32px/1.1 var(--font); color: var(--black); font-variant-numeric: tabular-nums; }
.rb-live__turnout { font-weight: 800; color: var(--black); font-variant-numeric: tabular-nums; }
.rb-live__ballot > * + * { margin-top: var(--s-4); }
.rb-live__ballot legend.panel-title { margin-bottom: 0; }
.rb-live__option { display: flex; flex-direction: column; align-items: flex-start; gap: var(--s-2); min-width: 0; }
.rb-live__text { font-size: 15px; color: var(--ink); }
.rb-live__options { display: grid; gap: var(--s-3); margin: 0; padding: 0; list-style: none; }
.rb-live__options > li { padding: var(--s-4); border: 1px solid var(--rule); border-radius: var(--radius); background: var(--paper); }
.rb-live__result > * + * { margin-top: var(--s-3); }
.rb-live__outcome { font: 800 20px/1.3 var(--font); color: var(--black); }
/* Admin control */
.rb-agm-current > .panel-title + * { margin-top: 0; }
.rb-agm__controls { display: grid; justify-items: start; gap: var(--s-4); margin-top: var(--s-5); padding-top: var(--s-5); border-top: 1px solid var(--rule); }
.rb-agm__open { display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--s-3); }
.rb-agm__next { font-weight: 800; color: var(--black); }
.rb-agm-order .is-current { background: var(--tint); }
.rb-agm-order .rb-chips { margin-top: var(--s-1); }
/* Projector: one screen, large type, no navigation. */
.layout-projector { background: var(--paper); }
.projector-main { min-height: 100vh; padding: var(--s-6) var(--s-7); }
.rb-screen { display: flex; flex-direction: column; gap: var(--s-6); max-width: 1680px; margin: 0 auto; }
.rb-screen__bar { display: flex; align-items: center; justify-content: space-between; gap: var(--s-4); }
.rb-screen__brand { display: flex; align-items: center; gap: var(--s-3); font: 800 20px/1.3 var(--font); color: var(--black); }
.rb-screen .kicker { font-size: 18px; }
.rb-screen .rb-live__label { font-size: 56px; }
.rb-screen .state { padding: var(--s-2) var(--s-4); font-size: 20px; }
.rb-screen .rb-live__meter { padding: var(--s-5) var(--s-6); }
.rb-screen .rb-live__clock { font-size: clamp(48px, 14vw, 96px); }
.rb-screen .rb-live__timer .meta, .rb-screen .rb-live__turnout { font-size: 28px; }
.rb-screen .rb-live__options > li { padding: var(--s-5); }
.rb-screen .rb-live__option .choice-label, .rb-screen .rb-live__option .rb-chip { font-size: 28px; }
.rb-screen .rb-live__text { font-size: 22px; max-width: none; }
.rb-screen .rb-live__wait { padding: var(--s-8) var(--s-6); }
.rb-screen .rb-live__wait-title { font-size: 44px; }
.rb-screen .rb-live__outcome { font-size: 40px; }
.rb-screen .aside-title, .rb-screen .rb-live__result .meta { font-size: 18px; }
.rb-screen .bar-label { font-size: 28px; }
.rb-screen .bar-value, .rb-screen .bar-value strong { font-size: 24px; }
.rb-screen .bar { height: 20px; }

/* RTI quote style: a 4px status bar on the left of a tinted, rounded block. */
.alert { display: flex; gap: var(--s-3); align-items: flex-start; padding: var(--s-4); border-left: 4px solid var(--muted); border-radius: var(--radius); background: var(--info-bg); color: var(--ink); }
.alert > .icon { height: 1.65em; color: var(--grey-700); }
.alert-success { border-left-color: var(--success); background: var(--success-bg); }
.alert-success > .icon { color: var(--success); }
.alert-warning { border-left-color: var(--accent); background: var(--warning-bg); }
.alert-warning > .icon { color: var(--warning); }
.alert-danger { border-left-color: var(--danger); background: var(--danger-bg); }
.alert-danger > .icon { color: var(--danger); }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--rule); border-radius: var(--radius); background: var(--paper); }
.data-table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.data-table th {
  padding: var(--s-3) var(--s-4); background: var(--paper-2); border-bottom: 1px solid var(--rule);
  text-align: left; font-size: 12px; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted);
}
.data-table td { padding: var(--s-4); border-bottom: 1px solid var(--rule); vertical-align: top; }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table tbody tr:hover td { background: var(--paper-2); }
.data-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.data-table a:not(.btn) { color: var(--black); font-weight: 700; text-decoration: none; }
.data-table a:not(.btn):hover { color: var(--link); text-decoration: underline; }
.data-table td > .meta { margin-top: var(--s-1); }
.cell-title, .data-table a.cell-title { display: inline-block; font: 700 16px/1.35 var(--font); overflow-wrap: anywhere; }
/* Thin turnout bar (SVG, width via attribute): orange on a light track, rounded. */
.meter { display: block; width: 120px; max-width: 100%; height: 6px; margin-top: var(--s-2); border-radius: 999px; overflow: hidden; }
.aside-block > .meter { width: 100%; height: 8px; }
.meter-track { fill: var(--rule); }
.meter-fill { fill: var(--accent); transform-box: fill-box; transform-origin: left center; animation: grow var(--dur) var(--ease) both; }
@media (max-width: 760px) {
  .data-table thead { display: none; }
  .data-table, .data-table tbody, .data-table tr, .data-table td { display: block; width: 100%; }
  .data-table tr { padding: var(--s-3) var(--s-4); border-bottom: 1px solid var(--rule); }
  .data-table tbody tr:last-child { border-bottom: 0; }
  .data-table td, .data-table tbody tr:last-child td { padding: var(--s-2) 0; border: 0; }
  .data-table tbody tr:hover td { background: none; }
  .data-table td:empty { display: none; }
  /* Label stacked above its value, so multi-part cells read as one line (audit 20). */
  .data-table td[data-label]::before { content: attr(data-label); display: block; margin-bottom: var(--s-1); color: var(--muted); font-size: 11px; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; }
  .data-table .num { text-align: left; }
}

/* ---------- Row lists: rows inside one bordered card (mockup B) ---------- */
.rule-list { list-style: none; margin: 0; padding: 0; border: 1px solid var(--rule); border-radius: var(--radius); background: var(--paper); overflow: hidden; }
.rule-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--s-5); align-items: center; padding: var(--s-4) var(--s-5); border-top: 1px solid var(--rule); }
.rule-list > .rule-row:first-child { border-top: 0; }
.rule-row__title { margin: 0; font: 700 17px/1.3 var(--font); letter-spacing: -0.01em; color: var(--black); overflow-wrap: anywhere; }
.rule-row__title a { color: var(--black); text-decoration: none; transition: color var(--dur) var(--ease); }
.rule-row__title + .meta { margin-top: var(--s-1); }
.rule-row__tags { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2); margin-top: var(--s-2); }
.rule-row__action { display: flex; align-items: center; justify-content: flex-end; gap: var(--s-3); }
.rule-row__action .meter { margin-top: 0; }
/* Line rows: compact, name on the left and a pill or action on the right; the right part drops below when space runs out. */
.rule-row.rule-row--line { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s-3) var(--s-4); padding: var(--s-3) var(--s-5); }
.rule-row--line > :first-child { flex: 1 1 220px; min-width: 0; overflow-wrap: anywhere; }
.rule-row__end { margin-left: auto; }
@media (max-width: 640px) {
  /* Once wrapped, the right part starts on the content edge; forms take the full row. */
  .rule-row__end { margin-left: 0; }
  .rule-row--line > .input-group { flex: 1 1 100%; }
}
/* Poll rows: the whole row is the title link's hit area; real links in the action slot sit above it. */
.poll-row { position: relative; transition: background-color var(--dur) var(--ease); }
.poll-row .rule-row__title a::after { content: ""; position: absolute; inset: 0; }
.poll-row:hover { background: var(--paper-2); }
.poll-row:hover .rule-row__title a { color: var(--link); }
.poll-row .rule-row__action a { position: relative; z-index: 1; }
@supports selector(:has(*)) {
  .poll-row .rule-row__title a:focus-visible { outline: 0; box-shadow: none; }
  .poll-row:has(.rule-row__title a:focus-visible) { outline: 3px solid var(--focus); outline-offset: -3px; box-shadow: inset 0 0 0 5px var(--focus-edge); }
}
@media (max-width: 640px) {
  .rule-row { grid-template-columns: minmax(0, 1fr); gap: var(--s-3); padding: var(--s-4); }
  .rule-row__action { justify-content: stretch; }
  .rule-row__action .btn { flex: 1 1 auto; }
}

/* ---------- Tabs, filters, pagination ---------- */
.tabs { display: flex; gap: var(--s-5); border-bottom: 1px solid var(--rule); overflow-x: auto; }
.tab { position: relative; display: inline-flex; align-items: center; gap: var(--s-2); min-height: 44px; padding: var(--s-2) 0; font-size: 14.5px; font-weight: 700; color: var(--grey-700); text-decoration: none; white-space: nowrap; }
.tab::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: var(--accent); transform: scaleX(0); transition: transform var(--dur) var(--ease); }
.tab:hover { color: var(--black); }
.tab[aria-current="page"] { color: var(--black); font-weight: 800; }
.tab[aria-current="page"]::after { transform: scaleX(1); }
.tab-count { font-variant-numeric: tabular-nums; color: var(--muted); font-weight: 600; }
.filters { display: flex; flex-wrap: wrap; gap: var(--s-4); align-items: flex-end; }
.filters .field { min-width: 160px; }
.filters .field-grow { flex: 1 1 240px; }
@media (max-width: 640px) {
  .filters .field, .filters .field-grow, .filters .btn { flex: 1 1 100%; }
}
.pagination { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s-3); padding: var(--s-4) 0; color: var(--muted); font-size: 13.5px; font-variant-numeric: tabular-nums; }
.pagination .cluster { gap: var(--s-2); }
/* Prev/next beside a page's actions (Rule Book article and proposal pages). */
.page-actions:has(> .pagination) { align-items: center; }
.page-actions > .pagination { padding: 0; }

/* ---------- Avatars and brand ---------- */
.avatar {
  display: inline-grid; place-items: center; flex: none; width: 40px; height: 40px;
  border-radius: 50%; background: var(--tint); color: var(--black);
  font-weight: 800; font-size: 13px; letter-spacing: 0.02em; object-fit: cover; overflow: hidden;
}
.avatar-sm { width: 32px; height: 32px; font-size: 11px; }
.avatar-lg { width: 96px; height: 96px; font: 800 32px var(--font); }
.brand { display: inline-flex; align-items: center; gap: var(--s-3); min-width: 0; font: 800 19px/1.2 var(--font); letter-spacing: -0.01em; color: var(--black); text-decoration: none; }
.brand:hover { color: var(--black); }
.brand-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.logo { flex: none; border-radius: 50%; object-fit: cover; }
.logo-sm { width: 46px; height: 46px; }
.logo-lg { width: 68px; height: 68px; }
/* RTI horizontal lockup (rondel height = 1): "ROUND" heavy + "TABLE" light at ~0.43, the rest of the club name
   small and widely spaced underneath, right-aligned to the end of "TABLE". The sub line stays >= 9px to be legible. */
.wordmark { display: inline-flex; flex-direction: column; align-items: flex-end; min-width: 0; line-height: 1; color: var(--black); }
.wordmark__main { font-size: 20px; font-weight: 300; letter-spacing: 0; white-space: nowrap; }
.wordmark__main b { font-weight: 900; }
/* letter-spacing also trails the last letter, which would end it short of TABLE; the translate takes that back. */
.wordmark__sub { max-width: 100%; margin-top: var(--s-1); transform: translateX(0.32em); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 9.5px; font-weight: 700; letter-spacing: 0.32em; }

/* ---------- Member shell ---------- */
.site-header { position: sticky; top: 0; z-index: 20; background: var(--paper); border-bottom: 1px solid var(--rule); }
.site-header-inner { display: flex; align-items: center; gap: var(--s-6); min-height: var(--header-h); }
.site-header .brand { margin-right: auto; }
.menu-toggle { display: none; }
.site-menu { display: flex; align-items: center; gap: var(--s-6); }
.site-nav { display: flex; gap: var(--s-5); }
.site-nav a { display: inline-flex; align-items: center; min-height: 44px; border-bottom: 3px solid transparent; border-top: 3px solid transparent; font-size: 15px; font-weight: 750; color: var(--ink); text-decoration: none; white-space: nowrap; transition: color var(--dur) var(--ease), border-color var(--dur) var(--ease); }
.site-nav a:hover { color: var(--accent-text); }
.site-nav a[aria-current="page"] { color: var(--black); border-bottom-color: var(--accent); }
/* Language switch and sign-out: one rhythm (audit 30). */
.header-actions { display: flex; align-items: center; gap: var(--s-4); padding-left: var(--s-5); border-left: 1px solid var(--rule); }
.header-actions .btn { white-space: nowrap; }
/* Narrow desktops: the five-link menu (with "Statuts") stays on one line; below 821px it folds behind the menu button. */
@media (min-width: 821px) and (max-width: 960px) {
  .site-header-inner, .site-menu { gap: var(--s-4); }
  .site-nav { gap: var(--s-4); }
  .header-actions { gap: var(--s-3); padding-left: var(--s-4); }
}
@media (max-width: 820px) {
  .site-header-inner { flex-wrap: wrap; gap: 0 var(--s-3); min-height: 0; padding-block: var(--s-2); }
  .site-header .brand { flex: 1 1 0; }
  .js .menu-toggle { display: inline-flex; }
  /* The menu collapses behind the toggle (app.js toggles body.sidebar-open); without JS it stays open. */
  .site-menu { flex: 1 1 100%; flex-direction: column; align-items: stretch; gap: var(--s-4); margin-top: var(--s-2); padding-block: var(--s-2) var(--s-4); border-top: 1px solid var(--rule); }
  .js .site-menu { display: none; }
  .js .sidebar-open .site-menu { display: flex; }
  .site-nav { flex-direction: column; gap: 0; }
  /* RTI mobile menu: tall rows, current item with an orange bar on a pale-orange ground. */
  .site-nav a, .site-nav a[aria-current="page"] { min-height: 56px; padding-left: var(--s-3); border-top: 0; border-bottom: 1px solid var(--rule); border-left: 4px solid transparent; }
  .site-nav a[aria-current="page"] { border-left-color: var(--accent); background: var(--tint); }
  .header-actions { padding-left: 0; border-left: 0; }
  .header-actions .inline-form { margin-left: auto; }
}

/* ---------- Admin shell: top bar over a light sidebar (mockup A) ---------- */
.admin-header-inner { display: flex; align-items: center; gap: var(--s-5); min-height: var(--header-h); padding-inline: var(--gutter); }
.admin-header .brand { margin-right: auto; }
.brand-kicker { flex: none; padding: var(--s-1) var(--s-2); border-radius: var(--radius-sm); background: var(--black); color: var(--on-dark); font: 800 11px/1.2 var(--font); letter-spacing: 0.1em; text-transform: uppercase; }
.admin-header-actions { gap: var(--s-5); padding-left: 0; border-left: 0; }
.admin-header-actions .btn-text { color: var(--ink); font-weight: 700; }
.admin-header-actions .btn-text:hover { color: var(--black); }
.admin-shell { display: grid; grid-template-columns: 232px minmax(0, 1fr); min-height: calc(100vh - var(--header-h)); }
.sidebar { position: sticky; top: var(--header-h); align-self: start; max-height: calc(100vh - var(--header-h)); overflow-y: auto; padding: var(--s-5) var(--s-3); border-right: 1px solid var(--rule); background: var(--paper); }
.sidebar-nav { display: flex; flex-direction: column; gap: var(--s-5); }
.sidebar-label { margin-bottom: var(--s-2); padding-left: var(--s-4); font-size: 11px; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.sidebar a { display: block; padding: var(--s-2) var(--s-3); border-left: 4px solid transparent; border-radius: 0 var(--radius-sm) var(--radius-sm) 0; font-size: 14.5px; font-weight: 700; line-height: 1.4; color: var(--ink); text-decoration: none; transition: background-color var(--dur) var(--ease), color var(--dur) var(--ease); }
.sidebar a:hover { background: var(--paper-2); color: var(--black); }
.sidebar a[aria-current="page"] { border-left-color: var(--accent); background: var(--tint); color: var(--black); }
.sidebar-foot { display: none; }
.admin-main { min-width: 0; max-width: calc(var(--container) + 2 * var(--gutter)); }
@media (max-width: 1023px) {
  .admin-shell { grid-template-columns: minmax(0, 1fr); }
  .admin-header { z-index: 50; }
  .admin-header-inner { flex-wrap: wrap; gap: var(--s-3); }
  .js .admin-header .menu-toggle { display: inline-flex; }
  .js .header-wide { display: none; }
  /* The drawer opens under the top bar, so the menu button stays reachable to close it. */
  .js .sidebar { position: fixed; top: var(--header-h); bottom: 0; left: 0; z-index: 40; width: min(288px, 85vw); max-height: none; box-shadow: var(--shadow); transform: translateX(-100%); visibility: hidden; transition: transform var(--dur) var(--ease), visibility var(--dur); }
  .js .sidebar-open .sidebar { transform: none; visibility: visible; }
  .js .sidebar-open .admin-main::before { content: ""; position: fixed; inset: var(--header-h) 0 0 0; z-index: 30; background: var(--scrim); }
  .js .sidebar a, .js .sidebar .btn-text { min-height: 44px; display: flex; align-items: center; }
  .js .sidebar-foot { display: flex; flex-direction: column; margin-top: var(--s-6); padding-top: var(--s-4); border-top: 1px solid var(--rule); }
  .sidebar-foot a, .sidebar-foot .btn-text { color: var(--grey-700); }
  /* Without JS the sidebar is a plain block above the content. */
  .sidebar { position: static; max-height: none; border-right: 0; border-bottom: 1px solid var(--rule); }
}
@media (max-width: 480px) {
  .admin-header .brand-kicker { display: none; }
}

/* ---------- Public (auth, setup, error) shell: a centred card on pale grey (approved login mockup) ---------- */
/* The shell is at least the viewport tall (dvh where supported) with the card centred in it; paddings are sized so
   /login and /forgot fit without scrolling down to 360x640. Longer content simply grows the shell and scrolls (reflow). */
.auth-main { display: flex; justify-content: center; align-items: center; min-height: 100vh; min-height: 100dvh; padding: var(--s-6) var(--gutter); background: var(--paper-2); }
.auth-column { width: min(440px, 100%); display: flex; flex-direction: column; gap: var(--s-6); padding: var(--s-6); border: 1px solid var(--rule); border-radius: var(--radius-lg); background: var(--paper); box-shadow: var(--shadow); }
/* Horizontal lockup centred in the card: rondel, then the wordmark (or the plain club name) vertically centred on it. */
.auth-brand { display: flex; align-items: center; justify-content: center; gap: calc(var(--s-4) + var(--s-1)); min-width: 0; color: var(--black); text-decoration: none; }
.auth-brand:hover { color: var(--black); }
.auth-brand .wordmark__main { font-size: 29px; }
.auth-brand .wordmark__sub { font-size: 10px; }
.auth-brand .brand-name { font: 800 22px/1.2 var(--font); letter-spacing: -0.018em; white-space: normal; overflow-wrap: anywhere; }
.auth-section > * + * { margin-top: var(--s-6); }
.auth-head > * + * { margin-top: var(--s-3); }
.auth-head > .kicker + * { margin-top: var(--s-2); }
.auth-head h1 { margin-bottom: 0; font-size: 26px; overflow-wrap: anywhere; }
.auth-section > .auth-links { margin-top: var(--s-5); font-size: 14px; }
.auth-foot { display: flex; justify-content: center; padding-top: var(--s-4); border-top: 1px solid var(--rule); }
/* Language buttons --s-3 apart (audit 29). */
.lang-switch { display: flex; gap: var(--s-3); }
.lang-btn { min-height: 44px; padding: var(--s-2) 0; border: 0; border-bottom: 3px solid transparent; background: none; font: 700 13px var(--font); color: var(--muted); cursor: pointer; }
.lang-btn:hover { color: var(--black); }
.lang-btn[aria-pressed="true"] { color: var(--black); font-weight: 800; border-bottom-color: var(--accent); }
@media (max-width: 640px) {
  .auth-main { padding-block: var(--s-4); }
  .auth-column { gap: var(--s-5); padding: var(--s-5); }
}
/* Narrow phones: a smaller lockup so ROUNDTABLE never truncates in a 360px viewport. */
@media (max-width: 400px) {
  .auth-brand { gap: var(--s-4); }
  .auth-brand .logo-lg { width: 60px; height: 60px; }
  .auth-brand .wordmark__main { font-size: 26px; }
  .auth-brand .wordmark__sub { font-size: 9px; }
}
/* 320px (WCAG reflow width) and below: one more step so the unclipped nowrap ROUNDTABLE never slides over the rondel. */
@media (max-width: 340px) {
  .auth-brand { gap: var(--s-3); }
  .auth-brand .logo-lg { width: 48px; height: 48px; }
  .auth-brand .wordmark__main { font-size: 21px; }
}
/* Short screens: tighten the vertical rhythm so the login card still fits without scrolling. */
@media (max-height: 760px) {
  .auth-main { padding-block: var(--s-3); }
  .auth-column { gap: var(--s-4); padding-block: var(--s-4); }
  .auth-section > * + * { margin-top: var(--s-4); }
  .auth-section .form-stack { gap: var(--s-4); }
  .auth-section > .auth-links { margin-top: var(--s-3); }
  .auth-foot { padding-top: var(--s-2); }
}
.error-detail { font-size: 12px; padding: var(--s-3); background: var(--paper-2); border: 1px solid var(--rule); border-radius: var(--radius-sm); max-height: 320px; overflow: auto; }

/* ---------- Polls ---------- */

.poll-header { display: block; }
.poll-layout { display: grid; gap: var(--s-7); grid-template-columns: minmax(0, 1fr) 320px; align-items: start; }
@media (max-width: 900px) { .poll-layout { grid-template-columns: minmax(0, 1fr); gap: var(--s-5); } }
.poll-description { white-space: pre-line; overflow-wrap: anywhere; font-size: 16px; max-width: 68ch; }
/* Full-width cast button, the rule notes underneath. */
.ballot-actions { display: flex; flex-direction: column; gap: var(--s-4); margin-top: var(--s-5); }
.ballot-notes { display: flex; flex-direction: column; gap: var(--s-2); font-size: 13.5px; color: var(--muted); }
.field-error[data-choice-required] { margin-top: var(--s-3); }
/* Aside: pale-grey rounded panels (the mockup's info strip), small uppercase labels. */
.poll-aside { display: flex; flex-direction: column; gap: var(--s-4); }
.aside-block { padding: var(--s-5); border-radius: var(--radius); background: var(--paper-2); }
.aside-block > * + * { margin-top: var(--s-4); }
.aside-title { margin: 0; font: 800 12px/1.4 var(--font); letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }

.candidate { display: flex; gap: var(--s-5); align-items: flex-start; padding: var(--s-5); border: 1px solid var(--rule); border-radius: var(--radius); }
.candidate > div > * + * { margin-top: var(--s-2); }
.candidate-photo { width: 120px; height: 120px; flex: none; object-fit: cover; border-radius: var(--radius); background: var(--paper-2); }
.candidate-photo.avatar { border-radius: 50%; }
.candidate h2 { margin: 0; font-size: 24px; }
.candidate-bio { white-space: pre-line; }
@media (max-width: 560px) { .candidate { flex-direction: column; } }

.voted-banner { display: flex; align-items: center; gap: var(--s-4); padding: var(--s-5); border-left: 4px solid var(--success); border-radius: var(--radius); background: var(--success-bg); color: var(--ink); animation: fade-up var(--dur) var(--ease) both; }
.voted-banner strong { display: block; font: 800 18px/1.3 var(--font); color: var(--black); }
.voted-banner p { margin-top: var(--s-1); color: var(--grey-700); }
.check-anim { width: 40px; height: 40px; flex: none; color: var(--success); }
.check-anim circle { fill: none; stroke: currentColor; stroke-width: 2; stroke-dasharray: 151; stroke-dashoffset: 151; animation: draw 120ms var(--ease) forwards; }
.check-anim path { fill: none; stroke: currentColor; stroke-width: 2.5; stroke-linecap: round; stroke-dasharray: 36; stroke-dashoffset: 36; animation: draw 80ms var(--ease) 120ms forwards; }
.voted-banner.is-static, .voted-banner.is-static .check-anim circle, .voted-banner.is-static .check-anim path { animation: none; stroke-dashoffset: 0; }
.your-vote { padding: var(--s-4) var(--s-5); font-size: 14px; }

/* Results: rows with rounded orange SVG bars (width set via SVG attribute, so CSP-safe). */
.results { display: flex; flex-direction: column; }
.bar-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--s-2) var(--s-3); align-items: baseline; padding: var(--s-4) 0; border-top: 1px solid var(--rule); }
.bar-row:first-child { border-top: 0; padding-top: 0; }
.bar-label { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2); font-weight: 700; color: var(--black); overflow-wrap: anywhere; }
.bar-value { font-variant-numeric: tabular-nums; color: var(--muted); font-size: 13.5px; white-space: nowrap; }
.bar-value strong { color: var(--black); font-size: 15px; font-weight: 800; }
.bar { grid-column: 1 / -1; display: block; width: 100%; height: 8px; border-radius: 999px; overflow: hidden; }
.bar-bg { fill: var(--rule); }
.bar-fill { fill: var(--accent); transform-box: fill-box; transform-origin: left center; animation: grow var(--dur) var(--ease) both; }
/* Results page facts: label above a large figure. */
.facts dt { font-size: 12px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.facts dt:not(:first-child) { margin-top: var(--s-5); }
.facts dd { margin-top: var(--s-1); font: 800 28px/1.2 var(--font); color: var(--black); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.facts dd small { font: 600 13px/1.4 var(--font); color: var(--muted); }
.facts .facts-text { font-size: 20px; }
.aside-block > .facts + * { margin-top: var(--s-6); }
.results-note { margin-top: var(--s-4); }
.voter-list .data-table td { vertical-align: middle; }
.results-foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--s-2); padding-top: var(--s-3); border-top: 1px solid var(--rule); color: var(--muted); font-size: 13.5px; font-variant-numeric: tabular-nums; }


/* ---------- Profile: form sections, title beside the form ---------- */
.form-section { display: grid; grid-template-columns: 240px minmax(0, 560px); gap: var(--s-6); padding-top: var(--s-6); border-top: 1px solid var(--rule); }
.form-section > .section-title { margin: 0; font-size: 20px; }
.avatar-row { display: flex; gap: var(--s-5); align-items: flex-start; }
.avatar-row > .form-stack { flex: 1; min-width: 0; }
@media (max-width: 760px) {
  .form-section { grid-template-columns: minmax(0, 1fr); gap: var(--s-5); }
}
@media (max-width: 480px) {
  .avatar-row { flex-direction: column; }
}

/* ---------- Stats ---------- */
/* Bordered cards: small uppercase label above a heavy number; the first card carries RTI's orange top edge. */
.stat-grid { display: grid; gap: var(--s-4); grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.stat { padding: var(--s-4) var(--s-5); border: 1px solid var(--rule); border-radius: var(--radius); background: var(--paper); }
.stat:first-child { box-shadow: inset 0 4px 0 var(--accent); }
.stat-label { font-size: 12px; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.stat-value { margin-top: var(--s-1); font: 800 30px/1.1 var(--font); color: var(--black); font-variant-numeric: tabular-nums; }

/* ---------- Empty state, key/value ---------- */
.empty { display: flex; flex-direction: column; align-items: center; gap: var(--s-2); padding: var(--s-7) var(--s-5); text-align: center; color: var(--muted); border-radius: var(--radius); background: var(--paper-2); }
.panel .empty { background: transparent; padding: var(--s-6) var(--s-4); }
.empty strong { font: 800 18px/1.3 var(--font); color: var(--black); }
.empty .btn { margin-top: var(--s-3); }
/* Facts list: label above value, so long values don't squeeze in a narrow column (audit 23). */
.kv { display: block; }
.kv dt { font-size: 12px; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.kv dt:not(:first-child) { margin-top: var(--s-4); }
.kv dd { margin: var(--s-1) 0 0; overflow-wrap: anywhere; }

/* ---------- Builder: numbered stepper beside field rows ---------- */
.builder { display: grid; gap: var(--s-6); }
.builder-body { container-type: inline-size; min-width: 0; }
/* Compact horizontal stepper by default (phones, tablets, no sidebar room). */
.stepper { display: flex; gap: var(--s-5); margin: 0; padding: 0; list-style: none; border-bottom: 1px solid var(--rule); }
.builder:not(.is-stepped) .stepper, .builder:not(.is-stepped) [data-step-prev], .builder:not(.is-stepped) [data-step-next] { display: none; }
.step-indicator { flex: 1 1 0; min-width: 0; display: flex; align-items: center; gap: var(--s-2); margin-bottom: -1px; padding: var(--s-3) 0; border-bottom: 3px solid transparent; color: var(--muted); font-size: 14.5px; font-weight: 700; cursor: default; transition: color var(--dur) var(--ease), border-color var(--dur) var(--ease); }
.step-indicator .step-num { flex: none; display: inline-grid; place-items: center; width: 26px; height: 26px; border: 2px solid var(--control-border); border-radius: 50%; font: 800 12px/1 var(--font); font-variant-numeric: tabular-nums; color: var(--grey-700); }
.step-indicator.is-active { color: var(--black); border-bottom-color: var(--accent); }
.step-indicator.is-active .step-num { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.step-indicator.is-done { color: var(--ink); cursor: pointer; }
.step-indicator.is-done:hover .step-label { text-decoration: underline; text-underline-offset: 0.16em; }
.step-indicator.is-done .step-num { background: var(--black); border-color: var(--black); color: var(--on-dark); }
.step-indicator .step-label { min-width: 0; overflow-wrap: anywhere; }
@media (max-width: 480px) {
  .step-indicator { flex: 0 0 auto; }
  .step-indicator.is-active { flex: 1 1 auto; }
  .step-indicator:not(.is-active) .step-label { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
}
/* Desktop: a vertical stepper column; the current step carries a 3px orange bar on the left. */
@media (min-width: 1024px) {
  .builder.is-stepped { grid-template-columns: 220px minmax(0, 1fr); gap: var(--s-7); align-items: start; }
  .stepper { flex-direction: column; gap: 0; border-bottom: 0; border-left: 1px solid var(--rule); }
  .step-indicator { flex: none; margin: 0 0 0 -1px; padding: var(--s-2) 0 var(--s-2) var(--s-4); border-bottom: 0; border-left: 3px solid transparent; }
  .step-indicator.is-active { border-left-color: var(--accent); }
}
fieldset.step { border-bottom: 1px solid var(--rule); }
fieldset.step > legend + * { margin-top: 0; }
/* The legend starts on the same edge as the labels below it (audit 24). */
legend.section-title { margin-bottom: var(--s-5); }
/* Field rows: a 220px label column beside the control on wide forms, stacked otherwise. */
.field-row { display: grid; gap: var(--s-3); padding: var(--s-5) 0; border-top: 1px solid var(--rule); }
.field-row__label { display: flex; flex-direction: column; gap: var(--s-2); min-width: 0; }
.field-row__label > label, .field-row__label > .label { font-weight: 800; font-size: 14px; color: var(--black); }
.field-row__control { display: flex; flex-direction: column; gap: var(--s-2); min-width: 0; }
@container (min-width: 600px) {
  .field-row { grid-template-columns: 220px minmax(0, 1fr); gap: var(--s-6); }
}
.step-note { margin-bottom: var(--s-5); }
.input-short { max-width: 160px; }
/* Radio lists: mark, label, muted description underneath. */
.choice-list { display: flex; flex-direction: column; gap: var(--s-4); }
.check-label { font-weight: 700; color: var(--black); }
.check:has(input:disabled) { color: var(--muted); cursor: not-allowed; }
.check:has(input:disabled) .check-label { color: var(--muted); }
/* Options: icon buttons --s-2 apart, "Add" --s-4 below the rows (audit 19). */
.option-list { display: flex; flex-direction: column; gap: var(--s-3); }
.option-row { display: flex; gap: var(--s-3); align-items: center; }
.option-row input { flex: 1; min-width: 0; }
.option-row__tools { display: flex; flex: none; gap: var(--s-2); }
.option-add { margin-top: var(--s-2); }
.builder-actions { display: flex; flex-wrap: wrap; gap: var(--s-3); margin-top: var(--s-6); }

/* ---------- Dialog ---------- */
.dialog { width: min(480px, calc(100% - var(--s-6))); padding: 0; border: 0; border-radius: var(--radius-lg); background: var(--paper); color: var(--ink); box-shadow: var(--shadow); }
.dialog[open] { animation: fade-up var(--dur) var(--ease) both; }
.dialog::backdrop { background: var(--scrim); animation: fade-in var(--dur) var(--ease) both; }
.dialog-body { padding: var(--s-6); margin: 0; }
.dialog-title { font-size: 20px; }
.dialog [data-confirm-message] { white-space: pre-line; color: var(--grey-700); }
.dialog-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: var(--s-3); margin-top: var(--s-6); }
@media (max-width: 480px) { .dialog-actions .btn { flex: 1 1 auto; } }
/* Edit dialogs of the admin comparison table: wide for long texts, scrolling inside the viewport. */
.dialog--edit { width: min(860px, calc(100% - var(--s-5))); max-height: calc(100dvh - var(--s-5)); overflow-y: auto; overscroll-behavior: contain; }
.dialog--edit .dialog-actions { align-items: center; margin-top: 0; }
.dialog--edit [data-rb-edit-status] > .alert { margin-top: var(--s-4); }
.dialog-actions--edit > .btn-text { margin-right: auto; }
.dialog-actions--edit > [aria-disabled="true"] { opacity: 0.45; pointer-events: none; }
@media (max-width: 480px) {
  .dialog--edit .dialog-body { padding: var(--s-5) var(--s-4); }
  .dialog-actions--edit > .btn-text { flex-basis: 100%; }
}

/* ---------- Toasts ---------- */
/* Charcoal toasts with a coloured icon (RTI dark cards). */
.toast-region { position: fixed; right: var(--s-4); bottom: var(--s-4); z-index: 60; display: flex; flex-direction: column; gap: var(--s-3); width: min(380px, calc(100% - var(--s-6))); pointer-events: none; }
.toast { pointer-events: auto; display: flex; align-items: flex-start; gap: var(--s-3); padding: var(--s-4); border-radius: var(--radius); background: var(--ink); color: var(--on-dark); box-shadow: var(--shadow); animation: toast-in var(--dur) var(--ease) both; }
.toast > .icon:first-child { height: 1.65em; color: var(--accent); }
.toast p { flex: 1; font-weight: 600; font-size: 14px; }
.toast-success > .icon:first-child { color: var(--success-on-dark); }
.toast-error > .icon:first-child { color: var(--danger-on-dark); }
/* 44px hit area; the negative margins keep the small glyph in the toast's corner. */
.toast-close { flex: none; display: grid; place-items: center; width: 44px; height: 44px; margin: calc(var(--s-2) - var(--s-4)); padding: 0; border: 0; border-radius: var(--radius-sm); background: none; color: var(--on-dark); opacity: 0.75; cursor: pointer; }
.toast-close:hover { opacity: 1; }
.toast.is-leaving { animation: toast-out var(--dur) var(--ease) forwards; }

/* ---------- Motion ---------- */
@view-transition { navigation: auto; }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: var(--dur); }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes fade-up { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes grow { from { transform: scaleX(0); } }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes toast-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateY(6px); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
  @view-transition { navigation: none; }
  .check-anim circle, .check-anim path { stroke-dashoffset: 0; }
  /* app.js removes a closing toast on animationend, so keep a 1ms (motionless) animation to fire it. */
  .toast.is-leaving { animation: fade-in 1ms linear reverse forwards !important; }
}

/* ---------- Print ---------- */
.print-only { display: none; }
@media print {
  /* Print-only literal colours (outside the token table on purpose): white paper, black text,
     a light grey track and black bars, forced on because browsers drop backgrounds by default. */
  body { background: #fff; color: #000; font-size: 11pt; }
  .bar, .meter { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .bar-bg, .meter-track { fill: #e5e5e5; }
  .bar-fill, .meter-fill { fill: #000 !important; }
  .rule-list, .table-wrap, .panel, .stat, .candidate { box-shadow: none; border-color: #ccc; }
  .aside-block { background: none; border: 1px solid #ccc; }
  .state { border: 1px solid #999; background: none; color: #000; }

  .site-header, .sidebar, .no-print, .toast-region, .btn, .tabs, .filters, .pagination, .lang-switch { display: none !important; }
  .admin-shell { display: block; }
  .panel, .stat, .aside-block, .bar-row, .rb-result__proposal { break-inside: avoid; }
  .rb-ballot-bar, .rb-answer { display: none !important; }
  .rb-original, .rb-table thead th { background: none; }
  .rb-table-wrap, .rb-result { border-color: #ccc; }
  .page { padding: 0; }
  * { animation: none !important; }
  .print-only { display: block !important; }
  /* Letterhead on printed results: small logo beside the club name and print date. */
  .print-only.print-brand { display: flex !important; align-items: center; gap: var(--s-3); }
  .print-brand .logo { width: 40px; height: 40px; }
}
