/* ===== מדגם הבחירות הארצי — design system =====
   Committed dark look. RTL-first. Palette for party marks is CVD-validated
   (see server/seed/parties.js); identity is never color-alone. */

/* The Heebo webfont is loaded ASYNCHRONOUSLY from ui.js (JS-inserted <link>),
   never via @import: a CSS import of a third-party host sits in the critical
   path — pending stylesheets block deferred <script type=module> execution, so
   a slow/unreachable fonts.googleapis.com froze the whole app for ~13s. The
   font-family stacks below all carry full system fallbacks (font-display:swap
   semantics), so text renders immediately and upgrades when the font lands. */

:root {
  --bg: #0b1220;
  --surface: #131c2e;
  --raised: #1a2438;
  --line: #253049;
  --ink: #e8edf7;
  --ink-2: #a7b1c5;
  --muted: #97a1b5; /* lightened for WCAG 1.4.3 (≥4.5:1 on surfaces) */
  --field-border: #6874a0; /* 3.40:1 vs field bg (--raised) for WCAG 1.4.11 non-text contrast */
  --accent: #4f8ff7;
  --accent-2: #2dd4bf;
  --good: #34d399;
  --warn: #fbbf24;
  --bad: #f87171;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  --maxw: 1120px;
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: 76px; /* clear the 60px sticky header when focus scrolls into view */
}

/* Visually hidden but kept in the accessibility tree (labels, live regions). */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

body {
  margin: 0;
  overflow-x: hidden; /* wide content scrolls inside its own container, never the page */
  background: var(--bg);
  color: var(--ink);
  font-family: 'Heebo', -apple-system, 'Segoe UI', Roboto, 'Noto Sans Hebrew', Arial, sans-serif;
  font-size: 100%; /* honor the user's browser/OS default text size (WCAG 1.4.4) */
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

body::before {
  /* subtle radial glow behind the hero */
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(800px 420px at 85% -5%, rgba(79, 143, 247, 0.16), transparent 60%),
    radial-gradient(700px 380px at 10% 110%, rgba(45, 212, 191, 0.10), transparent 60%);
  pointer-events: none;
  z-index: 0;
}

main, header.site, footer.site { position: relative; z-index: 1; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3 { line-height: 1.2; margin: 0 0 0.5em; }
h1 { font-size: clamp(1.9rem, 4.5vw, 3.1rem); font-weight: 900; letter-spacing: -0.5px; }
h2 { font-size: clamp(1.3rem, 2.6vw, 1.8rem); font-weight: 800; }
h3 { font-size: 1.1rem; font-weight: 700; }

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 20px; }

/* ---------- header ---------- */
header.site {
  position: sticky;
  top: 0;
  backdrop-filter: blur(14px);
  background: rgba(11, 18, 32, 0.82);
  border-bottom: 1px solid var(--line);
  z-index: 50;
}
header.site .wrap {
  display: flex;
  align-items: center;
  gap: 16px;
  height: 60px;
}
.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 900;
  font-size: 1.06rem;
  color: var(--ink);
}
.logo:hover { text-decoration: none; }
.logo .mark { font-size: 1.4rem; }
nav.main { display: flex; gap: 4px; margin-inline-start: auto; }
nav.main a {
  color: var(--ink-2);
  font-weight: 600;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 0.95rem;
}
nav.main a:hover { color: var(--ink); background: var(--raised); text-decoration: none; }
nav.main a.active { color: var(--ink); background: var(--raised); }

/* ---------- language switcher ---------- */
.lang-switch {
  display: inline-flex;
  gap: 2px;
  background: var(--raised);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px;
  flex: none;
}
.lang-btn {
  background: transparent;
  border: none;
  color: var(--ink-2);
  font: inherit;
  font-weight: 700;
  font-size: 0.78rem;
  padding: 3px 9px;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
}
.lang-btn:hover { color: var(--ink); }
.lang-btn.on { background: var(--accent); color: var(--bg); font-weight: 800; } /* dark text on accent clears 4.5:1 */
.i18n-notice {
  background: rgba(79, 143, 247, 0.1);
  border: 1px solid rgba(79, 143, 247, 0.35);
  color: var(--ink-2);
  border-radius: var(--radius);
  padding: 10px 16px;
  margin: 14px 0 0;
  font-size: 0.86rem;
  text-align: center;
}

