/* =============================================================================
   Framers — "founding-era print, modern build" (D-71)
   Caslon for headings and Frame text (the face the Declaration was first
   printed in); Public Sans (the U.S. Web Design System face) for the interface.
   Both self-hosted (no third-party requests). Parchment and ink, federal navy,
   ochre and seal red as accents. Every text color is AA on every surface.
   ========================================================================== */

@font-face { font-family: "Libre Caslon Text"; src: url("../fonts/libre-caslon-text.47c2e04680d3.woff2") format("woff2"); font-weight: 400 700; font-style: normal; font-display: swap; }
@font-face { font-family: "Libre Caslon Text"; src: url("../fonts/libre-caslon-text-italic.4c4fe83229cf.woff2") format("woff2"); font-weight: 400 700; font-style: italic; font-display: swap; }
@font-face { font-family: "Public Sans"; src: url("../fonts/public-sans.3ee93cde1d5c.woff2") format("woff2"); font-weight: 100 900; font-style: normal; font-display: swap; }
@font-face { font-family: "Public Sans"; src: url("../fonts/public-sans-italic.fd784efe20e9.woff2") format("woff2"); font-weight: 100 900; font-style: italic; font-display: swap; }

:root {
  --bg: #f5efe2;          /* parchment */
  --surface: #fffcf6;     /* paper */
  --sunk: #efe7d6;
  --text: #1c1f26;        /* ink */
  --muted: #5a5d63;
  --border: #d6c9ae;      /* printer's rule */
  --field-border: #8b8172;
  --accent: #1f3a5f;      /* federal navy */
  --accent-strong: #152a46;
  --accent-contrast: #ffffff;
  --accent-soft: #e2e8f0;
  --gold: #8a5f14;        /* ochre: eyebrows, ornaments */
  --gold-soft: #f3e6c8;
  --seal: #9a2f2a;        /* seal red */
  --ok: #2b6a3e;
  --ok-soft: #e1efe3;
  --warn: #8a5300;
  --warn-soft: #f8ecd2;
  --danger: #a22c2c;
  --danger-soft: #f8e1df;
  --danger-contrast: #ffffff;
  --focus: #8a5f14;
  --shadow: 0 1px 0 rgba(28, 31, 38, 0.04), 0 8px 24px -16px rgba(28, 31, 38, 0.25);
  --radius: 6px;
  --radius-lg: 10px;
  --font-body: "Public Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-head: "Libre Caslon Text", "Iowan Old Style", Georgia, serif;
  --measure: 44rem;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #11161f;
    --surface: #19202c;
    --sunk: #222a38;
    --text: #ede6d6;
    --muted: #a9afba;
    --border: #323b4c;
    --field-border: #6a7488;
    --accent: #a8c1e6;
    --accent-strong: #c4d6f0;
    --accent-contrast: #0e1420;
    --accent-soft: #23314a;
    --gold: #d9b26a;
    --gold-soft: #3a3020;
    --seal: #ec9a8f;
    --ok: #86d19f;
    --ok-soft: #1c3226;
    --warn: #f0bf6a;
    --warn-soft: #3a2e19;
    --danger: #f39b9b;
    --danger-soft: #3e2224;
    --danger-contrast: #0e1420;
    --focus: #f0bf6a;
    --shadow: 0 1px 0 rgba(0, 0, 0, 0.2), 0 10px 28px -18px rgba(0, 0, 0, 0.8);
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-rendering: optimizeLegibility; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.6;
  font-feature-settings: "kern", "liga";
}

h1, h2, h3, h4 { font-family: var(--font-head); font-weight: 700; line-height: 1.2; margin: 0 0 0.55em; letter-spacing: -0.005em; text-wrap: balance; }
h1 { font-size: clamp(2rem, 4.5vw, 2.85rem); }
h2 { font-size: clamp(1.35rem, 2.6vw, 1.6rem); }
h3 { font-size: 1.15rem; }
p, ul, ol, dl { margin: 0 0 1em; }
p { text-wrap: pretty; }
strong { font-weight: 650; }

a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 2px; }
::selection { background: var(--gold-soft); }

.container { width: 100%; max-width: 1040px; margin: 0 auto; padding: 0 20px; }
@media (max-width: 600px) { .container { padding: 0 16px; } }

.skip-link { position: absolute; left: -999px; top: 0; }
.skip-link:focus { left: 16px; top: 8px; background: var(--surface); padding: 8px 12px; z-index: 10; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* --- Header ------------------------------------------------------------------ */
.env-banner { background: var(--warn-soft); color: var(--warn); text-align: center; font-size: 0.8rem; font-weight: 600; letter-spacing: 0.04em; padding: 3px 16px; }
.site-header { background: var(--surface); border-bottom: 3px double var(--border); position: relative; z-index: 5; }
.header-inner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 24px; min-height: 68px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; }
.brand-mark { width: 32px; height: 32px; color: var(--accent); flex: none; }
.brand-name { font-family: var(--font-head); font-size: 1.55rem; font-weight: 700; letter-spacing: 0.01em; line-height: 1; }
.brand:hover .brand-name { color: var(--accent); }
.nav-list { list-style: none; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 4px; margin: 0; padding: 0; }
.nav-list a, .nav-list .link-button { display: inline-block; padding: 8px 10px; border-radius: var(--radius); text-decoration: none; color: var(--text); font-weight: 500; font-size: 0.97rem; }
.nav-list a:hover, .nav-list .link-button:hover { background: var(--sunk); color: var(--accent); }
.nav-list a[aria-current="page"] { color: var(--accent); box-shadow: inset 0 -2px 0 var(--gold); border-radius: 0; }
.nav-list .button-small { color: var(--accent-contrast); background: var(--accent); margin-left: 6px; padding: 8px 16px; }
.nav-list .button-small:hover { background: var(--accent-strong); color: var(--accent-contrast); }
.nav-sep { width: 1px; height: 22px; background: var(--border); margin: 0 6px; }
.inline-form { display: inline; margin: 0; }
.link-button { background: none; border: 0; padding: 0; font: inherit; color: var(--accent); cursor: pointer; }
.link-button:hover { text-decoration: underline; }
.nav-toggle { display: none; }
@media (max-width: 860px) {
  .js .nav-toggle { display: inline-flex; align-items: center; gap: 8px; background: transparent; color: var(--text); border: 1px solid var(--border); border-radius: var(--radius); padding: 8px 12px; min-height: 44px; font: inherit; font-weight: 600; cursor: pointer; margin: 0; }
  .js .nav-toggle:hover { background: var(--sunk); filter: none; }
  .nav-toggle svg { width: 18px; height: 18px; }
  .js .site-nav { flex-basis: 100%; display: none; padding-bottom: 12px; }
  .js .site-nav.is-open { display: block; }
  .site-nav { flex-basis: 100%; }
  .nav-list { flex-direction: column; align-items: stretch; gap: 2px; }
  .nav-list a, .nav-list .link-button { display: block; width: 100%; text-align: left; padding: 12px 10px; font-size: 1.02rem; }
  .nav-list .button-small { margin: 8px 0 0; text-align: center; }
  .nav-sep { width: 100%; height: 1px; margin: 6px 0; }
  .nav-list a[aria-current="page"] { box-shadow: inset 3px 0 0 var(--gold); }
}

main.container { padding-top: 36px; padding-bottom: 64px; min-height: 60vh; }
.site-notice { background: var(--gold-soft); border-bottom: 1px solid var(--border); padding: 10px 0; font-weight: 500; }

