/* The one stylesheet (009 §8). Server-rendered pages; every genuinely
   interactive part lives inside the artifact iframe.

   COLOUR IS ALL TOKENS (issue #72 §2). The shell was already tokenized; the
   twenty-odd hexes that were not are the ones that carry MEANING — a
   retraction banner, an exploratory plan, a failed run — and each is now a
   semantic triple (surface / border / text) rather than a literal. That is
   the whole of what made dark mode work: a filter or an inverted brightness
   would have turned the red banner into something that is no longer read as
   red, and the banners are the part of this UI whose entire job is to be
   noticed.

   Five semantic families, and they mean things rather than looking like
   colours:
     --bad-*    something is wrong, or was found wrong (retraction, failure)
     --warn-*   something is unresolved and a person may need to act
     --ok-*     something was checked and held up
     --info-*   after-the-fact record, no action implied
     --code     the surface SQL, plans and ids are set on
   --warn-mark is the same family's solid marker colour, used where there is
   no surface to tint (the left rule on a clouded answer, the clarification
   dot). It is the one token whose threshold is 3:1 rather than 4.5:1 — WCAG
   applies the non-text minimum to a mark that carries meaning — and it is
   the one the first sweep missed, because that sweep walked text/surface
   pairs and this is not text (PR #81 review, finding 6). It needs a genuinely
   different value per theme: one gold cannot clear 3:1 against both a near
   white and a near black page.

   THREE THEME STATES, and the media query is deliberately not the only one.
   `system` follows prefers-color-scheme; an explicit choice stamps
   data-theme on <html> (server-side, from a cookie — routes.py explains why
   there) and must win in BOTH directions, so the dark values appear twice:
   once for "system says dark and the reader hasn't overridden it", once for
   "the reader asked for dark". The duplication is plain CSS's price for
   that; the alternative, light-dark(), leaves every colour unset on a
   browser that lacks it, which is a worse failure than a repeated block. */
:root {
  --ink: #1e2430;
  /* Nudged one step darker than 009 shipped it (#6b7280): the old value is
     4.39:1 on --code, i.e. under AA for the muted id chips that sit on it. */
  --muted: #666e7c;
  --line: #e2e6ec;
  --accent: #2456c4;
  /* The little "i" more-info control. Cyan on purpose, distinct from the
     blue accent links sit in — a hint, not a place to go. 5.29:1 on --card. */
  --more-info: #0e7490;
  --bg: #f7f8fa;
  --card: #ffffff;
  --code: #f2f4f8;
  --on-accent: #ffffff;

  --bad-bg: #fdecea;  --bad-line: #e4b3ad;  --bad-ink: #7a1f14;
  --warn-bg: #fdf6e3; --warn-line: #e5d5a1; --warn-ink: #6b5312;
  --ok-bg: #e8f5ee;   --ok-line: #b9dcc8;   --ok-ink: #1c5c38;
  --info-bg: #eef2fb; --info-line: #c3d0ee; --info-ink: #24407a;
  /* Darker than the dark theme's gold, not lighter: 3.75:1 on --bg and
     3.98:1 on --card. The shared #c08a2e it replaces was 2.86 / 3.04 here,
     under the 3:1 non-text minimum, while being fine in dark. */
  --warn-mark: #a8761f;

  /* Header bar, main, and the shelf pages share this. The header used to
     cap its inner nav at 60rem while `main.wide` was 76rem, so the bar and
     the folders/results column did not line up; 76rem is the shelf measure. */
  --page-width: 76rem;
}

@font-face {
  font-family: "Mulish";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("/static/mulish-latin-400-700.woff2") format("woff2");
}

/* The dark palette. Every text/surface pair in it clears 4.5:1, the banners
   by a wide margin (bad 9.4:1, warn 9.4:1, ok 8.9:1, info 8.5:1 on their own
   surfaces) — a washed-out retraction banner is a correctness problem, not a
   cosmetic one, so the tinted surfaces stay dark and the text stays bright
   rather than the pair being pulled toward the page background.
   --warn-mark keeps its lighter gold here: 6.02:1 on --bg, well over the 3:1
   a non-text marker needs, which is why only the light block moved. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ink: #e6e9ef;
    --muted: #9aa3b2;
    --line: #2b3240;
    --accent: #8ab0ff;
    --more-info: #67e8f9;
    --bg: #12151c;
    --card: #191d26;
    --code: #11141b;
    --on-accent: #0d1017;

    --bad-bg: #3a1714;  --bad-line: #7d3a30;  --bad-ink: #ffb4a3;
    --warn-bg: #362b12; --warn-line: #7a6528; --warn-ink: #f2d18b;
    --ok-bg: #10301f;   --ok-line: #2f6a48;   --ok-ink: #8fdcae;
    --info-bg: #182540; --info-line: #3a5488; --info-ink: #a9c2f5;
    --warn-mark: #c08a2e;
  }
}
/* The same values, for a reader who chose dark on a light system. Keep the
   two blocks in step — they are one palette written twice. */
:root[data-theme="dark"] {
  --ink: #e6e9ef;
  --muted: #9aa3b2;
  --line: #2b3240;
  --accent: #8ab0ff;
  --more-info: #67e8f9;
  --bg: #12151c;
  --card: #191d26;
  --code: #11141b;
  --on-accent: #0d1017;

  --bad-bg: #3a1714;  --bad-line: #7d3a30;  --bad-ink: #ffb4a3;
  --warn-bg: #362b12; --warn-line: #7a6528; --warn-ink: #f2d18b;
  --ok-bg: #10301f;   --ok-line: #2f6a48;   --ok-ink: #8fdcae;
  --info-bg: #182540; --info-line: #3a5488; --info-ink: #a9c2f5;
  --warn-mark: #c08a2e;
}
* { box-sizing: border-box; }

/* THE `hidden` ATTRIBUTE HAS TO ACTUALLY HIDE. The UA sheet's
   `[hidden] { display: none }` is an ordinary type-less attribute selector,
   so ANY author rule that sets `display` on the same element beats it — and
   `.remix-fallback { display: inline-block }` below did exactly that, which
   meant app.js setting `fallback.hidden = true` was a no-op and every reader
   with a clipboard got the Claude link AND the selectable fallback beside it
   (PR #81 review, finding 2). `!important` rather than reordering, because
   the next author rule to set `display` on a hideable element would silently
   reopen it. */
[hidden] { display: none !important; }

body {
  margin: 0;
  font: 15px/1.55 "Mulish", system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--bg);
}
button, input, select, textarea { font-family: inherit; }
.site-header {
  max-width: var(--page-width); margin: 0 auto;
  background: var(--card);
  border-bottom: 1px solid var(--line);
  font-size: 1.2em;
}
.site-header nav {
  padding: 0.7rem 1rem;
  display: flex; flex-wrap: wrap; gap: 0.6rem 1.1rem; align-items: center;
}
.site-header a { color: var(--ink); text-decoration: none; }
.site-header a:hover { color: var(--accent); }
.site-header .brand {
  font-weight: 700; margin-right: 1rem;
  display: flex; align-items: center; gap: 0.4rem; line-height: 1;
}
.brand-mark { width: 1.4em; height: 1.4em; display: block; flex-shrink: 0; }

/* The right-hand disclosure holds standing account/build information and
   occasional display controls. Native details keeps it operable without JS. */
.account-menu { position: relative; margin-left: auto; }
.account-menu > summary {
  list-style: none; width: 2rem; height: 2rem; display: grid; place-items: center;
  border: 1px solid transparent; border-radius: 6px; color: var(--ink);
  cursor: pointer;
}
.account-menu > summary::-webkit-details-marker { display: none; }
.account-menu > summary:hover,
.account-menu > summary:focus-visible,
.account-menu[open] > summary {
  color: var(--accent); background: var(--code); border-color: var(--line);
}
.account-menu-icon,
.account-menu-icon::before,
.account-menu-icon::after {
  display: block; width: 1.1rem; height: 2px; border-radius: 999px;
  background: currentColor;
}
.account-menu-icon { position: relative; }
.account-menu-icon::before,
.account-menu-icon::after { content: ""; position: absolute; left: 0; }
.account-menu-icon::before { top: -0.35rem; }
.account-menu-icon::after { top: 0.35rem; }
.account-menu-panel {
  position: absolute; z-index: 20; top: calc(100% + 0.55rem); right: 0;
  width: min(22rem, calc(100vw - 2rem)); padding: 1rem;
  display: flex; flex-direction: column; gap: 0.85rem;
  background: var(--card); border: 1px solid var(--line); border-radius: 8px;
  box-shadow: 0 0.65rem 1.8rem rgb(0 0 0 / 0.16);
}