.live-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: var(--raised);
  border: 1px solid var(--line);
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--ink-2);
  white-space: nowrap;
}
.live-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--good);
  box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.55);
  animation: pulse 2s infinite;
}
.live-dot.off { background: var(--muted); animation: none; box-shadow: none; }
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.55); }
  70% { box-shadow: 0 0 0 9px rgba(52, 211, 153, 0); }
  100% { box-shadow: 0 0 0 0 rgba(52, 211, 153, 0); }
}

/* ---------- hero ---------- */
.hero { padding: 64px 0 36px; text-align: center; }
.hero .kicker {
  display: inline-flex; align-items: center; gap: 8px;
  color: var(--accent-2);
  font-weight: 700;
  font-size: 0.9rem;
  letter-spacing: 0.06em;
  margin-bottom: 14px;
}
.hero p.sub {
  color: var(--ink-2);
  max-width: 640px;
  margin: 12px auto 26px;
  font-size: 1.08rem;
}
.hero-ctas { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid var(--line);
  background: var(--raised);
  color: var(--ink);
  font: inherit;
  font-weight: 700;
  padding: 12px 22px;
  border-radius: 12px;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.12s ease;
}
.btn:hover { transform: translateY(-1px); text-decoration: none; background: #20304d; }
.btn:active { transform: translateY(0); }
.btn.primary {
  background: linear-gradient(135deg, #2563eb, #0f766e); /* darkened so #fff label clears 4.5:1 across the sweep */
  border: none;
  color: #fff;
  box-shadow: 0 8px 24px rgba(53, 115, 232, 0.35);
  font-size: 1.05rem;
  padding: 14px 30px;
}
.btn.primary:hover { box-shadow: 0 10px 30px rgba(53, 115, 232, 0.5); }
.btn.ghost { background: transparent; }
.btn.small { padding: 8px 14px; font-size: 0.9rem; border-radius: 10px; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }

/* ---------- stat tiles ---------- */
.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 14px;
  margin: 34px 0 8px;
}
.stat {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 16px 14px;
  text-align: center;
}
.stat .num {
  font-size: clamp(1.6rem, 3.4vw, 2.3rem);
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.5px;
  line-height: 1.1;
}
.stat .lbl { color: var(--ink-2); font-size: 0.88rem; font-weight: 600; margin-top: 4px; }
.stat .num.accent { color: var(--accent-2); }

/* ---------- cards / sections ---------- */
section.block { padding: 34px 0; }
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
}
.card + .card { margin-top: 18px; }
.card h2, .card h3 { display: flex; align-items: center; gap: 10px; }
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.section-head .hint { color: var(--muted); font-size: 0.86rem; }

.grid-2 { display: grid; grid-template-columns: 1.25fr 1fr; gap: 18px; align-items: start; }
@media (max-width: 860px) { .grid-2 { grid-template-columns: 1fr; } }

