/* Union election live site.
   Palette: cool ballot-paper greys with one accent, the violet of indelible voting ink.
   Party colours are data and are the only other saturated colours on the page. */
@font-face {
  font-family: "Archivo";
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  font-stretch: 62% 125%;
  src: url(/fonts/archivo.woff2) format("woff2-variations"), url(/fonts/archivo.woff2) format("woff2");
}
:root {
  --paper: #f2f4f6;
  --surface: #ffffff;
  --ink: #18212c;
  --muted: #5a6572;
  --faint: #8d97a2;
  --line: #d6dce2;
  --track: #e6eaee;
  --ink-violet: #4b2b8a;
  --violet-soft: #ece6f8;
  --danger: #b3261e;
  --ok: #1d6b3a;
  --focus: #4b2b8a;
  --radius-s: 4px;
  --radius-m: 10px;
  --wrap: 1080px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #0f141a;
    --surface: #171e27;
    --ink: #e7ecf1;
    --muted: #a0abb7;
    --faint: #74808d;
    --line: #2a3441;
    --track: #232c37;
    --ink-violet: #b69cf0;
    --violet-soft: #2a2140;
    --danger: #ff8a80;
    --ok: #7fd49b;
    --focus: #b69cf0;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "Archivo", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.5;
  font-variant-numeric: tabular-nums;
}
a { color: var(--ink-violet); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 16px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- header ---------- */
.site-head { background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; }
.site-head .wrap { display: flex; align-items: center; gap: 16px; min-height: 56px; flex-wrap: wrap; }
.brand { font-stretch: 72%; font-weight: 800; font-size: 1.15rem; letter-spacing: .01em; text-decoration: none; color: var(--ink); line-height: 1.1; padding: 8px 0; }
.brand small { display: block; font-stretch: 100%; font-weight: 500; font-size: .75rem; color: var(--muted); }
.tabs { display: flex; gap: 4px; margin-left: auto; overflow-x: auto; scrollbar-width: none; }
.tabs a { padding: 16px 10px 14px; text-decoration: none; color: var(--muted); font-weight: 600; font-size: .95rem; border-bottom: 3px solid transparent; white-space: nowrap; }
.tabs a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--ink-violet); }
@media (max-width: 640px) {
  .site-head .wrap { gap: 0; }
  .tabs { margin-left: -10px; width: calc(100% + 20px); }
  .tabs a { padding: 10px 10px 10px; }
}

.notice { background: var(--violet-soft); color: var(--ink); border-bottom: 1px solid var(--line); font-size: .92rem; }
.notice .wrap { padding-top: 8px; padding-bottom: 8px; }
.unofficial { color: var(--muted); font-size: .85rem; margin: 18px 0 0; }

main { padding-bottom: 64px; }
h1, h2, h3 { line-height: 1.15; margin: 0; }
.page-title { font-stretch: 68%; font-weight: 800; font-size: clamp(2rem, 6vw, 3.2rem); letter-spacing: -.005em; margin: 28px 0 6px; }
.lede { color: var(--muted); max-width: 62ch; margin: 0 0 20px; }

/* ---------- live status line ---------- */
.livebar { display: flex; flex-wrap: wrap; gap: 6px 18px; align-items: center; color: var(--muted); font-size: .9rem; margin: 0 0 18px; }
.live-dot { display: inline-flex; align-items: center; gap: 8px; color: var(--ink); font-weight: 600; }
.live-dot::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--ink-violet); }
.live-dot.stale::before { background: var(--faint); }
.live-dot.pulse::before { animation: pulse 1.6s ease-out infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--ink-violet) 60%, transparent); } 100% { box-shadow: 0 0 0 10px transparent; } }
@media (prefers-reduced-motion: reduce) { .live-dot.pulse::before { animation: none; } }

