/* PolitiWard — survey plat world. Tokens mirror app/theme.py; see DESIGN.md. */

/* Self-hosted Google Fonts (SIL Open Font License 1.1), latin subset. */
@font-face {
  font-family: 'Barlow Semi Condensed';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('fonts/BarlowSemiCondensed-normal-500.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: 'Barlow Semi Condensed';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('fonts/BarlowSemiCondensed-normal-600.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: 'Barlow Semi Condensed';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('fonts/BarlowSemiCondensed-normal-700.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: 'Public Sans';
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url('fonts/PublicSans-italic-400.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: 'Public Sans';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('fonts/PublicSans-normal-400_700.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;
}

:root {
  --ink-950: #0f1720;
  --ink-900: #17212c;
  --ink-800: #243140;
  --ink-600: #4a5666;
  --ink-500: #5d6875;
  --ink-400: #808994;
  --rule: #d5d9d1;
  --rule-strong: #b7bdb2;
  --grid-line: rgba(23, 33, 44, 0.045);
  --ground: #f2f3ee;
  --panel: #fcfcfb;
  --panel-tab: #f5f6f1;
  --hover: #f3f6f2;
  --accent: #0e6b68;
  --accent-hover: #0a5553;
  --accent-weak: #d7e9e6;
  --accent-rail: #4fb3a9;
  --deemph: #b9bdb3;
  --yes: #2a78d6;
  --no: #eb6834;
  --absent: #c9ccc3;
  --warn-text: #7a5200;
  --font-ui: "Public Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-label: "Barlow Semi Condensed", "Arial Narrow", system-ui, sans-serif;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;
  --rail-h: 56px;
  color-scheme: light;
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scrollbar-color: var(--rule-strong) var(--ground);
  scroll-padding-top: calc(var(--pw-rail-height, 56px) + var(--space-4)); }
body { margin: 0; }
h1, h2, h3, h4, p, ul, ol, figure, pre { margin: 0; }
ul, ol { padding-left: 1.25rem; }
img, svg { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
table { border-collapse: collapse; }
summary { cursor: pointer; }
[hidden] { display: none !important; }

/* ---------- Base ---------- */
body {
  font-family: var(--font-ui);
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink-900);
  background-color: var(--ground);
  /* one-mile section grid of the township plat */
  background-image:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 48px 48px;
  background-position: -1px -1px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
body > main { flex: 1 0 auto; width: 100%; }
::selection { background: var(--accent-weak); color: var(--ink-950); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--accent-hover); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--ground); }
::-webkit-scrollbar-thumb { background: var(--rule-strong); border: 2px solid var(--ground); border-radius: 6px; }
h1, h2, h3, h4 { color: var(--ink-950); text-wrap: balance; line-height: 1.2; }
table { font-variant-numeric: tabular-nums; }
.pw-icon { width: 16px; height: 16px; flex: none; display: inline-block; vertical-align: -3px; }
.pw-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; }
.pw-skip { position: absolute; left: var(--space-4); top: -60px; z-index: 2000; padding: 10px 16px;
  background: var(--panel); color: var(--ink-950); border: 2px solid var(--accent); font-weight: 600; }
.pw-skip:focus { top: var(--space-2); }

/* ---------- Label system: condensed caps for legends & codes ---------- */
.pw-label {
  font-family: var(--font-label);
  font-weight: 600;
  font-size: 12.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-500);
}
.pw-code {
  font-family: var(--font-label);
  font-weight: 600;
  font-size: 13px;
  letter-spacing: 0.04em;
  font-variant-numeric: tabular-nums;
  white-space: nowrap; /* a report number (EC2026-0837) or date never breaks */
  color: var(--ink-600);
}
a.pw-code { color: var(--accent); }
.pw-subhead { display: block; margin: var(--space-4) 0 6px; }
.pw-subhead:first-child { margin-top: 0; }