/* ---------- party bars ---------- */
.party-rows { display: flex; flex-direction: column; gap: 9px; position: relative; }
.party-row {
  display: grid;
  grid-template-columns: minmax(120px, 190px) 1fr 88px;
  align-items: center;
  gap: 12px;
  min-height: 34px;
}
.party-row .name {
  display: flex; align-items: center; gap: 8px;
  font-weight: 600; font-size: 0.94rem;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.party-row .swatch { width: 11px; height: 11px; border-radius: 3.5px; flex: none; }
.letters-chip {
  font-size: 0.72rem;
  font-weight: 800;
  background: var(--raised);
  border: 1px solid var(--line);
  color: var(--ink-2);
  border-radius: 6px;
  padding: 1px 6px;
  flex: none;
}
.party-row .track {
  position: relative;
  background: var(--raised);
  border-radius: 6px;
  height: 22px;
  overflow: hidden;
}
.party-row .fill {
  position: absolute;
  inset-inline-start: 0;
  top: 0; bottom: 0;
  border-start-start-radius: 6px; border-end-start-radius: 6px;
  border-start-end-radius: 4px; border-end-end-radius: 4px;
  min-width: 2px;
  transition: width 0.7s cubic-bezier(0.22, 1, 0.36, 1);
}
.party-row .vals {
  font-variant-numeric: tabular-nums;
  font-size: 0.88rem;
  color: var(--ink-2);
  text-align: left;
  white-space: nowrap;
}
.party-row .vals b { color: var(--ink); font-weight: 800; }
.party-row.below .fill { opacity: 0.45; }
.party-row.below .name { color: var(--ink-2); }
.below-tag {
  font-size: 0.66rem;
  font-weight: 700;
  color: var(--warn);
  border: 1px solid var(--warn);
  border-radius: 5px;
  padding: 0 5px;
  margin-inline-start: 6px;
  white-space: nowrap;
}
.threshold-line {
  position: absolute;
  top: -6px; bottom: -6px;
  width: 0;
  border-inline-start: 2px dashed rgba(251, 191, 36, 0.5);
  z-index: 2;
  pointer-events: none;
}
.threshold-line::after {
  content: 'אחוז החסימה';
  position: absolute;
  top: -16px;
  inset-inline-start: -30px;
  font-size: 0.66rem;
  color: var(--warn);
  white-space: nowrap;
}
.seats-badge {
  display: inline-block;
  min-width: 26px;
  text-align: center;
  background: var(--raised);
  border: 1px solid var(--line);
  border-radius: 7px;
  font-weight: 800;
  font-size: 0.82rem;
  padding: 1px 7px;
  margin-inline-start: 6px;
}

/* ---------- hemicycle + bloc bar ---------- */
.hemicycle-wrap { text-align: center; }
.hemicycle-wrap svg { width: 100%; max-width: 460px; height: auto; }
.seat { transition: opacity 0.3s; }
.majority-note { color: var(--muted); font-size: 0.8rem; margin-top: 4px; }

.bloc-bar {
  display: flex;
  height: 30px;
  border-radius: 9px;
  overflow: hidden;
  background: var(--raised);
  position: relative;
  gap: 2px; /* spacer between segments */
}
.bloc-bar .seg {
  height: 100%;
  transition: width 0.7s cubic-bezier(0.22, 1, 0.36, 1);
  min-width: 0;
}
.bloc-61 {
  position: absolute;
  top: -7px; bottom: -7px;
  inset-inline-start: 50%;
  border-inline-start: 2px solid var(--ink);
  opacity: 0.8;
}
.bloc-61::after {
  content: '61';
  position: absolute;
  top: -18px;
  inset-inline-start: -9px;
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--ink);
}
.bloc-legend { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 12px; font-size: 0.86rem; color: var(--ink-2); }
.bloc-legend .item { display: inline-flex; align-items: center; gap: 7px; }
.bloc-legend .sw { width: 10px; height: 10px; border-radius: 3px; }

/* legend (charts) */
.chart-legend { display: flex; flex-wrap: wrap; gap: 10px 16px; margin-top: 12px; font-size: 0.84rem; color: var(--ink-2); }
.chart-legend .item { display: inline-flex; align-items: center; gap: 6px; }
.chart-legend .sw { width: 10px; height: 10px; border-radius: 3px; flex: none; }

/* ---------- timeline chart ---------- */
.timeline-chart { position: relative; }
.timeline-chart svg { width: 100%; height: auto; display: block; }

/* chart tooltip (shared) */
.chart-tip {
  position: fixed;
  z-index: 90;
  background: var(--raised);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--shadow);
  padding: 8px 12px;
  font-size: 0.84rem;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.12s;
  max-width: 260px;
}
.chart-tip.on { opacity: 1; }
.chart-tip b { font-variant-numeric: tabular-nums; }

/* ---------- ticker ---------- */
.ticker {
  display: flex;
  flex-direction: column;
  gap: 0;
  max-height: 290px;
  overflow: hidden;
  position: relative;
}
.ticker::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 56px;
  background: linear-gradient(transparent, var(--surface));
  pointer-events: none;
}
.tick {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 9px 2px;
  border-bottom: 1px solid var(--line);
  font-size: 0.9rem;
  animation: tickIn 0.45s ease;
}
.tick .t { color: var(--muted); font-size: 0.76rem; font-variant-numeric: tabular-nums; flex: none; padding-top: 2px; }
@keyframes tickIn {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: none; }
}

