/* Screens: Matrix, Review, Registry, Health, Audit, Replay. Tokens come from live.css. */

.tabs { display: flex; gap: var(--space-1); flex-wrap: wrap; margin: var(--space-2) 0; border-bottom: var(--border) solid var(--line); padding-bottom: var(--space-2); }
.stubs { font-size: var(--text-sm); color: var(--muted); margin: 0 0 var(--space-2); line-height: 2.1; }
/* The box scrolls both ways, so the sticky headers inside it stay put while its rows scroll. */
.scroll { overflow: auto; max-height: calc(100dvh - 12rem); }
code.json { display: block; max-width: 38ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; background: none; padding: 0; }
.badge-flag { background: transparent; color: var(--ink); border-color: var(--ink-2); }

/* ---------- shared: UTC switch, chips, posts ---------- */
.utc-switch { display: inline-flex; align-items: center; min-height: var(--target); gap: var(--space-2); margin-left: auto; font-size: var(--text-sm); color: var(--ink-2); cursor: pointer; }
.utc-switch input { width: 16px; height: 16px; }
.t-utc { display: none; color: var(--muted); font-size: var(--text-sm); }
body:has(#utc:checked) .t-utc { display: inline; }

.chips { display: flex; flex-wrap: wrap; gap: var(--space-1); }
.chip { display: inline-flex; align-items: center; gap: var(--space-1); min-height: 26px; font-size: var(--text-sm); padding: 0 var(--space-2);
  border: var(--border) solid var(--line-strong); border-radius: var(--radius-pill); color: var(--ink-2); text-decoration: none; background: var(--surface); }
.chip:hover { border-color: var(--ink); color: var(--ink); }
.chip.zero { border-style: dashed; color: var(--muted); }
.chip[aria-current="true"] { border: var(--border-strong) solid var(--accent); background: var(--tint-accent); color: var(--ink); font-weight: 600; }
.chip.static { margin-left: var(--space-1); cursor: default; }
.is-stub { color: var(--muted); cursor: default; display: inline-flex; gap: var(--space-1); align-items: center; }
.btn.is-stub { opacity: .6; }
.meta { display: flex; flex-wrap: wrap; gap: var(--space-1) var(--space-2); font-size: var(--text-sm); color: var(--muted); align-items: center; margin: 0; }
.meta .src { color: var(--ink); font-weight: 600; }
.ptitle { font-weight: 600; margin: 0; }
.pbody { white-space: pre-wrap; overflow-wrap: anywhere; margin: 0; max-width: var(--measure); color: var(--ink-2); line-height: 1.6; }
.pbody.big { font-size: var(--text-md); color: var(--ink); }
.ico { flex: none; }
/* "Read at <domain>": the words in the link colour, the domain muted, a small external-link icon */
.plink { display: inline-flex; align-items: center; gap: var(--space-1); min-height: 24px; width: max-content; font-size: var(--text-sm); font-weight: 600; text-decoration: none; }
.plink .dom { color: var(--muted); font-weight: 400; }
.plink:hover { text-decoration: underline; }
.plink:hover .dom { color: var(--ink-2); }
/* a post reads: signals, headline, byline, text, link */
.post { display: grid; gap: var(--space-2); justify-items: start; --measure: 80ch; }
.signals { display: flex; flex-wrap: wrap; gap: var(--space-1) var(--space-2); align-items: center; margin: 0; }
.byline { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-1) var(--space-2); margin: 0; font-size: var(--text-sm); color: var(--muted); }
.byline .src { color: var(--ink); font-weight: 600; }
.when, .ago { color: var(--muted); }
.when { display: inline-flex; flex-wrap: wrap; gap: var(--space-2); }
.ago::before { content: "("; } .ago::after { content: ")"; }
/* who posted: PRIMARY filled olive (first-hand), COVERAGE soft slate (someone else's report) */
.tag-primary { background: var(--olive); border-color: var(--olive); color: var(--olive-ink); }
.tag-coverage { background: var(--tint-slate); border-color: var(--slate-line); color: var(--slate); }
.tier { font-size: var(--text-xs); color: var(--muted); }
/* certainty and copy flags: no box, a small marker shape before the word */
.flag { padding: 0; color: var(--muted); }
.flag::before { content: ""; flex: none; box-sizing: border-box; }
.flag-unconfirmed { color: var(--violet-muted); }
.flag-unconfirmed::before { width: 9px; height: 9px; border: 2px dotted currentcolor; border-radius: 50%; }   /* dotted ring */
.flag-confirmed { color: var(--ok); }
.flag-confirmed::before { width: 5px; height: 9px; border: solid currentcolor; border-width: 0 2px 2px 0; transform: rotate(45deg); margin: 0 2px 2px; }  /* tick */
.flag-derivative::before { width: 8px; height: 8px; border: solid currentcolor; border-width: 0 0 2px 2px; }  /* hooked corner: taken from elsewhere */
.flag-deleted { text-decoration: line-through; }
.flag-deleted::before { width: 10px; height: 2px; background: currentcolor; }                                  /* strike */

/* ---------- matrix: section tabs, branch rail, story stream ---------- */
/* keyboard focus is never left under the sticky tab band and lane heading (WCAG 2.4.11) */
html:has(.mx-top) { scroll-padding-top: 120px; }
/* the tab band is a fixed height so the lane headings can stick exactly under it */
.mx-top { --mx-top: 53px; position: sticky; top: 0; z-index: 4; height: var(--mx-top); background: var(--bg); margin: 0 calc(-1 * var(--space-5));
  padding: var(--space-2) var(--space-5); border-bottom: var(--border) solid var(--line); }