/* What is deployed (issue #155). Below the session rule: product name, then
   the version chip. Standing information, not a control. */
.site-header .deployed {
  display: flex; flex-direction: column; gap: 0.1rem;
  border-top: 1px solid var(--line); padding-top: 0.85rem;
  color: var(--muted); font-size: 0.8em;
  font-variant-numeric: tabular-nums;
}
.deployed-name { font-weight: 600; }
.site-header .theme { display: flex; align-items: baseline; gap: 0.3rem; }
.theme-label, .tz-label { color: var(--muted); font-size: 0.8em; }
.theme-option {
  background: transparent; color: var(--muted); border: 1px solid transparent;
  border-radius: 999px; padding: 0.1rem 0.55rem; font-size: 0.8em; cursor: pointer;
}
.theme-option:hover { color: var(--ink); filter: none; }
.theme-option.active {
  background: var(--code); border-color: var(--line); color: var(--ink); font-weight: 600;
}

/* The timezone picker (issue #148). A real <select>, styled only enough to
   stop being a system widget three sizes too large for a menu — twelve
   cities is past what a row of buttons can carry.

   .tz-go is the no-JavaScript submit. app.js hides it and submits on change;
   it is visible in the markup so that a reader without scripting has a way to
   apply the choice at all. */
.site-header .tz { display: flex; align-items: center; gap: 0.3rem; }
.tz-select {
  background: var(--bg); color: var(--ink); border: 1px solid var(--line);
  border-radius: 999px; padding: 0.1rem 0.4rem; font-size: 0.8em;
  font-family: inherit; cursor: pointer; max-width: 9rem;
  font-variant-numeric: tabular-nums;
}
.tz-select:hover { color: var(--ink); border-color: var(--accent); }
.tz-go {
  background: transparent; color: var(--muted); border: 1px solid var(--line);
  border-radius: 999px; padding: 0.1rem 0.55rem; font-size: 0.8em; cursor: pointer;
}
.tz-go:hover { color: var(--ink); filter: none; }

/* Sign out (issue #200), shaped like a control rather than a nav link — it
   is a press that changes something, not a place to go. Muted until hovered,
   because on nearly every visit it is the least interesting thing in the
   header; it matters on the one visit where somebody needs back out.

   The rule above this block is the one thing that stops it reading as a
   third member of the theme/timezone group (PR #205 review, finding 4):
   those two change how the page looks, this one ends the session. The
   signed-in address sits with it, because both are about who this session
   is rather than how the page looks. The button's title says what it does
   for the same reason. */
.account-session {
  display: flex; flex-direction: column; gap: 0.55rem;
  border-top: 1px solid var(--line); padding-top: 0.85rem;
}
/* Which account this session is on. Muted and small like the version chip:
   standing information rather than a control. */
.site-header .signed-in-as {
  color: var(--muted); font-size: 0.8em;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.site-header .signout { display: flex; align-items: baseline; }
.signout-go {
  background: transparent; color: var(--muted); border: 1px solid var(--line);
  border-radius: 999px; padding: 0.1rem 0.55rem; font-size: 0.8em; cursor: pointer;
}
.signout-go:hover { color: var(--ink); border-color: var(--accent); filter: none; }

main { max-width: var(--page-width); margin: 1.4rem auto 4rem; padding: 0 1rem; }
h1 { font-size: 1.45rem; margin: 0.4rem 0 1rem; }
h2 { font-size: 1.15rem; margin: 1.4rem 0 0.6rem; }
a { color: var(--accent); }

.banner {
  padding: 0.8rem 1rem; margin: 0 0 1rem; border-radius: 6px;
  border: 1px solid;
}
.banner-retraction { background: var(--bad-bg); border-color: var(--bad-line); color: var(--bad-ink); }
.banner-pending { background: var(--warn-bg); border-color: var(--warn-line); color: var(--warn-ink); }
.banner-resolved { background: var(--info-bg); border-color: var(--info-line); color: var(--info-ink); }
.banner-reason { display: block; margin-top: 0.3rem; font-size: 0.92em; }

.artifact-frame {
  width: 100%;
  height: calc(100vh - 240px); /* fixed viewport-relative; artifact scrolls internally (009 §3.3) */
  min-height: 340px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--card);
}

/* THE CHART FOLLOWS THE READER'S THEME NOW (issue #115), so this note is no
   longer about every chart and no longer switched on by the theme.

   What changed: /viz/{id}/frame re-assembles a saved chart from its canonical
   View Document instead of replaying frozen bytes, and stamps the reader's
   theme on it; render code paints with the runtime's var(--cv-*) tokens, which
   the render gate enforces. A chart drawn since needs no explanation at all.

   A chart drawn BEFORE that cannot be re-themed — its colours are literals in
   bytes somebody already saved — so the artifact frames it as a deliberate
   light inset and the template renders this note beside it, in EVERY theme.
   The visibility rule that used to live here has gone with it: the template
   asks `embed_legacy`, which is a fact about the chart, rather than the
   stylesheet guessing from the theme. */
.artifact-note { display: block; }

/* --- the chart stage: fullscreen and zoom (issue #116) ----------------------
 *
 * A chart is often unreadable not because it is wrong but because it is small
 * — a third-width dashboard panel is ~420px, and 10px axis labels in it are
 * 10px. Two controls, both acting on the frame from outside it:
 *
 *   * FULLSCREEN is requested on .viz-stage, not on the iframe. Fullscreening
 *     the iframe itself would take the toolbar away at the exact moment the
 *     reader wants the zoom stepper, and would leave no visible way back but
 *     Esc.
 *   * ZOOM is postMessage'd into the frame and applied there by the runtime,
 *     because a sandboxed frame in an opaque origin is not something this page
 *     can reach into — and because `zoom` inside the document REFLOWS the
 *     chart, where a transform out here would magnify a picture of it.
 *
 * The zoom/fullscreen group ships `hidden` and app.js unhides it: with
 * scripting off neither control can work, while the Refresh form in the same
 * toolbar remains a normal GET form. */
.viz-stage { position: relative; }