/* ---------- steps / how it works ---------- */
.steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; }
.step { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.step .n {
  width: 34px; height: 34px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, #2563eb, #0f766e); /* darkened so #fff label clears 4.5:1 across the sweep */
  color: #fff; font-weight: 900;
  border-radius: 10px;
  margin-bottom: 12px;
}
.step p { color: var(--ink-2); font-size: 0.92rem; margin: 6px 0 0; }

.sec-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.sec-item { display: flex; gap: 12px; align-items: flex-start; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 14px; }
.sec-item .ic { font-size: 1.3rem; flex: none; }
.sec-item b { display: block; margin-bottom: 2px; }
.sec-item span { color: var(--ink-2); font-size: 0.88rem; }

/* ---------- wizard (vote flow) ---------- */
.wizard { max-width: 620px; margin: 34px auto 60px; }
.progress {
  display: flex;
  gap: 6px;
  margin-bottom: 26px;
}
.progress .seg {
  flex: 1;
  height: 5px;
  border-radius: 4px;
  background: var(--raised);
  overflow: hidden;
  position: relative;
}
.progress .seg::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, #3573e8, #2fb7a8);
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 0.4s ease;
}
.progress .seg.done::after, .progress .seg.now::after { transform: scaleX(1); }
.progress .seg.now::after { opacity: 0.85; }

.wizard .card { padding: 28px; }
.field { margin-bottom: 18px; }
.field label { display: block; font-weight: 700; margin-bottom: 7px; font-size: 0.95rem; }
.field .help { color: var(--muted); font-size: 0.82rem; margin-top: 5px; }
input[type='text'], input[type='tel'], input[type='password'], select {
  width: 100%;
  background: var(--raised);
  color: var(--ink);
  border: 1.5px solid var(--field-border);
  border-radius: 11px;
  font: inherit;
  padding: 12px 14px;
  transition: border-color 0.15s;
}
input:focus { outline: none; border-color: var(--accent); }
input.err { border-color: var(--bad); }
.field .errmsg { color: var(--bad); font-size: 0.84rem; margin-top: 6px; min-height: 1.2em; }

/* honeypot — visually gone, present for bots */
.hp-field { position: absolute; opacity: 0; height: 0; overflow: hidden; pointer-events: none; }

.otp-row { display: flex; gap: 9px; direction: ltr; justify-content: center; margin: 10px 0 4px; }
.otp-cell {
  width: 46px; height: 56px;
  text-align: center;
  font-size: 1.5rem;
  font-weight: 800;
  background: var(--raised);
  color: var(--ink);
  border: 1.5px solid var(--field-border);
  border-radius: 11px;
}
.otp-cell:focus { outline: none; border-color: var(--accent); }

.demo-otp {
  background: rgba(251, 191, 36, 0.1);
  border: 1px dashed rgba(251, 191, 36, 0.55);
  color: var(--warn);
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 0.9rem;
  margin: 12px 0;
  text-align: center;
}
.demo-otp b { font-size: 1.25rem; letter-spacing: 0.2em; }

.wizard-nav { display: flex; gap: 10px; margin-top: 22px; justify-content: space-between; flex-wrap: wrap; }

/* survey */
.q-card { margin-bottom: 8px; }
.q-count { color: var(--muted); font-size: 0.84rem; font-weight: 600; }
.q-text { font-size: 1.18rem; font-weight: 800; margin: 8px 0 16px; }
.opts { display: flex; flex-direction: column; gap: 9px; }
.opt {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--raised);
  border: 1.5px solid var(--field-border);
  border-radius: 11px;
  padding: 12px 14px;
  cursor: pointer;
  font: inherit;
  color: var(--ink);
  text-align: start;
  transition: border-color 0.12s, background 0.12s;
}
.opt:hover { border-color: var(--accent); }
.opt.on { border-color: var(--accent); background: rgba(79, 143, 247, 0.12); }
.opt .dot {
  width: 18px; height: 18px;
  border: 2px solid var(--muted);
  border-radius: 50%;
  flex: none;
  display: grid; place-items: center;
}
.opt.on .dot { border-color: var(--accent); }
.opt.on .dot::after { content: ''; width: 9px; height: 9px; border-radius: 50%; background: var(--accent); }

