/* === Campaign platform design system — "the marked register, made
   legible": graphite / teal, with a pen-stroke signature ===
   Token structure lifted from ~/GitProjects/verge and re-skinned.

   Skin rationale, because it is not arbitrary: in Northern Ireland every
   strong colour is already a party colour (green, orange, blue, red), and
   this platform reads every party's data. So the CHROME is deliberately
   party-neutral — graphite ink with a teal identity accent — and the party
   palette is reserved for data marks, where a colour means a party and
   nothing else. Don't spend green on a button.

   Identity (2026-08-28 redesign): the platform digitises pen strokes on
   paper registers, so the app dresses as the instrument it descends
   from. IBM Plex Serif — the serif of the public record — carries the
   display layer (page titles, KPI figures, document section heads);
   Plex Sans stays the body, Plex Mono the instrument-panel microlabels.
   The SIGNATURE is the volunteer's register mark, used exactly three
   ways and nowhere else: the brand glyph (a register row with one
   strike), the title underline (an ink stroke), and done-states
   (walked turfs, passed milestones). Resist spending it elsewhere.

   LIGHT-ONLY by choice: a local desktop tool, print-first, read by an
   older volunteer audience — one deliberate look, no dark variant.

   File order: tokens → base → layout → sidebar → shared components →
   page-specific sections (/stations, /canvass, /calendar) → responsive →
   global print. Page sections keep their own @media print rules beside
   them, because the print behaviour is part of the component. */

* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --sans: "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --serif: "IBM Plex Serif", Georgia, "Times New Roman", serif;
  --sidebar-width: 232px;

  /* Type scale. Every font-size in this file comes off this ladder; if a
     new size feels needed, pick the nearest step instead. (The printable
     canvass sheet uses pt sizes in its own print block — paper, not
     screen, so it is exempt.) */
  --text-3xs: 0.62rem;   /* sidebar footer, ODbL credits */
  --text-2xs: 0.66rem;   /* mono microlabels: eyebrows, column heads */
  --text-xs:  0.72rem;   /* badges, KPI labels, cell notes */
  --text-sm:  0.82rem;   /* numeric table cells, dense controls */
  --text-md:  0.875rem;  /* tables, nav, card headers */
  --text-base: 1rem;     /* body — sized for an older volunteer readership */
  --text-lg:  1.05rem;   /* brand, prose h2 */
  --text-xl:  1.15rem;   /* prose h3, dense section heads */
  --text-2xl: 1.35rem;   /* document section heads (serif) */
  --text-3xl: 1.9rem;    /* page h1 (serif) */
  --text-4xl: 2.4rem;    /* KPI figures, the home hero (serif) */

  /* Spacing scale. Values already on the quarter-rem ladder use these;
     deliberate density tuning (e.g. sheet cell padding) stays literal. */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;

  /* Chrome */
  --primary: #1f3c42;
  --ink-side: #16232a;        /* sidebar, deeper than primary */

  /* On-ink palette: everything drawn ON the dark sidebar. One ramp,
     light to dim, plus the on-ink siblings of teal and warn (both
     tuned lighter than their on-white originals for contrast). */
  --ink-100: #f3f7f7;             /* brand text (== --cream) */
  --ink-300: #c3d3d6;             /* nav links */
  --ink-400: #9fb3b8;             /* sidebar body text */
  --ink-500: #93a7ad;             /* the db-vintage line */
  --ink-600: #7f979d;             /* group labels, footer */
  --ink-line: rgba(243, 247, 247, 0.12);
  --ink-active: rgba(15, 111, 114, 0.24);
  --teal-on-ink: #56b4b7;
  --warn-on-ink: #d98a6a;
  --teal: #0f6f72;            /* identity accent: brand mark, active states */
  --teal-hover: #0b585b;
  --teal-soft: #e2f0f0;
  --cobalt: #1f5fa8;          /* interactive: links, focus, info */
  --cream: #f3f7f7;

  /* Functional */
  --ok: #1f7a4d;      --ok-soft: #e4f3ea;
  --warn: #92600a;    --warn-soft: #fdf1d7;
  --bad: #b23434;     --bad-soft: #fcebeb;
  --info: #1f5fa8;    --info-soft: #e8eefb;
  --neutral: #5b6b7b; --neutral-soft: #e9edf1;

  /* Cool neutrals */
  --gray-50:  #f9fafb;
  --gray-100: #f2f4f6;
  --gray-200: #e4e8ec;
  --gray-300: #cfd6dd;
  --gray-400: #99a3ad;
  --gray-500: #6b7681;
  --gray-600: #4e5860;
  --gray-700: #383f46;
  --gray-800: #24292e;

  /* Microlabel ink — the mono caption layer (eyebrows, column heads,
     codes, hints). Must clear 4.5:1 on white (tests/test_style_tokens.py
     is the gate); the layer's quietness comes from the mono face, small
     size and uppercase — never from a grey too light to read. */
  --ink-micro: var(--gray-500);

  /* Non-party data marks. Turf membership on the /canvass map — an amber
     no NI party owns — and the white casing between choropleth fills;
     both read by the map scripts via tokens.js. */
  --turf: #a3560f;
  --map-casing: #ffffff;

  /* Party marks — data only, never chrome. Sourced from each party's own
     identity so a reader recognises them without a legend. */
  --p-sdlp: #2c8b57;
  --p-sf:   #1c6b52;
  --p-dup:  #b5471f;
  --p-uup:  #2d5aa8;
  --p-all:  #b58a00;
  --p-tuv:  #6a4f8f;
  --p-grn:  #4d8a2f;
  --p-oth:  #6b7681;

  --radius: 8px;        /* cards, panels */
  --radius-sm: 5px;     /* controls, chips, small frames */
  --radius-pill: 999px; /* badges */
  --shadow: 0 1px 2px rgba(22,35,42,0.06), 0 1px 3px rgba(22,35,42,0.04);
  --border: 1px solid var(--gray-200);
}

body {
  font-family: var(--sans);
  color: var(--gray-800);
  background: var(--gray-100);
  line-height: 1.6;
  font-size: var(--text-base);
  -webkit-font-smoothing: antialiased;
}

:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }

/* Screen-reader-only text: table captions and tooltip twins. */
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}
::selection { background: rgba(15,111,114,0.20); }

