/* Kumii v4 — the dashboard in the approved builder's look. Layout, rail, panels, chart chrome.
 *
 * NO HEX CODES IN THIS FILE. Every colour is a token from tokens.css, which is the only file
 * allowed to name one. If you need a colour that is not there, add a token; do not inline it, or
 * the next theme costs a search-and-replace.
 *
 * WHERE THE LOOK COMES FROM. Rob, 2026-10-06: the builder (v3) was approved after this dashboard
 * was drawn, and the two must read as one product. So the chrome below is the builder's, taken
 * from ../../v3/css/builder.css by value and never linked: near-black INK as the pressed state and
 * the send button, white outlined buttons at radius 8, small uppercase grey section heads, white
 * cards at radius 12 on the warm grey ground, the floating ask bar at radius 16, and blue only for
 * focus and selection. Nothing here introduces a hue.
 *
 * WHAT DID NOT CHANGE, AND MUST NOT: every data mark keeps its validated colour, and the
 * containment rule stands - a brand hue and a band hue never share a panel (CLAUDE.md). The
 * chrome carries neither. Its whole chromatic palette is --dash-accent plus --dash-warn, the same
 * two the builder's chrome uses.
 *
 * LIGHT BY DEFAULT, DARK KEPT. Every rule is written in tokens, so the dark block of tokens.css
 * re-themes the same rules: ink on panel becomes near-white on near-black. That is the builder's
 * monochrome move inverted, not a second design to keep in step.
 */

*, *::before, *::after { box-sizing: border-box; }

/* The `hidden` attribute is only display:none in the UA stylesheet, so any later `display` on the
   same element beats it and a hidden control stays on screen and in the tab order. Same fix as
   the builder's, and the panel footers rely on it. */
[hidden] { display: none !important; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--dash-bg);
  color: var(--dash-ink);
  font-family: var(--dash-font);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* Numbers that are read in columns must not dance as they change. Tabular figures everywhere a
   figure sits next to another figure. */
.hero, .tick, .n, .delta, .rate, .theme-n, .reply-score, .brandrow-score, .knob-value {
  font-variant-numeric: tabular-nums;
}

button, input, select, textarea { font: inherit; color: inherit; }

/* The browser's own parts - scrollbars, the caret, a prompt's field - follow the theme. The rail and
   the stage scroll on their own now, and without this they kept light scrollbars on the dark page. */
html[data-theme="light"] { color-scheme: light; }
html[data-theme="dark"]  { color-scheme: dark; }

/* One visible focus treatment for the whole page, the builder's. Never remove it - a keyboard
   user who cannot see where they are has no way back. */
