/* Reader aliases over the INSO semantic tokens in inso-tokens.css. */
:root {
  --bg: var(--surface-page);
  --surface: var(--surface-neutral-white);
  --surface-2: var(--surface-container-hovered);
  --text: var(--content-body);
  --muted: var(--content-support);
  --border: var(--border-medium);
  --accent: var(--content-primary);
  --accent-bg: var(--surface-primary-default);
  --accent-bg-hover: var(--surface-primary-hovered);
  --accent-contrast: var(--content-on-surface-primary);
  --badge-bg: var(--surface-neutral-super-light);
  --high: var(--content-danger);
  --medium: var(--content-notice-text);
  --low: var(--content-success-text);
  --shadow: var(--shadow-surface);
  --sidebar-w: 15rem;
  --map-settlement: var(--vis-02-01);
  --map-admin2: var(--vis-07-01);
  --map-admin1: var(--vis-04-01);
}
@media (prefers-color-scheme: dark) {
  :root {
    --map-settlement: var(--vis-02-05);
    --map-admin2: var(--vis-07-03);
    --map-admin1: var(--vis-04-04);
  }
}

* { box-sizing: border-box; }
:root { accent-color: var(--accent-bg); }
body {
  margin: 0;
  font: var(--weight-regular) var(--text-m)/1.43 var(--font-sans);
  background: var(--bg);
  color: var(--text);
}
:is(h1, h2, h3, h4, h5, h6) { font-weight: var(--weight-medium); color: var(--content-heading); }
a { color: var(--content-link); text-decoration: none; }
a:hover { color: var(--content-link-hover); text-decoration: underline; }
:focus-visible { outline: 2px solid var(--border-focus); outline-offset: 2px; }

/* App shell: INSO Portal sidebar + main column — docs/reader.md#app-shell */
.shell { display: flex; min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; align-self: flex-start; flex: none;
  display: flex; flex-direction: column; width: var(--sidebar-w); height: 100vh; overflow-y: auto;
  background: var(--surface); border-right: 1px solid var(--border); transition: width 0.15s ease;
}
.brand { display: flex; align-items: center; gap: var(--space-s); padding: var(--space-l); color: var(--text); }
.brand:hover { color: var(--text); text-decoration: none; }
.brand-logo { display: block; flex: none; width: 3.5rem; height: auto; border-radius: var(--radius-xs); }
.brand-text { display: flex; flex-direction: column; min-width: 0; }
.brand-name { font-weight: var(--weight-medium); font-size: var(--text-m); line-height: var(--leading-m); }
.brand-sub { font-size: var(--text-s); line-height: var(--leading-s); color: var(--muted); }
.nav { display: flex; flex-direction: column; gap: var(--space-l); padding: var(--space-2xl) var(--space-s) var(--space-l); flex: 1; }
.nav-group { display: flex; flex-direction: column; gap: var(--space-2xs); }
.nav-label {
  padding: 0 var(--space-s) var(--space-xs); font-size: var(--text-xs); line-height: var(--leading-xs);
  letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted);
}
.nav-link {
  display: flex; align-items: center; gap: var(--space-m); padding: var(--space-s); border-radius: var(--radius-xs);
  color: var(--text); font-weight: var(--weight-medium);
}
.icon { flex: none; width: 1.25rem; height: 1.25rem; fill: currentColor; }
.nav-link:hover { color: var(--text); background: var(--surface-container-hovered); text-decoration: none; }
.nav-link[aria-current="page"] { color: var(--accent); background: var(--surface-container-selected); }
.nav-foot { display: flex; flex-direction: column; gap: var(--space-xs); padding: var(--space-l); border-top: 1px solid var(--border); }
.nav-foot .who { font-weight: var(--weight-medium); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-foot .logout { display: inline-flex; align-items: center; gap: var(--space-xs); font-size: var(--text-s); }
.nav-foot .logout .icon { width: 1rem; height: 1rem; }
.nav-fold {
  display: inline-flex; align-items: center; gap: var(--space-xs); align-self: flex-start; margin-top: var(--space-s);
  padding: var(--space-xs) 0; background: none; border: 0; color: var(--muted); font: inherit; font-size: var(--text-s); cursor: pointer;
}
.nav-fold:hover { color: var(--text); }
.nav-fold .icon { width: 1rem; height: 1rem; }
.nav-check { position: absolute; opacity: 0; width: 0; height: 0; }
.nav-panel { display: flex; flex-direction: column; flex: 1; }
.menu-toggle { display: none; }
/* Sidebar country filter: one compact button, a checklist panel under it — docs/reader.md#country-filter */
.country-filter { position: relative; margin: 0 var(--space-s); }
.country-filter + .nav { padding-top: var(--space-l); }
.country-filter-button {
  display: flex; align-items: center; gap: var(--space-s); padding: var(--space-s); list-style: none; cursor: pointer;
  border: 1px solid var(--border); border-radius: var(--radius-xs); background: var(--bg); color: var(--text); font-weight: var(--weight-medium);
}
.country-filter-button::-webkit-details-marker { display: none; }
.country-filter-button:hover { border-color: var(--border-dark); }
.country-filter-button .icon:first-child { color: var(--accent); }
.country-filter-button .icon:last-child { margin-left: auto; color: var(--muted); transition: transform 0.15s ease; }
.country-filter[open] .country-filter-button { border-color: var(--border-focus); }
.country-filter[open] .country-filter-button .icon:last-child { transform: rotate(180deg); }
.country-filter-value { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.country-filter-rail { display: none; }
.country-filter-panel {
  position: absolute; z-index: 40; top: calc(100% + var(--space-2xs)); left: 0; right: 0; display: flex; flex-direction: column; gap: var(--space-s);
  padding: var(--space-s); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-s); box-shadow: var(--shadow);
}
.country-filter-search { width: 100%; }
.country-filter-list { display: flex; flex-direction: column; max-height: 16rem; overflow-y: auto; }
.country-filter-option { display: flex; align-items: center; gap: var(--space-s); padding: var(--space-xs) var(--space-s); border-radius: var(--radius-xs); cursor: pointer; }
.country-filter-option[hidden] { display: none; }
.country-filter-option:hover { background: var(--surface-container-hovered); }
.country-filter-option:has(input:checked) { color: var(--accent); font-weight: var(--weight-medium); }
.country-filter-option.is-last-chosen { margin-bottom: var(--space-xs); border-bottom: 1px solid var(--border); border-radius: var(--radius-xs) var(--radius-xs) 0 0; }
.country-filter-actions { display: flex; gap: var(--space-xs); padding-top: var(--space-s); border-top: 1px solid var(--border); }
.main { flex: 1; min-width: 0; }

/* Icon rail: <html data-nav="collapsed">, set in base.html's <head> — docs/reader.md#app-shell */
@media (min-width: 744px) {
  :root[data-nav="collapsed"] { --sidebar-w: 4.5rem; }
  [data-nav="collapsed"] .brand { justify-content: center; padding: var(--space-l) var(--space-s); }
  [data-nav="collapsed"] .brand-text, [data-nav="collapsed"] .nav-foot .who { display: none; }
  [data-nav="collapsed"] .nav-label { height: 1px; margin: 0 var(--space-s) var(--space-xs); padding: 0; overflow: hidden; color: transparent; background: var(--border); }
  [data-nav="collapsed"] :is(.nav-link, .logout, .nav-fold) { justify-content: center; align-self: stretch; }
  [data-nav="collapsed"] :is(.nav-link, .logout, .nav-fold) > span {
    position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap;
  }
  [data-nav="collapsed"] .nav-foot { padding-inline: var(--space-s); }
  [data-nav="collapsed"] .nav-fold .icon { transform: rotate(180deg); }
  [data-nav="collapsed"] .country-filter-button { flex-direction: column; gap: var(--space-2xs); padding: var(--space-xs) 0; }
  [data-nav="collapsed"] .country-filter-button :is(.country-filter-value, .icon:last-child) { display: none; }
  [data-nav="collapsed"] .country-filter-rail { display: block; font-size: var(--text-xs); line-height: var(--leading-xs); color: var(--accent); }
  /* Fixed, so the panel escapes the rail's overflow clip and opens beside it. */
  [data-nav="collapsed"] .country-filter-panel { position: fixed; top: auto; left: calc(var(--sidebar-w) + var(--space-2xs)); right: auto; width: 15rem; }
}
@media (prefers-reduced-motion: reduce) { .sidebar { transition: none; } }

/* Below tablet width the sidebar folds into a top bar with a JS-free menu toggle. */
@media (max-width: 743px) {
  :root { --shell-bar-h: 3.5rem; }
  .shell { flex-direction: column; }
  .sidebar {
    z-index: 30; flex-direction: row; flex-wrap: wrap; align-items: center; align-self: stretch;
    width: auto; height: auto; max-height: 100vh; border-right: 0; border-bottom: 1px solid var(--border);
  }
  .brand { flex: 1; min-height: var(--shell-bar-h); padding: var(--space-s) var(--space-l); }
  .brand-logo { width: 2.75rem; }
  .menu-toggle {
    display: inline-flex; align-items: center; gap: var(--space-xs); margin-right: var(--space-l);
    cursor: pointer; user-select: none; font-weight: var(--weight-medium);
  }
  .menu-toggle::after { content: "Menu ▾"; }
  .nav-check:checked ~ .menu-toggle::after { content: "Close ▴"; }
  .nav-check:focus-visible ~ .menu-toggle { outline: 2px solid var(--border-focus); outline-offset: 2px; }
  .nav-panel { display: none; flex-basis: 100%; border-top: 1px solid var(--border); }
  .nav { padding-top: var(--space-s); }
  .country-filter { margin: var(--space-m) var(--space-l) 0; }
  .country-filter-panel { position: static; margin-top: var(--space-2xs); box-shadow: none; }
  .nav-check:checked ~ .nav-panel { display: flex; }
  .nav-fold { display: none; }
}

.content { max-width: 62rem; margin: 0 auto; padding: 1.25rem; }
.content.content-wide { max-width: none; }
/* Only the source table spans the page; everything around it keeps the 62rem column. */
.content-wide > .admin > :not(#source-list),
.content-wide #source-list > :not(#bulk-form),
.content-wide #bulk-form > .bulk-bar { max-width: 59.5rem; margin-inline: auto; }

/* Filter toolbar */
.filters {
  display: flex; flex-wrap: wrap; gap: 0.75rem 1rem; align-items: end;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-s);
  padding: 0.9rem 1rem; margin-bottom: 1.25rem; box-shadow: var(--shadow);
}
/* Pinned only when there is height to spare — see docs/reader.md#filter-toolbar */
@media (min-height: 1200px) {
  .filters { position: sticky; top: var(--space-s); z-index: 20; }
}
@media (min-height: 1200px) and (max-width: 743px) {
  .filters { top: calc(var(--shell-bar-h) + var(--space-s)); }
}
.field { display: flex; flex-direction: column; gap: 0.3rem; font-size: 0.75rem; font-weight: 600; color: var(--muted); }
.field[hidden] { display: none; }
.field-search { flex: 1 1 16rem; min-width: 12rem; }
.field-countries { flex: 1 1 20rem; min-width: 14rem; }
.field-areas { flex: 1 1 16rem; min-width: 12rem; }
/* The area pickers' swap wrapper must not become a flex item of its own. */
.area-fields { display: contents; }
/* Sources soaks up the row beside Period: its chips grow as you pick. */
.field-sources { flex: 1 1 20rem; min-width: 14rem; }
.field-report-value { display: flex; gap: 0.5rem; align-items: center; min-height: 2.2rem; text-transform: none; letter-spacing: normal; font-weight: 400; font-size: 0.85rem; }
.field select, input[type=text], input[type=search], input[type=date], input[type=email], input[type=number], textarea {
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius-xs); padding: 0.45rem 0.55rem; font: inherit;
}
/* Toggle pills */
.pill {
  display: inline-flex; align-items: center; gap: 0.4rem; cursor: pointer; user-select: none;
  border: 1px solid var(--border); border-radius: var(--radius-xs); padding: 0.45rem 0.85rem;
  background: var(--surface); color: var(--muted); font-size: 0.85rem; white-space: nowrap;
}
/* Right-aligned, and wraps as one unit rather than stranding a pill on its own line. */
.pill-group { display: flex; gap: 0.5rem; margin-left: auto; }
.row-break { flex-basis: 100%; height: 0; }
/* One height for every control in a row, so bottom-aligned fields keep their labels level;
   2.25rem is the empty chip pickers' own height, so the single-line controls match them. */