/* ---------- Header rail ---------- */
.pw-rail {
  position: sticky;
  top: 0;
  z-index: 1030;
  background: var(--ink-950);
  color: #e9ecef;
  border-bottom: 1px solid #000;
}
.pw-rail__inner {
  max-width: 1440px;
  margin: 0 auto;
  min-height: var(--rail-h);
  display: flex;
  align-items: center;
  gap: var(--space-5);
  padding: 0 var(--space-5);
}
.pw-brand { display: flex; align-items: baseline; gap: var(--space-2); color: #fff; text-decoration: none; white-space: nowrap; }
.pw-brand:hover { color: #fff; }
.pw-brand__name { font-family: var(--font-label); font-weight: 700; font-size: 22px; letter-spacing: 0.01em; }
.pw-brand__city { font-family: var(--font-label); font-weight: 500; font-size: 13px; letter-spacing: 0.08em;
  text-transform: uppercase; color: #9fb3b1; }
.pw-nav-frame { display: flex; flex: 1 1 auto; align-items: stretch; min-width: 0; }
.pw-nav { display: flex; flex: 1 1 auto; min-width: 0; gap: 2px; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
.pw-nav::-webkit-scrollbar { display: none; }
.pw-nav-step { display: none; flex: 0 0 44px; min-height: 44px; padding: 0; border: 0;
  border-bottom: 3px solid transparent; background: transparent; color: #c3cad1;
  font-size: 28px; line-height: 1; align-items: center; justify-content: center; }
.pw-nav-frame[data-overflow="true"] .pw-nav-step { display: inline-flex; }
.pw-nav-step:hover:not(:disabled) { color: #fff; background: var(--ink-800); }
.pw-nav-step:disabled { color: #808994; cursor: default; }
.pw-rail a:focus-visible, .pw-rail button:focus-visible { outline-color: var(--accent-rail); outline-offset: -3px; }
.pw-nav__link {
  font-family: var(--font-label);
  font-weight: 600;
  font-size: 14.5px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #c3cad1;
  text-decoration: none;
  padding: 0 var(--space-3);
  line-height: var(--rail-h);
  border-bottom: 3px solid transparent;
  white-space: nowrap;
  flex-shrink: 0;
  transition: color 150ms ease-out, border-color 150ms ease-out;
}
.pw-nav__link:hover { color: #fff; }
.pw-nav__link.active { color: #fff; border-bottom-color: var(--accent-rail); }

/* Global search: a combobox over /api/search; a plain GET form without JavaScript */
.pw-rail__search { position: relative; margin-left: auto; width: 260px; flex-shrink: 0; }
.pw-search__input { width: 100%; height: 36px; padding: 0 36px 0 12px; border: 1px solid #34404f; border-radius: 0;
  background: var(--ink-800); color: #fff; font-size: 14px; }
.pw-search__input::placeholder { color: #b4bcc5; }
.pw-search__input:focus { outline: none; border-color: var(--accent-rail); box-shadow: 0 0 0 3px rgba(79, 179, 169, 0.3); }
.pw-search__input::-webkit-search-cancel-button { filter: invert(1); }
.pw-search__key { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); min-width: 20px; height: 20px;
  padding: 0 5px; border: 1px solid #4a5666; color: #b4bcc5; font: 600 12px/18px var(--font-label); text-align: center;
  pointer-events: none; }
.pw-search__input:focus + .pw-search__key, .pw-search__input:not(:placeholder-shown) + .pw-search__key { display: none; }
.pw-search__results { position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 10; margin: 0; padding: 4px 0;
  list-style: none; background: var(--panel); border: 1px solid var(--rule-strong); color: var(--ink-900);
  max-height: min(420px, 70vh); overflow-y: auto; }
.pw-search__results li { display: block; }
.pw-search__results a { display: block; padding: 7px 12px; color: var(--ink-900); text-decoration: none; font-size: 14px; }
.pw-search__results a span { color: var(--ink-500); font-size: 13px; }
.pw-search__results [aria-selected="true"] a, .pw-search__results a:hover { background: var(--accent-weak); }
.pw-search__results .pw-search__empty { padding: 8px 12px; color: var(--ink-500); font-size: 13.5px; }

/* ---------- Page frame ---------- */
.pw-page { max-width: 1440px; margin: 0 auto; padding: var(--space-6) var(--space-5) var(--space-7); }
.pw-page:focus { outline: none; }
.pw-head { margin-bottom: var(--space-5); max-width: 78ch; }
.pw-head h1 { font-family: var(--font-label); font-weight: 700; font-size: 34px; line-height: 1.1;
  letter-spacing: -0.005em; margin: 0 0 var(--space-2); }
.pw-head p { color: var(--ink-600); margin: 0; font-size: 15.5px; }
.pw-back { font-size: 13px; margin-bottom: var(--space-3); }
.pw-record-status {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 24px;
  padding: 12px 16px;
  margin-bottom: var(--space-5);
  background: var(--panel-tab);
  border: 1px solid var(--rule-strong);
}
/* A legend cell ruled off from the note, as on a plat sheet */
.pw-record-status > div { display: flex; flex-direction: column; gap: 2px; padding-right: 24px; border-right: 1px solid var(--rule); }
@media (max-width: 700px) { .pw-record-status > div { padding-right: 0; border-right: 0; } }
.pw-record-status > span { flex: 1 1 260px; color: var(--ink-600); }
.pw-record-status > a { min-height: 32px; display: inline-flex; align-items: center; font-size: 14px; }
#privacy { scroll-margin-top: calc(var(--pw-rail-height, 56px) + 16px); }

/* ---------- Filters (one GET form per page) ---------- */
.pw-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: var(--space-4) var(--space-5);
  padding: var(--space-3) var(--space-4);
  margin-bottom: var(--space-5);
  background: var(--panel);
  border: 1px solid var(--rule);
}
.pw-filter { display: flex; flex-direction: column; gap: 4px; min-width: 160px; }
.pw-filter > .pw-seg { align-self: flex-start; }
.pw-filter--wide { min-width: 280px; flex: 1 1 280px; }
.pw-filter--actions { min-width: 0; flex: 0 0 auto; flex-direction: row; align-items: center; gap: var(--space-3);
  margin-left: auto; }
.pw-filter--button { min-width: 0; }
.pw-filter-reset { display: inline-flex; align-items: center; min-height: 36px; font-size: 14px; }
.pw-filter .pw-label { font-size: 12px; }

.pw-select, .pw-input {
  display: block;
  width: 100%;
  min-height: 36px;
  padding: 6px 10px;
  border: 1px solid var(--rule-strong);
  border-radius: 0;
  background-color: #fff;
  color: var(--ink-900);
  font-size: 14px;
  line-height: 1.4;
}
select.pw-select { appearance: none; padding-right: 32px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%234a5666' stroke-width='1.6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 11px center; background-size: 12px 8px; }
.pw-select:disabled { color: var(--ink-400); background-color: var(--panel-tab); cursor: not-allowed; }
.pw-select:focus, .pw-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-weak); }
.pw-input::placeholder { color: var(--ink-500); }

.pw-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 36px;
  padding: 6px 16px;
  border: 1px solid var(--ink-900);
  border-radius: 0;
  background: var(--ink-900);
  color: #fff;
  font-weight: 600;
  font-size: 14px;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color 150ms ease-out, border-color 150ms ease-out;
}
.pw-button:hover { background: var(--accent); border-color: var(--accent); color: #fff; }
.pw-button:active { background: var(--accent-hover); }
.pw-button--quiet { background: var(--panel); color: var(--ink-900); border-color: var(--rule-strong);
  font-family: var(--font-label); letter-spacing: 0.04em; }
.pw-button--quiet:hover { background: var(--ink-900); border-color: var(--ink-900); }

/* Segmented control: radios styled as joined buttons */
.pw-seg { display: inline-flex; border: 1px solid var(--rule-strong); background: var(--panel); }
.pw-seg__option { position: relative; display: flex; margin: 0; }
.pw-seg__option input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.pw-seg__option span {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 5px 14px;
  border-right: 1px solid var(--rule);
  font-family: var(--font-label);
  font-weight: 600;
  letter-spacing: 0.04em;
  font-size: 14px;
  color: var(--ink-600);
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 120ms ease-out, color 120ms ease-out;
}
.pw-seg__option:last-child span { border-right: 0; }
.pw-seg__option span:hover { background: var(--hover); color: var(--ink-950); }
.pw-seg__option input:checked + span { background: var(--ink-900); color: #fff; }
.pw-seg__option input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: -2px; }

/* Multiple choice: a disclosure of checkboxes */
.pw-multi { position: relative; }
.pw-multi > summary { list-style: none; padding-right: 32px; cursor: pointer; white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%234a5666' stroke-width='1.6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 11px center; background-size: 12px 8px; }
.pw-multi > summary::-webkit-details-marker { display: none; }
.pw-multi[open] > summary { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-weak); }
.pw-multi > summary:focus-visible { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-weak); }
.pw-multi__menu { position: absolute; z-index: 20; top: calc(100% + 4px); left: 0; min-width: 100%; max-height: 320px;
  overflow-y: auto; padding: 4px 0; background: var(--panel); border: 1px solid var(--rule-strong); }
.pw-multi__option { display: flex; align-items: center; gap: 10px; padding: 6px 12px; font-size: 14px; cursor: pointer;
  white-space: nowrap; }
.pw-multi__option:hover { background: var(--hover); }
.pw-multi__option input { width: 16px; height: 16px; margin: 0; accent-color: var(--ink-900); }

@media (max-width: 700px) {
  .pw-filters { gap: var(--space-3); }
  .pw-filter, .pw-filter--wide { min-width: 0; max-width: 100%; flex-basis: 100%; }
  .pw-filter--actions { margin-left: 0; }
  /* Six years must fit a phone; long labels wrap rather than overflow the filter band. */
  .pw-seg { display: flex; flex-wrap: wrap; width: fit-content; max-width: 100%; }
  .pw-seg__option span { padding: 5px 10px; }
}

/* ---------- Modules: ruled panels with a header tab ---------- */
.pw-grid { display: grid; gap: var(--space-4); grid-template-columns: repeat(12, minmax(0, 1fr)); }
.span-12 { grid-column: span 12; } .span-8 { grid-column: span 8; } .span-7 { grid-column: span 7; }
.span-6 { grid-column: span 6; } .span-5 { grid-column: span 5; } .span-4 { grid-column: span 4; }
.span-3 { grid-column: span 3; }
.pw-col { display: flex; flex-direction: column; gap: var(--space-4); min-width: 0; }
@media (max-width: 1100px) {
  .span-8, .span-7, .span-6, .span-5, .span-4, .span-3 { grid-column: span 12; }
}
.pw-module { background: var(--panel); border: 1px solid var(--rule); min-width: 0; display: flex; flex-direction: column;
  scroll-margin-top: calc(var(--pw-rail-height, 56px) + 16px); }
.pw-module__tab {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-3);
  padding: 9px var(--space-4) 8px;
  background: var(--panel-tab);
  border-bottom: 1px solid var(--rule);
}
.pw-module__tab h2 { font-family: var(--font-label); font-weight: 700; font-size: 16px; letter-spacing: 0.04em;
  text-transform: uppercase; margin: 0; color: var(--ink-900); }
.pw-module__meta { font-size: 12.5px; color: var(--ink-500); text-align: right; }
.pw-module__body { padding: var(--space-4); flex: 1; min-width: 0; }
.pw-module__body--flush { padding: 0; }
.pw-module__foot { padding: var(--space-2) var(--space-4); border-top: 1px solid var(--rule); font-size: 12.5px;
  color: var(--ink-500); }
.pw-module__foot p + p { margin-top: 4px; }
.pw-module__tools { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3) var(--space-4);
  padding: var(--space-3) var(--space-4); border-bottom: 1px solid var(--rule); }
.pw-module__tools .pw-input { flex: 1 1 260px; }
.pw-module__tools--inline { padding: 0 0 var(--space-3); border-bottom: 0; }
.pw-module__tools--inline .pw-filter { min-width: min(360px, 100%); }
.pw-prose { max-width: 72ch; }
.pw-prose p { margin-bottom: var(--space-3); }
.pw-prose ul { margin-bottom: var(--space-3); }
.pw-prose li + li { margin-top: 6px; }
.pw-prose__head { display: block; margin: var(--space-4) 0 var(--space-1); }
.pw-prose__head:first-child { margin-top: 0; }
.pw-muted { color: var(--ink-500); }
.pw-small { font-size: 13px; }
.pw-block { display: block; }
.pw-strong { font-weight: 700; }
.pw-warn { color: var(--warn-text); font-weight: 600; }
.pw-gap { margin-top: var(--space-4); }
.pw-gap-sm { margin-top: var(--space-2); }
.pw-preline { white-space: pre-line; }
.pw-plain-list { list-style: none; padding: 0; margin: 0; }
.pw-split { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; }
.pw-minw-980 { min-width: 980px; }
.pw-stack { display: flex; flex-direction: column; gap: var(--space-4); }
.pw-stack > .pw-facts { margin-bottom: 0; }

/* ---------- Facts band (ruled row of figures, not cards) ---------- */
.pw-reps { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); gap: var(--space-3) var(--space-5); }
.pw-rep .pw-label { margin-bottom: 2px; }
.pw-rep a { font-weight: 600; }
.pw-facts { display: flex; flex-wrap: wrap; border: 1px solid var(--rule); background: var(--panel); margin-bottom: var(--space-4); }
.pw-fact { padding: var(--space-3) var(--space-4); border-right: 1px solid var(--rule); min-width: 150px; flex: 1 1 150px; }
.pw-fact:last-child { border-right: 0; }
.pw-fact__value { font-size: 22px; font-weight: 650; color: var(--ink-950); line-height: 1.2; }
.pw-fact__note { font-size: 12.5px; color: var(--ink-500); }

/* ---------- Party & vote marks ---------- */
.pw-party { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; font-size: 13.5px; color: var(--ink-800); }
.pw-party__dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; box-shadow: 0 0 0 2px var(--panel); }
.pw-tag {
  display: inline-block;
  font-family: var(--font-label);
  font-weight: 600;
  font-size: 12px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 1px 6px;
  border: 1px solid var(--rule-strong);
  color: var(--ink-600);
  background: var(--panel);
  white-space: nowrap;
}
.pw-tag--won { border-color: var(--accent); color: var(--accent); }
.pw-tag--carried { border-color: var(--yes); color: #1d5aa5; }
.pw-tag--defeated { border-color: var(--no); color: #a8441a; }
.pw-tag--warn { border-color: #c98500; color: var(--warn-text); }
.pw-tags { display: inline-flex; gap: 4px; flex-wrap: wrap; }

.pw-seats { display: inline-grid; grid-auto-flow: column; gap: 2px; align-items: center; }
.pw-seat { width: 11px; height: 14px; background: var(--absent); display: inline-block; }
.pw-seat--yes { background: var(--yes); }
.pw-seat--no { background: var(--no); }
.pw-seat--none { background: transparent; outline: 1px solid var(--rule); outline-offset: -1px; }
.pw-legend { display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-4); font-size: 13px; color: var(--ink-600); align-items: center; }
.pw-legend__key { display: inline-flex; align-items: center; gap: 6px; }
.pw-legend__swatch { width: 12px; height: 12px; display: inline-block; flex: none; }
.pw-legend__swatch--dot { border-radius: 50%; }
.pw-legend__swatch--line { height: 3px; width: 16px; }

/* ---------- Tables ---------- */
.pw-table-scroll { overflow-x: auto; max-width: 100%; -webkit-overflow-scrolling: touch; }
.pw-roster { width: 100%; border-collapse: collapse; font-size: 14px; }
.pw-roster th {
  font-family: var(--font-label);
  font-weight: 600;
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-500);
  text-align: left;
  padding: 8px var(--space-3);
  border-bottom: 1px solid var(--rule-strong);
  background: var(--panel-tab);
  vertical-align: bottom;
}
.pw-roster td { padding: 7px var(--space-3); border-bottom: 1px solid var(--rule); vertical-align: middle; }
.pw-roster tbody tr:last-child td { border-bottom: 0; }
.pw-roster tbody tr:hover td { background: var(--hover); }
.pw-roster .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.pw-roster a { font-weight: 600; text-decoration: none; color: var(--ink-950); }
.pw-roster a:hover { color: var(--accent); text-decoration: underline; }
.pw-roster td[data-field="seat"] { white-space: nowrap; }

/* Sortable table: the header button carries the sort state (aria-sort on the th) */
.pw-sort { display: inline-flex; align-items: center; gap: 5px; padding: 0; border: 0; background: none;
  font: inherit; letter-spacing: inherit; text-transform: inherit; color: inherit; text-align: inherit; }
.pw-sort::after { content: ""; width: 7px; height: 10px; flex: none; opacity: 0.45;
  background: no-repeat center / 7px 10px url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 7 10'%3E%3Cpath d='M3.5 0 7 4H0zM3.5 10 0 6h7z' fill='%235d6875'/%3E%3C/svg%3E"); }
.pw-sort:hover { color: var(--accent); }
th[aria-sort="ascending"] .pw-sort, th[aria-sort="descending"] .pw-sort { color: var(--ink-900); }
th[aria-sort="ascending"] .pw-sort::after { opacity: 1;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 7 10'%3E%3Cpath d='M3.5 1 7 6H0z' fill='%230e6b68'/%3E%3C/svg%3E"); }
th[aria-sort="descending"] .pw-sort::after { opacity: 1;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 7 10'%3E%3Cpath d='M3.5 9 0 4h7z' fill='%230e6b68'/%3E%3C/svg%3E"); }
th.num .pw-sort { flex-direction: row-reverse; }
.pw-dt__tools { padding: var(--space-3) var(--space-4); border-bottom: 1px solid var(--rule); }
.pw-dt__tools .pw-input { max-width: 360px; }
.pw-dt__pager { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: var(--space-2);
  padding: var(--space-2) var(--space-4); border-top: 1px solid var(--rule); font-size: 13px; color: var(--ink-500); }
.pw-dt__pager .pw-button { min-height: 32px; padding: 4px 12px; }
.pw-dt tr.pw-hidden { display: none; }

/* ---------- Bars drawn in HTML (inline share bars) ---------- */
.pw-bar { position: relative; height: 8px; background: #eceee8; min-width: 60px; }
.pw-bar__fill { position: absolute; inset: 0 auto 0 0; background: var(--deemph); border-radius: 0 3px 3px 0; }
.pw-bar__fill--em { background: var(--accent); }
.pw-bar--diverging { background: var(--no); }
.pw-bar--diverging .pw-bar__fill { background: var(--yes); }
.pw-share { min-width: 110px; }

/* ---------- Motion list ---------- */
.pw-motion { padding: var(--space-3) var(--space-4); border-bottom: 1px solid var(--rule); display: grid;
  grid-template-columns: 96px minmax(0, 1fr) auto; gap: var(--space-3); align-items: start; }
.pw-motion:last-child { border-bottom: 0; }
.pw-motion__text { font-size: 14px; color: var(--ink-800); display: -webkit-box; -webkit-line-clamp: 3;
  -webkit-box-orient: vertical; overflow: hidden; }
.pw-motion__meta { margin-top: 4px; }
.pw-motion__side { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.pw-rollcall { margin-top: 4px; }
.pw-rollcall > summary { display: inline-block; font-size: 13px; color: var(--accent); text-decoration: underline;
  text-underline-offset: 3px; min-height: 28px; line-height: 28px; list-style: none; }
.pw-rollcall > summary::-webkit-details-marker { display: none; }
.pw-rollcall[open] > summary { font-weight: 600; }
.pw-rollcall__body { margin-top: var(--space-2); padding: var(--space-3) var(--space-4); background: var(--panel-tab);
  border: 1px solid var(--rule); }
.pw-rollcall__body[aria-busy="true"] { color: var(--ink-500); }
.pw-rollcall__cols { display: flex; gap: var(--space-6); flex-wrap: wrap; margin-bottom: var(--space-3); }
.pw-rollcall__cols > div { min-width: 160px; }
@media (max-width: 700px) {
  .pw-motion { grid-template-columns: 1fr; }
  .pw-motion__side { align-items: flex-start; flex-direction: row; flex-wrap: wrap; }
}

/* ---------- Empty / notice ---------- */
.pw-empty { padding: var(--space-6) var(--space-5); text-align: left; max-width: 64ch; }
.pw-empty__title { font-family: var(--font-label); font-weight: 700; font-size: 18px; text-transform: uppercase;
  letter-spacing: 0.04em; margin-bottom: var(--space-2); }
.pw-empty p { margin-bottom: var(--space-3); }
.pw-notice { display: flex; gap: 10px; align-items: flex-start; border: 1px solid var(--rule-strong); background: #fbfaf3;
  padding: var(--space-3) var(--space-4); font-size: 13.5px; color: var(--ink-800); margin-bottom: var(--space-4); }
.pw-notice .pw-icon { color: #8a6100; margin-top: 2px; }

/* ---------- Footer ---------- */
.pw-foot { border-top: 1px solid var(--rule); background: var(--panel); }
.pw-foot__inner { max-width: 1440px; margin: 0 auto; padding: var(--space-4) var(--space-5); display: flex; flex-wrap: wrap;
  gap: var(--space-2) var(--space-5); font-size: 13px; color: var(--ink-500); }

/* ---------- Loading: hold the frame, never flash ---------- */
main[aria-busy="true"] .pw-stack, main[aria-busy="true"] .pw-module__body { opacity: 0.55; transition: opacity 150ms ease-out 120ms; }

/* ---------- Charts ---------- */
.pw-figure { margin: 0; min-width: 0; }
.pw-chart { min-width: 0; }
.pw-chart-data { margin-top: 8px; border-top: 1px solid var(--rule); }
.pw-chart-data > summary { display: list-item; min-height: 44px; padding: 10px 4px; color: var(--accent); font-size: 13px; }
.pw-chart-data__table { margin-bottom: 12px; }
.pw-chart-data__caption { display: flex; align-items: baseline; justify-content: space-between;
  flex-wrap: wrap; gap: 4px 12px; margin: 8px 0; }
.pw-chart-data__table > .pw-table-scroll { max-height: min(28rem, 55vh); overflow: auto;
  overscroll-behavior: contain; scrollbar-gutter: stable; border: 1px solid var(--rule); }
.pw-chart-data__table th { position: sticky; top: 0; z-index: 1; }
.pw-chart__legend { margin-bottom: var(--space-2); }

/* Maps: SVG in an aspect-locked frame; labels are HTML so they stay 13px */
.pw-map { position: relative; width: 100%; margin: 0 auto; }
.pw-map__svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: hidden; }
.pw-area { stroke: var(--panel); stroke-width: 1.5px; vector-effect: non-scaling-stroke; stroke-linejoin: round;
  transition: filter 120ms ease-out; }
.pw-map__svg a { outline: none; }
.pw-map__svg a:hover .pw-area, .pw-area:hover { filter: brightness(0.92) saturate(1.1); }
.pw-map__svg a:focus-visible .pw-area { stroke: var(--ink-950); stroke-width: 3px; }
.pw-map__focus { stroke: var(--ink-950); stroke-width: 3px; vector-effect: non-scaling-stroke; stroke-linejoin: round; pointer-events: none; }
.pw-map__highlight { stroke: var(--ink-950); stroke-width: 3px; vector-effect: non-scaling-stroke; stroke-linejoin: round; pointer-events: none; }
.pw-map__ward { stroke: var(--ink-900); stroke-width: 1.2px; vector-effect: non-scaling-stroke; pointer-events: none; }
.pw-map__dotted { stroke: var(--ink-900); stroke-width: 1.6px; stroke-dasharray: 2 3; vector-effect: non-scaling-stroke; pointer-events: none; }
.pw-map__label { position: absolute; transform: translate(-50%, -50%); font: 600 13px/1 var(--font-label);
  color: var(--ink-900); pointer-events: none; text-shadow: 0 0 2px rgba(252, 252, 251, 0.9), 0 0 4px rgba(252, 252, 251, 0.6); }
.pw-colorbar { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 8px; margin-top: var(--space-2);
  font-size: 12px; color: var(--ink-500); font-variant-numeric: tabular-nums; }
.pw-colorbar__title { font-family: var(--font-label); font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase;
  margin-right: 4px; }
.pw-colorbar__ramp { width: 140px; height: 10px; }
.pw-mapside { display: flex; gap: var(--space-5); flex-wrap: wrap; }
.pw-mapside__map { flex: 1 1 520px; min-width: 0; }
.pw-mapside__side { flex: 0 1 340px; min-width: 260px; }
@media (max-width: 700px) { .pw-mapside__side { min-width: 0; flex-basis: 100%; } }

/* Horizontal bar lists: a shared grid so labels line up */
.pw-hbars { display: grid; grid-template-columns: minmax(0, max-content) minmax(0, 1fr); column-gap: 10px; }
.pw-hbars--diverging { grid-template-columns: minmax(0, max-content) minmax(0, 1fr) minmax(0, 1fr); column-gap: 0; }
.pw-hbars--diverging .pw-hbar__label { padding-right: 10px; }
.pw-hbar { display: contents; }
.pw-hbar__label { min-width: 0; max-width: 16em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  text-align: right; font-size: 13px; line-height: 28px; color: var(--ink-900); }
.pw-hbar__track { display: flex; align-items: center; min-height: 28px; min-width: 0; }
.pw-hbar__fill { flex: none; height: 18px; border-radius: 0 4px 4px 0; min-width: 1px; }
.pw-hbar__fill--left { border-radius: 4px 0 0 4px; }
.pw-hbar__value { flex: none; margin: 0 6px; font-size: 12px; color: var(--ink-600); white-space: nowrap;
  font-variant-numeric: tabular-nums; }
.pw-hbar--em .pw-hbar__label { font-weight: 600; }
.pw-hbar:hover .pw-hbar__label, .pw-hbar:hover .pw-hbar__value { color: var(--ink-950); }
.pw-hbar__track--left { justify-content: flex-end; }
.pw-hbar__track--right { border-left: 1px solid var(--ink-600); }
.pw-stack__seg { height: 18px; border-right: 2px solid var(--panel); }
.pw-stack__seg:last-child { border-right: 0; }
.pw-axis .pw-hbar__label, .pw-axis > span:first-child { line-height: 1; }
.pw-axis__ticks { position: relative; height: 20px; font-size: 11.5px; color: var(--ink-500); font-variant-numeric: tabular-nums; }
.pw-axis__ticks > span { position: absolute; top: 4px; transform: translateX(-50%); white-space: nowrap; }
.pw-axis__ticks > span:first-child { transform: none; }
.pw-axis__ticks > span:last-child { transform: translateX(-100%); }
.pw-axis__short { display: none; }
@media (max-width: 700px) { .pw-axis__long { display: none; } .pw-axis__short { display: inline; } }

/* Timeline and dot plot: rows on a shared year or value axis */
.pw-timeline__track { position: relative; height: 34px; border-bottom: 1px solid var(--rule); }
.pw-timeline__grid { position: absolute; top: 0; bottom: 0; width: 1px; background: #e4e6df; }
.pw-timeline__term { position: absolute; top: 12px; height: 10px; background: var(--accent); }
.pw-timeline__election { position: absolute; top: 50%; width: 12px; height: 12px; transform: translate(-50%, -50%) rotate(45deg);
  border: 2px solid var(--accent); background: var(--accent); }
.pw-timeline__election--lost { background: #fff; border-color: var(--ink-600); }
.pw-dotplot__track { height: 28px; border-bottom: 0; }
.pw-dotplot__link { position: absolute; top: 50%; height: 2px; margin-top: -1px; background: var(--deemph); }

/* Line and scatter plots: lines in a stretched SVG, points and labels in HTML */
.pw-plot { position: relative; width: 100%; }
.pw-plot__area { position: absolute; }
.pw-plot__svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.pw-plot__grid { stroke: #e4e6df; stroke-width: 1px; }
.pw-dot { position: absolute; width: var(--s, 9px); height: var(--s, 9px); border-radius: 50%; background: var(--c);
  border: 2px solid var(--panel); transform: translate(-50%, -50%); box-sizing: content-box; }
.pw-dot--hollow { background: #fff; border-color: var(--c); }
.pw-dot--link { min-width: 20px; min-height: 20px; z-index: 2; }
.pw-dot--link:focus-visible { outline: 3px solid var(--ink-900); outline-offset: 3px; z-index: 5; }
.pw-policy-records { display: grid; gap: 16px; }
.pw-policy-record { padding: 16px 0; border-bottom: 1px solid var(--rule); min-width: 0; }
.pw-policy-record:last-child { border-bottom: 0; }
.pw-policy-record h3 { margin: 8px 0; font-size: 18px; }
.pw-policy-record p { margin: 8px 0; max-width: 78ch; }
.pw-policy-record blockquote { border-left: 3px solid var(--accent); padding-left: 12px; margin-left: 0; }
.pw-policy-links { display: flex; gap: 16px; flex-wrap: wrap; margin: 8px 0; }
.pw-policy-timeline { padding-left: 22px; margin: 16px 0 0; }
.pw-policy-timeline li { padding: 8px 0; }
.pw-spectrum__ends { display: flex; justify-content: space-between; gap: 24px; color: var(--ink-600); font-size: 12px; margin: 12px 0; }
.pw-spectrum__ends span { text-align: right; }
.pw-spectrum__row { display: grid; grid-template-columns: minmax(120px, 1fr) minmax(100px, 2fr) minmax(140px, 1fr); gap: 18px; align-items: center; padding: 12px 0; border-top: 1px solid var(--rule); }
.pw-spectrum__rail { position: relative; height: 24px; margin: 0 12px; background: linear-gradient(transparent 11px, #c4cbc5 11px, #c4cbc5 13px, transparent 13px); }
.pw-spectrum__range { position: absolute; top: 8px; height: 8px; background: #9ebbb5; }
.pw-spectrum__point { position: absolute; top: 0; width: 24px; height: 24px; border-radius: 50%; background: #315e58; border: 3px solid var(--panel); transform: translateX(-50%); }
.pw-spectrum__point:focus-visible { outline: 3px solid #172c29; outline-offset: 3px; }
.pw-spectrum__missing { font-size: 12px; color: var(--ink-600); }
@media (max-width: 620px) {
  .pw-spectrum__row { grid-template-columns: 1fr; gap: 8px; }
  .pw-spectrum__ends { gap: 16px; }
  .pw-policy-record a { overflow-wrap: anywhere; }
}
.pw-dot[data-tip]:hover { box-shadow: 0 0 0 3px var(--accent-weak); }
.pw-plot__label { position: absolute; font-size: 12px; line-height: 1; color: var(--ink-600); white-space: nowrap;
  pointer-events: none; font-variant-numeric: tabular-nums; }
.pw-plot__label--link { pointer-events: auto; min-height: 24px; display: inline-flex; align-items: center;
  z-index: 3; color: var(--ink-900); background: var(--panel); text-decoration: underline; text-underline-offset: 3px; }
.pw-plot__label--link:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; z-index: 6; }
.pw-at-top { transform: translate(-50%, calc(-100% - 9px)); }
.pw-at-bottom { transform: translate(-50%, 9px); }
.pw-at-right { transform: translate(10px, -50%); }
.pw-at-left { transform: translate(calc(-100% - 10px), -50%); }
.pw-at-top-left { transform: translate(calc(-100% - 4px), calc(-100% - 6px)); }
.pw-at-top-right { transform: translate(4px, calc(-100% - 6px)); }
.pw-at-bottom-left { transform: translate(calc(-100% - 4px), 6px); }
.pw-at-bottom-right { transform: translate(4px, 6px); }
.pw-at-center { transform: translate(-50%, -50%); }
.pw-leader { position: absolute; height: 1px; transform-origin: 0 50%; pointer-events: none; }
.pw-tick { position: absolute; font-size: 11.5px; color: var(--ink-500); white-space: nowrap; font-variant-numeric: tabular-nums; }
.pw-tick--x { top: calc(100% + 6px); transform: translateX(-50%); }
.pw-tick--y { right: calc(100% + 8px); transform: translateY(-50%); }
.pw-tick--cat { white-space: normal; text-align: center; line-height: 1.15; font-size: 12px; }
.pw-colbar { position: absolute; bottom: 0; border-radius: 3px 3px 0 0; min-height: 1px; }
.pw-plot__title { position: absolute; font-size: 12px; color: var(--ink-500); }
.pw-plot__title--x { left: 64px; right: 16px; bottom: 4px; text-align: center; }
.pw-plot__title--y { left: 4px; top: 50%; transform: translate(-0%, -50%) rotate(180deg); writing-mode: vertical-rl; }

/* Agreement grid: a real table of shaded cells */
.pw-heat { border-collapse: separate; border-spacing: 2px; font-size: 11.5px; margin: 0 auto; }
.pw-heat th { font-weight: 500; color: var(--ink-800); font-size: 12px; white-space: nowrap; }
.pw-heat thead th { vertical-align: bottom; height: 120px; padding: 0 0 4px; }
.pw-heat thead th span { writing-mode: vertical-rl; transform: rotate(180deg); display: inline-block; }
.pw-heat tbody th { text-align: right; padding-right: 8px; }
.pw-heat td { width: 32px; min-width: 32px; height: 28px; text-align: center; font-variant-numeric: tabular-nums; }
.pw-heat td:hover { outline: 2px solid var(--ink-950); outline-offset: -2px; }
.pw-heat__self { background: var(--panel-tab); }

/* Tooltip shared by maps and charts */
.pw-tip { position: fixed; z-index: 3000; max-width: 280px; padding: 7px 10px; background: var(--ink-950); color: #fff;
  font-size: 12.5px; line-height: 1.4; pointer-events: none; white-space: pre-line; }
.pw-tip strong { display: block; font-weight: 600; }

/* ---------- Small multiples (ward boundaries by era) ---------- */
.pw-multiples { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.pw-multiple { margin: 0; border-top: 1px solid var(--rule); padding-top: 8px; }
.pw-multiple figcaption { padding-top: 4px; }
.pw-multiple .pw-chart-data { display: none; }
@media (max-width: 700px) {
  .pw-multiples { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
}

/* ---------- Disclosure for long secondary lists ---------- */
.pw-details > summary { padding: 12px 16px; color: var(--accent); font-size: 14px;
  border-top: 1px solid var(--rule); text-decoration: underline; text-underline-offset: 3px; }
.pw-details > summary:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.pw-details[open] > summary { border-bottom: 1px solid var(--rule); }
.pw-sql { margin: var(--space-3) var(--space-4); border: 1px solid var(--rule); background: var(--panel-tab); }
.pw-sql > summary { padding: 6px 12px; font: 600 12px/1.6 var(--font-label); letter-spacing: 0.06em; color: var(--ink-600); }
.pw-sql pre { padding: 10px 12px; border-top: 1px solid var(--rule); white-space: pre-wrap; font-size: 12.5px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }

/* ---------- Lists, presets, search results ---------- */
.pw-more { padding: var(--space-3) var(--space-4); border-top: 1px solid var(--rule); text-align: center; }
.pw-document-link { display: inline-block; min-height: 28px; line-height: 28px; white-space: nowrap; }
.pw-document-link + .pw-document-link { margin-left: var(--space-3); }
.pw-presets { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); margin-bottom: var(--space-4); }
.pw-presets .pw-label { margin-right: var(--space-1); }
.pw-chip { display: inline-flex; align-items: center; min-height: 32px; padding: 4px 12px; border: 1px solid var(--rule-strong);
  background: var(--panel); color: var(--ink-800); font-size: 13.5px; text-decoration: none; }
.pw-chip:hover { border-color: var(--accent); color: var(--accent); }
.pw-results { list-style: none; margin: 0; padding: 0; }
.pw-results li { padding: 8px 0; border-bottom: 1px solid var(--rule); }
.pw-results li:last-child { border-bottom: 0; }
.pw-results a { font-weight: 600; text-decoration: none; color: var(--ink-950); }
.pw-results a:hover { color: var(--accent); text-decoration: underline; }

/* ---------- Responsive ---------- */
@media (max-width: 980px) {
  .pw-rail__inner { flex-wrap: wrap; gap: 0 var(--space-4); padding: var(--space-2) var(--space-4) 0; }
  .pw-rail__search { order: 2; width: auto; flex: 1 1 200px; margin: 0 0 var(--space-2); }
  .pw-nav-frame { order: 3; flex-basis: 100%; width: 100%; }
  .pw-nav__link { line-height: 40px; }
  .pw-page { padding: var(--space-5) var(--space-4) var(--space-6); }
  .pw-head h1 { font-size: 28px; }
  .pw-foot__inner { padding: var(--space-4); }
}
@media (max-width: 700px) {
  .pw-roster { font-size: 13.5px; }
  .pw-roster td, .pw-roster th { padding: 6px 8px; }
  /* Columns keep whole words; the table scrolls inside its module instead of squeezing them. */
  .pw-dt__table td, .pw-dt__table th { min-width: 84px; }
  .pw-dt__table td[data-field="member"], .pw-dt__table td[data-field="name"],
  .pw-dt__table td[data-field="contributor"] { min-width: 132px; }
  .pw-dt__table td[data-field="to"], .pw-dt__table td[data-field="recipients"],
  .pw-dt__table td[data-field="roles"] { min-width: 168px; }
  .pw-fact { min-width: 140px; padding: var(--space-2) var(--space-3); }
  .pw-fact__value { font-size: 19px; }
  .pw-module__tab { flex-wrap: wrap; }
  .pw-module__meta { text-align: left; }
  .pw-hbar__label { max-width: 9.5em; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}
@media print {
  .pw-rail, .pw-filters, .pw-foot, .pw-chart-data, .pw-more { display: none !important; }
  body { background: #fff; }
  .pw-module { break-inside: avoid; }
}

/* ---------- Search "all results" row, load failure alert ---------- */
.pw-search__all { border-top: 1px solid var(--rule); margin-top: 4px; padding-top: 4px; }
.pw-search__all a { color: var(--accent); }
.pw-error { position: fixed; z-index: 2500; left: 50%; bottom: var(--space-4); transform: translateX(-50%);
  width: min(560px, calc(100% - 32px)); margin: 0; display: flex; align-items: center; flex-wrap: wrap;
  gap: var(--space-3) var(--space-4); background: #fff7e6; border-color: #c98500; }
.pw-error__actions { display: flex; gap: var(--space-2); margin-left: auto; }
.pw-map__label--light { color: #fff; text-shadow: 0 0 2px rgba(15, 23, 32, 0.8), 0 0 4px rgba(15, 23, 32, 0.5); }
.pw-colorbar { justify-content: center; }
.pw-back { display: inline-block; margin-bottom: var(--space-2); font-size: 13px; text-decoration: none; }
.pw-back:hover { text-decoration: underline; }
.pw-lead { margin-bottom: var(--space-3); }
.pw-hbar__fill { display: flex; align-items: center; justify-content: flex-end; overflow: hidden; }
.pw-hbar__value--inside { margin: 0 6px; font-weight: 600; }
.pw-tick--x.pw-tick--start { transform: none; }
.pw-tick--x.pw-tick--end { transform: translateX(-100%); }
.pw-page > .pw-grid + .pw-notice, .pw-page > .pw-grid + .pw-grid, .pw-page > .pw-stack + .pw-grid { margin-top: var(--space-4); }

/* Roll call body: resolution, then the vote columns */
.pw-rollcall__body > p { margin-bottom: var(--space-3); }
.pw-rollcall__body li a { color: var(--ink-900); text-decoration: none; font-weight: 500; }
.pw-rollcall__body li a:hover { color: var(--accent); text-decoration: underline; }
.pw-rollcall__body .pw-label { margin-bottom: 4px; }

/* Search clear control in the rail's palette */
.pw-search__input::-webkit-search-cancel-button { -webkit-appearance: none; appearance: none; filter: none;
  width: 14px; height: 14px; cursor: pointer;
  background: no-repeat center / 10px url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 10'%3E%3Cpath d='M1 1l8 8M9 1L1 9' stroke='%23b4bcc5' stroke-width='1.6'/%3E%3C/svg%3E"); }
.pw-input::-webkit-search-cancel-button { -webkit-appearance: none; appearance: none; width: 14px; height: 14px; cursor: pointer;
  background: no-repeat center / 10px url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 10'%3E%3Cpath d='M1 1l8 8M9 1L1 9' stroke='%235d6875' stroke-width='1.6'/%3E%3C/svg%3E"); }

/* Loading: a thin teal rule under the rail while a view is on its way */
.pw-progress { position: fixed; top: 0; left: 0; z-index: 1100; height: 3px; width: 100%; background: var(--accent-rail);
  transform: scaleX(0); transform-origin: left; opacity: 0; pointer-events: none;
  transition: transform 200ms ease-out, opacity 200ms ease-out; }
.pw-progress.is-active { opacity: 1; transform: scaleX(0.7); transition: transform 6s cubic-bezier(0.1, 0.6, 0.2, 1), opacity 120ms; }
.pw-progress.is-done { opacity: 0; transform: scaleX(1); transition: transform 150ms ease-out, opacity 300ms ease-out 150ms; }
/* Visually hidden labels stay inside their (scrolling) table */
.pw-roster th { position: relative; }
.pw-chart-data__table th { position: sticky; }
.pw-searchform { flex-direction: column; align-items: stretch; gap: 4px; }
.pw-searchbox { display: flex; gap: var(--space-2); max-width: 640px; }
.pw-searchbox .pw-input { flex: 1 1 auto; }
/* Facts on phones: a two-column ruled grid rather than one long column */
@media (max-width: 520px) {
  .pw-facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pw-fact { min-width: 0; border-right: 1px solid var(--rule); border-bottom: 1px solid var(--rule); }
  .pw-fact:nth-child(2n) { border-right: 0; }
  .pw-fact:last-child { border-bottom: 0; }
  .pw-fact:nth-last-child(2):nth-child(odd) { border-bottom: 0; }
  .pw-fact:last-child:nth-child(odd) { grid-column: span 2; }
  .pw-fact__value { font-size: 18px; overflow-wrap: anywhere; }
}
.pw-empty--page { max-width: none; margin-bottom: var(--space-4); padding: var(--space-5); background: var(--panel);
  border: 1px solid var(--rule); }

/* By-elections: one election's races side by side when there is room */
.pw-byelection { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 380px), 1fr)); gap: 0 var(--space-5, 24px); }
.pw-byelection__race { min-width: 0; }

/* Conduct and accountability records */
.pw-records { list-style: none; margin: 0; padding: 0; }
.pw-record { padding: var(--space-3) 0; border-top: 1px solid var(--rule); }
.pw-record:first-child { border-top: 0; padding-top: 0; }
.pw-record__head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.pw-record__who { margin-top: 6px; font-weight: 600; }
.pw-record__text { margin: 6px 0 0; max-width: 72ch; }
.pw-record__links { display: flex; flex-wrap: wrap; gap: var(--space-3); margin-top: 6px; }

/* "On this page": jump links for long pages, a ruled band like the record-status strip */
.pw-onpage { display: flex; align-items: baseline; gap: var(--space-3) var(--space-4); padding: 10px var(--space-4);
  background: var(--panel); border: 1px solid var(--rule); }
.pw-onpage__label { flex: none; }
.pw-onpage__links { display: flex; flex-wrap: wrap; gap: 6px var(--space-4); }
.pw-onpage__links a { font-size: 14px; white-space: nowrap; color: var(--accent); text-underline-offset: 3px;
  min-height: 24px; display: inline-flex; align-items: center; }
.pw-onpage__links a:hover { color: var(--accent-hover); }
/* Anchored sections clear the sticky rail (taller on phones, where the nav sits on its own row). */
:where(.pw-page [id]) { scroll-margin-top: calc(var(--rail-h) + var(--space-3)); }
@media (max-width: 980px) { :where(.pw-page [id]) { scroll-margin-top: 142px; } }
@media (max-width: 700px) {
  .pw-onpage { flex-direction: column; gap: 6px; }
  .pw-onpage__links { flex-wrap: nowrap; overflow-x: auto; width: 100%; padding-bottom: 2px; scrollbar-width: thin; }
}

/* Overview: find a councillor by neighbourhood */
.pw-findward { display: flex; flex-direction: column; gap: 6px; margin-bottom: var(--space-4); padding-bottom: var(--space-4);
  border-bottom: 1px solid var(--rule); }

/* ---------- Preview notice ---------- */
.pw-preview { background: #fbf3dc; border-bottom: 1px solid #e4d3a3; color: var(--ink-900); font-size: 13.5px; }
.pw-preview p { max-width: none; margin: 0; padding: var(--space-2) var(--space-5); }
.pw-preview a { color: var(--warn-text); font-weight: 600; }
@media (max-width: 640px) {
  .pw-preview p { padding: var(--space-2) var(--space-4); }
}