/* Keyboard users get a way past the nav; invisible until focused. */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 200;
  background: var(--gray-800);
  color: #fff;
  padding: var(--space-2) var(--space-4);
  border-radius: 0 0 var(--radius-sm) 0;
}
.skip-link:focus { left: 0; }

/* === Layout === */

.app-layout { display: flex; min-height: 100vh; }

.main-content {
  flex: 1;
  min-width: 0;              /* let wide tables scroll, not stretch the page */
  margin-left: var(--sidebar-width);
  min-height: 100vh;
}

/* The default column is a reading measure, not a mobile layout — and
   it CENTRES in the space beside the sidebar, so a wide monitor gets
   balanced margins instead of a dead zone on the right. */
.content-area { max-width: 1080px; margin-inline: auto;
  padding: 2.25rem var(--space-10) 5rem; }
.content-area.content-wide { max-width: none; padding: var(--space-5) var(--space-6) 4rem; }
/* long-form pages: keep figures close to the prose measure */
.content-area.content-narrow { max-width: 900px; }

/* === Sidebar === */

.sidebar {
  width: var(--sidebar-width);
  background: var(--ink-side);
  color: var(--ink-400);
  position: fixed;
  top: 0; left: 0; bottom: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  z-index: 100;
}

.sidebar-brand {
  padding: var(--space-5) var(--space-5) var(--space-4);
  border-bottom: 1px solid var(--ink-line);
}

.sidebar-brand a {
  color: var(--ink-100);
  text-decoration: none;
  font-size: var(--text-lg);
  font-weight: 700;
  letter-spacing: 0.01em;
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.brand-mark { flex-shrink: 0; }

.brand-sub {
  font-family: var(--mono);
  font-size: var(--text-3xs);
  color: var(--ink-600);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 3px;
}

.sidebar-nav { flex: 1; padding: var(--space-3) 0; }
.nav-group { margin-bottom: var(--space-1); }

.nav-group-label {
  font-family: var(--mono);
  font-size: var(--text-3xs);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-600);
  padding: var(--space-3) var(--space-5) 0.35rem;
  font-weight: 600;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: var(--space-2) var(--space-5);
  color: var(--ink-300);
  text-decoration: none;
  font-size: var(--text-md);
  border-left: 3px solid transparent;
  transition: background 0.12s, color 0.12s;
}

.nav-link:hover { background: rgba(255,255,255,0.05); color: #fff; }

.nav-link.active {
  background: var(--ink-active);
  border-left-color: var(--teal-on-ink);
  color: #fff;
  font-weight: 600;
}

.nav-icon { width: 15px; height: 15px; flex-shrink: 0; opacity: 0.85; }
.nav-link.active .nav-icon { opacity: 1; }

.sidebar-foot {
  padding: 0.9rem var(--space-5) 1.1rem;
  border-top: 1px solid var(--ink-line);
  font-family: var(--mono);
  font-size: var(--text-3xs);
  line-height: 1.7;
  color: var(--ink-600);
  letter-spacing: 0.02em;
}

/* --warn is tuned for white; these are the on-ink siblings. */
.sidebar-foot .warn-dot { color: var(--warn-on-ink); }
.sidebar-foot .vintage { color: var(--ink-500); }

/* === Page header === */

.page-header {
  margin-bottom: 1.6rem;
  padding-bottom: 0.85rem;
  border-bottom: 1px solid var(--gray-200);
}

/* The signature, use 2 of 3: the title sits over a hand-drawn ink
   stroke — the register mark that the whole platform digitises. */
.page-header::after {
  content: "";
  display: block;
  width: 190px;
  max-width: 60%;
  height: 8px;
  margin-top: 0.55rem;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 220 8' preserveAspectRatio='none'%3E%3Cpath d='M2 5.5C38 3 82 6.5 128 4.5 166 2.9 198 5 218 3.6' fill='none' stroke='%230f6f72' stroke-width='2.4' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat;
  background-size: 100% 100%;
}

.page-header .eyebrow {
  font-family: var(--mono);
  font-size: var(--text-2xs);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--teal);
  margin-bottom: 0.4rem;
}

.page-header h1 {
  font-family: var(--serif);
  font-size: var(--text-3xl);
  font-weight: 600;
  color: var(--gray-800);
  line-height: 1.22;
  letter-spacing: -0.005em;
  text-wrap: balance;
}

.page-header .sub {
  margin-top: var(--space-2);
  color: var(--gray-500);
  font-size: var(--text-base);
  max-width: 62ch;
}

/* === Prose === */

/* Bare page-level section heads ("Ward", "Coming up", "Roads — …")
   speak in the document voice: the serif display face, one size below
   the page title. Card headers and prose h2 keep their own scales. */
.content-area > h2, #ward-panel > h2 {
  font-family: var(--serif);
  font-size: var(--text-2xl);
  font-weight: 600;
  color: var(--gray-800);
  margin: var(--space-8) 0 var(--space-3);
}

.prose { max-width: 66ch; }
.prose p { margin-bottom: 0.9rem; color: var(--gray-600); }
.prose ul, .prose ol { margin: 0 0 0.9rem 1.15rem; color: var(--gray-600); }
.prose li { margin-bottom: 0.35rem; }
.prose h2 {
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--gray-800);
  margin: var(--space-8) 0 0.6rem;
}
.prose h3 {
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--gray-700);
  margin: var(--space-6) 0 0.4rem;
}
.prose b, .prose strong { color: var(--gray-800); font-weight: 600; }

.quiet { color: var(--gray-500); font-size: var(--text-md); }
.prose .quiet { color: var(--gray-500); }

/* === Cards === */

.card {
  background: #fff;
  border: var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: var(--space-6);
  overflow: hidden;
}

.card-header {
  padding: 0.8rem var(--space-5);
  border-bottom: 1px solid var(--gray-200);
  font-weight: 600;
  font-size: var(--text-md);
  color: var(--gray-700);
  background: var(--gray-50);
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-4);
}

.card-header .hint {
  font-family: var(--mono);
  font-size: var(--text-2xs);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-micro);
  font-weight: 400;
}

.card-body { padding: var(--space-5); }
.card-body > :last-child { margin-bottom: 0; }

/* === KPI tiles === */

.kpi-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(168px, 1fr));
  gap: var(--space-4);
  margin-bottom: 1.6rem;
}

.kpi-card {
  background: #fff;
  border: var(--border);
  border-left: 4px solid var(--teal);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: var(--space-4) 1.2rem;
}

