/* Layout: the nucleus fills the left; a reading panel on the right holds whatever is selected. */
:root {
  --bg: #f2f4f3; --surface: #ffffff; --fg: #17201c; --muted: #5d6a64; --faint: #c9d2cd; --rule: #dce3df;
  --accent: #00623f; --accent-soft: #e0eee6; --chip: #edf1ef;
  --core: #17201c; --core-fg: #f2f4f3; --moon: #d3dcd7; --star: #b7791f;
  --g-parliament: #00703f; --g-government: #6b4c9a; --g-health_system: #005eb8;
  --g-think_tanks: #b35c00; --g-media: #c0392b; --g-trade_press: #7a7f12;
  --body: "Public Sans", system-ui, sans-serif; --mono: "IBM Plex Mono", ui-monospace, monospace;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --bg: #0f1513; --surface: #171f1b; --fg: #e3ebe6; --muted: #98a69f; --faint: #33403a; --rule: #28332e;
  --accent: #5fc797; --accent-soft: #1b3228; --chip: #212b26; --core: #e3ebe6; --core-fg: #0f1513; --moon: #46554e; --star: #f2c14e;
  --g-parliament: #5fc797; --g-government: #b59ce6; --g-health_system: #6fa8f5;
  --g-think_tanks: #f0a65a; --g-media: #ff8a80; --g-trade_press: #c9cf5a; color-scheme: dark; } }
:root[data-theme="dark"] {
  --bg: #0f1513; --surface: #171f1b; --fg: #e3ebe6; --muted: #98a69f; --faint: #33403a; --rule: #28332e;
  --accent: #5fc797; --accent-soft: #1b3228; --chip: #212b26; --core: #e3ebe6; --core-fg: #0f1513; --moon: #46554e; --star: #f2c14e;
  --g-parliament: #5fc797; --g-government: #b59ce6; --g-health_system: #6fa8f5;
  --g-think_tanks: #f0a65a; --g-media: #ff8a80; --g-trade_press: #c9cf5a; color-scheme: dark; }

* { box-sizing: border-box; }
html, body { height: 100%; }
body { overflow: hidden; }
@media (max-width: 980px) { body { overflow: auto; } }
body { margin: 0; background: var(--bg); color: var(--fg); font-family: var(--body); font-size: 14px; line-height: 1.45;
  display: flex; flex-direction: column; }
button { font: inherit; color: inherit; }

.top { display: flex; align-items: center; gap: 24px; padding: 12px 20px; border-bottom: 1px solid var(--rule); background: var(--surface); flex-wrap: wrap; }
.brand { font-weight: 700; letter-spacing: -.01em; font-size: 16px; }
.brand span { color: var(--accent); }
.tabs { display: flex; gap: 4px; }
.tabs a { padding: 6px 12px; border-radius: 6px; text-decoration: none; color: var(--muted); font-weight: 500; }
.tabs a[aria-current="page"] { background: var(--accent-soft); color: var(--accent); }
.tabs a.soon { opacity: .55; }
.tabs a:focus-visible { outline: 2px solid var(--accent); }
.status { margin-left: auto; font-family: var(--mono); font-size: 12px; color: var(--muted); }
.status .bad { color: var(--g-media); }

.controls { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; padding: 10px 20px; }
.window { display: inline-flex; border: 1px solid var(--rule); border-radius: 7px; overflow: hidden; background: var(--surface); }
.window button { border: 0; background: transparent; padding: 6px 12px; cursor: pointer; color: var(--muted); }
.window button[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.window button:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.legend { display: flex; flex-wrap: wrap; gap: 6px; }
.legend button { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; border: 1px solid var(--rule);
  background: var(--surface); cursor: pointer; font-size: 13px; }
.legend button[aria-pressed="false"] { opacity: .4; }
.legend button:focus-visible { outline: 2px solid var(--accent); }
.legend .sw { width: 9px; height: 9px; border-radius: 50%; }
.legend .n { font-family: var(--mono); font-size: 11px; color: var(--muted); }
#search { margin-left: auto; min-width: 0; flex: 0 1 240px; padding: 7px 12px; border: 1px solid var(--rule); border-radius: 7px; background: var(--surface); font: inherit; color: var(--fg); }
#search:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

.stage { flex: 1; display: grid; grid-template-columns: minmax(0, 1fr) 380px; min-height: 0; }
.nucleus-wrap { position: relative; min-width: 0; min-height: 340px; }

/* nucleus (drawn on canvas; colours are read from these tokens) */
#nucleus { width: 100%; height: 100%; display: block; cursor: grab; touch-action: pan-y; }
#nucleus.pointer { cursor: pointer; }
#nucleus.dragging { cursor: grabbing; }

.lens { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; }
.lens[hidden] { display: none; }
.lens select { font: inherit; font-weight: 600; color: var(--fg); background: var(--surface); border: 1px solid var(--rule); border-radius: 7px;
  padding: 6px 10px; max-width: 260px; cursor: pointer; }
.lens select:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

.tip { position: absolute; pointer-events: none; max-width: 340px; background: var(--surface); border: 1px solid var(--rule);
  border-radius: 7px; padding: 8px 10px; box-shadow: 0 6px 24px rgb(0 0 0 / .12); font-size: 13px; z-index: 5; }
.tip .src { font-family: var(--mono); font-size: 11px; color: var(--muted); display: block; margin-top: 3px; }

/* panel */
.panel { border-left: 1px solid var(--rule); background: var(--surface); overflow: auto; padding: 18px 20px 40px; min-width: 0; }
.panel h2 { margin: 0 0 2px; font-size: 19px; letter-spacing: -.01em; }
.panel .sub { color: var(--muted); font-size: 13px; margin: 0 0 14px; }
.panel .eyebrow { font-family: var(--mono); font-size: 11px; letter-spacing: .07em; text-transform: uppercase; color: var(--accent); margin-bottom: 4px; display: block; }
.feed { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; }
.feed li { padding: 10px 0; border-bottom: 1px solid var(--rule); display: grid; grid-template-columns: 10px 1fr; gap: 10px; cursor: pointer; }
.feed li:hover .h { color: var(--accent); }
.feed li:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.feed .sw { width: 8px; height: 8px; border-radius: 50%; margin-top: 6px; }
.feed .h { font-weight: 500; overflow-wrap: anywhere; }
.feed .d { color: var(--muted); font-size: 13px; margin-top: 2px; overflow-wrap: anywhere; }
.feed .c { font-family: var(--mono); font-size: 11px; color: var(--muted); margin-top: 4px; overflow-wrap: anywhere; }
.back { border: 0; background: none; color: var(--accent); cursor: pointer; padding: 0; margin-bottom: 10px; font-size: 13px; }
.back:focus-visible { outline: 2px solid var(--accent); }
.detail h2 { font-size: 18px; line-height: 1.35; }
.detail .qtext { font-size: 15px; margin: 10px 0; }
.detail .answer { background: var(--chip); border-radius: 6px; padding: 10px 12px; font-size: 13px; white-space: pre-line; max-height: 280px; overflow: auto; }
.detail dl { display: grid; grid-template-columns: 110px 1fr; gap: 6px 12px; font-size: 13px; margin: 14px 0; }
.detail dt { color: var(--muted); }
.detail dd { margin: 0; overflow-wrap: anywhere; }
.detail .terms code { font-family: var(--mono); font-size: 11px; background: var(--accent-soft); color: var(--accent); padding: 1px 5px; border-radius: 3px; margin-right: 4px; display: inline-block; margin-bottom: 3px; }
.detail a.open { display: inline-block; margin-top: 6px; color: var(--accent); font-weight: 600; }
.groups { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin: 6px 0 18px; }
.groups div { background: var(--chip); border-radius: 6px; padding: 8px 10px; }
.groups b { display: block; font-size: 20px; font-variant-numeric: tabular-nums; }
.groups span { font-size: 12px; color: var(--muted); }
.empty-note { color: var(--muted); }

@media (max-width: 980px) {
  .stage { grid-template-columns: 1fr; }
  .panel { border-left: 0; border-top: 1px solid var(--rule); }
  .nucleus-wrap { height: 125vw; max-height: 80vh; min-height: 380px; }
  #search { margin-left: 0; flex-basis: 100%; }
}

.strand-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px; margin-top: 8px; }
.strand-list button { display: flex; justify-content: space-between; gap: 8px; text-align: left; border: 1px solid var(--rule); background: var(--surface);
  border-radius: 6px; padding: 6px 9px; cursor: pointer; font-size: 13px; min-width: 0; }
.strand-list button span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.strand-list button .n { font-family: var(--mono); font-size: 11px; color: var(--muted); }
.strand-list button:hover { border-color: var(--accent); }
.strand-list button:focus-visible { outline: 2px solid var(--accent); }
.strand-list button.zero { opacity: .5; }

/* ---------- Cover: lanes × days, today pinned left ---------- */
:root { --lane-w: 168px; --day-w: 176px; --weekend-w: 30px;
  --l-commons: #00703f; --l-wh: #2f7d6d; --l-lords: #9b1c31; --l-select: #6b4c9a; --l-legislative: #8a6d00;
  --l-orals: #005eb8; --l-bills: #b35c00; --l-nice: #0b7a8a; --l-consult: #a3366e; --now: #e0531f; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --l-commons: #5fc797; --l-wh: #6fd0bd; --l-lords: #ff8fa3; --l-select: #b59ce6; --l-legislative: #e6c65a;
  --l-orals: #6fa8f5; --l-bills: #f0a65a; --l-nice: #5cc8d6; --l-consult: #f08cc0; --now: #ff7a45; } }
:root[data-theme="dark"] {
  --l-commons: #5fc797; --l-wh: #6fd0bd; --l-lords: #ff8fa3; --l-select: #b59ce6; --l-legislative: #e6c65a;
  --l-orals: #6fa8f5; --l-bills: #f0a65a; --l-nice: #5cc8d6; --l-consult: #f08cc0; --now: #ff7a45; }

.strand-pick { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; }
.strand-pick select { font: inherit; color: var(--fg); background: var(--surface); border: 1px solid var(--rule); border-radius: 7px; padding: 6px 8px; max-width: 240px; }
.strand-pick select:focus-visible { outline: 2px solid var(--accent); }
.certainty-key { display: flex; gap: 6px; font-size: 12px; }
.certainty-key .key { padding: 3px 9px; border-radius: 6px; }
.key.announced { background: var(--accent-soft); border: 1.5px solid var(--accent); color: var(--fg); }
.key.provisional { border: 1.5px dashed var(--muted); color: var(--fg); }
.key.indicative { border: 1.5px dotted var(--faint); color: var(--muted); }

.timeline-wrap { position: relative; min-width: 0; min-height: 0; overflow: auto; }
.timeline { display: grid; position: relative; min-width: max-content; padding-bottom: 24px; align-content: start; }
.tl-corner, .tl-lane { position: sticky; left: 0; z-index: 3; background: var(--bg); }
.tl-corner { top: 0; z-index: 4; }
.tl-band, .tl-day { position: sticky; z-index: 2; background: var(--bg); }
.tl-band { top: 0; font-family: var(--mono); font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted);
  padding: 8px 10px 4px; border-left: 1px solid var(--rule); white-space: nowrap; overflow: hidden; }
.tl-band b { color: var(--fg); font-weight: 500; }
.tl-day { top: 30px; padding: 4px 10px 8px; border-left: 1px solid var(--rule); border-bottom: 1px solid var(--rule); font-size: 13px; white-space: nowrap; }
.tl-day .dn { font-weight: 600; }
.tl-day .dm { color: var(--muted); font-family: var(--mono); font-size: 11px; margin-left: 4px; }
.tl-day.weekend { color: var(--muted); padding: 4px 0 8px; text-align: center; font-size: 10px; }
.tl-day.today .dn { color: var(--now); }
.tl-lane { padding: 10px 12px; border-bottom: 1px solid var(--rule); display: flex; align-items: flex-start; gap: 8px; font-weight: 600; font-size: 13px; }
.tl-lane .sw { width: 10px; height: 10px; border-radius: 3px; margin-top: 4px; flex: none; }
.tl-lane .n { font-family: var(--mono); font-size: 11px; color: var(--muted); font-weight: 400; }
.tl-cell { border-left: 1px solid var(--rule); border-bottom: 1px solid var(--rule); padding: 6px; display: flex; flex-direction: column; gap: 6px; min-height: 64px; }
.tl-cell.weekend { background: repeating-linear-gradient(135deg, transparent 0 6px, var(--chip) 6px 7px); padding: 6px 0; }
.tl-now { position: absolute; top: 30px; bottom: 0; width: 2px; background: var(--now); z-index: 1; pointer-events: none;
  box-shadow: 0 0 0 0 var(--now); animation: now-glow 2.4s ease-in-out infinite; }
@keyframes now-glow { 0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--now) 50%, transparent); } 50% { box-shadow: 0 0 14px 3px color-mix(in srgb, var(--now) 45%, transparent); } }