.viz-stage-tools {
  display: flex; flex-wrap: wrap; align-items: flex-end; gap: 0.6rem;
  margin: 0 0 0.4rem;
  font-size: 0.85rem;
}
.viz-stage-label {
  color: var(--muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.viz-stage-zoom {
  display: flex; align-items: center; gap: 0.6rem;
  margin-left: auto; flex: 0 0 auto;
}
.viz-zoom { display: flex; align-items: center; gap: 0.25rem; }
.viz-zoom-value {
  min-width: 3.2em; text-align: center;
  color: var(--muted); font-variant-numeric: tabular-nums;
}
.viz-stage-tools button {
  background: transparent; color: var(--accent);
  border: 1px solid var(--line); border-radius: 999px;
  padding: 0.1rem 0.7rem; font-size: inherit; line-height: 1.6;
  cursor: pointer;
}
.viz-stage-tools button:hover:not(:disabled) { background: var(--code); }
.viz-stage-tools button:disabled { color: var(--muted); cursor: default; }

/* In fullscreen the stage IS the viewport: paint it, or the parts of it the
   frame does not cover show the UA's black. The frame takes everything the
   toolbar does not. */
.viz-stage:fullscreen {
  background: var(--bg);
  padding: 0.6rem 0.8rem;
  box-sizing: border-box;
  display: flex; flex-direction: column;
}
.viz-stage:fullscreen .viz-stage-tools { flex: 0 0 auto; }
.viz-stage:fullscreen iframe {
  flex: 1 1 auto;
  width: 100%; height: auto; min-height: 0;
}

.viz-title-row {
  display: flex; flex-wrap: wrap; align-items: flex-start;
  gap: 0.6rem; justify-content: space-between;
}
.viz-title-row h1 { margin-bottom: 0.4rem; }

/* Result-page actions: a native disclosure, anchored at the far right of the
   title row. Nested disclosures keep Archive and Rename deliberate without
   making the closed page read as a form. */
.actions { position: relative; margin-left: auto; }
.actions > summary {
  list-style: none; cursor: pointer; color: var(--accent);
  border: 1px solid var(--line); border-radius: 999px;
  padding: 0.15rem 0.8rem; font-size: 0.85rem;
}
.actions > summary::-webkit-details-marker { display: none; }
.actions > summary::after { content: " ▾"; }
.actions[open] > summary,
.actions > summary:hover { background: var(--code); }
.actions-panel {
  position: absolute; z-index: 15; top: calc(100% + 0.4rem); right: 0;
  width: min(25rem, calc(100vw - 2rem)); min-width: 19rem;
  padding: 0.8rem; display: flex; flex-direction: column; gap: 0.7rem;
  background: var(--card); border: 1px solid var(--line); border-radius: 8px;
  box-shadow: 0 0.65rem 1.8rem rgb(0 0 0 / 0.16);
}
.actions-panel .remix { display: flex; flex-wrap: wrap; gap: 0.4rem; align-items: center; }
.actions-panel .rename,
.actions-panel .archive-confirm { border-top: 1px solid var(--line); padding-top: 0.6rem; }
.actions-panel summary { cursor: pointer; color: var(--accent); }
/* Archive and Rename sit open in this menu — same blue heading, no marker,
   no second tap. pointer-events keeps the summary from closing them; the
   forms inside still take clicks. */
.actions-panel .rename { margin: 0; }
.actions-panel .archive-confirm > summary,
.actions-panel .rename > summary {
  cursor: default;
  pointer-events: none;
  color: var(--accent);
  font-size: inherit;
  display: block;
  list-style: none;
}
.actions-panel .archive-confirm > summary::marker,
.actions-panel .rename > summary::marker { content: none; }
.actions-panel .archive-confirm > summary::-webkit-details-marker,
.actions-panel .rename > summary::-webkit-details-marker { display: none; }
.actions-panel .rename > summary::before { content: none; }
.actions-panel .rename > summary:hover { color: var(--accent); }
.actions-panel .archive-confirm .archive-form {
  display: block;
  margin-top: 0.45rem;
}
.actions-panel .rename-form {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  margin-top: 0.35rem;
}
.actions-panel .rename-form input { flex: none; max-width: none; width: 100%; }
.actions-panel .rename-form button {
  align-self: flex-start;
  background: transparent; color: var(--accent);
  border: 1px solid var(--line); border-radius: 999px;
  padding: 0.15rem 0.75rem; font: inherit; font-size: 0.85em;
  cursor: pointer;
  margin-top: 0.35rem;
}
.actions-panel .rename-form button:hover {
  background: var(--code); filter: none;
  color: var(--accent); border-color: var(--line);
}
.actions-panel .actions-hint { margin: 0.3rem 0 0; }
.actions-hint { margin: 0.35rem 0 0.55rem; color: var(--muted); font-size: 0.88em; }

/* The remix control (templates/_remix.html). The round-edged Claude link is
   the press; the <details> holding the same text stays for selection when
   there is no clipboard to write to. */
.remix { font-size: 0.85em; }
.remix-claude {
  display: inline-block;
  background: transparent; color: var(--accent);
  border: 1px solid var(--line); border-radius: 999px;
  padding: 0.15rem 0.75rem; font-size: inherit;
  font-weight: 600; text-decoration: none;
}
.remix-claude:hover { background: var(--code); }
.remix-fallback { margin: 0.35rem 0 0; display: inline-block; }
.remix-fallback > summary { font-weight: 400; color: var(--accent); }
.remix-hint { color: var(--muted); margin: 0.3rem 0 0.2rem; }
.remix-text {
  display: block; width: 100%; max-width: 34rem;
  background: var(--code); color: var(--ink);
  border: 1px solid var(--line); border-radius: 6px;
  /* pre-wrap, not pre: the prompt's "Original query" line is as long as
     the question, and soft wrapping is visual only — a textarea's VALUE,
     which is what gets copied, is unchanged by it. */
  padding: 0.4rem 0.6rem; font: inherit; white-space: pre-wrap;
}

/* Archiving (templates/_archive.html, issue #118). The controls are forms,
   so the button has to be talked out of looking like the page's primary
   action: an Archive on every Browse row rendered in accent fill would make
   a list of charts read as a list of buttons. Same quiet outline as the
   remix control it sits beside. */
.row-actions {
  display: flex; flex-wrap: wrap; align-items: baseline;
  gap: 0.5rem; margin-top: 0.35rem;
}
.viz-title-row .row-actions { margin-top: 0; }
.archive-form { display: inline; }
.archive-button {
  background: transparent; color: var(--accent);
  border: 1px solid var(--line); border-radius: 999px;
  padding: 0.15rem 0.75rem; font-size: 0.85em;
}
.archive-button:hover { background: var(--code); filter: none; }
/* The undo lives inside a banner, where it is the one thing to press. */
.archive-notice .archive-form { margin-left: 0.4rem; }
.archive-link { color: var(--muted); font-size: 0.88em; margin-top: 1.2rem; }

.viz-header .viz-question { margin: 0.1rem 0; }
.viz-meta, .plan-meta, .attempt-meta { color: var(--muted); font-size: 0.88em; }
.viz-list { list-style: none; padding: 0; }
.viz-list li {
  background: var(--card); border: 1px solid var(--line); border-radius: 6px;
  padding: 0.75rem 1rem; margin-bottom: 0.6rem;
}
/* 15% over the question and meta lines beneath it (issue #227) — a list row
   used to lean on the review badge to say "this is the important word here";
   with the row actions gone, the title carries that weight by size instead. */
.viz-list .viz-title { font-weight: 600; text-decoration: none; font-size: 1.15em; }
.viz-list .viz-question { margin: 0.2rem 0; }
.badge {
  font-size: 0.75em; padding: 0.1rem 0.5rem; border-radius: 999px;
  vertical-align: middle; margin-left: 0.4rem;
}
/* Review-status badges (issue #72 §3). One per Browse row and one on each
   result page, from routes.review_badge — five tones for eight outcomes,
   with the LABEL carrying the distinction inside a tone (the two amber ones
   read "human review pending" and "automated review: couldn't assess", which
   are different sentences about different layers).

   `broken` is its own tone rather than a shade of warn or of none: a review
   that ERRORED is not a warning about the data and not the absence of a
   review, it is a review that was attempted and produced nothing. Dashed,
   so it is distinguishable from "not reviewed" without relying on colour —
   which also covers the colour-blind reader, for whom `ok` and `bad` are
   otherwise a coin toss. */
.badge-ok { background: var(--ok-bg); border: 1px solid var(--ok-line); color: var(--ok-ink); }
.badge-warn { background: var(--warn-bg); border: 1px solid var(--warn-line); color: var(--warn-ink); }
.badge-bad { background: var(--bad-bg); border: 1px solid var(--bad-line); color: var(--bad-ink); }
.badge-broken {
  background: var(--code); border: 1px dashed var(--muted); color: var(--muted);
}
.badge-none { background: transparent; border: 1px solid var(--line); color: var(--muted); }

/* The legend under the list, and the sentence under a result page's badge:
   the qualifying half of each status AS TEXT. A `title` tooltip is unreachable
   on touch and unreliable everywhere else, and "not reviewed" without its
   sentence is exactly the reading this vocabulary exists to prevent
   (routes.badge_legend). Collapsed, because it is a reference rather than
   something to read every visit. */
.badge-legend { margin: 1.2rem 0 0; font-size: 0.88em; }
.badge-legend > summary { color: var(--accent); cursor: pointer; }
.badge-legend dl { margin: 0.6rem 0 0; }
.badge-legend dt { margin-top: 0.5rem; }
.badge-legend dt .badge { margin-left: 0; }
.badge-legend dd { margin: 0.15rem 0 0; color: var(--muted); }
/* Truncation notes and standing claims reuse this class as a muted aside
   (inline-block, slightly inset). The circular "i" used to live here too;
   that control is `.more-info` now, so a paragraph is not a widget. */
.badge-detail { position: relative; display: inline-block; margin-left: 0.25rem; }

/* Generic more-info "i". Native details, so the sentence is there on touch
   and with scripting off. Cyan, distinct from accent links. Superscript and
   30% smaller than the original chip, so it reads as a footnote on the
   label it explains. Flex rows ignore vertical-align, so the timezone
   picker lifts the same control with a relative offset. */
.more-info {
  position: relative; display: inline-block; flex-shrink: 0;
  vertical-align: super;
}
.site-header .tz .more-info { top: -0.35em; }
.more-info > summary {
  display: inline-grid; place-items: center; list-style: none;
  width: 0.945rem; height: 0.945rem; border: 1px solid var(--more-info);
  border-radius: 50%; color: var(--more-info); cursor: pointer; font-size: 0.546rem;
  font-weight: 700;
}
.more-info > summary::-webkit-details-marker { display: none; }
.more-info > summary:hover,
.more-info > summary:focus-visible,
.more-info[open] > summary {
  background: var(--code);
}
.more-info > span {
  position: absolute; z-index: 10; top: calc(100% + 0.35rem); right: 0;
  width: min(24rem, calc(100vw - 2rem)); padding: 0.6rem 0.75rem;
  color: var(--ink); background: var(--card); border: 1px solid var(--line);
  border-radius: 6px; box-shadow: 0 0.5rem 1.2rem rgb(0 0 0 / 0.14);
}
.account-menu-panel .more-info > span {
  right: auto; left: 0; width: min(18rem, calc(100vw - 4rem));
}
.viz-meta > .more-info { margin-left: 0.25rem; }

.toast {
  position: fixed; z-index: 50; right: 1rem; bottom: 1rem;
  max-width: min(28rem, calc(100vw - 2rem)); padding: 0.7rem 0.9rem;
  color: var(--on-accent); background: var(--accent);
  border-radius: 7px; box-shadow: 0 0.55rem 1.4rem rgb(0 0 0 / 0.22);
}

.search { display: flex; gap: 0.5rem; margin-bottom: 1rem; align-items: center; flex-wrap: wrap; }
.search input[type="search"] { flex: 1; min-width: 12rem; padding: 0.45rem 0.6rem; border: 1px solid var(--line); border-radius: 6px; }

/* The by-creator filter sits in the search form (issue #169). "by" labels it
   without a second line; the select follows the same border as the box. */
.creator-label { color: var(--muted); font-size: 0.9em; }
.creator-select {
  padding: 0.4rem 0.5rem; border: 1px solid var(--line); border-radius: 6px;
  background: var(--card); color: var(--ink); max-width: 14rem;
}

/* THE HERO (issue #169): the empty landing is the search box and little else.
   Centred, roomy, and the box grown to match — the page's one job when there
   is nothing to answer is to invite the question. */
.search-hero-heading {
  display: flex; align-items: center; justify-content: center; gap: 0.45rem;
  text-align: center; margin: 3.5rem 0 1.2rem; font-weight: 700;
}
.search.search-hero {
  max-width: 40rem; margin: 0 auto 1rem; justify-content: center;
}
.search.search-hero input[type="search"] {
  font-size: 1.15rem; padding: 0.7rem 0.9rem; flex-basis: 100%;
}
.search-hero-hint {
  text-align: center; color: var(--muted); margin: 0.6rem auto 0;
  max-width: 34rem;
}

/* Matching folders and tags, as results above the items (issue #169). Chips,
   because each is a jump into a filter rather than a row to read. */
.results-labels { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0.6rem 0 1.2rem; }
.result-label {
  display: inline-flex; align-items: baseline; gap: 0.35rem;
  padding: 0.3rem 0.6rem; border: 1px solid var(--line); border-radius: 999px;
  background: var(--card); text-decoration: none; font-weight: 600;
}
.result-label:hover { border-color: var(--accent); }
.result-label-kind { color: var(--muted); font-size: 0.72em; font-weight: 400; }

/* The two result groups. The count rides in the heading, small and muted, so
   "Visualizations 3" reads as a heading with a number, not a badge. */
.results-group { margin: 0 0 1.6rem; }
.results-heading { font-size: 1.05rem; margin: 0 0 0.5rem; }
.results-count {
  color: var(--muted); font-weight: 400; font-size: 0.85em; margin-left: 0.2rem;
}

details { margin: 1rem 0; }
details > summary { cursor: pointer; font-weight: 600; }
.provenance, .recently-resolved {
  background: var(--card); border: 1px solid var(--line); border-radius: 6px;
  padding: 0.7rem 1rem;
}
.plan { border-top: 1px solid var(--line); padding-top: 0.7rem; margin-top: 0.7rem; }
pre.sql {
  background: var(--code); border: 1px solid var(--line); border-radius: 6px;
  padding: 0.6rem 0.8rem; overflow-x: auto; font-size: 0.86em;
  white-space: pre-wrap;
}
.confidence {
  font-size: 0.72em; padding: 0.1rem 0.45rem; border-radius: 999px;
  border: 1px solid var(--line); vertical-align: middle;
}
.confidence-canonical { background: var(--ok-bg); border-color: var(--ok-line); color: var(--ok-ink); }
.confidence-exploratory { background: var(--warn-bg); border-color: var(--warn-line); color: var(--warn-ink); }
.attempt-error { color: var(--bad-ink); font-size: 0.9em; }

/* The execution a dashboard panel linked to (issue #117). A left rail rather
 * than a fill: the SQL block beneath keeps its own surface, and the marker has
 * to read on a page that already spends its background colours on banners. */
.attempt-linked {
  border-left: 3px solid var(--accent);
  padding-left: 0.7rem;
  margin-left: -0.7rem;
}
.attempt-linked-note { color: var(--accent); font-size: 0.85em; margin: 0 0 0.2rem; }
.linked-from { margin-bottom: 0.8rem; }
.artifact-linked-note { margin: 0.4rem 0 0; }
.carried-by { margin-top: 1.2rem; }

/* Why a listed panel is NOT refetching (issue #117; PR #120 review, finding
 * 4). The same pill the dashboard puts beside a panel's title, so the two
 * surfaces name the same state the same way — muted rather than accented,
 * because it qualifies an entry in a list and is not itself the news. */
.carried-kind {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.05rem 0.35rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
  white-space: nowrap;
}

.review-card {
  background: var(--card); border: 1px solid var(--line); border-radius: 6px;
  padding: 1rem 1.2rem; margin-bottom: 1rem;
}
.review-card h2 { margin-top: 0; }
/* Title and the links out of it on one line, the links pushed right and sized
 * as chrome — the same weighting the dashboard panel gives its Source (issue
 * #149). What the card is about is what the eye should land on first. */
.review-card-head { display: flex; align-items: baseline; gap: 0.6rem; flex-wrap: wrap; }
.review-card-head h2 { flex: 1 1 auto; }
.review-links { display: inline-flex; gap: 0.7rem; font-size: 0.8rem; white-space: nowrap; }
.recently-resolved .review-links { margin-left: 0.5rem; }
.review-source { color: var(--muted); font-style: italic; margin-top: -0.4rem; }
.review-card dl dt { font-weight: 600; margin-top: 0.5rem; }
.review-card dl dd { margin: 0.1rem 0 0; }
.original-question { color: var(--muted); display: block; font-size: 0.9em; }
.no-sql { color: var(--muted); font-style: italic; }
.preview-rows { border-collapse: collapse; font-size: 0.85em; margin: 0.5rem 0; }
.preview-rows th, .preview-rows td {
  border: 1px solid var(--line); padding: 0.25rem 0.55rem; text-align: left;
}

.resolve-form { border-top: 1px solid var(--line); margin-top: 0.8rem; padding-top: 0.8rem; }
.resolve-form label { display: block; margin-bottom: 0.5rem; font-weight: 600; }
.resolve-form input, .resolve-form select, .resolve-form textarea {
  display: block; width: 100%; max-width: 34rem; margin-top: 0.2rem;
  padding: 0.4rem 0.55rem; border: 1px solid var(--line); border-radius: 6px;
  font: inherit;
}
button {
  background: var(--accent); color: var(--on-accent); border: 0; border-radius: 6px;
  padding: 0.45rem 1rem; font: inherit; cursor: pointer;
}
button:hover { filter: brightness(1.1); }
.resolved-notes { margin: 0.15rem 0 0.5rem; color: var(--muted); }

.tabs { display: flex; gap: 0.4rem; border-bottom: 1px solid var(--line); margin-bottom: 0.8rem; }
.tabs a {
  padding: 0.4rem 0.9rem; text-decoration: none; color: var(--ink);
  border: 1px solid transparent; border-bottom: 0; border-radius: 6px 6px 0 0;
}
.tabs a.active { background: var(--card); border-color: var(--line); font-weight: 600; }
.window-form { margin-bottom: 1rem; color: var(--muted); }
.window-form input { width: 5rem; padding: 0.25rem 0.4rem; }
table.stats {
  border-collapse: collapse; background: var(--card); width: 100%;
  border: 1px solid var(--line); border-radius: 6px;
}
table.stats th, table.stats td {
  text-align: left; padding: 0.45rem 0.8rem; border-bottom: 1px solid var(--line);
  vertical-align: top;
}
table.stats th em { font-weight: 400; color: var(--muted); font-size: 0.85em; }
/* A divider inside table.stats, so the calibration table's headline rates
   (#43) read as the figure the section is for and the supporting counts read
   as support — one table rather than three, because splitting them would put
   a rate and its own denominator in different tables. */
table.stats th.row-group {
  font-size: 0.78em; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--muted); padding-top: 1.1rem; border-bottom: 1px solid var(--line);
}

.login { max-width: 22rem; margin: 4rem auto; text-align: center; }
.login input[type="password"] {
  display: block; width: 100%; margin: 0.8rem 0; padding: 0.55rem 0.7rem;
  border: 1px solid var(--line); border-radius: 6px; font: inherit;
}
.login .hint { color: var(--muted); }
.form-error { color: var(--bad-ink); }
/* Google renders its own button into this element and owns everything inside
   it — the size and theme are passed to renderButton, not set here. This only
   centres the iframe it injects. */
.google-button { display: flex; justify-content: center; margin: 1.2rem 0; }
/* The contractor token field (issue #65): a collapsed detail, muted, so the
   reader who needs the Google button above never has to decide whether this
   is for them. */
.contractor-signin { margin-top: 2rem; text-align: left; }
.contractor-signin summary {
  color: var(--muted); font-size: 0.85em; cursor: pointer; text-align: center;
}
.contractor-signin .hint { font-size: 0.85em; text-align: left; }
/* Who a review is about to be resolved as — the text that replaced the
   "Resolving as" input (see reviews.html). */
.resolving-as { color: var(--muted); font-size: 0.85em; margin: 0.6rem 0; }

.error-page { text-align: center; margin-top: 4rem; }
.error-page h1 { font-size: 3rem; color: var(--muted); }
.reference-id code { background: var(--code); padding: 0.1rem 0.4rem; border-radius: 4px; }
.empty { color: var(--muted); }
/* A rule that COULD have refused something and did not (issue #204). Muted
   rather than hidden or badged: it is in the ranking because "this fired
   zero times" is the answer to a real question, and it must not compete for
   attention with the rules that did fire. Colour alone carries no meaning
   here — the 0 in the count column is the fact. */
tr.idle td { color: var(--muted); }

/* --- traces (task 028) --------------------------------------------------
   The timeline is the page. Everything here works toward one thing: the
   default view scans as a narrative — a column of timestamps, one bold
   phrase each — and every payload sits behind a <details>. */
.hint { color: var(--muted); margin-top: -0.3rem; }
/* A hint that has to be READ before the numbers under it, not skimmed past:
   currently the pre-blinding-reviews warning (#43), which says a contrast on
   this page is drawn across two incomparable cohorts. Muted grey would file it
   with the explanatory prose it sits among, which is exactly where a caveat
   about the validity of the figures must not go.

   Reuses the existing warn family rather than introducing a colour: both
   themes already guarantee --warn-ink on --warn-bg clears AA. */
.hint.warn {
  color: var(--warn-ink); background: var(--warn-bg);
  border-left: 3px solid var(--warn-mark);
  padding: 0.5rem 0.7rem; margin-top: 0.6rem; border-radius: 3px;
}
.crumb { margin: 0 0 0.4rem; font-size: 0.9em; }
.sub { color: var(--muted); font-size: 0.88em; }
.state {
  font-size: 0.75em; padding: 0.1rem 0.5rem; border-radius: 999px;
  border: 1px solid var(--line); white-space: nowrap;
}
.state-answered { background: var(--ok-bg); border-color: var(--ok-line); color: var(--ok-ink); }
.state-awaiting-review { background: var(--warn-bg); border-color: var(--warn-line); color: var(--warn-ink); }
.state-execution-failing { background: var(--bad-bg); border-color: var(--bad-line); color: var(--bad-ink); }

.trace-header {
  background: var(--card); border: 1px solid var(--line); border-radius: 6px;
  padding: 0.8rem 1.1rem;
}
.trace-header dl { margin: 0; display: grid; grid-template-columns: 8rem 1fr; gap: 0.3rem 1rem; }
.trace-header dt { font-weight: 600; color: var(--muted); }
.trace-header dd { margin: 0; }

/* What the user was told (issue #41). Leads the trace, and looks like it:
   the answer text is set at body size in the body face — everything else on
   this page is metadata about how it was arrived at, and rendering the claim
   in the same muted register as the metadata would bury it. */
.trace-answer .answer + .answer { margin-top: 0.8rem; }
.answer-text {
  margin: 0; background: var(--card); border: 1px solid var(--line);
  border-left: 3px solid var(--accent); border-radius: 4px;
  padding: 0.7rem 0.9rem; font-family: inherit; font-size: 1em;
  white-space: pre-wrap; overflow-wrap: anywhere;
}
/* A superseded answer stays legible but stops competing with the one that
   stands — it is context for the revision, not the claim under review. */
.answer-superseded .answer-text { border-left-color: var(--line); color: var(--muted); }
.answer-rank {
  margin: 0 0 0.2rem; font-size: 0.7em; text-transform: uppercase;
  letter-spacing: 0.04em; color: var(--muted);
}
/* An answer resting on a flagged run, or on a plan a human corrected or
   rejected. The claim stays — somebody was told it — but the page stops
   presenting it as one that still stands, which it did while that status
   lived only in the Chain section below the fold. Amber rather than the
   error red: this is "check before you rely on this", not "this failed". */
.answer-concern {
  margin: 0 0 0.4rem; padding: 0.4rem 0.6rem; font-size: 0.85em;
  color: var(--warn-ink); background: var(--warn-bg); border: 1px solid var(--warn-line);
  border-radius: 4px;
}
.answer-clouded .answer-text { border-left-color: var(--warn-mark); }

/* --- the result page (issue #42 §5) --------------------------------------
   templates/result.html, which /viz/{viz_id} and /answer/{answer_id} both
   render. Reuses .answer-text above rather than restyling the claim: the
   same words carry the same weight whether a data-team reader meets them on
   a trace, a requester meets them on the answer's address, or a colleague
   meets them above the chart they arrived for — and two treatments of one
   thing is how they drift apart. Everything here is the frame around it. */
.answer-body { margin: 1rem 0 1.2rem; }
.answer-charts, .answer-evidence { margin: 1.2rem 0; }
.answer-charts h2, .answer-evidence h2 {
  margin: 0 0 0.4rem; font-size: 0.8em; text-transform: uppercase;
  letter-spacing: 0.04em; color: var(--muted); font-weight: 600;
}
.answer-charts ul, .answer-evidence ul { margin: 0; padding-left: 1.1rem; }
.answer-evidence code { font-size: 0.9em; }
.answer-evidence-note { color: var(--muted); font-size: 0.88em; margin: 0.4rem 0 0; }

.timeline { list-style: none; margin: 0; padding: 0 0 0 1rem; border-left: 2px solid var(--line); }
.event {
  position: relative; background: var(--card); border: 1px solid var(--line);
  border-radius: 6px; padding: 0.5rem 0.8rem; margin-bottom: 0.45rem;
}
/* The dot on the rail. Sized/offset to sit centred on the 2px border above. */
.event::before {
  content: ""; position: absolute; left: -1.43rem; top: 0.95rem;
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--line); border: 2px solid var(--bg);
}
/* A logged record is the substance; the call that produced it is scaffolding
   — same rail, deliberately quieter, so the two read as one narrative rather
   than as two interleaved lists. */
