/* Threshold Governance Observatory — instrument-panel styling.
   Single source of visual truth. Tokens live here; no inline styles, no external assets. */

@layer tokens, base, layout, components, utilities;

@layer tokens {
  :root {
    /* Surfaces and ink */
    --bg: #0d0d0d;
    --bg-deep: #070707;
    --surface: #141414;
    --surface2: #191919;
    --surface3: #1c1526;
    --line: #2a2433;
    --line-strong: #51465f;
    --ink: #f6f6f6;
    --muted: #9a9a9a;

    /* Brand: interactive and structural only, never decorative gradients */
    --purple: #7d00ff;
    --purple-deep: #5b00b8;
    --purple2: #925bff;
    --purple3: #b886fe;
    --purple-text: #b886fe;

    /* Semantics: always paired with glyph + text */
    --btc: #f7931a;
    --btc-soft: rgba(247, 147, 26, .12);
    --good: #7cffb2;
    --good-soft: rgba(124, 255, 178, .06);
    --good-softer: rgba(124, 255, 178, .12);
    --bad: #ff7a7a;
    --bad-soft: rgba(255, 122, 122, .08);
    --ok: #7cffb2;
    --focus: #7cffb2;

    /* Strict scale */
    --s1: 4px;
    --s2: 8px;
    --s3: 12px;
    --s4: 16px;
    --s5: 24px;
    --s6: 32px;
    --s7: 48px;
    --radius: 0;

    --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
    --hairline: 0 0 0 1px var(--line);
  }

  @supports (color: color-mix(in srgb, red, blue)) {
    :root { --purple-fill: color-mix(in srgb, var(--purple) 18%, var(--surface)); }
  }
  :root { --purple-fill: var(--surface3); }
}

@layer base {
  *, *::before, *::after { box-sizing: border-box; }

  html { scroll-behavior: auto; }

  body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font: 12px/1.55 var(--mono);
    font-variant-numeric: tabular-nums;
    -webkit-font-smoothing: antialiased;
  }

  h1, h2, h3 { margin: 0; font-weight: 600; text-wrap: pretty; }
  h1 { font-size: 16px; line-height: 1.35; letter-spacing: .01em; }
  h2 { font-size: 14px; line-height: 1.4; letter-spacing: .02em; }
  h3 { font-size: 12px; line-height: 1.4; }
  p { margin: 0; text-wrap: pretty; }
  b, strong { font-weight: 700; }
  code, pre { font-family: var(--mono); font-variant-numeric: tabular-nums; }

  a { color: var(--purple-text); text-decoration: none; border-radius: var(--radius); }
  a:hover { text-decoration: underline; text-underline-offset: 2px; }

  button, input, select { font: inherit; font-variant-numeric: tabular-nums; }
  button { cursor: pointer; }

  input, select {
    background: var(--surface2);
    color: var(--ink);
    border: 1px solid var(--line-strong);
    padding: var(--s2);
    font-size: 12px;
    border-radius: var(--radius);
    min-height: 44px;
  }
  input:disabled, select:disabled {
    opacity: 1;
    color: var(--muted);
    border-color: var(--line);
    background: var(--bg-deep);
    cursor: not-allowed;
  }
  input::placeholder { color: var(--muted); }

  :where(a, button, input, select, summary, [tabindex="0"]):focus-visible {
    outline: 2px solid var(--bg);
    box-shadow: 0 0 0 4px var(--focus);
    outline-offset: 0;
    border-radius: var(--radius);
  }

  .hidden { display: none !important; }
  .muted, .sample-note, .provenance { color: var(--muted); font-size: 12px; }
  .sample-note { margin-top: var(--s3); }
  .ok-text { color: var(--ok); }
  .bad-text { color: var(--bad); }
}