:focus-visible {
  outline: 2px solid var(--dash-accent);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ---------------------------------------------------------------- frame
 *
 * The builder's app frame: the page is exactly the window, the top bar stays put, and the rail and
 * the panels scroll on their own. v1 scrolled the whole page and kept only its cockpit sticky - but
 * the questionnaire switch lives on the top bar now, and a switch that scrolls away with the first
 * row of panels is a filter nobody can reach from the last one.
 */

.dash {
  height: 100vh;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}

.work { display: grid; min-height: 0; }

/* The builder's rail is 300px. Same width here, so the two pages put their content edge in the
   same place. */
:root { --rail: 300px; }

/* The dock. LEFT by default (js/layout.js), where the builder's rail is; the other three sides
   stay a choice while the layout is unlocked. */
[data-dock="left"]   .work { grid-template-columns: var(--rail) minmax(0, 1fr); grid-template-areas: "ck stage"; }
[data-dock="right"]  .work { grid-template-columns: minmax(0, 1fr) var(--rail); grid-template-areas: "stage ck"; }
[data-dock="top"]    .work { grid-template-rows: auto minmax(0, 1fr); grid-template-areas: "ck" "stage"; }
[data-dock="bottom"] .work { grid-template-rows: minmax(0, 1fr) auto; grid-template-areas: "stage" "ck"; }

.cockpit { grid-area: ck; min-height: 0; overflow-y: auto; }

/* The stage scrolls; the ask bar inside it is sticky to its foot (see the ask bar below). A flex
   column, so the grid can grow to fill a tall window and the bar still sits at the bottom of it
   rather than under a short grid halfway down the screen. */
.stage {
  grid-area: stage;
  min-width: 0; min-height: 0;
  overflow-y: auto;
  display: flex; flex-direction: column;
}

/* ---------------------------------------------------------------- top bar */

/* The builder's: the questionnaire switch on the left where the builder has its form switch, the
   page's own controls on the right. Named .top as there, NOT v1's .bar - every chart column is a
   <rect class="bar">, and v1's top-bar rule was silently matching all of them. */
.top {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 16px;
  padding: 10px 20px;
  background: var(--dash-panel);
  border-bottom: 1px solid var(--dash-line);
}

/* min-width:0 lets these columns shrink inside the 1fr track, and flex-wrap is the second guard,
   for German labels that run wider than English ones. The builder learned both the hard way. */
.top-l, .top-r { display: flex; align-items: center; gap: 8px; min-width: 0; flex-wrap: wrap; }
.top-r { justify-content: flex-end; }

/* ---------------------------------------------------------------- controls (the builder's) */

.bbtn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 7px 14px;
  border: 1px solid var(--dash-line);
  border-radius: 8px;
  background: var(--dash-panel);
  cursor: pointer;
  white-space: nowrap;
  font-weight: 500;
  color: var(--dash-ink);
  text-decoration: none;
}
.bbtn:hover { background: var(--dash-panel-2); }
.bbtn:disabled { opacity: .4; cursor: default; }
.bbtn--ghost { background: transparent; border-color: transparent; color: var(--dash-ink-2); }
.bbtn--ghost:hover { color: var(--dash-ink); background: var(--dash-panel-2); }
.bbtn--sm { padding: 5px 10px; font-size: 12.5px; }
.bbtn--block { display: flex; width: 100%; }

/* The joined switch: the questionnaire choice, the interface language, the theme. Pressed is INK,
   as in the builder - monochrome, so it spends neither status hue on a control. */
.bseg {
  display: inline-flex;
  border: 1px solid var(--dash-line);
  border-radius: 8px;
  overflow: hidden;
  background: var(--dash-panel);
}
.bseg button {
  padding: 6px 12px;
  border: 0;
  border-right: 1px solid var(--dash-line);
  background: transparent;
  cursor: pointer;
  color: var(--dash-ink-2);
  font-weight: 500;
  white-space: nowrap;
}
.bseg button:last-child { border-right: 0; }
.bseg button:hover { color: var(--dash-ink); background: var(--dash-panel-2); }
.bseg button[aria-pressed="true"] { background: var(--dash-ink); color: var(--dash-panel); }
/* The group clips its children to round its corners, which would also clip a focus ring drawn
   outside the button. Inside, it stays whole. */
.bseg button:focus-visible { outline-offset: -3px; }

.langpick button { padding: 6px 10px; font-size: 12px; font-weight: 600; letter-spacing: .04em; }
.bseg--icons button { padding: 6px 9px; display: grid; place-items: center; }
.bseg--icons svg { width: 15px; height: 15px; display: block; }

.chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid var(--dash-line);
  background: var(--dash-panel);
  color: var(--dash-ink-2);
  font-size: 11px; font-weight: 600; letter-spacing: .02em;
  white-space: nowrap;
}

.linkbtn {
  border: 0; background: none; padding: 0 4px; cursor: pointer;
  font-size: 12px; color: var(--dash-ink-2);
  text-decoration: underline; text-underline-offset: 2px;
  white-space: nowrap;
}
.linkbtn:hover { color: var(--dash-ink); }

/* The rail's choices: the builder's button, pressed in ink, in a row that wraps. Four periods or
   four comment groups do not fit one 268px line, and a joined switch cannot break across two. */