/* --- Footer ------------------------------------------------------------------ */
.site-footer { border-top: 3px double var(--border); background: var(--surface); color: var(--muted); font-size: 0.92rem; padding: 36px 0 28px; }
.footer-grid { display: grid; gap: 20px 40px; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); align-items: start; }
@media (max-width: 700px) { .footer-grid { grid-template-columns: 1fr; } }
.motto { font-family: var(--font-head); font-style: italic; font-size: 1.15rem; color: var(--text); margin-bottom: 0.6em; }
.footer-links { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.footer-links a { color: var(--text); }
.footer-fine { font-size: 0.85rem; }

/* --- Shared pieces ----------------------------------------------------------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 24px; margin-bottom: 20px; box-shadow: var(--shadow); }
.card > :last-child { margin-bottom: 0; }
.auth-card { max-width: 520px; margin: 0 auto 20px; }
.danger-zone { border-color: var(--danger); }
.eyebrow { font-family: var(--font-body); text-transform: uppercase; letter-spacing: 0.14em; font-size: 0.76rem; font-weight: 700; color: var(--gold); margin-bottom: 0.6em; }
.lede { font-size: 1.18rem; line-height: 1.55; max-width: var(--measure); color: var(--text); }
.prose { max-width: var(--measure); }
.prose h2 { margin-top: 1.6em; }
.rule-ornament { border: 0; height: 12px; margin: 32px 0; background: linear-gradient(var(--border), var(--border)) left center / calc(50% - 18px) 1px no-repeat, linear-gradient(var(--border), var(--border)) right center / calc(50% - 18px) 1px no-repeat; position: relative; }
.rule-ornament::after { content: ""; position: absolute; left: 50%; top: 50%; width: 8px; height: 8px; border: 1px solid var(--gold); transform: translate(-50%, -50%) rotate(45deg); }
.helptext, .muted { color: var(--muted); }
.small { font-size: 0.9rem; }

.button, button[type="submit"]:not(.link-button) {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--accent); color: var(--accent-contrast);
  border: 1px solid var(--accent); border-radius: var(--radius);
  padding: 10px 20px; min-height: 46px;
  font: inherit; font-weight: 650; letter-spacing: 0.01em; line-height: 1.2;
  text-decoration: none; cursor: pointer; margin: 0 8px 8px 0;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.button:hover, button[type="submit"]:not(.link-button):hover { background: var(--accent-strong); border-color: var(--accent-strong); }
.button-secondary, button[type="submit"].button-secondary { background: transparent; color: var(--accent); border-color: var(--accent); }
.button-secondary:hover, button[type="submit"].button-secondary:hover { background: var(--accent-soft); color: var(--accent); }
.button-small { padding: 4px 12px; min-height: 0; margin: 0; }
.button-danger, button[type="submit"].button-danger { background: var(--danger); border-color: var(--danger); color: var(--danger-contrast); }
.button-danger:hover, button[type="submit"].button-danger:hover { background: var(--danger); filter: brightness(0.92); }

/* --- Forms ------------------------------------------------------------------- */
form p { margin-bottom: 16px; }
label { display: inline-block; font-weight: 600; margin-bottom: 5px; }
input[type="text"], input[type="email"], input[type="password"], input[type="tel"], input[type="number"], input[type="search"], textarea, select {
  display: block; width: 100%;
  font: inherit; color: var(--text);
  background: var(--surface);
  border: 1px solid var(--field-border); border-radius: var(--radius);
  padding: 10px 12px; min-height: 46px;
}
input:hover, textarea:hover, select:hover { border-color: var(--accent); }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: 0.85; }
textarea { line-height: 1.5; resize: vertical; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--accent); }
input[type="checkbox"] { width: 20px; height: 20px; vertical-align: middle; margin-right: 6px; }
/* Django renders checkboxes after their label; show them inline, box first. */
form p:has(> input[type="checkbox"]) { display: flex; flex-direction: row-reverse; justify-content: flex-end; align-items: flex-start; gap: 10px; }
form p:has(> input[type="checkbox"]) label { font-weight: 400; margin: 0; }
form p:has(> input[type="checkbox"]) input[type="checkbox"] { flex: none; margin: 3px 0 0; }
.errorlist { list-style: none; padding: 10px 14px; margin: 0 0 10px; background: var(--danger-soft); color: var(--danger); border-radius: var(--radius); font-weight: 500; }

.messages { list-style: none; padding: 0; margin: 0 0 24px; }
.message { padding: 12px 16px; border-radius: var(--radius); margin-bottom: 8px; background: var(--accent-soft); border-left: 4px solid var(--accent); }
.message-success { background: var(--ok-soft); color: var(--ok); border-left-color: var(--ok); }
.message-warning { background: var(--warn-soft); color: var(--warn); border-left-color: var(--warn); }
.message-error { background: var(--danger-soft); color: var(--danger); border-left-color: var(--danger); }
.status { padding: 12px 16px; border-radius: var(--radius); border-left: 4px solid currentColor; }
.status-ok { background: var(--ok-soft); color: var(--ok); }
.status-warning { background: var(--warn-soft); color: var(--warn); }

