/* Policy tracker: design system
   Tokens → base → layout → components → pages → charts → utilities. */

/* ---------- tokens ---------- */
:root {
  --font-sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-serif: "Source Serif 4", Georgia, "Times New Roman", serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --bg: #fafaf8;
  --surface: #ffffff;
  --surface-2: #f3f4f1;
  --ink: #15191d;
  --ink-2: #3a424b;
  --muted: #5e6873;
  --line: #e4e6e2;
  --line-strong: #cfd3ce;
  --accent: #0d6b63;
  --accent-ink: #0a564f;
  --accent-soft: #e4f2ef;
  --on-accent: #ffffff;
  --warn-bg: #fdf5e2;
  --warn-line: #efd9a4;
  --warn-ink: #6f4e06;
  --info-bg: #eef4f8;
  --info-line: #cfe0ea;

  --s-in-force: #2b8a57;
  --s-amended: #3a6fd0;
  --s-replaced: #8159c0;
  --s-revoked: #c2412f;
  --s-expired: #8d949b;
  --s-pending: #b7791f;
  --s-draft: #6b8fa6;

  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 1px 2px rgba(20, 25, 30, 0.04), 0 2px 8px rgba(20, 25, 30, 0.04);
  --shadow-hover: 0 2px 4px rgba(20, 25, 30, 0.06), 0 8px 24px rgba(20, 25, 30, 0.07);
  --container: 1200px;
  --gutter: 16px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111416;
    --surface: #181c1f;
    --surface-2: #1f2427;
    --ink: #eceeec;
    --ink-2: #c9ced1;
    --muted: #98a1a8;
    --line: #2a3034;
    --line-strong: #3a4247;
    --accent: #5cc4b6;
    --accent-ink: #7dd6ca;
    --accent-soft: #17312e;
    --on-accent: #0b1a18;
    --warn-bg: #2f2713;
    --warn-line: #5a4819;
    --warn-ink: #f0d58e;
    --info-bg: #162229;
    --info-line: #24353f;
    --s-in-force: #4fc07f;
    --s-amended: #74a2f2;
    --s-replaced: #b08de8;
    --s-revoked: #ef7564;
    --s-expired: #8e979e;
    --s-pending: #e0a94a;
    --s-draft: #8fb0c4;
    --shadow: none;
    --shadow-hover: 0 0 0 1px var(--line-strong);
    color-scheme: dark;
  }
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 16px/1.6 var(--font-sans);
  font-feature-settings: "cv11", "ss01";
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { line-height: 1.25; margin: 0 0 0.5em; color: var(--ink); }
h1 { font: 600 clamp(1.9rem, 1.4rem + 2vw, 2.6rem)/1.15 var(--font-serif); letter-spacing: -0.01em; }
h2 { font-size: 1.3rem; font-weight: 600; letter-spacing: -0.005em; }
h3 { font-size: 1.05rem; font-weight: 600; }
p { margin: 0 0 1em; }
a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--accent-ink); }
code, .mono { font-family: var(--font-mono); font-size: 0.86em; }
code { background: var(--surface-2); padding: 0.1em 0.35em; border-radius: 4px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 3px; }
img, svg { max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }

/* ---------- layout ---------- */
.container { max-width: var(--container); margin: 0 auto; padding: 0 var(--gutter); }
@media (min-width: 720px) { :root { --gutter: 28px; } }
.narrow { max-width: 720px; }
.section { margin-top: 64px; }
.section-sm { margin-top: 36px; }
.section-title { margin-top: 40px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.section-head h2 { margin: 0; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(auto-fill, minmax(min(100%, 420px), 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr)); }
main { min-height: 60vh; padding-bottom: 72px; }

/* ---------- header ---------- */
.skip { position: absolute; left: -999px; top: 8px; background: var(--surface); padding: 8px 12px; z-index: 10; }
.skip:focus { left: 8px; }
.site-header { background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 64px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; }
.brand-mark { width: 32px; height: 32px; flex: none; }
.brand-mark rect { fill: var(--accent); }
.brand-mark path { fill: none; stroke: var(--on-accent); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-name { font-weight: 700; font-size: 0.98rem; letter-spacing: -0.01em; }
.brand-sub { font-size: 0.75rem; color: var(--muted); }
.nav { display: flex; gap: 2px; }
.nav a { color: var(--ink-2); text-decoration: none; padding: 8px 11px; border-radius: var(--radius-sm); font-size: 0.93rem; font-weight: 500; }
.nav a:hover { background: var(--surface-2); color: var(--ink); }
.nav a[aria-current="page"] { color: var(--accent); background: var(--accent-soft); }
.nav-btn { display: none; }
@media (max-width: 960px) {
  .header-inner { flex-wrap: wrap; }
  .nav { flex-wrap: wrap; width: 100%; padding-bottom: 8px; }
  .js .nav-btn { display: flex; flex-direction: column; justify-content: center; gap: 4px; width: 40px; height: 40px; padding: 10px; background: none; border: 0; cursor: pointer; border-radius: var(--radius-sm); }
  .js .nav-btn span { display: block; height: 2px; background: var(--ink); border-radius: 2px; }
  .js .nav { display: none; }
  .js .nav-open .nav { display: flex; flex-direction: column; gap: 0; padding: 4px 0 12px; }
  .nav a { padding: 11px 10px; }
}

/* ---------- footer ---------- */
.site-footer { border-top: 1px solid var(--line); background: var(--surface); padding: 32px 0; font-size: 0.9rem; }
.footer-inner { display: grid; grid-template-columns: 1.5fr 1fr; gap: 16px 40px; }
.footer-title { font-weight: 700; margin-bottom: 4px; }
.footer-links { display: flex; flex-direction: column; gap: 6px; }
.footer-links a { color: var(--ink-2); text-decoration: none; }
.footer-links a:hover { color: var(--accent); text-decoration: underline; }
.site-footer .small { grid-column: 1 / -1; margin: 0; }
@media (max-width: 640px) { .footer-inner { grid-template-columns: 1fr; } }

/* ---------- typography helpers ---------- */
.eyebrow { text-transform: uppercase; letter-spacing: 0.08em; font-size: 0.74rem; font-weight: 600; color: var(--muted); margin-bottom: 8px; }
.lede { font-size: 1.12rem; color: var(--ink-2); max-width: 70ch; }
.display { font-size: clamp(2.1rem, 1.4rem + 3vw, 3.3rem); max-width: 20ch; }
.muted { color: var(--muted); }
.small { font-size: 0.86rem; }
.label-sm { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin: 18px 0 8px; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.empty { color: var(--muted); padding: 32px 0; text-align: center; }

/* ---------- page heads and hero ---------- */
.page-head { padding-top: 28px; padding-bottom: 20px; }
.crumbs { font-size: 0.85rem; color: var(--muted); margin-bottom: 18px; display: flex; flex-wrap: wrap; gap: 6px; }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--accent); text-decoration: underline; }
.crumbs .sep { opacity: 0.5; }
.hero { background: linear-gradient(180deg, var(--surface) 0%, var(--bg) 100%); border-bottom: 1px solid var(--line); }
.hero-inner { padding-top: 64px; padding-bottom: 48px; }
.hero-search { display: flex; gap: 8px; max-width: 640px; margin: 28px 0 12px; }
.hero-search input { flex: 1; min-width: 0; padding: 13px 16px; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--surface); font-size: 1rem; box-shadow: var(--shadow); }
.hero-search input:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: transparent; }
.hero-links { color: var(--muted); font-size: 0.92rem; }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 10px 16px; border-radius: var(--radius-sm); border: 1px solid var(--accent); background: var(--accent); color: var(--on-accent); font-weight: 600; font-size: 0.93rem; text-decoration: none; cursor: pointer; white-space: nowrap; }
.btn:hover { background: var(--accent-ink); border-color: var(--accent-ink); color: var(--on-accent); }
.btn-secondary { background: var(--surface); color: var(--accent); }
.btn-secondary:hover { background: var(--accent-soft); color: var(--accent-ink); }
.btn-ghost { background: transparent; color: var(--ink-2); border-color: var(--line-strong); }
.btn-ghost:hover { background: var(--surface-2); color: var(--ink); border-color: var(--line-strong); }
.btn-sm { padding: 6px 10px; font-size: 0.84rem; }
.btn-block { display: flex; width: 100%; margin-top: 16px; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.link { background: none; border: 0; padding: 0; color: var(--accent); text-decoration: underline; cursor: pointer; }

/* ---------- cards ---------- */
.card { display: block; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); color: inherit; }
a.card { text-decoration: none; transition: box-shadow 0.15s, border-color 0.15s, transform 0.15s; }
a.card:hover { box-shadow: var(--shadow-hover); border-color: var(--line-strong); color: inherit; }
a.card:hover h2, a.card:hover h3 { color: var(--accent); }
.card-muted { background: var(--surface-2); box-shadow: none; }
.card-muted h3 { margin-bottom: 2px; }
.card-muted p { margin: 0; }