.seg { display: flex; flex-wrap: wrap; gap: 6px; }
.seg .seg-btn {
  flex: 1 1 auto; min-width: 0;
  padding: 6px 10px;
  border: 1px solid var(--dash-line); border-radius: 8px;
  background: var(--dash-panel); color: var(--dash-ink-2);
  font-size: 12.5px; font-weight: 500; text-align: center;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  cursor: pointer;
}
.seg .seg-btn:hover { background: var(--dash-panel-2); color: var(--dash-ink); }
.seg .seg-btn[aria-pressed="true"] {
  background: var(--dash-ink); border-color: var(--dash-ink); color: var(--dash-panel);
  font-weight: 600;
}
.seg .seg-btn--icon { flex: 0 0 auto; width: 36px; height: 30px; display: grid; place-items: center; padding: 0; }

/* The dock picker draws four little diagrams of where the rail will go, because "top / right /
   bottom / left" as words needs a moment of thought that a picture does not. */
.dock-ico { width: 13px; height: 11px; border: 1.5px solid currentColor; border-radius: 2px; position: relative; }
.dock-ico::after { content: ""; position: absolute; background: currentColor; }
.dock-ico--right::after  { inset: 0 0 0 auto; width: 4px; }
.dock-ico--left::after   { inset: 0 auto 0 0; width: 4px; }
.dock-ico--bottom::after { inset: auto 0 0 0; height: 4px; }
.dock-ico--top::after    { inset: 0 0 auto 0; height: 4px; }

/* Unlocked is a mode the page is in, so the button wears the builder's pressed ink while it lasts. */
.lockbtn[aria-pressed="true"] { background: var(--dash-ink); border-color: var(--dash-ink); color: var(--dash-panel); }
.lockbtn[aria-pressed="true"]:hover { background: var(--dash-ink); opacity: .85; }

/* A padlock drawn in CSS: the shackle is a bordered half-circle that swings open when unlocked,
   so the control shows its state rather than only naming it. */
.lock-ico { position: relative; width: 11px; height: 13px; display: inline-block; }
.lock-ico::before {
  content: ""; position: absolute; inset: auto 0 0 0; height: 7px;
  border: 1.5px solid currentColor; border-radius: 2px;
}
.lock-ico::after {
  content: ""; position: absolute; left: 2px; top: 0; width: 7px; height: 7px;
  border: 1.5px solid currentColor; border-bottom: 0;
  border-radius: 4px 4px 0 0;
  transition: transform var(--t-fast, 140ms) ease, left var(--t-fast, 140ms) ease;
}
.lockbtn[aria-pressed="true"] .lock-ico::after { transform: rotate(-24deg); left: 5px; }

/* ---------------------------------------------------------------- the rail */

.cockpit { padding: 16px; background: var(--dash-panel); }
[data-dock="left"]   .cockpit { border-right: 1px solid var(--dash-line); }
[data-dock="right"]  .cockpit { border-left: 1px solid var(--dash-line); }
[data-dock="top"]    .cockpit { border-bottom: 1px solid var(--dash-line); }
[data-dock="bottom"] .cockpit { border-top: 1px solid var(--dash-line); }

/* Docked along the top or the bottom, the rail lies across the page instead of down it: its
   sections sit side by side, and it gets a ceiling with a scroll of its own, or a 900px column of
   filters would push the panels off the screen. */
[data-dock="top"] .cockpit,
[data-dock="bottom"] .cockpit {
  max-height: 42vh;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 0 28px;
  align-items: start;
}

.field { margin-bottom: 22px; }

/* The builder's rail head (QUESTIONS, ENDINGS, LIBRARY) and inspector head (ANSWER TYPE). */
.field-label {
  margin: 0 0 8px;
  font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase;
  color: var(--dash-ink-3);
}
.field-sub { margin: 0 0 6px; font-size: 12px; color: var(--dash-ink-3); }
.field-note { margin: 8px 0 0; font-size: 12px; line-height: 1.45; color: var(--dash-ink-3); }
.field .bbtn--block { margin-top: 10px; }

/* The demo block. Scaffolding, not product - set apart behind a dashed edge, the way the builder
   draws a surface with nothing in it, so nobody reviewing the prototype mistakes it for a feature
   the marketing team would get. */