.tile { all: unset; box-sizing: border-box; display: block; cursor: pointer; border-radius: 8px; padding: 7px 9px 8px; font-size: 12.5px; line-height: 1.35;
  background: var(--surface); border: 1.5px solid var(--rule); position: relative; transition: transform .18s, box-shadow .18s, opacity .25s, filter .25s; }
.tile .ln { position: absolute; left: 0; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; }
.tile .tm { font-family: var(--mono); font-size: 11px; color: var(--muted); display: block; }
.tile .tt { font-weight: 600; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.tile .td { color: var(--muted); font-size: 11.5px; display: block; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile .badge { position: absolute; top: -7px; right: -6px; font-family: var(--mono); font-size: 10.5px; background: var(--fg); color: var(--bg); border-radius: 999px; padding: 1px 6px; }
.tile.announced { border-color: color-mix(in srgb, var(--accent) 55%, var(--rule)); background: color-mix(in srgb, var(--accent-soft) 60%, var(--surface)); }
.tile.provisional { border-style: dashed; border-color: var(--muted); }
.tile.indicative { border-style: dotted; border-color: var(--faint); background: transparent; }
.tile.indicative .tt { font-weight: 500; }
.tile:hover { transform: translateY(-2px); box-shadow: 0 8px 22px rgb(0 0 0 / .14); }
.tile:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.tile.sel { box-shadow: 0 0 0 2px var(--fg); }
.tile.dim { opacity: .14; filter: saturate(.3); transform: scale(.97); }
.tile.new::after { content: ""; position: absolute; inset: -4px; border-radius: 11px; border: 2px solid var(--accent); animation: halo 2.6s ease-out forwards; pointer-events: none; }
@keyframes halo { from { opacity: 1; transform: scale(.96); } to { opacity: 0; transform: scale(1.08); } }
@media (prefers-reduced-motion: reduce) { .tl-now, .tile.new::after { animation: none; } .tile { transition: none; } }

.detail .pill { display: inline-block; font-family: var(--mono); font-size: 11px; padding: 2px 8px; border-radius: 999px; margin-right: 6px; }
.detail .pill.announced { background: var(--accent-soft); color: var(--accent); }
.detail .pill.provisional { border: 1px dashed var(--muted); color: var(--fg); }
.detail .pill.indicative { border: 1px dotted var(--muted); color: var(--muted); }
.qlist { list-style: none; padding: 0; margin: 8px 0 0; display: grid; gap: 8px; }
.qlist li { font-size: 13px; padding-left: 10px; border-left: 2px solid var(--rule); }
.qlist li.hit { border-left-color: var(--accent); }
.qlist .who { display: block; font-family: var(--mono); font-size: 11px; color: var(--muted); margin-top: 2px; }
.people { margin: 6px 0 0; padding-left: 18px; font-size: 13px; }
.tl-cell .more { all: unset; cursor: pointer; font-size: 12px; color: var(--accent); padding: 2px 4px; border-radius: 4px; }
.tl-cell .more:hover { text-decoration: underline; }
.tl-cell .more:focus-visible { outline: 2px solid var(--accent); }
.tile[hidden] { display: none; }   /* .tile sets display, which would beat the browser's [hidden] rule */

/* Compact: one-line tiles, narrower days, for short screens. */
.compact { --day-w: 150px; }
.compact .tile { padding: 4px 8px; }
.compact .tile .tt { -webkit-line-clamp: 1; font-size: 12px; }
.compact .tile .td { display: none; }
.compact .tl-cell { min-height: 40px; gap: 4px; padding: 4px; }
.compact .tl-lane { padding: 6px 12px; }
.density { border: 1px solid var(--rule); background: var(--surface); border-radius: 7px; padding: 6px 12px; cursor: pointer; color: var(--muted); }
.density[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.density:focus-visible { outline: 2px solid var(--accent); }

/* ---------- Output tray + page ---------- */
.detail-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-top: 10px; }
.detail-actions .open { margin-top: 0; }
.tray-add { border: 1px solid var(--accent); background: transparent; color: var(--accent); border-radius: 7px; padding: 6px 12px; cursor: pointer; font-weight: 600; }
.tray-add[aria-pressed="true"] { background: var(--accent); color: var(--bg); }
.tray-add:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- Find: new, starred, triage, coming up, topic history ---------- */
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.link { border: 0; background: none; color: var(--accent); cursor: pointer; padding: 0; font-size: 12px; font-weight: 600; }
.link:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.star-eyebrow { color: var(--star); margin-top: 16px; }
.now-eyebrow { color: var(--now); margin-top: 16px; }
.section-head + .feed, .star-eyebrow + .feed { margin-bottom: 16px; }
.feed .star { color: var(--star); }
.feed .new-tag { font-family: var(--mono); font-size: 10px; text-transform: uppercase; letter-spacing: .06em; color: var(--accent);
  background: var(--accent-soft); border-radius: 4px; padding: 1px 5px; margin-right: 6px; vertical-align: 1px; }
.feed .sw.diamond { width: 8px; height: 8px; border-radius: 1px; transform: rotate(45deg); background: var(--now); margin-top: 6px; }
.feed .sw.diamond.open { background: transparent; border: 1.5px solid var(--now); }
.feed li.hit .h { color: var(--now); }
.triage { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tri { border: 1px solid var(--rule); background: var(--surface); border-radius: 7px; padding: 6px 12px; cursor: pointer; font-weight: 600; color: var(--fg); }
.tri.on { border-color: var(--star); color: var(--star); }
.tri:hover { border-color: var(--muted); }
.tri:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.tri-note { font-size: 11px; color: var(--muted); font-family: var(--mono); }
.history { margin: 4px 0 16px; }
.spark { display: block; width: 100%; height: auto; margin: 6px 0 2px; overflow: visible; }
.spark .base { stroke: var(--rule); stroke-width: 1; }
.spark .bar path { fill: color-mix(in srgb, var(--accent) 45%, var(--surface)); }
.spark .bar.wk path { fill: var(--accent); }
.spark .bar .hit { fill: transparent; }
.spark .bar:hover path { fill: var(--fg); }
.spark .ax { font-family: var(--mono); font-size: 10px; fill: var(--muted); }