.sections { display: flex; flex-wrap: wrap; gap: var(--space-1); margin: 0; padding: 0; border: 0; }
.sections a { display: inline-flex; align-items: center; gap: var(--space-2); min-height: 36px; padding: 0 var(--space-3);
  border: var(--border) solid var(--line-strong); background: var(--surface); }
.sections a[aria-current="page"] { border-color: var(--ink); }
.sections a[aria-current="page"] .count { color: var(--surface); }
/* section dot by tab position, so no section name is written into the code: 1 olive, 2 blue, 3 teal, 4 violet; Unfiled a grey ring */
.sections .dot { width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--muted); }
.sections a[aria-current="page"] .dot { box-shadow: 0 0 0 2px var(--surface); }
.sections a:nth-child(4n+1) .dot { background: var(--olive); }
.sections a:nth-child(4n+2) .dot { background: var(--blue); }
.sections a:nth-child(4n+3) .dot { background: var(--teal); }
.sections a:nth-child(4n+4) .dot { background: var(--violet); }
.sections a.unfiled .dot { background: transparent; border: 2px solid var(--muted); }
.mx-help { display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-5); margin: var(--space-3) 0 0; }
.key > summary { font-weight: 600; color: var(--accent); min-height: var(--target); display: flex; align-items: center; gap: var(--space-2); }
.key[open] { flex-basis: 100%; background: var(--surface); border: var(--border) solid var(--line); border-radius: var(--radius-lg); padding: var(--space-1) var(--space-4) var(--space-3); }
.legend { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: var(--space-2) var(--space-4); margin: var(--space-2) 0; align-items: baseline; max-width: 90ch; }
.legend dt { display: flex; gap: var(--space-1); flex-wrap: wrap; font-weight: 600; }
.legend dd { margin: 0; color: var(--ink-2); }
.stub-list { list-style: none; margin: var(--space-2) 0 0; padding: 0; display: grid; gap: var(--space-2); }
.stub-list li { display: flex; gap: var(--space-2); align-items: baseline; color: var(--ink-2); }

.board { --mx-top: 53px; display: grid; grid-template-columns: 17rem minmax(0, 1fr); gap: var(--space-6); align-items: start; margin-top: var(--space-4); }
.rail { position: sticky; top: calc(var(--mx-top) + var(--space-4)); max-height: calc(100dvh - var(--mx-top) - var(--space-5)); overflow-y: auto; padding: 0 var(--space-1) var(--space-3) var(--ring); }
.rail-h { font-size: var(--text-sm); font-weight: 600; color: var(--muted); margin: var(--space-2) 0 var(--space-2); }
.rail-list { list-style: none; margin: 0 0 var(--space-3); padding: 0; border-left: var(--border-strong) solid var(--line); }
.rail-list > li { padding: var(--space-1) 0 var(--space-1) var(--space-3); margin-left: calc(-1 * var(--border-strong)); border-left: var(--border-strong) solid transparent; }
.rail-list > li.has-stories { border-left-color: var(--line-strong); }
/* the active branch: the one jumped to, or the first with stories until you jump (rules for :target are written by the template) */
.rail-list > li.is-active { border-left-color: var(--accent); background: var(--tint-accent); border-radius: 0 var(--radius) var(--radius) 0; }
.board:has(.lane:target) .rail-list > li.is-active { border-left-color: var(--line-strong); background: none; }
.rb { display: flex; justify-content: space-between; gap: var(--space-2); align-items: center; min-height: 28px; padding: var(--space-1) var(--space-1) var(--space-1) 0; }
.rb .count { display: inline-flex; align-items: center; justify-content: center; min-width: 28px; height: 20px; padding: 0 var(--space-2);
  border-radius: var(--radius-pill); background: var(--sunken); font-size: var(--text-xs); font-weight: 600; }
.has-stories .rb .count { background: var(--surface); color: var(--ink); box-shadow: inset 0 0 0 var(--border) var(--line-strong); }
a.rb { color: var(--ink); font-weight: 600; text-decoration: none; transition: color var(--fast); }
.rail-list > li { transition: background-color var(--fast); }
.rail-list > li.has-stories:not(.is-active):hover { background: var(--surface-2); }
a.rb:hover span:first-child { text-decoration: underline; }
.is-empty .rb { color: var(--muted); }
.rail .chips { margin: var(--space-1) 0 var(--space-2); }

.stream { max-width: 820px; min-width: 0; }
.showing { margin: var(--space-2) 0 var(--space-3); }
.lane { margin: 0 0 var(--space-6); scroll-margin-top: var(--mx-top); }
.mh { position: sticky; top: var(--mx-top); z-index: 2; display: flex; align-items: baseline; gap: var(--space-3); margin: 0; padding: var(--space-3) 0 var(--space-2);
  background: var(--bg); border-bottom: var(--border-strong) solid var(--ink); font-size: var(--text-lg); }