.facts dt { font-weight: 650; margin-top: 10px; font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.facts dd { margin: 2px 0 6px; }
.link-list { padding-left: 1.2em; }
.cf-turnstile { margin: 8px 0 14px; min-height: 65px; }

@media (max-width: 600px) {
  body { font-size: 1rem; }
  .card { padding: 18px; }
  .button { width: 100%; margin-right: 0; }
  .nav-list .button-small { width: auto; }
}

/* --- Console ------------------------------------------------------------- */
.site-notice { background: var(--accent-soft); border-bottom: 1px solid var(--border); padding: 10px 0; }
.tile-grid, .card-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); margin-bottom: 20px; }
.card-grid .card { margin-bottom: 0; }
.tile { display: block; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 18px 20px; color: var(--text); text-decoration: none; box-shadow: var(--shadow); transition: border-color 0.15s; }
.tile h2 { font-size: 1.3rem; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.tile h2::after { content: "→"; margin-left: auto; font-family: var(--font-body); font-size: 1rem; color: var(--muted); }
.tile p { color: var(--muted); font-size: 0.95rem; margin: 0; }
.tile:hover { border-color: var(--accent); }
.tile h2 { color: var(--accent); }
.table-wrap { overflow-x: auto; margin-bottom: 20px; }
.data-table { width: 100%; border-collapse: collapse; background: var(--surface); font-size: 0.95rem; }
.data-table th, .data-table td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
.data-table thead th { font-size: 0.85rem; color: var(--muted); white-space: nowrap; }
.badge { display: inline-block; font-size: 0.8rem; font-family: var(--font-body); font-weight: 600; padding: 2px 8px; border-radius: 999px; vertical-align: middle; }
.badge-active { background: var(--ok-soft); color: var(--ok); }
.badge-draft { background: var(--warn-soft); color: var(--warn); }
.badge-retired, .badge-discarded { background: var(--accent-soft); color: var(--muted); }
.facts-inline dt { margin-top: 6px; }
.hash { font-size: 0.8rem; word-break: break-all; }
fieldset.card { min-width: 0; }
fieldset.card legend { font-family: var(--font-head); font-size: 1.2rem; font-weight: 700; padding: 0 6px; }
.field-grid { display: grid; gap: 4px 16px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.field label { font-size: 0.92rem; }
.field-error { display: block; color: var(--danger); font-size: 0.9rem; }
.inline-fields { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; }
.inline-fields .field { flex: 1 1 200px; margin-bottom: 8px; }
button[type="submit"].button-secondary { background: transparent; color: var(--accent); }

/* --- Frames -------------------------------------------------------------- */
.submit-layout { display: grid; gap: 20px; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); align-items: start; }
@media (max-width: 800px) { .submit-layout { grid-template-columns: 1fr; } }
.guidance ol { padding-left: 1.2em; }
.char-count { display: block; text-align: right; font-size: 0.9rem; color: var(--muted); margin-top: 4px; }
.char-count.over-limit { color: var(--danger); font-weight: 700; }
.frame-header { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px 14px; margin-bottom: 10px; }
.frame-header h1, .frame-header h3 { margin: 0; }
.frame-text { margin: 0 0 16px; padding: 14px 18px; border-left: 4px solid var(--accent); background: var(--bg); border-radius: 0 8px 8px 0; font-size: 1.1rem; overflow-wrap: anywhere; }
.frame-list { list-style: none; padding: 0; margin: 0 0 12px; }
.frame-list li { padding: 10px 0; border-bottom: 1px solid var(--border); display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: baseline; }
.frame-snippet { flex-basis: 100%; overflow-wrap: anywhere; }
.badge-submitted, .badge-in_circulation { background: var(--accent-soft); color: var(--accent); }
.badge-held_for_review, .badge-suspended { background: var(--warn-soft); color: var(--warn); }
.badge-all_stages { background: var(--ok-soft); color: var(--ok); }
.badge-failed, .badge-rejected, .badge-removed { background: var(--danger-soft); color: var(--danger); }
.badge-withdrawn, .badge-cancelled { background: var(--accent-soft); color: var(--muted); }
.flag-list { padding-left: 1.2em; }
.decision-row { display: flex; flex-wrap: wrap; gap: 12px 24px; align-items: flex-end; }
.reject-form { flex: 1 1 320px; border-left: 3px solid var(--danger-soft); padding-left: 16px; }
.reject-form .field { margin-bottom: 10px; }
.reject-form select, .reject-form input[type="text"] { width: 100%; }
.reject-form button, .decision-row button { margin: 0; }

/* --- Voting Room ------------------------------------------------------- */
.vote-layout { display: grid; gap: 20px; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); align-items: start; }
@media (max-width: 800px) { .vote-layout { grid-template-columns: 1fr; } }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.ballot-choices { border: 0; padding: 0; margin: 0 0 16px; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.ballot-choice { display: flex; align-items: center; justify-content: center; gap: 10px; min-height: 64px; border: 2px solid var(--border); border-radius: var(--radius); background: var(--bg); font-size: 1.25rem; font-weight: 700; cursor: pointer; margin: 0; }
.ballot-choice:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.ballot-choice:focus-within { outline: 3px solid var(--focus); outline-offset: 2px; }
.ballot-choice input { width: 22px; height: 22px; margin: 0; }
button[type="submit"].ballot-submit { width: 100%; min-height: 52px; font-size: 1.1rem; margin: 0 0 8px; }
.confirm-choice { font-size: 1.2rem; }
.assignment-list { list-style: none; padding: 0; margin: 0 0 12px; }
.assignment-list li { padding: 10px 0; border-bottom: 1px solid var(--border); display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: baseline; }

/* --- Public directories -------------------------------------------------- */
.filters { display: flex; flex-wrap: wrap; gap: 12px 14px; align-items: flex-end; margin: 0 0 14px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 14px 16px 16px; }
.filters .field { flex: 1 1 170px; margin: 0; }
.filters label { font-size: 0.85rem; margin-bottom: 4px; }
.filters button[type="submit"]:not(.link-button) { margin: 0; flex: none; }
.result-count { font-size: 0.95rem; margin-bottom: 14px; }
.page-head { margin: 8px 0 22px; }
.page-head h1 { margin-bottom: 0.25em; }
.page-head .lede { margin: 0; }
.pagination { display: flex; gap: 16px; align-items: center; justify-content: center; }
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin-bottom: 28px; }
.stat { display: block; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; text-decoration: none; color: var(--text); }
.stat:hover { border-color: var(--accent); }
.stat-number { display: block; font-family: var(--font-head); font-size: 2rem; font-weight: 700; color: var(--accent); }
.stat-label { color: var(--muted); }
.timeline { list-style: none; padding: 0; margin: 0 0 12px; }
.timeline-item { border-left: 4px solid var(--border); padding: 4px 0 12px 16px; margin-bottom: 8px; }
.timeline-item h3 { margin-bottom: 2px; }
.timeline-label { font-weight: 700; margin-bottom: 6px; }
.timeline-passed { border-color: var(--ok); }
.timeline-failed, .timeline-insufficient_participation, .timeline-insufficient_pool { border-color: var(--danger); }
.timeline-open { border-color: var(--accent); }
.result-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin: 0 0 8px; }
.result-grid div { background: var(--bg); border-radius: 8px; padding: 8px 10px; }
.result-grid dt { font-size: 0.8rem; color: var(--muted); }
.result-grid dd { margin: 0; font-size: 1.25rem; font-weight: 700; }

/* --- Archive --------------------------------------------------------------- */
.archive-filters .field-wide { flex: 1 1 calc(100% - 160px); order: 0; }
.archive-filters button[type="submit"]:not(.link-button) { order: 1; min-width: 120px; }
.archive-filters .field:not(.field-wide) { order: 2; flex-basis: 150px; }
.history { list-style: none; padding: 0; margin: 0; }
.history li { display: grid; grid-template-columns: 13.5rem 1fr; gap: 0 16px; padding: 7px 0; border-top: 1px solid var(--border); }
.history li:first-child { border-top: 0; }
.history time { color: var(--muted); font-size: 0.88rem; font-variant-numeric: tabular-nums; padding-top: 2px; }

/* --- Console: moderation, people, audit -------------------------------- */
.action-form { border-top: 1px solid var(--border); padding-top: 12px; margin-top: 12px; }
.action-form h3 { margin-bottom: 4px; }
.payload { font-size: 0.8rem; word-break: break-word; white-space: pre-wrap; }
.report-box summary { cursor: pointer; font-weight: 600; color: var(--accent); }
.report-box[open] summary { margin-bottom: 12px; }

/* --- Console: analytics ------------------------------------------------- */
/* Chart colors: categorical slots in fixed order, validated for color-vision
   deficiency against these surfaces in both modes (D-59). */