.kpi-value {
  font-family: var(--serif);
  font-size: var(--text-4xl);
  letter-spacing: -0.01em;
  font-weight: 600;
  color: var(--gray-800);
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}

.kpi-label {
  font-size: var(--text-xs);
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 0.2rem;
  font-weight: 500;
}

/* The front door's three live leads: next deadline, top GOTV station,
   worst lapse ward. Each is a whole-card link to the page that
   computes it; the serif figure is the headline. */
.today-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--space-4);
  margin-bottom: var(--space-6);
}
.today-item {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  background: var(--primary);
  color: var(--cream);
  border-radius: var(--radius);
  padding: var(--space-4) var(--space-5);
  text-decoration: none;
  box-shadow: var(--shadow);
}
.today-item:hover { background: var(--teal-hover); text-decoration: none; }
.today-k {
  font-family: var(--mono);
  font-size: var(--text-2xs);
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--ink-300);
}
.today-v {
  font-family: var(--serif);
  font-size: var(--text-2xl);
  font-weight: 600;
  line-height: 1.2;
}
.today-d { font-size: var(--text-sm); color: var(--ink-300); }

/* a small unit riding a KPI figure ("4 of 7") and the note that
   explains an amber tile — a warning without a sentence is noise */
.kpi-of { font-size: var(--text-md); color: var(--gray-500);
  font-weight: 500; }
.kpi-note { margin: -0.8rem 0 1.6rem; max-width: 72ch; }

.kpi-card-ok   { border-left-color: var(--ok); }
.kpi-card-warn { border-left-color: var(--warn); }
.kpi-card-bad  { border-left-color: var(--bad); }
.kpi-card-bad .kpi-value { color: var(--bad); }

/* === Tables === */

.table-wrap { overflow-x: auto; }

table { width: 100%; border-collapse: collapse; font-size: var(--text-md); }

th, td {
  padding: 0.55rem var(--space-4);
  text-align: left;
  border-bottom: 1px solid var(--gray-100);
  vertical-align: top;
}

thead th {
  background: transparent;
  font-family: var(--mono);
  font-weight: 500;
  color: var(--ink-micro);
  font-size: var(--text-2xs);
  text-transform: uppercase;
  letter-spacing: 0.09em;
  white-space: nowrap;
  border-bottom: 1px solid var(--gray-200);
  vertical-align: bottom;
}

tbody th { font-weight: 600; color: var(--gray-800); white-space: nowrap; }
tbody th span { display: block; font-weight: 400; color: var(--ink-micro);
                font-size: var(--text-sm); font-family: var(--mono); }
tbody tr:hover { background: var(--gray-50); }
tbody tr:last-child td, tbody tr:last-child th { border-bottom: none; }

/* numeric columns */
td.n, th.n { text-align: right; font-family: var(--mono); font-size: var(--text-sm);
             font-variant-numeric: tabular-nums; white-space: nowrap; }
td.g { color: var(--gray-500); }
/* Missing data is still content: it must clear contrast thresholds. */
td.na, .na { color: var(--gray-500); text-align: center; }
.pc { color: var(--ink-micro); font-size: 0.85em; }
/* a withheld/not-credible cell on /propensity */
.sus { color: var(--bad); font-weight: 700; margin-left: 2px; }

tr.total td, tr.total th {
  border-top: 2px solid var(--gray-300);
  font-weight: 600;
  background: var(--gray-50);
}

tr.hot td, tr.hot th { background: var(--ok-soft); }

/* A tall ranked table scrolls inside its own frame so the header can
   stay put — position:sticky needs the scroll container to be the
   thing that scrolls. */
.table-tall { max-height: 75vh; overflow-y: auto; }
.table-tall thead th {
  position: sticky; top: 0; z-index: 2;
  background: #fff;
  box-shadow: 0 1px 0 var(--gray-200);
}