@layer layout {
  .shell {
    max-width: 1440px;
    margin: 0 auto;
    padding: var(--s5);
  }

  .topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: grid;
    grid-template-columns: minmax(180px, 230px) 1fr auto;
    align-items: center;
    gap: var(--s5);
    min-height: 64px;
    padding: var(--s3) var(--s5);
    border-bottom: 1px solid var(--line);
    background: var(--bg-deep);
  }
  .brand { font-size: 12px; font-weight: 700; letter-spacing: .14em; color: var(--ink); text-transform: uppercase; }
  .brand:hover { text-decoration: none; }
  .brand span { color: var(--purple-text); }

  .nav { display: flex; align-items: center; gap: var(--s1); justify-self: start; }
  .nav a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--s2);
    min-height: 44px;
    min-width: 44px;
    padding: var(--s2) var(--s4);
    border: 1px solid transparent;
    color: var(--muted);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .06em;
  }
  .nav a:hover { color: var(--ink); background: var(--surface); text-decoration: none; }
  .nav a.active { color: var(--ink); border-color: var(--line-strong); background: var(--surface); }
  .nav a[aria-current="page"] { border-bottom-color: var(--purple-text); }

  .tbtc-mark {
    display: inline-grid;
    place-items: center;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--btc);
    color: var(--bg);
    font-weight: 700;
    font-size: 11px;
    line-height: 1;
  }
  .gear-mark { color: var(--purple-text); font-size: 14px; line-height: 1; }
  .committee-label { font-weight: 700; letter-spacing: .04em; }

  .top-meta { justify-self: end; color: var(--muted); font-size: 12px; text-align: right; }
  .mode-label {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: var(--s1) var(--s3);
    border: 1px solid var(--line-strong);
    color: var(--purple-text);
    font-size: 11px;
    letter-spacing: .08em;
    text-transform: uppercase;
  }

  .skip-link {
    position: absolute;
    left: var(--s4);
    top: -100px;
    z-index: 100;
    padding: var(--s3) var(--s4);
    background: var(--surface);
    border: 1px solid var(--focus);
    color: var(--ink);
  }
  .skip-link:focus { top: var(--s2); }

  .view > .view-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: var(--s4);
    margin-bottom: var(--s5);
    padding-bottom: var(--s3);
    border-bottom: 1px solid var(--line);
  }
  .view-head h1 { font-size: 14px; text-transform: uppercase; letter-spacing: .08em; }
  .view-head p { max-width: 100ch; color: var(--muted); font-size: 12px; }
  .view-head .muted { font-size: 12px; }

  .region {
    margin-bottom: var(--s6);
    container-type: inline-size;
    container-name: region;
  }
  .region-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: var(--s4);
    margin-bottom: var(--s3);
    padding-bottom: var(--s2);
    border-bottom: 1px solid var(--line);
  }
  .region-head h2 { font-size: 14px; text-transform: uppercase; letter-spacing: .06em; }
  .region-head p { color: var(--muted); font-size: 12px; text-align: right; }

  .stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: var(--s3);
    margin-bottom: var(--s4);
  }

  .proposal-timeline {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: var(--s1);
    margin: var(--s3) 0;
    padding: 0;
    list-style: none;
  }

  .tally-block, .kv-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: var(--s5);
  }

  .committee-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: var(--s4);
    align-items: start;
  }

  @supports (container-type: inline-size) {
    @container region (max-width: 620px) {
      .stats, .health-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
      .participation-row { grid-template-columns: minmax(0, 1fr) 72px 120px; }
    }
  }

  @supports (view-transition-name: none) {
    .shell { view-transition-name: view-root; }
    ::view-transition-old(root), ::view-transition-new(root) { animation-duration: 120ms; }
  }
}