/* ---------- seat strip (the hero) ---------- */
.strip-block { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m); padding: 18px 18px 14px; margin-bottom: 28px; }
.strip-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.strip-head h2 { font-stretch: 72%; font-weight: 800; font-size: 1.35rem; }
.strip-head p { margin: 0; color: var(--muted); font-size: .88rem; }
.strip { display: flex; gap: 10px; align-items: flex-end; }
.strip-group { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.strip-group[data-g="main"] { flex: 9 1 0; }
.strip-group[data-g="ug"] { flex: 9 1 0; }
.strip-group[data-g="pg"] { flex: 31 1 0; }
.strip-cells { display: flex; gap: 2px; height: 64px; }
.seat { flex: 1 1 0; min-width: 0; border-radius: 2px; background: var(--track); border: 0; padding: 0; cursor: pointer; position: relative; }
.seat.lead { background-image: repeating-linear-gradient(135deg, var(--c) 0 3px, transparent 3px 6px); background-color: color-mix(in srgb, var(--c) 18%, var(--surface)); }
.seat.won { background: var(--c); }
.seat.won.unopp { background: var(--c); opacity: .78; }
.strip-label { font-size: .78rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.strip-legend { display: flex; flex-wrap: wrap; gap: 8px 22px; margin-top: 16px; padding: 0; list-style: none; }
.strip-legend li { display: flex; align-items: baseline; gap: 8px; font-size: .95rem; }
.swatch { width: 12px; height: 12px; border-radius: 3px; display: inline-block; flex: none; background: var(--c, var(--faint)); align-self: center; }
.strip-legend b { font-stretch: 75%; font-size: 1.2rem; }
.strip-legend .sub { color: var(--muted); font-size: .85rem; }
.key { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 10px; color: var(--muted); font-size: .8rem; }
.key span { display: inline-flex; align-items: center; gap: 6px; }
.key i { width: 14px; height: 14px; border-radius: 2px; display: inline-block; background: var(--ink); }
.key i.k-lead { background: repeating-linear-gradient(135deg, var(--ink) 0 2px, transparent 2px 4px); }
.key i.k-wait { background: var(--track); }
.seat-tip { position: fixed; z-index: 30; background: var(--ink); color: var(--paper); font-size: .82rem; padding: 6px 9px; border-radius: 6px; pointer-events: none; max-width: 240px; }
@media (max-width: 640px) {
  .strip { flex-direction: column; align-items: stretch; gap: 12px; }
  .strip-cells { height: 34px; }
}

/* ---------- filters ---------- */
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 0 0 18px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); padding: 3px; }
.seg button { border: 0; background: transparent; padding: 6px 12px; border-radius: 999px; cursor: pointer; color: var(--muted); font-weight: 600; font-size: .9rem; }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
.search { flex: 1 1 200px; min-width: 0; padding: 8px 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); }

