/* Spam Patterns — compact research-dashboard theme (approved folder-tab
   redesign, Dec 2026). Light theme below; the dark theme (dual-theme kit) is
   the :root[data-theme="dark"] section near the end, set by /static/js/theme.js.
   forced-colors supported.
   Visual system: midnight-navy header, folder-tab navigation strip, cool grey
   canvas, white bordered panels with 2px corners, 13px system type with
   monospaced labels and figures. Every text pair is checked for WCAG 2.2 AA
   in test/a11y-contrast.test.ts. */
:root {
  --canvas: #F4F6F8; --surface: #FFFFFF; --text: #172333; --text-2: #647184;
  --divider: #D7DEE6; --rule: #E7EBF0; --outline: #6B7C96; --action: #2458B5; --action-hover: #194795;
  --focus: #3977D6; --err: #9F2020; --err-bg: #FFF1F1; --ok: #14533D; --ok-bg: #EAF6EF;
  --warn: #713D00; --warn-bg: #FFF4DB; --map-bg: #F3F7FD;
  --strip: #E9EDF2; --tab-bg: #F3F5F8; --tab-active: #E0EBFC; --tab-border: #A9BFDF; --seg-active: #E8EFFA;
  --bin0: #F1F5F9; --bin0-text: #475569; --bin1: #A9C5E2; --bin2: #6D98C5; --bin3: #3B6B9B; --bin4: #204A73;
  --bin-text-light: #172333; --bin-text-dark: #FFFFFF;
  --tint: #F5F7FA; --tint-blue: #EEF3FB; --panel-head: #FAFBFD; --teal-text: #07706A;
  --navy: #152334; --navy-meta: #AEBFD4; --radius: 2px;
  --font: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: ui-monospace, SFMono-Regular, Consolas, monospace;
}
* { box-sizing: border-box; }
/* The hidden attribute always wins over a component's display (.btn, .empty-box). */
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--canvas); color: var(--text); font: 400 13px/1.55 var(--font); -webkit-font-smoothing: antialiased; }
a { color: var(--action); text-decoration: none; }
a:hover { color: var(--action-hover); text-decoration: underline; }
/* Running text keeps underlined links (1.4.1: not colour alone). */
p a, li a, dd a, td a, figcaption a, .prose a { text-decoration: underline; text-underline-offset: 2px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; box-shadow: 0 0 0 2px #fff; }
img { max-width: 100%; height: auto; }
.wrap { max-width: 1240px; margin: 0 auto; padding: 0 24px; }
@media (max-width: 800px) { .wrap { padding: 0 14px; } }
.narrow { max-width: 640px; }
.prose { max-width: 80ch; }
h1, h2, h3 { color: var(--text); }
h1 { font-size: 27px; line-height: 1.2; font-weight: 700; letter-spacing: -.9px; margin: 5px 0 7px; }
h2 { font-size: 18px; line-height: 1.3; font-weight: 700; letter-spacing: -.3px; margin: 28px 0 8px; }
h3 { font-size: 15px; line-height: 1.35; font-weight: 700; margin: 20px 0 6px; }
@media (max-width: 800px) { h1 { font-size: 23px; } }
p { margin: 0 0 10px; }
.lead { font-size: 14px; line-height: 1.6; color: var(--text-2); }
.meta, .help { font-size: 12px; line-height: 1.5; color: var(--text-2); }
.footnote { font-size: 11px; line-height: 1.5; color: var(--text-2); }
.num, .mono { font-variant-numeric: tabular-nums; }
.mono, .receipt { font-family: var(--mono); }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -9999px; top: 8px; background: var(--surface); padding: 8px 12px; z-index: 50; border-radius: var(--radius); }
.skip:focus { left: 16px; }
.eyebrow { margin: 0 0 4px; color: var(--text-2); font: 11px/1.5 var(--mono); letter-spacing: .03em; text-transform: uppercase; }