.event-audit::before { background: var(--accent); }
.event-tool_call { background: transparent; border-style: dashed; }
.event-clarification::before { background: var(--warn-mark); }
.event-failed { border-color: var(--bad-line); }
/* Which zone the whole stamp column is in, said once beside the heading
   rather than on each of its rows (issue #105). Quiet and small: it is a unit,
   not a heading, and it should read as a footnote on the column. */
.tz-note { color: var(--muted); font-size: 0.72em; font-weight: 400; font-style: normal; margin-left: 0.4rem; }
/* The absolute moment beside a relative one, on the pending review queue: the
   age answers the question the queue asks and this is the fact it was computed
   from, so it is present and it is quiet (issue #148). */
.stamp-exact { color: var(--muted); font-size: 0.85em; }
.event-head { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: baseline; }
.event-ts { color: var(--muted); font-size: 0.85em; font-variant-numeric: tabular-nums; }
.event-label { font-weight: 600; }
/* The call, as code — visibly a different register from the phrase its
   audit record gets, so the pair reads as "this ran, and it logged that". */
.event-call { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.88em; }
.event-kind {
  font-size: 0.7em; text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--muted); border: 1px solid var(--line); border-radius: 999px;
  padding: 0 0.4rem;
}
.event-meta { color: var(--muted); font-size: 0.85em; }
.event-bad { color: var(--bad-ink); font-size: 0.85em; font-weight: 600; }
.event-actor { margin-left: auto; color: var(--muted); font-size: 0.85em; }
.event-ids { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.25rem; }
.id-chip { color: var(--muted); font-size: 0.78em; }
.id-chip code { background: var(--code); padding: 0 0.3rem; border-radius: 3px; }
.event-fields, .event-preview, .event-reason, .event-plan { margin: 0.4rem 0 0; }
.event-fields > summary, .event-preview > summary,
.event-reason > summary, .event-plan > summary {
  font-weight: 400; font-size: 0.86em; color: var(--accent);
}
/* The agent's own 1-2 sentences on why it made this call (task 029). Open by
   default and set in the body face rather than the muted metadata face: it is
   the narrative, not an annotation on it.

   Promotion keys on the field name, so this block also carries
   request_human_review's reason, which is written for a reviewer rather than
   for a trace reader (PR #39 review, finding 1). That still reads correctly
   under "why" — it is why that call was made — so the block is deliberately
   not split per event; only the audience of the sentences varies. */