/* ---------- pills, tags, chips ---------- */
.pills { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 0.78rem; font-weight: 600; padding: 2px 9px 2px 8px; border-radius: 999px; white-space: nowrap; line-height: 1.6; }
.pill.status { background: color-mix(in srgb, var(--sc) 12%, transparent); color: color-mix(in srgb, var(--sc) 80%, var(--ink)); }
.pill.status .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--sc); }
.s-in-force { --sc: var(--s-in-force); }
.s-amended { --sc: var(--s-amended); }
.s-replaced { --sc: var(--s-replaced); }
.s-revoked { --sc: var(--s-revoked); }
.s-expired { --sc: var(--s-expired); }
.s-pending { --sc: var(--s-pending); }
.s-draft { --sc: var(--s-draft); }
.pill.status.s-draft { background: transparent; border: 1px dashed var(--s-draft); }
.pill.verif { border: 1px solid var(--line-strong); color: var(--muted); font-weight: 500; }
.pill.v-verified { border-color: var(--s-in-force); color: var(--s-in-force); }
.pill.v-partly-verified { border-color: var(--warn-line); color: var(--warn-ink); background: var(--warn-bg); }
.pill.v-unverified { border-style: dashed; }
.tag { font-size: 0.78rem; color: var(--ink-2); background: var(--surface-2); padding: 2px 9px; border-radius: 999px; text-decoration: none; white-space: nowrap; }
a.tag:hover { color: var(--accent); background: var(--accent-soft); }
.country-chip { font-size: 0.74rem; font-weight: 600; color: var(--ink-2); background: var(--surface-2); padding: 1px 8px; border-radius: 4px; }
.lg-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--sc); vertical-align: 0; margin: 0 2px 0 8px; }
.lg-dot:first-child { margin-left: 0; }