.filters .field select:not([multiple]), .filters .field > input:not([type=checkbox]), .filters .pill,
.filters .switch { box-sizing: border-box; height: 2.25rem; padding-block: 0; }
/* Content type: one joined control, each segment its own checkbox. */
.segmented { display: inline-flex; }
.segmented .pill { text-transform: none; letter-spacing: normal; font-weight: 400; border-radius: 0; margin-left: -1px; }
.segmented .pill:first-of-type { border-radius: var(--radius-xs) 0 0 var(--radius-xs); margin-left: 0; }
.segmented .pill:last-of-type { border-radius: 0 var(--radius-xs) var(--radius-xs) 0; }
.segmented .pill:has(input:checked) { position: relative; z-index: 1; }
/* Full-text switch */
.switch {
  display: inline-flex; align-items: center; gap: 0.5rem; cursor: pointer; user-select: none;
  font-size: 0.85rem; font-weight: 400; letter-spacing: normal;
  text-transform: none; color: var(--text); transition: opacity 0.15s;
}
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch-track {
  position: relative; flex: none; width: 2.1rem; height: 1.2rem; border-radius: var(--radius-pill);
  background: var(--border); transition: background 0.15s;
}
.switch-track::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: calc(1.2rem - 4px); height: calc(1.2rem - 4px);
  border-radius: 50%; background: var(--content-on-surface-secondary); box-shadow: 0 1px 2px rgb(0 0 0 / 25%); transition: transform 0.15s;
}
.switch input:checked + .switch-track { background: var(--accent); }
.switch input:checked + .switch-track::after { transform: translateX(0.9rem); }
.switch input:focus-visible + .switch-track { outline: 2px solid var(--accent); outline-offset: 2px; }
/* The switch only narrows signals, so it recedes while Signal is off. */
.filters:has(input[name=kind][value=signal]:not(:checked)) .switch { opacity: 0.45; }
/* Active-filter bar: what is currently narrowing the feed, each pill its own remove link. */
.active-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem 0.5rem; margin: 0 0 0.9rem; }
.af-label { font-size: var(--text-s); font-weight: 700; color: var(--muted); }
.af-chip { gap: 0.35rem; }
.af-name { color: var(--muted); }
.af-value { color: var(--text); font-weight: 600; }
.af-chip:hover .af-name, .af-chip:hover .af-value { color: var(--accent); }
.af-x { font-size: 1em; line-height: 1; opacity: 0.6; }
.af-chip:hover .af-x { opacity: 1; }
.af-clear { font-size: 0.76rem; color: var(--muted); }

/* Extra filter row: own line inside the toolbar, collapsed until something in it is set. */
.entity-filters { flex: 1 1 100%; border-top: 1px solid var(--border); padding-top: 0.7rem; }
.entity-filters > summary {
  cursor: pointer; font-size: var(--text-s); font-weight: 600; color: var(--muted);
}
.entity-filters > summary .count { color: var(--accent); }
.entity-fields { display: flex; flex-wrap: wrap; gap: 0.75rem 1rem; margin-top: 0.7rem; }
.entity-fields .field { flex: 1 1 11rem; min-width: 9rem; }
.pill input { position: absolute; opacity: 0; width: 0; height: 0; }
.pill-icon { font-size: 0.95em; line-height: 1; }
.pill:not(.on):not(:has(input:checked)) .pill-icon { color: var(--muted); }
/* .on is server-rendered; :has(:checked) gives instant feedback on click (the form isn't htmx-swapped). */
.pill.on, .pill:has(input:checked) { border-color: var(--accent); color: var(--accent); background: var(--surface-container-selected); }
/* Portal segmented control: the chosen segment is filled brand. */
.segmented .pill:has(input:checked) { background: var(--accent-bg); border-color: var(--accent-bg); color: var(--accent-contrast); }
.segmented .pill:has(input:checked) .pill-icon { color: inherit; }
.segmented .pill:has(input:checked) + .pill:has(input:checked) { border-left-color: var(--border-focus); }
.pill:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Buttons */
.btn { background: var(--surface); color: var(--text); border: 1px solid var(--border-dark); border-radius: var(--radius-xs); padding: 0.45rem 0.9rem; cursor: pointer; font: inherit; font-weight: var(--weight-medium); }
.btn:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }
.btn-primary { background: var(--accent-bg); color: var(--accent-contrast); border-color: var(--accent-bg); }
.btn-primary:hover { background: var(--accent-bg-hover); border-color: var(--accent-bg-hover); color: var(--accent-contrast); }
.btn-sm { padding: 0.3rem 0.6rem; font-size: 0.8rem; }
.btn.on { border-color: var(--accent); color: var(--accent); }
.btn-icon { background: none; border: none; cursor: pointer; font-size: 1.15rem; line-height: 1; color: var(--muted); padding: 0.1rem 0.2rem; border-radius: var(--radius-xs); }
.btn-icon:hover { color: var(--text); background: var(--surface-2); }
.btn-icon.on { color: var(--medium); }        /* bookmarked star */
.btn-icon.read { color: var(--low); }          /* read checkmark */

/* Feed */
.feed { display: flex; flex-direction: column; gap: 0.75rem; }
.feed-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 0.25rem 1rem; margin: 0.25rem 0 0.25rem; }
.feed-head h2 { margin: 0; font-size: 1.15rem; }
/* Its own row under the heading: the admin heads carry whole sentences, which nowrap on one
   flex line either overflowed or squeezed the title out. */
.feed-status { flex-basis: 100%; color: var(--muted); font-size: 0.82rem; }
.live-dot { display: inline-block; width: 0.5rem; height: 0.5rem; border-radius: 50%; background: var(--low); margin-right: 0.15rem; vertical-align: middle; }

/* Cards */
.card {
  position: relative; display: flex; gap: 0.9rem;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-s);
  padding: 0.85rem 1rem; box-shadow: var(--shadow);
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}
.card:hover { border-color: var(--accent); }
/* Unread: accent left rail + bold title + dot. Read: dimmed, normal weight. */
.card.is-unread { border-left: 3px solid var(--accent); }
.card.is-read { opacity: 0.64; }
.card.is-read:hover { opacity: 1; }

/* Thumbnail */
.thumb { flex: none; width: 6rem; height: 4.5rem; border-radius: var(--radius-s); overflow: hidden; background: var(--surface-2); }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }

.card-body { flex: 1; min-width: 0; }
.chips { display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem 0.4rem; }
.ago { color: var(--muted); font-size: 0.78rem; white-space: nowrap; }
/* Only rendered when the publisher revised the story after we collected it. */
.revised { color: var(--medium); font-size: 0.78rem; font-weight: 600; white-space: nowrap; }
.controls { position: relative; z-index: 1; display: inline-flex; align-items: center; gap: 0.1rem; }
/* Controls sit at the far right of the chips row. */
.chips .controls { margin-left: auto; }

.unread-dot { flex: none; width: 0.5rem; height: 0.5rem; border-radius: 50%; background: var(--accent); }
.byline { margin: 0.4rem 0 0; color: var(--muted); font-size: 0.8rem; }
/* Title row: headline on the left, timestamp + controls pinned top-right. */
.card-title { display: flex; align-items: flex-start; justify-content: space-between; gap: 0.75rem; margin: 0.25rem 0 0; font-size: 1.05rem; font-weight: 500; line-height: 1.3; }
.card-title .card-link { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.card-title-meta { flex: none; display: inline-flex; align-items: center; gap: 0.5rem; padding-top: 0.1rem; }
.is-unread .card-title { font-weight: 700; }
.card-link { color: var(--text); }
/* Stretched link: the title covers the whole card, so any click opens the item… */
.card-link::after { content: ""; position: absolute; inset: 0; }
.card-title a:hover { text-decoration: none; }
.summary { margin: 0.5rem 0 0; font-size: 0.9rem; color: var(--text); overflow-wrap: anywhere; }
.is-read .summary { color: var(--muted); }
.ttitle { margin: 0.15rem 0 0; color: var(--muted); font-style: italic; font-size: 0.9rem; overflow-wrap: anywhere; }

/* Chips + badges */
.chip { display: inline-flex; align-items: center; gap: 0.3rem; padding: 0.12rem 0.55rem; border-radius: var(--radius-xs); background: var(--badge-bg); color: var(--muted); font-size: 0.76rem; }
/* Chips that are filter links keep the chip look; only the hover marks them clickable. */
a.chip { text-decoration: none; border: 1px solid transparent; }  /* transparent: hover adds no shift */
a.chip:hover { border-color: var(--accent); color: var(--accent); background: var(--surface-container-selected); }
a.chip:hover .source { color: var(--accent); }
.coords { font-size: 0.76rem; color: var(--muted); }
.source-chip { position: relative; z-index: 1; }        /* grade tooltip stays interactive */
.source-chip .source { font-weight: 600; color: var(--text); }
.is-read .source-chip .source { color: var(--muted); }
.flag { font-size: 0.95rem; line-height: 1; }
.badge { display: inline-block; padding: 0.12rem 0.55rem; border-radius: var(--radius-xs); font-size: 0.72rem; font-weight: 600; background: var(--badge-bg); color: var(--muted); text-transform: capitalize; }
.badge-high { color: var(--content-on-surface-secondary); background: var(--high); }
.badge-medium { color: var(--content-on-surface-secondary); background: var(--medium); }
.badge-low { color: var(--content-on-surface-secondary); background: var(--low); }
.badge-context { color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, var(--surface)); }

/* Source grade letter (A best … F worst), colour-coded */
.grade { display: inline-grid; place-items: center; min-width: 1.15rem; height: 1.15rem; padding: 0 0.2rem; border-radius: 50%; font-size: 0.72rem; font-weight: 800; color: var(--content-on-surface-secondary); }
.grade-a { background: color-mix(in srgb, var(--surface-success) 80%, var(--surface-neutral-black)); }
.grade-b { background: var(--surface-success); }
.grade-c { background: color-mix(in srgb, var(--surface-notice) 70%, var(--surface-neutral-black)); }
.grade-d { background: var(--surface-danger); }
.grade-e, .grade-f { background: color-mix(in srgb, var(--surface-danger) 65%, var(--surface-neutral-black)); }

.load-more { display: block; margin: 1rem auto 0; }

/* Detail */
.detail-head { display: flex; align-items: flex-start; gap: 1rem; }
.detail-head h1 { margin: 0; flex: 1; font-size: 1.5rem; overflow-wrap: anywhere; }
.detail-head .controls { margin-left: 0; }
.detail-meta { display: flex; flex-wrap: wrap; gap: 0.5rem 0.75rem; align-items: center; color: var(--muted); font-size: 0.85rem; margin: 0.6rem 0; }
.detail .hero { max-width: 100%; height: auto; border-radius: var(--radius-s); margin: 0.5rem 0; max-height: 240px;}
.back { color: var(--muted); }
/* Original | translation side-by-side; full article one column below. */
.bodies { display: grid; grid-template-columns: 1fr 1fr; gap: 1.75rem; margin-top: 1rem; }
/* Long text and the sections under it sit on white cards, as in the Portal. */
.detail :is(.bodies, .full-text, .entities, .episodes, .feedback-section) {
  background: var(--surface); border-radius: var(--radius-s); box-shadow: var(--shadow); padding: var(--space-l) var(--space-xl);
}
.bodies.single { grid-template-columns: 1fr; }
.body-col { min-width: 0; }
.body-col:first-child + .body-col { border-left: 1px solid var(--border); padding-left: 1.75rem; }
.col-h { margin: 0 0 0.5rem; font-size: var(--text-s); font-weight: 700; color: var(--muted); }
.md p { margin: 0 0 0.85rem; overflow-wrap: anywhere; }
/* Fixed-height body text with a JS-free "Read more" toggle (hidden checkbox + label, the
   same pattern as the filter pills) — the clamped preview stays visible when collapsed. */
.clamp-check { position: absolute; opacity: 0; width: 0; height: 0; }
.clamp-body { max-height: 15rem; overflow: hidden; position: relative; }
.clamp-check:checked ~ .clamp-body { max-height: none; }
.clamp-body::after {
  content: ""; position: absolute; inset: auto 0 0 0; height: 3.5rem; pointer-events: none;
  background: linear-gradient(to bottom, transparent, var(--surface));
}
.clamp-check:checked ~ .clamp-body::after { content: none; }
.clamp-toggle { display: inline-block; cursor: pointer; user-select: none; color: var(--accent); font-size: 0.85rem; font-weight: 600; padding: 0.35rem 0 0.6rem; }
.clamp-toggle::after { content: "Read more ▾"; }
.clamp-check:checked ~ .clamp-toggle::after { content: "Show less ▴"; }
.clamp-toggle:hover { text-decoration: underline; }
.clamp-check:focus-visible ~ .clamp-toggle { outline: 2px solid var(--accent); outline-offset: 2px; }

.full-text { margin-top: var(--space-l); }
/* Excerpt, translation and full text are all Markdown, so the element rules cover both. */
.md :is(h1, h2, h3, h4) { margin: 1.2rem 0 0.6rem; line-height: 1.3; font-size: 1.05rem; }
.md :is(ul, ol) { margin: 0 0 0.85rem; padding-left: 1.4rem; }
.md blockquote { margin: 0 0 0.85rem; padding-left: 0.9rem; border-left: 3px solid var(--border); color: var(--muted); }
.md code { font-size: 0.9em; background: var(--badge-bg); padding: 0.1em 0.35em; border-radius: var(--radius-xs); }
.md pre { overflow-x: auto; padding: 0.75rem; background: var(--badge-bg); border-radius: var(--radius-xs); }
.md pre code { padding: 0; background: none; }
.md table { border-collapse: collapse; width: 100%; margin: 0 0 0.85rem; display: block; overflow-x: auto; }
.md :is(th, td) { border: 1px solid var(--border); padding: 0.4rem 0.6rem; text-align: left; }
.md img { max-width: 100%; }
.entities { margin-top: var(--space-l); }
.entity-row { display: flex; flex-wrap: nowrap; align-items: baseline; gap: 0.4rem; margin: 0 0 0.6rem; }
.entity-label { flex: 0 0 7rem; font-size: var(--text-s); font-weight: 700; color: var(--muted); }
.entity-values { display: flex; flex-wrap: wrap; gap: 0.35rem 0.4rem; min-width: 0; }
.geo-breadcrumb { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.3rem; font-size: 0.85rem; }
.geo-part:last-child { font-weight: 600; }
.geo-sep { color: var(--muted); }