.event-reason > p {
  margin: 0.2rem 0 0; font-size: 0.9em; border-left: 2px solid var(--line);
  padding-left: 0.6rem;
}
.event-resolved { margin-top: 0.3rem; font-size: 0.9em; }
.event-plan pre, .plan-text {
  margin: 0.3rem 0 0; background: var(--code); border: 1px solid var(--line);
  border-radius: 4px; padding: 0.4rem 0.6rem; font-size: 0.88em;
  /* pre-wrap, so a plan's own line breaks survive (they are its steps) while
     long lines still wrap to the column. */
  white-space: pre-wrap; overflow-wrap: anywhere;
  font-family: inherit;
}
/* A period nobody asked anything in — rendered, not omitted, so a gap in the
   series reads as a gap rather than as adjacency. */
.bucket-empty td { color: var(--muted); }
.event-fields dl { margin: 0.4rem 0 0; display: grid; grid-template-columns: 10rem 1fr; gap: 0.2rem 1rem; }
.event-fields dt { color: var(--muted); font-size: 0.86em; word-break: break-word; }
.event-fields dd { margin: 0; font-size: 0.9em; overflow-wrap: anywhere; }
.event-fields pre {
  margin: 0; background: var(--code); border: 1px solid var(--line); border-radius: 4px;
  padding: 0.4rem 0.6rem; font-size: 0.85em; white-space: pre-wrap;
}
/* Wide result sets scroll inside their own box rather than widening the page. */
.preview-scroll { overflow-x: auto; }

