/* ============================================================
   Narrative Analyst — cleanup redesign (ported from
   gui/narrative-cleanup/). Decluttered chart with density
   thinning, velocity-aware hover, mini-timeline scrubber,
   resizable/collapsible rails, restored Stack view.

   Token strategy: the global :root block below is the app-wide
   base (unchanged from the prior narrative.css so Headlines /
   Price / Debug keep their current theming). The redesign's own
   palette is scoped under .nv-root so only the Narrative tab
   adopts it — other tabs are untouched.
   ============================================================ */

:root {
  /* surfaces */
  --bg-0: #0a0a0c;
  --bg-1: #101013;
  --bg-2: #15151a;
  --bg-3: #1c1c22;
  --bg-hover: #1f1f26;

  /* borders */
  --line: #22222a;
  --line-strong: #2e2e38;
  --line-soft: #1a1a20;

  /* text */
  --fg: #ececf0;
  --fg-2: #b4b4be;
  --fg-3: #7e7e8a;
  --fg-4: #54545e;
  --fg-faint: #38383f;

  /* accent — single warm tone, used sparingly */
  --accent: oklch(0.80 0.10 65);
  --accent-dim: oklch(0.62 0.08 65);
  --accent-faint: oklch(0.80 0.10 65 / 0.14);

  /* direction tints (very subtle background washes only) */
  --esc-wash: oklch(0.72 0.12 30 / 0.10);
  --desc-wash: oklch(0.78 0.06 215 / 0.07);
  --esc-color: oklch(0.72 0.14 30);
  --desc-color: oklch(0.78 0.10 215);

  --radius: 3px;
  --radius-lg: 3px;

  --mono: "IBM Plex Mono", "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --sans: "IBM Plex Sans", -apple-system, system-ui, sans-serif;
}

/* ---------- Narrative tab palette (redesign) ----------
   Scoped to the screen wrapper so it never leaks to other tabs.
   `color` / `font-family` are re-set here so descendants resolve
   them against this scope's tokens rather than the body's. */
.nv-root {
  --bg-0: #111114;
  --bg-1: #17171b;
  --bg-2: #1f1f25;
  --bg-3: #282830;
  --bg-hover: #1f1f26;

  --line: #2b2b33;
  --line-strong: #3a3a44;
  --line-soft: #1d1d23;

  --fg:   #e8e8ee;
  --fg-2: #aeaeb8;
  --fg-3: #82828e;
  --fg-4: #5a5a64;
  --fg-faint: #3c3c44;

  --accent:       oklch(0.78 0.11 64);
  --accent-dim:   oklch(0.62 0.09 64);
  --accent-faint: oklch(0.78 0.11 64 / 0.14);

  --esc-color:  oklch(0.70 0.15 28);
  --desc-color: oklch(0.76 0.10 220);
  --esc-faint:  oklch(0.70 0.15 28 / 0.14);
  --desc-faint: oklch(0.76 0.10 220 / 0.14);

  --radius: 5px;
  --radius-lg: 8px;
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  background: var(--bg-0);
  color: var(--fg);
  font-family: var(--sans);
  font-size: 13px;
}
.nv-root ::selection { background: var(--accent-faint); }

/* View-mode segmented control (used by the nv-local toolbar) */
.tb-layout { display: inline-flex; align-items: center; gap: 8px; }
.tb-layout .lbl { font-size: 10px; color: var(--fg-3); }
.seg {
  display: inline-flex; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
  background: var(--bg-2);
}
.seg button {
  padding: 5px 11px; font-size: 11px; color: var(--fg-3);
  border: 0; border-right: 1px solid var(--line);
  display: inline-flex; align-items: center; gap: 6px;
  transition: color .12s, background .12s;
}
.seg button:last-child { border-right: 0; }
.seg button:hover { color: var(--fg-2); }
.seg button.on { color: var(--fg); background: var(--bg-3); }
.seg button .ic { width: 13px; height: 13px; opacity: 0.85; }