/* header: midnight navy bar (58px) with the mark, pilot meta and the report button */
.site-header { background: var(--navy); color: #fff; }
.header-row { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 6px 30px; min-height: 58px; padding-top: 6px; padding-bottom: 6px; }
.wordmark { display: inline-flex; align-items: center; gap: 10px; color: #fff; font-size: 18px; font-weight: 700; letter-spacing: -.5px; text-decoration: none; min-height: 44px; }
.wordmark:hover { color: #fff; text-decoration: none; }
.wordmark .logo { width: 36px; height: 36px; flex: none; }
.headmeta { display: flex; gap: 20px; align-items: center; margin: 0; color: var(--navy-meta); font: 11px/1.5 var(--mono); letter-spacing: .03em; text-transform: uppercase; }
.site-header :focus-visible { box-shadow: 0 0 0 2px var(--navy); outline-color: #fff; }
/* header controls: language menu, theme control (System / Light / Dark) and,
   at 640px and narrower, the Menu. All share .hd-ctl (outlined, on navy).
   The theme control is hidden until theme.js has set data-theme. The
   drop-downs are <details class="hd-drop">; their lists (.hd-pop) float
   over the page, so opening one never makes the header taller. The Menu
   shows at 760px and narrower, where the tab strip is hidden. */
.head-actions { display: flex; align-items: center; gap: 8px; }
.hd-ctl { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; font: 400 13px/18px var(--font); color: #D5E2F4; background: transparent; border: 1px solid #62758E; border-radius: var(--radius); padding: 8px 10px; cursor: pointer; white-space: nowrap; }
.hd-ctl:hover { background: #263B53; }
.hd-ico { display: inline-flex; line-height: 1; }
.theme-ctl { display: none; padding: 0 0 0 9px; position: relative; }
:root[data-theme] .theme-ctl { display: inline-flex; }
.theme-select { appearance: none; font: inherit; color: inherit; background: transparent; border: 0; min-height: 34px; padding: 0 22px 0 0; cursor: pointer; }
.theme-ctl::after { content: "▾"; position: absolute; right: 8px; top: 50%; transform: translateY(-50%); pointer-events: none; font-size: 11px; }
.theme-select:focus-visible { outline: none; box-shadow: none; }
.theme-ctl:has(:focus-visible) { outline: 3px solid #fff; outline-offset: 2px; box-shadow: 0 0 0 2px var(--navy); }
.theme-select option { color: var(--text); background: var(--surface); }
.hd-drop { position: relative; }
.hd-drop > summary { list-style: none; }
.hd-drop > summary::-webkit-details-marker { display: none; }
.hd-drop > summary::after { content: "▾"; font-size: 11px; }
.hd-drop[open] > summary { background: #263B53; }
.hd-pop { position: absolute; top: calc(100% + 4px); left: 0; z-index: 60; min-width: 190px; padding: 4px 0; background: var(--surface); border: 1px solid var(--divider); border-radius: var(--radius); box-shadow: 0 6px 18px rgba(16, 25, 35, .22); }
.nav-menu .hd-pop { left: auto; right: 0; }
.hd-pop a { display: block; padding: 10px 14px; color: var(--text); font-size: 14px; line-height: 20px; text-decoration: none; white-space: nowrap; }
.hd-pop a:hover { background: var(--tint-blue); color: var(--text); text-decoration: none; }
.hd-pop a[aria-current] { color: var(--action); font-weight: 700; box-shadow: inset 3px 0 var(--action); }
.hd-pop a:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; box-shadow: none; }
.lang-code { display: none; }
.nav-menu { display: none; }

/* main navigation: left-aligned, content-width folder tabs on a grey strip.
   The tab for the current section carries aria-current ("page" on the tab's
   own page, "location" on a page inside its section). Below the width the
   tabs need, the strip scrolls sideways inside itself; nothing else does. */
.nav-tabs { background: var(--strip); border-bottom: 1px solid var(--divider); }
.nav-row { display: flex; gap: 3px; align-items: flex-end; padding-top: 5px; overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: thin; }
.nav-tabs a { flex: 0 0 auto; padding: 4px 11px; color: var(--text-2); background: var(--tab-bg); border: 1px solid var(--divider); border-bottom: 0; border-radius: 2px 2px 0 0; font-size: 12px; line-height: 18px; white-space: nowrap; text-decoration: none; }
.nav-tabs a:hover:not([aria-current]) { background: var(--surface); color: var(--text-2); text-decoration: none; }
.nav-tabs a[aria-current] { background: var(--tab-active); border-color: var(--tab-border); box-shadow: inset 0 2px var(--action); color: var(--action); font-weight: 700; }
.nav-tabs a[aria-current]:hover { color: var(--action); text-decoration: none; }
.nav-tabs a:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; box-shadow: none; }
.nav-tabs a[aria-current]:focus-visible { box-shadow: inset 0 2px var(--action); }
@media (max-width: 800px) { .nav-tabs a { padding: 4px 9px; } .headmeta { display: none; } }
/* 760px and narrower: the Menu replaces the tab strip, so no tab can scroll
   out of sight and the header gains no row. The report button stays. */
@media (max-width: 760px) {
  .nav-tabs { display: none; }
  /* The controls join the header row: language and Menu beside the
     wordmark, the theme control and report button wrap to a second row. */
  .header-row { justify-content: flex-end; column-gap: 8px; }
  .wordmark { margin-right: auto; }
  .head-actions { display: contents; }
  .lang-menu { order: 1; }
  .lang-menu .hd-pop { left: auto; right: 0; }
  .nav-menu { display: block; order: 2; }
  .theme-ctl { order: 3; }
  .btn-report { order: 4; }
}
@media (max-width: 420px) {
  .header-row { column-gap: 6px; }
  .wordmark { font-size: 15px; gap: 8px; }
  .wordmark .logo { width: 28px; height: 28px; }
  .site-header .btn-report { padding: 7px 9px; font-size: 12px; }
  .head-actions { gap: 5px; }
  .hd-ctl { padding: 7px 7px; font-size: 12px; gap: 4px; }
  .theme-ctl { padding: 0 0 0 7px; }
  .theme-ctl .hd-ico { display: none; }
  .hd-drop > summary::after { display: none; }
  .theme-select { padding-right: 16px; }
  .theme-ctl::after { right: 6px; }
  .lang-name { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .lang-code { display: inline; }
}
@media (max-width: 360px) { .nav-menu .hd-ico { display: none; } }
.demo-banner { background: var(--navy); border-top: 1px solid #2A3B52; color: #D6E8FF; font-size: 12px; line-height: 18px; padding: 6px 0; }
.demo-banner strong { color: #A3FFDF; }
main { overflow-wrap: break-word; }
main:focus { outline: none; }
.main-content { padding-top: 4px; padding-bottom: 30px; }

/* page intro (inner pages): the dashboard's compact intro, no band */
.page-hero { padding: 22px 0 8px; margin-bottom: 8px; }
.page-hero-inner { max-width: 860px; }
.page-hero h1 { margin: 5px 0 7px; }
.page-hero .lead, .page-hero p { margin: 0 0 6px; max-width: 75ch; color: var(--text-2); font-size: 13px; }

/* footer */
.site-footer { border-top: 1px solid var(--divider); padding: 16px 0 24px; font-size: 12px; color: var(--text-2); }
.footer-grid { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 24px; margin-bottom: 8px; }
.footer-brand { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; font-size: 13px; color: var(--text); text-decoration: none; min-height: 44px; }
.footer-brand:hover { color: var(--text); }
.footer-brand img { width: 28px; height: 28px; }
.site-footer nav { display: flex; flex-wrap: wrap; gap: 0 16px; }
.site-footer nav a { font-size: 12px; padding: 12px 0; }
/* language switcher: three flag links in the footer, above the legal line.
   .site-footer .lang-switch outranks the footer nav rules above. */
.site-footer .lang-switch { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 12px; }
.site-footer .lang-switch a { display: inline-flex; align-items: center; justify-content: center; min-width: 48px; min-height: 44px; padding: 4px 8px; border-radius: var(--radius); border: 1px solid transparent; line-height: 0; }
.site-footer .lang-switch a:hover { background: var(--surface); border-color: var(--divider); }
.site-footer .lang-switch svg { width: 27px; height: 18px; box-shadow: 0 0 0 1px rgba(15, 23, 42, .22); }
.site-footer .lang-switch a[aria-current="true"] { border-color: var(--action); background: var(--surface); box-shadow: inset 0 2px var(--action); }
.footer-legal { border-top: 1px solid var(--divider); padding-top: 12px; margin: 0; font-size: 11px; }

/* buttons and fields */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 36px; padding: 8px 14px; border-radius: var(--radius); font: 600 13px/18px var(--font); text-decoration: none; text-align: center; max-width: 100%; cursor: pointer; border: 1px solid transparent; margin: 0 8px 8px 0; }
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--action); border-color: var(--action); color: #fff; }
.btn-primary:hover { background: var(--action-hover); border-color: var(--action-hover); color: #fff; }
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--outline); }
.btn-secondary:hover { color: var(--text); background: #EEF2F7; }
.btn-link { background: none; color: var(--action); text-decoration: underline; padding-left: 4px; padding-right: 4px; }
.btn-danger { background: var(--err); border-color: var(--err); color: #fff; }
.btn[disabled] { opacity: .7; cursor: progress; }
.btn-block { display: flex; width: 100%; margin: 4px 0 8px; white-space: normal; text-align: center; }
.btn-report { margin: 0; padding: 9px 14px; white-space: nowrap; }
.btn-report::before { content: "+" / ""; font-weight: 700; }
.file-btn { cursor: pointer; }
input:focus-visible + .file-btn, #shot:focus + .file-btn { outline: 3px solid var(--focus); }
.field { margin: 0 0 16px; }
label { display: block; font-weight: 600; font-size: 13px; margin-bottom: 4px; }
.optional { font-weight: 400; color: var(--text-2); }
/* Fields keep 16px type so phones do not zoom on focus. */
input[type=text], input[type=tel], textarea, select { width: 100%; font: 400 16px/22px var(--font); color: var(--text); background: var(--surface); border: 1px solid var(--outline); border-radius: var(--radius); padding: 7px 10px; min-height: 40px; }
input[type=text]:focus, input[type=tel]:focus, textarea:focus, select:focus { border-color: var(--action); }
textarea { resize: vertical; }
[aria-invalid=true] { border-color: var(--err); border-width: 2px; }
.field-error { color: var(--err); font-size: 13px; line-height: 18px; margin: 4px 0 0; font-weight: 600; }
.help { margin: 0 0 6px; }

/* notices */
.notice { border-radius: var(--radius); padding: 10px 12px; margin: 12px 0; border: 1px solid; }
.notice > :last-child { margin-bottom: 0; }
.notice h1, .notice h2 { margin-top: 4px; }
.notice-error { color: var(--err); background: var(--err-bg); border-color: var(--err); }
.notice-success { color: var(--ok); background: var(--ok-bg); border-color: var(--ok); }
.notice-success h1 { color: var(--ok); }
.notice-info { background: var(--tint-blue); border-color: #C9D8EF; border-left: 3px solid var(--action); }
.notice-warning, .geo-warning { color: var(--warn); background: var(--warn-bg); border-color: var(--warn); }
.geo-warning { border: 0; border-left: 3px solid var(--warn); border-radius: 0; padding: 10px 12px; margin: 0; font-size: 12px; line-height: 18px; }
.geo-warning p { margin: 0; }
.terms { font-size: 13px; line-height: 19px; border-left: 3px solid var(--action); background: var(--tint-blue); padding: 10px 12px; }
.note-warn { border-left: 3px solid #B98B46; background: #FBF8F1; padding: 10px 12px; font-size: 12px; color: #675330; margin: 0 0 12px; }

/* panels and cards */
.panel { background: var(--surface); border: 1px solid var(--divider); border-radius: var(--radius); padding: 16px; margin: 0 0 16px; }
.scrubbed { white-space: pre-wrap; overflow-wrap: anywhere; }
.scrubbed.panel { background: var(--tint); border-color: var(--divider); border-left: 3px solid #8BA4C6; font: 12px/1.7 var(--mono); }
.ai-prompt { max-height: 12rem; overflow-y: scroll; margin-top: 8px; font-size: 12px; touch-action: pan-y; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: var(--outline) transparent; }
.ai-prompt::-webkit-scrollbar { width: 10px; }
.ai-prompt::-webkit-scrollbar-track { background: transparent; }
.ai-prompt::-webkit-scrollbar-thumb { background: var(--outline); border-radius: 5px; border: 2px solid var(--tint); }
.ai-prompt-wrap { position: relative; }
.ai-copy-icon { position: absolute; top: 8px; right: 8px; display: flex; align-items: center; justify-content: center; width: 32px; height: 32px; padding: 0; background: var(--surface); border: 1px solid var(--divider); border-radius: var(--radius); cursor: pointer; }
.ai-copy-icon:hover { background: var(--tint); }
.ai-copy-icon svg { display: block; }
.ai-copy { display: flex; flex-wrap: wrap; align-items: center; gap: 0 8px; }
.dl { display: grid; grid-template-columns: minmax(8em, max-content) 1fr; gap: 6px 16px; margin: 0 0 12px; }
.dl dt { font-weight: 700; } .dl dd { margin: 0; overflow-wrap: anywhere; }
.dl.compact { font-size: 12px; line-height: 18px; }
.receipt { font-size: 18px; line-height: 26px; background: var(--surface); border: 2px dashed var(--outline); padding: 12px 14px; border-radius: var(--radius); user-select: all; overflow-wrap: anywhere; }
.stored-receipts { background: var(--surface); border: 1px solid var(--divider); border-radius: var(--radius); padding: 14px 16px; margin: 16px 0; }
.stored-receipts h2 { margin-top: 0; font-size: 14px; }
.stored-receipts-list { list-style: none; padding: 0; margin: 0 0 12px; }
.stored-receipts-list li { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--rule); }
.stored-receipts-forget { margin-top: 8px; }
.choice { display: grid; gap: 16px; }
@media (min-width: 640px) { .choice { grid-template-columns: 1fr 1fr; } }
.choice-item { background: var(--surface); border: 1px solid var(--divider); border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; }
.choice-item h2 { margin: 12px 0 6px; font-size: 14px; line-height: 1.3; }
.choice-item .btn { width: 100%; margin-top: auto; }
.icon-box { width: 36px; height: 36px; border: 1px solid #D2DCE8; background: #F2F6FC; color: var(--action); display: grid; place-items: center; flex: none; }
.icon-box svg { width: 20px; height: 20px; }
.icon-box.teal { color: var(--teal-text); }

/* dashboard panel (kit .panel): head row with index, heading and tag, then body */
.card { background: var(--surface); border: 1px solid var(--divider); min-width: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--divider); background: var(--panel-head); }
.card-head h2 { font-size: 14px; line-height: 1.4; margin: 0; letter-spacing: 0; }
.card-index { font: 11px var(--mono); color: var(--text-2); margin-right: 8px; }
.card-body { padding: 15px 16px; }
.card-body > :last-child { margin-bottom: 0; }
.card-foot { padding: 10px 16px 12px; border-top: 1px solid var(--rule); }
.card-foot p { margin: 0 0 4px; }
.tag { flex: none; font: 10px/1.4 var(--mono); letter-spacing: .04em; text-transform: uppercase; border: 1px solid #D8E0E9; color: #536479; padding: 4px 7px; background: #F4F6F9; }

/* report and delete flows: each step sits in one panel */
#report-app, #delete-page { max-width: 760px; margin: 16px auto 0; }
#report-app > section[data-step], #delete-page { background: var(--surface); border: 1px solid var(--divider); border-radius: var(--radius); padding: 18px 16px; }
@media (min-width: 640px) { #report-app > section[data-step], #delete-page { padding: 22px 24px; } }
#report-app > section[data-step] > h1:first-child, #delete-page > h1:first-child { margin-top: 0; }
#report-app section[data-step="start"] { background: transparent; border: 0; padding: 0; }
#report-app section[data-step] h2 { font-size: 15px; margin-top: 22px; }
#report-app .choice-item h2 { margin-top: 12px; }
.remove-more { margin: 8px 0 16px; }
.remove-more summary { cursor: pointer; font-weight: 700; color: var(--action); padding: 10px 0; min-height: 44px; }
.reporter-path { border-top: 1px solid var(--divider); margin-top: 20px; }

/* overview: the data-first dashboard */
.dash { padding-top: 22px; padding-bottom: 30px; }
.dash-intro { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 18px; }
.dash-intro .lead { font-size: 13px; margin: 5px 0; }
/* hero entry point: the first report button with what filing does beside it */
.hero-cta { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 8px 16px; margin: 12px 0 0; max-width: 820px; }
.hero-btn { margin: 0; flex: none; }
.hero-why { flex: 1 1 300px; min-width: 0; }
.hero-why p { margin: 0 0 5px; }
.hero-why p:first-child { font-size: 13px; line-height: 1.55; color: var(--text); }
.dash-status { text-align: left; }
.dash-status p { margin: 0; }
.status { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; color: #37604F; }
.dot { width: 7px; height: 7px; background: #428569; display: inline-block; }
.range-mono { font-size: 11px; color: var(--text-2); letter-spacing: .03em; text-transform: uppercase; }
.kpis { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border: 1px solid var(--divider); background: var(--surface); margin-bottom: 16px; }
.kpi { padding: 15px 20px; border-right: 1px solid var(--divider); min-width: 0; overflow-wrap: anywhere; }
.kpi:last-child { border-right: 0; }
.kpi p { margin: 0; }
.kpi-num { font: 600 34px/1.3 var(--mono); letter-spacing: -2px; color: var(--text); }
.kpi-sub { font-size: 11px; color: var(--text-2); }
.dash-grid { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.dash-stack { display: grid; gap: 16px; min-width: 0; }
.dash .card h3 { font-size: 13px; margin: 0 0 8px; }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; padding: 10px 16px; border-top: 1px solid var(--rule); border-bottom: 1px solid var(--divider); }
.filters { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; margin: 0; }
.filters label { margin: 0; font-size: 12px; }
.filters select { width: auto; min-height: 32px; padding: 3px 8px; font-size: 13px; }
.filters .btn { margin: 0; min-height: 32px; padding: 6px 11px; }
.filters .mono { font-size: 11px; color: var(--text-2); letter-spacing: .03em; text-transform: uppercase; }
.count-block { font-size: 13px; }
.count-block .big { font: 600 15px/1.4 var(--mono); }
.big { font: 600 22px/1.3 var(--mono); letter-spacing: -.5px; color: var(--text); }
/* view switch (Table / Distribution / Map): a segmented control of links */
.tabs { display: inline-flex; flex-wrap: wrap; margin: 0; }
.tabs a { display: inline-flex; align-items: center; min-height: 32px; padding: 6px 11px; border: 1px solid var(--divider); background: var(--surface); color: var(--text-2); text-decoration: none; }
.tabs a + a { border-left: 0; }
.tabs a:hover { color: var(--action-hover); text-decoration: none; background: var(--tint); }
.tabs a[aria-current] { background: var(--seg-active); color: var(--action); font-weight: 600; }
.tabs a:focus-visible { outline-offset: -3px; box-shadow: none; }
.views-wrap { container: views / inline-size; }
.views > * { min-width: 0; }
.view { padding: 14px 16px; }
.view-table { padding: 0; overflow-x: auto; }
#map-h, #chart-h { margin-top: 0; }
.dash .detail.panel { margin: 12px 16px 0; }
.map-links { margin: 0 0 8px; }
.map-links a { display: inline-block; padding: 10px 0; font-weight: 600; }
.map-summary { font-size: 15px; line-height: 22px; margin: 0 0 4px; }
.map-key { margin: 0 0 12px; }
/* distribution: one row per state or DC, bar length relative to the largest */
.dist { list-style: none; margin: 0 0 8px; padding: 0; }
.dist-row { display: grid; grid-template-columns: minmax(90px, 160px) minmax(0, 1fr) 3em; gap: 10px; align-items: center; padding: 5px 0; }
.dist-row.selected a { font-weight: 700; }
.dist-row .num { text-align: right; font-family: var(--mono); }
.track { display: block; width: 100%; height: 12px; background: #EDF1F6; }
.track rect { fill: #7799CE; }
.bar { display: inline-block; vertical-align: middle; margin-right: 9px; }
.bar rect { fill: #99B5DF; }
.report-card .btn-block { margin-top: 12px; }
.checks { list-style: none; padding: 0; margin: 12px 0; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; font-size: 12px; }
.checks li::before { content: "✓" / ""; color: #39765C; margin-right: 6px; }
.links { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 0 14px; }
.links a { display: inline-block; padding: 6px 0; }
.sources { margin-top: 18px; }
.sources h2 { margin: 0 0 4px; color: var(--text-2); font: 11px/1.5 var(--mono); letter-spacing: .03em; text-transform: uppercase; }
.sources ul { margin: 0; padding-left: 18px; font-size: 11px; }
@media (max-width: 800px) {
  .dash-grid { grid-template-columns: minmax(0, 1fr); }
  .dash-intro { align-items: flex-start; flex-direction: column; gap: 10px; }
  .kpi { padding: 10px; }
  .kpi-num { font-size: 28px; }
}
@media (max-width: 420px) {
  .kpi .eyebrow { font-size: 9px; }
  .checks { grid-template-columns: minmax(0, 1fr); }
  .dist-row { grid-template-columns: minmax(70px, 110px) minmax(0, 1fr) 2.5em; gap: 8px; }
}

/* Map: a fluid 12 x 8 tile grid in three steps of panel content width. Both
   the grid and the state list are server-rendered; no JS.
   - 286 px: 12 x 22 px tiles + 11 x 2 px gaps. A 24 px pitch meets the
     WCAG 2.5.8 target-spacing rule. A 360 px phone gives a 298 px panel.
   - 480 px: 3 px gaps, 40 px rows, 12/13 px type.
   - 716 px: the desktop sizing (12 x 56 px + 11 x 4 px), 14/16 px type.
   Below 286 px (a 320 px phone, or heavy zoom) the state list is shown. */
.map-body { container: mapbody / inline-size; }
.tile-grid { display: none; }
.state-list { list-style: none; margin: 0 0 12px; padding: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; }
.gc1 { grid-column: 1; } .gc2 { grid-column: 2; } .gc3 { grid-column: 3; } .gc4 { grid-column: 4; } .gc5 { grid-column: 5; } .gc6 { grid-column: 6; }
.gc7 { grid-column: 7; } .gc8 { grid-column: 8; } .gc9 { grid-column: 9; } .gc10 { grid-column: 10; } .gc11 { grid-column: 11; } .gc12 { grid-column: 12; }
.gr1 { grid-row: 1; } .gr2 { grid-row: 2; } .gr3 { grid-row: 3; } .gr4 { grid-row: 4; } .gr5 { grid-row: 5; } .gr6 { grid-row: 6; } .gr7 { grid-row: 7; } .gr8 { grid-row: 8; }
/* Tile structure; sizes and type come from the width steps below. */
.tile { position: relative; display: flex; flex-direction: column; justify-content: center; min-width: 0; text-decoration: none; border: 1px solid transparent; }
a.tile { border-color: var(--outline); }
a.tile:hover { text-decoration: underline; }

/* One palette for tile fills, list swatches and legend swatches. */
.bin0 { background: var(--bin0); color: var(--bin0-text); }
.bin1 { background: var(--bin1); color: var(--bin-text-light); }
.bin2 { background: var(--bin2); color: var(--bin-text-light); }
.bin3 { background: var(--bin3); color: var(--bin-text-dark); }
.bin4 { background: var(--bin4); color: var(--bin-text-dark); }
a.tile.bin1:hover, a.tile.bin2:hover { color: var(--bin-text-light); }
a.tile.bin3:hover, a.tile.bin4:hover { color: var(--bin-text-dark); }

/* Focus: distinct outer outline (global :focus-visible). Selected: inset
   border plus a check mark. Both can show at once. */
.tile.selected, .state-row.selected { box-shadow: inset 0 0 0 3px var(--text), inset 0 0 0 5px #fff; }
.tile.selected:focus-visible, .state-row.selected:focus-visible { box-shadow: 0 0 0 2px #fff, inset 0 0 0 3px var(--text), inset 0 0 0 5px #fff; }
.sel-mark { position: absolute; top: 4px; right: 7px; font: 700 14px/18px var(--font); }
.state-row { position: relative; display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 10px 14px; border: 1px solid var(--divider); border-radius: var(--radius); background: var(--surface); color: var(--text); text-decoration: none; }
.state-row:hover { border-color: var(--action); color: var(--action-hover); background: var(--tint); }
.state-row .swatch { flex: none; }
.sl-name { flex: 1; min-width: 0; font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
.sl-sep { display: none; }
.sl-count { text-align: right; white-space: nowrap; color: var(--text-2); }
.state-row.selected { padding-right: 34px; font-weight: 600; }
.state-row .sel-mark { top: 50%; transform: translateY(-50%); right: 12px; }

/* Width steps (after the base tile and selection rules, which they override). */
@container mapbody (min-width: 286px) {
  .tile-grid { display: grid; grid-template-columns: repeat(12, minmax(22px, 1fr)); grid-template-rows: repeat(8, minmax(30px, auto)); gap: 2px; margin: 0 0 12px; }
  .state-list { display: none; }
  .tile { min-width: 22px; min-height: 30px; padding: 2px 1px; border-radius: 2px; align-items: center; text-align: center; }
  .tile-abbr { font: 600 10px/12px var(--font); }
  .tile-count { font: 700 10px/12px var(--font); font-variant-numeric: tabular-nums; }
  .tile .sel-mark { top: 0; right: 1px; font: 700 8px/10px var(--font); }
  .tile.selected { box-shadow: inset 0 0 0 2px var(--text), inset 0 0 0 3px #fff; }
  .tile.selected:focus-visible { box-shadow: 0 0 0 2px #fff, inset 0 0 0 2px var(--text), inset 0 0 0 3px #fff; }
}
@container mapbody (min-width: 480px) {
  .tile-grid { grid-template-columns: repeat(12, minmax(36px, 1fr)); grid-template-rows: repeat(8, minmax(40px, auto)); gap: 3px; }
  .tile { min-width: 36px; min-height: 40px; padding: 3px 2px; border-radius: 2px; }
  .tile-abbr { font: 600 12px/16px var(--font); }
  .tile-count { font: 700 13px/16px var(--mono); font-variant-numeric: tabular-nums; }
  .tile .sel-mark { top: 1px; right: 3px; font: 700 10px/12px var(--font); }
}
@container mapbody (min-width: 716px) {
  .tile-grid { grid-template-columns: repeat(12, minmax(56px, 1fr)); grid-template-rows: repeat(8, minmax(56px, auto)); gap: 4px; }
  .tile { min-width: 56px; min-height: 56px; padding: 4px 6px; border-radius: 2px; align-items: stretch; text-align: left; }
  .tile-abbr { font: 600 14px/18px var(--font); }
  .tile-count { font: 700 16px/20px var(--mono); font-variant-numeric: tabular-nums; }
  .tile .sel-mark { top: 4px; right: 7px; font: 700 14px/18px var(--font); }
  .tile.selected { box-shadow: inset 0 0 0 3px var(--text), inset 0 0 0 5px #fff; }
  .tile.selected:focus-visible { box-shadow: 0 0 0 2px #fff, inset 0 0 0 3px var(--text), inset 0 0 0 5px #fff; }
}

.legend ul { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 12px; }
.swatch { display: inline-block; width: 14px; height: 14px; border: 1px solid var(--outline); vertical-align: -3px; margin-right: 6px; }
.state-row .swatch { margin-right: 0; }
.table-scroll { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; background: var(--surface); font-size: 13px; line-height: 19px; }
.data-table caption { text-align: left; font-size: 12px; color: var(--text-2); padding: 4px 0 8px; }
.data-table th, .data-table td { text-align: left; padding: 9px 16px; border-bottom: 1px solid var(--rule); vertical-align: top; }
.data-table thead th { font-size: 11px; font-weight: 600; color: var(--text-2); background: var(--canvas); }
.data-table th a { color: var(--text-2); }
.data-table .num { text-align: right; white-space: nowrap; }
.data-table tr.selected td { background: #EEF3FB; font-weight: 600; }
.view-table .data-table caption { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.view-table td:first-child, .view-table td.num { font-family: var(--mono); }
.prose .data-table { margin: 8px 0 20px; border: 1px solid var(--divider); }
.prose .data-table th, .prose .data-table td { padding: 8px 12px; }
.prose .data-table tr:last-child td { border-bottom: 0; }
.stack-region { display: none; }
@media (max-width: 400px) { .data-table th, .data-table td { padding: 8px 8px; } .panel { padding: 12px; } .view { padding: 12px; } .view-table { padding: 0; } }
@media (max-width: 600px) { .col-region { display: none; } .stack-region { display: block; font-family: var(--font); font-size: 12px; color: var(--text-2); } }
/* State detail: area codes as chips. */
.code-list { list-style: none; padding: 0; margin: 0 0 12px; display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 6px; }
.code-list li { padding: 8px 12px; border: 1px solid var(--divider); background: var(--tint); display: flex; justify-content: space-between; gap: 8px; }
.code-list a { font-weight: 700; }
.empty { color: var(--text-2); padding: 8px 0; }
.detail.panel { border-color: var(--tab-border); background: var(--tint-blue); }
.detail h3 { margin-top: 0; }

/* patterns */
.pattern-list { list-style: none; padding: 0; display: grid; gap: 12px; }
.pattern.panel { padding: 16px; }
/* recurring scripts (home) */
.scripts { margin: 0; }
.script-list { list-style: none; padding: 0; margin: 0 0 12px; display: grid; gap: 8px; }
.script-list li { padding: 10px 12px; background: var(--surface); border: 1px solid var(--divider); }
.script-list .meta { display: block; }
.correction { margin: 12px 0; }
.pattern h2 { margin-top: 0; font-size: 15px; line-height: 1.3; }
.badge { display: inline-block; font: 10px/1.4 var(--mono); letter-spacing: .04em; text-transform: uppercase; padding: 4px 7px; border: 1px solid #D8E0E9; background: #F4F6F9; color: #536479; margin: 0 0 10px; }
.skeleton { font-size: 12px; }
.empty-box { display: grid; gap: 8px 24px; align-items: center; background: #F8FAFC; border: 1px dashed #CCD6E1; padding: 18px 15px; margin: 12px 0 15px; }
.empty-box img { display: block; width: 100%; max-width: 260px; margin: 0 auto; }
.empty-box .empty { padding: 0; margin: 0; }
.empty-box p { margin: 0 0 6px; }
.empty-cta { margin: 0 0 6px; font-size: 13px; color: var(--text-2); }
.empty-cta strong { display: block; font-size: 14px; color: var(--text); margin-bottom: 2px; }
.empty-box .btn { margin: 0; }
.example-script { margin: 0 0 12px; }
.example-script figcaption { font-size: 11px; line-height: 1.5; color: var(--text-2); margin: 0 0 6px; }
.example-label { margin-right: 6px; font: 11px/1.5 var(--mono); letter-spacing: .03em; text-transform: uppercase; color: var(--text-2); }
.example-script .scrubbed { margin: 0; }
.sample { background: var(--tint); border-left: 3px solid #8BA4C6; padding: 12px; margin: 10px 0; font: 12px/1.7 var(--mono); color: var(--text); overflow-wrap: anywhere; }
@media (min-width: 720px) { .empty-box:has(img) { grid-template-columns: 220px 1fr; padding: 20px 24px; } }
.status-mark { display: inline-block; margin: 0 0 8px; padding: 3px 7px; border: 1px solid #D8D0EE; background: #F4F0FF; color: #5E4A9E; font: 10px/1.4 var(--mono); letter-spacing: .04em; text-transform: uppercase; }
.process-graphic { display: block; width: 100%; max-width: 660px; border: 1px solid var(--divider); margin: 0 0 8px; }
.rules-version { font-size: 13px; }

/* processing pipeline (home): five numbered steps, one per row */
.how { margin: 0; }
.flow-steps { list-style: none; padding: 0; margin: 0 0 10px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 0; }
.flow-step { display: grid; grid-template-columns: 27px minmax(0, 1fr); column-gap: 10px; align-content: start; padding: 10px 0; border-bottom: 1px solid var(--rule); }
.flow-step:first-child { padding-top: 0; }
.flow-step:last-child { border-bottom: 0; }
.flow-num { grid-row: span 2; display: grid; place-items: center; height: 24px; border: 1px solid #D2DCE8; background: #F2F6FC; color: var(--action); font: 11px var(--mono); }
.flow-title { font-size: 13px; line-height: 1.4; }
.flow-text { color: var(--text-2); font-size: 12px; line-height: 1.5; }

/* long-form pages */
.prose h2 { padding-top: 4px; }
.prose ul, .prose ol { padding-left: 20px; }
.prose li { margin: 3px 0; }
.prose > .notice:first-child { margin-top: 0; }
.prose pre, .prose code { overflow-wrap: anywhere; white-space: pre-wrap; }

/* opt-out center (/opt-out): breadcrumb, jump links, callout, progress,
   directory (table on wide screens, compact cards on narrow ones), the two
   generators side by side on desktop. Colours come from the theme tokens
   above, so the dark theme needs no extra rules here. */
input[type=search] { width: 100%; font: 400 16px/22px var(--font); color: var(--text); background: var(--surface); border: 1px solid var(--outline); border-radius: var(--radius); padding: 7px 10px; min-height: 40px; }
input[type=search]:focus { border-color: var(--action); }
.breadcrumb ol { list-style: none; display: flex; flex-wrap: wrap; margin: 0; padding: 0; }
.breadcrumb li + li::before { content: "/" / ""; margin: 0 6px; }
.breadcrumb [aria-current] { color: var(--text); }
.optout .prose { max-width: 86ch; }
.jump { margin: 14px 0 4px; border-top: 1px solid var(--divider); border-bottom: 1px solid var(--divider); }
.jump ul { list-style: none; display: flex; flex-wrap: wrap; gap: 0 16px; margin: 0; padding: 4px 0; }
.jump li { margin: 0; }
.jump a { display: inline-block; padding: 6px 0; font-size: 12px; }
.intro-checks { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); font-size: 13px; }
.safety-table th[scope=row] { font-weight: 600; width: 34%; }
.quick-start li { margin: 6px 0; }
.callout { background: var(--surface); border: 1px solid var(--tab-border); border-left: 3px solid var(--action); padding: 2px 16px 10px; margin: 22px 0; }
.callout h2 { margin-top: 12px; }
.progress-kpis { margin: 0 0 12px; }
.progress-kpis dt, .progress-kpis dd { margin: 0; }
.progress-line { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.progress-line label { margin: 0; }
progress { width: min(320px, 100%); height: 10px; accent-color: var(--action); }
.dir-tools { padding: 12px 14px 4px; margin: 12px 0; }
.dir-filters { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 0 12px; }
.dir-filters .field { margin: 0 0 10px; min-width: 0; }
.dir-filters .dir-search { grid-column: 1 / -1; }
@media (min-width: 1000px) { .dir-filters { grid-template-columns: repeat(4, minmax(0, 1fr)); } .dir-filters .dir-search { grid-column: span 2; } }
.dir-filters label { font-size: 12px; }
.dir-filters select { font-size: 13px; min-height: 36px; padding: 5px 8px; }
/* search and location lead; everything else is under More filters */
.dir-filters.dir-main { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.dir-filters.dir-main .dir-search { grid-column: auto; }
@media (max-width: 560px) { .dir-filters.dir-main { grid-template-columns: minmax(0, 1fr); } }
.dir-more { margin: 0 0 10px; border-top: 1px solid var(--rule); }
.dir-more > summary { cursor: pointer; font-weight: 600; color: var(--action); padding: 8px 0; min-height: 36px; }
.dir-more[open] > summary { margin-bottom: 4px; }
.dir-safety { margin: 0 0 10px; }
.dir-empty-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.dir-empty-actions .btn { margin: 0; }
.dir-count-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 12px; margin: 0 0 6px; }
.dir-count-row .btn { margin: 0; min-height: 32px; padding: 6px 11px; }
.dir-scroll { border: 1px solid var(--divider); background: var(--surface); }
.dir-table { font-size: 12px; line-height: 17px; }
.dir-table caption { padding: 8px 12px; }
.dir-table th, .dir-table td { padding: 8px 12px; }
.dir-table tbody th[scope=row] { font-weight: 400; min-width: 15em; }
.dir-table thead th { white-space: nowrap; }
.dir-table tr[hidden] { display: none; }
.dir-name { display: block; font-size: 13px; font-weight: 700; color: var(--text); }
.dir-covers, .dir-check { display: block; }
.dir-check { margin: 2px 0; }
.dir-check .dir-cat { margin-right: 4px; }
.dir-check .meta:last-child { white-space: nowrap; }
.dir-table select.prog { width: auto; min-width: 11.5em; min-height: 32px; padding: 3px 6px; font-size: 12px; }
.dir-cost { white-space: nowrap; }
.dir-link { min-width: 12em; }
.dir-details summary { cursor: pointer; color: var(--action); font-size: 12px; padding: 4px 0; min-height: 24px; }
.dir-details .dl { grid-template-columns: minmax(7em, max-content) minmax(0, 1fr); gap: 4px 12px; margin: 6px 0 4px; max-width: 60ch; }
.vstatus { display: inline-block; font: 10px/1.4 var(--mono); letter-spacing: .04em; text-transform: uppercase; padding: 2px 6px; border: 1px solid; }
.vstatus-verified { color: var(--ok); background: var(--ok-bg); }
.vstatus-source-confirmed { color: var(--action); background: var(--tint-blue); }
.vstatus-restricted, .vstatus-needs-review { color: var(--warn); background: var(--warn-bg); }
.vstatus-discontinued { color: var(--err); background: var(--err-bg); }
.vstatus-pending-review { color: var(--text-2); background: var(--tint); }
.backlog { margin: 12px 0 0; }
.backlog summary, .ai-orgs summary { cursor: pointer; font-weight: 600; color: var(--action); padding: 8px 0; min-height: 36px; }
.backlog-list { columns: 2 220px; padding-left: 18px; font-size: 12px; margin: 0; }
.tools-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; align-items: start; margin: 26px 0 8px; }
@media (min-width: 1000px) { .tools-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }
.tool .card-head h2 { font-size: 15px; }
.tool-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0 4px; }
.tool-notes { padding-left: 18px; margin: 12px 0 0; }
.tool-notes li { margin: 4px 0; }
.email-body { max-height: 18rem; overflow-y: auto; margin: 8px 0; }
.btn.copy-btn[disabled] { cursor: not-allowed; opacity: .55; }
fieldset { border: 1px solid var(--divider); border-radius: var(--radius); padding: 6px 12px 4px; margin: 0 0 14px; min-width: 0; }
legend { font-weight: 600; padding: 0 4px; }
.check { display: flex; align-items: flex-start; gap: 8px; font-weight: 400; margin: 0 0 4px; min-height: 24px; }
.check input { flex: none; width: 16px; height: 16px; margin: 2px 0 0; accent-color: var(--action); }
.ai-cats, .ai-orgs-group { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 0 12px; }
.ai-orgs-group { margin-top: 6px; }
@media (max-width: 760px) {
  /* Directory rows become compact cards; each cell shows its column name. */
  .dir-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .dir-table caption { display: block; text-align: left; }
  .dir-table, .dir-table tbody, .dir-table tr, .dir-table td, .dir-table tbody th { display: block; width: 100%; }
  .dir-table tr { border-bottom: 1px solid var(--divider); padding: 6px 0; }
  .dir-table td, .dir-table tbody th[scope=row] { border: 0; padding: 4px 12px; min-width: 0; }
  .dir-table td[data-label]::before { content: attr(data-label); display: block; font: 10px/1.4 var(--mono); letter-spacing: .03em; text-transform: uppercase; color: var(--text-2); }
  .dir-table select.prog { font-size: 16px; min-height: 40px; }
  .dir-link { min-width: 0; }
  .safety-table th[scope=row] { width: auto; }
}

/* ---- dark theme (dual-theme kit) ----------------------------------------
   Set by /static/js/theme.js: the system preference until the visitor picks a
   theme with the header theme control. Kit tokens: bg #0D131C, panel #151E29, ink
   #E2E9F2, muted #A4B3C6, line #303E50, blue #83B4FF, nav #101923. The tokens
   the kit has no value for (errors, success, map area, input outlines) are
   chosen for the same WCAG AA pairs as the light theme (test/theme.test.ts).
   The map bins keep their light-theme colors, so the legend reads the same in
   both themes. Light-theme rules above are untouched. */
:root[data-theme="dark"] {
  color-scheme: dark;
  --canvas: #0D131C; --surface: #151E29; --text: #E2E9F2; --text-2: #A4B3C6;
  --divider: #303E50; --rule: #303E50; --outline: #7088A6; --action: #83B4FF; --action-hover: #A9CDFF;
  --focus: #A9CDFF; --err: #FF9B9B; --err-bg: #3A1A1D; --ok: #8BD3AE; --ok-bg: #12291F;
  --warn: #E5C891; --warn-bg: #30291D; --map-bg: #111A25;
  --strip: #111A25; --tab-bg: #192431; --tab-active: #203B60; --tab-border: #45658F; --seg-active: #20344E;
  --tint: #111A25; --tint-blue: #172A40; --panel-head: #192431; --teal-text: #6FD6CC;
  --navy: #101923;
}
/* focus: the gap between ring and control is the dark canvas, not white */
:where([data-theme="dark"]) :focus-visible { box-shadow: 0 0 0 2px var(--canvas); }
/* header and folder tabs */
[data-theme="dark"] .hd-ctl:hover, [data-theme="dark"] .hd-drop[open] > summary { background: #253549; }
[data-theme="dark"] .nav-tabs a:hover:not([aria-current]) { background: #253549; }
[data-theme="dark"] .nav-tabs a[aria-current], [data-theme="dark"] .nav-tabs a[aria-current]:hover { color: #B5D3FF; }
[data-theme="dark"] .demo-banner { border-top-color: #253549; }
/* buttons: filled buttons keep a dark fill so white text stays AA */
[data-theme="dark"] .btn-primary { background: #2458B5; border-color: #477AC9; color: #fff; }
[data-theme="dark"] .btn-primary:hover { background: #194795; border-color: #477AC9; color: #fff; }
[data-theme="dark"] .btn-danger { background: #B02A2A; border-color: #B02A2A; color: #fff; }
[data-theme="dark"] .btn-secondary:hover { background: #253549; }
/* segmented view switch (Table / Distribution / Map) */
[data-theme="dark"] .tabs a[aria-current] { color: #A9CDFF; border-color: #405A7C; }
/* panels, tags, empty states, samples, step numbers */
[data-theme="dark"] .tag, [data-theme="dark"] .badge { background: #1D2B3A; border-color: #374B62; color: #B6C6DA; }
[data-theme="dark"] .empty-box { background: #111A25; border-color: #40536A; }
[data-theme="dark"] .sample, [data-theme="dark"] .scrubbed.panel { border-left-color: #6386B4; }
[data-theme="dark"] .flow-num, [data-theme="dark"] .icon-box { background: #20344E; border-color: #405A7C; color: #A9CDFF; }
[data-theme="dark"] .icon-box.teal { color: var(--teal-text); }
[data-theme="dark"] .status-mark { background: #241F38; border-color: #4A3F73; color: #C9B8FF; }
[data-theme="dark"] .status, [data-theme="dark"] .checks li::before { color: #8BD3AE; }
[data-theme="dark"] .dot { background: #69B993; }
/* notices */
[data-theme="dark"] .note-warn { background: #30291D; color: #E5C891; border-left-color: #B98B46; }
[data-theme="dark"] .notice-info { border-color: #405A7C; border-left-color: var(--action); }
/* tables, bars and distribution tracks */
[data-theme="dark"] .data-table tr.selected td { background: #1D3150; }
[data-theme="dark"] .track { background: #263345; }
[data-theme="dark"] .track rect, [data-theme="dark"] .bar rect { fill: #779FDB; }
/* map: tiles keep the light bins, so the selected-tile ring stays dark-on-light */
[data-theme="dark"] .tile { --text: #172333; }
[data-theme="dark"] .state-row.selected { box-shadow: inset 0 0 0 3px var(--text), inset 0 0 0 5px var(--surface); }
[data-theme="dark"] .state-row.selected:focus-visible { box-shadow: 0 0 0 2px var(--canvas), inset 0 0 0 3px var(--text), inset 0 0 0 5px var(--surface); }
/* the illustrations draw their own light card; dim it a little against the dark page */
[data-theme="dark"] .process-graphic, [data-theme="dark"] .empty-box img { filter: brightness(.9); }
[data-theme="dark"] .site-footer .lang-switch svg { box-shadow: 0 0 0 1px rgba(226, 233, 242, .35); }

@media (forced-colors: active) {
  .btn { border: 2px solid ButtonText; }
  .tile { border: 1px solid GrayText; color: GrayText; }
  a.tile, .state-row { border: 2px solid LinkText; color: LinkText; }
  .tile.selected, .state-row.selected { border: 4px solid Highlight; }
  .sel-mark { color: Highlight; }
  :focus-visible { outline: 3px solid CanvasText; }
  .swatch { forced-color-adjust: none; border-color: CanvasText; }
  .geo-warning, .notice, .note-warn { border: 2px solid CanvasText; }
  .panel, .card, .kpis, .choice-item, .empty-box, #report-app > section[data-step], #delete-page { border: 1px solid CanvasText; }
  .tabs a[aria-current], .nav-tabs a[aria-current] { border: 2px solid Highlight; }
  .hd-pop { border: 1px solid CanvasText; }
  .hd-pop a[aria-current] { border-left: 3px solid Highlight; }
  .bar rect, .track rect { fill: CanvasText; }
  .track { border: 1px solid CanvasText; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
.nowrap { white-space: nowrap; }