:root {
  --viz-s1: #2a78d6; --viz-s2: #eb6834; --viz-s3: #1baf7a; --viz-s4: #eda100; --viz-s5: #e87ba4;
  --viz-grid: #e1e0d9; --viz-axis: #c3c2b7; --viz-hover: rgba(42, 120, 214, 0.08);
}
@media (prefers-color-scheme: dark) {
  :root {
    --viz-s1: #3987e5; --viz-s2: #d95926; --viz-s3: #199e70; --viz-s4: #c98500; --viz-s5: #d55181;
    --viz-grid: #2c3240; --viz-axis: #3d4554; --viz-hover: rgba(57, 135, 229, 0.14);
  }
}
.viz-s1 { fill: var(--viz-s1); } .viz-s2 { fill: var(--viz-s2); } .viz-s3 { fill: var(--viz-s3); }
.viz-s4 { fill: var(--viz-s4); } .viz-s5 { fill: var(--viz-s5); }
.scope-line { font-size: 0.95rem; }
.preset-list { list-style: none; display: flex; flex-wrap: wrap; gap: 4px 16px; padding: 0; margin: 0 0 8px; font-size: 0.95rem; }
.preset-list a[aria-current] { font-weight: 700; text-decoration: none; color: var(--text); }
.kpi-row .stat-number { font-family: var(--font-body); font-size: 1.75rem; font-weight: 600; }
.section-nav { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 0.9rem; margin-bottom: 24px; }
.analytics-section { margin-bottom: 36px; }
.section-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; margin-bottom: 8px; }
.section-head h2 { margin: 0; scroll-margin-top: 16px; }
.badge-measure { background: var(--accent-soft); color: var(--accent); }
.badge-descriptive { background: var(--bg); color: var(--muted); border: 1px solid var(--border); }
.numeric-table td { font-variant-numeric: tabular-nums; }
.numeric-table tbody th { font-weight: 600; }
.table-foot { font-size: 0.9rem; margin-top: -12px; }
.table-toggle summary { cursor: pointer; color: var(--accent); font-weight: 600; margin-bottom: 8px; }
.viz-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); margin-bottom: 12px; }
.viz { margin: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px 10px; }
.viz-title { font-weight: 600; font-size: 0.95rem; margin-bottom: 8px; }
.viz-frame { display: grid; grid-template-columns: auto 1fr; gap: 8px; }
.viz-yaxis { display: flex; flex-direction: column; justify-content: space-between; align-items: flex-end; font-size: 0.75rem; color: var(--muted); font-variant-numeric: tabular-nums; line-height: 1; height: 140px; }
.viz-plot { display: grid; height: 140px; }
.viz-layer { grid-area: 1 / 1; width: 100%; height: 100%; overflow: visible; }
.viz-yaxis span:first-child { transform: translateY(-50%); }
.viz-yaxis span:last-child { transform: translateY(50%); }
.viz-xaxis { display: flex; justify-content: space-between; font-size: 0.75rem; color: var(--muted); margin: 8px 0 0 32px; }
.viz-grid line, line.viz-grid { stroke: var(--viz-grid); stroke-width: 1; }
.viz-baseline { stroke: var(--viz-axis); stroke-width: 1; }
.viz-line { fill: none; stroke: var(--viz-s1); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.viz-area { fill: var(--viz-s1); opacity: 0.1; }
.viz-dot { fill: var(--viz-s1); stroke: var(--surface); stroke-width: 2; }
.viz-hit { fill: transparent; cursor: default; }
.viz-hit:hover, .viz-hit:focus { fill: var(--viz-hover); outline: none; }
.viz-rows { list-style: none; padding: 0; margin: 0 0 12px; display: grid; gap: 6px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; }
.viz-row { display: grid; grid-template-columns: 7.5rem 1fr 3.5rem; align-items: center; gap: 10px; border-radius: 6px; }
.viz-row:hover, .viz-row:focus { background: var(--viz-hover); outline: none; }
.viz-row:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.viz-row-label { font-size: 0.9rem; }
.viz-row-value { font-size: 0.9rem; text-align: right; font-variant-numeric: tabular-nums; }
.viz-track { width: 100%; height: 24px; overflow: visible; }
.viz-seg { stroke: var(--surface); stroke-width: 2; }
.viz-seg:hover { opacity: 0.85; }
.viz-legend { list-style: none; display: flex; flex-wrap: wrap; gap: 4px 16px; padding: 0; margin: 0 0 8px; font-size: 0.9rem; color: var(--muted); }
.viz-legend li { display: inline-flex; align-items: center; gap: 6px; }
.viz-swatch { width: 12px; height: 12px; }
.viz-tooltip { position: absolute; z-index: 20; pointer-events: none; background: var(--text); color: var(--surface); font-size: 0.85rem; font-weight: 600; padding: 4px 8px; border-radius: 6px; max-width: 280px; }
@media (max-width: 480px) {
  .kpi-row { grid-template-columns: 1fr 1fr; gap: 8px; }
  .kpi-row .stat { padding: 12px; }
  .kpi-row .stat-number { font-size: 1.4rem; }
  .kpi-row .stat-label { font-size: 0.85rem; line-height: 1.35; display: block; }
  .viz-row { grid-template-columns: 5.5rem 1fr 2.75rem; gap: 6px; }
}
@media (forced-colors: active) {
  .viz-line { stroke: CanvasText; } .viz-dot, .viz-bar, .viz-seg { fill: CanvasText; }
}
.questions { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 16px; margin-bottom: 20px; }
.questions summary { cursor: pointer; font-weight: 600; color: var(--accent); }
.questions ol { margin: 12px 0 8px; padding-left: 1.4em; }
.questions li { margin-bottom: 6px; }
.section-q { font-size: 0.85rem; }

/* --- Legal pages ------------------------------------------------------------ */
.definition-list dt { font-weight: 700; margin-top: 12px; }
.definition-list dd { margin: 2px 0 0; }
.footer-links { margin: 0; }
.rule-notes { margin: 12px 0 0; padding-left: 1.2em; font-size: 0.95rem; }
.rule-notes li { margin-bottom: 6px; }

/* --- Near-duplicate notices (D-70) ------------------------------------------ */
.similar-box { border: 1px solid var(--warn); background: var(--warn-soft); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 16px; }
.similar-box h2 { font-size: 1.1rem; margin-bottom: 6px; }
.similar-list { list-style: none; padding: 0; margin: 8px 0; display: grid; gap: 10px; }
.similar-list .frame-text { margin: 6px 0 0; }
.checkbox-field label { display: flex; gap: 8px; align-items: flex-start; font-weight: 600; }
.checkbox-field input { margin-top: 0.3em; width: auto; }
.similar-compare { border-top: 1px solid var(--border); margin-top: 8px; padding-top: 8px; }
.brand-seal { fill: var(--seal); }

/* =============================================================================
   Public pages (D-71)
   ========================================================================== */

/* --- Home: hero and ledger --------------------------------------------------- */
.hero { padding: 28px 0 36px; }
.hero-split { display: grid; gap: 28px 48px; grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr); align-items: center; }
.hero h1 { font-size: clamp(2.1rem, 5vw, 3.2rem); margin-bottom: 0.4em; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 22px 0 0; }
.hero-actions .button { margin: 0; }
.ledger { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow); padding: 18px 22px 8px; position: relative; }
.ledger::before { content: ""; position: absolute; inset: 5px; border: 1px solid var(--border); border-radius: 6px; pointer-events: none; }
.ledger-title { font-size: 0.76rem; text-transform: uppercase; letter-spacing: 0.14em; font-weight: 700; color: var(--gold); margin: 0 0 4px; text-align: center; }
.ledger-row { display: flex; align-items: baseline; gap: 14px; padding: 12px 2px; border-top: 1px solid var(--border); color: var(--text); text-decoration: none; position: relative; }
.ledger-row:first-of-type { border-top: 0; }
.ledger-row:hover .ledger-label { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.ledger-number { font-family: var(--font-head); font-weight: 700; font-size: 2.1rem; line-height: 1; color: var(--accent); min-width: 2.2ch; text-align: right; font-variant-numeric: lining-nums tabular-nums; }
.ledger-label { color: var(--muted); line-height: 1.3; }

/* --- Sections ---------------------------------------------------------------- */
.section { margin: 0 0 44px; }
.section-title-row { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 16px; margin-bottom: 14px; }
.section-title-row h2 { margin: 0; }
.measure-card p:last-child { margin-bottom: 0; }
.measure-card p { max-width: var(--measure); }
.steps { list-style: none; counter-reset: step; padding: 0; margin: 24px 0 0; display: grid; gap: 14px 24px; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.steps li { counter-increment: step; position: relative; padding-top: 44px; }
.steps li::before { content: counter(step); position: absolute; top: 0; left: 0; width: 32px; height: 32px; border-radius: 50%; border: 1.5px solid var(--accent); color: var(--accent); font-family: var(--font-head); font-weight: 700; display: grid; place-items: center; line-height: 1; }
.steps li::after { content: ""; position: absolute; top: 16px; left: 42px; right: -14px; border-top: 1px dashed var(--border); }
.steps li:last-child::after { display: none; }
.steps h3 { font-size: 1.05rem; margin-bottom: 0.3em; }
.steps p { color: var(--muted); font-size: 0.95rem; margin: 0; }

/* --- Process diagram ----------------------------------------------------------- */
.process-figure { margin: 8px 0 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 22px 20px 16px; box-shadow: var(--shadow); }
.process-figure figcaption { color: var(--muted); font-size: 0.92rem; margin-top: 10px; max-width: var(--measure); }
.dg { display: block; width: 100%; height: auto; overflow: visible; font-family: var(--font-body); }
.dg-tall { display: none; max-width: 380px; margin: 0 auto; }
@media (max-width: 760px) {
  .dg-wide { display: none; }
  .dg-tall { display: block; }
}
.dg-edge { stroke: var(--text); stroke-width: 1.6; }
.dg-head { fill: var(--text); }
.dg-exit, .dg-rail { stroke: var(--muted); stroke-width: 1.3; stroke-dasharray: 4 4; fill: none; }
.dg-head-exit { fill: var(--muted); }
.dg-label { fill: var(--muted); font-size: 13px; font-weight: 500; }
.dg-exit-label { font-style: italic; }
.dg-title { fill: var(--text); font-family: var(--font-head); font-weight: 700; font-size: 17px; }
.dg-muted { fill: var(--muted); }
.dg-count { fill: var(--text); font-weight: 600; }
.dg-paper { fill: var(--bg); stroke: var(--text); stroke-width: 1.5; stroke-linejoin: round; }
.dg-fold { fill: none; stroke: var(--text); stroke-width: 1.5; stroke-linejoin: round; }
.dg-lines { stroke: var(--muted); stroke-width: 2; stroke-linecap: round; }
.dg-stage { fill: var(--bg); stroke: var(--border); stroke-width: 1.5; }
.dg-dot { fill: var(--accent); }
.dg-dot.dg-even { fill: var(--gold); }
.dg-seal { fill: var(--seal); }
.dg-seal-ring { fill: none; stroke: var(--surface); stroke-width: 1.5; stroke-dasharray: 2 3; }
.dg-seal-text { fill: var(--surface); font-family: var(--font-head); font-weight: 700; font-size: 15px; letter-spacing: 0.04em; }
@media (prefers-color-scheme: dark) {
  .dg-seal-text { fill: #1c1f26; }
  .dg-seal-ring { stroke: #1c1f26; }
}

/* --- Frame cards --------------------------------------------------------------- */
.frame-cards { list-style: none; padding: 0; margin: 0 0 24px; display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.frame-card { position: relative; display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 16px 18px 14px; box-shadow: var(--shadow); transition: border-color 0.15s, transform 0.15s; }
.frame-card:hover { border-color: var(--accent); }
.frame-card:focus-within { border-color: var(--accent); }
@media (prefers-reduced-motion: no-preference) { .frame-card:hover { transform: translateY(-2px); } }
.frame-card-top { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin-bottom: 10px; }
.frame-ref { font-family: var(--font-head); font-weight: 700; font-size: 1.05rem; color: var(--text); text-decoration: none; letter-spacing: 0.02em; }
.frame-ref:hover { color: var(--accent); }
.stretched::after { content: ""; position: absolute; inset: 0; border-radius: inherit; }
.stretched:focus-visible { outline: 0; }
.stretched:focus-visible::after { outline: 3px solid var(--focus); outline-offset: 2px; }
.frame-cat { order: -1; flex-basis: 100%; margin-bottom: -4px; font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--gold); font-weight: 700; }
.frame-quote { font-family: var(--font-head); font-size: 1.05rem; line-height: 1.55; overflow-wrap: anywhere; flex: 1; margin: 0 0 14px; }
.frame-quote .muted { font-family: var(--font-body); font-size: 0.95rem; font-style: italic; }
.frame-card-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; border-top: 1px solid var(--border); padding-top: 10px; }
.frame-meta { font-size: 0.86rem; color: var(--muted); margin: 0; line-height: 1.4; }
.steps-mini { display: inline-flex; gap: 3px; flex: none; }
.step-pip { width: 18px; height: 6px; border-radius: 3px; background: var(--sunk); box-shadow: inset 0 0 0 1px var(--border); }
.step-passed { background: var(--ok); box-shadow: none; }
.step-failed { background: var(--danger); box-shadow: none; }
.step-current { background: var(--accent); box-shadow: none; }

/* Status badges: a dot plus text, so state is never color alone. */
.badge { display: inline-flex; align-items: center; gap: 6px; font-size: 0.78rem; font-weight: 650; letter-spacing: 0.01em; padding: 2px 10px 2px 8px; line-height: 1.5; }
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: none; }
.badge-measure::before, .badge-descriptive::before { display: none; }
.badge-in_circulation::before { box-shadow: 0 0 0 3px color-mix(in srgb, currentColor 25%, transparent); }

/* --- Frame page ------------------------------------------------------------------ */
.breadcrumb { font-size: 0.92rem; margin: 4px 0 14px; }
.breadcrumb a { text-decoration: none; }
.breadcrumb a:hover { text-decoration: underline; }
.frame-doc { padding: 28px 32px; }
.frame-doc-head .eyebrow { margin-bottom: 0.2em; }
.frame-title-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; margin-bottom: 18px; }
.frame-number { margin: 0; letter-spacing: 0.02em; }
.frame-text-lg { font-family: var(--font-head); font-size: clamp(1.15rem, 2.4vw, 1.4rem); line-height: 1.6; padding: 4px 0 4px 22px; border-left: 3px solid var(--gold); background: none; border-radius: 0; margin: 0 0 30px; max-width: 46rem; }

.stage-track { list-style: none; display: flex; padding: 0; margin: 0 0 24px; }
.track-step { flex: 1 1 0; min-width: 0; position: relative; display: flex; flex-direction: column; align-items: center; text-align: center; padding: 0 4px; }
.track-step::before { content: ""; position: absolute; top: 17px; right: 50%; width: 100%; border-top: 2px solid var(--border); z-index: 0; }
.track-step:first-child::before { display: none; }
.track-passed::before, .track-failed::before, .track-current::before { border-top-color: var(--ok); }
.track-node { position: relative; z-index: 1; width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 0.95rem; background: var(--surface); border: 2px solid var(--border); color: var(--muted); }
.track-node svg { width: 18px; height: 18px; }
.track-passed .track-node { background: var(--ok); border-color: var(--ok); color: var(--surface); }
.track-failed .track-node { background: var(--danger); border-color: var(--danger); color: var(--surface); }
.track-current .track-node { border-color: var(--accent); color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.track-not_reached .track-node { border-style: dashed; }
.track-name { font-weight: 650; font-size: 0.9rem; margin-top: 8px; }
.track-state { font-size: 0.8rem; color: var(--muted); line-height: 1.3; }
.track-final .track-node { color: var(--muted); }
.track-final.track-passed .track-node { background: var(--seal); border-color: var(--seal); color: var(--surface); }
.track-final.track-passed::before { border-top-color: var(--ok); }
.track-seal svg { width: 22px; height: 22px; }

.facts-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px 24px; border-top: 1px solid var(--border); padding-top: 16px; margin: 0; }
.facts-row div { min-width: 0; }
.facts-row dd { margin: 2px 0 0; }
.frame-doc .status { margin: 18px 0 0; }

.timeline-item { border-left-width: 3px; padding: 2px 0 16px 20px; margin-bottom: 14px; }
.timeline-item:last-child { margin-bottom: 4px; }
.timeline-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 2px 12px; margin-bottom: 10px; }
.timeline-head h3 { margin: 0; }
.timeline-label { margin: 0; font-size: 0.9rem; }
.timeline-passed .timeline-label { color: var(--ok); }
.timeline-failed .timeline-label, .timeline-insufficient_participation .timeline-label, .timeline-insufficient_pool .timeline-label { color: var(--danger); }
.timeline-open .timeline-label { color: var(--accent); }