.mh .count { font-weight: 400; }
.lane-desc { color: var(--muted); margin: var(--space-2) 0 0; max-width: var(--measure); }
.mc { display: grid; gap: var(--space-4); padding-top: var(--space-4); }
.event { background: var(--surface); border: var(--border) solid var(--line); border-left: 4px solid var(--line-strong); border-radius: var(--radius-lg);
  padding: var(--space-4) var(--space-5); display: grid; gap: var(--space-3); box-shadow: 0 1px 2px rgb(20 33 43 / .06);
  transition: border-color var(--fast), box-shadow var(--fast); }
.event:hover { border-top-color: var(--line-strong); border-right-color: var(--line-strong); border-bottom-color: var(--line-strong); box-shadow: var(--shadow); }
/* left edge: the lead source's tier (the tier is also written next to the source name) */
.event[data-tier="primary"], .event[data-tier="official"] { border-left-color: var(--olive); }
.event[data-tier="mainstream"] { border-left-color: var(--blue); }
.event[data-tier="specialist"] { border-left-color: var(--teal); }
.event[data-tier="osint"] { border-left-color: var(--violet); }
.event[data-tier="adversary"] { border-left-color: var(--umber); }
/* alert level: a ring round the whole card, solid for war, dashed for flash; the badge carries the word */
.event[data-level="war"] { outline: var(--border-strong) solid var(--war); outline-offset: 2px; }
.event[data-level="flash"] { outline: var(--border-strong) dashed var(--flash); outline-offset: 2px; }
/* legend swatches for the card edge */
.edges { list-style: none; display: flex; flex-wrap: wrap; gap: var(--space-1) var(--space-4); margin: 0; padding: 0; }
.edges li { display: inline-flex; align-items: center; gap: var(--space-2); }
.edges li::before { content: ""; width: 4px; height: 18px; border-radius: 2px; background: var(--line-strong); }
.edges .e-official::before { background: var(--olive); }
.edges .e-mainstream::before { background: var(--blue); }
.edges .e-specialist::before { background: var(--teal); }
.edges .e-osint::before { background: var(--violet); }
.edges .e-adversary::before { background: var(--umber); }
h3.ptitle { font-size: var(--text-title); color: var(--ink); line-height: 1.3; letter-spacing: -.005em; max-width: var(--measure); }
/* footer: urgency | sources | Open, separated by thin dividers */
.ev-foot { display: flex; flex-wrap: wrap; row-gap: var(--space-2); align-items: center; font-size: var(--text-sm); color: var(--muted);
  padding-top: var(--space-3); border-top: var(--border) solid var(--line); }
.ev-foot > span + span { border-left: var(--border) solid var(--line-strong); margin-left: var(--space-3); padding-left: var(--space-3); }
.ev-open { margin-left: auto; gap: var(--space-2); }
.ev-open .badge-stub { height: 18px; padding: 0 var(--space-1); }
.urg { display: inline-flex; align-items: center; gap: var(--space-2); }
.urg-num { color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }
.urg-bar { width: 48px; height: 6px; border-radius: var(--radius-pill); background: var(--sunken); border: var(--border) solid var(--line-strong); overflow: hidden; }
.urg-bar > span { display: block; height: 100%; width: calc(var(--u) * 100%); background: var(--blue); }
.more > summary { font-size: var(--text-sm); font-weight: 600; color: var(--accent); min-height: 28px; display: flex; align-items: center; }
.more[open] > summary { color: var(--accent); }
.more .post { padding: var(--space-3) 0 0 var(--space-3); margin-top: var(--space-2); border-left: var(--border-strong) solid var(--line); }
.quiet { color: var(--muted); border-top: var(--border) dashed var(--line-strong); padding-top: var(--space-2); }
.quiet p { display: flex; gap: var(--space-2); align-items: flex-start; margin: var(--space-1) 0; }
.quiet .ico { margin-top: 3px; }
.to-top { margin: var(--space-5) 0 0; }
.to-top a { display: inline-flex; align-items: center; gap: var(--space-2); min-height: var(--target); font-weight: 600; text-decoration: none; }
.to-top a:hover { text-decoration: underline; }
.quiet strong { color: var(--ink-2); }
@media (max-width: 900px) {
  .mx-top { position: static; height: auto; }
  html:has(.mx-top) { scroll-padding-top: 60px; }
  .board { --mx-top: 0px; grid-template-columns: minmax(0, 1fr); gap: var(--space-3); }
  .rail { position: static; max-height: none; padding: 0; }
  .rail-list { columns: 2 14rem; column-gap: var(--space-5); }
  .rail-list > li { break-inside: avoid; }
  .board:has(.lane) .rail-list > li.is-empty { display: none; }  /* the line under the stories still names them */
}
@media (max-width: 640px) {
  .bar, main { padding-left: var(--space-4); padding-right: var(--space-4); }
  .mx-top { margin: 0 calc(-1 * var(--space-4)); padding: var(--space-2) var(--space-4); }
  .event { padding: var(--space-3); }
}

/* ---------- review ---------- */
.rq { background: var(--surface); border: var(--border) solid var(--line); border-radius: var(--radius); padding: var(--space-4) var(--space-5); max-width: 80ch; }
.rq h2 { text-transform: none; letter-spacing: 0; font-size: var(--text-lg); color: var(--ink); margin-top: 0; }
.keys { display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: center; margin: var(--space-3) 0; }
.btn.key { font-size: var(--text-md); padding: var(--space-2) var(--space-4); }
kbd { border: var(--border) solid var(--line-strong); border-bottom-width: 3px; border-radius: var(--radius); padding: 0 var(--space-2); background: var(--surface-2); }