.demo-block {
  margin-top: 2px; padding: 12px;
  border: 1px dashed var(--dash-line); border-radius: 10px;
}
.demo-title {
  margin: 0 0 8px;
  font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase;
  color: var(--dash-ink-3);
}
.demo-note { margin: 8px 0 0; font-size: 12px; line-height: 1.45; color: var(--dash-ink-3); }

/* ---------------------------------------------------------------- grid + panels */

.grid {
  flex: 1 0 auto;
  display: grid;
  grid-template-columns: repeat(var(--cols, 3), minmax(0, 1fr));
  gap: 16px;
  padding: 20px;
  align-content: start;
  min-width: 0;
}

/* A panel is a builder card: white on the warm grey ground, radius 12, a hairline edge and the
   faint shadow the builder's workflow card has at rest. No grey footer band - the builder
   separates with hairlines, never with a second fill. */
.panel {
  display: flex; flex-direction: column;
  min-width: 0;
  border: 1px solid var(--dash-line);
  border-radius: 12px;
  background: var(--dash-panel);
  box-shadow: 0 1px 2px rgba(0, 0, 0, .05);
  overflow: hidden;
}

.panel-head {
  display: flex; align-items: center; gap: 8px;
  padding: 14px 16px 2px;
}
.panel-title {
  margin: 0; flex: 1 1 auto; min-width: 0;
  font-size: 14px; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.panel-body {
  padding: 10px 16px 16px; flex: 1 1 auto; min-width: 0;
  /* Grid rows stretch every panel to the tallest in the row, so short panels carry slack.
     space-between LOOKS like the fix and is not: it floats the band strip away from the hero
     number it belongs to. Only the trailing "n = " line is pushed down, via margin-top:auto
     below — everything else stays grouped with what it describes. */
  display: flex; flex-direction: column; gap: 8px;
}
.panel-body > .n { margin-top: auto; }

/* The caveats live here - incentivised, invented, too few to trust. A hairline, not a band of
   colour: they are part of the panel, not an appendix to it. */
.panel-foot {
  padding: 10px 16px 12px;
  border-top: 1px solid var(--dash-line);
  font-size: 12px; line-height: 1.45;
  color: var(--dash-ink-3);
}

/* The grip and the width button only exist while unlocked. Hiding them when locked keeps the
   header quiet in the state the page spends nearly all its time in. */
.grip, .widthbtn { display: none; }
[data-locked="false"] .grip {
  display: block; width: 9px; height: 13px; cursor: grab; flex: 0 0 auto;
  background-image: radial-gradient(currentColor 1px, transparent 1px);
  background-size: 4px 4px;
  color: var(--dash-ink-3);
}
[data-locked="false"] .widthbtn {
  display: grid; place-items: center;
  width: 26px; height: 24px; flex: 0 0 auto; cursor: pointer;
  border: 1px solid var(--dash-line); border-radius: 6px;
  background: var(--dash-panel); color: var(--dash-ink-2);
  font-size: 11px; font-weight: 600;
}
[data-locked="false"] .widthbtn:hover { background: var(--dash-panel-2); }
[data-locked="false"] .panel { border-style: dashed; }
[data-locked="false"] .panel:hover { border-color: var(--dash-ink-3); }

.panel.is-dragging { opacity: .35; }
.panel.is-over-before { box-shadow: inset 3px 0 0 var(--dash-accent); }
.panel.is-over-after  { box-shadow: inset -3px 0 0 var(--dash-accent); }

.panel-empty { margin: 0; padding: 18px 0; color: var(--dash-ink-3); font-size: 13px; text-align: center; }

/* "Not asked in this questionnaire" is a different claim from "no rows matched", and it is the
   more interesting one — it names a limit of the instrument rather than a shortage of data. */
.panel-empty--na { text-align: left; line-height: 1.5; padding: 12px 0; }

/* ---------------------------------------------------------------- tiles */

.tile { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.hero { margin: 0; font-size: 40px; line-height: 1; font-weight: 300; letter-spacing: -.02em; }
.hero--empty { color: var(--dash-ink-3); }
.tile-side { text-align: right; }
.scale { margin: 0; font-size: 12px; color: var(--dash-ink-3); }
.rate { margin: 2px 0 0; font-size: 15px; font-weight: 600; }
.n { margin: 8px 0 0; font-size: 12px; color: var(--dash-ink-3); }

.delta { display: inline-block; margin-top: 3px; font-size: 12px; font-weight: 600; }
.delta--up { color: var(--band-promoter); }
.delta--down { color: var(--band-detractor); }
.delta--flat { color: var(--dash-ink-3); }

/* ---------------------------------------------------------------- charts
 *
 * Unchanged from v1 apart from the tooltip's shape. The marks' colours are the validated palette,
 * and the tick sizes are what the charts' own label spacing was worked out against.
 */

.chart { display: block; max-width: 100%; overflow: visible; }

/* Named .gridline, NOT .grid: the panel container is .grid, and a bare .grid rule would also
   match <line class="grid"> inside every SVG and hand it display:grid and 20px of padding. */
.chart .gridline { stroke: var(--dash-grid); stroke-width: 1; }
.chart .gridline--zero { stroke: var(--dash-ink-3); stroke-width: 1; opacity: .55; }

.chart .tick { fill: var(--dash-ink-3); font-size: 9.5px; }
.chart .tick--y { text-anchor: end; }
.chart .tick--x { text-anchor: middle; }
.chart .tick--row { text-anchor: start; fill: var(--dash-ink-2); font-size: 11px; }
.chart .tick--val { fill: var(--dash-ink-2); font-size: 10.5px; font-weight: 600; }
.chart .tick--seg { fill: var(--dash-ink-2); font-size: 9.5px; }

.chart .trend { fill: none; stroke: var(--dash-ink); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; opacity: .55; }
.chart .trend--brand { opacity: 1; }
.chart .trend--spark { stroke: var(--dash-accent); opacity: .85; }
.chart .dot { stroke: var(--dash-panel); stroke-width: 2; }

.chart .hit { fill: transparent; }
.chart .hit:hover { fill: var(--dash-ink); fill-opacity: .045; }
.chart .crosshair { stroke: var(--dash-ink-3); stroke-width: 1; stroke-dasharray: 3 3; pointer-events: none; }

/* The current, unfinished month. Marked so a partial bar does not read as a collapse — the same
   trap the notebook console marks with an asterisk on its current week. */
.chart .bar--partial { opacity: .55; }

/* The builder's popover shape: white, hairline, radius 10, its shadow. */
.chart-tip {
  position: fixed; top: 0; left: 0; z-index: 60;
  max-width: 260px; padding: 8px 11px;
  border: 1px solid var(--dash-line); border-radius: 10px;
  background: var(--dash-panel); color: var(--dash-ink);
  box-shadow: var(--dash-shadow);
  font-size: 12px; line-height: 1.45;
  pointer-events: none; opacity: 0;
  transition: opacity 100ms ease;
}
.chart-tip.is-on { opacity: 1; }
.chart-tip b { display: block; font-size: 11.5px; margin-bottom: 1px; }
.chart-tip span { color: var(--dash-ink-2); }

/* ---------------------------------------------------------------- legend
 *
 * Present whenever a chart carries two or more series. Identity must never rest on colour alone —
 * that is what makes the light-mode promoter green legal at 2.33:1 against the surface.
 */

.legend { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 10px; }
.key { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--dash-ink-2); }
.sw { width: 9px; height: 9px; border-radius: 2px; flex: 0 0 auto; }
.sw--promoter { background: var(--band-promoter); }
.sw--passive { background: var(--band-passive); }
.sw--detractor { background: var(--band-detractor); }
.sw--keune { background: var(--series-keune); }
.sw--miiki { background: var(--series-miiki); }
.sw--trend { background: var(--dash-ink); opacity: .55; height: 2px; border-radius: 1px; }
.sw--hatch {
  background: repeating-linear-gradient(45deg,
    var(--dash-hatch) 0 2px, var(--dash-panel) 2px 4px);
}

/* ---------------------------------------------------------------- delivery faces */

.face-row { display: flex; justify-content: space-between; margin-top: 2px; }
.face-slot { flex: 1 1 0; display: grid; place-items: center; opacity: .3; }
.face-slot.is-mean { opacity: 1; }
.face-slot .face { width: 20px; height: 20px; display: block; }
.face .f-head { fill: none; stroke: var(--dash-ink-3); stroke-width: 2.5; }
.face .f-eye { fill: var(--dash-ink-2); }
.face .f-line { fill: none; stroke: var(--dash-ink-2); stroke-width: 2.5; stroke-linecap: round; }
.face-slot.is-mean .f-head { stroke: var(--dash-accent); }
.face-slot.is-mean .f-eye { fill: var(--dash-accent); }
.face-slot.is-mean .f-line { stroke: var(--dash-accent); }

/* ---------------------------------------------------------------- brand rows */

.brandrow + .brandrow { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--dash-line); }
.brandrow-head { display: flex; align-items: baseline; justify-content: space-between; }
.brandrow-score { font-size: 17px; font-weight: 600; }

