:root {
  --ink: #16202b;
  --ink-soft: #5b6b7c;
  --line: #dde4ec;
  --surface: #ffffff;
  --page: #f4f7fa;
  --accent: #1d5fb4;
  --accent-dark: #164a8f;
  --good: #1f7a4d;
  --good-soft: #e7f4ed;
  --warn: #9a5b00;
  --warn-soft: #fdf3e2;
  --bad: #b3261e;
  --bad-soft: #fbeceb;
  --radius: 12px;

  /* Data-mark colors. Turnout is a single ratio against a limit, so it is a
     meter on a same-ramp track: sequential blue step 450 on step 100. The
     results list is one measure across candidates, so every bar is the same
     hue - a per-candidate palette would imply an identity encoding that isn't
     there. Validated against a white surface with the skill's checker. */
  --seq-fill: #2a78d6;
  --seq-track: #cde2fb;
  --status-good: #0ca30c;
  --status-critical: #d03b3b;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--page);
  color: var(--ink);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

.shell {
  max-width: 620px;
  margin: 0 auto;
  padding: 24px 20px 64px;
}

.shell--wide {
  max-width: 1040px;
}

header.bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 0 26px;
}

header.bar h1 {
  font-size: 20px;
  margin: 0;
  letter-spacing: -0.01em;
}

header.bar .sub {
  margin: 2px 0 0;
  font-size: 14px;
  color: var(--ink-soft);
}

.lang {
  display: flex;
  border: 1px solid var(--line);
  border-radius: 999px;
  overflow: hidden;
  background: var(--surface);
  flex: none;
}

.lang button {
  border: 0;
  background: transparent;
  padding: 7px 14px;
  font: inherit;
  font-size: 14px;
  cursor: pointer;
  color: var(--ink-soft);
}

.lang button[aria-pressed="true"] {
  background: var(--accent);
  color: #fff;
  font-weight: 600;
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 28px;
}

.card h2 {
  margin: 0 0 8px;
  font-size: 24px;
  letter-spacing: -0.02em;
}

.card p.lede {
  margin: 0 0 22px;
  color: var(--ink-soft);
  font-size: 16px;
}

label.field {
  display: block;
  font-weight: 600;
  font-size: 15px;
  margin-bottom: 8px;
}

input[type="email"],
input[type="text"] {
  width: 100%;
  padding: 14px 16px;
  font-size: 17px;
  font-family: inherit;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
}

input:focus-visible,
button:focus-visible,
.choice:focus-within {
  outline: 3px solid rgba(29, 95, 180, 0.35);
  outline-offset: 2px;
}

input.code {
  font-size: 30px;
  letter-spacing: 12px;
  text-align: center;
  font-variant-numeric: tabular-nums;
  padding: 16px;
}

button.primary {
  width: 100%;
  margin-top: 18px;
  padding: 15px 20px;
  font: inherit;
  font-size: 17px;
  font-weight: 600;
  color: #fff;
  background: var(--accent);
  border: 0;
  border-radius: 10px;
  cursor: pointer;
}

button.primary:hover:not(:disabled) {
  background: var(--accent-dark);
}

button.primary:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

button.link {
  background: none;
  border: 0;
  color: var(--accent);
  font: inherit;
  font-size: 15px;
  text-decoration: underline;
  cursor: pointer;
  padding: 10px 0 0;
}

.choices {
  display: grid;
  gap: 12px;
  margin: 4px 0 6px;
}

/* One block per office on the ballot: Chair, Vice Chair, and so on. */
.contest {
  margin-bottom: 28px;
}

.contest h3 {
  margin: 0 0 2px;
  font-size: 18px;
  letter-spacing: -0.01em;
}

.contest .contest-hint {
  margin: 0 0 12px;
  font-size: 14px;
  color: var(--ink-soft);
}

.contest.needs-answer h3 {
  color: var(--bad);
}

.contest.needs-answer .choices .choice {
  border-color: #eec4c1;
}

.choice {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  border: 2px solid var(--line);
  border-radius: 10px;
  padding: 16px 18px;
  cursor: pointer;
  background: #fff;
}

.choice:hover {
  border-color: #b9c8da;
}

.choice input {
  margin: 3px 0 0;
  width: 20px;
  height: 20px;
  flex: none;
  accent-color: var(--accent);
}