/* Feedback */
.feedback-section, .detail .episodes { margin-top: var(--space-l); }
/* Inside the episodes card each episode is a row, not a second card. */
.detail .episodes .episode-card { margin: 0; padding: var(--space-l) 0; background: none; border: 0; border-radius: 0; box-shadow: none; }
.detail .episodes .episode-card + .episode-card { border-top: 1px solid var(--border); }
.detail .episodes .episode-card:last-child { padding-bottom: 0; }
.feedback textarea { width: 100%; }
.feedback-done { color: var(--low); font-weight: 600; }
.hint { color: var(--muted); font-size: 0.85rem; }

/* Sources directory */
.source-group { margin-top: 1.75rem; }
.group-h { display: flex; align-items: center; gap: 0.4rem; margin: 0 0 0.35rem; font-size: 1rem; }
.source-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(20rem, 100%), 1fr)); gap: 0.75rem; margin-top: 0.75rem; }
.source-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-s); padding: 0.85rem 1rem; box-shadow: var(--shadow); }
.source-head { display: flex; align-items: center; gap: 0.45rem; }
.source-name { margin: 0; font-size: 1rem; font-weight: 600; overflow-wrap: anywhere; }
.source-meta { display: flex; flex-wrap: wrap; gap: 0.35rem 0.4rem; margin-top: 0.5rem; }
.source-focus { margin: 0.5rem 0 0; color: var(--muted); font-size: 0.82rem; }
.source-about { margin: 0.5rem 0 0; font-size: 0.88rem; overflow-wrap: anywhere; }

/* Source detail — docs/reader.md#source-detail */
.source-detail { margin-top: 0.75rem; }
.source-detail .detail-head { align-items: center; }
.source-detail .detail-head .grade { width: 1.6rem; height: 1.6rem; min-width: 1.6rem; font-size: 0.85rem; }
.source-detail .source-meta { margin-top: 0.6rem; }
.source-link { margin: 0.6rem 0 0; font-size: 0.85rem; overflow-wrap: anywhere; }

.collection { margin-top: 2rem; border-top: 1px solid var(--border); padding-top: 1.25rem; }
.kv { margin: 0.75rem 0 0; display: flex; flex-direction: column; gap: 0.4rem; }
.kv-row { display: flex; gap: 0.6rem; align-items: baseline; font-size: 0.88rem; }
.kv dt { flex: 0 0 8rem; font-size: var(--text-s); font-weight: 700; color: var(--muted); }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.handle { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }

.original { display: flex; flex-wrap: wrap; gap: 0.35rem 1rem; }
.about-source { font-size: 0.9rem; }

.craap, .craap-rubric { margin-top: 2rem; border-top: 1px solid var(--border); padding-top: 1.25rem; }
.craap-scores { margin: 0.75rem 0 0; display: flex; flex-direction: column; gap: 0.85rem; }
.craap-score dt { display: flex; align-items: center; gap: 0.5rem; font-weight: 600; }
.craap-score dd { margin: 0.3rem 0 0 2rem; }
.craap-letter { display: inline-grid; place-items: center; width: 1.5rem; height: 1.5rem; flex: none; border-radius: var(--radius-xs); background: var(--surface-2); color: var(--muted); font-size: 0.8rem; font-weight: 800; }
.craap-value { margin-left: auto; font-variant-numeric: tabular-nums; }
.craap-value small { color: var(--muted); font-weight: 400; }
.score-bar { display: flex; width: 100%; height: 0.4rem; border-radius: var(--radius-pill); overflow: hidden; background: var(--badge-bg); }
.score-fill { display: block; height: 100%; background: var(--medium); }
.score-fill.score-5, .score-fill.score-4 { background: var(--low); }
.score-fill.score-2, .score-fill.score-1 { background: var(--high); }
.score-what { margin: 0.35rem 0 0; font-size: 0.85rem; color: var(--muted); }
.score-flag { margin: 0.2rem 0 0; font-size: 0.78rem; }
.score-flag.ok { color: var(--low); }
.score-flag.muted { color: var(--muted); }
.craap-notes { margin-top: 1.25rem; }
.craap-notes p { margin: 0; font-size: 0.88rem; overflow-wrap: anywhere; }
.craap-provenance { margin-top: 1rem; }

.rubric-param { border: 1px solid var(--border); border-radius: var(--radius-s); padding: 0.5rem 0.75rem; margin: 0.5rem 0; }
.rubric-param > summary { display: flex; align-items: center; gap: 0.5rem; cursor: pointer; font-weight: 600; }
.rubric-param > summary small { color: var(--muted); font-weight: 400; }
.rubric-param p { font-size: 0.88rem; }
.rubric-levels, .rubric-grades { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.rubric-levels th, .rubric-levels td, .rubric-grades th, .rubric-grades td { text-align: left; vertical-align: top; padding: 0.4rem 0.6rem; border-bottom: 1px solid var(--border); }
.rubric-levels th { width: 2rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.rubric-grades th { width: 4rem; }
.rubric-range { white-space: nowrap; font-variant-numeric: tabular-nums; color: var(--muted); }

/* Admin table */
table.users { width: 100%; border-collapse: collapse; }
.invite-form { display: flex; flex-wrap: wrap; align-items: end; gap: 0.6rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-s); padding: 0.75rem 0.85rem; margin-bottom: 0.8rem; }
.invite-form .hint { flex: 1 1 100%; margin: 0; }
.invite-form .row-error { flex: 1 1 100%; }
table.users th, table.users td { text-align: left; padding: 0.55rem 0.6rem; border-bottom: 1px solid var(--border); vertical-align: top; font-size: 0.88rem; }
.u-name { display: block; font-weight: 600; }
.u-email { display: block; color: var(--muted); font-size: 0.8rem; }
.row-error { display: block; color: var(--high); font-size: 0.8rem; margin-top: 0.25rem; }
.u-countries { min-width: 20rem; }
.u-countries form { display: flex; gap: 0.5rem; align-items: start; }
.u-countries .ts-wrapper { flex: 1; }

/* Uploads page — docs/reader.md#uploads */
.banner { margin: 0 0 var(--space-m); padding: var(--space-m) var(--space-l); border-radius: var(--radius-s); border-left: var(--border-width-l) solid; color: var(--text); }
.banner-success { background: var(--surface-success-subtle); border-left-color: var(--border-positive); }
.banner-danger { background: var(--surface-danger-subtle); border-left-color: var(--border-negative); }
.upload-card {
  display: flex; flex-direction: column; gap: var(--space-l); max-width: 42rem; margin: 0 0 var(--space-2xl);
  padding: var(--space-xl); background: var(--surface); border-radius: var(--radius-s); box-shadow: var(--shadow);
}
p.upload-card { display: block; text-align: left; }
.upload-text { display: flex; flex-direction: column; gap: var(--space-l); }
.upload-text[hidden] { display: none; }
.upload-card input[type=text], .upload-card textarea { width: 100%; box-sizing: border-box; }
.upload-card textarea { resize: vertical; font: inherit; }
.dropzone {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: var(--space-s);
  padding: var(--space-xl); border: var(--border-width-m) dashed var(--border-dark); border-radius: var(--radius-s);
  background: var(--surface-container-default); color: var(--text); text-align: center;
  font-size: var(--text-m); font-weight: var(--weight-regular); cursor: pointer;
}
.dropzone:hover, .dropzone.is-over { border-color: var(--border-brand); background: var(--surface-container-hovered); }
.dropzone:focus-within { outline: 2px solid var(--border-focus); outline-offset: 2px; }
.dropzone .icon { width: 2rem; height: 2rem; color: var(--accent); }
.dropzone-text { font-weight: var(--weight-medium); overflow-wrap: anywhere; }
/* The input covers the zone, so clicks and native file drops land on it anywhere. */
.dropzone input[type=file] { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.upload-card .form-actions { justify-content: flex-start; }
.req { color: var(--content-danger); }
.upload-card .field .hint { font-size: var(--text-s); font-weight: var(--weight-regular); }
.section-h { margin: 0 0 var(--space-m); font-size: var(--text-xl); line-height: var(--leading-xl); }
/* Uploads scroll sideways on a phone rather than squeeze; long uploader ids truncate (full id in the title). */
.uploads-table { min-width: 46rem; }
.uploads-table .uploader { max-width: 11rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-size: var(--text-s); }
.upload-progress { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: var(--space-xs); margin-top: var(--space-xs); font-size: var(--text-s); }
.chip-done { background: var(--surface-success-subtle); color: var(--content-success-text); }

/* Admin source management — docs/reader.md#administering-sources */
.source-admin-list { display: flex; flex-direction: column; gap: 0.6rem; }
.source-admin { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-s); padding: 0.75rem 0.85rem; box-shadow: var(--shadow); }
.source-admin.is-inactive { opacity: 0.72; border-style: dashed; }
.source-panel { margin-bottom: 1rem; }
.sa-head { display: flex; align-items: start; gap: 0.6rem; }
.sa-id { flex: 1; min-width: 0; }
.sa-name { margin: 0; font-size: 0.98rem; }
.sa-name a { color: inherit; text-decoration: none; }
.sa-name a:hover { color: var(--accent); text-decoration: underline; }
.sa-meta { display: flex; flex-wrap: wrap; gap: 0.3rem; margin-top: 0.3rem; }
.chip-off { background: color-mix(in srgb, var(--high) 14%, var(--surface)); color: var(--high); }
.grade-none { background: var(--badge-bg); color: var(--muted); }
.sa-error { color: var(--high); font-size: 0.82rem; margin: 0.4rem 0 0; word-break: break-word; }
.sa-check { font-size: 0.85rem; margin: 0.5rem 0 0; padding: 0.4rem 0.55rem; border-radius: var(--radius-xs); background: var(--surface-2); border-left: 3px solid var(--muted); }
.sa-check.check-healthy { border-left-color: var(--low); }
.sa-check.check-broken { border-left-color: var(--high); }
.sa-check.check-no_fetcher { border-left-color: var(--medium); }
.sa-check .hint { display: block; }

/* Actor suggestions — docs/reader.md#actor-suggestions */
.actor-tabs { margin: 0 0 var(--space-m); }
.pill .icon { width: 1rem; height: 1rem; }
.sg-evidence { display: flex; flex-wrap: wrap; gap: var(--space-m); margin: var(--space-s) 0 0; font-size: 0.82rem; }
.sg-hint { margin-top: var(--space-s); }
.sg-hint-expand, .sg-hint-alias { border-left-color: var(--accent); }
.sg-step { display: flex; flex-direction: column; align-items: flex-start; gap: var(--space-s); padding-top: var(--space-m); margin-top: var(--space-m); border-top: 1px solid var(--border-medium); }
.sg-fields { width: 100%; }
.sg-pair { display: grid; grid-template-columns: 1fr 1fr; margin-top: var(--space-m); padding-top: var(--space-m); border-top: 1px solid var(--border-medium); }
.sg-pair > .sg-step { border-top: none; margin-top: 0; padding-top: 0; min-width: 0; }
.sg-pair > .sg-step:first-child { padding-right: var(--space-l); }
.sg-pair > .sg-step + .sg-step { padding-left: var(--space-l); border-left: 1px solid var(--border-medium); }
@media (max-width: 743px) {
  .sg-pair { grid-template-columns: 1fr; }
  .sg-pair > .sg-step:first-child { padding-right: 0; }
  .sg-pair > .sg-step + .sg-step { padding-left: 0; border-left: none; margin-top: var(--space-m); padding-top: var(--space-m); border-top: 1px solid var(--border-medium); }
}
.sg-fields-pair { display: grid; grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr)); gap: var(--space-s) var(--space-m); }
.sg-fields select, .sg-fields input { width: 100%; }
.sg-note { color: var(--muted); font-size: 0.85rem; margin: var(--space-xs) 0 var(--space-m); }
.actor-suggestion.is-done { box-shadow: none; }
.sg-done { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-s) var(--space-m); margin: 0; }
.actor-suggestion.is-done .sg-note { margin-bottom: 0; }
.sg-ignored-title { font-size: 1rem; margin: var(--space-l) 0 0; }

/* Health dot: derived from ops.source_run_logs, never stored on the source. */
.sa-health { display: flex; flex-direction: column; align-items: end; gap: 0.1rem; text-align: right; flex: 0 0 auto; }
.health-dot { width: 0.6rem; height: 0.6rem; border-radius: 50%; display: inline-block; background: var(--muted); }
.health-label { font-size: 0.78rem; font-weight: 600; }
.health-when { color: var(--muted); font-size: 0.72rem; }
.health-healthy { background: var(--low); }
.health-stalled { background: var(--medium); }
.health-failing { background: var(--medium); }
.health-broken { background: var(--high); }
.health-no_fetcher { background: var(--muted); }
.health-never { background: transparent; border: 1px solid var(--muted); }
.health-uploaded { background: transparent; border: 1px dashed var(--muted); }
/* Stalled is "look at this", not "it's on fire": the fetch works, the feed went quiet. */
.health-stalled { box-shadow: 0 0 0 2px color-mix(in srgb, var(--medium) 35%, transparent); }
.sa-error.sa-warn { color: var(--medium); }

.health-declining { background: var(--medium); opacity: 0.7; }
.health-robots_blocked { background: var(--accent); }