/* ---------- Columns / resizable rails ---------- */
.cols {
  flex: 1; min-height: 0;
  display: flex;
  position: relative;
}
.panel { min-height: 0; overflow: hidden; display: flex; flex-direction: column; position: relative; }
.panel.left { background: var(--bg-1); border-right: 1px solid var(--line); }
.panel.right { background: var(--bg-1); border-left: 1px solid var(--line); }
.panel.main { background: var(--bg-0); flex: 1 1 auto; min-width: 0; }

/* Narrative per-tab toolbar — the second strip, below the global Topbar.
   Holds the tab title + LIVE batch, the View switch, and global counts. */
.nv-local {
  flex: 0 0 auto;
  display: flex; align-items: center; gap: 18px;
  padding: 0 20px; min-height: 46px;
  border-bottom: 1px solid var(--line); background: var(--bg-1);
}
.nv-local-left { display: inline-flex; align-items: center; gap: 12px; }
.nv-tab-title { font-size: 14px; font-weight: 600; color: var(--fg); letter-spacing: -0.01em; }
.nv-live {
  display: inline-flex; align-items: center; gap: 7px;
  font-family: var(--mono); font-size: 10.5px; color: var(--fg-3); letter-spacing: 0.03em;
}
.nv-live .pulse {
  width: 7px; height: 7px; border-radius: 50%; background: oklch(0.78 0.15 145);
  box-shadow: 0 0 0 0 oklch(0.78 0.15 145 / 0.5); animation: livePulse 2.4s ease-out infinite;
}
@keyframes livePulse {
  0% { box-shadow: 0 0 0 0 oklch(0.78 0.15 145 / 0.5); }
  70% { box-shadow: 0 0 0 7px oklch(0.78 0.15 145 / 0); }
  100% { box-shadow: 0 0 0 0 oklch(0.78 0.15 145 / 0); }
}
.nv-local .tb-layout { margin-left: auto; }
.nv-local-meta { display: inline-flex; align-items: baseline; gap: 9px; font-family: var(--mono); font-size: 11px; color: var(--fg-3); }
.nv-local-meta .m b { color: var(--fg); font-weight: 500; font-variant-numeric: tabular-nums; }
.nv-local-meta .m i { color: var(--accent); font-style: normal; }
.nv-local-meta .dot { color: var(--fg-faint); }

/* Resize handle */
.resizer {
  flex: 0 0 6px;
  cursor: col-resize;
  background: transparent;
  position: relative;
  z-index: 12;
}
.resizer::after {
  content: ""; position: absolute; inset: 0 2px;
  border-radius: 2px;
  transition: background .12s;
}
.resizer:hover::after, .resizer.dragging::after { background: var(--accent-dim); }

/* Collapse toggles live as a thin tab on the panel edge */
.rail-collapse {
  position: absolute; top: 10px; z-index: 14;
  width: 20px; height: 30px;
  display: grid; place-items: center;
  border: 1px solid var(--line);
  background: var(--bg-2);
  color: var(--fg-3);
  border-radius: var(--radius);
  transition: color .12s, border-color .12s, background .12s;
}
.rail-collapse:hover { color: var(--fg); border-color: var(--line-strong); background: var(--bg-3); }
.panel.left .rail-collapse { right: 8px; }
.panel.right .rail-collapse { left: 8px; }

/* Collapsed rail — a slim vertical strip that reopens on click */
.rail-stub {
  flex: 0 0 30px;
  background: var(--bg-1);
  display: flex; flex-direction: column; align-items: center;
  padding-top: 12px; gap: 14px;
  cursor: pointer;
  transition: background .12s;
}
.rail-stub.left { border-right: 1px solid var(--line); }
.rail-stub.right { border-left: 1px solid var(--line); }
.rail-stub:hover { background: var(--bg-2); }
.rail-stub .chev { color: var(--fg-3); }
.rail-stub .vlabel {
  writing-mode: vertical-rl;
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.16em;
  text-transform: uppercase; color: var(--fg-3);
}
.rail-stub .vcount {
  writing-mode: vertical-rl;
  font-family: var(--mono); font-size: 10px; color: var(--fg-4);
}