.vote-progress { display: grid; gap: 8px; margin-bottom: 6px; font-size: 0.95rem; }
.vote-progress-bar svg { display: block; width: 100%; height: 10px; }
.vp-track { fill: var(--sunk); }
.vp-fill { fill: var(--accent); }

.yes-bar { margin: 0 0 12px; }
.yes-bar-svg { display: block; width: 100%; height: 26px; overflow: visible; }
.yb-track { fill: var(--sunk); }
.yb-fill { fill: var(--muted); }
.yes-bar-pass .yb-fill { fill: var(--ok); }
.yes-bar-fail .yb-fill { fill: var(--danger); }
.yb-threshold { stroke: var(--text); stroke-width: 2; stroke-dasharray: 3 2; }
.yes-bar-legend { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 2px 12px; font-size: 0.9rem; margin: 4px 0 0; }

@media (max-width: 860px) {
  .hero-split { grid-template-columns: 1fr; }
  .steps { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .steps li:nth-child(2)::after { display: none; }
}
@media (max-width: 560px) {
  .hero { padding: 12px 0 24px; }
  .steps { grid-template-columns: 1fr; }
  .steps li { padding: 0 0 0 46px; min-height: 32px; }
  .steps li::after { display: none; }
  .frame-cards { grid-template-columns: 1fr; }
  .filters .field, .archive-filters .field:not(.field-wide) { flex: 1 1 40%; }
  .filters button[type="submit"]:not(.link-button) { flex: 1 1 100%; }
  .archive-filters .field-wide { flex-basis: 100%; }
  .frame-doc { padding: 20px 18px; }
  .card { padding: 18px; }
  .process-figure { padding: 16px 10px 12px; }
  .track-name { font-size: 0.78rem; }
  .history li { grid-template-columns: 1fr; }
  .result-grid { gap: 6px; }
  .result-grid div { padding: 6px 8px; }
  .result-grid dd { font-size: 1.1rem; }
  .track-state { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
}

/* --- About ------------------------------------------------------------------- */
.about-layout { display: grid; grid-template-columns: 13rem minmax(0, 1fr); gap: 40px; align-items: start; }
.toc { position: sticky; top: 20px; font-size: 0.92rem; border-left: 1px solid var(--border); padding-left: 16px; }
.toc-title { font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.14em; font-weight: 700; color: var(--gold); margin-bottom: 8px; }
.toc ol { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.toc a { color: var(--muted); text-decoration: none; }
.toc a:hover { color: var(--accent); text-decoration: underline; }
.about-section { margin-bottom: 44px; scroll-margin-top: 20px; }
.about-section > p { max-width: var(--measure); }

.question-list { list-style: none; counter-reset: q; padding: 0; display: grid; gap: 0; border-top: 1px solid var(--border); }
.question-list li { counter-increment: q; display: grid; grid-template-columns: 2.4rem 1fr; padding: 12px 0; border-bottom: 1px solid var(--border); font-family: var(--font-head); font-size: 1.1rem; line-height: 1.45; }
.question-list li::before { content: counter(q, upper-roman) "."; color: var(--gold); font-weight: 700; font-size: 0.95rem; padding-top: 2px; }

.glossary { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.glossary div { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; }
.glossary dt { font-family: var(--font-head); font-weight: 700; font-size: 1.05rem; }
.glossary dd { margin: 2px 0 0; color: var(--muted); font-size: 0.95rem; line-height: 1.5; }

.check-list { list-style: none; padding: 0; display: grid; gap: 10px; max-width: var(--measure); }
.check-list li { position: relative; padding-left: 32px; }
.check-list li::before { content: ""; position: absolute; left: 2px; top: 5px; width: 18px; height: 18px; border-radius: 50%; background: var(--ok-soft); box-shadow: inset 0 0 0 1.5px var(--ok); }
.check-list li::after { content: ""; position: absolute; left: 8px; top: 9px; width: 5px; height: 9px; border: solid var(--ok); border-width: 0 2px 2px 0; transform: rotate(45deg); }

.criteria { list-style: none; counter-reset: c; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; }
.criteria li { counter-increment: c; background: var(--surface); border: 1px solid var(--border); border-top: 3px solid var(--accent); border-radius: var(--radius); padding: 12px 14px; }
.criteria li::before { content: counter(c); font-family: var(--font-head); font-weight: 700; color: var(--gold); font-size: 1.4rem; line-height: 1; display: block; margin-bottom: 6px; }
.criteria h3 { font-size: 1rem; margin-bottom: 0.3em; }
.criteria p { margin: 0; color: var(--muted); font-size: 0.93rem; line-height: 1.5; }

.retention-list { display: grid; gap: 0; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); max-width: var(--measure); }
.retention-list div { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 16px; align-items: baseline; padding: 10px 14px; border-top: 1px solid var(--border); }
.retention-list div:first-child { border-top: 0; }
.retention-list dd { margin: 0; font-weight: 650; text-align: right; }

.eligibility { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 10px 22px; }
.eligibility li { display: flex; align-items: center; gap: 10px; font-weight: 600; }
.eligibility-mark { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; border: 1.5px solid var(--accent); color: var(--accent); font-family: var(--font-head); font-weight: 700; font-size: 0.95rem; }

@media (max-width: 860px) {
  .about-layout { grid-template-columns: 1fr; gap: 8px; }
  .toc { position: static; border-left: 0; padding: 12px 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 24px; }
  .toc ol { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
}
@media (max-width: 560px) {
  .retention-list div { grid-template-columns: 1fr; }
  .retention-list dd { text-align: left; }
}

/* --- Public rules ------------------------------------------------------------ */
.measure { max-width: var(--measure); }
.rules-facts { border-top: 0; padding-top: 0; margin-bottom: 14px; }
.rules-hash { grid-column: span 2; }
.stage-rules { list-style: none; padding: 0; margin: 4px 0 18px; display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); }
.stage-rule { border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg); padding: 14px 16px; }
.stage-rule-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.stage-rule-head h3 { margin: 0; font-size: 1.1rem; }
.stage-rule-number { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--accent); color: var(--accent-contrast); font-family: var(--font-head); font-weight: 700; font-size: 0.95rem; flex: none; }
.stage-rule-size { margin-left: auto; font-size: 0.85rem; font-weight: 650; color: var(--gold); }
.stage-rule-facts { margin: 0; display: grid; gap: 0; }
.stage-rule-facts div { display: grid; grid-template-columns: 8.5rem 1fr; gap: 10px; padding: 6px 0; border-top: 1px solid var(--border); font-size: 0.92rem; }
.stage-rule-facts dt { color: var(--muted); }
.stage-rule-facts dd { margin: 0; font-weight: 550; }
@media (max-width: 560px) { .rules-hash { grid-column: auto; } }

/* --- Account menu (header) ---------------------------------------------------- */
.account-menu { position: relative; }
.account-menu > summary { list-style: none; display: inline-flex; align-items: center; gap: 6px; padding: 8px 10px; border-radius: var(--radius); font-weight: 500; font-size: 0.97rem; cursor: pointer; color: var(--text); }
.account-menu > summary::-webkit-details-marker { display: none; }
.account-menu > summary:hover { background: var(--sunk); color: var(--accent); }
.account-menu > summary.is-current { color: var(--accent); }
.account-menu > summary svg { width: 12px; height: 12px; transition: transform 0.15s; }
.account-menu[open] > summary svg { transform: rotate(180deg); }
.account-menu-list { list-style: none; margin: 0; padding: 6px; position: absolute; right: 0; top: calc(100% + 6px); min-width: 220px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow), 0 12px 30px -12px rgba(0, 0, 0, 0.25); z-index: 20; }
.account-menu-list a, .account-menu-list .link-button { display: block; width: 100%; text-align: left; padding: 9px 12px; }
.account-menu-list .inline-form { display: block; }
.account-menu-who { font-size: 0.82rem; color: var(--muted); padding: 6px 12px 8px; border-bottom: 1px solid var(--border); margin-bottom: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 280px; }
@media (max-width: 860px) {
  .account-menu > summary { display: flex; width: 100%; padding: 12px 10px; font-size: 1.02rem; }
  .account-menu-list { position: static; box-shadow: none; border: 0; border-left: 2px solid var(--border); border-radius: 0; margin: 0 0 4px 10px; padding: 0 0 0 6px; min-width: 0; }
}