/* Source triage: tabs, cause groups, bulk bar, compact table — docs/reader.md#triage */
.triage-tabs { display: flex; flex-wrap: wrap; gap: 0.3rem; margin: 0 0 0.75rem; }
.triage-tab { display: inline-flex; align-items: center; gap: 0.35rem; padding: 0.3rem 0.7rem; border-radius: var(--radius-xs); border: 1px solid var(--border); background: var(--surface); color: var(--muted); font-size: 0.82rem; font-weight: 600; text-decoration: none; }
.triage-tab:hover { color: var(--text); text-decoration: none; border-color: var(--accent); }
.triage-tab.is-active { background: var(--accent-bg); border-color: var(--accent-bg); color: var(--accent-contrast); }
.triage-count { font-variant-numeric: tabular-nums; font-weight: 800; }
.triage-new:not(.is-active) .triage-count, .triage-broken:not(.is-active) .triage-count { color: var(--high); }
.cause-groups { display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem; margin: 0 0 0.6rem; }
.cause-head { color: var(--muted); font-size: 0.76rem; margin-right: 0.2rem; }
.cause-chip { display: inline-flex; gap: 0.35rem; padding: 0.15rem 0.6rem; border-radius: var(--radius-xs); background: color-mix(in srgb, var(--high) 10%, var(--surface)); color: var(--text); font-size: 0.8rem; text-decoration: none; border: 1px solid transparent; }
.cause-chip:hover { border-color: var(--high); text-decoration: none; }
.cause-chip.is-active { border-color: var(--high); background: color-mix(in srgb, var(--high) 22%, var(--surface)); }
.cause-hint { font-size: 0.85rem; margin: 0 0 0.6rem; padding: 0.4rem 0.6rem; border-left: 3px solid var(--high); background: var(--surface-2); border-radius: var(--radius-xs); }
.chip.cause { background: color-mix(in srgb, var(--high) 12%, var(--surface)); color: var(--high); }
.bulk-bar { position: sticky; top: 0; z-index: 2; display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem; padding: 0.45rem 0.6rem; margin-bottom: 0.4rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-s); box-shadow: var(--shadow); }
.bulk-bar:not(.has-selection) button { opacity: 0.5; pointer-events: none; }
.deactivate-dialog { width: min(32rem, calc(100vw - 2rem)); padding: 1.1rem 1.2rem; border: 1px solid var(--border); border-radius: var(--radius-s); background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.deactivate-dialog::backdrop { background: var(--overlay-50); }
.deactivate-dialog h2 { margin: 0 0 0.4rem; font-size: 1.05rem; }
.deactivate-dialog textarea { width: 100%; box-sizing: border-box; }
.deactivate-dialog .form-actions { margin-top: 1rem; }
.st-actions .btn + .btn { margin-left: 0.25rem; }
.st-deactivated { display: block; margin-top: 0.3rem; font-size: 0.76rem; color: var(--medium); }
.bulk-count { font-size: 0.82rem; font-weight: 600; margin-right: 0.3rem; min-width: 6.5rem; }
.source-table { width: 100%; }
.source-table td { vertical-align: middle; }
.source-table .sel { width: 1.6rem; }
.source-row.is-inactive td { opacity: 0.65; }
.source-row.is-new { box-shadow: inset 3px 0 0 var(--high); }
.st-source { min-width: 14rem; max-width: 28rem; }
.st-name { font-weight: 600; color: var(--text); }
.st-host { display: block; color: var(--muted); font-size: 0.74rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.st-meta { display: flex; flex-wrap: wrap; gap: 0.25rem; margin-top: 0.25rem; }
.st-health { min-width: 12rem; max-width: 30rem; }
.st-health > * { display: block; margin-top: 0.15rem; }
.st-health > .chip { display: inline-flex; }
.st-badge { display: inline-flex !important; align-items: center; gap: 0.35rem; }
.st-error { color: var(--high); font-size: 0.74rem; word-break: break-word; }
.st-error.st-warn { color: var(--medium); }
.st-check { font-size: 0.74rem; padding-left: 0.4rem; border-left: 3px solid var(--muted); }
.st-check.check-healthy { border-left-color: var(--low); }
.st-check.check-broken { border-left-color: var(--high); }
.st-check.check-no_fetcher { border-left-color: var(--medium); }
.st-strip { display: inline-flex; align-items: flex-end; gap: 2px; height: 24px; }
.st-day { display: block; width: 5px; border-radius: 1px; background: var(--border); }
.st-day-ok { background: var(--low); }
.st-day-mixed { background: var(--medium); }
.st-day-failed { background: var(--high); }
.st-day-skipped { background: var(--muted); }
.st-when { white-space: nowrap; font-size: 0.82rem; }
.st-when small { display: block; }
.st-actions { white-space: nowrap; }
.warn-text { color: var(--medium); font-weight: 600; }

/* Extraction outcome shares. Widths are inline percentages of real attempts. */
.sa-extract { margin-top: 0.5rem; display: flex; flex-direction: column; gap: 0.25rem; align-items: start; }
.share-bar { display: flex; width: 100%; height: 0.4rem; border-radius: var(--radius-pill); overflow: hidden; background: var(--badge-bg); }
.share { display: block; height: 100%; }
.share-ok { background: var(--low); }
.share-paywall { background: var(--medium); }
.share-error { background: var(--high); }
.share-robots { background: var(--accent); }
.share-other { background: var(--muted); }
.share-legend { color: var(--muted); font-size: 0.76rem; }
.field-note { font-size: 0.8rem; color: var(--muted); margin: 0.25rem 0; flex: 1 1 100%; }
.field-note.warn { color: var(--medium); }

/* Edit disclosure: a hidden checkbox, so a row expands without JavaScript. */
.sa-actions { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.6rem; }
.sa-actions form { display: contents; }
.sa-actions > .btn { text-decoration: none; }

/* The form itself */
.source-form fieldset { border: 1px solid var(--border); border-radius: var(--radius-s); padding: 0.6rem 0.75rem 0.8rem; margin: 0 0 0.7rem; display: flex; flex-wrap: wrap; gap: 0.6rem; }
.source-form fieldset > .pill { align-self: flex-start; }
.source-form fieldset:has(input[name="is_active"]:checked) .deactivation-reason { display: none; }
.source-form legend { font-size: var(--text-s); font-weight: 700; color: var(--muted); padding: 0 0.3rem; }
.source-form .field { flex: 1 1 12rem; min-width: 10rem; }
.source-form .field-wide { flex: 1 1 100%; }
.source-form .field-score { flex: 0 0 5.5rem; min-width: 4.5rem; }
.source-form .hint { font-size: 0.74rem; text-transform: none; letter-spacing: 0; font-weight: 400; }
.source-form textarea.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.8rem; }
.source-form input[type=number], .source-form input[type=url] { background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: var(--radius-xs); padding: 0.45rem 0.55rem; font: inherit; }
.craap-grid { display: flex; flex-wrap: wrap; gap: 0.5rem; flex: 1 1 100%; }
.fetch-fields { display: flex; flex-wrap: wrap; gap: 0.6rem; flex: 1 1 100%; }
.form-actions { display: flex; gap: 0.5rem; }
.add-source { margin-bottom: 0.8rem; }
.add-source > .btn { display: inline-block; text-decoration: none; }
.back-link { margin: 0 0 0.8rem; font-size: 0.85rem; }

/* Busy state for the slow POSTs (assess, add, link check): htmx puts .htmx-request on the
   requesting form, so the label swaps for a spinner while the request is in flight. */
.btn-busy { display: none; align-items: center; gap: 0.35rem; }
.htmx-request .btn-label { display: none; }
.htmx-request .btn-busy { display: inline-flex; }
/* The add form's RRE path: fields and labels that apply only with the box ticked, or only without it */
.source-form .only-rre { display: none; }
.source-form:has(input[name="is_rre"]:checked) .only-rre { display: revert; }
.source-form:has(input[name="is_rre"]:checked) .not-rre { display: none; }
.btn[disabled] { opacity: 0.75; cursor: progress; }
.spinner { width: 0.75em; height: 0.75em; border: 2px solid currentColor; border-top-color: transparent; border-radius: 50%; display: inline-block; animation: spin 0.7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 2.4s; } }

/* Assessor progress + failure — docs/reader.md#adding-a-source */
.assess-log, .assess-failure { border: 1px solid var(--border); border-radius: var(--radius-s); background: var(--surface); padding: 0.9rem 1rem; margin: 0.75rem 0 1.25rem; box-shadow: var(--shadow); }
.assess-failure { border-left: 4px solid var(--high); }
.assess-head { display: flex; align-items: center; gap: 0.45rem; margin: 0 0 0.6rem; flex-wrap: wrap; }
.assess-steps { list-style: none; margin: 0; padding: 0; font-size: 0.85rem; }
.assess-step { display: flex; gap: 0.5rem; padding: 0.15rem 0; }
.assess-mark { flex: 0 0 1rem; color: var(--muted); }
.assess-msg { min-width: 0; overflow-wrap: anywhere; }
.assess-repairing .assess-mark, .assess-repairing .assess-msg { color: var(--high); }
.assess-failed .assess-mark, .assess-failed .assess-msg { color: var(--high); }
.assess-fields { margin: 0.4rem 0 0.6rem; padding-left: 1.1rem; font-size: 0.85rem; }
.assess-raw summary, .assess-log-past summary { cursor: pointer; font-size: 0.85rem; color: var(--muted); }
.assess-raw pre, .assess-raw-pre { max-height: 18rem; overflow: auto; font-size: 0.75rem; background: var(--bg); padding: 0.6rem; border-radius: var(--radius-xs); white-space: pre-wrap; overflow-wrap: anywhere; }
.assess-log-past { margin: 0.5rem 0 1.25rem; }
.reassess { border-radius: var(--radius-s); background: var(--surface); padding: var(--space-m) var(--space-l); margin: var(--space-s) 0 var(--space-l); box-shadow: var(--shadow); border-left: var(--border-width-l) solid var(--content-notice); }
.reassess h2 { margin: 0 0 var(--space-xs); font-size: var(--text-l); }
.reassess-table { width: 100%; border-collapse: collapse; font-size: var(--text-m); table-layout: fixed; }
.reassess-table col.reassess-field { width: 30%; }
.reassess-table th, .reassess-table td { text-align: left; padding: var(--space-xs) var(--space-s); border-bottom: 1px solid var(--border); vertical-align: top; overflow-wrap: break-word; }
.reassess-table thead th { color: var(--muted); font-weight: var(--weight-medium); }
.reassess-table tr.is-changed td:last-child { background: var(--surface-container-selected); font-weight: var(--weight-medium); }

/* Admin stats — docs/reader.md#pipeline-stats */
.stat-grid { display: flex; flex-wrap: wrap; gap: 0.75rem; margin: 0.75rem 0 1.4rem; }
.stat-tile { flex: 1 1 11rem; border: 1px solid var(--border); border-left: 4px solid var(--muted); border-radius: var(--radius-s); padding: 0.8rem 1rem; background: var(--surface); box-shadow: var(--shadow); }
.stat-tile-big { flex-basis: 100%; }
.stat-tile-label { font-size: var(--text-s); font-weight: 600; color: var(--muted); }
.stat-tile-value { margin-top: 0.3rem; font-size: 1.7rem; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat-tile-sub { margin-top: 0.3rem; font-size: 0.78rem; color: var(--muted); }
.stat-tile-total { border-left-color: var(--accent); }
.stat-tile-success { border-left-color: var(--low); }
.stat-tile-warning { border-left-color: var(--medium); }
.stat-tile-danger { border-left-color: var(--high); }
.stat-details { border: 1px solid var(--border); border-radius: var(--radius-s); padding: 0.6rem 0.85rem; margin: 0 0 1.4rem; }
.stat-details > summary { cursor: pointer; font-weight: 600; }
.stat-details .hint { margin: 0.4rem 0 0; }
.stat-details .stat-grid { margin-bottom: 0; }
.table-scroll { overflow-x: auto; margin: 0.5rem 0 1.4rem; }
.stat-table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
.stat-table th, .stat-table td { text-align: left; padding: 0.5rem 0.6rem; border-bottom: 1px solid var(--border); }
.stat-table td:last-child, .stat-table th:last-child { text-align: right; font-variant-numeric: tabular-nums; }
.stat-table td:last-child .queue-meta { justify-content: flex-end; }
.stat-table tfoot td { font-weight: 700; border-top: 2px solid var(--border); border-bottom: none; color: var(--text); }

/* Signal flow funnel: two real decision points (translate, sift), then a snapshot of where
   the relevant pool sits today. */
.funnel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-s); padding: 1rem 1.1rem; margin: 0.9rem 0 1.4rem; box-shadow: var(--shadow); }
.funnel-top { display: flex; align-items: stretch; gap: 0.75rem; flex-wrap: wrap; }
.funnel-node { flex: 1 1 11rem; padding: 0.8rem 1rem; border-radius: var(--radius-s); background: var(--surface-2); }
.funnel-node-total { border: 1px solid var(--border); }
.funnel-node-success { background: color-mix(in srgb, var(--low) 12%, var(--surface-2)); }
.funnel-arrow { display: flex; align-items: center; justify-content: center; font-size: 1.4rem; color: var(--muted); padding: 0 0.25rem; }
.funnel-branches { display: flex; gap: 1.25rem; margin-top: 0.9rem; padding-top: 0.9rem; border-top: 1px dashed var(--border); flex-wrap: wrap; }
.funnel-branch-group { flex: 1 1 14rem; display: flex; flex-direction: column; gap: 0.4rem; }
.funnel-branch-label { font-size: var(--text-s); font-weight: 700; color: var(--muted); }
.funnel-branch-row { display: flex; justify-content: space-between; gap: 0.6rem; padding: 0.35rem 0.6rem; border-radius: var(--radius-xs); font-size: 0.85rem; }
.funnel-branch-neutral { background: var(--badge-bg); color: var(--text); }
.funnel-branch-danger { background: color-mix(in srgb, var(--high) 12%, var(--surface)); color: var(--high); }
.funnel-pool { margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--border); }
.funnel-pool-label { font-size: 0.85rem; font-weight: 600; margin-bottom: 0.6rem; }
.funnel-pool-row { display: flex; gap: 0.6rem; flex-wrap: wrap; }
.funnel-pool-node { flex: 1 1 8rem; padding: 0.6rem 0.75rem; border-radius: var(--radius-s); background: var(--surface-2); border: 1px solid var(--border); }
.funnel-pool-node .stat-tile-value { font-size: 1.2rem; }
.funnel-pool-node-danger { background: color-mix(in srgb, var(--high) 10%, var(--surface)); border-color: color-mix(in srgb, var(--high) 30%, var(--border)); }

