/* VoxPulse — calm-tool design language. Narrow first; widen with min-width. */
:root {
  --bg: #f4f6fb; --surface: #fff; --surface-2: #f6f8fc; --line: #e3e7f0; --line-2: #d4dae6;
  --ink: #0f172a; --ink-2: #4b5870; --ink-3: #8a96ac;
  --brand: var(--b-light, #3b4fd8); --brand-2: var(--b-light-2, #2f40b8); --brand-soft: var(--b-light-soft, #eceffe); --on-brand: var(--on-b-light, #fff);
  --ok: #15803d; --warn: #b45309; --bad: #dc2626;
  --r: 14px; --r-sm: 10px;
  --shadow: 0 1px 2px rgba(15,23,42,.05), 0 8px 24px -14px rgba(15,23,42,.22);
  --font: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-display: 'Fraunces', Georgia, serif;
  --mono: ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace;
  --ease: cubic-bezier(.2,.8,.2,1);
  --row: 64px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme=light]) {
    --bg: #0b1020; --surface: #121a2e; --surface-2: #172038; --line: #222c45; --line-2: #2e3a59;
    --ink: #e8ecf6; --ink-2: #a9b3c9; --ink-3: #74809b;
    --brand: var(--b-dark, #7d8cff); --brand-2: var(--b-dark-2, #9aa6ff); --brand-soft: var(--b-dark-soft, #1d2650); --on-brand: var(--on-b-dark, #0b1020);
    --ok: #4ade80; --warn: #fbbf24; --bad: #f87171;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 10px 28px -14px rgba(0,0,0,.6);
    color-scheme: dark;
  }
}
:root[data-theme=dark] {
  --bg: #0b1020; --surface: #121a2e; --surface-2: #172038; --line: #222c45; --line-2: #2e3a59;
  --ink: #e8ecf6; --ink-2: #a9b3c9; --ink-3: #74809b;
  --brand: var(--b-dark, #7d8cff); --brand-2: var(--b-dark-2, #9aa6ff); --brand-soft: var(--b-dark-soft, #1d2650); --on-brand: var(--on-b-dark, #0b1020);
  --ok: #4ade80; --warn: #fbbf24; --bad: #f87171;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 10px 28px -14px rgba(0,0,0,.6);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.5 var(--font); min-height: 100vh; overflow-x: hidden; }
h1, h2, h3 { font-family: var(--font-display); font-weight: 600; line-height: 1.15; margin: 0; letter-spacing: -.01em; }
h1 { font-size: clamp(1.6rem, 5vw, 2.4rem); }
h2 { font-size: clamp(1.3rem, 4vw, 1.7rem); }
h3 { font-size: 1.1rem; }
p { margin: 0; }
a { color: var(--brand); }
img { max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.num, .tab { font-variant-numeric: tabular-nums; }
.muted { color: var(--ink-2); }
.dim { color: var(--ink-3); font-size: .875rem; }
.mono { font-family: var(--mono); overflow-wrap: anywhere; }
.stack > * + * { margin-top: 12px; }
.stack-lg > * + * { margin-top: 20px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.between { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.grow { flex: 1 1 auto; min-width: 0; }
.center { text-align: center; }
.hide { display: none !important; }

/* ── Shell ── */
.top { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--surface) 88%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.top-in { max-width: 1180px; margin: 0 auto; padding: 8px 14px; display: flex; align-items: center; gap: 10px; }
.brand { display: flex; align-items: center; gap: 8px; text-decoration: none; color: var(--ink); font-weight: 700; font-size: 1.05rem; min-height: 40px; flex: none; }
.brand b { color: var(--brand); }
.brand > span { display: none; }                 /* narrow first: logo only */
@media (min-width: 560px) { .brand > span { display: inline; } }
.brand svg { width: 30px; height: 30px; flex: none; color: var(--brand); }
.org-chip { display: flex; align-items: center; gap: 8px; min-width: 0; padding-left: 10px; margin-left: -2px; border-left: 1px solid var(--line); font-weight: 700; color: var(--ink-2); font-size: .85rem; }
.org-chip img { width: 30px; height: 30px; border-radius: 8px; object-fit: contain; flex: none; background: var(--surface); }
.org-chip .org-name { display: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 22ch; }
@media (min-width: 760px) { .org-chip .org-name { display: inline; } }
.brand { margin-right: 0; }
.nav { display: flex; gap: 2px; margin-left: auto; }
.motto { font-family: var(--font-display); font-style: italic; color: var(--ink-2); font-size: 1.05rem; }
.voter-msg { padding: 10px 12px; border-radius: var(--r-sm); background: var(--brand-soft); color: var(--ink); font-weight: 600; }
.choice.swatch { padding: 6px; } .choice.swatch i { display: block; width: 30px; height: 30px; border-radius: 8px; }
.choice input[type=color] { width: 30px; height: 30px; border: 0; padding: 0; background: none; cursor: pointer; }
.nav a { text-decoration: none; color: var(--ink-2); font-weight: 600; font-size: .9rem; padding: 9px 8px; border-radius: var(--r-sm); white-space: nowrap; }
.nav a[aria-current=page] { color: var(--brand); background: var(--brand-soft); }
.nav .nav-long { display: none; }
.theme-btn { width: 40px; height: 40px; border-radius: var(--r-sm); border: 1px solid var(--line); background: var(--surface); display: grid; place-items: center; cursor: pointer; flex: none; }
.theme-btn svg { width: 18px; height: 18px; }
main { max-width: 1180px; margin: 0 auto; padding: 16px 12px 120px; }
* { min-width: 0; }
.foot { max-width: 1180px; margin: 0 auto; padding: 0 14px 28px; color: var(--ink-3); font-size: .8rem; display: flex; gap: 10px; flex-wrap: wrap; justify-content: space-between; }
.demo-band { background: color-mix(in srgb, var(--warn) 12%, var(--surface)); color: var(--ink); border-bottom: 1px solid color-mix(in srgb, var(--warn) 30%, transparent); font-size: .85rem; padding: 7px 14px; text-align: center; }
@media (min-width: 520px) { .nav .nav-long { display: inline; } .nav .nav-short { display: none; } }
@media (min-width: 720px) { main { padding: 24px 20px 120px; } .top-in { padding: 10px 20px; } }

/* ── Cards, pills, alerts ── */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); padding: 16px; min-width: 0; }
.card { padding: 14px; }
@media (min-width: 360px) { .card { padding: 16px; } }
@media (min-width: 720px) { .card { padding: 22px; } }
.card-sub { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 12px; }
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: .8rem; font-weight: 700; padding: 4px 10px; border-radius: 999px; background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line); white-space: nowrap; }
.pill::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.pill.ok   { color: var(--ok);   background: color-mix(in srgb, var(--ok) 10%, transparent);   border-color: color-mix(in srgb, var(--ok) 30%, transparent); }
.pill.warn { color: var(--warn); background: color-mix(in srgb, var(--warn) 10%, transparent); border-color: color-mix(in srgb, var(--warn) 30%, transparent); }
.pill.bad  { color: var(--bad);  background: color-mix(in srgb, var(--bad) 10%, transparent);  border-color: color-mix(in srgb, var(--bad) 30%, transparent); }
.pill.brand { color: var(--brand); background: var(--brand-soft); border-color: transparent; }
@media (prefers-reduced-motion: no-preference) { .pill.ok.live::before { animation: beat 1.6s var(--ease) infinite; } }
@keyframes beat { 0%,100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--ok) 50%, transparent); } 50% { box-shadow: 0 0 0 5px transparent; } }
.alert { border-radius: var(--r-sm); padding: 11px 13px; font-size: .92rem; border: 1px solid var(--line); background: var(--surface-2); display: flex; gap: 10px; align-items: flex-start; }
.alert svg { width: 18px; height: 18px; flex: none; margin-top: 2px; }
.alert.ok   { border-color: color-mix(in srgb, var(--ok) 35%, transparent);   background: color-mix(in srgb, var(--ok) 8%, var(--surface)); }
.alert.warn { border-color: color-mix(in srgb, var(--warn) 40%, transparent); background: color-mix(in srgb, var(--warn) 9%, var(--surface)); }
.alert.bad  { border-color: color-mix(in srgb, var(--bad) 35%, transparent);  background: color-mix(in srgb, var(--bad) 8%, var(--surface)); }
.alert.ok svg { color: var(--ok); } .alert.warn svg { color: var(--warn); } .alert.bad svg { color: var(--bad); }