/* ---------------------------------------------------------------- themes */

.themes { list-style: none; margin: 0; padding: 0; }
.themes li + li { margin-top: 3px; }
.theme {
  display: flex; align-items: center; gap: 9px; width: 100%;
  padding: 6px 8px; cursor: pointer; text-align: left;
  border: 0; border-radius: 8px; background: transparent;
}
.theme:hover { background: var(--dash-panel-2); }
.theme[aria-expanded="true"] { background: var(--dash-panel-2); }
.theme-name { flex: 0 0 34%; font-size: 12.5px; color: var(--dash-ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.theme-bar { position: relative; flex: 1 1 auto; height: 13px; }
.theme-fill {
  position: absolute; left: 0; top: 0; height: 100%;
  border-radius: 4px; background: var(--ramp-3);
}
/* The complaint share, drawn over the total, so a theme that is mostly gripes shows it without a
   second chart. Band hue, not brand hue — see the containment rule. */
.theme-fill--neg { background: var(--band-detractor); }
.theme-n { flex: 0 0 auto; font-size: 12px; font-weight: 600; color: var(--dash-ink-2); min-width: 30px; text-align: right; }

.verbatims { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--dash-line); }
.verbatims-head { margin: 0 0 8px; font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--dash-ink-3); }
.verbatim-list { list-style: none; margin: 0; padding: 0; max-height: 260px; overflow-y: auto; }
/* The builder's note shape (.insp-note): a rule on the left, the second grey behind, square on the
   ruled side. */