.choice.selected {
  border-color: var(--accent);
  background: #f2f7fd;
}

.choice .name {
  font-weight: 600;
  font-size: 17px;
}

.choice .blurb {
  margin: 4px 0 0;
  font-size: 14px;
  color: var(--ink-soft);
}

.notice {
  border-radius: 10px;
  padding: 14px 16px;
  font-size: 15px;
  margin-bottom: 20px;
}

.notice--error {
  background: var(--bad-soft);
  color: var(--bad);
  border: 1px solid #f0c9c6;
}

.notice--info {
  background: #eef4fc;
  color: var(--accent-dark);
  border: 1px solid #cfe0f5;
}

.notice--good {
  background: var(--good-soft);
  color: var(--good);
  border: 1px solid #c7e6d5;
}

.hidden {
  display: none !important;
}

.tick {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--good-soft);
  color: var(--good);
  display: grid;
  place-items: center;
  font-size: 30px;
  margin-bottom: 18px;
}

.privacy {
  margin-top: 24px;
  font-size: 14px;
  color: var(--ink-soft);
  text-align: center;
  line-height: 1.6;
}

/* --- admin ------------------------------------------------------------- */

.site-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
}

.site-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
}

.site-card h3 {
  margin: 0 0 2px;
  font-size: 17px;
}

.site-card .meta {
  font-size: 13px;
  color: var(--ink-soft);
  margin: 0 0 16px;
}

.turnout-figure {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 10px;
}

.turnout-figure .count {
  font-size: 30px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

.turnout-figure .of {
  font-size: 15px;
  color: var(--ink-soft);
}

/* Turnout is one ratio against a limit, so it is a meter, not a chart: a
   same-ramp track with one filled span. The remainder stays visible because
   "how many are left" is the number coordinators actually act on. */
.meter {
  height: 10px;
  border-radius: 999px;
  background: var(--seq-track);
  overflow: hidden;
}

.meter > span {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: var(--seq-fill);
  transition: width 0.3s ease;
}

/* Complete is a status, so it also carries the "All voted" text label beside
   it - the color never has to be read on its own. */
.meter.is-complete > span {
  background: var(--status-good);
}

.pill {
  display: inline-block;
  font-size: 12px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.pill--draft {
  background: #eceff3;
  color: var(--ink-soft);
}

.pill--open {
  background: var(--good-soft);
  color: var(--good);
}

.pill--closed {
  background: var(--warn-soft);
  color: var(--warn);
}

.row-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 16px;
}

.row-actions button,
.row-actions a {
  font: inherit;
  font-size: 14px;
  padding: 8px 14px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  text-decoration: none;
}

.row-actions button:hover,
.row-actions a:hover {
  border-color: #b9c8da;
}

table.roster {
  width: 100%;
  border-collapse: collapse;
  font-size: 15px;
}

table.roster th,
table.roster td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
}

table.roster th {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-soft);
}

table.roster td.status-yes {
  color: var(--good);
  font-weight: 600;
}

table.roster td.status-no {
  color: var(--ink-soft);
}

/* Results are one measure (votes) compared across candidates, so: horizontal
   bars in a single hue, capped thickness, rounded data-end, value at the tip.
   One series means no legend - the heading says what is plotted. */
.bar-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 14px;
}

.bar-list .bar-label {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 6px;
  font-size: 15px;
}

.bar-list .bar-label .elected {
  font-weight: 650;
}

.bar-list .bar-label .votes {
  font-variant-numeric: tabular-nums;
  color: var(--ink-soft);
  flex: none;
}

.bar-list .bar-track {
  height: 16px;
  background: transparent;
}

.bar-list .bar-fill {
  display: block;
  height: 100%;
  min-width: 2px;
  background: var(--seq-fill);
  border-radius: 0 4px 4px 0;
}

.bar-list li.is-elected .bar-fill {
  background: var(--seq-fill);
}

.bar-list li:not(.is-elected) .bar-fill {
  opacity: 0.45;
}

.elected-key {
  font-size: 13px;
  color: var(--ink-soft);
  margin: 16px 0 0;
}

@media (max-width: 560px) {
  .card {
    padding: 22px 18px;
  }
  .shell {
    padding: 12px 14px 48px;
  }
}