/* =============================================================================
   Participant pages (D-71)
   ========================================================================== */

/* --- Dashboard --------------------------------------------------------------- */
.page-head .eyebrow { overflow-wrap: anywhere; }
.assignment-callouts { background: var(--accent); color: var(--accent-contrast); border-radius: var(--radius-lg); padding: 20px 22px; margin-bottom: 24px; box-shadow: var(--shadow); }
.callout-title { display: flex; align-items: center; gap: 10px; font-size: 1.3rem; margin-bottom: 12px; color: inherit; }
.pulse { width: 10px; height: 10px; border-radius: 50%; background: var(--gold-soft); flex: none; box-shadow: 0 0 0 4px color-mix(in srgb, var(--gold-soft) 35%, transparent); }
@media (prefers-reduced-motion: no-preference) { .pulse { animation: pulse 2s ease-in-out infinite; } }
@keyframes pulse { 50% { box-shadow: 0 0 0 8px color-mix(in srgb, var(--gold-soft) 0%, transparent); } }
.callout-list { list-style: none; padding: 0; margin: 0 0 12px; display: grid; gap: 10px; }
.callout { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; background: var(--surface); color: var(--text); border-radius: var(--radius); padding: 14px 16px; }
.callout-body { flex: 1 1 320px; min-width: 0; }
.callout-meta { margin: 0 0 4px; font-size: 0.92rem; color: var(--muted); }
.callout-meta strong { color: var(--text); font-family: var(--font-head); font-size: 1.05rem; }
.callout-quote { font-family: var(--font-head); margin: 0; overflow-wrap: anywhere; }
.callout .button { margin: 0; }
.callout-note { margin: 0; font-size: 0.9rem; opacity: 0.92; }
.dash-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 20px; align-items: start; }
.dash-side { position: sticky; top: 20px; }
.dash-side .status { margin-bottom: 4px; font-size: 0.95rem; }
.my-frames { list-style: none; padding: 0; margin: 0; }
.my-frame { padding: 12px 0; border-top: 1px solid var(--border); }
.my-frame:first-child { border-top: 0; padding-top: 0; }
.my-frame-top { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; margin-bottom: 4px; }
.my-frame-top .frame-ref { color: var(--accent); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.my-frame-date { margin-left: auto; }
.my-frame-text { margin: 0; font-family: var(--font-head); overflow-wrap: anywhere; }
.empty-state { text-align: center; padding: 18px 12px; border: 1px dashed var(--border); border-radius: var(--radius); background: var(--bg); }
.empty-state p { color: var(--muted); max-width: 32rem; margin: 0 auto 12px; }
.empty-state .button { margin: 0; }
li.card.empty-state { grid-column: 1 / -1; }
.past-list { list-style: none; padding: 0; margin: 0; font-size: 0.95rem; }
.past-list li { display: grid; grid-template-columns: 6.5rem 5rem 1fr; gap: 8px; padding: 7px 0; border-top: 1px solid var(--border); }
.past-list li:first-child { border-top: 0; }
.pool-state { font-weight: 650; }
.pool-in { color: var(--ok); }

/* --- Submit ------------------------------------------------------------------- */
.submit-card textarea { font-family: var(--font-head); font-size: 1.15rem; line-height: 1.6; min-height: 11rem; padding: 14px 16px; background: var(--bg); }
.guide-list { list-style: none; counter-reset: g; padding: 0; margin: 0 0 16px; display: grid; gap: 10px; }
.guide-list li { counter-increment: g; position: relative; padding-left: 36px; font-size: 0.95rem; line-height: 1.5; }
.guide-list li::before { content: counter(g); position: absolute; left: 0; top: 0; width: 24px; height: 24px; border-radius: 50%; border: 1.5px solid var(--accent); color: var(--accent); display: grid; place-items: center; font-weight: 700; font-size: 0.8rem; }
.guide-list strong { display: block; }
.private-note { display: flex; gap: 10px; align-items: flex-start; font-size: 0.9rem; color: var(--muted); background: var(--bg); border-radius: var(--radius); padding: 10px 12px; margin: 12px 0 0; }
.private-note svg { width: 18px; height: 18px; flex: none; color: var(--accent); margin-top: 2px; }

/* --- Voting room ---------------------------------------------------------------- */
.deadline { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 0.95rem; color: var(--muted); border-top: 1px solid var(--border); padding-top: 14px; }
.deadline svg { width: 18px; height: 18px; flex: none; color: var(--accent); }
.deadline strong { color: var(--text); }
.ballot-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px 16px; flex-wrap: wrap; }
.ballot-step { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.12em; font-weight: 700; color: var(--gold); }
.ballot-choice { display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 12px; align-items: center; justify-content: start; text-align: left; padding: 14px 18px; min-height: 76px; background: var(--surface); transition: border-color 0.15s, background-color 0.15s; }
.ballot-choice input { grid-row: 1 / 3; grid-column: 1; }
.ballot-choice span, .ballot-choice small { grid-column: 2; }
.ballot-choice span { font-family: var(--font-head); font-size: 1.45rem; line-height: 1.1; }
.ballot-choice small { font-size: 0.85rem; font-weight: 500; color: var(--muted); }
.ballot-choice:hover { border-color: var(--accent); }
.confirm-card { max-width: 40rem; border-top: 4px solid var(--accent); }
.confirm-mark { font-family: var(--font-head); font-size: 1.6rem; color: var(--accent); padding: 0 4px; }
.confirm-back { margin: 8px 0 0; text-align: center; }