.verbatim {
  display: block; padding: 8px 10px; margin-bottom: 6px;
  border-radius: 0 8px 8px 0; background: var(--dash-panel-2);
  border-left: 3px solid var(--dash-line);
}
.verbatim--neg { border-left-color: var(--band-detractor); }
.verbatim-text { display: block; font-size: 12.5px; }
.verbatim-meta { display: block; margin-top: 3px; font-size: 11px; color: var(--dash-ink-3); }

/* ---------------------------------------------------------------- replies */

.reply-count { margin: 0 0 9px; font-size: 12px; color: var(--dash-ink-3); }
.replies { list-style: none; margin: 0; padding: 0; max-height: 320px; overflow-y: auto; }
.reply { display: flex; gap: 10px; padding: 8px 0; border-top: 1px solid var(--dash-line); }
.reply:first-child { border-top: 0; }
.reply-score {
  flex: 0 0 auto; width: 24px; height: 24px; display: grid; place-items: center;
  border-radius: 6px; font-size: 11px; font-weight: 700;
  background: var(--band-detractor); color: var(--dash-bg);
}
.reply-body { min-width: 0; }
.reply-text { display: block; font-size: 12.5px; }
.reply-meta { display: block; margin-top: 2px; font-size: 11px; color: var(--dash-ink-3); }

/* ---------------------------------------------------------------- the ask bar
 *
 * The builder's floating "Ask Kumii AI" bar (../../v3/css/builder.css .graph-ai): white, radius 16,
 * a ring of the second grey round its shadow, the send button in ink. Sticky to the foot of the
 * stage, so it floats over the panels while they scroll and settles below the last one at the end -
 * the builder's bar floats over its canvas the same way. The answers open above it, in a card of
 * the same shape, and can be put away (js/dash.js askOpen).
 */