/* ---------- Left: threads ---------- */
.left-head {
  flex: 0 0 auto;
  padding: 14px 16px 10px;
  display: flex; align-items: baseline; justify-content: space-between;
}
.left-head .title { font-size: 12px; color: var(--fg-2); font-weight: 600; letter-spacing: 0.02em; }
.left-head .count { font-family: var(--mono); font-size: 11px; color: var(--fg-4); }
.thread-search {
  flex: 0 0 auto;
  margin: 0 12px 8px;
  padding: 7px 10px;
  font-family: var(--mono); font-size: 11px; color: var(--fg);
  background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius);
}
.thread-search::placeholder { color: var(--fg-4); }
.thread-search:focus { outline: none; border-color: var(--accent-dim); background: var(--bg-3); }
.threads-scroll { flex: 1 1 auto; overflow-y: auto; padding: 0 8px 24px; }
.topic-group { margin-bottom: 4px; }
.topic-head {
  font-family: var(--mono); font-size: 9px; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--fg-3); padding: 10px 10px 4px;
}
.thread-row {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 8px 10px; border-radius: var(--radius);
  cursor: pointer; transition: background .12s;
}
.thread-row:hover { background: var(--bg-2); }
.thread-row.active { background: var(--bg-2); box-shadow: inset 2px 0 0 var(--accent); }
.thread-row .ind { width: 6px; height: 6px; border-radius: 50%; background: var(--fg-faint); flex: none; }
.thread-row.touched .ind { background: var(--accent); box-shadow: 0 0 6px var(--accent-dim); }
.thread-row .ago {
  flex: 0 0 30px; margin-top: 1px;
  font-family: var(--mono); font-size: 10px; color: var(--fg-4);
  font-variant-numeric: tabular-nums; text-align: right;
}
.thread-row.touched .ago { color: var(--accent); }
.thread-row .label {
  flex: 1; min-width: 0; font-size: 12.5px; color: var(--fg-2); line-height: 1.35;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden;
}
.thread-row .count { margin-top: 1px; font-family: var(--mono); font-size: 10px; color: var(--fg-faint); font-variant-numeric: tabular-nums; min-width: 26px; text-align: right; }
.thread-row .score { margin-top: 1px; font-family: var(--mono); font-size: 11px; color: var(--fg-3); font-variant-numeric: tabular-nums; min-width: 42px; text-align: right; }
.thread-row.active .label, .thread-row.touched .label { color: var(--fg); }
.thread-row.touched .score { color: var(--accent); }

/* ---------- Inactive (dormant >=7d) — sectioned + dimmed ---------- */
.inactive-group { margin-top: 6px; border-top: 1px solid var(--line); }
.inactive-head {
  font-family: var(--mono); font-size: 9px; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--fg-4); padding: 12px 10px 4px;
}
.thread-row.dormant, .stack-card.dormant { opacity: 0.45; }
.thread-row.dormant:hover, .stack-card.dormant:hover { opacity: 0.72; }
.thread-row.dormant.active, .stack-card.dormant.active { opacity: 1; }

/* ---------- Main: thread detail ---------- */
.thread-detail { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; padding: 0 26px; }
.detail-head {
  flex: 0 0 auto;
  padding: 16px 0 12px;
  display: flex; align-items: flex-start; gap: 18px;
  border-bottom: 1px solid var(--line);
}
.detail-head .htext { flex: 1; min-width: 0; }
.detail-title-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.detail-title { font-size: 18px; font-weight: 600; letter-spacing: -0.01em; color: var(--fg); }
.topic-chip {
  position: relative;
  font-family: var(--mono); font-size: 9px; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--fg-3); background: var(--bg-2); border: 1px solid var(--line);
  padding: 3px 8px; border-radius: var(--radius); cursor: help; white-space: nowrap;
}
.topic-chip:hover { color: var(--fg-2); border-color: var(--line-strong); }
.topic-chip[data-summary]:hover::after {
  content: attr(data-summary);
  position: absolute; top: calc(100% + 7px); left: 0;
  width: max-content; max-width: 460px;
  padding: 11px 13px; background: var(--bg-2); border: 1px solid var(--line-strong);
  border-radius: var(--radius); color: var(--fg-2);
  font-family: var(--sans); font-size: 12px; text-transform: none; letter-spacing: 0; line-height: 1.5;
  white-space: normal; z-index: 40; box-shadow: 0 12px 34px rgba(0,0,0,0.6);
}
.touched-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 7px var(--accent-dim); }
.detail-summary {
  margin-top: 7px; color: var(--fg-3); font-size: 12.5px; line-height: 1.5; max-width: 70ch;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden;
}
.detail-summary.expanded { -webkit-line-clamp: unset; }
.sum-toggle { font-family: var(--mono); font-size: 10px; color: var(--fg-3); padding: 2px 0 0; border: 0; }
.sum-toggle:hover { color: var(--fg); }