/* ---------- tables: a card with quiet row rules and sentence-case headings ---------- */
.scroll { background: var(--surface); border: var(--border) solid var(--line); border-radius: var(--radius-lg); box-shadow: 0 1px 2px rgb(20 33 43 / .06); }
.tbl { width: 100%; border-collapse: collapse; }
.tbl th, .tbl td { border: 0; border-bottom: var(--border) solid var(--line); padding: var(--space-2) var(--space-3); text-align: left; vertical-align: top; }
.tbl th { background: var(--surface-2); position: sticky; top: 0; z-index: 1; font-size: var(--text-xs); font-weight: 600; color: var(--ink-2);
  border-bottom-color: var(--line-strong); white-space: nowrap; }
.tbl tbody tr { transition: background-color var(--fast); }
.tbl tbody tr:hover { background: var(--surface-2); }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl td.num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl tr.dim { opacity: .65; }
.redrow td { background: var(--sunken); }

/* ---------- source and review states: word + shape; red and amber stay reserved for alert levels ----------
   OK: green outline with a tick. REVIEW DUE: dashed outline with a clock. RED / AUTO-DISABLED: filled dark with "!".
   DISABLED / NO DATA: dotted grey. */
.state { display: inline-flex; align-items: center; gap: var(--space-1); height: 20px; padding: 0 var(--space-2); border: var(--border) solid currentcolor;
  border-radius: var(--radius); font: 600 var(--text-xs)/1 var(--font-sans); letter-spacing: .04em; white-space: nowrap; }
.state::before { content: ""; flex: none; box-sizing: border-box; }
.state-ok { color: var(--ok); }
.state-ok::before { width: 5px; height: 9px; border: solid currentcolor; border-width: 0 2px 2px 0; transform: rotate(45deg); margin: 0 2px 2px; }
.state-amber { color: var(--ink-2); border-style: dashed; }
.state-amber::before { width: 9px; height: 9px; border: 1.5px solid currentcolor; border-radius: 50%;
  background: linear-gradient(currentcolor, currentcolor) 50% 25% / 1.5px 3px no-repeat; }
.state-red, .state-auto-disabled { background: var(--ink); color: var(--surface); border-color: var(--ink); }
.state-red::before, .state-auto-disabled::before { content: "!"; font-weight: 700; }
.state-disabled, .state-no-data { color: var(--off); border-style: dotted; }

/* ---------- forms ---------- */
.grid { display: flex; flex-wrap: wrap; gap: var(--space-3); align-items: end; margin: var(--space-3) 0; }
.grid label, .bulk label, .filters label, .row-form label { display: grid; gap: var(--space-1); font-size: var(--text-sm); font-weight: 600; color: var(--ink-2); }
input, select { font: inherit; padding: var(--space-1) var(--space-2); min-height: var(--target); border: var(--border) solid var(--line-strong); border-radius: var(--radius);
  background: var(--surface); color: var(--ink); transition: border-color var(--fast); }