@media (max-width: 860px) {
  .dash-layout { grid-template-columns: 1fr; }
  .dash-side { position: static; order: -1; }
}
@media (max-width: 560px) {
  .assignment-callouts { padding: 16px; margin-left: -4px; margin-right: -4px; }
  .callout .button { width: 100%; }
  .past-list li { grid-template-columns: 6rem 4.5rem 1fr; }
  .ballot-choice { padding: 12px 14px; }
}
.guidance .guide-list { padding-left: 0; }

/* --- Settings and sign-in pages ---------------------------------------------- */
.settings-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 20px; align-items: start; }
.settings-grid .card { height: calc(100% - 20px); }
.settings-grid h2 { font-size: 1.3rem; }
.row-links { list-style: none; padding: 0; margin: 0; }
.row-links li { border-top: 1px solid var(--border); }
.row-links li:first-child { border-top: 0; }
.row-links a { display: grid; grid-template-columns: 1fr auto; grid-template-rows: auto auto; column-gap: 12px; padding: 10px 4px; text-decoration: none; color: var(--text); font-weight: 600; }
.row-links a::after { content: "→"; grid-row: 1 / 3; grid-column: 2; align-self: center; color: var(--accent); }
.row-links a:hover span:first-child { color: var(--accent); text-decoration: underline; }
.row-links .muted { font-weight: 400; }
.danger-zone { border-color: var(--danger); border-left-width: 4px; }

.auth-layout { display: grid; grid-template-columns: minmax(0, 520px) minmax(0, 360px); gap: 48px; justify-content: center; align-items: center; padding: 12px 0; }
.auth-layout .auth-card { margin: 0; width: 100%; padding: 28px 30px; }
.auth-card h1 { font-size: 2rem; }
.auth-aside { color: var(--text); }
.auth-aside .motto { font-size: 1.35rem; line-height: 1.4; margin: 14px 0 18px; }
.auth-aside .check-list { font-size: 0.95rem; color: var(--muted); }
.auth-seal { width: 92px; height: 92px; }
.auth-seal-outer { fill: var(--accent); }
.auth-seal-ring { fill: none; stroke: var(--accent-contrast); stroke-width: 1.2; stroke-dasharray: 2 3; opacity: 0.7; }
.auth-seal-corners, .auth-seal-lines { fill: none; stroke: var(--accent-contrast); stroke-width: 3; stroke-linecap: round; }
.auth-seal-dot { fill: var(--seal); stroke: var(--accent-contrast); stroke-width: 2; }
.auth-card form button[type="submit"]:not(.link-button) { width: 100%; margin: 6px 0 0; }
.auth-card ul:not(.errorlist) { padding-left: 1.2em; font-size: 0.92rem; color: var(--muted); }

@media (max-width: 860px) {
  .settings-grid { grid-template-columns: 1fr; }
  .settings-grid .card { height: auto; }
  .auth-layout { grid-template-columns: minmax(0, 520px); }
  .auth-aside { display: none; }
}
.settings-grid .danger-zone { grid-column: 1 / -1; height: auto; }
.table-wrap:focus-visible { outline-offset: 2px; }

/* --- Error pages -------------------------------------------------------------- */
.error-page { max-width: 36rem; margin: 24px auto 0; text-align: center; }
.error-code { font-family: var(--font-head); font-weight: 700; font-size: clamp(4rem, 14vw, 7rem); line-height: 1; color: var(--gold); margin: 0 0 8px; letter-spacing: 0.04em; }
.error-page .hero-actions { justify-content: center; }