.chain-plan {
  background: var(--card); border: 1px solid var(--line); border-radius: 6px;
  padding: 0.7rem 1.1rem; margin-bottom: 0.6rem;
}
.chain-plan h3 { font-size: 0.98rem; margin: 0 0 0.3rem; }
.chain-exec { margin: 0.5rem 0 0; }
.chain-exec > summary { font-weight: 400; font-size: 0.9em; }

/* --- dashboards (issue #103) ---------------------------------------------
 *
 * A 12-column grid, three widths, and panels packed left to right. The
 * default layout is deliberately boring — first panel full, everything after
 * it half — so that "the agent got the layout wrong" has nowhere to happen;
 * what a human drags is stored on the panel row and this only draws it.
 */
.dash-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 1rem;
  margin: 1rem 0 1.5rem;
  padding: 0.75rem 1rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--card);
}
/* The note saying who last moved the control bar (issue #156). The pull-up is
 * on the ADJACENT-SIBLING rule only: the bar sets its own bottom margin and
 * the note belongs under it rather than floating between it and the first
 * panel — but the note also renders when the bar has been taken off
 * ENTIRELY, which is the case a reader is most likely to be confused by, and
 * there the -1rem would drag it into the header above. */
.dash-controls-edited { margin: 0 0 1.25rem; }
.dash-controls + .dash-controls-edited { margin-top: -1rem; }
/* A link asking for a value the bar no longer offers (PR #192 review). In the
 * --warn family rather than the plain note one: something the reader asked
 * for is not being honoured, and the panels below are drawing something else.
 * It sits ABOVE the bar, so the reader's eye lands on it before the picker
 * they are about to blame. */
.dash-controls-off-bar {
  margin: 1rem 0 0.75rem;
  padding: 0.6rem 0.9rem;
  border: 1px solid var(--warn-line);
  border-radius: 6px;
  background: var(--warn-bg);
  color: var(--warn-ink);
}
.dash-control { display: flex; flex-direction: column; gap: 0.25rem; font-size: 0.9rem; }
.dash-control-label { font-weight: 600; }
.dash-control-sep { padding: 0 0.25rem; }
.dash-control-cap { font-size: 0.75rem; opacity: 0.7; }

.dash-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 1rem;
  align-items: start;
}
.dash-panel {
  position: relative;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.75rem 1rem 1rem;
  background: var(--card);
  min-width: 0;
}
.dash-panel-full  { grid-column: span 12; }
.dash-panel-half  { grid-column: span 6; }
.dash-panel-third { grid-column: span 4; }
/* A width somebody dragged to, in grid columns (3-12). */
.dash-panel.dash-panel-cols { grid-column: span var(--dash-cols); }
@media (max-width: 900px) {
  .dash-panel-half, .dash-panel-third,
  .dash-panel.dash-panel-cols { grid-column: span 12; }
}
.dash-panel.dragging { opacity: 0.5; }

/* The resize corner. Two diagonal strokes in the line colour, so it reads as
 * a grip in either theme without a colour of its own. touch-action: none is
 * what lets a finger drag it instead of scrolling the page. */
.dash-resize {
  position: absolute;
  right: 3px;
  bottom: 3px;
  width: 14px;
  height: 14px;
  cursor: nwse-resize;
  touch-action: none;
  opacity: 0.6;
  background:
    linear-gradient(135deg, transparent 45%, var(--muted) 45%, var(--muted) 55%, transparent 55%) 6px 6px / 8px 8px no-repeat,
    linear-gradient(135deg, transparent 45%, var(--muted) 45%, var(--muted) 55%, transparent 55%) 0 0 / 14px 14px no-repeat;
}
.dash-resize:hover, .dash-panel.resizing .dash-resize { opacity: 1; }
.dash-panel.resizing { outline: 2px dashed var(--accent); outline-offset: 2px; }
/* While a corner is held, the frames must not catch the pointer: a sandboxed
 * iframe under the cursor swallows pointermove and the drag stalls. */
.dash-grid.resizing { user-select: none; cursor: nwse-resize; }
.dash-grid.resizing iframe { pointer-events: none; }