/* ---------- stats ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; margin: 28px 0 0; box-shadow: var(--shadow); }
.stats > div { background: var(--surface); padding: 18px 20px; }
.stats dt { font-size: 0.8rem; color: var(--muted); }
.stats dd { margin: 4px 0 0; font: 600 1.9rem/1.1 var(--font-serif); }
.stats dd .muted { font: 500 0.95rem var(--font-sans); }
.stat-progress { grid-column: span 2; }
@media (max-width: 520px) { .stat-progress { grid-column: auto; } }
.progress { height: 6px; background: var(--surface-2); border-radius: 999px; margin-top: 10px; overflow: hidden; }
.progress span { display: block; height: 100%; background: var(--s-in-force); min-width: 3px; border-radius: 999px; }

/* ---------- home ---------- */
.feature { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: 32px; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 32px; box-shadow: var(--shadow); }
.feature h2 { font: 600 1.6rem/1.2 var(--font-serif); }
.feature-chart { margin: 0; }
@media (max-width: 860px) { .feature { grid-template-columns: 1fr; padding: 22px; } }
.country-card-head { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.country-card-head h2, .country-card-head h3 { margin: 0; font: 600 1.4rem var(--font-serif); }
.country-code { font: 700 0.8rem var(--font-mono); background: var(--accent-soft); color: var(--accent); padding: 4px 7px; border-radius: 5px; }
.bar { display: flex; height: 8px; border-radius: 999px; overflow: hidden; gap: 2px; margin: 14px 0 10px; }
.bar span { background: var(--sc); }
.topic-card h3 { margin: 4px 0; font-size: 1rem; }
.topic-card { padding: 16px 18px; }
.topic-group { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.07em; color: var(--muted); font-weight: 600; }
.topic-card-lg p { margin-bottom: 10px; }
.callout { border-radius: var(--radius); padding: 16px 20px; border: 1px solid var(--info-line); background: var(--info-bg); }
.callout h2 { font-size: 1.1rem; }
.callout p:last-child { margin-bottom: 0; }
.callout.warn { background: var(--warn-bg); border-color: var(--warn-line); color: var(--warn-ink); }
.callout.warn a { color: inherit; }

/* ---------- rule card ---------- */
.rule-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); transition: box-shadow 0.15s, border-color 0.15s; }
.rule-card:hover { box-shadow: var(--shadow-hover); border-color: var(--line-strong); }
.rule-card-meta { display: flex; align-items: center; gap: 8px; font-size: 0.82rem; color: var(--muted); flex-wrap: wrap; }
.rule-card-meta .mono { color: var(--ink-2); font-weight: 600; }
.spacer { flex: 1; }
.rule-card-title { font: 600 1.08rem/1.35 var(--font-serif); margin: 6px 0 4px; }
.rule-card-title a { color: var(--ink); text-decoration: none; }
.rule-card-title a:hover { color: var(--accent); text-decoration: underline; }
.rule-card-summary { font-size: 0.92rem; color: var(--ink-2); margin-bottom: 10px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* ---------- explore ---------- */
.explore { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 32px; align-items: start; }
.facets { position: sticky; top: 84px; max-height: calc(100vh - 100px); overflow: auto; padding-right: 4px; }
.facet-search label { display: block; font-weight: 600; font-size: 0.88rem; margin-bottom: 6px; }
.facet-search input, .facet-search select { width: 100%; padding: 9px 12px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--surface); }
.facet { border-top: 1px solid var(--line); padding: 10px 0; }
.facet:first-of-type { margin-top: 16px; }
.facet > summary { font-weight: 600; font-size: 0.88rem; cursor: pointer; padding: 4px 0 6px; list-style: none; display: flex; justify-content: space-between; }
.facet > summary::-webkit-details-marker { display: none; }
.facet > summary::after { content: "+"; color: var(--muted); }
.facet[open] > summary::after { content: "–"; }
.check { display: flex; align-items: flex-start; gap: 8px; padding: 3px 0; font-size: 0.9rem; cursor: pointer; color: var(--ink-2); }
.check input { margin-top: 4px; accent-color: var(--accent); }
.check .n { margin-left: auto; color: var(--muted); font-size: 0.78rem; font-variant-numeric: tabular-nums; padding-left: 6px; }
.check.zero { opacity: 0.45; }
.results-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.results-bar p { margin: 0; font-weight: 600; }
.results-tools { display: flex; align-items: center; gap: 8px; }
.results-tools select { padding: 6px 10px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--surface); }
.active-filters { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.active-filters:empty { display: none; }
.chip-btn { display: inline-flex; align-items: center; gap: 6px; font-size: 0.8rem; padding: 3px 10px; border-radius: 999px; border: 1px solid var(--accent); background: var(--accent-soft); color: var(--accent-ink); cursor: pointer; }
.chip-btn::after { content: "×"; font-size: 1rem; line-height: 1; }
.results-list { display: flex; flex-direction: column; gap: 12px; }
.filter-toggle { display: none; }
@media (max-width: 860px) {
  .explore { grid-template-columns: 1fr; gap: 16px; }
  .facets { position: static; max-height: none; }
}

/* ---------- rule page ---------- */
.rule-page { padding-top: 28px; }
.rule-head { margin-bottom: 28px; max-width: 860px; }
.amend-line { margin-top: 2px; }
.rule-head h1 { margin-bottom: 8px; }
.orig { font-family: var(--font-serif); font-style: italic; color: var(--muted); margin-bottom: 14px; }
.rule-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 40px; align-items: start; }
.rule-side { position: sticky; top: 84px; display: flex; flex-direction: column; gap: 16px; }
@media (max-width: 960px) { .rule-layout { grid-template-columns: 1fr; } .rule-side { position: static; } }
.rule-summary { font-size: 1.14rem; line-height: 1.65; color: var(--ink); }
.facts-title { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.07em; color: var(--muted); margin-bottom: 12px; }
.facts dl { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 8px 14px; margin: 0; font-size: 0.9rem; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; overflow-wrap: anywhere; }
.side-actions { display: flex; flex-direction: column; gap: 8px; font-size: 0.92rem; }
.chart-frame { margin: 12px 0 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.scroll-x { overflow-x: auto; }
.chain-steps { list-style: none; margin: 16px 0 0; padding: 0; border-left: 2px solid var(--line); }
.chain-steps li { position: relative; padding: 0 0 16px 20px; }
.chain-steps li::before { content: ""; position: absolute; left: -6px; top: 7px; width: 10px; height: 10px; border-radius: 50%; background: var(--surface); border: 2px solid var(--line-strong); }
.chain-steps li.current::before { background: var(--accent); border-color: var(--accent); }
.chain-step-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.related { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.related li .small { margin-top: 2px; }
.cite { display: flex; gap: 12px; align-items: flex-start; background: var(--surface-2); border-radius: var(--radius); padding: 14px 16px; font-size: 0.9rem; }
.cite p { margin: 0; flex: 1; overflow-wrap: anywhere; }

/* ---------- country and topic pages ---------- */
.country-cols { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 40px; align-items: start; }
.country-cols aside { display: flex; flex-direction: column; gap: 16px; position: sticky; top: 84px; }
@media (max-width: 960px) { .country-cols { grid-template-columns: 1fr; } .country-cols aside { position: static; } }
.topic-block { padding: 16px 0; border-top: 1px solid var(--line); }
.topic-block h3 a { color: var(--ink); text-decoration: none; }
.topic-block h3 a:hover { color: var(--accent); }
.hierarchy { margin: 0; padding-left: 20px; font-size: 0.92rem; }
.hierarchy li { padding: 3px 0; }
.plain { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.topic-countries .card { padding: 22px; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
table { border-collapse: collapse; width: 100%; font-size: 0.92rem; }
th, td { text-align: left; vertical-align: top; padding: 12px 16px; border-bottom: 1px solid var(--line); }
thead th { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); background: var(--surface-2); }
tbody tr:last-child > * { border-bottom: 0; }
.matrix th[scope="row"] { width: 15%; min-width: 150px; font-weight: 600; }
.matrix th[scope="row"] a { color: var(--ink); text-decoration: none; }
.matrix th[scope="row"] a:hover { color: var(--accent); text-decoration: underline; }
.matrix td { min-width: 165px; font-size: 0.88rem; }
.matrix th, .matrix td { padding: 12px 12px; }
.matrix .group-row th { background: var(--bg); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.07em; color: var(--muted); padding: 8px 16px; }
.matrix-rule { display: flex; gap: 6px; align-items: baseline; padding: 2px 0; }
.matrix-rule .lg-dot { margin: 0; flex: none; }
.data-table td:first-child { white-space: nowrap; }

/* ---------- data page ---------- */
.download { display: flex; gap: 16px; align-items: flex-start; }
.download h2 { margin-bottom: 4px; font-family: var(--font-mono); font-size: 1.05rem; }
.download p { margin: 0; }
.file-type { flex: none; font: 700 0.75rem var(--font-mono); color: var(--on-accent); background: var(--accent); padding: 12px 10px; border-radius: 8px; }

/* ---------- about ---------- */
.prose-layout { display: grid; grid-template-columns: 200px minmax(0, 720px); gap: 48px; }
.toc { position: sticky; top: 84px; align-self: start; display: flex; flex-direction: column; gap: 4px; font-size: 0.9rem; border-left: 2px solid var(--line); padding-left: 14px; }
.toc a { color: var(--muted); text-decoration: none; padding: 2px 0; }
.toc a:hover { color: var(--accent); }
.prose h2 { margin-top: 40px; font: 600 1.45rem var(--font-serif); }
.prose h2:first-child { margin-top: 0; }
.prose li { margin-bottom: 8px; }
.defs { display: grid; grid-template-columns: max-content 1fr; gap: 12px 20px; align-items: baseline; }
.defs dd { margin: 0; color: var(--ink-2); }
@media (max-width: 760px) { .prose-layout { grid-template-columns: 1fr; gap: 20px; } .toc { position: static; flex-direction: row; flex-wrap: wrap; gap: 4px 14px; border: 0; padding: 0; } .defs { grid-template-columns: 1fr; gap: 4px; } .defs dd { margin-bottom: 12px; } }

/* ---------- charts ---------- */
.chart { width: 100%; height: auto; display: block; font-family: var(--font-sans); }
.swimlane { min-width: 720px; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .lane { stroke: var(--line); stroke-dasharray: 2 4; }
.chart .axis { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.chart .label { fill: var(--ink-2); font-size: 12.5px; }
.chart a:hover .label { fill: var(--accent); text-decoration: underline; }
.chart .label.current { fill: var(--ink); font-weight: 700; }
.chart .hit { fill: transparent; }
.chart a:hover .hit { fill: var(--surface-2); }
.chart .edge { fill: none; stroke: var(--line-strong); stroke-width: 1.6; }
.chart .edge.amends { stroke-dasharray: 4 3; }
.chart .edge.overrides { stroke-dasharray: 1 3; stroke-width: 2; }
.chart .dot { fill: var(--sc); stroke: var(--surface); stroke-width: 2; }
.chart a:hover .dot { stroke: var(--ink); }
.chart .dot.current { stroke: var(--ink); stroke-width: 2.5; }
.legend { font-size: 0.8rem; color: var(--muted); margin: 10px 0 0; display: flex; flex-wrap: wrap; align-items: center; gap: 2px 4px; }
.lg-line { display: inline-block; width: 22px; border-top: 2px solid var(--line-strong); margin: 0 4px 0 10px; vertical-align: middle; }
.lg-line:first-child { margin-left: 0; }
.lg-line.dashed { border-top-style: dashed; }
.lg-line.dotted { border-top-style: dotted; }

/* ---------- reviewer view ---------- */
.review-layout { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 28px; align-items: start; }
.review-queue { position: sticky; top: 84px; display: flex; flex-direction: column; gap: 12px; }
.inline-checks { border: 0; padding: 0; margin: 0; display: flex; gap: 14px; }
.queue { list-style: none; margin: 0; padding: 0; max-height: 42vh; overflow: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.queue a { display: flex; gap: 6px; align-items: baseline; padding: 7px 12px; color: var(--ink-2); text-decoration: none; border-bottom: 1px solid var(--line); font-size: 0.88rem; }
.queue li:last-child a { border-bottom: 0; }
.queue a:hover, .queue a.selected { background: var(--accent-soft); color: var(--ink); }
.queue .flag { font: 700 0.72rem var(--font-mono); color: var(--muted); }
.queue .v { margin-left: auto; font-size: 0.74rem; color: var(--muted); }
.draft-dot { color: var(--accent); font-size: 0.7rem; }
.stack { display: flex; flex-direction: column; gap: 8px; }
.editor { padding: 24px; }
.editor h2 { font: 600 1.5rem var(--font-serif); }
.editor h3 { margin-top: 24px; }
.editor .callout { margin: 12px 0; }
.checklist { display: flex; flex-direction: column; gap: 2px; }
.problems { background: var(--warn-bg); border: 1px solid var(--warn-line); color: var(--warn-ink); border-radius: var(--radius-sm); padding: 10px 14px 10px 32px; font-size: 0.9rem; }
.form { display: flex; flex-direction: column; gap: 12px; }
.form-row { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 4px 14px; align-items: start; font-size: 0.92rem; }
.form-row > span:first-child { color: var(--muted); padding-top: 8px; font: 0.8rem var(--font-mono); }
.form-row.changed > span:first-child { color: var(--accent); font-weight: 700; }
.form-row input[type=text], .form-row textarea, .form-row select { width: 100%; padding: 8px 10px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--bg); }
.form-row.changed input[type=text], .form-row.changed textarea, .form-row.changed select { border-color: var(--accent); background: var(--surface); }
.form-row .was { grid-column: 2; color: var(--muted); font-size: 0.8rem; }
.multi { display: flex; flex-wrap: wrap; gap: 0 14px; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 20px; padding-top: 20px; border-top: 1px solid var(--line); }
@media (max-width: 860px) {
  .review-layout { grid-template-columns: 1fr; }
  .review-queue { position: static; }
  .form-row { grid-template-columns: 1fr; }
  .form-row .was { grid-column: 1; }
}

/* ---------- print ---------- */
@media print {
  .site-header, .site-footer, .rule-side .side-actions, .hero-search, .facets, .crumbs, .cite button { display: none !important; }
  body { background: #fff; }
  .card, .chart-frame, .rule-card { box-shadow: none; }
  .rule-layout { grid-template-columns: 1fr; }
}

/* ---------- updates and change log ---------- */
.narrow-left { max-width: 920px; margin-left: auto; margin-right: auto; }
.update { display: grid; grid-template-columns: 140px minmax(0, 1fr); gap: 20px; padding: 22px 0; border-top: 1px solid var(--line); }
.update-date { color: var(--muted); font-size: 0.9rem; font-variant-numeric: tabular-nums; padding-top: 2px; }
.update h2 { font: 600 1.15rem/1.35 var(--font-serif); margin-bottom: 4px; }
.update-list { margin: 8px 0 0; padding-left: 18px; font-size: 0.92rem; }
.update-list li { margin-bottom: 4px; }
@media (max-width: 640px) { .update { grid-template-columns: 1fr; gap: 4px; } }
.changelog { list-style: none; margin: 0; padding: 0; }
.changelog > li { padding: 10px 0; border-top: 1px solid var(--line); }
.changelog > li:first-child { border-top: 0; }
.changelog-head { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.changelog-head time { font-weight: 600; font-size: 0.9rem; }
.changelog ul { margin: 6px 0 0; padding-left: 18px; }
.changelog p { margin: 4px 0 0; }

/* ---------- coverage roadmap ---------- */
.roadmap td, .roadmap th { vertical-align: top; }
.roadmap th[scope="row"] { white-space: nowrap; }
.roadmap td:last-child { min-width: 340px; width: 45%; }
.roadmap td:nth-child(4) { min-width: 170px; }
.roadmap td.est { min-width: 110px; max-width: 150px; }
.nowrap { white-space: nowrap; }
.roadmap-links { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 6px; }
.pill.diff { border: 1px solid var(--line-strong); color: var(--ink-2); font-weight: 500; }
.pill.d-low { color: var(--s-in-force); border-color: currentColor; }
.pill.d-medium { color: var(--warn-ink); background: var(--warn-bg); border-color: var(--warn-line); }
.pill.d-high { color: var(--s-revoked); border-color: currentColor; }

.pill.flag-pill { border: 1px solid var(--line-strong); color: var(--ink-2); font-weight: 500; background: var(--surface-2); }

.sources-list li { padding-bottom: 4px; }

/* ---------- categories ---------- */
:root {
  --cat-electricity: #0d6b63;
  --cat-energy: #8a6d1d;
  --cat-supply-chain: #3d5a80;
  --cat-trade: #6b4f7a;
}
@media (prefers-color-scheme: dark) {
  :root {
    --cat-electricity: #5cc4b6;
    --cat-energy: #d4b25e;
    --cat-supply-chain: #8fb0dc;
    --cat-trade: #c4a3d6;
  }
}
.cat-electricity { --cat: var(--cat-electricity); }
.cat-energy { --cat: var(--cat-energy); }
.cat-supply-chain { --cat: var(--cat-supply-chain); }
.cat-trade { --cat: var(--cat-trade); }
.category-tile { background: var(--surface); border: 1px solid var(--line); border-top: 4px solid var(--cat); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow); }
.category-tile h3 { font: 600 1.2rem var(--font-serif); margin-bottom: 4px; }
.category-tile h3 a { color: var(--ink); text-decoration: none; }
.category-tile h3 a:hover { color: var(--accent); text-decoration: underline; }
.category-tile p { color: var(--muted); margin-bottom: 12px; }
.category-topics { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr)); gap: 4px 16px; font-size: 0.9rem; }
.category-topics a { text-decoration: none; }
.category-topics a:hover { text-decoration: underline; }
.category-topics .n { color: var(--muted); font-size: 0.8rem; }
.cat-chip { font-size: 0.74rem; font-weight: 600; padding: 2px 8px; border-radius: 999px; white-space: nowrap; color: var(--cat); background: color-mix(in srgb, var(--cat) 12%, transparent); }
.cat-dot, .cat-mark { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--cat); margin-right: 6px; vertical-align: 0; }
.category-heading { display: flex; align-items: center; }
.category-heading .cat-mark { width: 12px; height: 12px; margin-right: 10px; }
.matrix .group-row .cat-mark { margin-right: 8px; }

/* ---------- compare controls ---------- */
.compare-controls { display: flex; flex-wrap: wrap; gap: 8px 32px; margin-bottom: 16px; }
.compare-controls fieldset { border: 0; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 2px 14px; align-items: center; }
.compare-controls legend { font-weight: 600; font-size: 0.86rem; margin-bottom: 4px; width: 100%; }
.matrix th[scope="row"] { position: sticky; left: 0; z-index: 1; background: var(--surface); }
.matrix .group-row th { position: sticky; left: 0; }