/* Stats tabs: server-rendered links, not CSS-only radios — the funnel/tab content lives
   outside the filter <form>, so this nav needs no JS and no sticky-form interaction, see
   docs/reader.md#pipeline-stats. */
.tabs { display: flex; flex-wrap: wrap; margin: 0 0 1rem; }
.tab-link { padding: 0.55rem 0.9rem; font-weight: 600; font-size: 0.88rem; color: var(--muted); border-bottom: 2px solid var(--border); }
.tab-link:hover { color: var(--text); text-decoration: none; }
.tab-link-active { color: var(--text); border-bottom-color: var(--accent); }
.tab-panel { margin-top: 1rem; }

/* Window switch — 7d/30d/90d/All-time links on "Enriched by country" and "Signals enriched
   by day"; reuses .btn/.btn-sm/.on rather than a new button style. */
.range-switch { display: flex; gap: 0.4rem; margin: 0.5rem 0; flex-wrap: wrap; }
.range-switch .btn { text-decoration: none; }

/* Notices / login */
.notice, .login { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-s); padding: 2rem; text-align: center; max-width: 34rem; margin: 3rem auto; box-shadow: var(--shadow); }
.empty { color: var(--muted); text-align: center; padding: 2rem; }
.dev-login { margin-top: 1.5rem; padding-top: 1rem; border-top: 1px dashed var(--border); }
.dev-login form { display: flex; gap: 0.5rem; justify-content: center; }
.about-bot { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-s); padding: 2rem; max-width: 46rem; margin: 2rem auto; box-shadow: var(--shadow); }
.about-bot h2 { margin-top: 1.5rem; }
.about-bot pre { white-space: pre-wrap; overflow-wrap: anywhere; }

/* ── Tom Select theming (light + dark via the vars above) ─────────────────── */
.ts-control {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-xs);
  color: var(--text); box-shadow: none; min-height: 2.2rem;
}
.ts-control:focus-within { border-color: var(--accent); box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 25%, transparent); }
.ts-wrapper.multi .ts-control > .item {
  background: color-mix(in srgb, var(--accent) 14%, var(--surface));
  color: var(--text); border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--border));
  border-radius: var(--radius-xs); padding: 0.05rem 0.5rem;
}
.ts-wrapper.multi .ts-control > .item .remove { border-left-color: color-mix(in srgb, var(--accent) 35%, var(--border)); }
.ts-control input { color: var(--text); }
.ts-control input::placeholder { color: var(--muted); }
.ts-dropdown {
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius-xs); box-shadow: var(--shadow); margin-top: 4px;
}
.ts-dropdown .active { background: color-mix(in srgb, var(--accent) 16%, var(--surface)); color: var(--text); }
.ts-dropdown .option { padding: 0.4rem 0.6rem; }

/* ── Phones and narrow tablets — docs/reader.md#mobile-layout ─────────────── */
@media (max-width: 640px) {
  /* 16px keeps iOS Safari from zooming the page when a field takes focus. */
  .field select, input[type=text], input[type=search], input[type=date], input[type=email],
  input[type=number], input[type=url], textarea, .ts-control input { font-size: 13px; }
  .field select, .field input, .field textarea, .ts-wrapper { width: 100%; }

  .brand-sub { display: none; }

  .content { padding: 0.85rem 0.75rem; }

  .filters { padding: 0.75rem; gap: 0.6rem 0.75rem; margin-bottom: 1rem; }
  .field-search, .field-countries, .field-areas, .entity-fields .field,
  .source-form .field, .source-form .field-score { flex: 1 1 100%; min-width: 0; }
  /* The right-alignment trick needs a wide row; stacked, it would strand the pills. */
  .pill-group { margin-left: 0; }

  .card { padding: 0.7rem 0.75rem; gap: 0.65rem; }
  .thumb { width: 4.25rem; height: 3.2rem; }
  .card-title { font-size: 1rem; gap: 0.5rem; }
  .summary { font-size: 0.86rem; }

  /* Touch targets: the icon buttons are ~18px of glyph, too small to hit reliably. */
  .btn-icon { min-width: 2.25rem; min-height: 2.25rem; display: inline-grid; place-items: center; padding: 0; }
  .controls { gap: 0.15rem; }

  .entity-row { flex-wrap: wrap; }
  .entity-label { flex-basis: 100%; }
  .kv-row { flex-wrap: wrap; }
  .kv dt { flex-basis: 100%; }
  .bodies { grid-template-columns: 1fr; gap: 1.25rem; }
  .body-col:first-child + .body-col { border-left: 0; padding-left: 0; }

  .detail-head { gap: 0.6rem; }
  .detail-head h1 { font-size: 1.25rem; }
  .detail .hero { max-height: 180px; }

  .craap-score dd { margin-left: 0; }
  .rubric-levels, .rubric-grades { font-size: 0.8rem; }

  .stat-tile { flex: 1 1 100%; }
  .stat-tile-value { font-size: 1.45rem; }
  .funnel-top { flex-direction: column; }
  .funnel-arrow { transform: rotate(90deg); }
  .u-countries { min-width: 14rem; }
  .u-countries form { flex-wrap: wrap; }

  .notice, .login { padding: 1.25rem; margin: 1.5rem auto; }
  .about-bot { padding: 1.25rem; margin: 1rem auto; }
  .sa-head { flex-wrap: wrap; }
  .sa-health { flex-direction: row; align-items: baseline; gap: 0.35rem; }
  .assess-log, .assess-failure { padding: 0.7rem 0.75rem; }
}

/* ── Split review gate ─────────────────────────────────────────────── */
.review-head { margin-bottom: 1rem; }
/* Seven counters wrap unevenly in the shared flex .stat-grid; an explicit grid wraps them evenly. */
.review-head .stat-grid, .stat-grid.queue-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(9.5rem, 1fr)); }
.queue-window { margin: 0 0 -0.25rem; font-size: var(--text-s); color: var(--muted); }
a.stat-tile-link { display: block; color: var(--text); text-decoration: none; }
a.stat-tile-link:hover { background: var(--surface-container-hovered); color: var(--text); text-decoration: none; }
a.stat-tile-link[aria-current="page"] { background: var(--surface-container-selected); border-color: var(--border-focus); }
.queue-tiles .stat-tile-value, .queue-tiles .stat-tile-label { display: block; }
.ai-metrics h2 { margin: var(--space-l) 0 0; font-size: var(--text-l); }
.ai-metrics .stat-grid.queue-tiles { grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); }
.ai-metrics .stat-tile-sub { display: block; }
.progress-period { margin-bottom: var(--space-l); }
.progress-controls { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-m) var(--space-l); margin-bottom: var(--space-l); }
.progress-person { display: inline-flex; align-items: center; gap: var(--space-s); font-size: var(--text-s); color: var(--muted); }
.progress-person select { font: inherit; font-size: var(--text-m); padding: 0.35rem 0.45rem; border: 1px solid var(--border-dark); border-radius: var(--radius-xs); background: var(--surface); color: var(--text); max-width: 100%; }
.progress-table tfoot th, .progress-table tfoot td { border-top: 2px solid var(--border); border-bottom: none; background: var(--surface-2); font-weight: 600; }
.segmented a.pill { color: var(--text); text-decoration: none; }
.segmented a.pill[aria-current="page"] { position: relative; z-index: 1; background: var(--accent-bg); border-color: var(--accent-bg); color: var(--accent-contrast); }
.progress-table tr.day-start td { border-top: 2px solid var(--border); }
.progress-table tr.is-you td { background: var(--surface-container-selected); }
.progress-table td.answers { white-space: nowrap; }
.progress-table tr.group-head th[scope="colgroup"] { text-align: center; border-left: 1px solid var(--border); }
.claim-banner { margin: 0 0 var(--space-l); padding: var(--space-s) var(--space-m); border-left: 4px solid var(--content-notice); border-radius: var(--radius-xs); background: var(--surface); box-shadow: var(--shadow); }
.backlog-note { margin: -0.6rem 0 1rem; padding: var(--space-s) var(--space-m); border-radius: var(--radius-xs); background: var(--surface-container-selected); font-size: var(--text-s); }
.review-head h1 { margin: 0 0 0.25rem; font-size: 1.35rem; }
.review-lede { margin: 0 0 0.6rem; color: var(--muted); font-size: 0.9rem; }

.gate-state { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; margin-bottom: 0.5rem; font-size: 0.8rem; }
.gate-pill { padding: 0.15rem 0.6rem; border-radius: var(--radius-xs); font-weight: 600; }
.gate-on { background: color-mix(in srgb, var(--accent) 16%, var(--surface)); color: var(--accent); }
.gate-off { background: var(--badge-bg); color: var(--muted); }
.gate-meta { color: var(--muted); }
.gate-note { color: var(--medium); }

.filter-bar { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 0.6rem; padding: 0.75rem; margin-bottom: 1rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-s); box-shadow: var(--shadow); }
.filter-bar > label { display: flex; flex-direction: column; gap: 0.2rem; font-size: 0.75rem; color: var(--muted); }
.filter-bar select, .filter-bar input[type="date"] { font: inherit; padding: 0.35rem 0.45rem; border: 1px solid var(--border); border-radius: var(--radius-xs); background: var(--surface); color: var(--text); }
.filter-checks, .correction-group, .decision-block { border: 1px solid var(--border); border-radius: var(--radius-s); padding: 0.4rem 0.6rem 0.55rem; margin: 0; }
.filter-checks legend, .correction-group legend, .decision-block legend { font-size: var(--text-s); font-weight: 600; color: var(--muted); padding: 0 0.25rem; }
.check, .radio { display: inline-flex; align-items: center; gap: 0.3rem; margin-right: 0.75rem; font-size: 0.82rem; color: var(--text); cursor: pointer; }

table.queue { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-s); overflow: hidden; }
table.queue th, table.queue td { text-align: left; padding: 0.55rem 0.7rem; border-bottom: 1px solid var(--border); vertical-align: top; font-size: 0.87rem; }
table.queue th { font-size: var(--text-s); color: var(--muted); background: var(--surface-2); }
table.queue tr:last-child td { border-bottom: none; }
table.queue .num { text-align: right; font-variant-numeric: tabular-nums; }
table.queue .warn { color: var(--medium); font-weight: 600; }
.queue-title a { font-weight: 600; }
.queue-meta { display: flex; flex-wrap: wrap; gap: 0.3rem; align-items: center; margin-top: 0.25rem; color: var(--muted); font-size: 0.78rem; }
.chip.warn { background: color-mix(in srgb, var(--medium) 16%, var(--surface)); color: var(--medium); }
.chip.bad { background: color-mix(in srgb, var(--high) 14%, var(--surface)); color: var(--high); }

.verdict { font-size: 0.78rem; font-weight: 600; }
.verdict-approved { color: var(--low); }
.verdict-rejected { color: var(--high); }
.verdict-correction_requested { color: var(--medium); }
.verdict-pending { color: var(--muted); font-weight: 400; }
/* The cluster gate's coherence answer, toned like the verdicts. */
.coherence-coherent { color: var(--low); }
.coherence-under_merged { color: var(--medium); }
.coherence-over_merged { color: var(--high); }

.filters-incidents .field-countries, .filters-incidents .field-sources { flex: 1 1 14rem; min-width: 10rem; }
table.queue td.nowrap, .stat-table td.nowrap { white-space: nowrap; }
.list-head { display: flex; align-items: center; justify-content: space-between; gap: 0.6rem; margin-bottom: 0.7rem; }
.list-count { color: var(--muted); font-size: 0.87rem; }
.btn-download { margin-left: auto; text-decoration: none; font-size: 0.85rem; }
.btn-download:hover { text-decoration: none; }

.pager { display: flex; align-items: center; gap: 0.6rem; margin-top: 0.9rem; }
.pager-at { color: var(--muted); font-size: 0.8rem; }

/* Two columns: the article on the left, its episodes on the right. */
.split-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 1rem; align-items: start; }
.split-head h1 { margin: 0 0 0.3rem; font-size: 1.2rem; }
.split-meta { display: flex; flex-wrap: wrap; gap: 0.45rem; align-items: center; color: var(--muted); font-size: 0.8rem; margin-bottom: 0.9rem; }
.split-body, .split-episodes { min-width: 0; }
.split-body h2, .split-episodes h2, .split-decision-section h2 { font-size: 0.8rem; color: var(--muted); margin: 0 0 0.4rem; }
.body-text { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-s); padding: 0.9rem 1rem; box-shadow: var(--shadow); white-space: pre-wrap; overflow-wrap: break-word; line-height: 1.65; max-height: 75vh; overflow-y: auto; }