.dash-panel-head { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.dash-panel-head h2 { font-size: 1.05rem; margin: 0; flex: 1 1 auto; }
.dash-drag { cursor: grab; user-select: none; opacity: 0.6; }
.dash-mode {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.1rem 0.4rem;
  border-radius: 999px;
  border: 1px solid var(--line);
}
.dash-mode-fixed { opacity: 0.75; }

/* The way out of a panel and into its analysis (issue #117). Sized with the
 * mode chip beside it rather than with the heading: it is chrome, and the
 * panel's title is what the eye should land on first. */
.dash-source { font-size: 0.8rem; white-space: nowrap; }
.dash-source-none { color: var(--muted); cursor: help; }

/* Both stamps, side by side and equally prominent: how fresh the fetch was
 * and what period it covers are different facts, and a reader deciding
 * whether to act on a number needs both. */
.dash-stamps {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  font-size: 0.8rem;
  opacity: 0.85;
  margin: 0.4rem 0;
}
.dash-cached { opacity: 0.7; }
.dash-params { font-variant-numeric: tabular-nums; }
.dash-note { font-size: 0.8rem; opacity: 0.85; margin: 0.3rem 0; }
.dash-note-warn { font-weight: 600; opacity: 1; }
.dash-ignores { font-style: italic; }

.dash-frame {
  width: 100%;
  min-height: 320px;
  border: 0;
  border-radius: 4px;
  /* No background of our own: the artifact paints its own surface, and since
     issue #115 that surface is the token for the theme this page is in — so a
     colour here would be a second answer to the same question, and now a
     second answer that could disagree. */
}
/* A height somebody dragged to. Outranked by `.viz-stage:fullscreen iframe`,
 * which is the point: fullscreen still fills the screen. */
.dash-panel-sized .dash-frame {
  height: var(--dash-frame-h);
  min-height: 0;
}
.dash-empty { margin: 1rem 0; }
.dash-refresh-all { margin-left: auto; }

/* --- a saved chart's own control bar (issue #119) -------------------------
 *
 * Deliberately the same vocabulary as the dashboard's bar (.dash-control and
 * friends are reused rather than re-styled): a date picker over a chart and a
 * date picker over a dashboard do the same thing, and making them look
 * different would be a claim that they do not.
 */
.viz-refresh-bar {
  display: flex;
  flex: 1 1 0;
  min-width: 0;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.55rem;
  margin: 0;
}
.viz-refresh-bar .dash-control { margin: 0; }
.viz-stage-tools .viz-refresh {
  background: var(--accent); color: var(--on-accent);
  border-color: var(--accent); font-weight: 600;
}
.viz-stage-tools .viz-refresh:hover:not(:disabled) {
  background: var(--accent); filter: brightness(1.08);
}
.viz-stage-tools .viz-refresh:disabled {
  background: var(--code); border-color: var(--line); color: var(--muted);
}
.viz-refresh-note { font-size: 0.8rem; opacity: 0.85; }
.viz-refresh-explainer { margin: 0.25rem 0 0.75rem; }
/* The two facts a control bar owes a reader who did not put it there
 * (issue #132 review): that one of these controls moves the POPULATION out
 * from under the review, and that somebody other than the chart's owner set
 * these controls. Both sit with the explainer above rather than in the banner
 * stack — a banner says a claim may be wrong, and neither of these does. The
 * population line is the louder of the two because a reader can act on it in
 * one click. */
.viz-refresh-population { margin: 0 0 0.75rem;
                          border-left: 3px solid var(--line);
                          padding-left: 0.6rem; }
.viz-refresh-edited { margin: 0 0 0.75rem; }
/* Louder than the review banners it sits beside is wrong; as quiet as a note
 * is also wrong. This says the numbers on screen are not the ones the answer
 * describes, which a reader has to see before reading either. */
.viz-live-banner a { text-decoration: underline; }

/* ---- release filtering and the phase comparison (issue #147) ----------- */

/* The version control sits beside the window in the same form, and unlike
   the window it holds a label rather than a number — the 5rem the inputs
   take would truncate "build 4b9776ee · estimated" to nothing useful. */
.window-form select { padding: 0.25rem 0.4rem; max-width: 22rem; }

/* The version comparison's two cuts (issue #155): one row per cut, and the
   row IS the form — its own button, its own mode, nothing to fall out of
   step with the controls beside it.

   A rule between the two rather than a box around each: the pair reads as
   one control with two ways in, and two boxes read as two unrelated
   settings. */
.compare-forms { margin-bottom: 1rem; }
.compare-forms .compare-mode {
  display: flex; flex-wrap: wrap; gap: 0.9rem; align-items: baseline;
  border-top: 1px solid var(--line);
  margin: 0 0 0.5rem; padding: 0.6rem 0 0;
}
.compare-forms .compare-mode:first-child { border-top: 0; padding-top: 0; }
.compare-forms .mode-name { font-weight: 600; color: var(--ink); }
/* The row the page is currently showing a table for, so a reader arriving on
   a link can see which of the two produced what is below it. The name takes
   the accent colour rather than the row taking a background: these are form
   rows, and a filled one reads as a disabled one. */
.compare-forms .compare-mode.active .mode-name { color: var(--accent); }
.compare-forms .compare-mode .hint { margin: 0; font-size: 0.85em; }

/* Which release the page is scoped to leads the tab, so a reader cannot get
   two sections down before learning the numbers are about one build. */
.release-banner h2 { margin-bottom: 0.3rem; }
table.stats tr.current > td { font-weight: 600; }
table.stats tr.current > td:first-child { border-left: 3px solid var(--accent); }

/* A summed total is a different kind of row from the ones above it and is
   read as one — the whole reason these phases are means rather than medians
   is so this line means something. */
table.stats tr.total > th, table.stats tr.total > td {
  border-top: 2px solid var(--line); border-bottom: none;
}

/* Faster and slower, in the theme's own good/bad inks rather than a bare
   green and red: this page renders in both themes and a hardcoded #1c5c38
   on the dark card is unreadable. Never colour ALONE — every such cell also
   carries an arrow and the word "faster" or "slower", because a reader who
   cannot separate the two hues still has to be able to read the table. */
table.stats td.better { color: var(--ok-ink); }
table.stats td.worse { color: var(--bad-ink); }

/* ---- time to answer, on a trace (issue #147) --------------------------- */

/* Leads the trace above the answer, and looks like a headline: the figure is
   the one thing this section exists to say, and setting it in the same
   register as the metadata around it would bury it exactly as the answer
   text would have been buried. */
.trace-timing { margin-bottom: 1.2rem; }
.trace-timing .timing + .timing {
  margin-top: 1rem; padding-top: 0.9rem; border-top: 1px solid var(--line);
}
.timing-headline { margin: 0 0 0.4rem; }
.timing-figure { font-size: 1.5em; margin-right: 0.5rem; }
.timing-ordinal {
  display: inline-block; margin-right: 0.5rem; font-size: 0.7em;
  text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted);
}
/* The per-thread breakdown is support for the figure, not a second table of
   record — narrower than the page and quieter than the number above it. */
.timing-phases { max-width: 32rem; font-size: 0.92em; }

/* --- folders and tags (issue #170) ------------------------------------------

   THE SHELF: a nav rail on the left of Browse, /dashboards and /archive, the
   filing controls on a row and on a detail page, and the management page.

   `main.wide` is the class those three pages still opt into
   (base.html's main_class block). The width itself is `--page-width`, shared
   with the header bar, so the rail and the results sit on the same column. */
main.wide { max-width: var(--page-width); }

/* The events catalog brings its own sidebar and width, so its page gives it
   everything below the header — however tall a wrapped header makes that. */
body:has(main.fullbleed) { height: 100vh; display: flex; flex-direction: column; }
main.fullbleed {
  max-width: none; margin: 0; padding: 0; flex: 1; min-height: 0;
  display: flex; flex-direction: column;
}
.events-bar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem 1.2rem;
  padding: 0.5rem 1rem; border-bottom: 1px solid var(--line);
  background: var(--card); font-size: 0.9rem;
}
.events-title { font-size: 1rem; margin: 0; }
.events-source { color: var(--muted); }
.events-version { margin-left: auto; display: flex; align-items: center; gap: 0.5rem; }
.events-version select { font-size: inherit; }
.events-frame { display: block; width: 100%; flex: 1; min-height: 0; border: 0; }

.shelf-layout {
  display: grid;
  grid-template-columns: 13rem minmax(0, 1fr);
  gap: 1.8rem;
  align-items: start;
}
/* One column on a narrow window, rail first: it is navigation, and a filter
   the reader has to scroll past the whole list to reach is not one. */
@media (max-width: 900px) {
  .shelf-layout { grid-template-columns: 1fr; gap: 0.8rem; }
  .shelf { position: static; }
}
.shelf {
  position: sticky; top: 1rem;
  border: 1px solid var(--line); border-radius: 6px;
  background: var(--card); padding: 0.7rem 0.8rem 0.9rem;
}
.shelf-heading {
  font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--muted); margin: 0.6rem 0 0.35rem; font-weight: 700;
}
.shelf-heading:first-child { margin-top: 0; }
.shelf-list { list-style: none; margin: 0; padding: 0; }
.shelf-row {
  display: flex; align-items: baseline; gap: 0.4rem;
  padding: 0.24rem 0.4rem; border-radius: 4px;
  color: var(--ink); text-decoration: none;
  border: 1px solid transparent;
}
.shelf-row:hover { background: var(--code); }
.shelf-row.active { background: var(--code); font-weight: 600; }
.shelf-count {
  margin-left: auto; color: var(--muted); font-size: 0.82em;
  font-variant-numeric: tabular-nums;
}
.shelf-empty { color: var(--muted); font-size: 0.86em; margin: 0.2rem 0.4rem; }
.tag-add button, .label-rename button {
  background: transparent; color: var(--muted);
  border: 1px solid var(--line); border-radius: 999px;
  padding: 0.1rem 0.6rem; font: inherit; font-size: 0.8em; cursor: pointer;
}
.tag-add button:hover,
.label-rename button:hover { color: var(--ink); border-color: var(--accent); }
.shelf-manage { margin: 0.7rem 0 0; font-size: 0.82em; }

/* Every folder a row is in, in its meta line, each one a link into that
   filter — the same affordance the tag chips beside them have, since issue
   #194 made the two the same shape.

   SQUARE where a tag chip is round, and muted where a tag chip is coloured.
   They behave alike now, so the look is the only thing left saying which
   vocabulary a name belongs to: a folder is the small curated set the rail
   lists, a tag is the open one. */