/* ballot slips */
.ballots {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
  gap: 13px;
}
.ballot {
  background: #f7f5ef;
  color: #16181d;
  border: none;
  border-radius: 8px;
  padding: 18px 10px 14px;
  text-align: center;
  cursor: pointer;
  font: inherit;
  position: relative;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.4);
  transition: transform 0.14s ease, box-shadow 0.14s ease;
}
.ballot:hover { transform: translateY(-3px) rotate(-0.4deg); box-shadow: 0 10px 22px rgba(0, 0, 0, 0.5); }
.ballot .letters {
  font-size: 2.1rem;
  font-weight: 900;
  letter-spacing: 0.02em;
  line-height: 1.1;
}
.ballot .pname { font-size: 0.86rem; font-weight: 700; margin-top: 7px; color: #3c414d; }
.ballot .pleader { font-size: 0.74rem; color: #4b5563; margin-top: 2px; min-height: 1em; }
.ballot .stripe { position: absolute; inset-inline: 0; top: 0; height: 5px; border-radius: 8px 8px 0 0; }
.ballot.on {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
  transform: translateY(-3px) scale(1.03);
}
.ballot.on::after {
  content: '✓';
  position: absolute;
  top: 8px; inset-inline-end: 9px;
  width: 24px; height: 24px;
  background: var(--accent);
  color: #fff;
  border-radius: 50%;
  display: grid; place-items: center;
  font-weight: 900;
  font-size: 0.9rem;
}

/* confirm modal */
.modal-back {
  position: fixed; inset: 0;
  background: rgba(4, 8, 16, 0.72);
  display: grid; place-items: center;
  z-index: 100;
  padding: 20px;
}
.modal {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  max-width: 420px;
  width: 100%;
  padding: 26px;
  text-align: center;
  box-shadow: var(--shadow);
  animation: modalIn 0.22s ease;
}
@keyframes modalIn { from { opacity: 0; transform: scale(0.94); } to { opacity: 1; transform: none; } }
.modal .big-ballot {
  margin: 14px auto;
  max-width: 190px;
}

/* receipt */
.receipt-box {
  background: var(--raised);
  border: 1.5px dashed var(--line);
  border-radius: 12px;
  padding: 16px;
  margin: 16px 0;
  text-align: center;
}
.receipt-box .code {
  font-size: 1.5rem;
  font-weight: 900;
  letter-spacing: 0.12em;
  font-variant-numeric: tabular-nums;
  direction: ltr;
  color: var(--accent-2);
}

/* ---------- toasts ---------- */
.toasts {
  position: fixed;
  bottom: 18px;
  inset-inline-start: 18px;
  z-index: 120;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: min(360px, calc(100vw - 36px));
}
.toast {
  background: var(--raised);
  border: 1px solid var(--line);
  border-inline-start: 4px solid var(--accent);
  border-radius: 12px;
  padding: 12px 16px;
  box-shadow: var(--shadow);
  font-size: 0.92rem;
  animation: toastIn 0.3s ease;
}
.toast.milestone { border-inline-start-color: var(--accent-2); }
.toast.warn { border-inline-start-color: var(--warn); }
@keyframes toastIn { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.toast.out { opacity: 0; transform: translateY(8px); transition: 0.3s; }

/* ---------- confetti ---------- */
.confetti {
  position: fixed;
  top: -12px;
  z-index: 130;
  width: 9px; height: 15px;
  pointer-events: none;
  animation: fall linear forwards;
}
@keyframes fall {
  to { transform: translateY(105vh) rotate(720deg); opacity: 0.4; }
}

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; }
table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
table.data th, table.data td {
  padding: 9px 10px;
  border-bottom: 1px solid var(--line);
  text-align: start;
  white-space: nowrap;
}
table.data th { color: var(--ink-2); font-weight: 700; font-size: 0.82rem; }
table.data td.num { font-variant-numeric: tabular-nums; }

/* ---------- footer ---------- */
footer.site {
  border-top: 1px solid var(--line);
  margin-top: 50px;
  padding: 26px 0 34px;
  color: var(--muted);
  font-size: 0.85rem;
}
footer.site .disclaimer { max-width: 760px; }

/* ---------- utilities ---------- */
.center { text-align: center; }
.mt-0 { margin-top: 0; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.spin {
  width: 18px; height: 18px;
  border: 2.5px solid rgba(255, 255, 255, 0.25);
  border-top-color: #fff;
  border-radius: 50%;
  animation: rot 0.7s linear infinite;
  display: inline-block;
  vertical-align: -4px;
}
@keyframes rot { to { transform: rotate(360deg); } }

.notify-cta { display: inline-flex; align-items: center; gap: 8px; }

textarea {
  width: 100%;
  background: var(--raised);
  color: var(--ink);
  border: 1.5px solid var(--field-border);
  border-radius: 11px;
  font: inherit;
  padding: 12px 14px;
  resize: vertical;
  transition: border-color 0.15s;
}
textarea:focus { outline: none; border-color: var(--accent); }
/* Strong, offset keyboard focus ring on form controls (WCAG 2.4.7); :focus-visible
   keeps mouse clicks clean while giving keyboard users a clear indicator. */
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
.otp-cell:focus-visible,
.opt:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
input[type='date'] { color-scheme: dark; }
code, .mono { font-family: ui-monospace, 'SF Mono', 'Cascadia Code', Menlo, Consolas, monospace; font-size: 0.85em; }

/* ---------- public status banner ---------- */
.status-banner {
  border-radius: var(--radius);
  padding: 13px 18px;
  margin: 18px 0 0;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
}
.status-banner .bic { font-size: 1.2rem; flex: none; }
.status-banner.paused { background: rgba(251, 191, 36, 0.12); border-color: rgba(251, 191, 36, 0.4); color: var(--warn); }
.status-banner.closed { background: rgba(248, 113, 113, 0.10); border-color: rgba(248, 113, 113, 0.4); color: #fca5a5; }
.status-banner.embargo { background: rgba(79, 143, 247, 0.10); border-color: rgba(79, 143, 247, 0.4); color: var(--ink-2); }

/* ---------- admin console ---------- */
.admin-shell { padding: 20px 0 60px; }
.control-bar {
  position: sticky;
  top: 60px;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 16px;
  box-shadow: var(--shadow);
}
.cb-status { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 200px; }
.cb-actions { display: flex; gap: 6px; }
.cb-meta { display: flex; align-items: center; gap: 12px; margin-inline-start: auto; }
.status-badge {
  display: inline-flex; align-items: center; gap: 7px;
  font-weight: 800; font-size: 0.95rem;
  padding: 6px 14px; border-radius: 999px;
  background: var(--raised); border: 1px solid var(--line);
}
.status-badge::before { content: ''; width: 9px; height: 9px; border-radius: 50%; background: currentColor; }
.status-badge.s-open { color: var(--good); border-color: rgba(52,211,153,0.4); }
.status-badge.s-paused { color: var(--warn); border-color: rgba(251,191,36,0.4); }
.status-badge.s-closed { color: #fca5a5; border-color: rgba(248,113,113,0.4); }
.cb-actions .btn.active { outline: 2px solid var(--accent); outline-offset: 1px; }

.tabs { display: flex; gap: 4px; margin: 18px 0; flex-wrap: wrap; border-bottom: 1px solid var(--line); }
.tab {
  background: transparent; border: none; color: var(--ink-2);
  font: inherit; font-weight: 700; font-size: 0.95rem;
  padding: 10px 16px; cursor: pointer; border-radius: 10px 10px 0 0;
  border-bottom: 2.5px solid transparent; margin-bottom: -1px;
}
.tab:hover { color: var(--ink); background: var(--surface); }
.tab.active { color: var(--ink); border-bottom-color: var(--accent); }
.pane { display: none; }
.pane.active { display: block; animation: fadeIn 0.25s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* funnel */
.funnel-row { display: grid; grid-template-columns: 120px 1fr 64px; align-items: center; gap: 12px; margin-bottom: 10px; }
.funnel-row .fl { font-size: 0.9rem; font-weight: 600; color: var(--ink-2); }
.funnel-row .ft { background: var(--raised); border-radius: 6px; height: 20px; overflow: hidden; }
.funnel-row .ff { display: block; height: 100%; border-radius: 6px; transition: width 0.6s cubic-bezier(0.22,1,0.36,1); min-width: 2px; }
.funnel-row .fv { text-align: left; font-variant-numeric: tabular-nums; font-weight: 800; }

.pill-inline { font-size: 0.82rem; color: var(--muted); }
.pill-inline.on { color: var(--accent); font-weight: 700; }
.save-note { align-self: center; font-size: 0.9rem; color: var(--good); font-weight: 700; }

/* switch row */
.switch-row { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; cursor: pointer; }
.switch-row input { margin-top: 3px; flex: none; width: 18px; height: 18px; }

/* lifecycle diagram */
.lifecycle { display: flex; align-items: stretch; gap: 8px; flex-wrap: wrap; }
.lc-step {
  flex: 1; min-width: 120px;
  display: flex; flex-direction: column; gap: 2px;
  background: var(--raised); border: 1.5px solid var(--line);
  border-radius: var(--radius-sm); padding: 12px 14px;
}
.lc-step .ic { font-size: 1.1rem; }
.lc-step .muted { font-size: 0.78rem; }
.lc-step.on { border-color: var(--accent); background: rgba(79,143,247,0.1); }
.lc-arrow { align-self: center; color: var(--muted); font-size: 1.2rem; }
@media (max-width: 620px) { .lc-arrow { transform: rotate(-90deg); } }

/* blocklist / reset inputs */
.block-add { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0; }
.block-add input { flex: 1; min-width: 140px; width: auto; }
.block-add select { width: auto; }

.card.danger { border-color: rgba(248, 113, 113, 0.45); }
.card.danger h2 { color: #fca5a5; }
.btn.danger-btn { background: #b91c1c; border: none; color: #fff; font-weight: 800; }
.btn.danger-btn:hover:not(:disabled) { background: #dc2626; }

/* audit event chips */
.evt { font-size: 0.76rem; font-weight: 700; padding: 1px 7px; border-radius: 6px; background: var(--raised); border: 1px solid var(--line); white-space: nowrap; }
.evt-ballot_cast { color: var(--accent-2); }
.evt-verified { color: var(--good); }
.evt-settings_update, .evt-poll_reset { color: var(--warn); }
.evt-phone_conflict, .evt-otp_fail, .evt-block_add { color: #fca5a5; }
#auditTable td.mono { max-width: 260px; overflow: hidden; text-overflow: ellipsis; }

@media (max-width: 640px) {
  .control-bar { top: 56px; }
  .funnel-row { grid-template-columns: 92px 1fr 52px; gap: 8px; }
  .cb-meta { margin-inline-start: 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001s !important; transition-duration: 0.001s !important; }
  html { scroll-behavior: auto; }
}

@media (max-width: 640px) {
  .party-row { grid-template-columns: minmax(96px, 132px) 1fr 74px; gap: 8px; }
  .party-row .name { font-size: 0.85rem; }
  /* The metrics cell holds "votes · pct" plus the below-threshold tag; at 74px
     the nowrap line pokes past the viewport edge (RTL: leftward) and forces
     page-level horizontal scroll. Let it wrap — the tag drops to its own line. */
  .party-row .vals { white-space: normal; }
  .below-tag { display: inline-block; margin-top: 2px; }
  .letters-chip { display: none; }
  nav.main a:not(.cta-nav) { display: none; }
  .hero { padding: 44px 0 26px; }
  /* keep the sticky header inside the viewport: let the logo shrink+truncate */
  header.site .wrap { gap: 8px; padding: 0 12px; }
  .logo { flex: 1; min-width: 0; font-size: 0.95rem; gap: 6px; }
  .logo .lt { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
  .live-pill { font-size: 0.78rem; padding: 4px 9px; }
  .wizard .card { padding: 20px 16px; }
}

/* Very narrow phones: the header row (logo · lang switch · live pill) still
   overhangs by a few px — tighten the two pills so nothing forces h-scroll. */
@media (max-width: 420px) {
  .lang-switch button { padding: 4px 7px; font-size: 0.72rem; }
  .live-pill { font-size: 0.7rem; padding: 3px 7px; }
}
