/* ============================================================================
   Bento board — ELCA Bento UI Layout Spec
   ----------------------------------------------------------------------------
   The spec is a layout system, not a theme applied on top of one: the grid,
   the box archetypes, the shared anatomy every box repeats, and three
   interaction states. Everything here is that system. KPI wiring lives in
   cockpit.js; this file never names a metric.

   Nine archetypes now, not the spec's seven: H (stack) and I (composition)
   were added for questions the seven could not ask — one metric split month
   by month, and one total drawn as the parts it is made of. Both keep the
   shared anatomy and the three interaction states, which is what makes them
   extensions of the system rather than exceptions to it.
   ========================================================================== */

:root {
  /* Surface */
  --board:      #ecebe6;
  --box:        #ffffff;
  --rail:       #16181d;
  --hairline:   #f2f2ee;
  --edge:       #e6e6e1;

  /* Ink */
  --ink:        #16181d;
  --ink-2:      #4a4f57;
  --ink-3:      #6f747d;
  --muted:      #8b8f98;
  --muted-2:    #9a9ea6;
  --faint:      #b5b8be;

  /* Category — the three funnel stages, in funnel order */
  --cat-1:      #1a2b4a;
  --cat-2:      #4a8a5f;
  --cat-3:      #c8102e;
  --cat-none:   #9a9ea6;

  /* Status */
  --good:       #1f8a5b;  --good-bg:  #e8f3ec;
  --watch:      #b8862f;  --watch-bg: #fdf4e3;
  --breach:     #c8102e;  --breach-bg:#fdecee;

  /* Series identity — metric colours for the multi-metric box. Deliberately
     not the category colours: a series here is a metric, not a stage. */
  --s-1: #2b5bd7;  --s-2: #c8102e;  --s-3: #1f8a5b;  --s-4: #b8862f;

  /* Geometry */
  --radius:     22px;
  --radius-sm:  7px;
  --gap:        16px;
  --row:        188px;

  --mono: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --sans: 'Montserrat', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;

  /* chart.js draws against these; mapping them keeps the existing SVG
     renderers on the bento palette without touching their source. */
  --accent:    var(--s-1);
  --danger:    var(--breach);
  --grid-line: var(--hairline);
  --border:    var(--edge);
  --panel:     var(--box);
  --text:      var(--ink);
  --bg:        var(--board);
}

* { box-sizing: border-box; }
/* Several surfaces below set an explicit display, which outranks the UA
   [hidden] rule and leaves a "hidden" panel on screen. */