/* Six hues so adjacent episodes stay distinguishable; the sup carries the number for
   anyone who cannot separate the colours. */
mark.q { padding: 0.05rem 0.1rem; border-radius: var(--radius-xs); color: inherit; }
mark.q sup, mark.cq sup { font-size: 0.65em; font-weight: 700; opacity: 0.85; padding-left: 0.15em; }
/* Claims underline, never fill: a fill must keep meaning "an episode was read from here". */
.cq { text-decoration: underline dashed var(--content-support); text-decoration-thickness: 1.5px; text-underline-offset: 0.22em; text-decoration-skip-ink: none; }
mark.cq { padding: 0.05rem 0.1rem; border-radius: var(--radius-xs); color: inherit; }
mark.cq:not(.q) { background: transparent; }
mark .cq-label { color: var(--muted); }
mark.q-join-l { padding-left: 0; border-top-left-radius: 0; border-bottom-left-radius: 0; }
mark.q-join-r { padding-right: 0; border-top-right-radius: 0; border-bottom-right-radius: 0; }
.q-0 { background: color-mix(in srgb, var(--vis-08-01) 34%, transparent); }
.q-1 { background: color-mix(in srgb, var(--vis-03-01) 34%, transparent); }
.q-2 { background: color-mix(in srgb, var(--surface-success) 34%, transparent); }
.q-3 { background: color-mix(in srgb, var(--vis-05-03) 34%, transparent); }
.q-4 { background: color-mix(in srgb, var(--vis-04-03) 34%, transparent); }
.q-5 { background: color-mix(in srgb, var(--vis-07-02) 34%, transparent); }
.episode-num { display: inline-flex; align-items: center; justify-content: center; min-width: 1.35rem; height: 1.35rem; border-radius: var(--radius-xs); font-weight: 700; font-size: 0.8rem; }
/* Only the split gate pairs a number with a body highlight; elsewhere it is a plain badge. */
.episode-num:not(.q) { background: var(--badge-bg); color: var(--muted); }

.episode-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-s); padding: 0.75rem 0.9rem; margin-bottom: 0.7rem; box-shadow: var(--shadow); }
.episode-top { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; margin-bottom: 0.4rem; }
.episode-cluster { margin-left: auto; text-decoration: none; }
.split-episodes .split-claims-head { margin-top: var(--space-l); }
.episode-type { font-weight: 600; font-size: 0.85rem; }
.episode-family { color: var(--muted); font-size: 0.76rem; }
.episode-summary { margin: 0 0 0.5rem; font-size: 0.9rem; line-height: 1.45; }
.episode-quote, .claim-quote { margin: 0 0 0.5rem; padding-left: 0.6rem; border-left: 2px solid var(--border); color: var(--muted); font-size: 0.83rem; }
.episode-fields { display: grid; grid-template-columns: 4.5rem minmax(0, 1fr); gap: 0.15rem 0.6rem; margin: 0 0 0.55rem; font-size: 0.82rem; }
.episode-fields dt { color: var(--muted); font-size: var(--text-s); padding-top: 0.1rem; }
.episode-fields dd { margin: 0; min-width: 0; }
.resolved-place { display: flex; flex-wrap: wrap; align-items: center; gap: 0.3rem; margin-top: 0.1rem; }
.place-trail { overflow-wrap: anywhere; }
a.place-trail { color: var(--accent); text-decoration: none; }
a.place-trail:hover { text-decoration: underline; }
.quoted { color: var(--muted); font-style: italic; font-size: 0.78rem; margin-top: 0.1rem; }
.muted { color: var(--muted); }
.actor { font-weight: 600; }
/* Ticked and linked = matched to the actor register; a dotted rule = named but unmatched. */
a.actor.is-registered { color: inherit; text-decoration: none; }
a.actor.is-registered:hover { text-decoration: underline; }
.reg-tick { color: var(--low); font-weight: 700; font-size: 0.8em; padding-left: 0.15em; }
.actor.is-unregistered { border-bottom: 1px dotted var(--border); }
.impact { display: inline-block; margin-right: 0.4rem; padding: 0.05rem 0.4rem; border-radius: var(--radius-xs); background: var(--badge-bg); font-size: 0.76rem; font-variant-numeric: tabular-nums; }

.episode-verdict { border-top: 1px solid var(--border); padding-top: 0.5rem; }

/* Collapsed by default: scanning the card is the common case, correcting is not. */
.corrections > summary { cursor: pointer; font-size: 0.78rem; color: var(--muted); }
.corrections[open] > summary { margin-bottom: 0.4rem; }
.correction-group { margin-bottom: 0.5rem; display: grid; grid-template-columns: repeat(auto-fit, minmax(8.5rem, 1fr)); gap: 0.35rem 0.5rem; }
.correction-group legend { grid-column: 1 / -1; }
.correction-field { display: flex; flex-direction: column; gap: 0.15rem; min-width: 0; font-size: 0.72rem; color: var(--muted); }
.correction-field input, .correction-field select, .correction-field textarea { font: inherit; font-size: 0.8rem; width: 100%; box-sizing: border-box; padding: 0.25rem 0.35rem; border: 1px solid var(--border); border-radius: var(--radius-xs); background: var(--surface); color: var(--text); }
.correction-field textarea { resize: vertical; }
.correction-field:has(textarea) { grid-column: 1 / -1; }
/* Forces the next row's first column, so a logical block never lands diagonally. */
.correction-field.starts-row { grid-column-start: 1; }
.corrections-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; }
.corrections-foot .hint { margin: 0; font-size: 0.72rem; }
.was { color: var(--medium); font-size: 0.7rem; }
.verdict-choice { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; margin-bottom: 0.4rem; }
.saved-note { color: var(--low); font-size: 0.78rem; }
.saved-banner { padding: 0.5rem 0.75rem; margin: 0 0 0.7rem; border-radius: var(--radius-s); background: var(--surface-2); font-size: 0.85rem; }
.split-decision-section { margin-top: 1.1rem; max-width: 42rem; }
.split-decision-section .cluster-verdict { margin-top: 0; }
.split-decision-section .decision-block { margin-bottom: 0.6rem; }
.split-decision-section .radio { display: flex; margin: 0.15rem 0; }
.notes { display: flex; flex-direction: column; gap: 0.2rem; margin-bottom: 0.6rem; font-size: 0.75rem; color: var(--muted); }
.notes textarea { font: inherit; padding: 0.4rem 0.5rem; border: 1px solid var(--border); border-radius: var(--radius-xs); background: var(--surface); color: var(--text); resize: vertical; }

@media (max-width: 900px) {
  .split-grid { grid-template-columns: minmax(0, 1fr); }
  .body-text { max-height: 40vh; }
}

/* ── Cluster review ─────────────────────────────────────────────────────────── */
.cluster-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 1rem; align-items: start; }
.cluster-event, .cluster-members { min-width: 0; }
.event-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-s); padding: 0.9rem 1rem; box-shadow: var(--shadow); }
.event-card + .event-card { margin-top: 0.9rem; }
.event-card > h3 { margin: 0 0 0.5rem; }
.event-card > .chip-row { margin-bottom: 0.6rem; }
.event-summary { font-size: 1.05rem; margin: 0.5rem 0 0.3rem; line-height: 1.4; }
.event-act { color: var(--muted); margin: 0 0 0.6rem; font-size: 0.85rem; }
.chip-row { display: flex; flex-wrap: wrap; gap: 0.3rem; align-items: center; }
.chip-good { background: color-mix(in srgb, var(--surface-success) 18%, transparent); }
.discrepancies { margin: 0.7rem 0 0; padding-left: 1.1rem; font-size: 0.82rem; color: var(--muted); }
.credibility-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-s); padding: 0.9rem 1rem; margin-top: 0.9rem; box-shadow: var(--shadow); }
.credibility-card h3 { margin: 0 0 0.55rem; font-size: 0.8rem; color: var(--muted); }
.cred-verdict { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: baseline; }
.cred-tier { font-size: 1.05rem; font-weight: 600; text-transform: capitalize; }
/* Colour climbs with the rung, so the tier reads before the words do. */
.cred-tier.tier-singleton { color: var(--muted); }
.cred-tier.tier-corroborated { color: var(--muted); }
.cred-tier.tier-triangulated { color: var(--text); }
.cred-tier.tier-well_established { color: var(--surface-success); }
.cred-tier.tier-authoritative { color: var(--content-success-text); }
.cred-blocked { font-size: 0.8rem; color: var(--muted); }
.cred-level { font-size: 0.78rem; color: var(--muted); }
/* A filled-pip meter, so the rung reads before the word does. */
.cred-pips { display: inline-flex; gap: 0.18rem; align-items: center; align-self: center; }
.cred-pips i { width: 0.85rem; height: 0.32rem; border-radius: var(--radius-pill); background: var(--border); }
.cred-pips i.on { background: currentColor; }
.cred-verdict .cred-pips { color: var(--accent); }
.cred-alert { margin: 0.55rem 0 0; padding: 0.4rem 0.6rem; border-radius: var(--radius-xs); font-size: 0.82rem; background: color-mix(in srgb, var(--medium) 12%, transparent); color: var(--text); }

.cred-indicators { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.7rem 1rem; margin: 0.8rem 0 0; }
.cred-indicators > div { min-width: 0; }
.cred-indicators dt { color: var(--muted); font-size: var(--text-s); }
.cred-indicators dd { margin: 0; }
.cred-value { font-size: 1.1rem; font-weight: 600; line-height: 1.3; }
.cred-value .muted { font-size: 0.78rem; font-weight: 400; }
.cred-value.warn { color: var(--medium); }
.cred-note { font-size: 0.76rem; color: var(--muted); line-height: 1.45; margin: 0.15rem 0 0; }
.cred-chips { display: flex; flex-wrap: wrap; gap: 0.25rem; margin-top: 0.3rem; }

.cred-legend { margin-top: 0.9rem; font-size: 0.82rem; }
.cred-legend > summary { cursor: pointer; color: var(--muted); }
.cred-ladder-scroll { overflow-x: auto; margin: 0.5rem 0; }
.cred-ladder { width: 100%; border-collapse: collapse; font-size: 0.76rem; }
.cred-ladder th { text-align: left; color: var(--muted); font-weight: 500; padding: 0.2rem 0.35rem; border-bottom: 1px solid var(--border); }
.cred-ladder td { padding: 0.22rem 0.35rem; border-bottom: 1px solid var(--border); text-transform: capitalize; }
.cred-ladder .num { text-align: right; font-variant-numeric: tabular-nums; }
.cred-ladder tr.is-current { background: color-mix(in srgb, var(--accent) 10%, transparent); font-weight: 600; }
.cred-ladder .base-note { color: var(--muted); font-style: italic; text-transform: none; }

@media (max-width: 1100px) {
  .cred-indicators { grid-template-columns: minmax(0, 1fr); }
}
.followups { margin-top: 0.9rem; font-size: 0.85rem; }
.followups ul { margin: 0.3rem 0 0; padding-left: 1.1rem; }

.marker-legend { list-style: none; margin: 0 0 0.7rem; padding: 0; font-size: 0.74rem; color: var(--muted); display: grid; gap: 0.15rem; }
.marker-legend li { display: flex; gap: 0.4rem; align-items: baseline; }
.marker-legend .swatch { flex: none; width: 0.85rem; height: 0.85rem; border-radius: var(--radius-xs); border: 1px solid var(--border); }
/* Each swatch is the marker itself, so the legend cannot drift from the cards. */
.marker-legend .swatch.odd-type { background: color-mix(in srgb, var(--vis-08-01) 10%, transparent); }
.marker-legend .swatch.mention-secondary { border-left: 3px solid color-mix(in srgb, var(--surface-notice) 60%, transparent); }
.marker-legend .swatch.mention-background { border-left: 3px solid color-mix(in srgb, var(--surface-danger) 60%, transparent); }
.marker-legend .swatch.is-late { background: var(--badge-bg); opacity: 0.75; }

/* ── incident review ─────────────────────────────────────────────────────── */
.chip.status-approved { background: color-mix(in srgb, var(--surface-success) 18%, transparent); }
.chip.status-rejected, .chip.status-duplicate { color: var(--muted); }
.chip.status-pending_review { background: color-mix(in srgb, var(--vis-03-01) 12%, transparent); }
.member-card.not-sent { opacity: 0.6; }
.source-summary { margin: 0.4rem 0 0.3rem; font-size: 0.85rem; }
.evidence { margin: 0.3rem 0; padding: 0.3rem 0 0.3rem 0.7rem; border-left: 2px solid var(--border);
            color: var(--muted); font-size: 0.8rem; font-style: italic; }
.plain-list { margin: 0.2rem 0; padding-left: 1.1rem; font-size: 0.85rem; }
.plain-list li { margin-bottom: 0.15rem; }
.check-list { display: grid; gap: var(--space-xs); margin: 0; padding: 0; list-style: none; font-size: var(--text-m); line-height: var(--leading-m); color: var(--content-body); }
.check-warn { display: flex; align-items: flex-start; gap: var(--space-xs); }
.check-warn .icon { width: 1rem; height: 1rem; margin-top: 0.125rem; fill: var(--content-notice); }
.check-fixed { color: var(--content-support); padding-left: calc(1rem + var(--space-xs)); }
.check-rule { color: var(--content-support); font-size: var(--text-s); white-space: nowrap; }
.impact-block { margin-top: 0.7rem; }
.impact-block h3 { font-size: 0.8rem;
                   color: var(--muted); margin: 0 0 0.25rem; }