.askdock {
  position: sticky; bottom: 16px; z-index: 20;
  align-self: center;
  width: min(640px, calc(100% - 32px));
  margin: 0 0 16px;
  display: grid; gap: 8px;
}

.askbar {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 6px 6px 12px;
  border: 1px solid var(--dash-line);
  border-radius: 16px;
  background: var(--dash-panel);
  box-shadow: 0 0 0 4px var(--dash-panel-2), var(--dash-shadow);
}
/* Focus is shown on the whole bar rather than as a ring inside it: the field has no edge of its
   own to ring, and a ring drawn inside a rounded bar reads as a second box. */
.askbar:focus-within { border-color: var(--dash-accent); }
.askbar-ico { flex: none; display: grid; place-items: center; color: var(--dash-ink-3); }

.ask-in {
  flex: 1 1 auto; min-width: 0;
  padding: 8px 4px;
  border: 0; background: transparent;
  font-size: 14px; color: var(--dash-ink);
}
.ask-in::placeholder { color: var(--dash-ink-3); }
.ask-in:focus, .ask-in:focus-visible { outline: none; }
.ask-in:disabled { opacity: .55; }

/* Which engine answers is never hidden. A sentence from a keyword parser and a sentence from a
   model deserve different amounts of trust, and the reader can only calibrate if told which. */
.ask-engine.is-live { color: var(--dash-accent); border-color: var(--dash-accent); }

.ask-go {
  flex: none;
  width: 32px; height: 32px; padding: 0;
  display: grid; place-items: center;
  border: 0; border-radius: 10px;
  background: var(--dash-ink); color: var(--dash-panel);
  cursor: pointer;
}
.ask-go:hover { opacity: .85; }
.ask-go:disabled { cursor: default; opacity: .6; }