/* ---------- post blocks ---------- */
.section-title { font-stretch: 72%; font-weight: 800; font-size: 1.5rem; margin: 34px 0 12px; display: flex; align-items: baseline; gap: 10px; }
.section-title span { font-stretch: 100%; font-weight: 500; font-size: .9rem; color: var(--muted); }
.posts { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 330px), 1fr)); gap: 14px; }
.posts.main { grid-template-columns: repeat(auto-fill, minmax(min(100%, 480px), 1fr)); }
.post { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m); padding: 16px 16px 12px; display: flex; flex-direction: column; gap: 10px; }
.post-head { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.post-name { font-stretch: 70%; font-weight: 800; font-size: 1.3rem; }
.post-dept { display: block; font-stretch: 100%; font-weight: 500; font-size: .85rem; color: var(--muted); margin-top: 2px; }
.status { font-size: .78rem; font-weight: 700; padding: 3px 8px; border-radius: 999px; white-space: nowrap; border: 1px solid var(--line); color: var(--muted); }
.status.counting { color: var(--ink-violet); border-color: color-mix(in srgb, var(--ink-violet) 40%, transparent); background: var(--violet-soft); }
.status.declared { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.status.unopposed { color: var(--ink); }
.cands { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 9px; }
.cand { display: grid; grid-template-columns: 1fr auto; gap: 3px 12px; align-items: baseline; }
.cand-name { display: flex; align-items: center; gap: 7px; min-width: 0; font-weight: 600; }
.cand-name { flex-wrap: wrap; }
.cand-name .nm { overflow-wrap: anywhere; }
.cand-party { color: var(--muted); font-weight: 400; font-size: .82rem; white-space: nowrap; }
.cand-votes { font-stretch: 75%; font-weight: 800; font-size: 1.15rem; text-align: right; }
.cand-votes small { font-stretch: 100%; font-weight: 500; font-size: .78rem; color: var(--muted); margin-left: 4px; }
.track { grid-column: 1 / -1; height: 10px; background: var(--track); border-radius: 3px; position: relative; overflow: visible; }
.fill { display: block; height: 100%; border-radius: 3px; background: var(--c, var(--faint)); width: 0; transition: width .6s cubic-bezier(.2, .7, .2, 1); }
.cand:not(.top) .fill { opacity: .45; }
.cand.winner .cand-name::after { content: "Elected"; font-size: .72rem; font-weight: 700; color: var(--paper); background: var(--ink); padding: 1px 6px; border-radius: 3px; }
.poll-tick { position: absolute; top: -3px; bottom: -3px; width: 3px; border-radius: 2px; background: var(--ink-violet); box-shadow: 0 0 0 1.5px var(--surface); }
@media (prefers-reduced-motion: reduce) { .fill { transition: none; } }
.post-foot { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 4px 12px; color: var(--muted); font-size: .82rem; border-top: 1px solid var(--line); padding-top: 9px; }
.linkish { background: none; border: 0; padding: 0; color: var(--ink-violet); cursor: pointer; font-size: inherit; text-decoration: underline; text-underline-offset: 2px; }
.batches { width: 100%; border-collapse: collapse; font-size: .82rem; }
.batches th, .batches td { text-align: right; padding: 4px 6px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.batches th:first-child, .batches td:first-child { text-align: left; }
.batches-wrap { overflow-x: auto; }
.tie { color: var(--danger); font-weight: 700; }

.unopp-list { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m); padding: 6px 16px; margin-top: 14px; }
.unopp-list h3 { font-size: .95rem; margin: 10px 0 4px; }
.unopp-list ul { list-style: none; padding: 0; margin: 0; }
.unopp-list li { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-top: 1px solid var(--line); font-size: .92rem; }
.unopp-list li:first-child { border-top: 0; }
.unopp-list .dept { color: var(--muted); }

.empty { color: var(--muted); padding: 28px 0; }
.log { list-style: none; padding: 0; margin: 0; font-size: .88rem; }
.log li { padding: 6px 0; border-bottom: 1px solid var(--line); display: flex; gap: 12px; }
.log time { color: var(--muted); flex: none; width: 4.5em; }

/* ---------- forms ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m); padding: 18px; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.field label, .field legend { font-weight: 600; }
.hint { color: var(--muted); font-size: .85rem; margin: 0; }
input[type="text"], input[type="number"], input[type="search"], input[type="datetime-local"], select, textarea {
  border: 1px solid var(--line); border-radius: var(--radius-s); background: var(--surface); padding: 10px 12px; width: 100%;
}
input.invalid { border-color: var(--danger); }
textarea { min-height: 140px; resize: vertical; line-height: 1.5; }
.row { display: flex; gap: 12px; flex-wrap: wrap; }
.row > .field { flex: 1 1 180px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid var(--ink); background: var(--ink); color: var(--paper); padding: 10px 18px; border-radius: var(--radius-s); font-weight: 700; cursor: pointer; text-decoration: none; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn.small { padding: 5px 10px; font-size: .85rem; font-weight: 600; }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.msg { padding: 10px 12px; border-radius: var(--radius-s); font-size: .92rem; margin: 10px 0; }
.msg.err { background: color-mix(in srgb, var(--danger) 12%, var(--surface)); color: var(--danger); }
.msg.ok { background: color-mix(in srgb, var(--ok) 12%, var(--surface)); color: var(--ok); }
.hashline { font-size: .8rem; color: var(--muted); word-break: break-all; margin-top: 4px; }
.hashline code { background: var(--track); padding: 1px 5px; border-radius: 3px; }

/* exit poll questions */
fieldset.q { border: 1px solid var(--line); border-radius: var(--radius-m); padding: 14px 16px 10px; margin: 0 0 14px; background: var(--surface); }
fieldset.q legend { font-stretch: 72%; font-weight: 800; font-size: 1.2rem; padding: 0 6px; margin-left: -6px; }
.opt { display: flex; align-items: center; gap: 10px; padding: 9px 4px; border-top: 1px solid var(--line); cursor: pointer; }
.opt:first-of-type { border-top: 0; }
.opt input { width: 18px; height: 18px; accent-color: var(--ink-violet); flex: none; }
.opt .party { color: var(--muted); font-size: .85rem; margin-left: auto; text-align: right; }
.opt.skip { color: var(--muted); }

/* leaderboard */
.lb { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 420px), 1fr)); gap: 14px; }
.lb .post { gap: 8px; }
.breakdown { width: 100%; border-collapse: collapse; font-size: .82rem; }
.breakdown th, .breakdown td { padding: 5px 6px; border-bottom: 1px solid var(--line); text-align: right; white-space: nowrap; }
.breakdown th:first-child, .breakdown td:first-child { text-align: left; white-space: normal; }
.breakdown td.hi { font-weight: 800; }