.detail-score { flex: 0 0 auto; text-align: right; }
.detail-score .big {
  font-family: var(--mono); font-size: 30px; line-height: 1; letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums; color: var(--fg);
}
.detail-score .dline {
  margin-top: 6px; font-family: var(--mono); font-size: 11px; color: var(--fg-3);
  display: flex; align-items: center; justify-content: flex-end; gap: 6px;
}
.detail-score .dline .arrow { font-size: 9px; }
.detail-score .dline.up { color: var(--accent); }
.detail-score .dline.down { color: var(--fg-2); }

/* The chart region grows; breathing room top & bottom keeps it central */
.detail-body {
  flex: 1 1 auto; min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--list-w, 320px);
  gap: 18px;
  padding: 18px 0 22px;
}
.detail-body.no-list { grid-template-columns: minmax(0,1fr); }
.detail-body.stacked { display: flex; flex-direction: column; gap: 14px; }
.detail-body.stacked .chart-col { flex: 1 1 auto; min-height: 0; }
.detail-body.stacked .list-col.bottom { flex: 0 0 auto; max-height: 30%; }
.detail-body.stacked .list-col.bottom .prog-list { max-height: 100%; }
.chart-col { display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.list-col { display: flex; flex-direction: column; min-height: 0; }

/* Chart toolbar */
.chart-toolbar {
  flex: 0 0 auto;
  display: flex; align-items: center; justify-content: space-between; gap: 18px;
  margin-bottom: 14px; flex-wrap: wrap;
}

/* Stat strip — inline in the chart toolbar (left side) */
.stat-strip { display: flex; gap: 22px; flex-wrap: wrap; }
.stat { display: flex; align-items: baseline; gap: 6px; line-height: 1; }
.stat .lbl { font-size: 10px; color: var(--fg-3); }
.stat .val { font-family: var(--mono); font-size: 14px; color: var(--fg); font-variant-numeric: tabular-nums; }
.stat .val.accent { color: var(--accent); }

.chart-right-ctl { display: flex; align-items: center; gap: 10px; }
.thin-toggle {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 4px 10px; font-size: 11px; color: var(--fg-3);
  border: 1px solid var(--line); border-radius: var(--radius); background: transparent;
  transition: color .12s, border-color .12s, background .12s;
}
.thin-toggle:hover { color: var(--fg-2); border-color: var(--line-strong); }
.thin-toggle.on { color: var(--fg); border-color: var(--line-strong); background: var(--bg-2); }
.thin-toggle .ic { width: 15px; height: 11px; }
.range-grp { display: inline-flex; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.range-grp button {
  padding: 4px 11px; font-family: var(--mono); font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--fg-3); border: 0; border-right: 1px solid var(--line);
}
.range-grp button:last-child { border-right: 0; }
.range-grp button:hover { color: var(--fg-2); }
.range-grp button.on { color: var(--fg); background: var(--bg-2); }

/* ---------- The chart ---------- */
.chart {
  position: relative; flex: 1 1 auto; min-height: 220px;
  --y-axis-w: 42px; --x-pad: 14px;
}
.chart-yaxis {
  position: absolute; left: 0; top: 0; bottom: 26px; width: var(--y-axis-w);
  font-family: var(--mono); font-size: 10px; color: var(--fg-3);
  pointer-events: none; font-variant-numeric: tabular-nums; z-index: 4;
}
.yaxis-tick { position: absolute; left: 0; right: 5px; transform: translateY(-50%); text-align: right; white-space: nowrap; }
.yaxis-tick.zero { color: var(--fg-2); font-weight: 600; }
.yaxis-tick.ceiling.esc { color: var(--esc-color); font-weight: 600; }
.yaxis-tick.ceiling.desc { color: var(--desc-color); font-weight: 600; }

.chart-watermarks { position: absolute; left: var(--y-axis-w); right: var(--x-pad); top: 0; bottom: 0; pointer-events: none; z-index: 0; overflow: hidden; }
.chart-wm {
  position: absolute; left: 0; right: 0; display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: clamp(22px, 4vw, 46px); letter-spacing: 0.22em;
  text-transform: uppercase; user-select: none; white-space: nowrap;
}
.chart-wm.esc { top: 6px; color: var(--esc-color); opacity: 0.05; }
.chart-wm.desc { bottom: 6px; color: var(--desc-color); opacity: 0.05; }

.chart-scroll {
  position: absolute; left: var(--y-axis-w); right: var(--x-pad); top: 0; bottom: 0;
  overflow-x: auto; overflow-y: hidden;
}
.chart-content { height: 100%; }
.chart-inner { position: relative; height: 100%; padding: 30px 0; cursor: crosshair; user-select: none; }
.chart-svg { position: absolute; inset: 0; width: 100%; height: 100%; }

/* Points — decluttered. Steps are small + dim so milestones/recaps pop. */
.chart-pt {
  position: absolute; border-radius: 50%; background: var(--fg);
  transform: translate(-50%, -50%); pointer-events: none;
  transition: transform .1s, box-shadow .1s, opacity .12s, background .12s;
  z-index: 2;
}
.chart-pt.step { width: 6px; height: 6px; background: var(--fg-2); opacity: 0.78; }
.chart-pt.extrema { opacity: 1; width: 7px; height: 7px; background: var(--fg); }
.chart-pt.milestone {
  width: 9px; height: 9px; background: var(--accent);
  box-shadow: 0 0 0 3px var(--bg-0), 0 0 0 4px var(--accent-dim);
  opacity: 1;
}
.chart-pt.recap {
  width: 9px; height: 9px; background: var(--bg-1); border: 1.5px solid var(--fg-3);
  border-radius: 0; box-shadow: 0 0 0 3px var(--bg-0); opacity: 1;
}
.chart-pt.this-batch {
  width: 11px; height: 11px; background: var(--accent);
  box-shadow: 0 0 0 3px var(--bg-0), 0 0 0 5px var(--accent-dim), 0 0 14px var(--accent-dim);
  opacity: 1;
}
.chart-pt.hovered {
  transform: translate(-50%, -50%) scale(1.7); background: var(--fg); opacity: 1;
  box-shadow: 0 0 0 3px var(--bg-0), 0 0 0 5px var(--fg-2), 0 0 10px rgba(255,255,255,0.3);
  z-index: 5;
}
.chart-pt.selected {
  background: var(--accent); transform: translate(-50%, -50%) scale(1.6); opacity: 1;
  box-shadow: 0 0 0 3px var(--bg-0), 0 0 0 6px var(--accent), 0 0 16px var(--accent-dim);
  z-index: 6;
}
.chart-pt.recap.selected, .chart-pt.recap.hovered { border-color: var(--accent); }

/* Date chips on the zero line */
.zero-dates { position: absolute; inset: 0; pointer-events: none; z-index: 3; }
.zero-date {
  position: absolute; transform: translate(-50%, 5px);
  font-family: var(--mono); font-size: 9px; color: var(--fg-3); white-space: nowrap;
  background: var(--bg-0); padding: 1px 5px; border: 1px solid var(--line-soft); border-radius: 3px;
}

/* Crosshair overlay */
.crosshair { position: absolute; left: var(--y-axis-w); right: var(--x-pad); top: 0; bottom: 0; pointer-events: none; overflow: hidden; z-index: 5; }
.crosshair-v { position: absolute; top: 0; bottom: 0; width: 0; border-left: 1px dashed var(--accent-dim); }
.crosshair-h { position: absolute; left: 0; right: 0; height: 0; border-top: 1px dashed var(--accent-dim); }
.hover-y {
  position: absolute; right: 4px; transform: translateY(-50%);
  background: var(--accent-faint); border: 1px solid var(--accent-dim); color: var(--accent);
  font-family: var(--mono); font-size: 10px; padding: 2px 6px; white-space: nowrap; pointer-events: none; z-index: 6;
  font-variant-numeric: tabular-nums;
}
.x-overlay { position: absolute; left: var(--y-axis-w); right: var(--x-pad); bottom: 2px; height: 22px; pointer-events: none; z-index: 6; }
.hover-x {
  position: absolute; top: 0; transform: translateX(-50%);
  background: var(--accent-faint); border: 1px solid var(--accent-dim); color: var(--accent);
  font-family: var(--mono); font-size: 10px; padding: 2px 8px; white-space: nowrap; pointer-events: none;
}

/* Floating chart hover card — the reading surface */
.chart-tip { position: absolute; z-index: 30; pointer-events: none; }
.chart-tip.card {
  background: var(--bg-2); border: 1px solid var(--line-strong); border-radius: var(--radius);
  box-shadow: 0 18px 44px rgba(0,0,0,0.7);
  overflow: hidden;
  animation: tipIn .1s ease-out;
}
.chart-tip.card.is-milestone { border-left: 2px solid var(--accent); }
.chart-tip.card.is-recap { border-left: 2px solid var(--fg-3); }
@keyframes tipIn { from { opacity: 0; } to { opacity: 1; } }
.chart-tip .tip-top { display: flex; align-items: flex-start; gap: 12px; padding: 10px 12px 0; }
.chart-tip .tip-when { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.chart-tip .tip-date { font-family: var(--mono); font-size: 11px; color: var(--fg); font-variant-numeric: tabular-nums; }
.chart-tip .tip-rel { font-family: var(--mono); font-size: 9.5px; color: var(--fg-4); }
.chart-tip .tip-scorebox { margin-left: auto; display: inline-flex; align-items: baseline; gap: 5px; }
.chart-tip .tip-score { font-family: var(--mono); font-size: 19px; line-height: 1; color: var(--fg); font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.chart-tip .tip-arrow { font-size: 10px; }
.chart-tip .tip-arrow.up { color: var(--esc-color); }
.chart-tip .tip-arrow.down { color: var(--desc-color); }
.chart-tip .tip-tagrow { display: flex; gap: 4px; flex-wrap: wrap; padding: 8px 12px 0; }
.chart-tip .t { font-family: var(--mono); font-size: 8.5px; letter-spacing: 0.06em; text-transform: uppercase; padding: 2px 6px; border-radius: 2px; background: var(--bg-3); color: var(--fg-2); }
.chart-tip .t.milestone { background: var(--accent-faint); color: var(--accent); }
.chart-tip .t.recap { border: 1px solid var(--line-strong); background: transparent; }
.chart-tip .t.step { color: var(--fg-3); }
.chart-tip .t.esc { color: var(--esc-color); }
.chart-tip .t.desc { color: var(--desc-color); }
.chart-tip .tip-body { font-size: 12.5px; line-height: 1.5; color: var(--fg); padding: 8px 12px 0; text-wrap: pretty; }
.chart-tip .tip-foot { font-family: var(--mono); font-size: 9.5px; color: var(--accent); padding: 9px 12px 11px; margin-top: 8px; border-top: 1px solid var(--line); }

/* ---------- Mini-timeline scrubber ---------- */
.minimap {
  flex: 0 0 var(--minimap-h, 46px);
  margin-top: 12px;
  position: relative;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--bg-1);
  overflow: hidden;
  cursor: crosshair;
  user-select: none;
}
.minimap svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.minimap-window {
  position: absolute; top: 0; bottom: 0;
  background: var(--accent-faint);
  border-left: 1.5px solid var(--accent); border-right: 1.5px solid var(--accent);
  cursor: grab;
}
.minimap-window:active { cursor: grabbing; }
.minimap-window .edge { position: absolute; top: 0; bottom: 0; width: 8px; cursor: ew-resize; }
.minimap-window .edge.l { left: -4px; } .minimap-window .edge.r { right: -4px; }
.minimap-shade { position: absolute; top: 0; bottom: 0; background: rgba(0,0,0,0.45); pointer-events: none; }

/* ---------- Progression list (ported; not mounted in the chart-only
   main panel, kept for parity with the redesign source) ---------- */
.list-head { flex: 0 0 auto; display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.list-head .title { font-size: 11px; color: var(--fg-2); font-weight: 600; }
.list-head .count { font-family: var(--mono); font-size: 10px; color: var(--fg-4); }
.prog-search {
  flex: 0 0 auto; width: 100%; margin-bottom: 8px; padding: 7px 10px;
  font-family: var(--mono); font-size: 11px; color: var(--fg);
  background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius);
}
.prog-search::placeholder { color: var(--fg-4); }
.prog-search:focus { outline: none; border-color: var(--accent-dim); background: var(--bg-3); }
.prog-list { flex: 1 1 auto; min-height: 0; overflow-y: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg-1); }
.prog-list.empty { padding: 22px; color: var(--fg-3); font-family: var(--mono); font-size: 11px; border-style: dashed; }
.prog-item { padding: 10px 13px; border-bottom: 1px solid var(--line-soft); cursor: pointer; position: relative; transition: background .1s; }
.prog-item:last-child { border-bottom: 0; }
.prog-item:hover, .prog-item.hovered { background: var(--bg-2); }
.prog-item.hovered::before, .prog-item.this-batch::before {
  content: ""; position: absolute; left: 0; top: 6px; bottom: 6px; width: 2px; background: var(--accent-dim); border-radius: 1px;
}
.prog-item.this-batch::before { background: var(--accent); }
.prog-item.recap { background: var(--bg-0); }
.prog-item.selected { background: var(--accent-faint); }
.prog-item.selected::before { content: ""; position: absolute; left: 0; top: 4px; bottom: 4px; width: 3px; background: var(--accent); border-radius: 1px; }
.prog-head { display: flex; align-items: center; gap: 9px; font-family: var(--mono); font-size: 11px; }
.prog-time { color: var(--fg-2); font-variant-numeric: tabular-nums; }
.prog-tags { display: flex; gap: 4px; flex: 1; flex-wrap: wrap; }
.ptag { font-family: var(--mono); font-size: 8.5px; letter-spacing: 0.06em; text-transform: uppercase; padding: 2px 6px; border-radius: 3px; background: var(--bg-3); color: var(--fg-3); }
.ptag.esc { color: var(--esc-color); }
.ptag.desc { color: var(--desc-color); }
.ptag.milestone { color: var(--accent); background: var(--accent-faint); }
.ptag.recap { color: var(--fg-2); border: 1px solid var(--line-strong); background: transparent; }
.prog-scores { margin-left: auto; display: inline-flex; align-items: baseline; gap: 9px; }
.prog-delta { font-family: var(--mono); font-size: 10px; color: var(--fg-3); font-variant-numeric: tabular-nums; }
.prog-delta.up { color: var(--esc-color); } .prog-delta.down { color: var(--desc-color); }
.prog-score { font-family: var(--mono); font-size: 12px; color: var(--fg); font-variant-numeric: tabular-nums; }
.prog-rationale { color: var(--fg-2); font-size: 12px; line-height: 1.5; margin-top: 6px; }
.prog-item.hovered .prog-rationale, .prog-item.this-batch .prog-rationale { color: var(--fg); }
.prog-hl { background: var(--accent-faint); color: var(--fg); border-radius: 2px; padding: 0 1px; }

/* ---------- Right: selected point ---------- */
.sel-empty { padding: 40px 22px; color: var(--fg-3); }
.sel-empty .t { font-family: var(--mono); font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--fg-2); margin-bottom: 8px; }
.sel-empty .h { font-size: 12px; line-height: 1.5; }
.sel-head { flex: 0 0 auto; padding: 16px 18px 14px; border-bottom: 1px solid var(--line); }
.sel-head-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 9px; }
.sel-time { font-family: var(--mono); font-size: 10.5px; color: var(--fg-3); }
.sel-close { color: var(--fg-3); font-size: 18px; line-height: 1; padding: 0 6px; border: 0; }
.sel-close:hover { color: var(--fg); }
.sel-score-row { display: flex; align-items: baseline; gap: 12px; margin-bottom: 10px; }
.sel-score { font-family: var(--mono); font-size: 26px; line-height: 1; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; color: var(--fg); }
.sel-score.recap { color: var(--fg-2); }
.sel-delta { font-family: var(--mono); font-size: 11px; color: var(--fg-3); font-variant-numeric: tabular-nums; }
.sel-tags { display: flex; gap: 4px; flex-wrap: wrap; }
.sel-tag { font-family: var(--mono); font-size: 9px; letter-spacing: 0.08em; text-transform: uppercase; padding: 2px 7px; border-radius: 3px; background: var(--bg-2); color: var(--fg-3); }
.sel-tag.milestone { color: var(--accent); background: var(--accent-faint); }
.sel-tag.recap { color: var(--fg-2); border: 1px solid var(--line-strong); }
.sel-tag.esc { color: var(--esc-color); } .sel-tag.desc { color: var(--desc-color); }
.sel-covers { font-family: var(--mono); font-size: 10px; color: var(--fg-3); margin-top: 8px; }
.sel-covers .lbl { color: var(--fg-4); text-transform: uppercase; letter-spacing: 0.1em; margin-right: 6px; }
.sel-body { flex: 0 0 auto; padding: 14px 18px; color: var(--fg); font-size: 13px; line-height: 1.6; border-bottom: 1px solid var(--line); }
.sel-trigs { flex: 1 1 auto; overflow-y: auto; padding: 14px 18px 30px; }
.sel-trigs-head { display: flex; align-items: center; gap: 7px; font-size: 11px; color: var(--fg-2); font-weight: 600; margin-bottom: 10px; }
.sel-trigs-head .c { font-family: var(--mono); font-size: 9px; color: var(--fg-faint); background: var(--bg-2); padding: 1px 5px; border-radius: 2px; }
.sel-trig { padding: 11px 12px; margin-bottom: 10px; background: var(--bg-0); border: 1px solid var(--line); border-radius: var(--radius); }
.sel-trig-head { display: flex; align-items: center; gap: 8px; margin-bottom: 7px; padding-bottom: 6px; border-bottom: 1px dotted var(--line); font-family: var(--mono); }
.sel-trig-time { font-size: 11px; color: var(--fg); }
.sel-trig-id { font-size: 9px; color: var(--fg-faint); margin-left: auto; }
.sel-trig-fact { color: var(--fg); font-size: 12.5px; line-height: 1.45; }
.sel-trig-ctx { color: var(--fg-3); font-size: 11.5px; line-height: 1.4; margin-top: 4px; }
.sel-trig-meta { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 7px; }
.sel-trig-tag { font-family: var(--mono); font-size: 9px; color: var(--fg-3); background: var(--bg-2); padding: 1px 6px; border-radius: 2px; }
.sel-trig-tag.horizon { color: var(--fg-2); border: 1px solid var(--line); background: transparent; }