/* --- Legal documents ---------------------------------------------------------- */
.legal-doc { max-width: 48rem; margin: 0 auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow); padding: 36px 44px; }
.legal-doc h1 { margin-bottom: 0.2em; }
.legal-doc h2 { font-size: 1.3rem; padding-top: 1.1em; border-top: 1px solid var(--border); }
.legal-doc dt { font-weight: 650; margin-top: 10px; }
.legal-doc dd { margin: 2px 0 8px; }
@media (max-width: 560px) { .legal-doc { padding: 22px 18px; margin: 0 -4px; } }

/* =============================================================================
   Constitution questions (D-72)
   ========================================================================== */
.quiz-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 20px; align-items: start; }
.quiz-card { padding: 26px 28px; }
.quiz-form { margin: 0; }
.quiz-tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 12px; }
.quiz-tags span { font-size: 0.74rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--gold); background: var(--gold-soft); border-radius: 999px; padding: 2px 10px; }
.quiz-text { font-family: var(--font-head); font-size: clamp(1.2rem, 2.6vw, 1.5rem); line-height: 1.45; font-weight: 700; margin: 0 0 18px; padding: 0; }
.quiz-options { border: 0; padding: 0; margin: 0 0 16px; display: grid; gap: 10px; min-width: 0; }
.quiz-option { display: flex; align-items: center; gap: 14px; margin: 0; padding: 12px 14px; min-height: 56px; border: 2px solid var(--border); border-radius: var(--radius); background: var(--surface); font-weight: 500; cursor: pointer; transition: border-color 0.15s, background-color 0.15s; }
.quiz-option:hover { border-color: var(--accent); }
.quiz-option:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.quiz-option:focus-within { outline: 3px solid var(--focus); outline-offset: 2px; }
.quiz-option input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.quiz-letter { flex: none; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; border: 1.5px solid var(--accent); color: var(--accent); font-family: var(--font-head); font-weight: 700; }
.quiz-option:has(input:checked) .quiz-letter { background: var(--accent); color: var(--accent-contrast); }
.quiz-option-text { line-height: 1.45; }
button[type="submit"].quiz-submit { width: 100%; min-height: 50px; margin: 0; font-size: 1.05rem; }

.quiz-verdict { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; font-size: 1.05rem; padding: 6px 14px 6px 10px; border-radius: 999px; margin: 0 0 14px; }
.quiz-verdict svg { width: 20px; height: 20px; }
.quiz-right .quiz-verdict { background: var(--ok-soft); color: var(--ok); }
.quiz-wrong .quiz-verdict { background: var(--danger-soft); color: var(--danger); }
.quiz-review { list-style: none; padding: 0; margin: 0 0 16px; display: grid; gap: 8px; }
.quiz-review li { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius); color: var(--muted); }
.quiz-review li.is-answer { border: 2px solid var(--ok); color: var(--text); background: var(--ok-soft); }
.quiz-review li.is-answer .quiz-letter { background: var(--ok); border-color: var(--ok); color: var(--surface); }
.quiz-review li.is-choice { border: 2px solid var(--danger); color: var(--text); }
.quiz-review li.is-choice .quiz-letter { border-color: var(--danger); color: var(--danger); }
.quiz-flag { font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--ok); margin-left: 6px; white-space: nowrap; }
.quiz-flag-choice { color: var(--muted); }
.quiz-explain { border-left: 3px solid var(--gold); padding: 2px 0 2px 16px; }
.quiz-explain p { margin-bottom: 0.6em; }
.quiz-ref { font-size: 0.92rem; color: var(--muted); }
.quiz-note { font-size: 0.9rem; color: var(--muted); font-style: italic; }
.quiz-next { display: flex; flex-wrap: wrap; gap: 10px; margin: 18px 0 6px; }
.quiz-next .button { margin: 0; }
.quiz-disclaimer { font-size: 0.86rem; color: var(--muted); margin: 0 4px 24px; }
.quiz-progress h2, .quiz-layout aside h2 { font-size: 1.2rem; }
.quiz-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 0 0 8px; text-align: center; }
.quiz-stats div { background: var(--bg); border-radius: var(--radius); padding: 8px 4px; }
.quiz-stats dt { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); font-weight: 650; }
.quiz-stats dd { margin: 2px 0 0; font-family: var(--font-head); font-size: 1.5rem; font-weight: 700; color: var(--accent); }
.quiz-stats dd .muted { font-family: var(--font-body); font-size: 0.85rem; font-weight: 500; }
.quiz-filter { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 16px; }
.quiz-filter a { font-size: 0.9rem; padding: 6px 12px; border: 1px solid var(--border); border-radius: 999px; text-decoration: none; color: var(--text); background: var(--surface); }
.quiz-filter a:hover { border-color: var(--accent); color: var(--accent); }
.quiz-filter a[aria-current] { background: var(--accent); border-color: var(--accent); color: var(--accent-contrast); }

/* Home teaser and pre-submission question */
.qotd-teaser { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 16px 22px; align-items: center; }
.qotd-mark { width: 54px; height: 54px; border-radius: 50%; background: var(--gold-soft); color: var(--gold); display: grid; place-items: center; font-family: var(--font-head); font-weight: 700; font-size: 1.5rem; }
.qotd-teaser p { margin: 0; }
.qotd-teaser .qotd-q { font-family: var(--font-head); font-size: 1.15rem; line-height: 1.45; color: var(--text); }
.qotd-teaser .button { margin: 0; }
.gate-box { border: 1px solid var(--border); border-left: 4px solid var(--gold); border-radius: var(--radius); background: var(--bg); padding: 16px 18px; margin: 0 0 18px; }
.gate-box h2 { font-size: 1.15rem; margin-bottom: 0.3em; }
.gate-box .quiz-text { font-size: 1.1rem; }
.gate-box .quiz-option { min-height: 48px; padding: 8px 12px; }
.gate-passed { display: flex; align-items: center; gap: 8px; color: var(--ok); font-weight: 650; background: var(--ok-soft); border-radius: var(--radius); padding: 10px 14px; margin: 0 0 16px; }
.gate-passed svg { width: 18px; height: 18px; flex: none; }

@media (max-width: 860px) {
  .quiz-layout { grid-template-columns: 1fr; }
  .qotd-teaser { grid-template-columns: auto minmax(0, 1fr); }
  .qotd-teaser .button { grid-column: 1 / -1; justify-self: start; }
}
@media (max-width: 560px) {
  .quiz-card { padding: 18px 16px; }
  .qotd-mark { width: 44px; height: 44px; font-size: 1.2rem; }
}
.gate-missed { background: var(--danger-soft); border-radius: var(--radius); padding: 10px 14px; margin: 0 0 14px; }
.gate-missed p { margin: 0 0 6px; }
.gate-missed p:last-child { margin: 0; }

/* --- Deployment checks -------------------------------------------------------- */
.check-rows { list-style: none; padding: 0; margin: 0 0 12px; }
.check-row { display: flex; gap: 12px; align-items: flex-start; padding: 10px 0; border-top: 1px solid var(--border); }
.check-row:first-child { border-top: 0; }
.check-icon { flex: none; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; margin-top: 1px; }
.check-icon svg { width: 16px; height: 16px; }
.check-pass .check-icon { background: var(--ok-soft); color: var(--ok); }
.check-fail .check-icon { background: var(--danger-soft); color: var(--danger); }
.check-info .check-icon { background: var(--accent-soft); color: var(--accent); }
.check-label { font-weight: 650; margin: 0; }
.check-detail { margin: 2px 0 0; color: var(--muted); font-size: 0.93rem; }
.ip-facts { margin-bottom: 12px; }
.ip-facts code, .xff-list code { overflow-wrap: anywhere; }
.xff-list { font-size: 0.92rem; margin: 0 0 12px; }

/* --- Reframer pool (D-75) ----------------------------------------------------- */
.pool-card { border-top: 4px solid var(--gold); }
.pool-card h2 { margin-bottom: 0.4em; }
.pool-bar { display: block; width: 100%; height: 12px; margin: 0 0 14px; }
.pool-track { fill: var(--sunk); }
.pool-fill { fill: var(--gold); }
.pool-card p:last-child { margin-bottom: 0; }
.row-target th, .row-target td { background: var(--gold-soft); font-weight: 650; }