.members-head { font-size: 0.8rem; color: var(--muted); margin: 0 0 0.2rem; }
details.source-group { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-s); margin-bottom: 0.7rem; box-shadow: var(--shadow); }
details.source-group > summary { cursor: pointer; padding: 0.55rem 0.8rem; display: flex; gap: 0.45rem; align-items: center; flex-wrap: wrap; }
.source-name { font-weight: 600; }

.member-card { border-top: 1px solid var(--border); padding: 0.7rem 0.8rem; border-left: 3px solid transparent; }
/* An absorbed secondary or background mention is a common over-merge cause. */
.member-card.mention-secondary { border-left-color: color-mix(in srgb, var(--surface-notice) 60%, transparent); }
.member-card.mention-background { border-left-color: color-mix(in srgb, var(--surface-danger) 60%, transparent); }
/* A member whose type differs from the event's: visible without reading a word. */
.member-card.odd-type { background: color-mix(in srgb, var(--vis-08-01) 10%, transparent); }
.member-card.is-late { opacity: 0.75; }
.member-foot { display: flex; gap: 0.7rem; font-size: 0.78rem; margin-top: 0.35rem; }
.copies { color: var(--muted); font-size: 0.8rem; margin: 0.35rem 0 0; }
.member-verdict { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; margin-top: 0.45rem; font-size: 0.8rem; }
.badge-anchor { background: color-mix(in srgb, var(--vis-03-01) 24%, transparent); }
.badge-late { background: color-mix(in srgb, var(--vis-04-03) 24%, transparent); }
.late-members { margin-top: 1rem; }

.cluster-verdict, .ai-findings { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-s); padding: 0.9rem 1rem; margin-top: 0.9rem; box-shadow: var(--shadow); }
.cluster-verdict h3, .ai-findings h3 { margin: 0 0 0.5rem; font-size: 0.8rem; color: var(--muted); }
.ai-findings { font-size: 0.87rem; margin-bottom: 0.9rem; }
.ai-findings h4 { margin: 0.7rem 0 0.25rem; font-size: var(--text-s); font-weight: 600; color: var(--muted); }
.ai-findings ul, .ai-findings ol { margin: 0; padding-left: 1.1rem; }
.ai-findings li { margin: 0.3rem 0; }
.ai-quote, .ai-member { display: block; color: var(--muted); font-size: 0.82rem; }
.notes-field { display: block; margin: 0.6rem 0; }
.notes-field textarea { width: 100%; }
.decision-state { font-size: 0.8rem; color: var(--muted); margin: 0.5rem 0 0; }
.prior-reviews { list-style: none; margin: 0 0 0.7rem; padding: 0 0 0.6rem; border-bottom: 1px solid var(--border); font-size: 0.82rem; color: var(--muted); }
.prior-reviews li { margin: 0.15rem 0; }
.prior-review-note { display: block; color: var(--text); }

@media (max-width: 900px) {
  .cluster-grid { grid-template-columns: minmax(0, 1fr); }
}
.lifecycle-banner { border-radius: var(--radius-s); padding: 0.5rem 0.8rem; margin: 0 0 0.7rem; font-size: 0.85rem; border: 1px solid var(--border); }
.lifecycle-banner.lifecycle-open, .lifecycle-banner.lifecycle-published { background: color-mix(in srgb, var(--vis-03-01) 12%, transparent); }
.lifecycle-banner.lifecycle-discarded, .lifecycle-banner.lifecycle-merged, .lifecycle-banner.lifecycle-released { background: color-mix(in srgb, var(--surface-neutral-medium) 14%, transparent); }
.chip.lifecycle-sealed { background: color-mix(in srgb, var(--surface-success) 18%, transparent); }
.chip.lifecycle-discarded, .chip.lifecycle-merged, .chip.lifecycle-released { color: var(--muted); }

/* Changed since the last review — docs/review-gates.md#changed-since-the-last-review */
.changes-banner { background: var(--surface); border: 1px solid var(--border); border-left: 3px solid var(--accent); border-radius: var(--radius-s); padding: 0.7rem 0.9rem; margin: 0 0 0.9rem; font-size: 0.85rem; box-shadow: var(--shadow); }
.changes-banner h2 { font-size: 1rem; margin: 0 0 0.3rem; }
.changes-banner h3 { font-size: 0.85rem; margin: 0.7rem 0 0.2rem; }
.changes-banner p { margin: 0 0 0.5rem; }
.changes-fields { width: 100%; border-collapse: collapse; margin-top: 0.5rem; table-layout: fixed; }
.changes-fields th, .changes-fields td { text-align: left; vertical-align: top; padding: 0.3rem 0.4rem; border-top: 1px solid var(--border); overflow-wrap: anywhere; font-weight: 400; }
.changes-fields thead th { border-top: 0; color: var(--muted); font-weight: 600; }
.changes-fields th[scope="row"] { width: 6.5rem; font-weight: 600; }
.changes-removed { margin: 0; padding-left: 1.1rem; }
.chip.chip-new { background: var(--surface-container-selected); color: var(--accent); font-weight: 600; }
.member-card.is-new { background: color-mix(in srgb, var(--surface-container-selected) 55%, transparent); }

/* Pipeline progress strip on the item page — docs/reader.md#pipeline-progress */
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.progress { margin: 1.25rem 0; overflow-x: auto; }
.steps { --dot: 1.5rem; --line: var(--border); display: flex; list-style: none; margin: 0; padding: 0 0 0.25rem; min-width: 34rem; }
.step { position: relative; flex: 1 1 0; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 0.15rem; padding: 0 0.2rem; --c: var(--muted); }
.step + .step::before { content: ""; position: absolute; top: calc(var(--dot) / 2 - 1px); right: calc(50% + var(--dot) / 2 + 0.2rem); left: calc(-50% + var(--dot) / 2 + 0.2rem); border-top: 2px solid var(--c); }
.step-dot { display: grid; place-items: center; width: var(--dot); height: var(--dot); border-radius: 50%; border: 2px solid var(--c); background: var(--surface); color: var(--content-on-surface-secondary); }
.step-dot svg { width: 0.85rem; height: 0.85rem; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.step-label { font-size: 0.78rem; font-weight: 600; color: var(--text); }
.step-note { font-size: 0.7rem; color: var(--muted); line-height: 1.25; max-width: 7.5rem; overflow-wrap: anywhere; }
.step-at { font-size: 0.68rem; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.step-done { --c: var(--low); }
.step-failed { --c: var(--high); }
.step-stopped { --c: var(--medium); }
.step-done .step-dot, .step-failed .step-dot, .step-stopped .step-dot { background: var(--c); }
.step-failed .step-note, .step-stopped .step-note { color: var(--c); font-weight: 600; }
.step-skipped .step-dot { color: var(--muted); }
.step-skipped::before { border-top-color: var(--low) !important; }
.step-next { --c: var(--accent); }
.step-next .step-dot::after { content: ""; width: 0.45rem; height: 0.45rem; border-radius: 50%; background: var(--accent); }
.step-next::before, .step-pending::before { border-top-style: dashed !important; border-top-color: var(--line) !important; }
.step-pending { --c: var(--line); }
.step-pending .step-label { color: var(--muted); font-weight: 500; }
.step-unreachable { --c: var(--line); opacity: 0.55; }
.step-unreachable .step-dot { border-style: dotted; }
.step-unreachable::before { border-top-style: dotted !important; }
.step-unreachable .step-label { color: var(--muted); font-weight: 500; text-decoration: line-through; }
@media (prefers-reduced-motion: no-preference) {
  .step-next .step-dot { animation: step-pulse 2s ease-in-out infinite; }
}
@keyframes step-pulse { 50% { box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 22%, transparent); } }

/* /map — docs/reader.md#map */
.map-controls { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-xs) var(--space-l); margin: var(--space-m) 0; font-size: var(--text-s); }
.map-controls label { display: inline-flex; align-items: center; gap: var(--space-xs); cursor: pointer; }
.map-controls-sep { width: 1px; align-self: stretch; background: var(--border); }
.map-swatch { display: inline-block; width: 0.75rem; height: 0.75rem; border-radius: var(--radius-circle); }
.map-settlement { background: var(--map-settlement); }
.map-admin2 { background: var(--map-admin2); }
.map-admin1 { background: var(--map-admin1); }
.map-status { margin-left: auto; color: var(--muted); }
.map { height: calc(100vh - 20rem); min-height: 28rem; border-radius: var(--radius-s); box-shadow: var(--shadow); }
.map .leaflet-popup-content-wrapper, .map .leaflet-popup-tip { background: var(--surface); color: var(--text); }
.map-popup { max-width: 18rem; font: inherit; }
.map-popup-title { font-weight: var(--weight-medium); }
.map-popup-meta { color: var(--muted); font-size: var(--text-s); }
.map-popup-summary { margin: var(--space-xs) 0; }

/* Incident review: verdict first, corrections inline in the record — docs/reader.md#incident-review */
.incident-head { margin: 0 0 var(--space-l); }
.incident-head h1 { margin: 0; font-size: var(--heading-h6); line-height: 1.33; }
.incident-sub { margin: var(--space-2xs) 0 var(--space-s); color: var(--muted); }
.incident-grid { gap: var(--space-l); }

.verdict-card { display: grid; gap: var(--space-m); margin: 0 0 var(--space-l); padding: var(--space-l) var(--space-xl); background: var(--surface); border-radius: var(--radius-s); box-shadow: var(--shadow); }
.verdict-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--space-2xs) var(--space-l); }
.verdict-head h2, .record-card-head h2 { margin: 0; font-size: var(--text-xl); line-height: var(--leading-xl); }
.verdict-history h3 { margin: 0 0 var(--space-xs); font-size: var(--text-m); }
.history-list { display: grid; gap: var(--space-m); max-height: 22rem; overflow-y: auto; margin: 0; padding: 0; list-style: none; }
.history-entry { display: grid; gap: var(--space-xs); padding-left: var(--space-m); border-left: 2px solid var(--border); }
.history-entry:first-child { border-left-color: var(--border-brand); }
.history-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--space-2xs) var(--space-s); margin: 0; }
.history-head [class^="verdict-"] { font-weight: var(--weight-medium); }
.history-notes { margin: 0; white-space: pre-line; }
.history-changes { display: grid; gap: var(--space-2xs); margin: 0; padding: 0; list-style: none; font-size: var(--text-s); }
.history-changes .rec-was { margin-left: var(--space-xs); }
.verdict-notes { display: grid; gap: var(--space-xs); font-size: var(--text-s); color: var(--muted); }
.verdict-notes textarea { min-height: 4.5rem; padding: var(--space-s) var(--space-m); font: inherit; font-size: var(--text-m); color: var(--text); background: var(--surface); border: 1px solid var(--border-dark); border-radius: var(--radius-xs); resize: vertical; }
.verdict-actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-s); }
.btn-verdict { display: inline-flex; align-items: center; gap: var(--space-s); min-height: 2.5rem; padding: 0 var(--space-l) 0 var(--space-m); font-weight: var(--weight-medium); }
.btn-verdict .icon { width: 1.25rem; height: 1.25rem; }
.btn-reject { background: var(--surface-neutral-super-light); border-color: transparent; }
.btn-reject .icon { color: var(--content-danger); }
.btn-reject:hover { background: var(--surface-danger); border-color: var(--surface-danger); color: var(--content-on-surface-secondary); }
.btn-reject:hover .icon { color: inherit; }
.btn-text { display: inline-flex; align-items: center; gap: var(--space-xs); min-height: 2.5rem; padding: 0 var(--space-s); border: 0; border-radius: var(--radius-xs); background: none; color: var(--muted); font: inherit; font-weight: var(--weight-medium); cursor: pointer; }
.btn-text[hidden] { display: none; }
.btn-text:hover { color: var(--text); background: var(--surface-container-hovered); }
.btn-text .icon { width: 1.125rem; height: 1.125rem; }
.verdict-actions .saved-note { display: inline-flex; align-items: center; gap: var(--space-xs); margin-left: auto; font-size: var(--text-m); font-weight: var(--weight-medium); }
.verdict-actions .saved-note .icon { width: 1.125rem; height: 1.125rem; }
.verdict-edits { margin: 0; font-size: var(--text-s); color: var(--content-primary); }
.verdict-card .hint { margin: 0; font-size: var(--text-s); }
@media (prefers-reduced-motion: no-preference) {
  .verdict-card.is-saved .saved-note { animation: saved-in 0.3s ease-out; }
}
@keyframes saved-in { from { opacity: 0; transform: translateY(2px); } }