/* ── Buttons: idle · busy · done · failed ── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 10px 16px; border-radius: var(--r-sm); border: 1px solid var(--line-2); background: var(--surface); color: var(--ink); font-weight: 700; font-size: .95rem; cursor: pointer; text-decoration: none; line-height: 1.2; text-align: center; transition: background .15s, border-color .15s, color .15s, transform .1s; }
.btn:hover { border-color: var(--brand); }
.btn:active { transform: translateY(1px); }
.btn svg { width: 18px; height: 18px; flex: none; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.btn.primary:hover { background: var(--brand-2); border-color: var(--brand-2); }
.btn.quiet { background: transparent; border-color: transparent; color: var(--brand); }
.btn.quiet:hover { background: var(--brand-soft); }
.btn.danger { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 40%, transparent); }
.btn.danger.solid { background: var(--bad); color: #fff; border-color: var(--bad); }
.btn.small { min-height: 36px; padding: 6px 11px; font-size: .85rem; }
.btn.big { min-height: 54px; font-size: 1.05rem; padding: 12px 22px; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .55; cursor: not-allowed; transform: none; }
.btn.is-busy { opacity: 1; cursor: progress; }
.btn.is-done { background: var(--ok); border-color: var(--ok); color: #fff; opacity: 1; }
.btn.is-fail { border-color: var(--bad); color: var(--bad); background: var(--surface); }
@media (prefers-reduced-motion: no-preference) { .btn.is-fail { animation: shake .35s; } }
@keyframes shake { 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }
.spin { width: 16px; height: 16px; border-radius: 50%; border: 2.5px solid currentColor; border-right-color: transparent; flex: none; }
@media (prefers-reduced-motion: no-preference) { .spin { animation: rot .7s linear infinite; } }
@keyframes rot { to { transform: rotate(1turn); } }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }
.btn-row > .btn { flex: 1 1 auto; }
@media (min-width: 560px) { .btn-row > .btn { flex: 0 0 auto; } }

/* One-of-many choice: a row of buttons, exactly one on */
.choices { display: flex; flex-wrap: wrap; gap: 6px; }
.choice { min-height: 44px; min-width: 44px; padding: 8px 13px; border-radius: var(--r-sm); border: 1px solid var(--line-2); background: var(--surface); font-weight: 700; font-size: .9rem; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.choice[aria-pressed=true], .choice[aria-checked=true] { background: var(--brand); color: var(--on-brand); border-color: var(--brand); }
.choice[aria-pressed=true]::before, .choice[aria-checked=true]::before { content: "✓"; }

/* ── Forms ── */
.field { display: block; }
.field > span { display: block; font-size: .85rem; font-weight: 700; color: var(--ink-2); margin-bottom: 5px; }
.field > small { display: block; color: var(--ink-3); font-size: .8rem; margin-top: 5px; }
.input, .field input:not([type=checkbox]):not([type=file]), .field select, .field textarea { width: 100%; min-height: 46px; padding: 10px 12px; border-radius: var(--r-sm); border: 1px solid var(--line-2); background: var(--surface); }
.field textarea { min-height: 120px; resize: vertical; }
.input:focus, .field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
input[type=datetime-local] { min-width: 0; }
.check { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 4px 0; cursor: pointer; font-weight: 600; }
.check input { width: 20px; height: 20px; accent-color: var(--brand); }
.form-grid { display: grid; gap: 14px; }
@media (min-width: 600px) { .form-grid.two { grid-template-columns: 1fr 1fr; } .form-grid .full { grid-column: 1 / -1; } }

/* ── Avatars: one size variable drives the circle and the letters, so initials stay centred and in proportion everywhere ── */
.av { --h: 220; --s: 44px; width: var(--s); height: var(--s); min-width: var(--s); aspect-ratio: 1; border-radius: 50%; object-fit: cover; object-position: 50% 30%; flex: none;
  display: inline-grid; place-items: center; overflow: hidden; font-size: calc(var(--s) * .38); line-height: 1; font-weight: 800; letter-spacing: .02em;
  background: var(--surface-2); border: 2px solid var(--surface); box-shadow: 0 0 0 1px var(--line); user-select: none; }
.av.ini { background: linear-gradient(140deg, hsl(var(--h) 68% 50%), hsl(calc(var(--h) + 38) 72% 38%)); color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,.25); }
.av.sm { --s: 32px; } .av.md { --s: 40px; } .av.lg { --s: clamp(52px, 15vw, 72px); } .av.xl { --s: clamp(80px, 26vw, 120px); }
.pos-img { width: 48px; height: 48px; border-radius: 12px; object-fit: cover; flex: none; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; }
.pos-img svg { width: 24px; height: 24px; }
/* Admin: a candidate's photo is itself the upload button */
.photo-btn { position: relative; padding: 0; border: 0; background: none; border-radius: 50%; cursor: pointer; flex: none; }
.photo-btn .cam { position: absolute; right: -2px; bottom: -2px; width: 20px; height: 20px; border-radius: 50%; background: var(--brand); color: var(--on-brand); display: grid; place-items: center; border: 2px solid var(--surface); }
.photo-btn .cam svg { width: 11px; height: 11px; }
.photo-btn.is-busy::after { content: ""; position: absolute; inset: 0; border-radius: 50%; background: color-mix(in srgb, var(--surface) 55%, transparent); }
.photo-btn .spin { position: absolute; inset: 0; margin: auto; z-index: 1; color: var(--brand); }
.drop { border: 2px dashed var(--line-2); border-radius: var(--r); padding: 16px; display: grid; gap: 12px; justify-items: center; text-align: center; background: var(--surface-2); transition: border-color .15s, background .15s; }
.drop.over { border-color: var(--brand); background: var(--brand-soft); }
.drop .preview { --s: clamp(96px, 30vw, 128px); }
.drop .preview.sq { border-radius: 16px; }
.match { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 10px; align-items: center; padding: 10px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface-2); }
.match .field { margin: 0; }
.match.skip { opacity: .55; }