/* Source headlines with open link */
.sel-headlines { margin-top: 10px; padding-top: 9px; border-top: 1px dotted var(--line); display: flex; flex-direction: column; gap: 6px; }
.sel-headlines-head { font-family: var(--mono); font-size: 9px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--fg-faint); margin-bottom: 2px; display: flex; gap: 6px; align-items: center; }
.sel-headline { display: block; padding: 7px 9px; background: var(--bg-1); border-left: 2px solid var(--line); border-radius: 0 3px 3px 0; text-decoration: none; transition: border-color .12s, background .12s; }
.sel-headline:hover { background: var(--bg-2); border-left-color: var(--accent); }
.sel-headline-meta { display: flex; gap: 9px; align-items: center; font-family: var(--mono); font-size: 9.5px; color: var(--fg-3); margin-bottom: 4px; }
.sel-headline-src { color: var(--fg-2); }
.sel-headline-open { margin-left: auto; color: var(--accent); display: inline-flex; align-items: center; gap: 3px; opacity: 0; transition: opacity .12s; }
.sel-headline:hover .sel-headline-open { opacity: 1; }
.sel-headline-text { color: var(--fg); font-size: 11.5px; line-height: 1.45; }
.sel-headline.missing { background: transparent; border-left-color: var(--line-soft); color: var(--fg-faint); font-family: var(--mono); font-size: 10px; font-style: italic; }

.empty { padding: 18px; color: var(--fg-3); font-size: 12px; font-family: var(--mono); }