@layer components {
  .card {
    border: 1px solid var(--line);
    background: var(--surface);
    padding: var(--s4);
    margin-bottom: var(--s4);
    border-radius: var(--radius);
    box-shadow: var(--hairline);
    min-width: 0;
  }
  .card > h2 { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; margin-bottom: var(--s3); color: var(--muted); }
  .card > h3 { font-size: 12px; margin: var(--s4) 0 var(--s2); color: var(--ink); }

  .stat {
    border: 1px solid var(--line);
    background: var(--surface);
    padding: var(--s3) var(--s4);
    min-height: 92px;
    min-width: 0;
    box-shadow: var(--hairline);
  }
  .stat h3 {
    color: var(--muted);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .08em;
  }
  .stat b {
    display: block;
    margin-top: var(--s2);
    color: var(--ink);
    font-size: 24px;
    line-height: 1.15;
    font-variant-numeric: tabular-nums;
    overflow-wrap: anywhere;
  }
  .stat small { display: block; margin-top: var(--s1); color: var(--muted); font-size: 11px; }

  #current-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    align-items: start;
  }
  #current-card > h2 { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
  #current-card > .proposal-title { margin-top: var(--s3); }
  .proposal-title { font-size: 14px; font-weight: 700; line-height: 1.45; overflow-wrap: anywhere; }
  .meta-line { color: var(--muted); font-size: 12px; margin-top: var(--s2); overflow-wrap: anywhere; }

  .deadline-bar {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: var(--s3);
    margin-top: var(--s4);
    padding: var(--s2) 0 var(--s3);
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
  }
  .deadline-label { color: var(--muted); font-size: 12px; }
  .countdown { color: var(--btc); font-size: 13px; font-variant-numeric: tabular-nums; }
  .deadline-bar.not-sampled .countdown { color: var(--muted); }
  .deadline-bar.passed { border-color: var(--btc); }
  .deadline-bar.passed .countdown { border: 1px solid var(--btc); padding: var(--s1) var(--s2); }
  .deadline-input { color: var(--muted); font-size: 11px; display: inline-flex; align-items: center; gap: var(--s2); }
  .deadline-input input { width: 128px; }
  .deadline-bar .draft-note { flex-basis: 100%; text-align: right; }

  .timeline-step {
    position: relative;
    min-width: 0;
    min-height: 92px;
    padding: var(--s2);
    border: 1px solid var(--line);
    border-top: 3px solid var(--line);
    background: transparent;
  }
  .timeline-step + .timeline-step::before {
    content: "";
    position: absolute;
    left: calc(-1 * var(--s1));
    top: -3px;
    width: var(--s1);
    height: 1px;
    background: var(--line);
  }
  .timeline-step b { display: block; font-size: 11px; line-height: 1.35; color: var(--ink); }
  .timeline-step small {
    display: block;
    margin-top: var(--s1);
    color: var(--muted);
    font-size: 11px;
    overflow-wrap: anywhere;
  }
  .timeline-step.done { border-top-color: var(--good); background: var(--good-soft); }
  .timeline-step.done b { color: var(--good); }
  .timeline-step.ready { border-top-color: var(--good); background: var(--good-softer); }
  .timeline-step.executed { border-top-color: var(--btc); background: var(--btc-soft); }
  .timeline-step.executed b { color: var(--btc); }
  .timeline-step.pending b { color: var(--muted); }
  .timeline-step .btn { margin-top: var(--s2); }
  .timeline-step .step-link {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    margin-top: var(--s2);
    padding: var(--s2) var(--s1);
    font-size: 11px;
  }

  .tally-block { margin-top: var(--s4); padding-top: var(--s3); border-top: 1px solid var(--line); }
  .tally-block > h3, .tally-block > .quorum-label, .tally-block > .progress,
  .tally-block > .donut, .tally-block > .donut-legend { grid-column: 1 / -1; }
  #current-card > .quorum-label { margin-top: var(--s4); padding-top: var(--s3); border-top: 1px solid var(--line); }
  .quorum-label { color: var(--muted); font-size: 12px; }

  .row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: var(--s4);
    min-width: 0;
    padding: var(--s2) 0;
    border-top: 1px solid var(--line);
  }
  .row span { color: var(--muted); font-size: 12px; }
  .row b { text-align: right; font-size: 12px; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
  .kv-grid .row { display: block; }
  .kv-grid .row b { display: block; text-align: left; margin-top: var(--s1); }

  .progress {
    height: 8px;
    border: 1px solid var(--line);
    background: var(--bg-deep);
    border-radius: 999px;
    overflow: hidden;
    margin: var(--s2) 0;
  }
  .progress > i { display: block; height: 100%; background: var(--purple); }
  .progress.not-sampled,
  .donut.not-sampled {
    background: repeating-linear-gradient(90deg, var(--line) 0 4px, transparent 4px 8px);
  }

  .donut { display: flex; height: 14px; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; margin-top: var(--s3); }
  .donut .seg { height: 100%; width: var(--pct, 0%); }
  .donut .seg:not(.zero) { min-width: 2px; }
  .seg-yes { background: var(--good); }
  .seg-no { background: var(--bad); }
  .seg-abstain { background: var(--btc); }
  .donut-legend {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: var(--s2);
    margin: var(--s2) 0;
  }
  .donut-legend div { border-left: 2px solid var(--line); padding-left: var(--s2); min-width: 0; }
  .donut-legend dt { color: var(--muted); font-size: 11px; text-transform: uppercase; }
  .donut-legend dd { margin: var(--s1) 0 0; font-size: 12px; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }

  .legend-card > h2 { font-size: 12px; }
  .legend-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: var(--s2) var(--s5); margin: 0; }
  .legend-list div { border-top: 1px solid var(--line); padding-top: var(--s2); }
  .legend-list dt { display: flex; align-items: center; gap: var(--s2); font-size: 12px; }
  .legend-list dd { margin: var(--s1) 0 0; color: var(--muted); font-size: 11px; }
  .legend-swatch { display: inline-block; width: 12px; height: 12px; border: 1px solid var(--line-strong); border-radius: 2px; }
  .legend-glyph { display: inline-grid; place-items: center; width: 16px; font-weight: 700; color: var(--good); }

  .list-head { display: flex; align-items: end; justify-content: space-between; gap: var(--s4); margin-bottom: var(--s3); }
  .list-head h2 { font-size: 14px; text-transform: uppercase; letter-spacing: .06em; }
  .filters { display: flex; gap: var(--s3); flex-wrap: wrap; }
  .filters label { display: flex; flex-direction: column; gap: var(--s1); color: var(--muted); font-size: 11px; }

  .proposal-list { border-top: 1px solid var(--line); }
  .proposal-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 120px 200px 200px;
    gap: var(--s4);
    align-items: center;
    min-height: 44px;
    padding: var(--s3) var(--s2);
    border-bottom: 1px solid var(--line);
  }
  .proposal-row[role="button"] { cursor: pointer; }
  .proposal-row:hover, .proposal-row:focus-visible { background: var(--surface); }
  .proposal-row b { display: block; font-size: 12px; overflow-wrap: anywhere; }
  .proposal-row small { display: block; color: var(--muted); font-size: 11px; }
  .proposal-row .pill + small { margin-top: var(--s1); }
  .row-open { display: none; color: var(--btc); }
  .proposal-row:hover .row-open, .proposal-row:focus-visible .row-open { display: inline; }

  .pill {
    display: inline-flex;
    align-items: center;
    gap: var(--s1);
    padding: var(--s1) var(--s2);
    border: 1px solid var(--purple2);
    border-radius: 999px;
    color: var(--purple-text);
    font-size: 10px;
    letter-spacing: .04em;
    text-transform: uppercase;
  }
  .pill.executed { color: var(--good); border-color: var(--good); }
  .pill.active { color: var(--btc); border-color: var(--btc); }
  .pill.authorized { color: var(--ok); border-color: var(--ok); background: var(--good-soft); }

  #proposal-inline-detail { margin-top: var(--s5); border-color: var(--purple2); }
  #proposal-inline-detail > h2 { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; margin: var(--s4) 0 var(--s2); color: var(--muted); }
  #proposal-inline-detail h1 { font-size: 20px; overflow-wrap: anywhere; }
  .back {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    padding: var(--s2) var(--s4);
    background: var(--surface2);
    border: 1px solid var(--line-strong);
    color: var(--purple-text);
    font: inherit;
    font-size: 12px;
  }
  .back:hover { background: var(--surface3); }
  .body-text {
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    color: var(--ink);
    font: 12px/1.65 var(--mono);
    max-height: 560px;
    overflow: auto;
    padding: var(--s3);
    border: 1px solid var(--line);
    background: var(--bg-deep);
  }
  .vote-dl { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s2); margin: 0; }
  .vote-dl div { border-left: 2px solid var(--line); padding-left: var(--s2); min-width: 0; }
  .vote-dl dt { color: var(--muted); font-size: 11px; text-transform: uppercase; }
  .vote-dl dd { margin: var(--s1) 0 0; font-size: 12px; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
  .timeline { list-style: none; padding: 0; margin: 0; }
  .timeline li { padding: var(--s2) 0 var(--s2) var(--s4); border-left: 2px solid var(--line); color: var(--muted); }
  .timeline li.observed { border-color: var(--good); color: var(--ink); }
  .timeline li.derived { border-color: var(--btc); }
  .action { border-top: 1px solid var(--line); padding: var(--s2) 0; }
  .action code { color: var(--purple-text); overflow-wrap: anywhere; }
  details summary { cursor: pointer; color: var(--purple-text); min-height: 44px; display: inline-flex; align-items: center; }

  #committee > .list-head { margin-bottom: var(--s4); }
  .committee-grid > .card { margin-bottom: 0; }
  #wallet-card { grid-column: 1 / -1; }
  .signer-detail { margin-top: var(--s4); padding-top: var(--s3); border-top: 1px solid var(--line); }
  .signer-detail h3 { margin-bottom: var(--s2); }
  .signer-detail > .muted { margin-bottom: var(--s3); }
  .committee-actions { display: flex; align-items: center; gap: var(--s3); flex-wrap: wrap; margin-top: var(--s4); }

  .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--s2);
    min-height: 44px;
    padding: var(--s3) var(--s4);
    background: var(--surface2);
    border: 1px solid var(--purple2);
    border-radius: var(--radius);
    color: var(--ink);
    font: inherit;
    font-size: 12px;
    letter-spacing: .02em;
    text-transform: uppercase;
  }
  .btn:hover:not(:disabled) { background: var(--purple-deep); border-color: var(--purple3); }
  .btn.primary { background: var(--purple-deep); border-color: var(--purple2); }
  .btn.primary:hover:not(:disabled) { background: var(--purple); }
  .btn.secondary { border-color: var(--line-strong); color: var(--ink); }
  .btn.secondary:hover:not(:disabled) { background: var(--surface3); }
  .btn:disabled { opacity: 1; cursor: not-allowed; border-color: var(--line); color: var(--muted); background: var(--bg-deep); }

  .error-note { color: var(--bad); font-size: 12px; min-height: 1em; }
  .draft-note { color: var(--btc); font-size: 12px; overflow-wrap: anywhere; }
  .wallet-confirm { border: 1px dashed var(--line-strong); padding: var(--s4); margin-top: var(--s4); background: var(--bg-deep); }
  .wallet-confirm p { margin-bottom: var(--s2); }
  .draft-confirm-label { display: block; color: var(--muted); font-size: 12px; margin: var(--s4) 0 var(--s2); }
  .draft-confirm-label b { color: var(--btc); }
  .draft-confirm-label input { display: block; margin-top: var(--s2); width: min(320px, 100%); }
  .draft-json { background: var(--bg-deep); border: 1px solid var(--line); padding: var(--s4); color: var(--purple-text); max-height: 420px; overflow: auto; }

  .table-scroll { overflow-x: auto; border: 1px solid var(--line); scrollbar-color: var(--line-strong) var(--bg-deep); }
  .table-scroll:focus, .table-scroll:focus-visible { outline: 2px solid var(--bg); box-shadow: 0 0 0 4px var(--focus); outline-offset: 2px; }
  .data-table { width: 100%; border-collapse: collapse; min-width: 640px; }
  .data-table caption { text-align: left; color: var(--muted); font-size: 11px; padding: var(--s2); border-bottom: 1px solid var(--line); }
  .data-table th, .data-table td { text-align: left; padding: var(--s2); border-bottom: 1px solid var(--line); vertical-align: middle; }
  .data-table thead th { color: var(--muted); font-size: 11px; letter-spacing: .06em; text-transform: uppercase; position: sticky; top: 0; background: var(--surface2); }
  .data-table td { font-size: 12px; }
  .data-table td.num { text-align: right; font-variant-numeric: tabular-nums; }
  .data-table code { color: var(--purple-text); overflow-wrap: anywhere; }
  .data-table tbody tr:hover { background: var(--surface); }

  .participation-list, .health-grid { display: grid; gap: var(--s2); }
  .participation-row, .health-item { border: 1px solid var(--line); padding: var(--s3); box-shadow: var(--hairline); min-width: 0; }
  .participation-row { display: grid; grid-template-columns: minmax(0, 1fr) 88px 160px 120px; gap: var(--s2); align-items: center; }
  .participation-row b { overflow-wrap: anywhere; }
  .health-item b { display: block; font-size: 18px; font-variant-numeric: tabular-nums; }
  .health-item .basis { color: var(--muted); font-size: 11px; }
  .band-good { border-color: var(--good); }
  .band-watch { border-color: var(--btc); }
  .band-low, .band-risk { border-color: var(--bad); }

  #inline-detail-effects details, #dashboard-effect-card details { margin-top: var(--s2); }
}