/* ── Home ── */
.hero { display: grid; gap: 16px; }
.hero h1 { font-size: clamp(1.9rem, 7vw, 3.2rem); }
.hero .org { display: flex; align-items: center; gap: 10px; color: var(--ink-2); font-weight: 600; }
.hero .org img { width: 40px; height: 40px; border-radius: 10px; object-fit: cover; }
.stats { display: grid; grid-template-columns: 1fr; gap: 8px; }
@media (min-width: 300px) { .stats { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.stat { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 10px; min-width: 0; }
.stat small { display: block; color: var(--ink-3); font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.stat b { display: block; font-size: 1.35rem; font-variant-numeric: tabular-nums; }
.steps { display: grid; gap: 10px; counter-reset: s; padding: 0; margin: 0; list-style: none; }
.steps li { counter-increment: s; display: flex; gap: 12px; align-items: flex-start; }
.steps li::before { content: counter(s); flex: none; width: 30px; height: 30px; border-radius: 50%; background: var(--brand-soft); color: var(--brand); font-weight: 800; display: grid; place-items: center; }
.home-grid { display: grid; gap: 16px; }
@media (min-width: 900px) { .home-grid { grid-template-columns: 1.4fr 1fr; align-items: start; } }

/* ── Voting ── */
.vote-wrap { max-width: 760px; margin: 0 auto; }
.code-input { width: 100%; font: 700 clamp(1.3rem, 6vw, 1.9rem)/1 var(--mono); letter-spacing: .12em; text-align: center; text-transform: uppercase; padding: 16px 10px; border-radius: var(--r); border: 2px solid var(--line-2); background: var(--surface); }
.code-input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-soft); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip-btn { font: 600 .8rem var(--mono); padding: 8px 10px; min-height: 36px; border-radius: 999px; border: 1px dashed var(--line-2); background: var(--surface-2); cursor: pointer; }
.progress { display: flex; gap: 4px; }
.progress span { flex: 1; height: 6px; border-radius: 3px; background: var(--line); }
.progress span.done { background: color-mix(in srgb, var(--brand) 55%, transparent); }
.progress span.now { background: var(--brand); }
.voter-chip { display: flex; align-items: center; gap: 10px; }
.voter-chip b { display: block; line-height: 1.2; }
.pos-head { display: flex; gap: 12px; align-items: flex-start; }
.cands { display: grid; gap: 10px; }
@media (min-width: 600px) { .cands { grid-template-columns: 1fr 1fr; } }
.cand { position: relative; display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; padding: 12px; padding-right: 44px; border-radius: var(--r); border: 1px solid var(--line-2); background: var(--surface); cursor: pointer; min-height: 88px; transition: border-color .15s, box-shadow .15s, background .15s; }
.cand:hover { border-color: var(--brand); }
.cand[aria-checked=true] { outline: 3px solid var(--brand); outline-offset: 1px; background: var(--brand-soft); border-color: var(--brand); }
.cand .tick { position: absolute; right: 12px; top: 12px; width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--line-2); display: grid; place-items: center; color: transparent; background: var(--surface); }
.cand[aria-checked=true] .tick { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.cand .tick svg { width: 14px; height: 14px; }
.cand .no { position: absolute; left: 6px; top: 6px; font-size: .7rem; font-weight: 800; background: var(--ink); color: var(--surface); border-radius: 6px; padding: 1px 6px; }
.cand-body { min-width: 0; }
.cand-name { display: block; font-weight: 800; font-size: 1.05rem; line-height: 1.25; overflow-wrap: anywhere; }
.cand-meta { display: block; color: var(--ink-2); font-size: .85rem; }
.cand-slogan { display: block; color: var(--ink-2); font-size: .85rem; font-style: italic; margin-top: 2px; }
.cand-wrap { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.cand-wrap .btn { align-self: flex-start; }
.dock { position: sticky; bottom: 0; z-index: 10; margin: 16px -12px 0; padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(8px); border-top: 1px solid var(--line); display: flex; gap: 8px; align-items: center; }
.dock .btn { flex: 1 1 0; }
.dock-note { flex-basis: 100%; font-size: .85rem; color: var(--ink-2); }
.dock { flex-wrap: wrap; }
@media (min-width: 720px) { .dock { margin: 20px 0 0; border-radius: var(--r); border: 1px solid var(--line); } }
.review { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.review li { display: flex; gap: 10px; align-items: center; padding: 12px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface-2); }
.review .who { display: flex; flex-direction: column; gap: 6px; }
.review .who { min-width: 0; }
.review .who span { display: flex; align-items: center; gap: 8px; font-weight: 700; overflow-wrap: anywhere; }
.review .abst { color: var(--warn); font-weight: 700; }
.hold { position: relative; overflow: hidden; width: 100%; min-height: 60px; border-radius: var(--r); border: 0; background: var(--brand); color: var(--on-brand); font-weight: 800; font-size: 1.1rem; cursor: pointer; touch-action: none; user-select: none; -webkit-user-select: none; }
.hold .fill { position: absolute; inset: 0; width: 0; background: color-mix(in srgb, #000 22%, transparent); }
.hold.holding .fill { width: 100%; transition: width 1s linear; }
.hold .lbl { position: relative; display: inline-flex; align-items: center; gap: 8px; }
.hold[disabled] { opacity: .7; cursor: progress; }
.done-mark { width: 84px; height: 84px; margin: 0 auto; border-radius: 50%; background: color-mix(in srgb, var(--ok) 14%, transparent); color: var(--ok); display: grid; place-items: center; }
.done-mark svg { width: 44px; height: 44px; }
@media (prefers-reduced-motion: no-preference) { .done-mark { animation: pop .5s var(--ease); } }
@keyframes pop { from { transform: scale(.6); opacity: 0; } }
.receipt { font: 800 1.4rem var(--mono); letter-spacing: .12em; padding: 10px 16px; border-radius: var(--r-sm); background: var(--surface-2); border: 1px dashed var(--line-2); display: inline-block; }

/* ── Results board ── */
.kpis { display: grid; grid-template-columns: 1fr; gap: 8px; }
@media (min-width: 300px) { .kpis { grid-template-columns: 1fr 1fr; } }
@media (min-width: 760px) { .kpis { grid-template-columns: repeat(4, 1fr); gap: 12px; } }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px; box-shadow: var(--shadow); min-width: 0; }
.kpi small { display: block; color: var(--ink-3); font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.kpi b { display: block; font-size: clamp(1.5rem, 5vw, 2.1rem); font-variant-numeric: tabular-nums; line-height: 1.2; }
.meter { height: 10px; border-radius: 5px; background: var(--line); overflow: hidden; }
.meter i { display: block; height: 100%; width: 0; background: var(--brand); border-radius: 5px; transition: width .6s var(--ease); }
.board { display: grid; gap: 14px; }
@media (min-width: 900px) { .board { grid-template-columns: 1fr 1fr; } }
.pos-card { padding: 14px; }
.pos-card header { display: flex; gap: 10px; align-items: center; margin-bottom: 10px; }
.rank { position: relative; }
.rrow { position: absolute; left: 0; right: 0; top: 0; height: calc(var(--row) - 6px); display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: var(--r-sm); transition: transform .6s var(--ease), background .4s; }
.rrow.lead { background: color-mix(in srgb, var(--ok) 8%, transparent); }
.rrow.tie { background: color-mix(in srgb, var(--warn) 10%, transparent); }
.rrow.bump { background: var(--brand-soft); }
.rrow .main { flex: 1; min-width: 0; }
.rrow .top-line { display: flex; gap: 8px; align-items: baseline; justify-content: space-between; }
.rrow .nm { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.rrow .ct { font-variant-numeric: tabular-nums; white-space: nowrap; font-weight: 800; }
.rrow .ct small { color: var(--ink-3); font-weight: 700; margin-left: 4px; }
.rrow .bar { height: 8px; border-radius: 4px; background: var(--line); margin-top: 5px; overflow: hidden; }
.rrow .bar i { display: block; height: 100%; width: 0; background: var(--brand); border-radius: 4px; transition: width .6s var(--ease); }
.rrow.lead .bar i { background: var(--ok); }
.rrow .flag { font-size: .7rem; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; color: var(--ok); }
.rrow.tie .flag { color: var(--warn); }
.classes { display: grid; gap: 8px; }
@media (min-width: 640px) { .classes { grid-template-columns: 1fr 1fr; } }
@media (min-width: 1000px) { .classes { grid-template-columns: 1fr 1fr 1fr; } }
.cls { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 10px; align-items: center; font-size: .9rem; }
.cls .meter { grid-column: 1 / -1; height: 7px; }
body.tv .top, body.tv .foot, body.tv .demo-band { display: none; }
body.tv main { max-width: none; padding: 24px 3vw; }
body.tv { --row: 92px; font-size: 20px; }
body.tv .board { grid-template-columns: 1fr; }
body.tv .pos-card { display: none; }
body.tv .pos-card.on { display: block; }
body.tv .rrow .nm { font-size: 1.4rem; }
body.tv .av.md { --s: 64px; }

/* ── Admin ── */
.admin { display: grid; gap: 14px; }
.side { display: grid; gap: 12px; }
.tabs { display: flex; gap: 4px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: thin; }
.tabs button { flex: none; min-height: 42px; padding: 8px 12px; border-radius: var(--r-sm); border: 1px solid var(--line); background: var(--surface); font-weight: 700; font-size: .88rem; color: var(--ink-2); cursor: pointer; display: inline-flex; gap: 6px; align-items: center; }
.tabs button[aria-selected=true] { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.tabs svg { width: 16px; height: 16px; }
@media (min-width: 980px) {
  .admin { grid-template-columns: 250px minmax(0, 1fr); align-items: start; }
  .side { position: sticky; top: 76px; }
  .tabs { flex-direction: column; overflow: visible; }
  .tabs button { justify-content: flex-start; }
}
.pane { display: grid; gap: 14px; min-width: 0; }
.list { display: grid; gap: 8px; }
.item { display: flex; gap: 10px; align-items: center; padding: 10px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface-2); flex-wrap: wrap; }
.item .grow { min-width: 150px; }
.item-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.pos-block { border: 1px solid var(--line); border-radius: var(--r); padding: 12px; display: grid; gap: 10px; background: var(--surface); }
.tbl-wrap { overflow-x: auto; }
.voters { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.voters li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 10px; align-items: center; padding: 9px 10px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface-2); }
.voters li .item-actions { grid-column: 1 / -1; }
@media (min-width: 720px) { .voters li { grid-template-columns: minmax(0, 1fr) 120px 110px auto; } .voters li .item-actions { grid-column: auto; } }
.codes { display: grid; gap: 6px; }
@media (min-width: 640px) { .codes { grid-template-columns: 1fr 1fr; } }
.code-line { display: flex; justify-content: space-between; gap: 8px; padding: 8px 10px; border-radius: var(--r-sm); background: var(--surface-2); border: 1px solid var(--line); flex-wrap: wrap; }
.code-line b { font-family: var(--mono); letter-spacing: .06em; }
.check-list { display: grid; gap: 8px; }
.check-row { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface-2); }
.check-row .dot { width: 10px; height: 10px; border-radius: 50%; margin-top: 7px; flex: none; background: var(--ink-3); }
.check-row.ok .dot { background: var(--ok); } .check-row.warn .dot { background: var(--warn); } .check-row.bad .dot { background: var(--bad); }
.log { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; font-size: .88rem; }
.log li { display: grid; grid-template-columns: 1fr; padding: 6px 0; border-bottom: 1px solid var(--line); }
@media (min-width: 640px) { .log li { grid-template-columns: 150px 1fr; gap: 10px; } }
.img-pick { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.img-pick .preview { width: 72px; height: 72px; border-radius: 12px; object-fit: cover; border: 1px solid var(--line); background: var(--surface-2); display: grid; place-items: center; color: var(--ink-3); }
.file-label { position: relative; overflow: hidden; }
.file-label input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

/* ── Dialog + toasts ── */
.modal-back { position: fixed; inset: 0; z-index: 50; background: rgba(15,23,42,.45); display: grid; align-items: end; justify-items: center; padding: 0; }
@media (min-width: 640px) { .modal-back { align-items: center; padding: 20px; } }
.modal { background: var(--surface); width: 100%; max-width: 560px; max-height: 92vh; overflow-y: auto; border-radius: var(--r) var(--r) 0 0; padding: 18px 16px calc(16px + env(safe-area-inset-bottom)); box-shadow: var(--shadow); }
@media (min-width: 640px) { .modal { border-radius: var(--r); padding: 22px; } }
@media (prefers-reduced-motion: no-preference) { .modal { animation: up .25s var(--ease); } }
@keyframes up { from { transform: translateY(20px); opacity: 0; } }
.modal-foot { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; margin-top: 18px; }
.modal-foot .btn { flex: 1 1 auto; }
@media (min-width: 640px) { .modal-foot .btn { flex: 0 0 auto; } }
.toasts { position: fixed; z-index: 60; left: 12px; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom)); display: grid; gap: 8px; justify-items: center; pointer-events: none; }
.toast { pointer-events: auto; max-width: 520px; width: 100%; background: var(--ink); color: var(--surface); border-radius: var(--r-sm); padding: 11px 14px; font-weight: 600; font-size: .92rem; box-shadow: var(--shadow); display: flex; gap: 10px; align-items: flex-start; }
.toast svg { width: 18px; height: 18px; flex: none; margin-top: 1px; }
.toast.ok svg { color: #4ade80; } .toast.bad svg { color: #f87171; } .toast.warn svg { color: #fbbf24; }
@media (prefers-reduced-motion: no-preference) { .toast { animation: up .25s var(--ease); } }
.toast.out { opacity: 0; transition: opacity .3s; }
.skeleton { height: 18px; border-radius: 6px; background: var(--line); }
@media (prefers-reduced-motion: no-preference) { .skeleton { animation: fade 1.2s ease-in-out infinite alternate; } }
@keyframes fade { to { opacity: .4; } }

/* ── Print: voter slips ── */
#print-root { display: none; }
@media print {
  body > *:not(#print-root) { display: none !important; }
  #print-root { display: block; }
  @page { size: A4; margin: 10mm; }
  .slips { display: grid; grid-template-columns: 1fr 1fr; gap: 0; }
  .slip { border: 1px dashed #999; padding: 5mm; height: 54mm; display: grid; grid-template-columns: 1fr 30mm; gap: 3mm; break-inside: avoid; font: 10pt/1.3 var(--font); color: #000; }
  .slip h4 { margin: 0; font: 600 11pt var(--font-display); }
  .slip .c { font: 800 15pt var(--mono); letter-spacing: .08em; margin: 2mm 0; }
  .slip img { width: 30mm; height: 30mm; }
  .slip ol { margin: 1mm 0 0; padding-left: 4mm; font-size: 8pt; }
}