/* noticeboard */
.board { display: flex; flex-direction: column; gap: 14px; max-width: 720px; }
.slip { background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--ink-violet); border-radius: var(--radius-s); padding: 16px 18px 12px; }
.slip h3 { font-stretch: 74%; font-weight: 800; font-size: 1.3rem; margin-bottom: 6px; overflow-wrap: anywhere; }
.slip .body { white-space: pre-wrap; overflow-wrap: anywhere; margin: 0 0 10px; max-width: 68ch; }
.slip-meta { display: flex; gap: 16px; flex-wrap: wrap; font-size: .85rem; color: var(--muted); align-items: center; }
.comments { margin-top: 10px; border-top: 1px solid var(--line); padding-top: 8px; }
.comments ul { list-style: none; margin: 0 0 8px; padding: 0; }
.comments li { padding: 6px 0; border-bottom: 1px dashed var(--line); font-size: .93rem; overflow-wrap: anywhere; }
.comments li .slip-meta { font-size: .78rem; margin-top: 2px; }
.comment-form { display: flex; gap: 8px; }
.comment-form input { flex: 1; }
.wc { font-size: .82rem; color: var(--muted); text-align: right; }
.wc.bad { color: var(--danger); }
.compose { max-width: 720px; margin-bottom: 22px; }

/* privacy page */
.prose { max-width: 68ch; }
.prose h2 { font-stretch: 72%; font-weight: 800; font-size: 1.4rem; margin: 30px 0 8px; }
.prose p, .prose li { color: var(--ink); }
.prose li { margin-bottom: 6px; }

/* admin */
.admin-tabs { display: flex; gap: 4px; flex-wrap: wrap; border-bottom: 1px solid var(--line); margin: 18px 0; }
.admin-tabs button { border: 0; background: none; padding: 10px 12px; font-weight: 600; color: var(--muted); border-bottom: 3px solid transparent; cursor: pointer; }
.admin-tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--ink-violet); }
.count-layout { display: grid; grid-template-columns: 300px 1fr; gap: 18px; align-items: start; }
@media (max-width: 820px) { .count-layout { grid-template-columns: 1fr; } }
.post-list { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m); max-height: 72vh; overflow-y: auto; }
.post-list button { display: flex; justify-content: space-between; align-items: center; gap: 8px; width: 100%; text-align: left; border: 0; border-bottom: 1px solid var(--line); background: none; padding: 9px 12px; cursor: pointer; font-size: .9rem; }
.post-list button[aria-current="true"] { background: var(--violet-soft); }
.post-list .grp { padding: 8px 12px; font-size: .78rem; font-weight: 700; color: var(--muted); background: var(--paper); border-bottom: 1px solid var(--line); }
.entry-grid { display: grid; grid-template-columns: 1fr 120px 90px; gap: 8px 12px; align-items: center; }
.entry-grid .h { font-size: .8rem; color: var(--muted); font-weight: 600; }
.entry-grid input { text-align: right; padding: 8px 10px; }
.entry-grid .tot { text-align: right; font-weight: 700; }
.table { width: 100%; border-collapse: collapse; font-size: .88rem; }
.table th, .table td { padding: 7px 8px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.table td.num, .table th.num { text-align: right; }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin: 10px 0; }
.mod-item { border: 1px solid var(--line); border-radius: var(--radius-s); padding: 12px 14px; background: var(--surface); margin-bottom: 10px; }
.mod-item.hidden-item { border-color: var(--danger); }
.pill { font-size: .75rem; font-weight: 700; padding: 2px 7px; border-radius: 999px; background: var(--track); color: var(--muted); }
.pill.bad { background: color-mix(in srgb, var(--danger) 15%, var(--surface)); color: var(--danger); }
.spark { display: flex; align-items: flex-end; gap: 2px; height: 60px; }
.spark span { flex: 1; background: var(--ink-violet); border-radius: 1px; min-height: 1px; }
.login-box { max-width: 420px; margin: 60px auto; }
dialog { border: 1px solid var(--line); border-radius: var(--radius-m); background: var(--surface); color: var(--ink); max-width: min(520px, 92vw); }
dialog::backdrop { background: rgb(0 0 0 / .45); }
.toast { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); background: var(--ink); color: var(--paper); padding: 10px 16px; border-radius: 8px; z-index: 50; font-size: .92rem; max-width: 90vw; }
.toast.err { background: var(--danger); color: #fff; }
.site-foot { color: var(--muted); font-size: .82rem; border-top: 1px solid var(--line); padding: 18px 0 30px; }
.poll-tick-key { display: inline-block; width: 3px; height: 14px; border-radius: 2px; background: var(--ink-violet); }
#count-panel h3 { margin: 18px 0 10px; font-size: 1.05rem; }
#count-panel .post-head { margin-bottom: 4px; }