@layer utilities {
  [data-state="good"] { color: var(--good); }
  [data-state="watch"] { color: var(--btc); }
  [data-state="bad"] { color: var(--bad); }

  .shell:has(#proposal-inline-detail:not(.hidden)) .stat { border-color: var(--line-strong); }

  @media (max-width: 1023px) {
    .topbar { grid-template-columns: minmax(160px, 200px) 1fr; }
    .top-meta { grid-column: 1 / -1; justify-self: start; text-align: left; }
    .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .proposal-timeline { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .proposal-row { grid-template-columns: minmax(0, 1fr) 120px 160px; }
    .proposal-row > div:last-child { grid-column: 1 / -1; }
  }

  @media (max-width: 767px) {
    .topbar { grid-template-columns: minmax(0, 1fr); gap: var(--s2); padding: var(--s3) var(--s4); }
    .nav { flex-wrap: wrap; }
    .region-head { flex-direction: column; align-items: flex-start; }
    .region-head p { text-align: left; }
    .list-head { flex-direction: column; align-items: stretch; }
    .filters { width: 100%; }
    .filters label { flex: 1 1 160px; }
    .deadline-bar { justify-content: flex-start; }
    .deadline-bar .draft-note { text-align: left; }
  }

  @media (max-width: 639px) {
    .shell { padding: var(--s4); }
    .stats, .health-grid { grid-template-columns: minmax(0, 1fr); }
    .stat { min-height: 88px; }
    #current-card, .tally-block, .kv-grid { grid-template-columns: minmax(0, 1fr); }
    .proposal-timeline { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .donut-legend, .vote-dl { grid-template-columns: minmax(0, 1fr); }
    .proposal-row { grid-template-columns: minmax(0, 1fr); }
    .proposal-row > div:last-child { grid-column: auto; }
    .committee-grid { grid-template-columns: minmax(0, 1fr); }
    .participation-row { grid-template-columns: minmax(0, 1fr); }
    .row { flex-wrap: wrap; gap: var(--s1) var(--s3); }
    .row b { text-align: left; }
  }

  @media (prefers-reduced-motion: no-preference) {
    .nav a, .btn, .back, .proposal-row, .stat, .card, .health-item, .participation-row {
      transition: background-color 120ms ease, border-color 120ms ease, color 120ms ease;
    }
    details[open] > div { animation: reveal 120ms ease-out; }
    @keyframes reveal { from { opacity: 0; transform: translateY(2px); } to { opacity: 1; transform: none; } }
    @supports (starting-style: opacity) {
      @starting-style { details[open] > div { opacity: 0; transform: translateY(2px); } }
    }
  }

  @media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto !important; }
    *, *::before, *::after {
      transition-duration: 0s !important;
      animation-duration: 0s !important;
      animation-iteration-count: 1 !important;
      scroll-behavior: auto !important;
    }
    .shell { view-transition-name: none !important; }
  }
}