.folder-chips { display: inline-flex; flex-wrap: wrap; gap: 0.3rem; }
.folder-chip {
  display: inline-flex; align-items: center; gap: 0.15rem;
  border: 1px solid var(--line); border-radius: 4px;
  padding: 0 0.35rem; color: var(--muted); font-size: 0.9em;
  text-decoration: none;
}
.folder-chip:hover { border-color: var(--accent); color: var(--ink); }
.tag-chips { display: inline-flex; flex-wrap: wrap; gap: 0.3rem; }
.tag-chip {
  display: inline-flex; align-items: center; gap: 0.15rem;
  border: 1px solid var(--info-line); background: var(--info-bg);
  color: var(--info-ink); text-decoration: none;
  border-radius: 999px; padding: 0 0.45rem; font-size: 0.82em;
}
.tag-chip:hover { border-color: var(--accent); }

.organize {
  display: flex; flex-wrap: wrap; align-items: center;
  gap: 0.4rem 1.1rem; margin: 0.2rem 0 0.8rem;
}
.tag-editor { display: flex; flex-wrap: wrap; align-items: center; gap: 0.3rem; }
/* Bigger than the chips beside it (folder-chip is 0.9em, tag-chip 0.82em) so
   the label reads as the heading of the row rather than a peer of what it is
   labelling — and blue on this one, since it is the label for the coloured
   half of the pair (client feedback). .folder-editor-label is its muted twin,
   sized the same so the two rows still line up. */
.tag-editor-label { color: var(--accent); font-size: 1em; font-weight: 500; }
.folder-editor-label { color: var(--muted); font-size: 1em; font-weight: 500; }
.tag-none { color: var(--muted); font-size: 0.82em; }
/* The chip and its × are one visual object made of two elements, because the
   × has to be its own form — a button inside a link is not a thing. */
.tag-chip-editable { padding-right: 0.15rem; }
.tag-chip-editable form { display: inline; }
.tag-remove {
  background: transparent; border: 0; cursor: pointer;
  color: inherit; font: inherit; line-height: 1;
  padding: 0 0.25rem; opacity: 0.7;
}
.tag-remove:hover { opacity: 1; }
.tag-add { display: inline-flex; gap: 0.3rem; }
.tag-add input {
  background: var(--bg); color: var(--ink);
  border: 1px solid var(--line); border-radius: 999px;
  padding: 0.1rem 0.5rem; font: inherit; font-size: 0.82em; width: 9rem;
}
/* The folder editor's add control is a PICKER, not a box: a folder that does
   not exist is not created by typing it here (_shelf.html says why), so the
   control offers the list instead of completing against it. */
.tag-add select {
  background: var(--bg); color: var(--ink);
  border: 1px solid var(--line); border-radius: 999px;
  padding: 0.1rem 0.4rem; font: inherit; font-size: 0.82em;
  cursor: pointer; max-width: 11rem;
}
/* The tag editor's twin, laid out identically — the two sit side by side in
   `.organize` and reading them as one control is the point. */
.folder-editor {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.3rem;
}
.folder-chip-editable { padding-right: 0.15rem; }
.folder-chip-editable form { display: inline; }
/* The way to /labels from the page where you notice you need it. Muted: it is
   an escape hatch beside the control, not a peer of it. */
.tag-manage { color: var(--muted); font-size: 0.78em; }

/* The management page. One row per label: the name IS the rename box, the
   counts say what a press would move, and Archive/Restore sits at the end. */
.label-list { list-style: none; padding: 0; margin: 0 0 0.8rem; }
.label-row {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem;
  padding: 0.4rem 0; border-bottom: 1px solid var(--line);
}
.label-row.label-archived { opacity: 0.72; }
.label-rename { display: inline-flex; gap: 0.3rem; }
.label-rename input {
  background: var(--bg); color: var(--ink);
  border: 1px solid var(--line); border-radius: 4px;
  padding: 0.15rem 0.4rem; font: inherit; width: 13rem;
}
.label-count { color: var(--muted); font-size: 0.86em; }
.label-state { color: var(--muted); font-size: 0.82em; }
.label-row .archive-form { margin-left: auto; }
.label-new { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; margin: 0 0 0.6rem; }
.label-new input {
  background: var(--bg); color: var(--ink);
  border: 1px solid var(--line); border-radius: 4px;
  padding: 0.15rem 0.4rem; font: inherit; width: 13rem;
}
.label-new button {
  background: transparent; color: var(--muted);
  border: 1px solid var(--line); border-radius: 999px;
  padding: 0.1rem 0.6rem; font: inherit; font-size: 0.8em; cursor: pointer;
}
.label-new button:hover { color: var(--ink); border-color: var(--accent); }
/* Closed by default (labels.html says why): a reader who came to tidy up is
   looking at what is active, not the folders retired months ago. Same
   disclosure pattern as .badge-legend, and it opens to a list of the exact
   same row shape live ones use, Restore standing in for Archive. */
.label-archived-group { margin: 1.2rem 0 0; font-size: 0.92em; }
.label-archived-group > summary { color: var(--accent); cursor: pointer; }
.label-archived-group .label-list { margin-top: 0.5rem; }

/* --- renaming (issue #195) ---------------------------------------------------

   A disclosure, a field and a button, on a chart's page, a dashboard's and
   every panel of one. _rename.html argues why it is behind a <summary> here
   and open on /labels: the name is already the heading on these pages, and a
   second copy of it in an open input beside every panel reads as a form
   somebody left half-filled.

   Quiet by default — the summary is a muted word, like `.tag-manage` beside
   the tag box — because renaming is the rarest press on these pages and
   should be findable rather than inviting. */
.rename { margin: 0.4rem 0 0.2rem; }
.rename > summary {
  color: var(--muted); font-size: 0.78em; cursor: pointer;
  display: inline-block; list-style: none;
}
.rename > summary::-webkit-details-marker { display: none; }
.rename > summary::before { content: "✎ "; }
.rename > summary:hover { color: var(--ink); }
.rename-form {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem;
  margin: 0.35rem 0 0;
}
.rename-label { color: var(--muted); font-size: 0.78em; }
.rename-form input {
  background: var(--bg); color: var(--ink);
  border: 1px solid var(--line); border-radius: 4px;
  padding: 0.15rem 0.4rem; font: inherit;
  /* Wider than a label's box: these are headings of a few words, and one that
     scrolls sideways while being edited is one the reader cannot check. */
  flex: 1 1 22rem; min-width: 0; max-width: 34rem;
}
.rename-form button {
  background: transparent; color: var(--muted);
  border: 1px solid var(--line); border-radius: 999px;
  padding: 0.1rem 0.6rem; font: inherit; font-size: 0.8em; cursor: pointer;
}
.rename-form button:hover { color: var(--ink); border-color: var(--accent); }
/* The sentence under the box: what this name is for, and what the braces do.
   `code` for the placeholder names so they read as things to type. */
.rename-hint {
  color: var(--muted); font-size: 0.8em; margin: 0.3rem 0 0;
  max-width: 46rem;
}
.rename-hint code {
  background: var(--code); border-radius: 3px; padding: 0 0.2rem;
  font-size: 0.95em;
}
/* Who last changed the name, on the meta line of a page and the stamps line of
   a panel. Muted like everything else on those lines; the `title` attribute
   carries the session handle for anyone matching it against the audit log. */
.renamed-line { color: var(--muted); }

/* --- the handouts index (issue #212) ---------------------------------------
   Four rows, one per sheet, on the page the header's Help link opens. A list
   rather than a grid of tiles: they have a reading order (handouts.SHEETS says
   which and why), and a grid reads as four equal choices when the first one
   is the one a new reader wants. */
.help-list { list-style: none; padding: 0; margin: 1.2rem 0 0; }
.help-list li {
  border-top: 1px solid var(--line);
  padding: 0.9rem 0;
}
.help-list li:last-child { border-bottom: 1px solid var(--line); }
.help-row { display: flex; align-items: baseline; gap: 0.6rem; flex-wrap: wrap; }
.help-title { font-weight: 600; text-decoration: none; font-size: 1.05em; }
/* "Start here" / "One page" / "Read once" — what the sheet costs to read,
   which is the thing a reader is actually choosing between. Styled as the
   muted chips elsewhere on this site rather than as a badge: it carries no
   verdict about anything. */
.help-kicker {
  font-size: 0.72em; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--muted); border: 1px solid var(--line);
  border-radius: 999px; padding: 0.1rem 0.5rem;
}
.help-blurb { margin: 0.3rem 0 0; color: var(--muted); max-width: 52rem; }