.record-card { padding: var(--space-l) var(--space-xl); }
.record-card-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: var(--space-2xs) var(--space-l); margin-bottom: var(--space-s); }
.record-card-head .hint, .record-section-head .hint { margin: 0; font-size: var(--text-s); }
.rec-fields { display: grid; gap: var(--space-2xs); margin: 0; }
.rec-row { display: grid; grid-template-columns: 8.5rem minmax(0, 1fr); gap: var(--space-m); margin: 0 calc(-1 * var(--space-s)); padding: var(--space-s); border-radius: var(--radius-xs); }
.rec-row dt { color: var(--muted); font-size: var(--text-s); line-height: var(--leading-m); }
.rec-row dd { display: flex; align-items: flex-start; gap: var(--space-s); min-width: 0; margin: 0; }
.rec-value { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.rec-shown, .rec-pending { display: flex; flex-direction: column; align-items: flex-start; gap: var(--space-2xs); }
.rec-value .plain-list { margin: 0; font-size: inherit; }
.rec-narrative { margin: 0; max-width: 68ch; }
.rec-was { font-size: var(--text-s); color: var(--content-notice-text); }

.rec-row.is-editable { cursor: pointer; }
.rec-row.is-editable:hover { background: var(--surface-container-hovered); }
.rec-edit { display: inline-grid; flex: none; place-items: center; width: 1.75rem; height: 1.75rem; margin: -0.25rem 0; padding: 0; border: 0; border-radius: var(--radius-xs); background: none; color: var(--content-primary); cursor: pointer; opacity: 0; }
.rec-edit .icon { width: 1rem; height: 1rem; }
.rec-row:hover .rec-edit, .rec-edit:focus-visible { opacity: 1; }
@media (hover: none) { .rec-edit { opacity: 1; color: var(--muted); } }

.rec-row.is-corrected, .rec-row.is-dirty { box-shadow: inset 2px 0 0 var(--border-brand); }
.rec-row.is-editing { cursor: default; background: var(--surface-container-default); }
.rec-row.is-editing:hover { background: var(--surface-container-default); }
.rec-row.is-editing .rec-value, .rec-row.is-editing .rec-edit { display: none; }
.rec-editor { display: grid; flex: 1; grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr)); gap: var(--space-s) var(--space-m); min-width: 0; }
.rec-editor[hidden] { display: none; }
.rec-input { display: grid; align-content: start; gap: var(--space-2xs); min-width: 0; font-size: var(--text-s); color: var(--muted); }
.rec-input:has(textarea) { grid-column: 1 / -1; }
.rec-input :is(input, select, textarea) { width: 100%; min-height: 2.25rem; padding: var(--space-xs) var(--space-s); font: inherit; font-size: var(--text-m); color: var(--text); background: var(--surface); border: 1px solid var(--border-dark); border-radius: var(--radius-xs); }
.rec-input textarea { resize: vertical; }
.rec-input.is-rows, .rec-input:has(select[multiple]) { grid-column: 1 / -1; }
.rec-row.is-editing:has(.is-rows) { grid-template-columns: minmax(0, 1fr); gap: var(--space-xs); }
.rec-rows { display: grid; gap: var(--space-xs); }
.rec-item { display: grid; grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr)); align-items: end; gap: var(--space-s) var(--space-m); padding: 0 0 var(--space-s); border-bottom: 1px solid var(--border); }
.rec-rows > .btn-text { justify-self: start; margin-left: calc(-1 * var(--space-s)); }
.rec-item-remove { justify-self: start; }
.rec-item-remove:hover { color: var(--content-danger); }
.rec-input .ts-wrapper { width: 100%; font-size: var(--text-m); color: var(--text); }
.rec-editor-foot { display: flex; grid-column: 1 / -1; align-items: center; gap: var(--space-m); }
.rec-editor-foot .btn { display: inline-flex; align-items: center; gap: var(--space-xs); }
.rec-editor-foot .btn .icon { width: 1rem; height: 1rem; }
.rec-editor-foot .btn-text { min-height: 2rem; }
.rec-input.is-wide { grid-column: 1 / -1; }
.rec-row.is-staged .rec-shown { display: none; }
.rec-editor-foot .hint { font-size: var(--text-s); }

.record-section { margin-top: var(--space-l); padding-top: var(--space-m); border-top: 1px solid var(--border); }
.record-section-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: var(--space-2xs) var(--space-l); margin-bottom: var(--space-xs); }
.record-section-head h3 { margin: 0; font-size: var(--text-l); }

@media (max-width: 743px) {
  .verdict-card, .record-card { padding: var(--space-l); }
  .rec-row { grid-template-columns: minmax(0, 1fr); gap: var(--space-2xs); }
  .verdict-actions .saved-note { margin-left: 0; }
}

/* A source block as the classificator reads it — docs/review-gates.md#the-record-beside-its-sources */
.source-facts { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: var(--space-2xs) var(--space-s); margin: 0 0 var(--space-s); font-size: var(--text-s); }
.source-facts dt { color: var(--muted); }
.source-facts dd { margin: 0; }
.source-text { margin: 0 0 var(--space-xs); }
.source-text > summary { cursor: pointer; font-size: var(--text-s); color: var(--muted); }
.source-text .evidence { font-style: normal; white-space: pre-line; max-height: 24rem; overflow-y: auto; }

/* Gen2 Portal tables and filters (Reports browser) — docs/reader.md#tables-and-filters */
.content:has(table.queue, table.users) { max-width: none; }
:root {
  --control-h: 2.25rem;
  --table-rule: var(--surface-primary-inverted-default);
  --icon-chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 -960 960 960'%3E%3Cpath d='M480-356q-6 0-11-2t-10-7L261-563q-9-9-8.5-21.5T262-606q9-9 21.5-9t21.5 9l175 176 176-176q9-9 21-8.5t21 9.5q9 9 9 21.5t-9 21.5L501-365q-5 5-10 7t-11 2Z'/%3E%3C/svg%3E");
  --icon-search: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 -960 960 960'%3E%3Cpath d='M378-329q-108.16 0-183.08-75Q120-479 120-585t75-181q75-75 181.5-75t181 75Q632-691 632-584.85 632-542 618-502q-14 40-42 75l242 240q9 8.56 9 21.78T818-143q-9 9-22.22 9-13.22 0-21.78-9L533-384q-30 26-69.96 40.5Q423.08-329 378-329Zm-1-60q81.25 0 138.13-57.5Q572-504 572-585t-56.87-138.5Q458.25-781 377-781q-82.08 0-139.54 57.5Q180-666 180-585t57.46 138.5Q294.92-389 377-389Z'/%3E%3C/svg%3E");
  --icon-check: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 -960 960 960'%3E%3Cpath d='m378-332 363-363q9.27-9 21.64-9 12.36 0 21.36 9.05 9 9.06 9 21.5 0 12.45-9 21.45L399-267q-9 9-21 9t-21-9L175-449q-9-9.07-8.5-21.53.5-12.47 9.55-21.47 9.06-9 21.5-9 12.45 0 21.45 9l159 160Z'/%3E%3C/svg%3E");
}
@media (prefers-color-scheme: dark) {
  :root { --table-rule: var(--surface-neutral-lighter); }
}

.filters, .filter-bar {
  align-items: center; gap: var(--space-s); margin-bottom: var(--space-l); padding: 0 0 var(--space-m);
  background: var(--bg); border: 0; border-bottom: 1px solid var(--border); border-radius: 0; box-shadow: none;
}
:is(.filters .field, .filter-bar > label):not([role=group], .check) {
  position: relative; flex-direction: row; align-items: center; gap: var(--space-s);
  min-height: var(--control-h); min-width: 9rem; padding: 0 var(--space-m);
  background: var(--surface); border-radius: var(--radius-xs); box-shadow: var(--shadow-control);
  font-size: var(--text-s); font-weight: var(--weight-regular); color: var(--muted);
}
:is(.filters .field, .filter-bar > label) > span:first-child { flex: none; white-space: nowrap; }
:is(.filters .field, .filter-bar > label) :is(select, input:not([type=checkbox], [type=hidden])) {
  flex: 1 1 auto; min-width: 0; height: calc(var(--control-h) - 2px); padding: 0; border: 0;
  background: transparent; box-shadow: none; font: inherit; color: var(--text);
  text-align: right; text-align-last: right;
}
:is(.filters .field, .filter-bar > label) :is(input[type=text], input[type=search]) { text-align: left; text-align-last: left; }
:is(.filters .field, .filter-bar > label) input[type=number] { flex: 0 1 4rem; }
:is(.filters .field, .filter-bar > label) :is(select, input):focus-visible { outline: none; }
:is(.filters .field, .filter-bar > label):not([role=group], .check):focus-within { box-shadow: var(--shadow-control), 0 0 0 2px var(--border-focus); }
:is(.filters .field, .filter-bar > label) > select:not([multiple]) { appearance: none; padding-right: 1.75rem; }
:is(.filters .field, .filter-bar > label):has(> select:not([multiple]))::after {
  content: ""; position: absolute; right: var(--space-m); top: 50%; width: 1rem; height: 1rem; margin-top: -0.5rem;
  background: currentColor; pointer-events: none;
  -webkit-mask: var(--icon-chevron) center / contain no-repeat; mask: var(--icon-chevron) center / contain no-repeat;
}
.filters .field .ts-wrapper { flex: 1 1 auto; min-width: 0; }
.filters .field .ts-wrapper .ts-control, .filters .field .ts-wrapper.focus .ts-control {
  display: flex; align-items: center; box-sizing: border-box; min-height: calc(var(--control-h) - 2px); padding: 0;
  border: 0; background: transparent; box-shadow: none; font-size: var(--text-s);
}

.filters .field-search { padding-left: var(--space-m); }
.filters .field-search > span:first-child { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.filters .field-search::before {
  content: ""; flex: none; width: 1rem; height: 1rem; background: var(--muted);
  -webkit-mask: var(--icon-search) center / contain no-repeat; mask: var(--icon-search) center / contain no-repeat;
}

/* Rows fill edge to edge: boxes stretch to share a line rather than leave gaps at its end. */
.filters > :is(.field, .pill-group), .filters .entity-fields .field { flex: 1 1 auto; }
.filters :is(.field-search, .field-areas, .field-sources, .field-countries) { flex: 2 1 11rem; }
.filters .field[role=group] > .segmented { flex: 1 1 auto; }
.filters .segmented .pill { flex: 1 1 auto; justify-content: center; }
.filters .switch { font-size: inherit; }
.filters .row-break { display: none; }
.filters .pill-group { margin-left: 0; }
.filters .pill-group > .pill { flex: 1 1 auto; justify-content: center; }
.filters .entity-filters { border-top: 0; padding-top: 0; }

/* Toggles: a joined group or single chips, the chosen ones pale blue — Gen2's "Button toggle". */
.filters .field[role=group] { flex-direction: row; }
.filters .field[role=group] > span:first-child { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
:is(.filters .pill, .filter-bar > .check) {
  display: inline-flex; flex-direction: row; align-items: center; gap: var(--space-xs);
  min-height: var(--control-h); height: auto; margin: 0; padding: 0 var(--space-l); border: 0; border-radius: var(--radius-xs);
  background: var(--surface); box-shadow: var(--shadow-control); color: var(--muted);
  font-size: var(--text-s); font-weight: var(--weight-medium);
}
:is(.filters .pill, .filter-bar > .check):is(.on, :has(input:checked)) { background: var(--surface-container-selected); color: var(--accent); }
:is(.filters .pill, .filter-bar > .check):has(input:focus-visible) { outline: 2px solid var(--border-focus); outline-offset: 2px; }
.filter-bar > .check input { position: absolute; opacity: 0; width: 0; height: 0; }
.filter-bar > .check:has(input:checked)::before {
  content: ""; width: 1rem; height: 1rem; background: currentColor;
  -webkit-mask: var(--icon-check) center / contain no-repeat; mask: var(--icon-check) center / contain no-repeat;
}
.filters .segmented { border-radius: var(--radius-xs); box-shadow: var(--shadow-control); }
.filters .segmented .pill { box-shadow: none; border-radius: 0; margin-left: 0; }
.filters .segmented .pill:first-of-type { border-radius: var(--radius-xs) 0 0 var(--radius-xs); }
.filters .segmented .pill:last-of-type { border-radius: 0 var(--radius-xs) var(--radius-xs) 0; }
.filters .segmented .pill:has(input:checked) { background: var(--surface-container-selected); color: var(--accent); }
.filters .segmented .pill:has(input:checked) + .pill:has(input:checked) { box-shadow: inset 1px 0 0 var(--border-focus); }

table.queue, table.users { border: 0; border-radius: var(--radius-s); background: var(--surface); box-shadow: var(--shadow); }
:is(table.queue, table.users, .stat-table) th {
  padding: var(--space-l) var(--space-m) var(--space-l) var(--space-l); border-bottom: 0;
  background: var(--surface-container-selected); color: var(--content-heading); vertical-align: middle; white-space: nowrap;
  font-size: var(--text-s); line-height: var(--leading-s); font-weight: var(--weight-medium); text-transform: uppercase;
}
:is(table.queue, table.users) td {
  height: 4.375rem; padding: var(--space-m) var(--space-m) var(--space-m) var(--space-l);
  border-bottom: 1px solid var(--table-rule); vertical-align: middle; font-size: var(--text-m);
}
:is(table.queue, table.users) tbody tr:hover > td { background: var(--surface-container-hovered); }
table.queue .chip {
  padding: var(--space-xs) var(--space-s); border-radius: var(--radius-pill); box-shadow: var(--shadow-control);
  font-size: var(--text-xs); line-height: var(--leading-xs); font-weight: var(--weight-medium);
}

.pager { justify-content: flex-end; gap: var(--space-l); margin-top: var(--space-m); font-size: var(--text-m); font-weight: var(--weight-medium); }
.pager a { color: var(--text); }
.pager a:hover { color: var(--accent); }
.pager-at { font-weight: var(--weight-regular); }
@media (max-width: 640px) {
  :is(.filters .field, .filter-bar > label):not([role=group], .check) { flex: 1 1 100%; min-width: 0; }
}

/* After a decision: straight on to the queue's next item — docs/reader.md#next-in-queue */
.btn-next { display: inline-flex; align-items: center; gap: var(--space-xs); text-decoration: none; }
.btn-next:hover { text-decoration: none; }
.btn-next .icon { width: 1.125rem; height: 1.125rem; }
.next-in-queue { margin: 0 0 var(--space-m); }