input:hover, select:hover { border-color: var(--ink-2); }
input::placeholder { color: var(--muted); opacity: 1; }
input[type="checkbox"] { min-height: 0; width: 16px; height: 16px; accent-color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { background: var(--ink); border-color: var(--ink); }
.btn.danger { background: var(--ink); border-color: var(--ink); color: var(--surface); }
.btn.danger:hover { background: var(--ink-2); }
.card-form { margin-top: var(--space-4); }
.card-form > summary { display: inline-flex; align-items: center; min-height: var(--target); font-weight: 600; color: var(--accent); }
.card-form[open] { background: var(--surface); border: var(--border) solid var(--line); border-radius: var(--radius-lg); padding: var(--space-2) var(--space-4) var(--space-3); }
.small-link { font-size: var(--text-sm); font-weight: 400; }
.audit li { font-size: var(--text-sm); padding: var(--space-1) 0; }
details > summary { cursor: pointer; color: var(--ink-2); }
details[open] > summary { color: var(--ink); font-weight: 600; }
.plain { list-style: none; padding-left: var(--space-3); margin: var(--space-1) 0; }

/* ---------- registry: sources, topic tree, change log ---------- */
.jump { display: flex; flex-wrap: wrap; gap: var(--space-2); margin: 0 0 var(--space-3); }
.jump a { display: inline-flex; align-items: center; gap: var(--space-2); min-height: var(--target); padding: 0 var(--space-3); border: var(--border) solid var(--line-strong);
  border-radius: var(--radius); background: var(--surface); color: var(--ink); font-weight: 600; text-decoration: none; transition: border-color var(--fast); }
.jump a:hover { border-color: var(--ink); }
.jump .count { font-weight: 400; }
.part { margin-top: var(--space-6); scroll-margin-top: var(--space-4); }
.part > h2 { display: flex; align-items: baseline; gap: var(--space-3); margin: 0 0 var(--space-2); }
.part > h2 .count { font-weight: 400; }
.part-lede { color: var(--ink-2); max-width: var(--measure); margin: 0 0 var(--space-3); }

.filters { display: flex; flex-wrap: wrap; gap: var(--space-3); align-items: end; margin: var(--space-3) 0 var(--space-4); }
.filters label.check { display: inline-flex; align-items: center; gap: var(--space-2); min-height: var(--target); font-weight: 400; }
.clear { align-self: center; font-weight: 600; }

/* sources table: tier as a badge and as the row's left edge, same colours as the Matrix card edge */
.tierbadge { background: transparent; border-color: currentcolor; color: var(--muted); }
.tier-primary, .tier-official { color: var(--olive); }
.tier-mainstream { color: var(--blue); }
.tier-specialist { color: var(--teal); }
.tier-osint { color: var(--violet); }
.tier-adversary { color: var(--umber); }
.sources td.pick { width: 1%; box-shadow: inset 4px 0 0 var(--line-strong); padding-left: var(--space-4); }
.sources tr[data-tier="primary"] td.pick, .sources tr[data-tier="official"] td.pick { box-shadow: inset 4px 0 0 var(--olive); }
.sources tr[data-tier="mainstream"] td.pick { box-shadow: inset 4px 0 0 var(--blue); }
.sources tr[data-tier="specialist"] td.pick { box-shadow: inset 4px 0 0 var(--teal); }
.sources tr[data-tier="osint"] td.pick { box-shadow: inset 4px 0 0 var(--violet); }
.sources tr[data-tier="adversary"] td.pick { box-shadow: inset 4px 0 0 var(--umber); }
.sources td { padding-top: var(--space-3); padding-bottom: var(--space-3); }
.who strong { display: block; font-size: var(--text-md); }
.who-meta { display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: center; margin-top: var(--space-1); font-size: var(--text-sm); }
.who .chips { margin-top: var(--space-2); }
.who .chip.static { margin: 0; min-height: 22px; }
.facets { display: block; margin-top: var(--space-1); font-size: var(--text-sm); color: var(--muted); }
.path { display: flex; flex-wrap: wrap; gap: 0 var(--space-1); }
.path span + span::before { content: "/"; color: var(--muted); margin-right: var(--space-1); }
.path span:last-child { font-weight: 600; }
.feed { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-1) var(--space-2); }
.loc { font: 400 var(--text-xs)/1.5 var(--font-mono); overflow-wrap: anywhere; }
.loc-path { color: var(--muted); }
.when-cell { margin-top: var(--space-1); font-size: var(--text-sm); }
.when-cell .when { display: grid; gap: 0; }
.manage-cell { width: 1%; white-space: nowrap; }
.manage > summary { display: inline-flex; align-items: center; min-height: var(--target); font-weight: 600; color: var(--accent); }
.manage[open] > summary { color: var(--ink); }
/* Manage opens as a small panel over the row, so the table columns do not jump */
.manage { position: relative; }
.manage-body { position: absolute; right: 0; top: 100%; z-index: 2; display: grid; gap: var(--space-3); justify-items: start; white-space: normal; width: 19rem;
  padding: var(--space-3) var(--space-4); margin-top: var(--space-1); background: var(--surface); border: var(--border) solid var(--line-strong);
  border-radius: var(--radius-lg); box-shadow: var(--shadow); }
.sources tbody tr:has(input[name="ids"]:checked) { background: var(--tint-accent); }
.row-form { display: flex; flex-wrap: wrap; align-items: end; gap: var(--space-2); }
.row-form select, .row-form input { max-width: 12rem; }
.confirm > summary { display: inline-flex; align-items: center; min-height: 28px; font-weight: 600; color: var(--ink-2); }
.confirm form { margin-top: var(--space-1); }
.confirm p { margin: 0 0 var(--space-2); font-size: var(--text-sm); color: var(--ink-2); }

/* bulk bar: stays at the bottom of the table while you scroll it; the ticked count is a CSS counter, no script */
.picker { counter-reset: picked; }
.picker input[name="ids"]:checked { counter-increment: picked; }
.bulk { position: sticky; bottom: 0; z-index: 3; display: flex; flex-wrap: wrap; gap: var(--space-3); align-items: end; margin: var(--space-2) 0 0;
  padding: var(--space-3) var(--space-4); background: var(--surface); border: var(--border) solid var(--line-strong); border-radius: var(--radius-lg);
  box-shadow: 0 -4px 12px rgb(20 33 43 / .08); }
.picked { align-self: center; min-width: 6.5em; }
.picked::before { content: counter(picked) " ticked"; font-weight: 600; color: var(--ink); }

/* topic tree: one column of section cards, rows with one aligned count column */
.edit-switch { display: inline-flex; align-items: center; gap: var(--space-2); min-height: var(--target); margin-bottom: var(--space-2); font-size: var(--text-sm); color: var(--ink-2); cursor: pointer; }
.tree-list { display: grid; gap: var(--space-3); max-width: 760px; }
.sect { background: var(--surface); border: var(--border) solid var(--line); border-left: 4px solid var(--line-strong); border-radius: var(--radius-lg);
  box-shadow: 0 1px 2px rgb(20 33 43 / .06); }