/* Wide tables hint that there is more to the side (scroll shadows). */
.table-wrap {
  background:
    linear-gradient(to right, #fff 30%, rgba(255,255,255,0)),
    linear-gradient(to right, rgba(255,255,255,0), #fff 70%) 100% 0,
    radial-gradient(farthest-side at 0 50%, rgba(22,35,42,0.14), transparent),
    radial-gradient(farthest-side at 100% 50%, rgba(22,35,42,0.14), transparent) 100% 0;
  background-repeat: no-repeat;
  background-size: 40px 100%, 40px 100%, 14px 100%, 14px 100%;
  background-attachment: local, local, scroll, scroll;
}

/* Column heads that expand an election code keep the hover affordance
   quiet — a faint dotted line, not the browser's heavy default. */
thead th abbr[title] {
  text-decoration: underline dotted;
  text-decoration-color: var(--gray-300);
  text-underline-offset: 3px;
  cursor: help;
}

/* Click-to-sort (sortable.js). The server's rank is the default order;
   the arrow shows a user-applied sort. */
.sortable-th { cursor: pointer; user-select: none; }
.sortable-th:hover { color: var(--gray-600); }
.sortable-th.sort-asc::after { content: " ▲"; font-size: 0.85em; }
.sortable-th.sort-desc::after { content: " ▼"; font-size: 0.85em; }

/* === Classed heat scale (pipeline/viz.py) ===
   Fixed decade turnout bands, the same on every page and in every
   election year. Cell text stays the table ink — every step holds
   >= 5:1 against it. Values mirror viz.HEAT_RAMP exactly;
   tests/test_style_tokens.py fails if either side drifts. */
.heat-1 { background: #f4f9f9; }
.heat-2 { background: #e2f0f0; }
.heat-3 { background: #c4e1e2; }
.heat-4 { background: #9fcfd1; }
.heat-5 { background: #7cbabd; }
.heat-6 { background: #58a3a6; }

/* SDLP-share cells (/memo): same fixed 5/10/15/20 breaks as the map's
   share layer, in the party hue — a data mark. The values are the
   cell-tuned siblings of viz.CELL_GREEN (the map's fills run darker
   because they draw at 0.75 opacity); tests/test_style_tokens.py keeps
   the two in step. Min contrast 6.2:1. */
.heat-g1 { background: #f1f8f4; }
.heat-g2 { background: #dcefe3; }
.heat-g3 { background: #bfe0cc; }
.heat-g4 { background: #9bcdaf; }
.heat-g5 { background: #74b791; }

.heat-chip {
  display: inline-block;
  padding: 0 0.4rem;
  border-radius: var(--radius-sm);
  font-family: var(--mono);
  font-size: var(--text-xs);
  color: var(--gray-800);
}

/* a caption line that sits inside a card, under its table */
.legend-line { padding: 0.6rem var(--space-5) 0.8rem; margin: 0; }

/* === Server-rendered SVG marks (pipeline/viz.py) === */

.spark { display: block; }
.spark-cell { width: 108px; }
.spk-line { fill: none; stroke: var(--gray-500); stroke-width: 1.5;
  stroke-linecap: round; stroke-linejoin: round; }
.spk-dot { fill: var(--gray-500); }
.spk-end { fill: var(--teal); }

.bar { vertical-align: middle; margin-left: 0.4rem; }
.bar-track { fill: var(--gray-100); }
.bar-fill { fill: var(--p-oth); }   /* unknown party -> the chips' grey */
.bar-neutral { fill: var(--gray-500); }
.bar-lost { fill: var(--gray-300); }
/* party fills — data marks, same tokens as the chips; these follow
   .bar-fill so a known party always overrides the fallback */
.bar-SDLP { fill: var(--p-sdlp); }
.bar-SF   { fill: var(--p-sf); }
.bar-DUP  { fill: var(--p-dup); }
.bar-UUP  { fill: var(--p-uup); }
.bar-ALL  { fill: var(--p-all); }
.bar-TUV  { fill: var(--p-tuv); }
.bar-GRN  { fill: var(--p-grn); }

.card table th:first-child, .card table td:first-child { padding-left: var(--space-5); }
.card table th:last-child,  .card table td:last-child  { padding-right: var(--space-5); }

/* === Badges === */

.badge {
  display: inline-block;
  padding: 0.12rem 0.55rem;
  border-radius: var(--radius-pill);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.badge-ok      { background: var(--ok-soft);      color: var(--ok); }
.badge-warn    { background: var(--warn-soft);    color: var(--warn); }
.badge-bad     { background: var(--bad-soft);     color: var(--bad); }
.badge-info    { background: var(--info-soft);    color: var(--info); }
.badge-neutral { background: var(--neutral-soft); color: var(--neutral); }

.badge::before {
  content: "";
  display: inline-block;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
  margin-right: 0.35rem;
  vertical-align: 1px;
}

.badge-plain::before { display: none; }

/* A badge that is also a control (the /canvass ward picker): give it the
   affordances a status pill deliberately lacks. */
a.badge, .badge-choice {
  cursor: pointer;
  border: 1px solid transparent;
  transition: background 0.12s, color 0.12s;
}
a.badge:hover, .badge-choice:hover { text-decoration: none; border-color: currentColor; }

/* The /holdings matrix: six fixed columns that must all stay on screen */
.holdings-table { table-layout: fixed; min-width: 920px; }
.holdings-table th { white-space: normal; }
.holdings-table td { vertical-align: top; }
.holdings-table td.g { font-size: var(--text-sm); line-height: 1.5; }
.holdings-table col:nth-child(1) { width: 14%; }
.holdings-table col:nth-child(2) { width: 17%; }
.holdings-table col:nth-child(3) { width: 12%; }
.holdings-table col:nth-child(4) { width: 25%; }
.holdings-table col:nth-child(5) { width: 14%; }
.holdings-table col:nth-child(6) { width: 18%; }

/* /canvass ward picker, grouped by DEA */
.ward-group { display: flex; flex-wrap: wrap; align-items: center;
  gap: var(--space-2); margin-bottom: var(--space-3); }
.ward-group-name { font-weight: 600; color: var(--gray-800);
  margin-right: var(--space-2); }

/* Overview: the one-line formula and the per-DEA ladder */
.lead-line { font-size: var(--text-lg); color: var(--gray-800); }
.ladder-table td { vertical-align: top; }
.ladder-table td.g { font-size: var(--text-sm); line-height: 1.5; }

/* The /coverage grid: DEA × election, two stacked badges per cell */
.coverage-table { min-width: 880px; }
.coverage-table td { vertical-align: top; }
.coverage-table td .badge { display: flex; width: fit-content;
  margin-bottom: var(--space-1); white-space: nowrap; }
.coverage-table tr.is-chosen th,
.coverage-table tr.is-chosen td { background: var(--teal-soft); }
.coverage-form { display: flex; flex-wrap: wrap; align-items: center;
  gap: var(--space-2); margin-bottom: var(--space-4); }

/* Small grey annotation under a badge in a table cell (the /holdings matrix) */
.cell-note {
  display: block;
  font-size: var(--text-xs);
  font-weight: 400;
  line-height: 1.45;
  color: var(--gray-500);
  margin-top: 0.35rem;
  max-width: 30ch;
}

/* Party chips — the one place a party colour is allowed. */
.party {
  font-family: var(--mono);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.04em;
  padding: 0.1rem 0.4rem;
  border-radius: var(--radius-sm);
  color: #fff;
  background: var(--p-oth);
}
.party-SDLP  { background: var(--p-sdlp); }
.party-SF    { background: var(--p-sf); }
.party-DUP   { background: var(--p-dup); }
.party-UUP   { background: var(--p-uup); }
.party-ALL   { background: var(--p-all); }
.party-TUV   { background: var(--p-tuv); }
.party-GRN   { background: var(--p-grn); }

/* === Callouts === */

.callout {
  border-left: 3px solid var(--teal);
  background: var(--teal-soft);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 0.85rem 1.1rem;
  margin: 1.4rem 0;
  max-width: 68ch;
}

.callout > :last-child { margin-bottom: 0; }
.callout p { color: var(--gray-700); font-size: var(--text-md); margin-bottom: var(--space-2); }

.callout .label {
  display: block;
  font-family: var(--mono);
  font-size: var(--text-2xs);
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--teal);
  margin-bottom: 0.35rem;
  font-weight: 600;
}

.callout-warn { border-left-color: var(--bad); background: var(--bad-soft); }
.callout-warn .label { color: var(--bad); }
.callout-ok { border-left-color: var(--ok); background: var(--ok-soft); }
.callout-ok .label { color: var(--ok); }
.callout-note { border-left-color: var(--warn); background: var(--warn-soft); }
.callout-note .label { color: var(--warn); }

/* === Links === */

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

/* .no-print marks screen-only chrome (back-links, print buttons): the
   global print block hides it, so a printed sheet keeps its title and
   counts but drops the controls. */

/* === Buttons and inputs ===
   The one button and the one input. Pages compose these (.sw-save adds
   width, .sw-pct adds numeric alignment); nothing redeclares the basics. */

.btn {
  font-family: var(--sans);
  font-size: var(--text-sm);
  padding: 0.3rem 0.7rem;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--gray-700);
  cursor: pointer;
}

.btn:hover { border-color: var(--teal); color: var(--teal); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

.btn-primary {
  background: var(--teal);
  border-color: var(--teal);
  color: #fff;
  font-weight: 600;
  padding: 0.45rem 1.1rem;
}
.btn-primary:hover:not(:disabled) { background: var(--teal-hover); color: #fff; }

/* Destructive actions look different BEFORE the pointer arrives. */
.btn-danger { color: var(--bad); border-color: var(--gray-300); }
.btn-danger:hover { border-color: var(--bad); color: var(--bad); background: var(--bad-soft); }

.btn-sm { font-size: var(--text-xs); padding: 0.15rem 0.5rem; }

.input {
  font-family: var(--sans);
  font-size: var(--text-sm);
  padding: 0.35rem 0.55rem;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--gray-800);
}

/* === Figures (hand-drawn SVG diagrams) === */

figure {
  background: #fff;
  border: var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin: 1.6rem 0;
  padding: 1.4rem var(--space-5) var(--space-4);
  overflow-x: auto;
}

figure svg { display: block; width: 100%; min-width: 620px; height: auto; }

/* A diagram on a full-width page shouldn't balloon to the viewport */
.figure-narrow { max-width: 880px; }

/* Presentation attributes carrying var() are unreliable across engines, so the
   diagram's faces are set here and the attribute is only a hint. */
figure svg text { font-family: var(--sans); }
figure svg [font-family="var(--mono)"] { font-family: var(--mono); }

figcaption {
  font-size: var(--text-md);
  line-height: 1.55;
  color: var(--gray-500);
  margin-top: var(--space-4);
  padding-top: var(--space-3);
  border-top: 1px solid var(--gray-100);
  max-width: 70ch;
}

/* === Definition lists (the handbook's term entries) === */

.terms { border-top: 1px solid var(--gray-200); margin: 1.2rem 0; }

/* A terms list opening a card body sits flush against the header. */
.terms-flush { border-top: none; margin-top: 0; }

.terms > div {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.15rem;
  padding: 0.8rem 0;
  border-bottom: 1px solid var(--gray-200);
}

@media (min-width: 760px) {
  .terms > div { grid-template-columns: 210px minmax(0, 1fr); column-gap: 1.75rem; }
}

.terms dt { font-weight: 600; color: var(--gray-800); font-size: var(--text-md); }
.terms dt code {
  display: block;
  font-family: var(--mono);
  font-weight: 400;
  font-size: var(--text-xs);
  color: var(--ink-micro);
  letter-spacing: 0.03em;
  margin-top: 0.15rem;
}
.terms dd { color: var(--gray-600); font-size: var(--text-md); max-width: 62ch; }
.terms dd p { margin-bottom: var(--space-2); }
.terms dd > :last-child { margin-bottom: 0; }

/* === Table of contents (handbook) === */

/* The handbook is a 700-line document: its contents strip stays stuck
   to the top of the viewport the whole way down, so the reader is
   never more than one click from any section. */
.toc {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem 0.85rem;
  font-size: var(--text-sm);
  font-family: var(--mono);
  color: var(--ink-micro);
  margin-bottom: var(--space-8);
  padding: 0.6rem 0 0.6rem;
  border-bottom: 1px solid var(--gray-200);
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--gray-100);
}
.toc a { color: var(--gray-600); }
.toc a:hover { color: var(--teal); }

.section-head {
  font-family: var(--serif);
  font-size: var(--text-2xl);
  font-weight: 600;
  color: var(--gray-800);
  margin: 2.6rem 0 0.7rem;
  padding-top: 1.2rem;
  border-top: 1px solid var(--gray-200);
}

/* anchor targets land below the sticky TOC, not underneath it */
.content-narrow :target { scroll-margin-top: 3.6rem; }

.section-head .n {
  font-family: var(--mono);
  font-size: var(--text-xs);
  color: var(--teal);
  letter-spacing: 0.08em;
  display: block;
  margin-bottom: 0.3rem;
  font-weight: 600;
}

/* The pen strike, used only where it means a pen strike. */
.strike { position: relative; color: var(--gray-600); font-family: var(--mono); }
.strike::after {
  content: "";
  position: absolute;
  left: -2%; right: -2%; top: 52%;
  height: 2px;
  background: var(--cobalt);
  transform: rotate(-1.2deg);
  border-radius: 2px;
}

/* === Utility === */

.mono { font-family: var(--mono); }
.nowrap { white-space: nowrap; }
.mt0 { margin-top: 0; }
.mt6 { margin-top: var(--space-6); }

/* === Station -> ward editor (/stations) ===
   Three columns: the work list, the editor, the ward palette. Collapses to a
   single column on narrow screens so it still works on a laptop in a hall. */

.sw-layout {
  display: grid;
  grid-template-columns: 270px minmax(0, 1fr) 250px;
  gap: var(--space-5);
  align-items: start;
}

@media (max-width: 1280px) {
  .sw-layout { grid-template-columns: 240px minmax(0, 1fr); }
  .sw-palette { grid-column: 1 / -1; }
  .sw-palette .sw-scroll { max-height: 260px; }
}

@media (max-width: 860px) {
  .sw-layout { grid-template-columns: 1fr; }
}

.sw-list, .sw-palette { position: sticky; top: var(--space-4); margin-bottom: 0; }
.sw-editor { min-width: 0; }   /* grid child: wide tables scroll, not blow out */
.sw-scroll { max-height: 70vh; overflow-y: auto; padding: var(--space-2); }

/* --- work list --- */

.sw-item {
  display: flex;
  gap: 0.55rem;
  align-items: flex-start;
  padding: 0.45rem 0.6rem;
  border-radius: var(--radius-sm);
  color: var(--gray-700);
  text-decoration: none;
  line-height: 1.35;
}

.sw-item:hover { background: var(--gray-50); text-decoration: none; }
.sw-item.on { background: var(--teal-soft); }
.sw-item.on .sw-item-name { color: var(--teal); font-weight: 600; }

.sw-item-main { display: flex; flex-direction: column; min-width: 0; }
.sw-item-name { font-size: var(--text-md); font-weight: 500; }
.sw-item-meta {
  font-family: var(--mono);
  font-size: var(--text-2xs);
  color: var(--ink-micro);
}

.sw-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 6px;
}

.sw-checked    { background: var(--ok); }
.sw-seeded     { background: var(--warn); }
.sw-unassigned { background: var(--bad); }

/* --- editor --- */

.sw-hint { font-size: var(--text-md); color: var(--gray-500); margin-bottom: 0.9rem; }

.sw-drop {
  border: 1.5px dashed var(--gray-300);
  border-radius: var(--radius);
  padding: 0.35rem var(--space-2);
  transition: border-color 0.12s, background 0.12s;
}

.sw-drop.over { border-color: var(--teal); background: var(--teal-soft); }

.sw-table { font-size: var(--text-md); }
.sw-table td, .sw-table th { padding: 0.4rem 0.6rem; }
.sw-code { font-size: var(--text-xs); color: var(--ink-micro); }

.sw-empty {
  text-align: center;
  color: var(--ink-micro);
  font-size: var(--text-md);
  padding: 1.2rem 0;
  margin: 0;
}

.sw-pct {
  width: 5.5rem;
  text-align: right;
  font-family: var(--mono);
  padding: 0.22rem 0.4rem;
}

.sw-x {
  border: none;
  background: none;
  color: var(--ink-micro);
  font-size: var(--text-xs);
  font-family: var(--mono);
  cursor: pointer;
  padding: 0.2rem;
}

.sw-x:hover { color: var(--bad); text-decoration: underline; }

.sw-total {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  margin: 0.9rem 0;
  font-size: var(--text-md);
  color: var(--gray-500);
}

.sw-total b { font-family: var(--mono); font-size: var(--text-base); }
.sw-ok  { color: var(--ok); }
.sw-off { color: var(--bad); }

.sw-meta {
  display: flex;
  gap: var(--space-4);
  flex-wrap: wrap;
  margin: var(--space-4) 0;
}

.sw-meta label {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  font-size: var(--text-sm);
  color: var(--gray-500);
  flex: 1 1 15rem;
}

.sw-actions { display: flex; align-items: center; gap: 0.9rem; flex-wrap: wrap; }

#wardfilter { width: 100%; margin-bottom: 0.6rem; }

.sw-dea { margin-bottom: 0.7rem; }

.sw-dea-label {
  font-family: var(--mono);
  font-size: var(--text-3xs);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-micro);
  margin-bottom: 0.3rem;
}

.sw-ward {
  display: block;
  width: 100%;
  text-align: left;
  font-family: var(--sans);
  font-size: var(--text-sm);
  padding: var(--space-1) var(--space-2);
  margin-bottom: 2px;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--gray-700);
  cursor: grab;
}

.sw-ward:hover { border-color: var(--teal); color: var(--teal); }
.sw-ward:active { cursor: grabbing; }

/* === Canvass sheets (/canvass) ===
   The printable ward–road sheet: dense, monochrome-safe, A4-tuned. The
   screen view is the print view — what you see is what the volunteer
   carries. Blank Code/Notes columns are deliberate writing space.
   Cell padding here is print density tuning — literal on purpose. */

.canvass-sheet { background: #fff; border: 1px solid var(--gray-200);
  border-radius: var(--radius-sm); padding: var(--space-4) var(--space-5); }
.sheet-head { font-size: var(--text-md); margin-bottom: var(--space-3); }
.sheet-date { float: right; color: var(--gray-700); }
.code-key { color: var(--gray-700); font-size: var(--text-sm); margin-top: 0.3rem; }
.sheet-provenance { color: var(--gray-500); font-family: var(--mono);
  font-size: var(--text-3xs); margin-top: 0.25rem; }
.sheet-table { width: 100%; border-collapse: collapse; font-size: var(--text-sm); }
.sheet-table th, .sheet-table td { border: 1px solid var(--gray-200);
  padding: 0.22rem 0.4rem; text-align: left; vertical-align: top; }
.sheet-table thead th { background: var(--gray-100); }
.sheet-table tbody th.sh-house { font-weight: 600; white-space: nowrap; }
.sheet-table .door-first th, .sheet-table .door-first td {
  border-top: 2px solid var(--gray-800); }
.sh-el, .sh-flag { text-align: center !important; width: 2.2rem; }
.sh-name { min-width: 11rem; }   /* the name column never crushes */
.sh-code { width: 3.2rem; }
.sh-notes { width: 26%; }

@media print {
  .canvass-sheet { border: none; padding: 0; }
  .sheet-table { font-size: 9pt; }
  .sheet-table tr { break-inside: avoid; }
  /* the header row must read even when the print dialog drops
     background graphics (most default to off) */
  .sheet-table thead th { border-bottom: 2px solid var(--gray-800); }
}

/* The /canvass locator map (Leaflet) and its table linkage. Chrome is
   party-neutral; the line marks carry the data (weight = lapsed count,
   selection = the identity accent — canvass-map.js reads these colours
   from the tokens via getComputedStyle). */
.canvass-map { height: 420px; border: 1px solid var(--gray-200);
  border-radius: var(--radius-sm); margin-bottom: var(--space-5); background: var(--gray-50); }
.canvass-map-note { padding: var(--space-4); color: var(--gray-700);
  font-size: var(--text-md); }
#roads-table tr[data-road] { cursor: pointer; }
#roads-table tr.road-hit th, #roads-table tr.road-hit td {
  background: var(--teal-soft); }
.no-map { font-size: var(--text-xs); font-weight: 500; color: var(--gray-500);
  border: 1px solid var(--gray-300); border-radius: var(--radius-sm);
  padding: 0 0.3rem; margin-left: 0.4rem; white-space: nowrap; }
.map-attribution { color: var(--gray-500); font-size: var(--text-xs); }
@media print {
  .canvass-map, .map-attribution, .turf-bar { display: none; }
}

/* The turf bar (#38): cut a named round on the map, save, print the
   packet. Controls are the shared .btn/.input. */
.turf-bar { display: flex; flex-wrap: wrap; align-items: center;
  gap: var(--space-2); margin-bottom: var(--space-3); }
.turf-bar .sub { flex-basis: 100%; margin: 0; }
#turf-tools { display: inline-flex; flex-wrap: wrap; align-items: center;
  gap: var(--space-2); }
#turf-tools[hidden] { display: none; }

/* Inline replacements for the old alert/confirm/prompt layer. */
.turf-msg { flex-basis: 100%; margin: 0; max-width: 62ch;
  padding: var(--space-2) var(--space-3);
  background: var(--warn-soft); border-left: 3px solid var(--warn);
  border-radius: var(--radius-sm); font-size: var(--text-sm); }
.turf-msg .btn { margin-top: 0.2rem; }
.walked-form { display: inline-flex; flex-wrap: wrap; align-items: flex-end;
  gap: var(--space-2); padding: var(--space-1) 0; }
.walked-form label { display: flex; flex-direction: column; gap: 2px;
  font-size: var(--text-xs); color: var(--gray-600); }
.walked-err { color: var(--bad); font-size: var(--text-sm); }
.retire-confirm { font-size: var(--text-sm); color: var(--gray-700); }

/* Ward switching in flight: the panel dims and the badges go inert so
   the multi-second whole-DEA fetch is visibly under way. */
#ward-panel.is-busy { opacity: 0.45; pointer-events: none; }
.ward-pick.is-disabled { pointer-events: none; opacity: 0.6; }

/* The packet: one turf, one print job, each road on its own page. */
.packet-sheet { margin-bottom: var(--space-6); }
@media print {
  .packet-sheet { margin: 0; break-after: page; page-break-after: always; }
  .packet-sheet:last-child { break-after: auto; page-break-after: auto; }
}

/* The sheet's orientation map: server-rendered SVG, VAN-walk-packet
   style — the target road bold, context streets grey, names legible,
   monochrome-print-safe. No tiles: the paper never needs the network. */
.sheet-map { display: block; width: 100%; max-width: 32rem; height: auto;
  margin: 0.6rem 0 0.15rem; border: 1px solid var(--gray-200);
  border-radius: var(--radius-sm); }
.sm-bg { fill: #fff; }
.sm-ctx { fill: none; stroke: var(--gray-300); stroke-width: 1.5;
  stroke-linecap: round; }
.sm-target { fill: none; stroke: var(--gray-800); stroke-width: 4;
  stroke-linecap: round; }
.sm-label { font-size: 10px; fill: var(--gray-500);
  paint-order: stroke; stroke: #fff; stroke-width: 3px; }
.sm-scale line { stroke: var(--gray-800); stroke-width: 1.5; }
.sm-scale text, .sm-north { font-size: 10px; fill: var(--gray-700); }
.sm-attribution { color: var(--gray-500); font-size: var(--text-3xs);
  margin-bottom: var(--space-2); }
.sheet-map-missing { color: var(--gray-500); font-size: var(--text-sm);
  margin: var(--space-2) 0; }

@media print {
  /* ~80x50 mm block — VAN-style orientation detail, ~a quarter of the
     first page; the walk list is still the artifact */
  .sheet-map { max-width: 80mm; margin: 2mm 0; break-inside: avoid; }
  .sm-attribution { font-size: 5pt; }  /* ODbL credit stays on paper */
}

/* === /analyses — the catalogue ===
   Stacked rows, not a table: the question needs a full prose measure and
   the metadata needs a fixed rail, which a 4-column table can't give. */

.cat-group { font-size: var(--text-xl); font-weight: 700;
  color: var(--gray-800); margin: var(--space-8) 0 var(--space-3); }
.cat-card { padding: 0; }
.cat-item { display: grid; grid-template-columns: minmax(0, 1fr) 240px;
  gap: var(--space-2) var(--space-8);
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--gray-100); }
.cat-item:last-child { border-bottom: none; }
.cat-q { font-weight: 600; color: var(--gray-800); }
.cat-detail { color: var(--gray-600); font-size: var(--text-md);
  max-width: 62ch; margin: 0.2rem 0 0; }
.cat-rests { color: var(--gray-500); font-size: var(--text-sm);
  max-width: 62ch; margin: 0.35rem 0 0; }
.cat-k { font-family: var(--mono); font-size: var(--text-2xs);
  text-transform: uppercase; letter-spacing: 0.07em;
  color: var(--ink-micro); margin-right: 0.25rem; }
.cat-meta { display: flex; flex-direction: column; align-items: flex-start;
  gap: 0.35rem; padding-top: 0.1rem; }
.cat-where { font-size: var(--text-md); }
.cat-note { color: var(--gray-500); font-size: var(--text-xs);
  line-height: 1.5; margin: 0; }
@media (max-width: 760px) {
  .cat-item { grid-template-columns: 1fr; }
}

/* === /map — the choropleth in the design system ===
   The server classifies features on fixed breaks (pipeline/mapview.py);
   map.js paints class -> colour. Controls and legend are ordinary page
   chrome; the only data colours are the ramp swatches. */

.map-toolbar { display: flex; flex-wrap: wrap; align-items: center;
  gap: var(--space-2); margin-bottom: var(--space-2); }
.map-toolbar .btn { text-decoration: none; }
.map-layerbox { display: inline-flex; flex-wrap: wrap;
  gap: 0.15rem var(--space-3); margin-left: var(--space-2); }
.map-layer-choice { font-size: var(--text-sm); color: var(--gray-700);
  white-space: nowrap; cursor: pointer; }
.map-desc { max-width: 72ch; margin-bottom: var(--space-2); }

.the-map { height: 68vh; min-height: 420px; border: 1px solid var(--gray-200);
  border-radius: var(--radius-sm); background: var(--gray-50); }
/* Quiet the mouse-click focus ring on map features, but keep a visible
   indicator for keyboard users — never a blanket outline: none. */
.the-map path.leaflet-interactive:focus:not(:focus-visible) { outline: none; }
.the-map path.leaflet-interactive:focus-visible {
  outline: 2px solid var(--cobalt); outline-offset: 1px; }

.map-yearform { display: inline-flex; align-items: center;
  gap: var(--space-2); }
.map-topics { display: flex; flex-wrap: wrap; gap: var(--space-2);
  margin-bottom: var(--space-3); }
.map-showing { margin-bottom: var(--space-1); }

.map-underbar { display: flex; flex-wrap: wrap; align-items: flex-start;
  justify-content: space-between; gap: var(--space-2) var(--space-4);
  margin-top: var(--space-2); }
.map-legend-title { font-family: var(--mono); font-size: var(--text-2xs);
  text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--gray-500); margin-bottom: 0.3rem; }
.map-legend-chips { display: flex; flex-wrap: wrap;
  gap: 0.25rem var(--space-3); }
.map-legend-chip { font-family: var(--mono); font-size: var(--text-xs);
  color: var(--gray-700); white-space: nowrap; }
.map-legend-chip i { display: inline-block; width: 12px; height: 12px;
  border-radius: 3px; border: 1px solid rgba(22,35,42,0.15);
  vertical-align: -2px; margin-right: 0.3rem; }
.map-legend-note { font-size: var(--text-xs); color: var(--gray-500);
  margin-top: 0.25rem; }

/* permanent ward labels: name over count, white halo for legibility on
   any fill (the counts stay primary even when the fill is a rate) */
.map-lbl { background: none; border: none; }
.map-lbl-name, .map-lbl-val { display: block; text-align: center;
  white-space: nowrap; transform: translate(-50%, -50%);
  font-family: var(--sans); color: var(--gray-800);
  text-shadow: 0 0 3px #fff, 0 0 3px #fff, 0 0 3px #fff, 0 0 3px #fff; }
.map-lbl-name { font-size: 12px; font-weight: 600; }
.map-lbl-val { font-size: 11px; margin-top: 11px; font-weight: 400; }

@media print {
  .map-toolbar { display: none; }
}

/* /calendar — the timeline strip: today -> polling day on one line. */
.cal-strip-card { padding: var(--space-4) var(--space-5) var(--space-2); }
/* the strip keeps its drawing width and scrolls on a narrow window */
.strip-scroll { overflow-x: auto; }
.cal-strip { min-width: 720px; }
.tl-axis { stroke: var(--gray-300); stroke-width: 2; }
.tl-tick { stroke: var(--gray-300); stroke-width: 1; }
.tl-month { font-size: 11px; fill: var(--ink-micro);
  font-family: var(--mono); }
.tl-dot { stroke: #fff; stroke-width: 1.5; }
.tl-statutory { fill: var(--gray-600); }
.tl-campaign { fill: var(--teal); }
.tl-reg { fill: var(--bad-soft); stroke: var(--bad); stroke-width: 2.5; }
.tl-label { font-size: 11.5px; fill: var(--gray-700); }
.tl-label-reg { font-size: 11.5px; font-weight: 600; fill: var(--bad); }
.tl-poll-line { stroke: var(--gray-800); stroke-width: 2; }
.tl-poll { font-size: 11.5px; font-weight: 600; fill: var(--gray-800);
  font-family: var(--mono); }

/* /calendar — the campaign clock (#48). Scenario (AE27) rows sit
   quieter than the LE27 spine; passed and done rows quieter still.
   Quiet = a muted colour token, never opacity — muted text still has
   to clear contrast thresholds. */
.cal-table td { vertical-align: top; }
.cal-date { white-space: nowrap; font-variant-numeric: tabular-nums; }
.cal-note { color: var(--gray-700); font-size: var(--text-sm); max-width: 34rem;
  margin-top: 0.15rem; }
.cal-scenario td { color: var(--gray-500); }
.cal-scenario .cal-note { color: var(--gray-500); }
.cal-passed td { color: var(--gray-500); }
.cal-passed .cal-note { color: var(--gray-500); }
.cal-done td { color: var(--gray-500); }
.cal-done .cal-note { color: var(--gray-500); }
/* The signature, use 3 of 3: DONE is a register mark — a teal strike
   through the thing that no longer needs doing. Same mark on walked
   turfs/roads (/canvass) and done milestones (/calendar). */
.cal-done .cal-what, .is-walked > th {
  text-decoration: line-through;
  text-decoration-color: var(--teal);
  text-decoration-thickness: 2px;
}

/* === Responsive === */

@media (max-width: 900px) {
  .sidebar {
    position: static;
    width: 100%;
    height: auto;
    flex-direction: column;
  }
  .app-layout { flex-direction: column; }
  .main-content { margin-left: 0; }
  .content-area { padding: var(--space-6) 1.15rem 4rem; }
  .sidebar-nav { display: flex; flex-wrap: wrap; padding: var(--space-2); }
  .nav-group { margin: 0; }
  .nav-group-label { display: none; }
  .nav-link { border-left: none; border-bottom: 3px solid transparent; }
  .nav-link.active { border-left: none;
    border-bottom-color: var(--teal-on-ink); }
  /* The "local only / never publish" warning is the one line that must
     SURVIVE a small screen — condensed, never dropped. */
  .sidebar-foot { padding: var(--space-2) var(--space-5); line-height: 1.5; }
  .sidebar-foot br { display: none; }
  .sidebar-foot .vintage { display: block; }
}

/* === Print (global) === */

@page { size: A4; margin: 12mm; }

@media print {
  .sidebar, .no-print, .skip-link { display: none; }
  .main-content { margin-left: 0; }
  .card, figure { box-shadow: none; break-inside: avoid; }
  /* analytical pages: never clip a wide table into the gutter */
  .table-wrap { overflow: visible; background: none; }
  .table-tall { max-height: none; overflow: visible; }
  table { font-size: 8.5pt; }
  /* a table that breaks across pages repeats its column headers */
  thead { display: table-header-group; }
  .sortable-th.sort-asc::after, .sortable-th.sort-desc::after { content: ""; }
}

/* === Sign-in (pipeline/auth.py, #70) ===
   A standalone page: no sidebar until someone is signed in. */

.signin-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--gray-100);
  padding: var(--space-4);
}
.signin-card {
  max-width: 26rem;
  width: 100%;
  background: #fff;
  border: var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: var(--space-8) var(--space-6);
}
.signin-card h1 {
  font-family: var(--serif);
  font-size: var(--text-2xl);
  margin: 0 0 var(--space-4);
}
.signin-card .btn-primary { width: 100%; font-size: var(--text-base); padding: 0.7rem 1rem; }
.signin-help, .signin-note { font-size: var(--text-sm); color: var(--gray-600); }
.signin-note { border-top: 1px solid var(--gray-200); padding-top: var(--space-4); margin-top: var(--space-6); }
.signin-error { color: var(--bad); background: var(--bad-soft); padding: var(--space-2) var(--space-3); border-radius: var(--radius-sm); }

.sidebar-foot .signout-form { margin-top: var(--space-2); }
.sidebar-foot .link-button {
  background: none; border: 0; padding: 0; cursor: pointer;
  font: inherit; color: var(--teal-on-ink); text-decoration: underline;
}