[hidden] { display: none !important; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--board);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--breach); text-decoration: none; }
a:hover { color: #9c0c22; }
::selection { background: var(--ink); color: #fff; }

/* ---------------------------------------------------------------- 01 · grid */
/* Four equal columns at minmax(0,1fr) so a long label can never widen its
   column; 188px fixed rows; 16px gap in both axes. Spacing comes from the
   gap alone — no box carries a margin. */

.page { max-width: 1320px; margin: 0 auto; padding: 26px 32px 56px; }

.board {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  /* minmax, not a fixed --row: every box is clipped by `overflow: hidden`, so
     a row that cannot grow silently cuts the bottom off whichever box needs
     one line more than the rest (the LinkedIn post views glance carries an
     extra caption row and lost its toolbar to it). The floor keeps the board
     on its rhythm — nothing that already fits moves — and only a row with a
     box taller than 188px grows, by exactly what that box needs. */
  grid-auto-rows: minmax(var(--row), auto);
  gap: var(--gap);
}
.span-2   { grid-column: span 2; }
.tall     { grid-row: span 2; }
.span-2.tall { grid-column: span 2; grid-row: span 2; }
/* .half-stack — a box that takes HALF the board's width and ONE row, so two
   of them stack in the right half beside a 2x2 primary. The archetypes it is
   put on claim other shapes for good reasons of their own (.box.rail is 1x2,
   .box.glance 1x1), and this overrides only the footprint, never the
   contents. Both need !important: the archetype rules are declared further
   down this file and win at equal specificity. */
.box.half-stack { grid-column: span 2 !important; grid-row: span 1 !important; }

/* Below 1180px the grid drops to two columns: the 2×2 keeps its span, the
   rail and the trend fall back to 1×1 so the board stays two-wide. */
@media (max-width: 1180px) {
  .board { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .box.rail.tall, .box.trend.tall { grid-row: span 1; }
  /* With the rows gone the rail has nothing to push to the bottom, and
     space-between would strand the figure at the top of an empty box. */
  .box.rail { justify-content: flex-start; }
  .box.rail .rail-rows { display: none; }
  .box.trend .trend-legend { display: none; }
}
@media (max-width: 720px) {
  .page  { padding: 20px 16px 40px; }
  .board { grid-template-columns: minmax(0, 1fr); grid-auto-rows: auto; }
  /* !important, for the same reason the .is-open reset below needs it: the
     archetypes claim their spans FURTHER DOWN this file (.box.primary at "01 ·
     grid" + 120 lines, .box.rail, .box.category, .box.trend, .box.multi), and
     at equal specificity the later rule wins. Without it the primary kept
     `grid-column: span 2` inside a one-track grid, which adds an implicit
     zero-width second track and pushes the box past the viewport. Naming each
     archetype here instead would leave the next one to be written broken. */
  .box, .box.span-2, .box.tall, .box.span-2.tall {
    grid-column: auto !important; grid-row: auto !important; min-height: var(--row);
  }
}

/* ------------------------------------------------------------ shared anatomy */
/* Every metric box reads top to bottom in the same order: source badge, ✦,
   status marker, value, delta, hint, chart, axis captions, read line. */

.box {
  background: var(--box);
  border-radius: var(--radius);
  padding: 20px 22px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  /* Background and shadow only. Animating a grid span produces a visible
     jump, so the reflow is deliberately instant and never tweened. */
  transition: background-color .15s ease, box-shadow .15s ease;
}
@media (prefers-reduced-motion: reduce) { .box { transition: none; } }

/* 0 · KPI id — rides in the box's own toolbar, immediately before ℹ/✦/▤/⌕
   (stampKpiId inserts it there in DOM order), so a box can be named in a bug
   report from the same spot a reader's eye already goes for its controls. A
   chip rather than bare text: filled + hairline outline, so it stays
   readable over the white box, the dark rail, and a glance box's accent bar.
   `flex: none` keeps it from being stretched or squeezed by the row's other
   items; it never carries pointer/selection behaviour of its own. */
.kpi-id {
  display: inline-flex; align-items: center; flex: none; align-self: center;
  padding: 2px 6px; border-radius: 999px;
  background: rgba(22, 24, 29, .06);
  border: 1px solid var(--edge);
  font-family: var(--mono); font-size: 10px; font-weight: 600; line-height: 1;
  letter-spacing: .06em; color: var(--ink-2);
  pointer-events: none; user-select: none;
}
.box.rail .kpi-id, .box.dark .kpi-id {
  background: rgba(255, 255, 255, .12);
  border-color: rgba(255, 255, 255, .22);
  color: #e3e5e9;
}
/* The one archetype with no toolbar to join: an error box returns before
   `actions()` ever runs, so stampKpiId falls back to prepending the chip
   straight onto `.box` — its only direct-child case, hence the `>` — where
   the column's default cross-axis stretch would otherwise pull a plain span
   to the box's full width. */
.box > .kpi-id:first-child { align-self: flex-start; margin-bottom: 8px; }

/* 1 · Source badge — 24px rounded square, first element in every metric box. */
.badge {
  width: 24px; height: 24px; border-radius: var(--radius-sm);
  border: 1px solid var(--edge); background: #fff;
  display: flex; align-items: center; justify-content: center; flex: none;
}
.badge svg { display: block; }
.rail .badge, .dark .badge { border-color: rgba(255,255,255,.16); background: rgba(255,255,255,.06); }

/* 2 · ✦ button — opens the in-box panel. Styled with .zoom-btn below. */

/* 3 · Status marker — pill on larger boxes, 8px dot on glance boxes. */
.pill {
  font-family: var(--mono); font-size: 9.5px; font-weight: 600;
  letter-spacing: .08em; text-transform: uppercase;
  padding: 4px 8px; border-radius: 5px; flex: none; white-space: nowrap;
  background: var(--hairline); color: var(--muted);
}
.pill.good   { color: var(--good);   background: var(--good-bg); }
.pill.watch  { color: var(--watch);  background: var(--watch-bg); }
/* On a card's own head the verdict is the card's "so what": larger, solid,
   with its direction, so it is read before the figure (client review). */
.cat-head .pill, .primary-head .pill, .trend-head .pill {
  font-size: 11.5px; font-weight: 700; padding: 5px 10px; border-radius: 6px; letter-spacing: .06em;
}
.cat-head .pill.good, .primary-head .pill.good, .trend-head .pill.good { color: #fff; background: var(--good); }
.cat-head .pill.good::before, .primary-head .pill.good::before, .trend-head .pill.good::before { content: '▲ '; }
.cat-head .pill.breach::before, .primary-head .pill.breach::before, .trend-head .pill.breach::before { content: '▼ '; }
.cat-head .pill.watch::before, .primary-head .pill.watch::before, .trend-head .pill.watch::before { content: '■ '; font-size: .8em; }
/* Behind is the one status a reader must not miss, so it is the one pill that
   fills rather than tints — solid red, white text, in every context. */
.pill.breach { color: #fff; background: var(--breach); }
.rail .pill, .dark .pill { background: rgba(255,255,255,.1); color: #c9ccd1; }
.rail .pill.good,   .dark .pill.good   { color: #6fd39d; background: rgba(111,211,157,.14); }
.rail .pill.breach, .dark .pill.breach { color: #fff; background: var(--breach); }
.rail .pill.watch,  .dark .pill.watch  { color: #e2bd72; background: rgba(226,189,114,.14); }

.dot { width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--muted); }
.dot.good { background: var(--good); } .dot.watch { background: var(--watch); } .dot.breach { background: var(--breach); }

/* 4 · Value — never wraps, 800 weight, −0.03em tracking. */
.value { font-weight: 800; letter-spacing: -.03em; line-height: 1; white-space: nowrap; font-variant-numeric: tabular-nums; }
.value.primary  { font-size: 72px; letter-spacing: -.045em; line-height: .9; }
.value.rail-hero{ font-size: 38px; letter-spacing: -.04em; }
.value.category { font-size: 40px; letter-spacing: -.04em; }
.value.glance   { font-size: 29px; font-weight: 700; }
.value.small    { font-size: 15px; font-weight: 700; }

/* 5 · Delta — baseline-aligned right of the value. */
.delta {
  font-family: var(--mono); font-size: 12px; font-weight: 600;
  letter-spacing: .02em; white-space: nowrap; color: var(--muted);
}
.delta.up   { color: var(--good); }
.delta.down { color: var(--breach); }
.delta.lg   { font-size: 18px; }
/* A dash that is a JUDGEMENT, not a gap: the comparison existed and was
   withheld because it would have been an artefact. It carries the reason as a
   tooltip, and the dotted underline is what says there is a reason to hover
   for — otherwise it is indistinguishable from a source that published no
   comparison at all. */
.delta.held {
  text-decoration: underline dotted currentColor 1px;
  text-underline-offset: 3px;
  cursor: help;
}
/* A percentage that IS a measurement, but not of the window the date picker
   names — a capped source comparing the two spans its chart actually draws.
   Same dotted affordance as .held for the same reason: the asterisk says there
   is something to read, the underline says it is hoverable. The colour stays
   the delta's own, because the number is real. */
.delta.marked {
  text-decoration: underline dotted currentColor 1px;
  text-underline-offset: 3px;
  cursor: help;
}
.rail .delta, .dark .delta { color: #8b8f98; }
.rail .delta.up, .dark .delta.up { color: #6fd39d; } .rail .delta.down, .dark .delta.down { color: #ff8a99; }
.rail-gain { font-family: var(--mono); font-size: 11px; color: #8b8f98; white-space: nowrap; }

/* 6 · Affordance — one control in one place on every box, so a reader never
   has to work out whether this one opens. It lives in the box toolbar,
   bottom — see 6b below. */
.spark-btn, .zoom-btn, .raw-btn, .info-btn, .table-btn {
  width: 23px; height: 23px; flex: none;
  border: 1px solid var(--edge); border-radius: var(--radius-sm);
  background: #fbfbf9; color: var(--muted);
  font-size: 11px; line-height: 1; cursor: pointer; padding: 0;
  display: flex; align-items: center; justify-content: center;
  transition: background .12s ease, color .12s ease, border-color .12s ease;
}
.spark-btn:hover, .zoom-btn:hover, .raw-btn:hover, .info-btn:hover, .table-btn:hover { border-color: var(--ink-3); color: var(--ink-2); }
.spark-btn[aria-expanded="true"], .zoom-btn[aria-expanded="true"], .raw-btn[aria-expanded="true"],
.info-btn[aria-expanded="true"] {
  background: var(--ink); border-color: var(--ink); color: #fff;
}
.zoom-btn svg, .table-btn svg { display: block; }
/* The ℹ glyph: a serif italic i, so it reads as "information" at 23px where a
   mono i would read as a stray character. */
.info-btn { font-family: Georgia, 'Times New Roman', serif; font-style: italic; font-weight: 700; font-size: 13px; padding-bottom: 1px; }

/* The donut has no head row of its own, so it keeps its own absolutely
   positioned corner rather than joining the in-flow footer every other
   archetype uses — bottom-right now, to match where every other box's
   controls live. */
.box-actions { position: absolute; bottom: 18px; right: 20px; display: flex; gap: 8px; }

/* 6a · Hide/unhide — admin-only, riding right after the kpi-id chip
   (stampHideToggle inserts it there — cockpit.js only calls it at all for an
   admin, so a viewer's markup never carries this button). Sized with the rest
   of the toolbar group rather than joining it: it is one glyph narrower, 22 not
   23, so the pair reads as "a chip with two small actions of its own" rather
   than a sixth identical toolbar button. Amber once hidden — the same ink
   .pill.watch uses — because a hidden card is a state to notice, not an
   error, and not the neutral idle every other toolbar button stays in. */
.hide-btn {
  width: 22px; height: 22px; flex: none;
  border: 1px solid var(--edge); border-radius: var(--radius-sm);
  background: #fbfbf9; color: var(--muted);
  font-size: 12px; line-height: 1; cursor: pointer; padding: 0;
  display: flex; align-items: center; justify-content: center;
  transition: background .12s ease, color .12s ease, border-color .12s ease;
}
.hide-btn:hover { border-color: var(--ink-3); color: var(--ink-2); }
.hide-btn.is-hidden { color: var(--watch); border-color: var(--watch); background: var(--watch-bg); }
.hide-btn.is-hidden:hover { color: var(--breach); border-color: var(--breach); }
.box.rail .hide-btn, .box.dark .hide-btn { background: rgba(255, 255, 255, .06); border-color: rgba(255, 255, 255, .18); color: #c9ccd1; }
.box.rail .hide-btn:hover, .box.dark .hide-btn:hover { border-color: rgba(255, 255, 255, .42); color: #fff; }
/* The one fallback stampKpiId itself falls back to (an error box, prepended
   straight onto `.box` rather than into a toolbar) — see stampKpiId's own
   comment. `.box` is a flex COLUMN there, so a direct-child button would
   otherwise stack as its own full-width row under the chip; pull it back to
   the chip's own corner instead. Scoped with `>` so it touches only that one
   fallback case, never the toolbar/box-actions row every other archetype
   places this button in. */
.box > .kpi-id:first-child + .hide-btn { align-self: flex-start; margin-top: -4px; margin-bottom: 8px; }

/* Export pick — the hide toggle's shape, for every viewer. Red once picked,
   the brand ink, so a picked card reads as marked from across the board. */
.pick-btn {
  width: 22px; height: 22px; flex: none;
  border: 1px solid var(--edge); border-radius: var(--radius-sm);
  background: #fbfbf9; color: var(--muted);
  font-size: 12px; font-weight: 700; line-height: 1; cursor: pointer; padding: 0;
  display: flex; align-items: center; justify-content: center;
  transition: background .12s ease, color .12s ease, border-color .12s ease;
}
.pick-btn:hover { border-color: var(--ink-3); color: var(--ink-2); }
.pick-btn.is-picked, .pick-btn.is-picked:hover { background: #e2001a; border-color: #e2001a; color: #fff; }
.box.rail .pick-btn:not(.is-picked), .box.dark .pick-btn:not(.is-picked) { background: rgba(255, 255, 255, .06); border-color: rgba(255, 255, 255, .18); color: #c9ccd1; }
.box.rail .pick-btn:not(.is-picked):hover, .box.dark .pick-btn:not(.is-picked):hover { border-color: rgba(255, 255, 255, .42); color: #fff; }
/* Error boxes have no toolbar: keep the pick in the chip's corner, same as
   the hide toggle above. The hide toggle, when present, sits between them. */
.box > .kpi-id:first-child + .pick-btn,
.box > .kpi-id:first-child + .hide-btn + .pick-btn { align-self: flex-start; margin-top: -4px; margin-bottom: 8px; }

/* Export view (#/export) — a header row over the board grid the picks sit in. */
.export-head {
  display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap;
  padding: 4px 2px 2px;
}
.export-title { font-family: var(--mono); font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--ink); }
.export-note { font-size: 12px; color: var(--muted); flex: 1; }
.export-clear {
  font-family: var(--mono); font-size: 10.5px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase;
  border: 1px solid var(--edge); border-radius: 999px; background: #fff; color: var(--ink-2);
  padding: 5px 12px; cursor: pointer;
}
.export-clear:hover { border-color: var(--ink-3); color: var(--ink); }
.export-empty {
  padding: 40px 16px; text-align: center;
  border: 1px dashed var(--edge); border-radius: var(--radius-sm, 8px);
  font-size: 13px; color: var(--muted);
}

/* 7 · Chart — fixed pixel height per archetype, min-height set so it can
   never collapse inside a flex column. */
.plot { display: block; width: 100%; flex: 0 1 auto; min-height: 30px; }
.plot.no-series { opacity: .5; }

/* 7a · The hover overlay — the period and the value under the pointer.
   Only present on the area charts, and only where the caller handed the plot
   an index-aligned set of period labels (see sparkPlot). The wrapper is the
   positioning context; the plot inside keeps every rule above, since all of
   them are descendant selectors and none assumed .box was the parent.

   Height is deliberately NOT set here. The svg still carries its own height
   attribute, resizer() still doubles it on expand, and .box.has-panel still
   pins it — the wrapper simply follows whatever the plot inside it is. */
.plot-wrap { position: relative; min-width: 0; }
/* Every part of the overlay is transparent to the pointer, or the readout
   would sit between the cursor and the chart it is reading. */
.plot-cursor, .plot-dot, .plot-readout { pointer-events: none; }
.plot-wrap:not(.is-hover) .plot-cursor,
.plot-wrap:not(.is-hover) .plot-dot,
.plot-wrap:not(.is-hover) .plot-readout { display: none; }

.plot-cursor { position: absolute; top: 0; bottom: 0; width: 1px; background: rgba(22, 24, 29, .22); }
/* Ringed in the card's own background so the dot stays visible where it lands
   on top of the line rather than beside it. */
.plot-dot {
  position: absolute; width: 7px; height: 7px; border-radius: 50%;
  transform: translate(-50%, -50%); background: var(--ink);
  box-shadow: 0 0 0 2px var(--box);
}

/* The chip itself. Pinned to the top of the plot rather than chasing the
   point's own height: near the peak of a series a chip that follows the line
   would cover the very shape it is describing, and .box is overflow:hidden,
   so one pushed past the top edge would simply be cut off. Its `left` is set
   in JS, clamped into the wrapper for the same reason. */
.plot-readout {
  position: absolute; top: 2px; z-index: 2; white-space: nowrap;
  /* Wraps to a second line rather than overflowing. The pillar cards are a
     quarter of the board wide and the chip carries two periods, two figures
     and a change — on those it simply does not fit on one line, and a chip
     wider than its card is one .box's overflow:hidden cuts in half. Capped at
     the wrapper's width so the JS clamp always has somewhere to put it. */
  max-width: 100%; flex-wrap: wrap; row-gap: 1px;
  display: flex; align-items: baseline; gap: 7px;
  padding: 3px 7px; border-radius: var(--radius-sm);
  background: var(--box); border: 1px solid var(--edge);
  box-shadow: 0 4px 14px rgba(22, 24, 29, .12);
  font-family: var(--mono); font-size: 10.5px; font-variant-numeric: tabular-nums;
}
.plot-readout-k { color: var(--ink-3); letter-spacing: .04em; }
.plot-readout-v { color: var(--ink); font-weight: 700; }
/* The grey ground's own period and value, named rather than assumed: on a
   capped source and on the half-year pair the baseline is the months BEFORE
   the line, not the same months a year earlier. */
.plot-readout-b { color: var(--muted); display: flex; align-items: baseline; gap: 5px; }
.plot-readout-d.up { color: var(--good); }
.plot-readout-d.down { color: var(--breach); }

/* 6b · The box toolbar — kpi id · ℹ · ✦(flagged off) · ▤ · ⛶ · ⌕, in that DOM
   order (stampKpiId inserts the id chip ahead of whichever control renders
   first). A footer row every archetype appends last, so it sits below
   everything else the box draws rather than crowding the head; the donut is
   the one exception, with no natural bottom row of its own to join — see
   .box-actions above. Lighter in glance boxes: they carry the tightest
   height budget on the board (188px, collapsed), so the hairline is dropped
   there rather than spending height on a divider nothing else needs. */
.box-toolbar {
  display: flex; align-items: center; gap: 8px; flex: none;
  margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--hairline);
}
.box.glance .box-toolbar { margin-top: 6px; padding-top: 0; border-top: 0; }
.box.rail .box-toolbar, .box.dark .box-toolbar { border-top-color: rgba(255, 255, 255, .1); }

/* 7b · Chart end labels — the first/last value under a pillar's area chart,
   left value under the line's start, right value under its end. Bolder and
   darker than axis-caps below: that row is a caption, this one is data. */
.plot-ends {
  display: flex; justify-content: space-between; gap: 8px;
  font-family: var(--mono); font-size: 10.5px; font-weight: 700;
  font-variant-numeric: tabular-nums; color: var(--ink-2);
}
.plot-ends > span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }

/* 8 · Axis captions — mono 9–9.5px, reference band left, window right. */
.axis-caps {
  display: flex; justify-content: space-between; gap: 8px;
  font-family: var(--mono); font-size: 9.5px; letter-spacing: .06em;
  text-transform: uppercase; color: var(--faint);
}
/* One line, always. A caption that wraps takes its height from the chart
   above it and knocks the box out of step with its neighbours. */
.axis-caps > span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }

/* 9 · Read line — the only prose in a box; omitted rather than padded. */
.read { font-size: 11.5px; line-height: 1.45; color: var(--ink-3); }

/* Kicker + title, the label pair above a value. */
.kicker {
  font-family: var(--mono); font-size: 10px; letter-spacing: .12em;
  text-transform: uppercase; color: var(--muted-2); overflow-wrap: anywhere;
  /* A 10px mono label was inheriting body leading. On the boxes whose source
     name wraps to two lines that alone was enough to push the axis caption
     out of a 188px row. */
  line-height: 1.3;
}
.title { font-size: 16px; font-weight: 700; letter-spacing: -.01em; margin-top: 4px; }

/* ----------------------------------------------------------- 02 · archetypes */

/* A · Primary — one per screen. Its size is the hierarchy. */
.box.primary { grid-column: span 2; grid-row: span 2; padding: 26px 28px 22px; justify-content: space-between; gap: 10px; }
/* A 72px figure, a 150px chart, captions and a category split add up to more
   than two rows hold, and .box clips its overflow — so the split row sat
   flush against the bottom edge with its descenders cut. The chart is the one
   element here with no fixed meaning at a given height, so it yields: it
   keeps 150px where there is room and shrinks toward 90 where there is not.
   preserveAspectRatio="none" means the line just redraws to fit. */
.box.primary .plot { min-height: 80px; }
.primary-head { display: flex; align-items: center; gap: 12px; }
.primary-figure { display: flex; align-items: flex-end; gap: 16px; }
/* A rate beside the headline, in the delta's place — see primaryBox's `note`.
   Sized between the delta and the captions: it is a real figure, not a
   caption, but it must not compete with the number it qualifies. */
.primary-note { display: inline-flex; align-items: baseline; gap: 7px; padding-bottom: 10px; }
.primary-note-v { font-size: 30px; font-weight: 800; font-variant-numeric: tabular-nums; color: var(--ink); letter-spacing: -.01em; }
.primary-note-k {
  font-family: var(--mono); font-size: 10px; letter-spacing: .06em;
  text-transform: uppercase; color: var(--muted);
}
.primary-split { display: flex; gap: 10px; }
/* .no-split — a primary whose drill table says the same thing its split row
   does, for EVERY page rather than the first three. CO-1 carried both: three
   pages with views and deltas under the chart, and the same pages with the
   same figures in the table one click away.

   Always, not just expanded: the duplication is what makes the split
   redundant, and that is true of the collapsed card too — the table is one
   click from it either way. Opt-in, because most primaries have no such
   overlap and their split row is the only breakdown they carry.

   The ℹ and ✦ buttons hide this same element inline and insert their panel
   after it, which still works: they operate on an element this rule has
   already hidden, and the panel is a sibling. */
.box.primary.no-split .primary-split { display: none; }
.primary-split > div { flex: 1; min-width: 0; border-top: 1px solid var(--hairline); padding-top: 10px; }
.split-k { display: flex; align-items: center; gap: 7px; font-size: 11px; color: var(--ink-3); }
.split-k span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.split-v { display: flex; align-items: baseline; gap: 7px; margin-top: 4px; }

/* B · Rail — dark by default. Rows fixed at 46px, labels above values, so
   height is constant no matter how long a label is. */
.box.rail { grid-row: span 2; background: var(--rail); color: #fff; padding: 22px 22px 20px; justify-content: space-between; gap: 12px; }
.rail a { color: var(--muted); }
.rail-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.rail-name { font-size: 13px; color: #c9ccd1; margin-top: 12px; line-height: 1.4; }
.rail-rows { display: flex; flex-direction: column; gap: 7px; }
.rail-row { border-top: 1px solid rgba(255,255,255,.1); padding-top: 7px; height: 46px; }
.rail-row .k { font-family: var(--mono); font-size: 9.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); line-height: 1.3; }
.rail-row .v { display: flex; align-items: baseline; gap: 7px; margin-top: 3px; }

/* The absolute gain beside a glance box's headline, in place of a delta chip —
   the glance twin of .rail-since. */
.glance-gain { display: inline-flex; align-items: baseline; gap: 5px; }
.glance-gain-v { font-weight: 700; font-size: 12.5px; font-variant-numeric: tabular-nums; color: var(--ink); }
.glance-gain-k {
  font-family: var(--mono); font-size: 8.5px; letter-spacing: .06em;
  text-transform: uppercase; color: var(--muted);
}

/* The absolute gain under a stock rail's hero, in place of a delta chip. The
   figure carries the weight; the caption names the window it covers. */
.rail-since { display: inline-flex; align-items: baseline; gap: 6px; }
.rail-since-v { font-weight: 700; font-size: 13px; font-variant-numeric: tabular-nums; color: #fff; }
.rail-since-k {
  font-family: var(--mono); font-size: 9px; letter-spacing: .06em;
  text-transform: uppercase; color: var(--muted-2);
}
.box.rail.light .rail-since-v { color: var(--ink); }
.box.rail.light .rail-since-k { color: var(--muted); }

/* The ▤/✦ drill panel inside a DARK rail. The shared .detail-row rules a few
   hundred lines down are written for a light box — .name takes var(--ink) and
   .v inherits it, both near-black — so on the dark rail they painted #16181d
   text on a #16181d ground and the page names vanished while the grey .sub
   line under them stayed readable. Scoped to `.box.rail:not(.light)` so the
   light rail and every non-rail box keep the shared defaults untouched. */
.box.rail:not(.light) .detail-row .k .name { color: #fff; }
.box.rail:not(.light) .detail-row .v { color: #fff; }
.box.rail:not(.light) .detail-row .v2, .box.rail:not(.light) .detail-row .v3 { color: var(--muted-2); }
.box.rail:not(.light) .detail-row { border-top-color: rgba(255, 255, 255, .1); }
.box.rail:not(.light) .detail-header,
.box.rail:not(.light) .detail-header .name,
.box.rail:not(.light) .detail-header .v,
.box.rail:not(.light) .detail-header .v2,
.box.rail:not(.light) .detail-header .v3 { color: var(--muted-2); }

/* .light — one rail instance (CO-2) keeps the rail's hero+rows layout but
   opts out of the dark treatment. Every dark-tuned rule above and in the
   shared-anatomy section (kpi-id, badge, pill, delta, toolbar, ▤/✦ panels)
   is scoped to `.rail`/`.box.rail`, so it still matches a box that also
   carries `.light` — each one needs a same-specificity-or-higher reset back
   to its plain (non-rail) default here, or the light box would inherit
   white-on-white text from the dark rules further down this file. */
.box.rail.light { background: var(--box); color: var(--ink); }
.box.rail.light .kpi-id { background: rgba(22, 24, 29, .06); border-color: var(--edge); color: var(--ink-2); }
.box.rail.light .badge { border-color: var(--edge); background: #fff; }
.box.rail.light .pill { background: var(--hairline); color: var(--muted); }
.box.rail.light .pill.good   { color: var(--good);   background: var(--good-bg); }
.box.rail.light .pill.breach { color: #fff; background: var(--breach); }
.box.rail.light .pill.watch  { color: var(--watch);  background: var(--watch-bg); }
.box.rail.light .delta { color: var(--muted); }
.box.rail.light .delta.up { color: var(--good); }
.box.rail.light .delta.down { color: var(--breach); }
.box.rail.light .rail-gain { color: var(--muted); }
.box.rail.light .box-toolbar { border-top-color: var(--hairline); }
.box.rail.light .rail-name { color: var(--ink-2); }
.box.rail.light .rail-row { border-top-color: var(--hairline); }
.box.rail.light .info-biz { color: var(--ink-2); }
.box.rail.light .raw-table th { background: var(--box); color: var(--muted-2); }
.box.rail.light .raw-table td { color: var(--ink-2); }
.box.rail.light .raw-table th, .box.rail.light .raw-table td { border-bottom-color: var(--hairline); }
.box.rail.light .raw-table tr:hover td { background: #fbfbf9; }
.box.rail.light .raw-panel { border-top-color: var(--hairline); }
.box.rail.light .raw-dl { background: #fbfbf9; border-color: var(--edge); color: var(--ink-2); }
.box.rail.light .raw-dl:hover { background: var(--ink); border-color: var(--ink); color: #fff; }
.box.rail.light .spark-btn, .box.rail.light .zoom-btn, .box.rail.light .info-btn, .box.rail.light .table-btn {
  background: #fbfbf9; border-color: var(--edge); color: var(--muted);
}
.box.rail.light .spark-btn:hover, .box.rail.light .zoom-btn:hover, .box.rail.light .info-btn:hover, .box.rail.light .table-btn:hover {
  border-color: var(--ink-3); color: var(--ink-2);
}
.box.rail.light .spark-btn[aria-expanded="true"], .box.rail.light .zoom-btn[aria-expanded="true"],
.box.rail.light .info-btn[aria-expanded="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }
.box.rail.light .ai-panel { border-top-color: var(--hairline); }
.box.rail.light .ai-fact { color: var(--ink-3); }
.box.rail.light .ai-fact .v { color: var(--ink); }
.box.rail.light .ai-caveat { color: var(--watch); background: var(--watch-bg); }

/* A category card sizes to its CONTENT, not to two board rows.

   The archetype claims `grid-row: span 2`, and `grid-auto-rows` has a 188px
   floor per row, so the card was pinned at 392px however little it had to say
   — a head, a figure, a 54px chart and however many metric rows the caller
   passed, which on the impressions-only cards is none. That left 173px of dead
   space under the chart, and even a card WITH two metric rows had 126px of it.

   Growing the chart into the gap was the first attempt and it was the wrong
   trade: a 177px sparkline is far more chart than the shape needs to be read,
   and it spent the reader's viewport to fill a hole. Shrinking the card is the
   fix — the chart stays a glanceable 54px band, and the row it no longer needs
   goes back to the page, which fits five stacked bands in the space three used
   to take.

   `align-self: start` is what lets it: the card stops stretching to its grid
   area and takes the height its content asks for. The band and the vertical
   grid stretch their cards to the tallest in the row (`align-items: stretch`
   below), so cards still line up with each other — they just line up at the
   height the content needs rather than at a fixed 392px. */
.box.category { align-self: start; }

/* Open, the card must fill its (now taller) area again — the expand panel is
   sized to the room the box has, and a card sized to its collapsed content
   would clip the table it just opened. */
.box.category.is-open { align-self: stretch; }

/* C · Composite — one share figure, 2–4 arcs, no legend: the caption carries
   the meaning. */
.box.donut { align-items: center; justify-content: center; gap: 8px; position: relative; }
.donut-wrap { position: relative; width: 104px; height: 104px; }
.donut-mid { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 23px; font-weight: 700; letter-spacing: -.02em; }
.donut-cap { font-size: 11.5px; color: var(--muted); text-align: center; line-height: 1.4; }

/* An unscored donut ends at its caption — no scorecard, so none of the
   reserved strip `.scored` keeps below its last metric row. It still has to
   keep clear of `.box-actions`, which is out of flow in the bottom-right
   corner and otherwise paints over a caption long enough to reach it (BA-33's
   "…largest share of search impressions" was the case that showed it).
   Reserving the corner's height at the bottom is what moves the caption: the
   box centres its content, so the padding shifts the whole block up rather
   than adding a gap under it. Capping the caption's width instead does NOT
   work — it is centred, so a narrower column still reaches past where the
   toolbar starts. */
.box.donut:not(.scored) { padding-bottom: 44px; }

/* A donut carrying a named legend. The ring and the list sit side by side, so
   the box switches from the centred column every other donut uses to a row:
   arcs on the left at their natural 104px, the legend taking the rest. The
   caption goes full-width underneath, where it still reads as the label for
   the whole card rather than for either column.
   `.legended` says nothing about height: the caller decides. Six rows beside
   the ring want the 1x2 card (the channel mix keeps `.tall`), two or three fit
   the 1x1 — which is the whole point of `compact`, a scorecard that would have
   forced `.scored` to 1x2 staying small by sitting beside the arcs instead. */
.box.donut.legended {
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-start;
  gap: 16px;
  padding-bottom: 44px;
}
/* The ring standing in for a glance box's sparkline. The glance layout is a
   column of full-width rows, so the wrapper centres itself rather than
   stretching, and takes the vertical room the 44px chart slot does not have. */
.box.glance .glance-donut { margin: 6px auto 2px; flex: none; }

.box.donut.legended .donut-wrap { flex: none; }
.box.donut.legended .donut-legend {
  flex: 1 1 150px;
  /* A 1x1 card is ~260px inside its padding: ring + gap + this floor does not
     fit, so the list drops under the ring at full width rather than being
     clipped beside it. Wider cards still keep it beside the ring. */
  min-width: 150px;
  display: flex;
  flex-direction: column;
  gap: 7px;
}
/* Full width on its own line under both columns. */
.box.donut.legended .donut-cap { flex-basis: 100%; text-align: left; }

/* A donut carrying a scorecard. It is 1x2 rather than 1x1, so the arcs stay
   the centre of gravity and the metric rows sit under them instead of
   squeezing them: the arcs and caption stack from the top, and `margin-top:
   auto` drops the scorecard to the bottom edge, which is where the category
   box keeps its own metric rows.
   The reserved bottom padding is not cosmetic. Unlike every other archetype
   the donut has no footer toolbar — it keeps the absolutely positioned
   `.box-actions` corner instead (see the note above it), which is OUT of flow
   and would otherwise be painted straight over the last metric row. The
   padding is the space that corner occupies. */
.box.donut.scored { justify-content: flex-start; gap: 10px; padding: 22px 22px 46px; }
.box.donut.scored .donut-wrap { margin: 4px auto 0; }
.box.donut.scored .cat-metrics { align-self: stretch; margin-top: auto; }
/* Re-stated after .cat-metrics gains its own top margin further down the file:
   at equal specificity the later rule wins, and the scorecard must stay pinned
   to the bottom edge rather than sitting 12px under the arcs. */
/* The label side carries a colour dot here (the arcs have no legend of their
   own), so it is a row rather than the bare span the category box uses. */
.box.donut.scored .cat-metric .k { display: flex; align-items: center; gap: 6px; }
.box.donut.scored .cat-metric .dot { width: 7px; height: 7px; border-radius: 50%; flex: none; }
/* Open, the box is twice as tall and the panel below is what should absorb
   the extra height — `margin-top: auto` would instead strand the scorecard at
   the bottom edge with a dead gap under the arcs. The collapsed box has no
   panel, which is why it wants the opposite rule. */
.box.donut.scored.is-open .cat-metrics { margin-top: 0; }
.box.donut.scored.is-open { justify-content: flex-start; }

/* The pillar band — the three GTM pillar cards, one row of three columns,
   full width, whatever else is on the board.
   
   Left to the board's own four-column auto-flow they broke wherever the box
   before them ended, and three cards whose whole purpose is to be read ACROSS
   cannot be read across a line break. The band takes the full width and lays
   them out itself, so nothing above it can move them again. */
.pillar-band {
  grid-column: 1 / -1;
  /* No row span. It claimed `span 2` back when a category card was pinned to
     two 188px rows; the cards now size to their content, so reserving two rows
     left the band's leftover height as a gap BETWEEN the bands — the same dead
     space, moved from inside the card to under it. `auto` lets the band be as
     tall as its tallest card and no taller. */
  grid-row: auto;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--gap);
  min-width: 0;
}
/* The archetype claims `grid-row: span 2` for the BOARD's grid, where a row is
   188px. Inside the band one row IS the band, so the span has to go or each
   card would reach for a second implicit row the band has no height for. */
.pillar-band > .box.category { grid-row: auto; }

/* Expanding a card inside the band: it takes the band's full WIDTH rather than
   being squeezed into a third of it — a 1/3-width category box with a detail
   table in it is not a smaller version of anything — and drops onto a row of
   its own, leaving the collapsed cards beside it in place.

   Open a second card and the two STACK, a full-width row each. Only the column
   span is pinned; pinning the row as well (`grid-row: 1 / -1`, which this rule
   carried while one card could be open at a time) would land every open card
   in the same cell, painting them over each other. Implicit rows are what let
   the band hold as many as are open — and what keep the siblings, which this
   rule used to hide, on screen to be compared against. */
.pillar-band > .box.category.is-open { grid-column: 1 / -1; }

/* The band's own height follows its content once anything in it is open: with
   the open cards sized by what they hold rather than by a fixed `grid-row: span
   4`, one open card and three are both accommodated without a per-card count
   the CSS has no way to take. */
.pillar-band:has(> .box.is-open) { grid-row: auto; grid-auto-rows: auto; }

@media (max-width: 720px) {
  .pillar-band { grid-column: auto; grid-row: auto; grid-template-columns: minmax(0, 1fr); }
}

/* The journey strip — one pillar on one channel, across the funnel stages.

   Four columns, ALWAYS, on every layer it appears on. The band above sizes
   itself to what it holds; this one must not, because the empty slots are the
   content: a strip that narrowed to the stages it had data for would show the
   same shape on DG as on CO and quietly say the reader was somewhere else.
   Fixed columns are also what keeps a card the same width on all four layers,
   so the accumulation reads as slots filling rather than as cards resizing. */
.journey-strip {
  grid-column: 1 / -1;
  grid-row: auto;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--gap);
  min-width: 0;
}
/* Same reason as the band: the archetype's `grid-row: span 2` is a claim on the
   BOARD's 188px rows, and inside this wrapper one row is the strip. */
.journey-strip > .box.category { grid-row: auto; }
.journey-strip > .box.category.is-open { grid-column: 1 / -1; }
.journey-strip:has(> .box.is-open) { grid-row: auto; grid-auto-rows: auto; }

/* The stage caption, INSIDE the card. Every card in this strip is the same
   channel, the same pillar and the same colour, so unlike the vertical grid's
   column headers this is the only thing distinguishing them — it cannot live in
   a header strip that a narrow viewport is entitled to hide. */
.journey-stage {
  display: flex;
  align-items: baseline;
  gap: 7px;
  flex: none;
  margin-bottom: 10px;
  min-width: 0;
}
.journey-step {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: color-mix(in srgb, currentColor 10%, transparent);
  color: var(--ink-2, #6b7280);
  font: 600 10px/1 var(--mono, ui-monospace, monospace);
}
.journey-caption {
  font-weight: 650;
  font-size: 12px;
  letter-spacing: .01em;
  color: var(--ink, #16181d);
  white-space: nowrap;
}
/* The metric this stage reads, in the mono the board uses for every source and
   unit caption. It is what stops three different units in one row reading as
   one series. */
.journey-note {
  font: 400 11px/1 var(--mono, ui-monospace, monospace);
  color: var(--ink-2, #6b7280);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

/* The lens' two pickers — pillar, then channel — in the strip's own first row
   rather than in the section grid: .board sets grid-auto-rows to the 188px
   row, so a control placed there would sit in a band that tall. Full width,
   because the choice governs all four slots under it. Wrapping, because three
   pillar names and five channel labels run longer than three window chips.
   The chips themselves are .modes, unchanged — the same gesture as the window
   picker: one of a small set is current. Not a .box, so it takes no id. */
.journey-picks { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.journey-picks .modes { flex-wrap: wrap; }

/* An unfilled slot. Deliberately not a `.box` — it takes no KPI id and is not
   counted as one, because it is ground, not a figure.

   This base look IS `.missing`'s look — a stage that was reached and whose
   source answered, but held no card for the picked pillar. It used to be a
   near-unreachable case; with twenty pillar × channel combinations it is
   routine, so it is named here rather than left as an unstyled default. The
   two rules below are the deviations from it. */
.journey-empty {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: 4px;
  padding: 20px 22px;
  border: 1px dashed color-mix(in srgb, currentColor 14%, transparent);
  border-radius: var(--radius, 12px);
  min-height: 96px;
  min-width: 0;
}
/* A stage the reader has not descended to yet reads as quieter than one that
   was reached and had nothing — the first is a promise, the second is a gap. */
.journey-empty.ahead { opacity: .55; }
/* A stage this hub has no source for at all. Held at full strength, unlike
   `.ahead`: it is not waiting on the reader, it is waiting on being built, and
   dimming it would file a missing capability under "come back later". The
   dashes go solid for the same reason — the slot is not a placeholder for
   something arriving, it is a statement that nothing is wired. */
.journey-empty.unwired {
  border-style: solid;
  background: color-mix(in srgb, currentColor 3%, transparent);
}
.journey-why {
  font-size: 12px;
  color: var(--ink-2, #6b7280);
  min-width: 0;
}

/* One column, and the captions STAY — they are the only labels this strip has,
   and stacked cards need them more than side-by-side ones do. */
@media (max-width: 720px) {
  .journey-strip { grid-column: auto; grid-row: auto; grid-template-columns: minmax(0, 1fr); }
}

/* The vertical pillar grid — the band's transpose. Channels are the columns,
   pillars the rows, so one theme can be read DOWN across every channel in one
   pass instead of scanned across five stacked bands.

   One column per channel; --vgrid-cols is set by the builder because the
   channel count is whatever actually returned cards. Like the band it takes
   the full width and owns its own layout, so nothing on the board can reflow
   it.

   There is no row label column. Each card already prints its pillar name in
   its own header, so a leading column repeating it spent a full column of
   width restating what the five cards beside it had already said — and took
   that width from the cards, which are the thing being compared. */
.pillar-vgrid {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(var(--vgrid-cols, 5), minmax(0, 1fr));
  gap: var(--gap);
  min-width: 0;
  align-items: stretch;
}

/* The archetype's `grid-row: span 2` is for the BOARD's 188px rows; inside the
   grid a card sits in one row of its own, exactly as in the band. */
.pillar-vgrid > .box.category { grid-row: auto; }

/* Others: each card in its vertical's column — the same columns as the
   Pillars GTM grid above (--others-cols follows that grid's folds), stacked
   top-down per column. Not a bento: every card is one column wide. */
.section-grid.others-cols {
  grid-template-columns: repeat(var(--others-cols, 5), minmax(0, 1fr));
  grid-auto-rows: auto;
  align-items: start;
}
.section-grid.others-cols > .others-col { display: flex; flex-direction: column; gap: var(--gap); min-width: 0; }
.section-grid.others-cols > .others-col > .box { grid-column: auto !important; grid-row: auto !important; }
.section-grid.others-cols > .col-collapsed { display: none; }
@media (max-width: 900px) {
  .section-grid.others-cols { grid-template-columns: minmax(0, 1fr); }
}

/* The status pill drops below the pillar name. A card head is one flex row —
   dot, name, pill — which fits fine at a band's third-of-the-board width but
   not at a fifth: 170px of content in a 124px header, so the name and the pill
   fought each other for a line neither could have.

   Wrapping is what fixes it. */
.pillar-vgrid > .box.category .cat-head {
  flex-wrap: wrap;
  align-items: baseline;
  row-gap: 4px;
}
/* The pill takes a full line of its own, which pushes it below the dot+name
   pair without breaking that pair apart — `flex: 1 0 100%` on the NAME would
   wrap the name instead and orphan the dot on the line above it. */
.pillar-vgrid > .box.category .cat-head > .cat-name { min-width: 0; }

/* The wrap is forced by a full-width break BEFORE the pill rather than by
   sizing the pill itself: a `flex-basis: 100%` wins the pill its own line but
   also stretches its background across the card, and neither `width:
   fit-content` nor an auto margin beats that basis. The ::before is a
   zero-height full-width item — it fills the first line, pushing the pill to
   the second, where the pill keeps its natural width. */
.pillar-vgrid > .box.category .cat-head > .pill { order: 2; }
.pillar-vgrid > .box.category .cat-head::before {
  content: '';
  flex: 0 0 100%;
  height: 0;
  order: 1;
}

/* Channel headers. They stay where the row labels went because nothing on a
   card names its channel — the source badge is an icon, not a label. Labels,
   not boxes: no card chrome, so the eye reads the grid's contents as the data
   and its edges as the frame.

   Each is also its channel's accordion toggle — five channels' worth of cards
   is more KPI than a reader holds at once, and the comparison usually wanted
   is two or three channels wide. */
.pillar-vgrid .vgrid-head {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
}

/* The header strip is ONE full-width grid item holding all five toggles, not
   five grid cells. Five cells only line up with the cards while nothing is
   folded; fold three and the grid is two columns wide, so the extra three
   headers would each open an IMPLICIT column and the cards would place
   themselves across those stray tracks at whatever width was left — a 44px
   card beside a 319px one. One spanning item contributes no column tracks, so
   the cards keep the template they were given.

   A folded channel keeps its toggle, which is the only way back. */
.pillar-vgrid > .vgrid-heads {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(var(--vgrid-heads, 5), minmax(0, 1fr));
  gap: var(--gap);
  min-width: 0;
  padding-bottom: 2px;
}
/* Folded, the strip stops mirroring the card columns — the toggles are a set
   of switches then, not headings over anything — so they close up to their
   natural widths at the left. */
.pillar-vgrid.has-collapsed > .vgrid-heads {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 10px;
}

/* The count of what is out of view, and the way back to all of it. It sits at
   the end of the strip and only exists while something is folded — a grid
   showing two channels of five otherwise looks like a grid that only ever had
   two. */
.vgrid-fold-note {
  margin-left: auto;
  appearance: none;
  background: none;
  border: 0;
  padding: 2px 8px;
  border-radius: 999px;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--muted-2, #9aa1ab);
  cursor: pointer;
  transition: background-color .12s ease, color .12s ease;
}
.vgrid-fold-note:hover { color: var(--ink); background: color-mix(in srgb, currentColor 10%, transparent); }
.vgrid-fold-note:focus-visible { outline: 2px solid var(--accent, #c8102e); outline-offset: 2px; }

/* The toggle itself: a label that happens to be pressable. No button chrome —
   the header's job is still to name the column, and a row of five buttons
   across the top would read as a toolbar rather than as headings. The chevron
   carries the affordance instead. */
.vgrid-head-name {
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .02em;
  color: var(--ink-2, #6b7280);
  overflow-wrap: anywhere;
  appearance: none;
  background: none;
  border: 0;
  padding: 2px 7px;
  border-radius: 999px;
  cursor: pointer;
  font-family: inherit;
  transition: background-color .12s ease, color .12s ease;
}
.vgrid-head-name:hover { background: color-mix(in srgb, currentColor 10%, transparent); }
.vgrid-head-name:hover { color: var(--ink); }
.vgrid-head-name:focus-visible { outline: 2px solid var(--accent, #c8102e); outline-offset: 2px; }

/* The same ▾ the board's sections use, rotating the same -90deg when shut, so
   the gesture is learned once and works in both places. It is what tells a
   reader the column folds BEFORE they have folded one — a bare word gave no
   sign it was pressable at all. */
.vgrid-chev {
  display: inline-block;
  color: var(--muted);
  font-size: 10px;
  transition: transform .15s ease;
}
.vgrid-head-name[aria-expanded="false"] .vgrid-chev { transform: rotate(-90deg); }

/* A folded channel stays legible but plainly off. Dimmed rather than struck
   through: a line through a channel name reads as "removed", and this one is
   a click away from coming back. */
.vgrid-head-name[aria-expanded="false"] { color: var(--muted-2, #9aa1ab); }
.vgrid-head-name[aria-expanded="false"] .vgrid-label { opacity: .75; }

/* The cells of a folded column. `display: none` rather than a width of 0 so
   they cost no layout at all, and so the grid's auto-placement flows the
   remaining cells into the narrower template. The toggles live in the header
   strip and are never hidden — they are the way back. */
.pillar-vgrid > .col-collapsed { display: none; }
.pillar-vgrid > .row-off { display: none; }
.pillar-vgrid > .vgrid-picks { margin-bottom: 4px; }

/* A channel that never classified this pillar. Stated rather than left blank:
   an empty cell reads as a rendering bug, a dash reads as "no reach here". */
.pillar-vgrid > .vgrid-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px dashed color-mix(in srgb, currentColor 14%, transparent);
  border-radius: var(--radius, 12px);
  color: var(--ink-2, #6b7280);
  font-size: 13px;
  min-height: 64px;
}

/* Expanding a card takes the grid's full WIDTH — a detail table at one-fifth
   width is not a smaller version of anything — and lands on a row of its own,
   in place, so the cards around it keep their columns and stay on screen.

   The collapsed siblings USED TO BE HIDDEN here, back when one card could be
   open at a time: you opened a card, the other thirteen vanished, you read it,
   you closed it and they came back, and the cost was invisible because there
   was never a second card to miss. It stops being invisible the moment two can
   be open — the whole reason to open BA-16 beside BA-18 is to see both, and
   hiding the siblings is precisely what takes BA-18 away. So they stay.

   `grid-column: 1 / -1` alone is enough: the card breaks out to full width on
   its own implicit row, and the grid's auto-placement flows the remaining
   cells around it. Several open cards each get such a row. */
.pillar-vgrid:has(> .box.is-open) > .box.category.is-open { grid-column: 1 / -1; }
.pillar-vgrid:has(> .box.is-open) { grid-auto-rows: auto; }

/* Narrow: the transpose stops paying for itself once the columns are too thin
   to compare, so it degrades to one card per line. The channel headers go with
   it — stacked, each would sit above a single card and head nothing, and the
   card's own source badge already says which channel it is. */
@media (max-width: 900px) {
  .pillar-vgrid { grid-column: auto; grid-template-columns: minmax(0, 1fr); }
  .pillar-vgrid > .vgrid-heads { display: none; }
}

/* ------------------------------------------------------- sectioned board */
/* A layer with sections (cockpit BA and CO) stacks them down the page; each
   section's body is itself a .board grid, so every archetype's span, the
   pillar band, and the is-open growth all work unchanged inside one. Only
   the first section is open on load — the rest sit collapsed behind their
   headers until asked for, so a page load is one question answered rather
   than every metric at once. The outer #board keeps the .board class (the
   is-loading state and the flat DG/LEAD layers still use it); .sectioned
   switches it from grid to a plain column of sections. */
.board.sectioned { display: flex; flex-direction: column; gap: 8px; }
.board-section { min-width: 0; display: flex; flex-direction: column; gap: 12px; }
.section-head {
  display: flex; align-items: baseline; gap: 10px;
  width: 100%; padding: 12px 2px 2px;
  background: none; border: 0; border-top: 1px solid var(--edge);
  font-family: var(--mono); font-size: 11.5px; font-weight: 600;
  letter-spacing: .14em; text-transform: uppercase; color: var(--ink-2);
  text-align: left; cursor: pointer;
}
.board-section:first-child .section-head { border-top: 0; padding-top: 0; }
.section-head:hover { color: var(--ink); }
.section-chev {
  display: inline-block; color: var(--muted);
  transition: transform .15s ease;
}
.board-section.closed .section-chev { transform: rotate(-90deg); }
.section-count { margin-left: auto; color: var(--muted-2); font-weight: 400; letter-spacing: .08em; }

/* The Hidden section — admin-only, so its header reads as "back office"
   against the reader-facing sections above it rather than as one more topic
   to open. Dashed rule, amber title, same ink the hide button itself takes
   once a card is hidden. */
.board-section-admin > .section-head {
  border-top-style: dashed; border-top-color: var(--watch);
  color: var(--watch);
}
.board-section-admin > .section-head:hover { color: #96701f; }
.board-section-admin > .section-head .section-chev { color: var(--watch); }

/* D · Category — three of equal weight, identical structure and field order,
   so differences read across. Only the accent bar and dot are tinted. */
.box.category { grid-row: span 2; padding-top: 20px; position: relative; justify-content: space-between; }
/* A glance box scoped to one pillar wears the same 4px accent bar as the
   category box, so a pillar keeps its configured colour at every size. */
.box.glance.accented { position: relative; }
.box.glance.accented::before { content: ""; position: absolute; inset: 0 0 auto; height: 4px; background: var(--accent-cat); }
.box.category::before { content: ""; position: absolute; inset: 0 0 auto; height: 4px; background: var(--accent-cat); }
.cat-head { display: flex; align-items: center; gap: 9px; min-height: 34px; }
/* No colour dot on a category card, in either layout. The card already runs
   its accent bar across the top in that exact colour, so the dot restated the
   card's own edge — and it was restating it in the scarcest space on the card,
   the header line the name and the status pill were already competing for.
   Gone, the name starts at the card's left margin.

   The dot is kept everywhere else it appears (the scored donut's legend, the
   breakdown rows), where it is the ONLY thing carrying the colour. */
.box.category > div > .cat-head > .dot { display: none; }
.cat-name { font-size: 13.5px; font-weight: 700; letter-spacing: -.01em; }
.cat-src  { display: flex; align-items: center; gap: 9px; margin-top: 14px; }
.cat-figure { display: flex; align-items: flex-end; gap: 9px; margin-top: 5px; }
/* The metric rows sit clear of the chart above them. They carried no top
   margin, so a row landed flush under the plot (or under the end labels that
   follow it) and read as part of the chart's furniture rather than as the
   card's second statement. One gap, set here, so the band and the vertical
   grid space it identically — every category card is built by the same
   function, and the separation should not depend on which layout it lands in.

   The donut overrides it: its scorecard is pushed to the bottom edge by
   `margin-top: auto`, which this would fight. */
.cat-metrics { display: flex; flex-direction: column; gap: 9px; margin-top: 12px; }
.box.donut.scored .cat-metrics { margin-top: auto; }
.box.donut.scored.is-open .cat-metrics { margin-top: 0; }
.cat-metric { display: flex; align-items: center; justify-content: space-between; gap: 10px; border-top: 1px solid var(--hairline); padding-top: 9px; }
.cat-metric .k { font-size: 11.5px; color: var(--ink-3); }
.cat-metric .v { display: flex; align-items: baseline; gap: 7px; }

/* E · Trend — one metric across all three categories on a shared axis. Tall,
   no gridlines, legend stacked below. */
.box.trend { grid-row: span 2; padding: 22px 22px 18px; }
.trend-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; flex-wrap: wrap; }
.trend-head .trend-title { flex: 1 1 auto; min-width: 0; }
.trend-head .kicker { flex: none; }
.trend-title { font-size: 14px; font-weight: 600; }
.box.trend .plot { flex: 1 1 auto; min-height: 80px; height: 100%; }
.trend-legend { display: flex; flex-direction: column; gap: 7px; padding-top: 10px; }
.legend-line { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--ink-3); }
.legend-line i { width: 16px; height: 3px; border-radius: 2px; flex: none; }
/* Ellipsis on the label, not the range or total: a long pillar name gives up
   space before either number does — the numbers are the part worth reading
   at a glance. */
.legend-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.legend-range {
  flex: none; font-family: var(--mono); font-size: 9.5px;
  font-variant-numeric: tabular-nums; color: var(--muted); white-space: nowrap;
}
.legend-line b { margin-left: auto; flex: none; font-variant-numeric: tabular-nums; color: var(--ink); }

/* G · Multi-metric — two to four related metrics as toggleable series. A
   selected row is filled in its series colour; the last one cannot be
   turned off. */
.box.stack { grid-row: span 2; gap: 8px; padding: 22px 22px 18px; }
.box.stack .plot { flex: 1 1 auto; min-height: 70px; height: 100%; }
.stack-rows {
  display: flex; flex-direction: column; gap: 5px;
  flex: none; max-height: 62%; overflow: auto; scrollbar-width: thin;
}
/* Expanded there is room for every row at natural height, so the cap lifts.
   Deliberately NOT made shrink-and-scroll like the panel above, though it has
   the same shape: `flex: none` here is load-bearing. The plot next to these
   rows is the flexible child, so making the rows flexible too hands the space
   to the plot and hides rows behind a scrollbar in a box that had room for
   them — the failure the paragraph above this one records. A series list long
   enough to outgrow an OPEN 2×4 would still clip, and that is accepted: these
   boxes carry two to six series by construction, not thirty. */
.box.stack.is-open .stack-rows, .box.multi.is-open .multi-rows { max-height: none; overflow: visible; }
.stack-row { display: flex; align-items: center; gap: 8px; font-size: 11.5px; padding: 2px 0; }
.stack-row .tick { width: 9px; height: 9px; border-radius: 2px; flex: none; }
.stack-row .k { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-2); }
.stack-row .v { font-family: var(--mono); font-size: 11px; font-variant-numeric: tabular-nums; color: var(--ink); }
.stack-row .share { font-family: var(--mono); font-size: 9.5px; color: var(--muted-2); min-width: 30px; text-align: right; }
.box.stack.is-open { grid-column: span 2; grid-row: span 4; }

/* Two columns wide at rest. One column is 302px at the board's max width,
   and a legend row there is tick + label + value + delta on one line — the
   label is the only flexible part, so it was the part that got ellipsed
   ("LinkedIn post vi…"). Naming a series is the whole job of that row, so
   the box takes the width instead of the label giving it up. */
.box.multi { grid-column: span 2; grid-row: span 2; gap: 8px; }
/* `flex: none`, so the rows take the height they need and the PLOT gives up
   the difference — it has a min-height and will stop shrinking there.
   Making the rows the flexible part instead is what hid three of five
   categories behind a scrollbar: the box stopped overflowing, but only
   because the content had been concealed rather than fitted. The max-height
   is the real safety valve, and it only engages past about six series. */
.multi-rows {
  display: flex; flex-direction: column; gap: 5px;
  flex: none; max-height: 62%; overflow: auto; scrollbar-width: thin;
}
.multi-row {
  display: flex; align-items: center; gap: 8px; width: 100%;
  padding: 5px 9px; border: 1px solid var(--edge); border-radius: 9px;
  background: #fff; color: var(--ink); cursor: pointer; text-align: left;
  font: inherit; font-size: 11.5px;
}
.multi-row .tick { width: 12px; height: 12px; border-radius: 3px; border: 1.5px solid var(--muted-2); flex: none; }
.multi-row .k { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.multi-row .v { font-weight: 700; font-variant-numeric: tabular-nums; }
.multi-row[aria-pressed="true"] { color: #fff; border-color: transparent; background: var(--series); }
.multi-row[aria-pressed="true"] .tick { border-color: #fff; background: #fff; }
.multi-row[aria-pressed="true"] .delta { color: rgba(255,255,255,.82); }
.multi-row:disabled { cursor: default; }
.box.multi .plot { flex: 1 1 auto; min-height: 58px; height: 100%; }
/* The hint under these two is UI copy, not data: at the narrowest four-column
   width ("Click a category to drop it from the axis.") wraps to two lines and
   pushes the box past its row. One line, clipped — the sentence still reads,
   and a wrapped hint is not worth a broken grid. */
.box.multi .note, .box.stack .note {
  flex: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* F · Glance — never a bare scorecard: every glance box carries its trailing
   series collapsed. Click expands in place to 2×2. */
.box.glance { gap: 8px; justify-content: space-between; }
.glance-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.glance-head .l { display: flex; align-items: flex-start; gap: 9px; min-width: 0; }
/* Two lines is the budget a 188px row leaves for a label. A third pushed the
   axis caption out of the box, so a label that long is clamped and keeps its
   full text in the tooltip. */
.glance-head .kicker {
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}
.glance-head .r { display: flex; align-items: center; gap: 8px; flex: none; height: 24px; }
/* A glance box given a bold `name` reuses the category box's own anatomy —
   .cat-name in the head, then a .cat-src badge + kicker row — so the two
   forms are one system with no parallel classes. Only the spacing differs:
   a 188px row has neither the tall form's 14px gap nor a second kicker
   line's height, so the metric clamps to one line and keeps its full text
   in the tooltip. */
.glance-head .cat-name {
  align-self: center; min-width: 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.box.glance .cat-src { margin-top: 2px; }
.box.glance .cat-src .kicker {
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.glance-figure { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; }
/* The one opt-in second figure a glance box can carry — CO-13's avg % viewed
   beside its views. Small and muted on purpose: the PRIMARY value above it is
   still the number the box is named for. */
.glance-secondary { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.glance-secondary .k {
  font-family: var(--mono); font-size: 9.5px; letter-spacing: .06em;
  text-transform: uppercase; color: var(--muted);
}
.glance-secondary .v {
  font-family: var(--mono); font-size: 12px; font-weight: 700; color: var(--ink-2);
  font-variant-numeric: tabular-nums;
}
.glance-secondary .delta { font-size: 11px; }
/* Collapsed, the detail holder is a flex child with no content — under
   space-between that is enough to open a gap where the chart used to sit
   flush against the rows. */
.glance-detail, .glance-detail:empty { display: none; }
/* A card that carries its table on the collapsed face — the breakdown is the
   point of the box, not a reward for clicking. */
.box.shows-detail > .glance-detail { display: block; }

/* I · Composition — 2×1, the primary's width and half its height. A total and
   the parts it is made of, as a single 100% bar.
   Two columns rather than one: a 100% bar's legibility IS its length, and at a
   quarter of the board a three-percent part is nine pixels of colour. Two is
   where that stops being true — the bar clears 550px, which is as much as the
   eye uses. Four was the first shape this took, and the extra width bought
   nothing the bar had a use for while leaving the card stranded alone across a
   whole band. */
.box.composition { grid-column: span 2; padding: 24px 26px 18px; gap: 12px; justify-content: flex-start; }
/* Stacked, in the order the card is read: the figure, then the bar it is
   divided into, then the same division stated for each window. Side by side
   these three fit a full-width strip and nothing narrower — at 2×1 the bar
   would be giving up half its length to a column of two short rows. */
.comp-body { display: flex; flex-direction: column; gap: 13px; }
/* The delta beside the figure on one line, the way .primary-figure carries
   its own — under the hero it read as a third row of the stack rather than as
   part of the number it qualifies. */
.comp-figure { display: flex; align-items: flex-end; gap: 16px; }
.comp-hero { display: flex; align-items: baseline; gap: 9px; }
.comp-unit {
  font-family: var(--mono); font-size: 10px; letter-spacing: .06em;
  text-transform: uppercase; color: var(--muted);
}
.comp-split { min-width: 0; display: flex; flex-direction: column; gap: 9px; }
/* A fixed 26px band with rounded ends, the segments butted together with a
   2px hairline of board colour between them — a gap, not a border, so the
   parts read as one quantity divided rather than as separate bars. */
.comp-bar { display: flex; height: 26px; border-radius: 6px; overflow: hidden; gap: 2px; background: var(--hairline); }
.comp-seg { display: block; min-width: 3px; }
/* The parts named at the ENDS of the bar they describe: first key left,
   last key right, any middle one spread between. With two parts — the shape
   this was built for — that puts each label under its own end of the bar. */
.comp-legend { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 16px; }
.comp-key { display: inline-flex; align-items: center; gap: 7px; min-width: 0; }
.comp-key .k { font-size: 11.5px; color: var(--ink-3); white-space: nowrap; }
.comp-key .v {
  font-family: var(--mono); font-size: 12px; font-weight: 700;
  font-variant-numeric: tabular-nums; color: var(--ink);
}
.comp-rows { display: flex; flex-direction: column; gap: 6px; }
.comp-row {
  display: flex; align-items: baseline; justify-content: space-between; gap: 14px;
  border-top: 1px solid var(--hairline); padding-top: 7px;
}
.comp-row .k { font-size: 11.5px; color: var(--ink-3); }
.comp-row .v {
  font-family: var(--mono); font-size: 13px; font-weight: 700;
  font-variant-numeric: tabular-nums; color: var(--ink);
}
/* Grows DOWN only, the same exemption .box.primary.tall-only takes: what ⤢
   opens is a channel-group table four narrow columns wide, which gains nothing
   from spanning the board and would push both neighbours off their row for as
   long as it is open. */
.box.composition.is-open { grid-column: span 2; grid-row: span 2; }

/* --------------------------------------------------------- 04 · interaction */
/* DEFAULT — the resting board: every box shows its figure and its trailing
   series, no panel open. CLICK — a glance box grows to 2×2 in place, and any
   number of boxes may be open at once, so two breakdowns can be compared side
   by side rather than from memory; Escape closes them all. ✦ — an in-box panel
   scoped to that box, and THOSE stay one at a time. */

/* Every archetype expands, and expansion DOUBLES the box in both axes — not
   a flat 2×2, which would leave a 1×2 box the same height it started at and
   give a taller chart nowhere to go. So each span doubles from its own
   natural footprint. */
.box.is-open { box-shadow: 0 12px 30px rgba(22, 24, 29, .10); }
.box.glance.is-open,
.box.donut.is-open    { grid-column: span 2; grid-row: span 2; }   /* 1×1 → 2×2 */
.box.rail.is-open,
.box.category.is-open,
.box.donut.scored.is-open,
.box.trend.is-open    { grid-column: span 2; grid-row: span 4; }   /* 1×2 → 2×4 */
/* multi rests at 2×2, so it doubles like the primary does. Left in the 2×4
   group it would open with no change in width at all — only a taller chart. */
.box.multi.is-open,
.box.primary.is-open  { grid-column: span 4; grid-row: span 4; }   /* 2×2 → 4×4 */
/* .tall-only — grow DOWN, not sideways. A box whose expanded content is a
   narrow table gains nothing from the extra width: doubling both axes made
   CO-1 span the whole board to hold four rows of page names, and pushed the
   two boxes beside it onto their own row for as long as it was open. Keeping
   its column span means the layout around it does not move at all. */
.box.primary.is-open.tall-only { grid-column: span 2; }
/* .shallow — a box whose drill is a handful of short rows rather than a long
   list or a chart. The doubling above is right for a table that needs the
   room and wrong for one that does not: CO-2's page table is four rows, and
   at span 4 the box opened to 800px to hold ~230px of content, leaving a
   void of empty ground under the last row. Half the height, same width. */
.box.rail.is-open.shallow { grid-row: span 2; }

/* Collapsed, a glance box pushes its captions to the bottom. Expanded, that
   same rule strands the extra height as a void between the chart and the
   breakdown — which is what made the detail hard to read. The detail takes
   the slack instead. */
.box.is-open { justify-content: flex-start; }
/* `overflow: auto` is the panel's safety net, and it is not decoration.
   .detail-rows scrolls itself, so a drill that IS one list has always fitted.
   But several drills are a COMPOSITE — two headed tables, or a table and a
   note (the YouTube drill's pillars + playlists, pivotDetail's three pivots,
   earnedSourceRows' table + caveat). That wrapper is a plain flex item with
   min-height:auto, so it refuses to shrink below its content, the content
   spilled past the panel, and .box's own `overflow: hidden` cut it off — rows
   painted over the toolbar and the rest of the table simply gone, with no
   scrollbar to say there was more. Making the PANEL the scroll container fixes
   every composite at once, including the ones not written yet: a drill that
   fits still shows no scrollbar, and one that does not becomes reachable
   instead of invisible. */
.box.is-open .glance-detail {
  display: flex; flex-direction: column; gap: 10px;
  flex: 1; min-height: 0; overflow: auto; scrollbar-width: thin;
}
.box.glance.is-open .value.glance { font-size: 40px; }
.box.donut.is-open { justify-content: center; }
/* The donut keeps its panel at natural height (that is what centres the box on
   its arcs), but `flex: none` also meant it could never give ground: a long
   channel list grew past the box and was clipped rather than scrolled. `0 1
   auto` leaves the natural height untouched wherever it fits and lets the
   shared `overflow: auto` above take over only where it does not. */
.box.donut.is-open .glance-detail { align-self: stretch; flex: 0 1 auto; }

/* A glance box whose drill is a COMPOSITE — more than one table, so the 2×2's
   four rows of panel were never going to hold it. Opt-in, per box, because the
   depth belongs to what a box has to show rather than to its archetype: a
   one-list drill in a 2×4 is a table with a void under it. It breaks the
   doubling rule above knowingly, and is the only exception to it. */
.box.glance.deep.is-open { grid-row: span 4; }

@media (max-width: 1180px) {
  /* Two columns: a doubled box would be the whole board, so cap the width. */
  .box.primary.is-open, .box.multi.is-open { grid-column: span 2; }
  /* At rest too — a two-column cell is already ~550px, wider than the
     four-column cell the span was bought for, so the legend fits at 1×2 and
     the multi does not need to take the entire board. This has to sit in
     THIS block rather than the grid one at the top of the file: the .box.multi
     rule is declared further down, and at equal specificity the later
     declaration wins regardless of which media query it is in. */
  .box.multi { grid-column: span 1; }
}
@media (max-width: 720px) {
  .box.is-open { grid-column: auto !important; grid-row: auto !important; }
}

/* The ⛶ dialog — one <dialog>, reused by every box's table-btn (see
   bento.js). It renders the same detail() a box's own expand does, but full
   viewport height rather than the box's own grid span, for the case an
   expanded table is not fully readable in place: long breakdowns, or a
   composite of more than one table. Unstyled <dialog> carries a browser
   border/padding/background; all of it is reset here so the dialog reads as
   part of this system rather than a native control dropped on top of it. */
.table-dialog {
  width: min(720px, 92vw); max-height: 82vh; padding: 0; border: 0; border-radius: 14px;
  box-shadow: 0 24px 60px rgba(22, 24, 29, .25); background: var(--box); color: var(--ink);
}
.table-dialog::backdrop { background: rgba(22, 24, 29, .45); }
.table-dialog-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 16px; border-bottom: 1px solid var(--hairline); flex: none;
}
.table-dialog-title { margin: 0; font-size: 13px; font-weight: 700; }
.table-dialog-close {
  width: 23px; height: 23px; flex: none; border: 0; border-radius: var(--radius-sm);
  background: none; color: var(--muted); font-size: 18px; line-height: 1; cursor: pointer; padding: 0;
}
.table-dialog-close:hover { background: var(--hairline); color: var(--ink-2); }
.table-dialog-body { padding: 4px 16px 16px; overflow: auto; max-height: calc(82vh - 53px); }
/* Reused as-is from the box's own expand — .detail-rows normally scrolls
   inside a flex column sized by the box; here the dialog body is that scroll
   container instead, so the list itself should just grow. */
.table-dialog-body .detail-rows { overflow: visible; flex: none; }

/* One row per category: dot, label, value, delta. The list scrolls in place
   rather than truncating, so a box with thirty campaigns still shows all
   thirty inside the four-row window the 2×2 leaves for it. */
.detail-rows { display: flex; flex-direction: column; overflow: auto; flex: 1; min-height: 0; scrollbar-width: thin; }
.detail-row {
  display: flex; align-items: center; gap: 9px;
  border-top: 1px solid var(--hairline); padding: 7px 0; font-size: 11.5px;
}
.detail-row:first-child { border-top: 0; }
.detail-row .k { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.detail-row .k .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink); }
.detail-row .k .sub {
  font-family: var(--mono); font-size: 9px; letter-spacing: .04em; color: var(--muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.detail-row .v { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.detail-row .v2, .detail-row .v3 {
  min-width: 44px; text-align: right; font-variant-numeric: tabular-nums;
  white-space: nowrap; color: var(--ink-3);
}
/* The optional header row breakdownRows() renders above the list — same grid
   as a data row (dot column hidden, not removed, so the label/value columns
   still line up), styled as a caption rather than a figure. */
.detail-header {
  font-family: var(--mono); font-size: 9px; letter-spacing: .06em;
  text-transform: uppercase; color: var(--muted); padding-bottom: 5px;
}
.detail-header .name { color: var(--muted); }
.detail-header .v, .detail-header .v2, .detail-header .v3 { font-weight: 600; color: var(--muted); }

/* Every box is a click target now, so the pointer cursor moves to .box and
   the archetype rules stop repeating it. */
.box { cursor: pointer; }
.box.multi .multi-row { cursor: pointer; }

/* The ✦ panel replaces the breakdown, not the chart — but a fact list is
   taller than the row of figures it stands in for, so the chart compresses
   to make the difference rather than the box overflowing. */
/* A fixed height, not `auto`: these plots carry a viewBox, so `height: auto`
   sizes them from that aspect ratio — on the trend box's 300×240 box that is
   taller than the chart it replaced, which is the opposite of the point. A
   pinned 60px leaves the line readable and hands the rest to the panel. */
.box.has-panel .plot { height: 60px !important; min-height: 60px !important; flex: 0 0 60px; }
/* The primary spends its height on a 72px figure, so it is the one box where
   the chart gives up the last 16px to keep the fact list unscrolled. */
.box.primary.has-panel .plot { height: 44px !important; min-height: 44px !important; flex: 0 0 44px; }
.box.has-panel .ai-panel { flex: 1 1 auto; min-height: 0; }
.ai-facts { scrollbar-width: thin; }
.box.has-panel .axis-caps { display: none; }

/* QUARTER and SEMESTER: the figure, its delta and the window label — no chart.
   Every time-series chart on this board is a year-over-year pair (yearPair,
   ymPair, and the "last year behind" ground under them), which is not the
   comparison a quarter or a semester makes. Removing the chart is
   honest; redrawing it on a window it does not describe is not, and three
   monthly points is not a shape anyone can read anyway.

   Done here rather than in the build functions on purpose. Passing an empty
   series would not remove a chart — sparkPlot([]) draws a dashed "no trailing
   series" line, which reads as a card that failed to load — and the ternary it
   would take at every archetype call site lives inside the build functions,
   where a dropped push renumbers every id after it. A box hidden by CSS keeps
   the id showLayer() stamped on it.

   The axis captions go with the chart, which is what retires every "monthly ·
   this year over last" and "last year behind" string in this mode without a
   branch anywhere in JS. Donuts stay: a share of the picked window still means
   what it says. */
.board.no-charts .plot,
.board.no-charts .plot-wrap,
.board.no-charts .plot-ends,
.board.no-charts .axis-caps { display: none; }

/* With no chart, the archetypes that claimed two 188px rows hold a figure, a
   split row and a toolbar, which fit in one. Required rather than cosmetic:
   `grid-auto-rows: minmax(var(--row), auto)` means a `span 2` box still claims
   392px whatever it holds, and both archetypes are `justify-content:
   space-between` — so without this you get a figure pinned to the top, a
   toolbar pinned to the bottom, and a lake of white between them.

   Only the ROW claim is dropped — whatever width the layout context gives a
   box is left alone, which matters for .box.multi, where the legend becomes
   the card once the chart is gone and those rows want the room. It gives up
   its second row like the rest, or the table sits in the top third of a 392px
   box. .box.donut is untouched: it keeps its graphic, so it keeps its space.
   .is-open too, since a reader has deliberately asked for that. */
.board.no-charts .box.primary,
.board.no-charts .box.category,
.board.no-charts .box.rail,
.board.no-charts .box.trend,
.board.no-charts .box.stack,
.board.no-charts .box.multi:not(.is-open) { grid-row: span 1; }

/* The ✦ panel replaces the breakdown, not the chart. */
.ai-panel { border-top: 1px solid var(--hairline); padding-top: 10px; display: flex; flex-direction: column; gap: 6px; }
.ai-panel h4 { margin: 0; font-size: 12px; font-weight: 700; }
.ai-facts { display: flex; flex-direction: column; gap: 4px; overflow: auto; min-height: 0; }
.ai-fact { display: flex; gap: 10px; justify-content: space-between; font-size: 11px; color: var(--ink-3); }
.ai-fact .k { font-family: var(--mono); font-size: 9.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted-2); flex: none; }
.ai-fact .v { text-align: right; overflow-wrap: anywhere; color: var(--ink); }
.ai-caveat {
  flex: none; font-size: 10.5px; line-height: 1.4; color: var(--watch);
  background: var(--watch-bg); border-radius: 7px; padding: 6px 8px;
  overflow-wrap: anywhere;
}
.ai-scope { font-family: var(--mono); font-size: 8.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--faint); }
/* The ℹ panel's one business sentence — set apart from the mechanics below
   it, because it is the line a reader who never reads mechanics takes away. */
.info-biz { font-size: 11.5px; font-weight: 600; color: var(--ink-2); line-height: 1.4; }
.rail .info-biz, .dark .info-biz { color: rgba(255,255,255,.8); }

/* --------------------------------------------------------------- raw rows */
/* The ▤ panel. Same seam as .ai-panel — it replaces the breakdown and lets the
   chart stay — but where that one carries six facts, this carries every row
   behind them, so the table scrolls in both axes inside the box rather than
   stretching it. */

.raw-panel { border-top: 1px solid var(--hairline); padding-top: 10px; display: flex; flex-direction: column; gap: 8px; min-height: 0; }
.box.has-panel .raw-panel { flex: 1 1 auto; }
.raw-head { display: flex; align-items: center; gap: 8px; flex: none; }
.raw-head h4 { margin: 0; font-size: 12px; font-weight: 700; }
.raw-count { font-family: var(--mono); font-size: 9px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted-2); }
.raw-dl {
  margin-left: auto; flex: none;
  font-family: var(--mono); font-size: 9.5px; letter-spacing: .06em;
  padding: 4px 9px; border-radius: 999px;
  border: 1px solid var(--edge); background: #fbfbf9; color: var(--ink-2);
}
.raw-dl:hover { background: var(--ink); border-color: var(--ink); color: #fff; }

.raw-scroll { overflow: auto; min-height: 0; flex: 1 1 auto; scrollbar-width: thin; }
.raw-table { border-collapse: collapse; width: 100%; font-size: 11px; }
.raw-table th, .raw-table td {
  text-align: left; padding: 4px 8px 4px 0; white-space: nowrap;
  border-bottom: 1px solid var(--hairline);
}
.raw-table th {
  position: sticky; top: 0; z-index: 1; background: var(--box);
  font-family: var(--mono); font-size: 9px; letter-spacing: .07em; text-transform: uppercase;
  color: var(--muted-2); font-weight: 600; cursor: pointer; user-select: none;
}
.raw-table th:hover { color: var(--ink-2); }
.raw-table th.sorted { color: var(--ink); }
.raw-table th.sorted::after { content: ""; }
.raw-table th.num, .raw-table td.num { text-align: right; font-family: var(--mono); font-variant-numeric: tabular-nums; }
.raw-table td { color: var(--ink-2); }
/* The title column is the one that can be arbitrarily long; it gets whatever
   width is left and truncates, with the full text on hover. */
.raw-table td:not(.num) { max-width: 340px; overflow: hidden; text-overflow: ellipsis; }
.raw-table tr:hover td { background: #fbfbf9; }
.raw-note { font-family: var(--mono); font-size: 8.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--faint); flex: none; }

/* A dark box (the rail archetype, or any other archetype wearing the .dark
   modifier) inverts everything the table assumes. */
.box.rail .raw-table th, .box.dark .raw-table th { background: var(--rail); color: rgba(255,255,255,.5); }
.box.rail .raw-table td, .box.dark .raw-table td { color: rgba(255,255,255,.82); }
.box.rail .raw-table th, .box.rail .raw-table td,
.box.dark .raw-table th, .box.dark .raw-table td { border-bottom-color: rgba(255,255,255,.10); }
.box.rail .raw-table tr:hover td, .box.dark .raw-table tr:hover td { background: rgba(255,255,255,.05); }
.box.rail .raw-panel, .box.dark .raw-panel { border-top-color: rgba(255,255,255,.12); }
.box.rail .raw-dl, .box.dark .raw-dl { background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.18); color: #fff; }
.box.rail .raw-dl:hover, .box.dark .raw-dl:hover { background: #fff; color: var(--ink); }
/* On a dark box, the button's open state has to invert too — the default
   fills it with the ink colour, which is the box's own surface here. */
.rail .spark-btn, .rail .zoom-btn, .rail .info-btn, .rail .table-btn,
.dark .spark-btn, .dark .zoom-btn, .dark .info-btn, .dark .table-btn { background: rgba(255,255,255,.06); border-color: rgba(255,255,255,.18); color: #c9ccd1; }
.rail .spark-btn:hover, .rail .zoom-btn:hover, .rail .info-btn:hover, .rail .table-btn:hover,
.dark .spark-btn:hover, .dark .zoom-btn:hover, .dark .info-btn:hover, .dark .table-btn:hover { border-color: rgba(255,255,255,.42); color: #fff; }
.rail .spark-btn[aria-expanded="true"], .rail .zoom-btn[aria-expanded="true"], .rail .info-btn[aria-expanded="true"],
.dark .spark-btn[aria-expanded="true"], .dark .zoom-btn[aria-expanded="true"], .dark .info-btn[aria-expanded="true"] { background: #fff; border-color: #fff; color: var(--ink); }
.rail .ai-panel, .dark .ai-panel { border-top-color: rgba(255,255,255,.1); }
.rail .ai-fact, .dark .ai-fact { color: #c9ccd1; } .rail .ai-fact .v, .dark .ai-fact .v { color: #fff; }
.rail .ai-caveat, .dark .ai-caveat { color: #e2bd72; background: rgba(226,189,114,.14); }

/* .dark — the inverse of the rail's own .light: any OTHER archetype (a
   category card, most likely) can wear the same dark surface the rail
   defaults to, reusing every rule above scoped to `.rail`/`.dark` together.
   Just the surface and the pieces the rail doesn't have: the category
   metric label (ink-3 has no contrast on this background, same reason
   rail-row's own label uses --muted instead) and the axis/end labels a
   glance-shaped card falls back to when it has no series. */
.box.dark { background: var(--rail); color: #fff; }
.box.dark .cat-metric .k { color: var(--muted); }
.box.dark .axis-caps { color: #8b8f98; }
.box.dark .plot-ends { color: rgba(255,255,255,.82); }
.box.dark .plot-cursor { background: rgba(255,255,255,.34); }
.box.dark .plot-dot { background: #fff; box-shadow: 0 0 0 2px var(--rail); }
.box.dark .plot-readout {
  background: #22252c; border-color: rgba(255,255,255,.14);
  box-shadow: 0 4px 14px rgba(0,0,0,.4);
}
.box.dark .plot-readout-k { color: rgba(255,255,255,.6); }
.box.dark .plot-readout-v { color: #fff; }
.box.dark .plot-readout-b { color: rgba(255,255,255,.55); }

/* -------------------------------------------------------------- board states */

.box .err {
  font-size: 11.5px; line-height: 1.45; color: var(--breach);
  background: var(--breach-bg); border-radius: 10px; padding: 9px 11px;
  overflow-wrap: anywhere;
}
.box .err button { margin-top: 8px; }
.box .note { font-size: 10.5px; line-height: 1.45; color: var(--muted); overflow-wrap: anywhere; }

.skeleton { border-radius: 12px; background: var(--hairline); animation: pulse 1.4s ease-in-out infinite; flex: 1; min-height: 40px; }
@keyframes pulse { 0%, 100% { opacity: .55 } 50% { opacity: 1 } }

.board.is-loading { opacity: .55; pointer-events: none; transition: opacity .2s ease; }

/* ------------------------------------------------------- the first-load boot
   The cockpit's first load is the only slow one: nothing is cached, so all
   twenty-odd reads go out to the vendors and the board has nothing to draw for
   several seconds. A spinner stood here and said only "wait". This says how
   far along the wait is, with the board's own vocabulary — a chart that fills
   in as the sources land.

   Two states, and the markup carries both so the loader never depends on JS to
   look alive:
    · not .is-live — cockpit.js has not run yet. The bars are all there, faint,
      with a wave running across them. Nothing is claimed about progress
      because nothing is known.
    · .is-live — boot.js is driving. The wave stops on a bar the moment its
      share of the sources has landed and it colours in; the line and its head
      dot are drawn to the same point. Both are real figures, not a timer.

   Spans the full grid so it is never mistaken for one box. */
.boot {
  grid-column: 1 / -1;
  display: flex; align-items: center; justify-content: center;
  min-height: calc(var(--row) * 2 + var(--gap));
}
.boot-card {
  width: 100%; max-width: 640px;
  background: var(--box); border-radius: var(--radius);
  padding: 26px 28px 22px;
  display: flex; flex-direction: column; gap: 18px;
}
.boot-head { display: flex; flex-direction: column; }
.boot-title { margin: 4px 0 0; font-size: 16px; font-weight: 700; letter-spacing: -.01em; }
.boot-note { margin: 8px 0 0; font-size: 11.5px; line-height: 1.45; color: var(--ink-3); max-width: 52ch; }

/* height:auto against the viewBox ratio: the card narrows on a small screen
   and the chart narrows with it rather than being cropped. */
.boot-plot { display: block; width: 100%; height: auto; overflow: visible; }

.boot-rules line { stroke: var(--hairline); stroke-width: 1; stroke-dasharray: 3 5; }
.boot-base { stroke: var(--edge); stroke-width: 1.5; }

/* The unfilled bar. A tint of the series colour rather than a grey, so a bar
   turning on is the same bar gaining conviction and not a different object.
   The filled one stops short of the full series colour on purpose: the line is
   drawn IN that colour, and a solid bar under a solid line of the same ink
   swallows it exactly when the chart is most complete. Bars carry the volume,
   the line carries the trend, and the two stay apart at every step. */
.boot-bar {
  fill: color-mix(in srgb, var(--s-1) 10%, var(--hairline));
  transition: fill .4s ease;
  animation: boot-wave 1.9s ease-in-out infinite;
  animation-delay: calc(var(--i) * .07s);
}
.boot-bar.on {
  fill: color-mix(in srgb, var(--s-1) 40%, var(--box));
  animation: none; opacity: 1;
}
@keyframes boot-wave { 0%, 100% { opacity: .5 } 40% { opacity: .95 } }

/* Drawn by boot.js through stroke-dashoffset — the dash array is its own
   length, so an offset of that length is a line that has not started and 0 is
   one that has arrived. Hidden until .is-live: with no progress to report yet,
   a line drawn to any point at all would be an invented figure. */
.boot-line {
  fill: none; stroke: var(--s-1); stroke-width: 3;
  stroke-linecap: round; stroke-linejoin: round;
  opacity: 0;
  transition: stroke-dashoffset .45s ease, opacity .3s ease;
}
.boot-dot, .boot-dot-ring { opacity: 0; transition: cx .45s ease, cy .45s ease, opacity .3s ease; }
.boot-dot { fill: var(--s-1); r: 5; }
.boot-dot-ring { fill: none; stroke: var(--s-1); stroke-width: 1.5; }
.boot.is-live .boot-line { opacity: 1; }
.boot.is-live .boot-dot { opacity: 1; }
.boot.is-live .boot-dot-ring { opacity: .45; animation: boot-ping 1.8s ease-out infinite; }
@keyframes boot-ping {
  0%   { r: 6; opacity: .5 }
  70%  { r: 15; opacity: 0 }
  100% { r: 15; opacity: 0 }
}

/* The same count as the bars, said precisely. The bars carry the shape of the
   wait; this carries the number. */
.boot-meter { height: 2px; border-radius: 2px; background: var(--hairline); overflow: hidden; }
.boot-meter i { display: block; height: 100%; width: 0; background: var(--s-1); transition: width .45s ease; }
.boot-legend {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
  font-family: var(--mono); font-size: 10px; letter-spacing: .08em;
  text-transform: uppercase; color: var(--muted);
}
.boot-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Only once something has actually arrived — a tick against "reaching the
   sources" would be a claim about a read that has not answered. */
.boot-label.in::before { content: '✓'; color: var(--good); margin-right: 6px; }
.boot-count { flex: none; color: var(--ink-2); font-weight: 600; letter-spacing: .06em; }

/* The hand-off to the real board. showLayer() replaces the board's children
   the instant the payload is laid out, which after a ten-second wait reads as
   a yank; boot.js holds this frame for a fifth of a second so the finished
   chart is seen finished. */
.boot.is-done .boot-card { opacity: 0; transform: translateY(-4px); transition: opacity .22s ease, transform .22s ease; }

@media (prefers-reduced-motion: reduce) {
  .boot-bar, .boot-dot-ring { animation: none; }
  .boot-bar, .boot-line, .boot-dot, .boot-dot-ring, .boot-meter i, .boot.is-done .boot-card { transition: none; }
}

/* ------------------------------------------------------------------- header */

.masthead { display: flex; align-items: center; gap: 20px; margin-bottom: 22px; flex-wrap: wrap; }
.masthead .mark { height: 30px; width: auto; flex: none; }
.masthead .rule { width: 1px; height: 32px; background: #dedeD8; flex: none; }
.masthead .who { flex: 1; min-width: 200px; }
.masthead h1 { margin: 2px 0 0; font-size: 21px; font-weight: 700; letter-spacing: -.02em; }

/* Board switcher — the same chip vocabulary as .presets, because it is the
   same gesture: one of a small set is current. */
.nav { display: flex; align-items: center; gap: 2px; padding: 3px; border: 1px solid #dcdbd4; border-radius: 999px; background: #fff; flex: none; position: relative; }
.nav a, .nav > button {
  font-family: var(--mono); font-size: 10.5px; font-weight: 600; letter-spacing: .06em;
  text-transform: uppercase; border-radius: 999px; padding: 5px 12px; color: var(--ink-3);
  border: 0; background: transparent; cursor: pointer;
}
.nav a:hover, .nav > button:hover { color: var(--ink); }
.nav a.on, .nav a.on:hover, .nav > button.on, .nav > button.on:hover { background: var(--ink); color: #fff; }
.nav > button[aria-expanded="true"] { background: var(--ink); color: #fff; }
.nav-count {
  display: inline-block; min-width: 16px; margin-left: 4px; padding: 1px 5px; border-radius: 999px;
  background: #e2001a; color: #fff; font-size: 9.5px; line-height: 14px; text-align: center;
}
.nav-count[hidden] { display: none; }

/* Funnel/LinkedIn/Logs rest collapsed behind "More" — Performance is the one
   board most visits are for, so it is the only sibling on the face. */
.nav-more-menu {
  position: absolute; top: calc(100% + 6px); left: 0; z-index: 3;
  display: flex; flex-direction: column; gap: 2px; padding: 4px;
  border: 1px solid #dcdbd4; border-radius: 14px; background: #fff;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .1); min-width: 120px;
}
.nav-more-menu[hidden] { display: none; }
.nav-more-menu a {
  font-family: var(--mono); font-size: 10.5px; font-weight: 600; letter-spacing: .06em;
  text-transform: uppercase; border-radius: 999px; padding: 6px 12px; color: var(--ink-3);
}
.nav-more-menu a:hover { color: var(--ink); background: var(--hairline); }
.nav-more-menu a.on { background: var(--ink); color: #fff; }
/* The account control: an initial in the masthead, beside the settings gear.
   It replaced a chip at the foot of the "More" menu — which rendered fine and
   was, in practice, invisible, because that menu is collapsed until you click
   something unrelated to signing out. */
.account { position: relative; flex: none; }
.account-btn {
  font-family: var(--mono); font-size: 11px; font-weight: 600; letter-spacing: 0;
  border: 1px solid #dcdbd4; background: #fff; color: var(--ink-2); cursor: pointer;
}
.account-btn:hover { color: var(--ink); border-color: var(--ink-3); }

.account-menu {
  position: absolute; top: calc(100% + 7px); right: 0; z-index: 30;
  min-width: 212px; padding: 12px 14px 10px;
  background: #fff; border: 1px solid #dcdbd4; border-radius: 14px;
  box-shadow: 0 10px 26px rgba(22, 24, 29, .10);
  display: flex; flex-direction: column; gap: 10px; align-items: flex-start;
}
.account-menu[hidden] { display: none; }

.account-who { display: flex; flex-direction: column; gap: 3px; min-width: 0; max-width: 100%; }
/* Mono, and allowed to wrap: an address is a value you read character by
   character, and truncating it defeats the one question this panel answers —
   which account am I actually signed in as. */
.account-mail { font-family: var(--mono); font-size: 11px; color: var(--ink); overflow-wrap: break-word; }
.account-role {
  font-family: var(--mono); font-size: 9px; letter-spacing: .07em;
  text-transform: uppercase; color: var(--set-label);
}

.account-out {
  width: 100%; margin: 0; padding: 7px 12px; cursor: pointer;
  font-family: var(--sans); font-size: 12px; font-weight: 500;
  color: var(--ink-2); background: var(--hairline);
  border: 1px solid transparent; border-radius: 9px;
}
.account-out:hover { color: var(--breach); border-color: var(--breach); background: var(--breach-bg); }
.account-out:disabled { opacity: .6; cursor: default; }

.controls { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* Masthead icon buttons — the gear that opens Sources, the calendar that
   expands the date controls. Same chip vocabulary, icon-sized. */
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; padding: 0; border-radius: 999px; flex: none; color: var(--ink-3); }
.icon-btn:hover { color: var(--ink); }
.icon-btn svg { width: 15px; height: 15px; display: block; }
.icon-btn[aria-expanded="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }

/* The date controls rest collapsed behind the calendar icon. */
.range-controls { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.range-controls[hidden] { display: none; }
/* CUSTOM offers the two dates and Refresh, never the old preset chips. */
.range-controls.custom .presets { display: none; }
.ytd-empty { padding: 32px 16px; text-align: center; color: var(--muted); }
.controls label { font-family: var(--mono); font-size: 9.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted-2); display: flex; align-items: center; gap: 5px; }
input[type="date"] {
  font: inherit; font-size: 11.5px; padding: 5px 8px;
  border: 1px solid var(--edge); border-radius: 8px; background: #fff; color: var(--ink);
}
.presets, .modes { display: flex; align-items: center; gap: 2px; padding: 3px; border: 1px solid #dcdbd4; border-radius: 999px; background: #fff; }
.presets button, .modes button {
  font-family: var(--mono); font-size: 10.5px; font-weight: 600; letter-spacing: .06em;
  border: 0; border-radius: 999px; padding: 5px 11px; background: transparent;
  color: var(--ink-3); cursor: pointer;
}
.presets button:hover, .modes button:hover { color: var(--ink); }
.presets button.on, .modes button.on { background: var(--ink); color: #fff; }

button {
  font: inherit; font-size: 11.5px; padding: 6px 12px; cursor: pointer;
  border: 1px solid var(--edge); border-radius: 999px; background: #fff; color: var(--ink);
}
button:hover { border-color: var(--ink-3); }
button.primary { background: var(--ink); border-color: var(--ink); color: #fff; }
button.primary:hover { background: #000; }
button:disabled, button[disabled] { opacity: .45; cursor: not-allowed; }

.status {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 16px; padding: 10px 14px;
  background: var(--breach-bg); color: var(--breach);
  border-radius: 12px; font-size: 12px;
}
/* A refused sign-in: the message takes the room, the Reconnect buttons sit
   after it and wrap under it on a narrow screen rather than squeezing it. */
.status { flex-wrap: wrap; }
.status .status-warn { flex: 1 1 280px; font-weight: 600; }

/* ------------------------------------------------------------- settings */
/* Not a bento box — a settings surface. It borrows the tokens and lives on
   its own page rather than inside the grid. The connection cards, source
   fieldsets and pillar rows below are shared with nothing else; the buttons,
   pills, notes and badges come from the board's vocabulary unchanged.

   One deliberate departure from the boards: TYPE SIZE AND INK. A board box is
   read at a glance and can afford 10px mono in --muted-2 — there are six
   words in it, and the value carries the meaning. A settings panel is read a
   line at a time, for minutes, and the same scale turned it into grey noise:
   the tab rail, every section heading and every hint sat at 10–11.5px in a
   grey under 3:1 on white. So the surface reads from the --set-* scale below
   instead of hard-coded px and the --muted greys. Nothing outside the
   settings page uses these, so the boards keep their own density. */

:root {
  /* Type. One step up from the boards. --set-fs-label is the only thing still
     small, and it earns it by being uppercase mono on a short word. */
  --set-fs:       13.5px;  /* controls, list rows, prose */
  --set-fs-sm:    12.5px;  /* dense secondary — table cells, row meta */
  --set-fs-label: 11px;    /* uppercase mono labels */
  --set-fs-code:  12px;

  /* Ink. Every role here clears 4.5:1 on white, which --muted (#8b8f98, 3.2:1)
     and --muted-2 (#9a9ea6, 2.7:1) do not — those two are for a label beside
     a 40px figure, not for a paragraph you have to read. */
  --set-body:  #3d424a;  /* list rows, options, controls */
  --set-quiet: #61666f;  /* hints, ledes, secondary values */
  --set-label: #6b7079;  /* uppercase mono labels — the floor, not the default */
}

.settings-shell { display: grid; grid-template-columns: 196px minmax(0, 1fr); gap: 26px; align-items: start; }
.settings-main { min-width: 0; }

/* The tab rail. It was .nav's chip vocabulary unrolled into a column — 10.5px
   mono uppercase in --ink-3, current tab inverted to solid black. Six of those
   stacked read as a column of tiny labels with one blacked out, which is a lot
   of contrast spent on the thing you already know. Sentence-case sans at 13px
   is legible without leaning in, and the current tab is a white pill: the same
   "card floating on the board" as the panel beside it, so the rail points at
   the panel instead of competing with it. */
.settings-nav { position: sticky; top: 22px; display: flex; flex-direction: column; gap: 2px; }
.settings-nav a {
  font-size: 13px; font-weight: 500; letter-spacing: 0;
  border-radius: 10px; padding: 9px 13px; color: var(--set-body);
  border: 1px solid transparent;
}
.settings-nav a:hover { color: var(--ink); background: rgba(255, 255, 255, .62); }
.settings-nav a.on, .settings-nav a.on:hover {
  background: var(--box); border-color: var(--edge); color: var(--ink); font-weight: 600;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .05);
}

.settings-body { background: var(--box); border-radius: var(--radius); padding: 26px 30px; min-height: 55vh; }

/* The panel's h2 is the title of the screen you are on — "Connections",
   "Data sources" — with a one-line lede under it. It was set as a 10px mono
   kicker in --muted-2, which is the treatment for a label ABOVE a value, not
   for a heading. A title gets title size; a second h2 in the same panel is a
   subsection and stays a step down. */
.settings-body > h2 {
  margin: 0 0 6px; font-size: 20px; font-weight: 700; letter-spacing: -.02em;
  color: var(--ink); display: flex; align-items: center; gap: 9px;
}
.settings-body > h2:not(:first-child) { margin-top: 30px; font-size: 15px; letter-spacing: -.01em; }
.settings-body > h2 + .hint { margin: 0 0 20px; max-width: 82ch; }

/* Global — .note is the caption under a chart on every board, so it keeps the
   board's scale. The settings surface overrides it on the line below. */
.hint, .note { color: var(--muted); font-size: 11.5px; }
.settings-body .hint, .settings-body .note { color: var(--set-quiet); font-size: var(--set-fs); line-height: 1.55; }
.settings-body code { font-family: var(--mono); font-size: var(--set-fs-code); background: var(--hairline); color: var(--ink); padding: 2px 6px; border-radius: 5px; }
/* Settings buttons run one step up from the board's 11.5px. The padding here
   is (0,1,1), so the two buttons that are NOT pill-shaped — the inline help
   glyph and the vendor sign-in chip — restate theirs at (0,2,0) below. */
.settings-body button { font-size: var(--set-fs-sm); padding: 7px 13px; margin-top: 8px; }
.settings-body .btn-link { font-size: var(--set-fs-sm); padding: 7px 13px; }

/* Save sits under the panel and stays reachable down a long form. It saves
   three tabs at once, so it says so rather than looking like this tab's. */
.settings-actions {
  position: sticky; bottom: 0; z-index: 2;
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  margin-top: 12px; padding: 14px 30px;
  background: var(--box); border-radius: var(--radius);
  border-top: 1px solid var(--hairline);
  font-size: var(--set-fs); color: var(--set-quiet);
}
.settings-actions button { font-size: var(--set-fs); padding: 8px 18px; }

/* Served field help, folded away. Nine paragraphs stacked down a form is why
   the old screen read as legend rather than form. */
.settings-body .help-btn { border: 0; background: none; padding: 0 2px; margin-top: 0; font-size: 12.5px; color: var(--set-label); cursor: pointer; line-height: 1; }
.settings-body .help-btn:hover { color: var(--ink); }
.help-body { margin: 6px 0 8px; padding-left: 12px; border-left: 2px solid var(--edge); font-size: var(--set-fs); line-height: 1.55; color: var(--set-quiet); }

/* ---------------------------------------------------------- connections */

.connections { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 12px; margin: 14px 0 0; }
.conn { border: 1px solid var(--edge); border-radius: 16px; padding: 15px 17px; overflow: hidden; }
.conn-head { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 10px; }
/* The account name is the identity, so it gets the room; the pill and the
   actions keep their own line when the name is long rather than pushing the
   buttons onto a ragged third row. */
.conn-head strong { font-size: 14.5px; min-width: 0; flex: 1 1 auto; overflow-wrap: anywhere; }
.conn-head .spacer { flex-basis: 100%; height: 0; }
.conn-head button, .conn-head .btn-link { font-size: 12px; padding: 5px 12px; white-space: nowrap; }
.conn ul { list-style: none; margin: 11px 0 0; padding: 0; }
.conn li { font-size: var(--set-fs); display: flex; gap: 8px; align-items: baseline; padding: 3px 0; color: var(--set-body); line-height: 1.55; }
.conn li .mark { width: 13px; flex: none; }
.conn li.yes .mark { color: var(--good); }
.conn li.no  .mark { color: var(--breach); }
/* The surface and its detail are one sentence that wraps as one, not two
   columns of ragged text fighting for the same width. */
.conn li > span:last-child { display: block; min-width: 0; }
.conn li > span:last-child .badge { display: inline-flex; vertical-align: -5px; margin-right: 6px; }
.conn li .surface-detail { color: var(--set-quiet); }
.conn .acct { font-size: var(--set-fs-sm); color: var(--set-quiet); margin-top: 7px; word-break: break-all; }
.conn-add { border-style: dashed; }

/* Access — one row per person. Rows, not the connection cards above: each
   carries an address, a role and a verb, and a card apiece turns a list of
   eight colleagues into a wall of boxes. */
.user-list { margin: 16px 0 0; border: 1px solid var(--edge); border-radius: 16px; overflow: hidden; }
.user-row { display: flex; align-items: center; gap: 12px; padding: 10px 16px; border-top: 1px solid var(--edge); }
.user-row:first-child { border-top: 0; }
.user-row .addr {
  flex: 1 1 auto; min-width: 0; display: flex; align-items: center; gap: 8px;
  font-family: var(--mono); font-size: var(--set-fs-code); color: var(--ink);
}
/* break-word, NOT anywhere. `anywhere` counts toward the min-content width,
   which in a flex row lets the address shrink to a single character and wrap
   one letter per line — which is exactly what it did. */
.user-row .addr > span:first-child { min-width: 0; overflow-wrap: break-word; }
.user-row .addr .you {
  flex: none; font-size: 9.5px; letter-spacing: .06em; text-transform: uppercase;
  padding: 3px 7px; border-radius: 999px; background: var(--hairline); color: var(--set-label);
}
/* An env-sourced administrator is shown, and shown to be unchangeable —
   rather than hidden, which would make AUTH_ADMIN_EMAILS an invisible
   grant, or editable, which would only ever return a 409. */
.user-row.locked { background: var(--hairline); }
.user-row.locked .note { flex: none; font-size: var(--set-fs-sm); }
/* .settings-body select is width:100% for the source pickers, which are one
   control to a row. Here it sits beside an address and a verb — and since
   that rule is declared further down this file, matching its specificity
   would lose on order. Scope under .settings-body to outrank it outright. */
.settings-body .user-row select,
.settings-body .user-add select { width: auto; min-width: 128px; }
.user-row select, .user-row button { margin: 0; flex: none; }
.user-row button { font-size: 12px; padding: 5px 12px; }
.user-row > .note { flex: 1; }

.user-add { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 14px; }
.settings-body .user-add input { width: auto; }
.user-add input { margin: 0; flex: 1 1 260px; min-width: 0; }
.user-add select, .user-add button { margin: 0; flex: none; }

.role-legend { list-style: none; margin: 12px 0 0; padding: 0; }
.role-legend li { font-size: var(--set-fs); line-height: 1.6; color: var(--set-body); padding: 3px 0; }
.scope-picks { display: flex; flex-wrap: wrap; gap: 8px 16px; margin: 11px 0; font-size: var(--set-fs); color: var(--set-body); }
.scope-picks label { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }

/* The connection pills read connected / not connected, not a KPI verdict, so
   they keep a bordered outline rather than the filled status pill. */
.conn .pill { font-size: 9.5px; padding: 4px 8px; }
.conn .pill.ok { color: var(--good); background: var(--good-bg); }
.conn .pill.no { color: var(--breach); background: var(--breach-bg); }

/* A link that has to look like a button: OAuth is a navigation, not a fetch. */
.btn-link {
  display: inline-flex; align-items: center; gap: 7px;
  font: inherit; font-size: 11.5px; padding: 6px 12px;
  border: 1px solid var(--edge); border-radius: 999px; background: #fff; color: var(--ink);
}
.btn-link:hover { border-color: var(--ink-3); }
.btn-link.primary { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn-link.primary:hover { background: #000; }

/* Sign-in buttons carry the vendor's own mark — the same one the boards use as
   a source badge — so the button names the vendor by showing it. The mark sits
   on its own white chip inside a dark button; it must never be recoloured. */
.settings-body .vendor-btn { display: inline-flex; align-items: center; gap: 9px; padding: 5px 16px 5px 6px; }
.vendor-btn .badge { width: 23px; height: 23px; }
.scope-picks .badge { width: 19px; height: 19px; }
.conn-head .badge, .settings-body legend .badge { width: 21px; height: 21px; }
.conn li .badge { width: 19px; height: 19px; }
.settings-body legend { display: flex; align-items: center; gap: 6px; }

/* -------------------------------------------------------- source pickers */

.source-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 14px; margin: 14px 0 18px; }
.field-stack { display: flex; flex-direction: column; gap: 14px; margin: 14px 0 0; }
.settings-body fieldset { border: 1px solid var(--edge); border-radius: 16px; padding: 12px 14px; min-width: 0; }
/* The two fields that map a thing to a pillar are a two-column form inside
   a one-column cell — domain → pillar, page id → pillar. At the readable type
   size they no longer fit a third of the grid, and both halves truncated
   mid-word ("elcacloudservi", "Cyberse"), which is the failure this whole
   pass is about. They get two tracks; the other fields are single values and
   stay narrow. Without :has() support nothing matches and the layout is
   exactly what it is today, so there is nothing to fall back to. */
@media (min-width: 1000px) {
  .source-grid fieldset:has(.site-rows) { grid-column: span 2; }
}
.settings-body legend { font-family: var(--mono); font-size: var(--set-fs-label); font-weight: 600; letter-spacing: .07em; text-transform: uppercase; color: var(--set-label); padding: 0 5px; }
.source-grid select, .source-grid input.manual, .settings-body input.manual, .settings-body select {
  width: 100%; font: inherit; font-size: var(--set-fs); padding: 8px 10px;
  border-radius: 9px; border: 1px solid var(--edge); background: #fff; color: var(--ink);
}
.settings-body input.mono, .settings-body textarea.mono { font-family: var(--mono); font-size: var(--set-fs-sm); }
.settings-body select.bad, .settings-body input.bad { border-color: var(--breach); color: var(--breach); }
.source-grid .opt { display: block; font-size: var(--set-fs); color: var(--set-body); padding: 3px 0; }
.source-grid .opt input { margin-right: 7px; }
.source-grid .err-note, .settings-body .err-note { color: var(--breach); margin-bottom: 7px; font-size: var(--set-fs-sm); }
.source-grid .warn-note, .settings-body .warn-note { color: var(--watch); margin-bottom: 7px; font-size: var(--set-fs-sm); }
.source-grid .note { margin-top: 5px; }
.source-actions { display: flex; align-items: center; gap: 10px; }
.account-pick { display: flex; align-items: center; gap: 8px; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--hairline); }
.account-pick select { flex: 1; min-width: 0; }

/* A long account list scrolls inside its own field rather than pushing the
   grid down the page. */
.opt-list { max-height: 240px; overflow-y: auto; margin-top: 5px; }
.opt-tools { display: flex; align-items: center; gap: 7px; margin-top: 7px; }
.opt-tools button { font-size: 11.5px; padding: 3px 9px; }
.opt-tools .note { margin-left: auto; }

/* ------------------------------------------------------------------ chips */
/* The editable list. Every scope field used to be one comma-separated text
   input, which hid where one entry ended and the next began. */

.chips {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
  margin-top: 7px; padding: 6px 7px; min-height: 34px;
  border: 1px solid var(--edge); border-radius: 9px; background: #fff;
}
.chip {
  display: inline-flex; align-items: center; gap: 3px; max-width: 100%;
  font-size: var(--set-fs-sm); padding: 3px 4px 3px 10px; border-radius: 999px;
  background: var(--hairline); color: var(--ink); overflow-wrap: anywhere;
}
.chip button { border: 0; background: none; padding: 0 4px; font-size: 13px; line-height: 1; color: var(--set-label); border-radius: 999px; cursor: pointer; }
.chip button:hover { color: var(--breach); }
.chip.bad { background: var(--breach-bg); color: var(--breach); }
.chip.stray { background: var(--watch-bg); color: var(--watch); }
.chip-input { flex: 1; min-width: 100px; border: 0; background: none; font: inherit; font-size: var(--set-fs); outline: none; padding: 2px; }

/* ----------------------------------------------------------- pillar rows */

.pillar-rows { display: flex; flex-direction: column; gap: 7px; margin: 12px 0; }
.pillar-row {
  display: grid; align-items: center; gap: 9px;
  grid-template-columns: 14px 28px minmax(100px, 1fr) auto minmax(130px, 1.4fr) auto auto;
}
.pillar-row input[type='color'] { width: 28px; height: 28px; padding: 0; border: 1px solid var(--edge); border-radius: 7px; background: none; flex: none; }
.pillar-row .chips { margin-top: 0; }
.pillar-row .grip { color: var(--set-label); cursor: grab; font-size: 14px; text-align: center; }
.pillar-row.dragging { opacity: .45; }
.pillar-row.drop-into { outline: 2px dashed var(--ink-3); outline-offset: 3px; border-radius: 8px; }
.pillar-key { font-family: var(--mono); font-size: var(--set-fs-sm); color: var(--set-quiet); background: var(--hairline); padding: 4px 7px; border-radius: 5px; }
.key-cell { display: inline-flex; align-items: center; gap: 4px; }
.key-cell input { width: 132px; }
.brand-pick, .brand-none { display: inline-flex; align-items: center; gap: 6px; font-size: var(--set-fs-sm); color: var(--set-quiet); white-space: nowrap; }
.brand-none { padding-left: 24px; }
.row-tools { display: inline-flex; gap: 4px; }
button.mini { font-size: 12px; padding: 4px 9px; flex: none; line-height: 1.3; }

/* ----------------------------------------------------------- rule editor */

.source-tabs { display: inline-flex; flex-wrap: wrap; margin: 12px 0 7px; }
.source-tabs button { font-size: 12px; }
.rule-list { display: flex; flex-direction: column; gap: 11px; margin: 12px 0; }
.rule-card { border: 1px solid var(--edge); border-radius: 16px; padding: 13px 15px; }
.rule-card.rule-empty { border-color: var(--watch); }
.rule-head { display: flex; align-items: center; gap: 8px; }
.rule-head .spacer { margin-left: auto; }
.rule-n { font-family: var(--mono); font-size: var(--set-fs-sm); color: var(--set-label); width: 20px; flex: none; }
.rule-tier { font-family: var(--mono); font-size: var(--set-fs-label); font-weight: 600; letter-spacing: .07em; text-transform: uppercase; color: var(--set-label); border: 1px solid var(--edge); border-radius: 999px; padding: 2px 8px; flex: none; white-space: nowrap; }
.rule-card select.rule-pillar { width: auto; min-width: 160px; max-width: 250px; }
.rule-row { display: flex; align-items: center; gap: 9px; margin-top: 10px; flex-wrap: wrap; }
.rule-label { font-family: var(--mono); font-size: var(--set-fs-label); font-weight: 600; letter-spacing: .07em; text-transform: uppercase; color: var(--set-label); flex: none; }
.rule-verbs button { font-size: 11.5px; padding: 5px 11px; }
.rule-comment { font-size: var(--set-fs-sm); color: var(--set-quiet); line-height: 1.55; margin: 9px 0 0; padding-left: 12px; border-left: 2px solid var(--edge); }
.rule-card .chips { margin-top: 6px; }

.raw-json { margin-top: 16px; }
.raw-json summary {
  cursor: pointer; font-family: var(--mono); font-size: var(--set-fs-label); letter-spacing: .1em;
  text-transform: uppercase; color: var(--set-label); font-weight: 600;
}
.raw-json summary:hover { color: var(--ink); }
.settings-body textarea.rules-json {
  width: 100%; font-family: var(--mono); font-size: var(--set-fs-sm); line-height: 1.55;
  padding: 10px; border-radius: 9px; border: 1px solid var(--edge);
  background: #fff; color: var(--ink); resize: vertical; margin-top: 7px;
}

/* The tester follows the source being edited — as an independent picker it let
   you edit one source's rules while reading a verdict about another's. */
.classify-bar {
  position: sticky; bottom: 0; display: flex; align-items: center; gap: 9px; flex-wrap: wrap;
  margin-top: 16px; padding: 12px 0 4px; background: var(--box); border-top: 1px solid var(--hairline);
}
.classify-bar select { width: auto; min-width: 120px; }
.classify-bar input.manual { flex: 1; min-width: 180px; }
.classify-bar .try-out { color: var(--ink); font-size: var(--set-fs); }

/* ---------------------------------------------------------- scope fields */

.config-grid .limit-row { display: flex; align-items: center; gap: 9px; font-size: var(--set-fs); color: var(--set-body); }
.config-grid .limit-row input { width: 100px; margin-left: auto; }
.site-rows { display: flex; flex-direction: column; gap: 7px; margin: 10px 0; }
.site-row { display: grid; grid-template-columns: minmax(0, 1.2fr) auto minmax(0, 1fr) auto; align-items: center; gap: 7px; }
.platform-row { margin-top: 10px; }
.settings-body .chips button, .settings-body .row-tools button, .settings-body .rule-head button,
.settings-body .opt-tools button, .settings-body .rule-verbs button, .settings-body .source-tabs button,
.settings-body .site-row button, .settings-body .key-cell button { margin-top: 0; }

/* ------------------------------------------------------ import / export */
/* The change table is read to answer one question — "is it safe to press
   Apply" — so the incoming column is the emphasised one and the current
   value is set back, rather than the two competing as equals. */

.settings-body .row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.settings-body input[type="file"] { font-size: var(--set-fs-sm); color: var(--set-quiet); max-width: 100%; }
.settings-body table.diff { width: 100%; border-collapse: collapse; margin: 12px 0 6px; font-size: var(--set-fs); }
.settings-body table.diff caption {
  text-align: left; font-family: var(--mono); font-size: var(--set-fs-label); font-weight: 600;
  letter-spacing: .07em; text-transform: uppercase; color: var(--set-label); padding-bottom: 6px;
}
.settings-body table.diff th, .settings-body table.diff td {
  text-align: left; vertical-align: top; padding: 8px 10px 8px 0; border-bottom: 1px solid var(--hairline);
  overflow-wrap: anywhere;
}
.settings-body table.diff thead th { font-family: var(--mono); font-size: var(--set-fs-label); letter-spacing: .06em; text-transform: uppercase; color: var(--set-label); font-weight: 600; }
.settings-body table.diff tbody th { font-weight: 600; width: 26%; color: var(--ink); }
.settings-body table.diff td.was { color: var(--set-quiet); width: 37%; }
.settings-body table.diff td.now { color: var(--ink); width: 37%; }
/* The current LinkedIn mapping file, in Settings → Import / export: a long
   table in a scroll box, so 600 rows do not push the Import box off screen. */
.settings-body .map-scroll { max-height: 420px; overflow: auto; border-top: 1px solid var(--hairline); margin-top: 8px; }
.settings-body table.map-table { width: 100%; border-collapse: collapse; font-size: var(--set-fs-sm); }
.settings-body table.map-table th {
  position: sticky; top: 0; background: var(--box); text-align: left; padding: 6px 10px 6px 0;
  font-family: var(--mono); font-size: var(--set-fs-label); letter-spacing: .06em; text-transform: uppercase;
  color: var(--set-label); font-weight: 600; border-bottom: 1px solid var(--edge);
}
.settings-body table.map-table td { padding: 6px 10px 6px 0; border-bottom: 1px solid var(--hairline); vertical-align: top; }
.settings-body table.map-table td.date { font-family: var(--mono); white-space: nowrap; color: var(--set-quiet); }
.settings-body table.map-table td.post { overflow-wrap: anywhere; }
.settings-body table.map-table td.blank { color: var(--watch); }
.settings-body table.map-table tr.untagged td.gtm { background: var(--watch-bg); }
.settings-body table.map-table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.settings-body table.map-table td.post a { color: inherit; text-decoration: underline; text-decoration-color: var(--hairline); text-underline-offset: 2px; }
.settings-body table.map-table td.post a:hover { text-decoration-color: currentColor; }

@media (max-width: 860px) {
  .settings-shell { grid-template-columns: 1fr; gap: 14px; }
  .settings-nav { position: static; flex-direction: row; overflow-x: auto; padding-bottom: 4px; }
  .settings-nav a { white-space: nowrap; }
  .settings-body { padding: 20px 18px; }
  .settings-actions { padding: 14px 18px; }
  .pillar-row { grid-template-columns: 14px 28px 1fr auto; }
  .pillar-row .chips, .pillar-row .brand-pick, .pillar-row .row-tools { grid-column: 1 / -1; }
}

/* ------------------------------------------------------- expanded-box charts */
/* chart.js output, inside an expanded box. Only the two boxes whose breakdown
   is a relationship rather than a list still draw one. */
.chart { width: 100%; display: block; overflow: visible; flex: 1; min-height: 0; }
.chart .axis { fill: var(--muted); font-size: 10px; font-family: var(--mono); }
.chart .gridline { stroke: var(--hairline); stroke-width: 1; }
.chart .line { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .area { fill: var(--accent); opacity: .09; }
.chart .dot  { fill: var(--accent); }
.chart .line.curr { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .line.prev { fill: none; stroke: var(--muted); stroke-width: 1.5; stroke-linejoin: round; opacity: .8; }

.footnote {
  margin-top: 26px; padding-top: 16px; border-top: 1px solid #dedeD8;
  font-family: var(--mono); font-size: 9.5px; letter-spacing: .08em;
  text-transform: uppercase; color: var(--faint);
}

/* ------------------------------------------------- cockpit · journey strip */
/* One tile per journey above the board — the BA/CO/DG/LEAD switch with the
   journey's headline figure on its face. The accent comes in per-tile as
   --j-accent, set inline from the layer's configured colour. */
.journeys {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--gap); margin-bottom: var(--gap);
}
.journeys:empty { display: none; }

/* The vertical view — a product owner's cut of the board (cockpit.js,
   ownerPillar). The nav's Vertical dropdown picks the vertical, so the lens'
   own pillar picker, which would pick it a second time, is not drawn. The
   tiles lose their figures there (those are the whole board's), so they
   shrink to a switch. */
.owner-view .journey-picks .pick-pillar { display: none; }
.journeys.owner { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.nav > button:disabled { opacity: .45; cursor: default; }

/* Filters the board's own cards as you type — see cardSearch.js. */
/* The field opens as a panel under the masthead's loupe, right-aligned to it,
   like the nav's own menus; the loupe wears a dot while a query is filtering. */
.search-wrap { position: relative; flex: none; }
.search-wrap .icon-btn.has-query::after {
  content: ''; position: absolute; top: 3px; right: 3px; width: 7px; height: 7px;
  border-radius: 50%; background: #e2001a;
}
.card-search-bar {
  position: absolute; top: calc(100% + 8px); right: 0; z-index: 30;
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  width: min(460px, calc(100vw - 32px)); box-sizing: border-box; padding: 10px;
  background: #fff; border: 1px solid #dcdbd4; border-radius: 14px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .1);
}
.card-search-bar[hidden] { display: none; }
.card-search {
  flex: 1 1 260px; min-width: 0; font-family: var(--sans); font-size: 13px;
  background: var(--box); border: 1px solid var(--edge); border-radius: var(--radius-sm);
  padding: 8px 12px; color: var(--ink);
}
.card-search:focus { outline: 2px solid var(--ink); outline-offset: 1px; }
.card-search-count {
  font-family: var(--mono); font-size: 10px; letter-spacing: .06em;
  text-transform: uppercase; color: var(--muted-2); white-space: nowrap;
}
/* Cards and sub-item toggles the search filtered out. Its own class, never
   the native `hidden` attribute already used for a closed section's grid
   and an admin-hidden card's relocation — the two mechanisms must not fight. */
.search-hidden { display: none !important; }
.journey {
  appearance: none; cursor: pointer; text-align: left;
  font-family: var(--sans); color: var(--ink);
  background: var(--box); border: 1px solid var(--edge); border-radius: 14px;
  padding: 12px 14px 12px 18px; position: relative; overflow: hidden;
  display: flex; flex-direction: column; gap: 3px; min-width: 0;
  transition: box-shadow .15s ease, border-color .15s ease;
}
.journey::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 4px;
  background: var(--j-accent, var(--ink));
}
.journey:hover { box-shadow: 0 2px 12px rgba(22, 24, 29, .10); }
.journey.on {
  border-color: var(--j-accent, var(--ink));
  box-shadow: 0 0 0 1px var(--j-accent, var(--ink));
}
.j-kicker {
  font-family: var(--mono); font-size: 9px; letter-spacing: .08em;
  text-transform: uppercase; color: var(--muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.j-name {
  font-weight: 700; font-size: 13px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.j-figure { display: flex; align-items: baseline; gap: 8px; margin-top: 2px; }
/* The fixed window, stated in the header where the date picker used to be. */
.range-fixed {
  font-family: var(--mono); font-size: 10px; letter-spacing: .06em;
  text-transform: uppercase; color: var(--muted); white-space: nowrap;
  padding: 0 2px;
}
/* The label names both windows of the pair now — "SEMESTER · March 2026–August
   2026 · vs September 2025–February 2026" against the old "YTD 2026 · vs 2025"
   — which nowrap pushed 15px past a phone's viewport and gave the whole page a
   horizontal scrollbar. It wraps here rather than truncating: which pair is
   being compared is the entire content of the label, so an ellipsis would cut
   the half that answers "against what". */
@media (max-width: 720px) {
  .range-fixed { white-space: normal; max-width: 100%; }
}

.j-value { font-family: var(--mono); font-weight: 600; font-size: 19px; }
/* On an indexed tile the percentage IS the headline, so it carries the
   figure's weight and the delta's colour rather than sitting beside one. */
.j-index.up   { color: var(--good); }
.j-index.down { color: var(--breach); }
.j-delta { font-family: var(--mono); font-size: 11px; }
.j-delta.up { color: var(--good); }
.j-delta.down { color: var(--breach); }
/* The index as bars, one per channel. The delta above is a mean, and a mean
   hides a split — these reopen it: which channels carried the number, and
   which pulled against it. Bars grow from a shared centre line so up and down
   are read by direction as well as by colour. */
.j-bars {
  display: flex; align-items: stretch; gap: 3px;
  height: 34px; margin-top: 4px;
  /* The zero line every bar is measured from. Positioned on the bar area
     only — the tag row below it is outside the 24px the bars are drawn in,
     so the line stays centred on the bars rather than on the whole block. */
  background:
    linear-gradient(var(--hairline), var(--hairline)) 0 12px / 100% 1px no-repeat;
}
/* Two equal halves: a bar grows upward out of the top one or downward out of
   the bottom one, so its height is read against half the track and up/down
   never share a pixel. */
.j-bar {
  flex: 1 1 0; min-width: 0;
  display: flex; flex-direction: column;
}
/* The two halves share a fixed 24px so the zero line lands at a known offset
   whatever the tag row costs below them. */
.j-bar-half { flex: 0 0 12px; display: flex; min-height: 0; }
.j-bar-half.top { align-items: flex-end; }
.j-bar-half.bottom { align-items: flex-start; }
/* 2px floor so a small-but-real change is still a visible mark rather than a
   hairline that reads as nothing — the percentage height carries the size,
   this only stops it rounding away. */
.j-bar-fill { width: 100%; border-radius: 1px; min-height: 2px; }
.j-bar-fill.up   { background: var(--good); }
.j-bar-fill.down { background: var(--breach); }
/* A channel the index could not score: present, but making no claim. */
.j-bar-fill.none { background: var(--hairline); }
/* Which channel each bar is, without a hover. A full channel name in a fifth
   of a tile: it ellipsizes on a narrow tile, and the title carries it whole. */
.j-bar-tag {
  font-family: var(--mono); font-size: 8px; letter-spacing: 0;
  color: var(--muted); text-align: center; line-height: 10px;
  margin-top: 2px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
}
@media (max-width: 720px) {
  .journeys { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* --------------------------------------------------------------- assistant */
/* The ✦ button is built on every box and shown on none until the page learns
   the server holds a key (cockpit.js sets data-assistant on <body> from
   /api/assistant). No box has to know; no build order has to be right. */
body:not([data-assistant]) .spark-btn { display: none; }

/* The drawer: one per page, pinned to the right, the board still visible
   beside it. An <aside>, not a <dialog> — nothing modal about a conversation
   you have while looking at the card it is about. */
.chat-drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(440px, 100vw);
  background: var(--box); border-left: 1px solid var(--edge);
  box-shadow: -12px 0 30px rgba(22, 24, 29, .10);
  display: flex; flex-direction: column; z-index: 40;
  font-family: var(--sans); color: var(--ink);
}
.chat-head { display: flex; align-items: flex-start; gap: 10px; padding: 16px 18px 12px; border-bottom: 1px solid var(--hairline); }
.chat-mark { font-size: 14px; line-height: 1.3; color: var(--ink-3); flex: none; }
.chat-who { min-width: 0; flex: 1 1 auto; }
.chat-title { margin: 0; font-size: 13px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-sub { font-family: var(--mono); font-size: 9.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted-2); margin-top: 4px; }
.chat-close {
  flex: none; width: 26px; height: 26px; border: 1px solid var(--edge); border-radius: var(--radius-sm);
  background: #fbfbf9; color: var(--muted); font-size: 16px; line-height: 1; cursor: pointer; padding: 0;
}
.chat-close:hover { background: var(--hairline); color: var(--ink-2); }

.chat-thread { flex: 1 1 auto; overflow: auto; padding: 14px 18px; display: flex; flex-direction: column; gap: 16px; scrollbar-width: thin; }
.chat-empty { font-size: 12px; color: var(--ink-3); line-height: 1.5; }
.chat-turn { display: flex; flex-direction: column; gap: 8px; }
.chat-q {
  align-self: flex-end; max-width: 88%; background: var(--ink); color: #fff;
  border-radius: 14px 14px 4px 14px; padding: 8px 12px;
  font-size: 12.5px; line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere;
}
.chat-a { font-size: 12.5px; line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; }
.chat-a.pending::after { content: '▍'; color: var(--muted); animation: chat-blink 1s steps(2) infinite; }
@keyframes chat-blink { to { opacity: 0; } }

/* Each fetch the model made, as it made it: server · tool, the arguments,
   and whether it came back — the "data pulled" line under an answer. */
.chat-tools { display: flex; flex-direction: column; gap: 4px; }
.chat-tool {
  display: flex; gap: 8px; align-items: baseline; min-width: 0;
  font-family: var(--mono); font-size: 10px; color: var(--ink-3);
  border-left: 2px solid var(--edge); padding-left: 8px;
}
.chat-tool .name { color: var(--ink-2); font-weight: 600; flex: none; }
.chat-tool .in { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-tool .st { flex: none; text-transform: uppercase; letter-spacing: .06em; font-size: 8.5px; color: var(--muted-2); }
.chat-tool.ok { border-color: var(--good); }
.chat-tool.err { border-color: var(--breach); }
.chat-tool.err .st { color: var(--breach); }
.chat-notice { font-size: 10.5px; line-height: 1.4; color: var(--watch); background: var(--watch-bg); border-radius: 7px; padding: 6px 8px; }
.chat-error { font-size: 11px; line-height: 1.4; color: var(--breach); background: var(--breach-bg); border-radius: 7px; padding: 6px 8px; }
.chat-meta { font-family: var(--mono); font-size: 8.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--faint); }

.chat-form { border-top: 1px solid var(--hairline); padding: 12px 18px 16px; display: flex; flex-direction: column; gap: 8px; }
.chat-input {
  width: 100%; box-sizing: border-box; resize: none; min-height: 58px;
  border: 1px solid var(--edge); border-radius: 10px; padding: 9px 11px;
  font: inherit; font-size: 12.5px; line-height: 1.4; background: #fbfbf9; color: var(--ink);
}
.chat-input:focus { outline: none; border-color: var(--ink-3); }
.chat-actions { display: flex; align-items: center; gap: 8px; }
.chat-send, .chat-stop {
  font-family: var(--mono); font-size: 9.5px; letter-spacing: .06em; text-transform: uppercase;
  padding: 6px 12px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--ink); background: var(--ink); color: #fff;
}
.chat-send:disabled { opacity: .35; cursor: default; }
.chat-stop { background: #fbfbf9; color: var(--ink-2); border-color: var(--edge); }
.chat-stop:hover { border-color: var(--ink-3); }
.chat-hint { margin-left: auto; font-family: var(--mono); font-size: 8.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--faint); }

/* With the drawer open the page gives up its right edge rather than being
   covered: the fourth column stays readable while the conversation is about
   one of its cards. Below the width where that leaves nothing for the board,
   the drawer simply overlays. */
@media (min-width: 1100px) {
  body.chat-open .page { margin-right: 456px; margin-left: auto; transition: margin-right .15s ease; }
}

/* The answer's Markdown — compact, the board's type scale, tables that read
   like the breakdown rows every card already has. */
.chat-a.md > :first-child { margin-top: 0; }
.chat-a.md > :last-child { margin-bottom: 0; }
.chat-a.md p { margin: 0 0 8px; }
.chat-a.md ul, .chat-a.md ol { margin: 0 0 8px; padding-left: 18px; }
.chat-a.md li { margin: 2px 0; }
.chat-a.md li ul { margin: 2px 0 0; }
.chat-a.md h3, .chat-a.md h4, .chat-a.md h5, .chat-a.md h6 { margin: 10px 0 4px; font-size: 12.5px; font-weight: 700; }
.chat-a.md strong { font-weight: 700; color: var(--ink); }
.chat-a.md code { font-family: var(--mono); font-size: 11px; background: var(--hairline); border-radius: 4px; padding: 1px 4px; }
.chat-a.md pre { margin: 0 0 8px; padding: 8px 10px; background: var(--hairline); border-radius: 8px; overflow: auto; }
.chat-a.md pre code { background: none; padding: 0; font-size: 10.5px; }
.chat-a.md blockquote { margin: 0 0 8px; padding: 2px 10px; border-left: 2px solid var(--edge); color: var(--ink-3); }
.chat-a.md hr { border: 0; border-top: 1px solid var(--hairline); margin: 10px 0; }
.chat-a.md a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.chat-a.md table { border-collapse: collapse; width: 100%; margin: 4px 0 10px; font-size: 11.5px; display: block; overflow-x: auto; }
.chat-a.md thead th {
  font-family: var(--mono); font-size: 9px; letter-spacing: .08em; text-transform: uppercase; font-weight: 500;
  color: var(--muted-2); text-align: left; padding: 4px 8px 5px; border-bottom: 1px solid var(--edge); white-space: nowrap;
}
.chat-a.md td { padding: 5px 8px; border-bottom: 1px solid var(--hairline); vertical-align: top; }
.chat-a.md tr:last-child td { border-bottom: 0; }
.chat-a.md th.right, .chat-a.md td.right { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.chat-a.md th.center, .chat-a.md td.center { text-align: center; }
.chat-a.md td.right { font-family: var(--mono); font-size: 11px; }

/* A chart in the answer: the board's own drawing, in a figure the width of
   the drawer. */
.md-chart-pending { font-family: var(--mono); font-size: 9.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--faint); }
.chat-chart { margin: 6px 0 10px; padding: 10px 12px 8px; border: 1px solid var(--hairline); border-radius: 12px; background: #fbfbf9; }
.chat-chart figcaption { font-size: 11.5px; font-weight: 700; margin: 0 0 8px; }
.chat-chart .plot, .chat-chart .plot-wrap { width: 100%; }
.chat-chart .plot { height: 120px; min-height: 120px; }
.chat-chart-caps { display: flex; justify-content: space-between; gap: 6px; margin-top: 2px; font-family: var(--mono); font-size: 8.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted-2); }
.chat-chart-caps span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-chart-ring { display: flex; align-items: center; gap: 14px; }
.chat-chart-ring svg { flex: none; }
.chat-chart-legend { list-style: none; margin: 6px 0 0; padding: 0; display: flex; flex-direction: column; gap: 3px; font-size: 11px; min-width: 0; flex: 1 1 auto; }
.chat-chart-ring .chat-chart-legend { margin: 0; }
.chat-chart-legend li { display: flex; align-items: center; gap: 7px; min-width: 0; }
.chat-chart-legend i { width: 9px; height: 9px; border-radius: 3px; flex: none; }
.chat-chart-legend .k { color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-chart-legend .v { margin-left: auto; font-family: var(--mono); font-size: 10.5px; color: var(--ink); white-space: nowrap; }
.chat-chart-empty { font-size: 11px; color: var(--ink-3); }

/* ---------------------------------------------------------------- issue mark
   A source this card reads is broken or limited (quota, expired sign-in, not
   connected). Deliberately quiet: a small amber "!" beside the id chip, the
   reason in its tooltip. Unlike .kpi-id it takes pointer events — hovering it
   is the whole interaction. */
.issue-mark {
  display: inline-flex; align-items: center; justify-content: center; flex: none; align-self: center;
  width: 15px; height: 15px; border-radius: 50%;
  margin-left: 4px;
  background: var(--watch-bg); border: 1px solid var(--watch); color: var(--watch);
  font-family: var(--mono); font-size: 10px; font-weight: 700; line-height: 1;
  cursor: help; user-select: none;
}
.issue-mark.auth, .issue-mark.setup { border-color: var(--breach); color: var(--breach); }
.box.rail .issue-mark, .box.dark .issue-mark { background: rgba(255, 255, 255, .12); }

/* Admin-only annotations — the explanatory captions a viewer does not need
   to read the board: the masthead tagline and each journey tile's
   "LAYER · metric · status" kicker, the Overview rail's "LAYER · every
   surface" kicker, a section's "N boxes" count, and the
   note beside a journey card's stage title. cockpit.js sets
   body[data-admin] once the role resolves, so they stay hidden for viewers
   and on any role failure. Add a selector here to demote another caption
   the same way. */
body:not([data-admin]) :is(#layer-kicker, .j-kicker, .section-count, .journey-note, .rail-head .kicker) { display: none; }

/* Data-limit strip (stampWindowNote in bento.js). Adjusted: the card answers a
   different pair of dates than the picker, inside the source's history.
   Uncovered: the window or its comparison lies outside it — the figures go
   grey so they are not read as like-for-like. Never hidden. */
.win-note {
  margin-top: 8px; padding: 8px 10px; border-radius: 6px;
  font-size: 11px; line-height: 1.4; color: var(--ink);
  display: flex; flex-direction: column; gap: 6px;
}
/* One line per limit — its name, then what it did to this card. Never clamped:
   the reason is the whole content of the note. */
.win-item { margin: 0; }
.win-item strong { display: block; font-weight: 650; }
.win-item span { color: var(--ink-2); }
.win-note.uncovered .win-item span { color: var(--muted); }
.win-note.adjusted, .win-note.caveat { background: #fff6e0; border: 1px solid #f0d58a; }
.win-note.uncovered {
  background: repeating-linear-gradient(135deg, #f1f0ec 0 6px, #e7e6e0 6px 12px);
  border: 1px solid #d6d4cc; color: var(--muted);
}
.box.win-uncovered .delta,
.box.win-uncovered .value,
.box.win-uncovered .figure,
.box.win-uncovered svg { opacity: .45; filter: grayscale(1); }
/* The asterisk that stands for the strip on the card face. */
.win-mark {
  font: 700 13px/1 var(--mono); width: 20px; height: 20px; border-radius: 6px; padding: 0;
  border: 1px solid #f0d58a; background: #fff6e0; color: #8a5a00; cursor: pointer;
}
/* adjusted and caveat share the amber default above */
.win-mark.uncovered { border-color: #d6d4cc; background: #f1f0ec; color: var(--muted); }
.win-note[hidden] { display: none; }
.limits-wrap { position: relative; display: inline-flex; }
.limits-btn {
  font: italic 600 11px/1 Georgia, serif; width: 18px; height: 18px; border-radius: 50%;
  border: 1px solid #dcdbd4; background: #fff; color: var(--muted); cursor: pointer; padding: 0;
}
.limits-btn.has-limits { border-color: #f0d58a; background: #fff6e0; color: #8a5a00; }
.window-notice {
  position: absolute; top: calc(100% + 6px); right: 0; z-index: 30; width: min(340px, 90vw);
  padding: 10px 12px; border-radius: 8px; background: #fff; border: 1px solid #e3e2dc;
  box-shadow: 0 6px 20px rgba(0,0,0,.08); font-size: 12px; line-height: 1.45; color: var(--ink);
}
.window-notice[hidden] { display: none; }
.window-notice p { margin: 6px 0 0; color: var(--muted); }
.info-limits { margin-top: 10px; padding: 8px 10px; border-radius: 6px; background: #fff6e0; border: 1px solid #f0d58a; font-size: 12px; line-height: 1.4; display: grid; gap: 4px; }
.info-limits .k { font-family: var(--mono); font-size: 10px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.info-limits .muted { color: var(--muted); }
.info-limits .now { font-weight: 600; }
/* "Lifetime · snapshot" — a card whose figure ignores the period (stampSnapshot). */
.snap-chip {
  font-family: var(--mono); font-size: 9px; letter-spacing: .06em; text-transform: uppercase;
  padding: 2px 6px; border-radius: 999px; background: #eef3ff; color: #2f4fa8; border: 1px solid #c9d6f5;
  white-space: nowrap; margin-right: auto;
}
/* Export presets and per-layer groups. */
.preset-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 4px 0 14px; font-size: 12px; }
.preset-bar select, .preset-bar input { font: inherit; padding: 5px 8px; border: 1px solid #dcdbd4; border-radius: 6px; background: #fff; min-width: 0; }
.preset-bar button { font: inherit; padding: 5px 10px; border: 1px solid #dcdbd4; border-radius: 999px; background: #fff; cursor: pointer; }
.preset-bar button.preset-save { background: var(--ink); color: #fff; border-color: var(--ink); }
.preset-bar button:disabled { opacity: .5; cursor: default; }
.preset-msg { color: var(--muted); }
.export-group + .export-group { margin-top: 18px; }
.export-layer { font-family: var(--mono); font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin: 8px 0; font-weight: 600; }
/* Targets (pilot; attachTarget in cockpit.js) — on the BACK of a card. The
   status label in the top-right corner (On track / Behind / On top) flips it;
   the face stays as it was. */
.box.has-target { position: relative; }
.target-flip {
  position: absolute; top: 12px; right: 12px; z-index: 2;
  flex: none; white-space: nowrap;
  padding: 3px 10px; border-radius: 999px;
  font-family: var(--mono); font-size: 10px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase;
  border: 1.5px solid #dcdbd4; background: #fff; color: var(--muted); cursor: pointer;
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
}
.target-flip:hover { filter: brightness(.97); }
.target-flip.behind { color: #b42318; border-color: #f3c2bd; background: #fff5f4; }
.target-flip.on-track { color: #2f4fa8; border-color: #c9d6f5; background: #f5f8ff; }
.target-flip.good { color: #127a3a; border-color: #b6e3c4; background: #f3fbf6; }
.target-flip[aria-pressed="true"] { background: var(--ink); color: #fff; border-color: var(--ink); }
.target-back { display: none; margin-top: 4px; font-size: 11px; }
.box.flipped > .target-back { display: block; }
.box.flipped > :not(.target-back):not(.box-toolbar):not(.journey-stage):not(.kpi-id):not(.target-flip):not(:has(> .cat-head)) { display: none; }
/* Room for the corner label so it never sits on the title or the stage note. */
.box.has-target > :first-child { padding-right: 84px; }
.box.flipped > div:has(> .cat-head) > :not(.cat-head) { display: none; }
.box.flipping { animation: card-turn .32s ease; }
@keyframes card-turn { 0% { transform: perspective(900px) rotateY(0); } 50% { transform: perspective(900px) rotateY(90deg); } 100% { transform: perspective(900px) rotateY(0); } }
@media (prefers-reduced-motion: reduce) { .box.flipping { animation: none; } }
.target-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px; margin-bottom: 6px; }
.target-pace { color: var(--muted); font-family: var(--mono); font-size: 9px; width: 100%; }
.target-dummy { font-family: var(--mono); font-size: 9px; text-transform: uppercase; letter-spacing: .06em; padding: 1px 6px; border-radius: 999px; background: #fde9c8; color: #8a5a00; }
.target-back { overflow-x: auto; }
.target-table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; font-size: 10.5px; }
.target-table th, .target-table td { padding: 2px 3px; text-align: right; white-space: nowrap; }
.target-table th:first-child { text-align: left; font-weight: 600; }
.target-table thead th { font-weight: 500; color: var(--muted); font-size: 10px; }
.target-table tr.on th { color: var(--ink); text-decoration: underline; }
.target-table tr.total td, .target-table tr.total th { border-top: 1px solid #dcdbd4; font-weight: 700; }
.target-pill { display: inline-block; padding: 1px 5px; border-radius: 999px; font-size: 9.5px; font-weight: 600; }
.target-pill.behind { background: #fde2e2; color: #b42318; }
.target-pill.on-track { background: #e8eefc; color: #2f4fa8; }
.target-pill.good { background: #def7e5; color: #127a3a; }
.target-pill.none { color: var(--muted); }
/* Settings → Targets grid (public/settings/targets.js). */
.targets-grid { border-collapse: collapse; margin: 10px 0; font-size: 13px; }
.targets-grid th, .targets-grid td { padding: 4px 8px; border-bottom: 1px solid #eceae4; text-align: left; vertical-align: middle; }
.targets-grid thead th { font-weight: 600; font-size: 12px; color: var(--muted); }
.targets-grid input { width: 120px; font: inherit; padding: 4px 6px; border: 1px solid #dcdbd4; border-radius: 6px; }
/* A stage with no such column: nothing to set, nothing to compare against. */
.targets-grid td.targets-none { color: var(--muted); text-align: center; cursor: default; }
.targets-grid input { width: 104px; }
.targets-tab label { display: block; margin: 6px 0; }
.targets-tab select { width: auto; }

/* ============================================================================
   The Funnel page (`#/funnel`, showFunnel in cockpit.js)

   One pillar on one channel down the four funnel stages, drawn as a rail: four
   stages joined by arrows, each reduced to its headline, with the stage the
   reader picked opened underneath as the board's own card. The rail's nodes are
   read off that card, not recomputed, so every figure here is a figure the
   board already shows. The look is the board's own — white boxes on the
   board's ground, mono kickers, the stage accents of LAYERS — nothing new.
   ========================================================================== */
.board.funnel-board { display: block; }
.funnel { display: flex; flex-direction: column; gap: 24px; min-width: 0; }
.funnel-head { display: flex; align-items: center; gap: 24px; flex-wrap: wrap; }
.fn-kicker { font: 400 11px/1 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); }
.funnel-empty { margin: 0; padding: 22px; font-size: 13px; color: var(--ink-3); }

/* Pillar and channel as one sentence — "Following Cybersecurity on LinkedIn" —
   rather than two filter rows: the pair is what the page is about. Native
   selects, restyled as the pills the window picker uses, so the keyboard and
   the screen reader get the platform's own list for free. */
.funnel-lens {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  background: var(--box); border-radius: 999px; padding: 6px 8px 6px 16px;
  box-shadow: 0 1px 2px rgba(22, 24, 29, .08);
}
.funnel-dot { flex: none; width: 10px; height: 10px; border-radius: 50%; }
.funnel-on { font-size: 14px; color: var(--ink-3); }
.funnel-select {
  appearance: none; -webkit-appearance: none; min-height: 44px; border: 0; border-radius: 999px;
  padding: 0 34px 0 16px; cursor: pointer; color: #fff; font: 500 14px/1 var(--sans);
  background: var(--ink) url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12' fill='none' stroke='white' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'><path d='M3 4.5l3 3 3-3'/></svg>") no-repeat right 14px center;
}
.funnel-select option { color: var(--ink); background: #fff; }
.funnel-select:focus-visible, .funnel-node:focus-visible { outline: 2px solid var(--s-1); outline-offset: 2px; }

.funnel-rail {
  display: flex; align-items: stretch; padding: 28px;
  background: var(--box); border-radius: var(--radius); box-shadow: 0 1px 2px rgba(22, 24, 29, .06);
}
.funnel-node {
  flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; gap: 10px;
  padding: 16px 18px; border: 1px solid var(--edge); border-radius: 14px;
  background: transparent; color: var(--ink); font: inherit; text-align: left;
}
button.funnel-node { cursor: pointer; }
button.funnel-node:hover { border-color: color-mix(in srgb, var(--stage) 45%, var(--edge)); }
/* The opened stage: its own accent, 2px, and a faint wash of it. Padding gives
   back the pixel the heavier border takes, so nothing in the rail shifts. */
button.funnel-node.on {
  padding: 15px 17px; border: 2px solid var(--stage);
  background: color-mix(in srgb, var(--stage) 5%, var(--box));
}
.funnel-node.ghost { border: 1.5px dashed var(--faint); }
.fn-top { display: flex; align-items: center; gap: 8px; }
.fn-step {
  flex: none; width: 22px; height: 22px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--stage); color: #fff; font: 500 11px/1 var(--mono);
}
.funnel-node.ghost .fn-step { background: transparent; border: 1.5px solid var(--muted-2); color: var(--ink-3); }
.fn-cap { font: 600 14px/1 var(--sans); }
.funnel-node.ghost .fn-cap { color: var(--ink-3); }
.fn-layer { margin-left: auto; font: 400 10px/1 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); }
.fn-metric { min-height: 2.6em; font: 400 11px/1.3 var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); }
.fn-figure { font: 600 40px/1 var(--sans); letter-spacing: -.04em; }
.fn-status { display: flex; align-items: center; gap: 8px; min-height: 22px; }
.fn-spark { display: block; height: 44px; margin-top: auto; pointer-events: none; }
.fn-spark > * { width: 100%; height: 100%; display: block; }
.fn-why { font-size: 13px; line-height: 1.45; color: var(--ink-3); }
.funnel-link { flex: 0 0 72px; display: flex; justify-content: center; align-items: flex-start; padding-top: 34px; color: var(--ink); }
.funnel-link svg { width: 72px; height: 14px; }
.funnel-link.ghost { color: var(--muted-2); }
.funnel-link.ghost path { stroke-dasharray: 4 5; }

/* The opened stage is the board's real card, laid out wide: the headline and
   its trend on the left, the secondary rows on the right. Its own toolbar —
   id, ℹ, target, pick, expand — stays where every card has it. */
.funnel-detail > .box.category {
  display: grid; grid-template-columns: minmax(240px, 340px) minmax(0, 1fr);
  column-gap: 48px; row-gap: 12px; align-content: start; align-items: start;
  grid-row: auto; padding: 26px 28px;
}
.funnel-detail > .box.category > .journey-stage { display: none; }
.funnel-detail > .box.category > div:not([class]),
.funnel-detail > .box.category > .plot-wrap,
.funnel-detail > .box.category > .plot,
.funnel-detail > .box.category > .plot-ends { grid-column: 1; }
.funnel-detail > .box.category > .cat-metrics { grid-column: 2; grid-row: 1 / span 4; }
.funnel-detail > .box.category > .note,
.funnel-detail > .box.category > .glance-detail,
.funnel-detail > .box.category > .box-toolbar { grid-column: 1 / -1; }
.funnel-detail > .box.category.is-open { grid-template-columns: minmax(0, 1fr); }

/* Phone and narrow windows: the rail turns to a column and the arrows point
   down, so the order still reads top to bottom. */
@media (max-width: 900px) {
  .funnel-rail { flex-direction: column; padding: 16px; }
  .funnel-link { flex: 0 0 auto; padding: 6px 0; transform: rotate(90deg); height: 72px; align-items: center; }
  .funnel-link svg { width: 48px; }
  .funnel-detail > .box.category { grid-template-columns: minmax(0, 1fr); }
  .funnel-detail > .box.category > .cat-metrics { grid-column: 1; grid-row: auto; }
}

/* Five nav items no longer fit a phone in one pill (Funnel joined Performance,
   Vertical, Export and More), and the pill is `flex: none`, so it widened the
   whole page. It may shrink and wrap onto a second row instead. */
@media (max-width: 720px) {
  .nav { flex: 0 1 auto; max-width: 100%; box-sizing: border-box; flex-wrap: wrap; border-radius: 22px; }
}

/* The window picker, folded: only the window the board is on shows (YTD by
   default), with a chevron saying it opens. A click on it unfolds the rest;
   choosing one folds it again (setModesOpen in cockpit.js). */
#modes.collapsed button:not(.on) { display: none; }
#modes.collapsed button.on::after {
  content: ''; display: inline-block; width: 5px; height: 5px; margin: 0 1px 2px 8px;
  border-right: 1.6px solid currentColor; border-bottom: 1.6px solid currentColor;
  transform: rotate(45deg);
}

/* The footer on the app pages (cockpit, settings, logs): copyright on the left,
   the version — a link to the log — on the right. The public pages use the
   same `.site-foot` from site.css; this is its twin for bento.css pages. */
.app-foot {
  max-width: 1320px; margin: 28px auto 0; padding: 18px 0 8px; border-top: 1px solid var(--edge);
  display: flex; flex-wrap: wrap; gap: 8px 22px; justify-content: space-between;
  font: 400 10px/1.4 var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3);
}
.app-foot a { color: inherit; text-decoration: none; }
.app-foot a:hover { color: var(--ink); text-decoration: underline; }
.app-foot a[hidden] { display: none; }