.spin {
  width: 12px; height: 12px; border-radius: 50%;
  border: 2px solid currentColor; border-top-color: transparent;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.ask-thread {
  border: 1px solid var(--dash-line);
  border-radius: 16px;
  background: var(--dash-panel);
  box-shadow: var(--dash-shadow);
  overflow: hidden;
}
.ask-thread-head {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 6px 6px 6px 14px;
  border-bottom: 1px solid var(--dash-line);
}
.ask-thread-title {
  font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase;
  color: var(--dash-ink-3);
}

.chat {
  list-style: none; margin: 0; padding: 10px;
  max-height: min(38vh, 320px); overflow-y: auto;
}
.msg { display: block; padding: 8px 10px; margin-bottom: 6px; border-radius: 10px; background: var(--dash-panel-2); }
.msg:last-child { margin-bottom: 0; }
/* An answer wears the builder's note shape: a rule on the left in the accent. */
.msg--ai { border-left: 3px solid var(--dash-accent); border-radius: 0 10px 10px 0; }
/* "I did not understand" must not look like an answer. */
.msg--unsure { border-left-color: var(--dash-ink-3); }
.msg-who {
  display: block; margin-bottom: 2px;
  font-size: 10.5px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase;
  color: var(--dash-ink-3);
}
.msg-text { display: block; font-size: 13px; line-height: 1.5; }
.msg-note {
  display: block; margin-top: 4px;
  font-size: 12px; line-height: 1.45; font-style: italic;
  color: var(--dash-ink-3);
}

/* ---------------------------------------------------------------- knobs
 *
 * The value arc is INK, as the builder's toggle switch is when on: a setting, not a data mark, so
 * it spends no hue. The accent marks only the knob being turned, as it marks focus everywhere.
 */

.knob-row { display: flex; gap: 6px; justify-content: space-between; }
.knob { flex: 1 1 0; min-width: 0; text-align: center; }
.knob-dial {
  width: 46px; height: 46px; margin: 0 auto;
  cursor: ns-resize;              /* the gesture is vertical; the cursor says so before the drag */
  touch-action: none;             /* without this the browser scrolls the page instead of turning */
}
.knob-dial svg { display: block; width: 100%; height: 100%; overflow: visible; }
.knob-track { fill: none; stroke: var(--dash-line); stroke-width: 3.5; stroke-linecap: round; }
.knob-fill { fill: none; stroke: var(--dash-ink); stroke-width: 3.5; stroke-linecap: round; }
.knob-cap { fill: var(--dash-panel); stroke: var(--dash-line); stroke-width: 1; }
.knob-pointer { stroke: var(--dash-ink-2); stroke-width: 2; stroke-linecap: round; }
.knob.is-turning .knob-cap { stroke: var(--dash-accent); }
.knob.is-turning .knob-pointer { stroke: var(--dash-ink); }
.knob-dial:focus-visible { outline: 2px solid var(--dash-accent); outline-offset: 3px; border-radius: 50%; }

.knob-label {
  margin: 4px 0 0; font-size: 11px; color: var(--dash-ink-3);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.knob-value {
  margin: 1px 0 0; font-size: 12px; font-weight: 600; color: var(--dash-ink-2);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* ---------------------------------------------------------------- responsive
 *
 * Breakpoints are kept in step with js/layout.js cols(): three columns from 1280px, two from
 * 900px, one below. If they drift, spans clamp against the wrong column count and a 3-wide panel
 * overflows its grid.
 */

@media (max-width: 1279px) {
  :root { --rail: 272px; }
}

/* Below 900px: one column, the builder's own stacking point. The frame lets go of the window
   height and the page scrolls as a whole again - panels first, then the filters, as v1 had it,
   because on a phone the numbers are what the page was opened for. The ask bar stays sticky, now
   to the window. layout.js forces the layout locked at this width, and the affordances are hidden
   so the page does not offer a control that cannot work. */
@media (max-width: 899px) {
  .dash { height: auto; min-height: 100vh; }
  .work {
    grid-template-columns: 1fr !important;
    grid-template-rows: auto auto !important;
    grid-template-areas: "stage" "ck" !important;
  }
  .stage, .cockpit { overflow: visible; }
  .cockpit {
    display: block !important; max-height: none !important;
    border: 0 !important; border-top: 1px solid var(--dash-line) !important;
  }
  .top { grid-template-columns: 1fr; gap: 8px; padding: 10px 12px; }
  .top-r { justify-content: flex-start; }
  .grid { padding: 12px; gap: 12px; }
  .panel { grid-column: span 1 !important; }
  .grip, .widthbtn, .lockbtn { display: none !important; }
  .hero { font-size: 34px; }
}

/* A phone: the ask bar breaks into two rows - the question across the full width, then which
   engine, the connect link and send. The glyph goes; it decorates, and the row needs the room. */
@media (max-width: 560px) {
  .bseg button { padding: 6px 9px; }
  /* The questionnaire switch's three labels are wider than a phone. Joined, the third ran off the
     edge where it could not be reached; here it breaks into the rail's wrapping buttons instead -
     the same buttons, pressed in the same ink. */
  .top-l .bseg {
    display: flex; flex-wrap: wrap; gap: 6px; width: 100%;
    border: 0; border-radius: 0; overflow: visible; background: none;
  }
  .top-l .bseg button,
  .top-l .bseg button:last-child {
    flex: 1 1 auto;
    border: 1px solid var(--dash-line); border-radius: 8px;
    background: var(--dash-panel);
  }
  .top-l .bseg button[aria-pressed="true"] { background: var(--dash-ink); border-color: var(--dash-ink); color: var(--dash-panel); }
  .top-l .bseg button:focus-visible { outline-offset: 2px; }
  .seg .seg-btn { font-size: 12px; padding: 6px 8px; }
  .askdock { width: calc(100% - 24px); }
  .askbar { flex-wrap: wrap; padding: 6px 6px 6px 10px; }
  .askbar-ico { display: none; }
  .ask-in { flex-basis: 100%; }
  .ask-go { margin-left: auto; }
}

/* ---------------------------------------------------------------- motion */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    transition-duration: .001ms !important;
  }
}