.sect > summary { display: flex; align-items: center; gap: var(--space-2); min-height: 44px; padding: var(--space-2) var(--space-4); font-size: var(--text-md); font-weight: 600; color: var(--ink); }
.sect > summary .count { margin-left: auto; font-weight: 400; }
.sect .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); flex: none; }
/* the same position colours as the Matrix section tabs */
.tree-list > .sect:nth-child(4n+1) { border-left-color: var(--olive); } .tree-list > .sect:nth-child(4n+1) .dot { background: var(--olive); }
.tree-list > .sect:nth-child(4n+2) { border-left-color: var(--blue); } .tree-list > .sect:nth-child(4n+2) .dot { background: var(--blue); }
.tree-list > .sect:nth-child(4n+3) { border-left-color: var(--teal); } .tree-list > .sect:nth-child(4n+3) .dot { background: var(--teal); }
.tree-list > .sect:nth-child(4n+4) { border-left-color: var(--violet); } .tree-list > .sect:nth-child(4n+4) .dot { background: var(--violet); }
.tt { padding: 0 var(--space-4) var(--space-2); }
.tt-row { display: grid; grid-template-columns: minmax(0, 1fr) 11em 8em; gap: var(--space-3); align-items: center; min-height: 34px; border-top: var(--border) solid var(--line); }
.tt-head { min-height: 28px; border-top: 0; font-size: var(--text-xs); font-weight: 600; color: var(--muted); }
.tt-row .num { text-align: right; font-variant-numeric: tabular-nums; font-size: var(--text-sm); color: var(--ink-2); }
.tt-row .num.zero { color: var(--muted); }
.tt-row .tn { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tt-row:not(.sub):not(.tt-head) .tn { font-weight: 600; }
/* sub-branches: indented, with a guide line down from the parent and a short tick to each row */
.tt-row.sub .tn { position: relative; align-self: stretch; display: flex; align-items: center; padding-left: var(--space-6); color: var(--ink-2); }
.tt-row.sub .tn::before { content: ""; position: absolute; left: var(--space-3); top: -1px; bottom: 0; border-left: var(--border) solid var(--line-strong); }
.tt-row.sub .tn::after { content: ""; position: absolute; left: var(--space-3); top: 50%; width: var(--space-3); border-top: var(--border) solid var(--line-strong); }
.tt-row.sub:has(+ .tt-row:not(.sub)) .tn::before, .tt-row.sub:last-child .tn::before { bottom: 50%; }   /* the last one ends at its tick */
.rm { justify-self: end; }
.rm .confirm { display: none; }
body:has(#edit-tree:checked) .rm .confirm { display: block; }
.sect-foot { padding: 0 var(--space-4) var(--space-2); }
body:not(:has(#edit-tree:checked)) .sect-foot { display: none; }

/* change log: aligned columns */
.log { list-style: none; margin: 0; padding: 0; max-width: 960px; background: var(--surface); border: var(--border) solid var(--line); border-radius: var(--radius-lg); }
.log li { display: grid; grid-template-columns: 17rem 14rem minmax(0, 1fr) 6rem; gap: var(--space-3); align-items: baseline; padding: var(--space-2) var(--space-4);
  border-top: var(--border) solid var(--line); font-size: var(--text-sm); }
.log li:first-child { border-top: 0; }
.log code { background: none; padding: 0; color: var(--ink); overflow-wrap: anywhere; }
.log-when .when { gap: var(--space-1); }
@media (max-width: 760px) {
  .tbl.sources { min-width: 760px; }          /* the region scrolls sideways rather than crushing the columns */
  .bulk { position: static; }
  html:has(.bulk) { scroll-padding-bottom: 0; }
  .bulk select, .bulk input { max-width: 100%; }
  .bulk label { min-width: 0; max-width: 100%; }
  .log li { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .tt-row { grid-template-columns: minmax(0, 1fr) auto; }
  .tt-row .rm { grid-column: 1 / -1; }
}
.manage-body > a { display: inline-flex; align-items: center; min-height: 24px; }
/* keyboard focus is never left under the sticky bulk bar (WCAG 2.4.11) */
html:has(.bulk) { scroll-padding-bottom: 120px; }

/* ---------- health: a board of state counts, then the feeds with what needs a look first ---------- */
.health-sum { background: var(--surface); border: var(--border) solid var(--line); border-radius: var(--radius-lg); margin: 0 0 var(--space-3); overflow: hidden; }
.fb-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: var(--space-1) var(--space-5);
  padding: var(--space-3) var(--space-4); border-bottom: var(--border) solid var(--line); }
.sum-line { margin: 0; font-size: var(--text-md); }
.updated { margin: 0; font-size: var(--text-sm); color: var(--muted); }
.health td { vertical-align: middle; padding-top: var(--space-3); padding-bottom: var(--space-3); }
.health td.st { box-shadow: inset 4px 0 0 var(--line-strong); padding-left: var(--space-4); white-space: nowrap; }
.health tr[data-tier="primary"] td.st, .health tr[data-tier="official"] td.st { box-shadow: inset 4px 0 0 var(--olive); }
.health tr[data-tier="mainstream"] td.st { box-shadow: inset 4px 0 0 var(--blue); }
.health tr[data-tier="specialist"] td.st { box-shadow: inset 4px 0 0 var(--teal); }
.health tr[data-tier="osint"] td.st { box-shadow: inset 4px 0 0 var(--violet); }
.health tr[data-tier="adversary"] td.st { box-shadow: inset 4px 0 0 var(--umber); }
.st-word { display: block; margin-top: var(--space-1); font-size: var(--text-xs); color: var(--muted); }
.redrow .st-word { color: var(--ink); font-weight: 600; }
.health td.num { font-size: var(--text-base); }
.health td.num.hot { color: var(--ink); font-weight: 600; }
.health th.num { text-align: right; }
.why { display: block; margin-top: var(--space-1); font-size: var(--text-xs); color: var(--ink-2); }
.not-built { margin-top: var(--space-4); }
@media (max-width: 760px) { .tbl.health { min-width: 1000px; } }
.tbl tr.grp th { position: static; background: var(--bg); font-size: var(--text-sm); color: var(--ink); padding-top: var(--space-4); border-bottom-color: var(--line-strong); }
.tbl tr.grp th .count { font-weight: 400; margin-left: var(--space-1); }
.tbl tbody tr.grp:hover { background: none; }
.feeds-h { display: flex; align-items: baseline; gap: var(--space-3); margin: var(--space-5) 0 var(--space-2); } .feeds-h .count { font-weight: 400; }

/* ---------- map: the whole window is the map; the panel, zoom and status float over it ----------
   Land is one calm grey. Colour belongs to the dots (amber place, blue sea or strait, coral border line),
   their outlined counts and name pills, so the news is what stands out, not the countries. */
.map-full { --coast: light-dark(rgb(20 33 43 / .30), rgb(245 244 240 / .16)); --grat: light-dark(rgb(20 33 43 / .07), rgb(245 244 240 / .045)); }
body:has(.map-full) { display: flex; flex-direction: column; height: 100dvh; overflow: hidden; }
.map-full { flex: 1; min-height: 0; max-width: none; margin: 0; padding: 0; position: relative; }
.map-full > .page-head { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); margin: 0; }
.map-stage { position: absolute; inset: 0; background: var(--bg); overflow: hidden; }
.map-view { position: absolute; inset: 0; cursor: grab; touch-action: none; }
.map-view:active { cursor: grabbing; }
.map { display: block; width: 100%; height: 100%; user-select: none; }
.map .sea { fill: var(--bg); }
.grat line { stroke: var(--grat); stroke-width: 1; vector-effect: non-scaling-stroke; }
.ctry path { fill: var(--surface-2); stroke: var(--coast); stroke-width: .6; stroke-linejoin: round; vector-effect: non-scaling-stroke; transition: fill var(--fast); }
.ctry.has path { fill: color-mix(in srgb, var(--surface-2), var(--ink) 5%); }
.ctry:hover path { fill: color-mix(in srgb, var(--surface-2), var(--ink) 10%); }
.ctry.sel path { fill: color-mix(in srgb, var(--surface-2), var(--ink) 12%); stroke: var(--accent); stroke-width: 1.4; }
.pin { color: var(--flash); }
.pin-water { color: var(--blue); }
.pin-border { color: var(--war); }
.pin .dot { fill: currentcolor; stroke: var(--bg); stroke-width: .5; vector-effect: non-scaling-stroke; }
.pin .halo { fill: currentcolor; opacity: .2; transition: opacity var(--fast); }
.pin:hover .halo, .pin.sel .halo { opacity: .42; }
.pin.sel .dot { stroke: var(--ink); stroke-width: 1.4; }
.pin-label { display: none; }
.map[data-z="mid"] .pin-label.top, .map[data-z="hi"] .pin-label { display: inline; transform-box: fill-box; transform-origin: 0 0; transform: scale(2); }
.pin-label rect { fill: var(--surface); stroke: var(--line); stroke-width: .25; opacity: .96; }
.pin-name { font: 500 2.2px var(--font-sans); fill: var(--ink); pointer-events: none; }
.map-view:focus-visible { outline: 3px solid var(--focus); outline-offset: -3px; }
.map-side { position: absolute; left: var(--space-4); top: var(--space-4); bottom: 64px; width: min(380px, calc(100% - 2 * var(--space-4))); display: flex; flex-direction: column; min-height: 0; }
.side-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); padding: var(--space-3) var(--space-4); border-bottom: var(--border) solid var(--line); }
.side-title { margin: 0; font-weight: 600; }
.side-body { overflow: auto; padding: var(--space-4); min-height: 0; }
.map-side.shut { bottom: auto; }
.map-side.shut .side-head { border-bottom: 0; }
.map-zoom { position: absolute; right: var(--space-4); top: var(--space-4); display: grid; gap: var(--space-2); padding: var(--space-3) var(--space-2); justify-items: center; }
.map-zoom .btn { min-width: 40px; justify-content: center; border-radius: var(--radius-pill); }
.map-bar { position: absolute; left: var(--space-4); right: var(--space-4); bottom: var(--space-3); display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2) var(--space-5); padding: var(--space-2) var(--space-4); font-size: var(--text-sm); border-radius: var(--radius-pill); }
.map-bar .sum-line { margin: 0; font-size: var(--text-sm); }
.map-key { list-style: none; display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-4); margin: 0 0 0 auto; padding: 0; color: var(--ink-2); }
.map-key li { display: inline-flex; align-items: center; gap: var(--space-2); }
.key-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--flash); box-shadow: 0 0 0 4px color-mix(in srgb, var(--flash) 22%, transparent); }
.key-dot.water { background: var(--blue); box-shadow: 0 0 0 4px color-mix(in srgb, var(--blue) 22%, transparent); }
.key-dot.border { background: var(--war); box-shadow: 0 0 0 4px color-mix(in srgb, var(--war) 22%, transparent); }
.key-box { min-width: 20px; height: 16px; padding: 0 4px; border: 1px solid var(--flash); border-radius: 4px; color: var(--ink); font-size: var(--text-xs); display: inline-flex; align-items: center; justify-content: center; }
.panel-h { margin: 0 0 var(--space-1); font-size: var(--text-lg); }
.panel-h:focus { outline: none; }
.panel-h:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.panel-sub { margin: 0 0 var(--space-3); color: var(--ink-2); font-size: var(--text-sm); }
.map-events { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-3); }
.map-event { border-top: var(--border) solid var(--line); padding-top: var(--space-3); }
.map-event .ptitle { margin: var(--space-1) 0; font-weight: 600; }
.map-lists { margin-top: var(--space-4); border-top: var(--border) solid var(--line); padding-top: var(--space-3); }
.map-lists .feeds-h { margin: 0 0 var(--space-2); font-size: var(--text-md); }
.country-pick { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); margin: 0 0 var(--space-3); }
.country-pick select { max-width: 100%; }
.map-cols h3 { margin: var(--space-3) 0 var(--space-1); font-size: var(--text-sm); color: var(--ink-2); }
.pick { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; }
.pick li { display: flex; justify-content: space-between; gap: var(--space-3); border-bottom: var(--border) solid var(--line); padding: var(--space-1) 0; }
.pick .n { font-variant-numeric: tabular-nums; color: var(--ink-2); }
.map-side .key { margin-top: var(--space-3); }
.map-find { position: absolute; top: var(--space-4); left: 50%; transform: translateX(-50%); display: flex; gap: var(--space-2); align-items: center; padding: var(--space-2) var(--space-3); width: min(440px, calc(100% - 2 * var(--space-4) - 440px)); min-width: 240px; border-radius: var(--radius-pill); }
.map-find input { flex: 1; min-width: 0; background: transparent; color: var(--ink); border: 0; padding: var(--space-2) var(--space-3); font: inherit; min-height: 36px; }
.map-find input:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: var(--radius-pill); }
.map-chips { position: absolute; left: calc(380px + 2 * var(--space-4)); right: 168px; bottom: 64px; width: fit-content; margin-inline: auto; display: flex; flex-wrap: wrap; justify-content: center; gap: var(--space-2); padding: var(--space-2); border-radius: var(--radius-pill); }
.map-chips .chip { display: inline-flex; align-items: center; gap: var(--space-2); min-height: 32px; padding: 0 var(--space-3); border: var(--border) solid transparent; border-radius: var(--radius-pill); background: transparent; color: var(--ink-2); text-decoration: none; font-size: var(--text-sm); }
.map-chips .chip:hover { color: var(--ink); border-color: var(--line-strong); }
.map-chips .chip[aria-current="true"] { background: var(--ink); color: var(--bg); font-weight: 600; }
.map-chips .chip .n { font-variant-numeric: tabular-nums; opacity: .7; }
.zoom-range { writing-mode: vertical-lr; direction: rtl; height: 120px; width: 28px; margin: 0 auto; accent-color: var(--accent); }
.zoom-read { text-align: center; font-size: var(--text-sm); font-variant-numeric: tabular-nums; color: var(--ink-2); }
.map-coords { position: absolute; right: var(--space-4); bottom: 64px; margin: 0; padding: var(--space-1) var(--space-3); font-size: var(--text-sm); font-variant-numeric: tabular-nums; color: var(--ink-2); border-radius: var(--radius-pill); }
@media (max-width: 1100px) {
  .map-find { width: min(320px, calc(100% - 2 * var(--space-4) - 140px)); left: auto; right: 84px; transform: none; }
  .map-chips { left: 410px; right: var(--space-4); width: auto; margin-inline: 0; justify-content: flex-start; }
}
@media (max-width: 860px) {
  .map-side { top: auto; bottom: 88px; max-height: 48%; left: var(--space-2); right: var(--space-2); width: auto; }
  .map-side.shut { max-height: none; }
  .map-find { top: var(--space-2); left: var(--space-2); right: 84px; width: auto; transform: none; }
  .map-chips { left: var(--space-2); right: var(--space-2); width: auto; margin-inline: 0; bottom: 64px; }
  .map-bar { left: var(--space-2); right: var(--space-2); }
  .map-key { margin-left: 0; }
  .map-coords { display: none; }
}
.pick a, .map-side .panel-sub a { color: var(--ink); text-decoration-color: var(--line-strong); }
.pick a:hover, .map-side .panel-sub a:hover { color: var(--accent); }
.map-side .plink { color: var(--ink-2); }
.map-float { background: color-mix(in srgb, var(--surface) 90%, transparent); border: var(--border) solid var(--line); border-radius: 16px;
  box-shadow: 0 12px 32px rgb(0 0 0 / .45); backdrop-filter: blur(12px); }

/* ---------- polish, from an audit against the Vercel Web Interface Guidelines and better-ui ----------
   Headings wrap evenly and paragraphs avoid one-word last lines. A panel that scrolls keeps the scroll to
   itself instead of moving the page behind it. Touch screens get no double-tap delay and 44 px targets; a mouse
   keeps the dense sizes, since a console is worked at a desk. */
h1, h2, h3, .page-title { text-wrap: balance; }
p, li, .lede { text-wrap: pretty; }
.scroll, .side-body, .manage-body, .map-events, .rq, .log { overscroll-behavior: contain; }
a, button, .btn, input, select, summary, label { touch-action: manipulation; }
@media (pointer: coarse) {
  .btn, .btn.small, .nav a, .tabs a, .chip, summary, select,
  input:not([type="checkbox"]):not([type="radio"]):not([type="range"]) { min-height: 44px; }
}
