/* Tokens from the Assay foundations canvas. Semantic names only — no screen
   here references a primitive. */
:root {
  --bg-canvas: #0F1012;
  --bg-inset: #131417;
  --bg-surface: #1A1B1E;
  --bg-raised: #222428;
  --border-default: #2A2C31;
  --border-strong: #3A3D44;
  --border-control: #6E727A;
  --fg-primary: #F5F6F7;
  --fg-secondary: #A8ABB2;
  --fg-muted: #8C9098;
  --accent-base: #4CC7D2;
  --accent-hover: #6FD6DE;
  --accent-subtle: rgba(76, 199, 210, 0.12);
  --fg-on-accent: #062227;
  --danger: #F0616D;
  --warning: #E8A33D;
  --success: #5FC98A;
  --info: #7EA6F0;
  --data-1: #A8E9EF;
  --data-2: #4CC7D2;
  --data-3: #3196A0;
  --data-4: #26737B;
  --data-track: #2A2C31;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg-canvas);
  color: var(--fg-primary);
  font-family: Manrope, system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
  line-height: 1.55;
}

a { color: var(--accent-base); text-decoration: none; }
a:hover { color: var(--accent-hover); }
::selection { background: rgba(76, 199, 210, 0.28); }

.shell { max-width: 760px; margin: 0 auto; padding: 48px 24px 96px; }
.wide { max-width: none; }
.wide .sentence { max-width: 78ch; }

.masthead { display: flex; align-items: center; gap: 12px; margin-bottom: 28px; }
.mark {
  width: 34px; height: 34px; border-radius: 9px; flex-shrink: 0;
  background: var(--accent-subtle); border: 1px solid rgba(76, 199, 210, 0.3);
  display: grid; place-items: center; color: var(--accent-base);
}
.masthead .who { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.masthead .who b { font-size: 14px; font-weight: 700; }
.masthead .who span { font-size: 12px; color: var(--fg-muted); }
.masthead .spacer { flex: 1; }

h2 { font-size: 17px; font-weight: 700; letter-spacing: -0.01em; margin: 0; }

/* A read-only sentence header: framing words muted, the names primary. */
.sentence { font-size: 19px; font-weight: 600; color: var(--fg-muted); margin: 0 0 6px; }
.sentence b { color: var(--fg-primary); font-weight: 600; }

.progress { height: 4px; border-radius: 2px; background: var(--border-default); overflow: hidden; margin: 14px 0 32px; }
.progress > i { display: block; height: 100%; background: var(--accent-base); transition: width 250ms cubic-bezier(.2, 0, 0, 1); }

.field { display: flex; flex-direction: column; gap: 12px; margin-bottom: 30px; }
.field .label { display: flex; flex-direction: column; gap: 5px; }
.field .label b { font-size: 15px; font-weight: 600; line-height: 1.45; }
.field .label b i { color: var(--accent-base); font-style: normal; }
.field .label span { font-size: 12.5px; color: var(--fg-muted); }

input[type="text"], input[type="email"], input[type="number"], input[type="date"], textarea {
  width: 100%; min-height: 46px; padding: 11px 14px;
  border-radius: var(--radius-md); border: 1px solid var(--border-default);
  background: var(--bg-inset); color: var(--fg-primary);
  font-family: inherit; font-size: 14px; line-height: 1.5;
}
input::placeholder, textarea::placeholder { color: var(--border-control); opacity: 1; }
input:focus, textarea:focus {
  outline: none; border-color: var(--accent-base);
  box-shadow: 0 0 0 3px rgba(76, 199, 210, 0.16);
}
textarea { min-height: 108px; resize: vertical; }
input[type="number"] { max-width: 200px; font-family: var(--mono); }

.choice { display: flex; flex-direction: column; gap: 8px; }
.choice label {
  display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 0 15px;
  border-radius: var(--radius-md); border: 1px solid var(--border-default);
  background: var(--bg-inset); cursor: pointer; font-size: 14px; color: var(--fg-secondary);
  transition: border-color 150ms, background 150ms;
}
.choice label:hover { border-color: var(--border-strong); }
.choice label.on { background: var(--accent-subtle); border-color: rgba(76, 199, 210, 0.34); color: var(--fg-primary); }
.choice input { accent-color: var(--accent-base); width: 17px; height: 17px; margin: 0; flex-shrink: 0; }

.scale { display: grid; grid-template-columns: repeat(11, minmax(0, 1fr)); gap: 6px; }
.scale label {
  height: 48px; display: grid; place-items: center; cursor: pointer;
  border-radius: 8px; border: 1px solid var(--border-default); background: var(--bg-inset);
  font-family: var(--mono); font-size: 13.5px; font-weight: 600; color: var(--fg-muted);
}
.scale label.on { background: var(--accent-base); border-color: var(--accent-base); color: var(--fg-on-accent); }
.scale input { position: absolute; opacity: 0; pointer-events: none; }
.scale-ends { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--border-control); margin-top: 8px; }

.consent { display: flex; align-items: flex-start; gap: 12px; cursor: pointer; }
.consent input { accent-color: var(--accent-base); width: 18px; height: 18px; margin: 2px 0 0; flex-shrink: 0; }
.consent span { font-size: 13.5px; color: var(--fg-secondary); }

.err { display: flex; align-items: center; gap: 7px; font-size: 12.5px; font-weight: 600; color: var(--danger); }
.field.bad input, .field.bad textarea { border-color: var(--danger); }
.field.bad .choice label, .field.bad .scale label { border-color: rgba(240, 97, 109, 0.4); }

.actions { display: flex; align-items: center; gap: 12px; padding-top: 8px; margin-top: 34px; }
.actions .spacer { flex: 1; }
.hint { font-size: 12.5px; color: var(--border-control); }

button {
  height: 46px; padding: 0 22px; border: none; border-radius: var(--radius-md);
  font-family: inherit; font-size: 14px; font-weight: 700; cursor: pointer;
  background: var(--accent-base); color: var(--fg-on-accent);
  transition: background 150ms;
}
button:hover:not(:disabled) { background: var(--accent-hover); }
button:disabled { opacity: 0.5; cursor: not-allowed; }
button.ghost { background: var(--bg-surface); color: var(--fg-secondary); border: 1px solid var(--border-default); font-weight: 600; }
button.ghost:hover:not(:disabled) { background: var(--bg-raised); color: var(--fg-primary); }

.notice {
  display: flex; flex-direction: column; align-items: center; gap: 14px;
  text-align: center; padding: 80px 24px;
}
.notice .icon { width: 56px; height: 56px; border-radius: var(--radius-lg); display: grid; place-items: center; }
.notice.ok .icon { background: rgba(95, 201, 138, 0.12); border: 1px solid rgba(95, 201, 138, 0.3); color: var(--success); }
.notice.stop .icon { background: rgba(232, 163, 61, 0.12); border: 1px solid rgba(232, 163, 61, 0.3); color: var(--warning); }
.notice.bad .icon { background: rgba(240, 97, 109, 0.12); border: 1px solid rgba(240, 97, 109, 0.3); color: var(--danger); }
.notice h2 { font-size: 24px; font-weight: 700; letter-spacing: -0.02em; }
.notice p { font-size: 14px; color: var(--fg-secondary); max-width: 460px; margin: 0; }
.notice .meta { font-family: var(--mono); font-size: 12px; color: var(--fg-muted); }

.card { background: var(--bg-surface); border: 1px solid var(--border-default); border-radius: var(--radius-lg); padding: 24px; }
.grid {
  display: grid; gap: 18px; align-items: start;
  grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
}

.tile-head { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 18px; }
.tile-head .t { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.tile-head .t b { font-size: 14.5px; font-weight: 600; line-height: 1.4; }
.tile-head .t span { font-size: 12.5px; color: var(--fg-muted); }

.bars { display: flex; flex-direction: column; gap: 12px; }
.bar-row { display: flex; flex-direction: column; gap: 6px; }
.bar-row .top { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.bar-row .top span:first-child { font-size: 13px; }
.bar-row .top span:last-child { font-family: var(--mono); font-size: 12px; color: var(--fg-secondary); white-space: nowrap; }
.bar-row.retired .top span:first-child { color: var(--border-control); text-decoration: line-through; }
.track { height: 8px; border-radius: 4px; background: var(--data-track); overflow: hidden; }
.track > i { display: block; height: 100%; border-radius: 4px; }

.stats { display: flex; gap: 22px; border-top: 1px solid var(--bg-raised); padding-top: 14px; margin-top: 16px; }
.stats div { display: flex; flex-direction: column; gap: 3px; }
.stats b { font-family: var(--mono); font-size: 15px; font-weight: 700; }
.stats span { font-size: 11px; font-weight: 700; letter-spacing: 0.07em; color: var(--border-control); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 7px; height: 26px; padding: 0 11px;
  border-radius: 999px; background: var(--bg-raised); border: 1px solid var(--border-strong);
  font-size: 11.5px; font-weight: 600; color: var(--fg-secondary);
}
.chip.mono { font-family: var(--mono); font-weight: 400; }
.chip.warn { background: rgba(232, 163, 61, 0.12); border-color: rgba(232, 163, 61, 0.3); color: var(--warning); }
.chip.info { background: rgba(126, 166, 240, 0.12); border-color: rgba(126, 166, 240, 0.3); color: var(--info); }

.quotes { display: flex; flex-direction: column; gap: 9px; border-top: 1px solid var(--bg-raised); padding-top: 14px; margin-top: 14px; }
.quotes p { margin: 0; font-size: 12.5px; color: var(--fg-secondary); padding-left: 12px; border-left: 2px solid var(--border-default); }


.skeleton { height: 13px; border-radius: var(--radius-sm); background: var(--bg-raised); animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.45; } }


@media (max-width: 560px) {
  .shell { padding: 32px 16px 72px; }
  .scale { grid-template-columns: repeat(6, minmax(0, 1fr)); }
}
@media (prefers-reduced-motion: reduce) { * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; } }

/* ---- constructor ---- */

.builder { display: grid; grid-template-columns: 260px 1fr 360px; min-height: 100vh; }
.builder > * { min-width: 0; }
.pane { background: var(--bg-inset); display: flex; flex-direction: column; }
.pane.left { border-right: 1px solid var(--border-default); }
.pane.right { border-left: 1px solid var(--border-default); }
.pane.stack { position: relative; background: var(--bg-canvas); padding: 24px 28px 80px; gap: 16px; }

.topbar {
  grid-column: 1 / -1; height: 56px; border-bottom: 1px solid var(--border-default);
  background: var(--bg-inset); display: flex; align-items: center; gap: 12px; padding: 0 14px;
  position: sticky; top: 0; z-index: 20;
}
.topbar .title-input {
  min-height: 32px; height: 32px; padding: 0 10px; font-size: 14px; font-weight: 700;
  background: transparent; border: 1px solid transparent; border-radius: var(--radius-sm);
  color: var(--fg-primary); width: 260px;
}
.topbar .title-input:hover { border-color: var(--border-default); }
.topbar .spacer { flex: 1; }
.topbar button { height: 32px; padding: 0 13px; font-size: 12.5px; }

.paneheader {
  padding: 16px 14px 10px; display: flex; align-items: center; justify-content: space-between; gap: 10px;
  font-size: 11.5px; font-weight: 700; letter-spacing: 0.1em; color: var(--fg-muted);
}

.outline { display: flex; flex-direction: column; gap: 2px; padding: 0 8px; }
.outline .row {
  display: flex; align-items: center; gap: 9px; height: 32px; padding: 0 8px;
  border-radius: 8px; cursor: pointer; font-size: 13px; color: var(--fg-muted);
}
.outline .row:hover { background: var(--bg-raised); }
.outline .row.page { font-size: 12.5px; font-weight: 700; color: var(--fg-secondary); }
/* `q`, not `field`: the fill surface owns `.field` as a column-stacked question
   wrapper, and a `class="row field"` here inherited its flex-direction, gap and
   margin — which stacked the icon above the label and clipped it. */
.outline .row.q { padding-left: 20px; }
.outline .row.on { background: var(--accent-subtle); color: var(--fg-primary); }
.outline .row .txt { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.outline .row .n { margin-left: auto; font-family: var(--mono); font-size: 10.5px; color: var(--border-control); }

.addrow {
  display: flex; align-items: center; gap: 9px; height: 34px; padding: 0 8px; margin: 4px 8px;
  border-radius: 8px; color: var(--accent-base); font-size: 13px; font-weight: 600; cursor: pointer;
}
.addrow:hover { background: var(--accent-subtle); }

.qcard { display: flex; gap: 10px; align-items: stretch; }
.qcard .handle { width: 20px; display: grid; place-items: start center; padding-top: 17px; color: var(--border-default); cursor: grab; }
.qcard:hover .handle { color: var(--border-control); }
.qcard .body {
  flex: 1; border-radius: 12px; background: var(--bg-surface); border: 1px solid var(--border-default);
  padding: 16px 18px; display: flex; flex-direction: column; gap: 12px; cursor: pointer; min-width: 0;
}
.qcard.on .body { background: var(--bg-raised); border-color: var(--accent-base); box-shadow: 0 0 0 3px rgba(76,199,210,0.14); cursor: default; }
.qcard.dragging { opacity: 0.4; }
/* One header line per question: the type dimmed, then the name. */
.qcard .qhead { display: flex; align-items: center; gap: 10px; min-width: 0; }
.qcard .qtype { font-size: 12.5px; color: var(--fg-muted); flex-shrink: 0; }
.qcard .qtitle {
  flex: 1; min-width: 0; font-size: 15px; font-weight: 600; line-height: 1.4;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.qcard .qtitle i { color: var(--accent-base); font-style: normal; margin-left: 3px; }
.qcard .qempty { color: var(--border-control); font-weight: 500; }
.qcard .qtitle-input { flex: 1; min-width: 0; }
.qcard .qmeta { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.qcard .qbounds { font-family: var(--mono); font-size: 12px; color: var(--fg-muted); }
.qcard .chip.rulechip {
  background: var(--accent-subtle); border-color: rgba(76, 199, 210, 0.28);
  color: var(--accent-hover); cursor: pointer;
}
.qcard .acts { display: flex; gap: 4px; margin-left: 4px; }
.qcard .acts .ib { width: 26px; height: 26px; border-radius: 7px; display: grid; place-items: center; color: var(--fg-muted); cursor: pointer; background: none; border: none; padding: 0; }
.qcard .acts .ib:hover { background: var(--bg-surface); color: var(--fg-primary); }
.qcard .acts .ib.danger:hover { color: var(--danger); }
/* Centred grey text, never a pill.
   Qualified with `button` and `:not(:disabled)` on purpose: the global
   `button:hover:not(:disabled)` rule scores (0,2,1), so a plain `.addq:hover`
   at (0,2,0) loses to it however far down the file it sits — which is how the
   accent background kept coming back on hover. */
button.addq {
  align-self: stretch; margin: 0; padding: 12px 0;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  height: auto; border: none; border-radius: 0; background: none;
  color: var(--fg-muted); font-family: inherit; font-size: 13px; font-weight: 600;
  cursor: pointer; transition: color 150ms;
}
button.addq:hover:not(:disabled) { background: none; color: var(--fg-primary); }

.inline-input {
  width: 100%; min-height: 34px; height: auto; padding: 6px 10px; font-size: 15px; font-weight: 600;
  background: var(--bg-inset); border: 1px solid var(--border-default); border-radius: var(--radius-sm);
  color: var(--fg-primary); font-family: inherit;
}
.opts { display: flex; flex-direction: column; gap: 6px; }
.opt { display: flex; align-items: center; gap: 10px; }
.opt .dot { width: 14px; height: 14px; border-radius: 999px; border: 1.5px solid var(--border-control); flex-shrink: 0; }
.opt.retired .dot { border-color: var(--border-strong); }
.opt input {
  flex: 1; min-height: 32px; height: 32px; padding: 0 10px; font-size: 13px;
  background: var(--bg-inset); border: 1px solid var(--border-default); border-radius: var(--radius-sm); color: var(--fg-primary);
}
.opt .oid { font-family: var(--mono); font-size: 10.5px; color: var(--border-control); }
.opt.retired span.rl { font-size: 11px; color: var(--border-control); }

.insp { padding: 18px 16px; display: flex; flex-direction: column; gap: 22px; overflow-y: auto; }
.insp .group { display: flex; flex-direction: column; gap: 11px; }
.insp .group > .gh { font-size: 11.5px; font-weight: 700; letter-spacing: 0.1em; color: var(--fg-muted); }
.insp .r { display: flex; align-items: center; justify-content: space-between; gap: 14px; min-height: 32px; }
.insp .r .k { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.insp .r .k b { font-size: 13px; font-weight: 500; color: var(--fg-primary); }
.insp .r .k span { font-size: 11.5px; color: var(--border-control); line-height: 1.4; }
.insp .r input[type="text"], .insp .r input[type="number"], .insp .r select {
  width: 132px; min-height: 32px; height: 32px; padding: 0 9px; font-size: 12.5px; flex-shrink: 0;
  background: var(--bg-raised); border: 1px solid var(--border-strong); border-radius: 8px;
  color: var(--fg-primary); font-family: inherit;
}
.insp .r .ro { font-family: var(--mono); font-size: 12px; color: var(--fg-muted); }
/* Tabs are sized by their labels, not stretched to quarters of the pane.
   Equal-width flex made "Form" as wide as "Validation" and left every label
   touching its neighbour's highlight. */
/* `.tabs` is a SIBLING of `.insp`, not a child — the old `.insp .tabs` selector
   matched nothing, so the bar had no padding, no gap and no border, and the
   buttons sat against each other as plain inline elements. */
.pane.right > .tabs { display: flex; gap: 6px; padding: 12px 12px 10px; border-bottom: 1px solid var(--border-default); }
.insp-tab {
  height: 32px; padding: 0 12px; border: none; border-radius: 8px;
  background: transparent; color: var(--fg-muted);
  font-size: 12.5px; font-weight: 700; font-family: inherit; cursor: pointer;
  transition: background 150ms, color 150ms;
}
.insp-tab:hover { background: var(--bg-surface); color: var(--fg-secondary); }
.insp-tab.on { background: var(--border-default); color: var(--fg-primary); }

.sw { width: 38px; height: 22px; border-radius: 999px; background: var(--border-strong); display: flex; align-items: center; padding: 3px; cursor: pointer; flex-shrink: 0; border: none; }
.sw > i { width: 16px; height: 16px; border-radius: 999px; background: var(--fg-muted); display: block; transition: transform 150ms cubic-bezier(.2,0,0,1); }
.sw.on { background: var(--accent-base); }
.sw.on > i { background: var(--fg-on-accent); transform: translateX(16px); }

/* The problem list floats over the bottom of the question stack, inside that
   column only, and takes no space in the flow — so the cards do not jump when
   a rule breaks or gets fixed. Sticky inside a full-height dock keeps it at the
   bottom of the view rather than the bottom of a long document. */
.bannerdock {
  position: absolute; inset: 0; z-index: 5; pointer-events: none;
  display: flex; flex-direction: column; justify-content: flex-end;
}
/* The same flat strip it always was — edge to edge across the column, square,
   no shadow — just docked at the bottom instead of pushing the questions down.
   Opaque rather than tinted glass, because it now sits over the cards. */
.banner {
  position: sticky; bottom: 0; pointer-events: auto;
  padding: 14px 20px; display: flex; flex-direction: column; gap: 8px;
  border-top: 1px solid rgba(240, 97, 109, 0.3);
  background: linear-gradient(rgba(240, 97, 109, 0.09), rgba(240, 97, 109, 0.09)), var(--bg-canvas);
}
.banner .bh { display: flex; align-items: center; gap: 9px; font-size: 13px; font-weight: 700; color: var(--danger); }
.banner ul { margin: 0; padding-left: 34px; display: flex; flex-direction: column; gap: 4px; }
.banner li { font-size: 12.5px; color: var(--fg-secondary); }

.picker { display: flex; flex-direction: column; gap: 4px; padding: 8px; }
.picker button {
  display: flex; align-items: center; gap: 10px; height: 38px; padding: 0 11px; width: 100%;
  background: none; border: none; border-radius: 8px; color: var(--fg-secondary);
  font-family: inherit; font-size: 13px; font-weight: 500; cursor: pointer; text-align: left;
}
.picker button:hover { background: var(--bg-raised); color: var(--fg-primary); }

.sheet { position: fixed; inset: 0; background: rgba(8,9,10,0.75); display: grid; place-items: center; z-index: 50; padding: 40px; }
.sheet .box { width: min(760px, 100%); max-height: 80vh; background: var(--bg-surface); border: 1px solid var(--border-strong); border-radius: var(--radius-lg); padding: 24px; display: flex; flex-direction: column; gap: 16px; }
.sheet textarea { min-height: 320px; font-family: var(--mono); font-size: 12px; line-height: 1.6; }
.sheet .row { display: flex; gap: 10px; align-items: center; }

.saving {
  font-size: 12px; color: var(--border-control);
  display: flex; align-items: center; gap: 7px;
  margin-right: 4px; white-space: nowrap;
}
.saving.warn { color: var(--warning); }
.saving.bad { color: var(--danger); }

/* ---- product shell ----
   The column that sits outside every authenticated surface: who you are, which
   Shard you are talking to, which form, and which of its five destinations. */

.app { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; align-items: stretch; }
.app > .main { min-width: 0; display: flex; flex-direction: column; }

.nav {
  background: var(--bg-inset); border-right: 1px solid var(--border-default);
  display: flex; flex-direction: column; gap: 20px; padding: 16px 0;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.nav .brand { display: flex; align-items: center; gap: 10px; padding: 0 14px; }
.nav .brand b { font-size: 14px; font-weight: 700; }

.nav .search {
  margin: 0 10px; height: 32px; border-radius: 8px; background: var(--bg-surface);
  border: 1px solid var(--border-default); display: flex; align-items: center; gap: 8px;
  padding: 0 10px; color: var(--border-control); font-size: 12.5px; cursor: text;
}
.nav .search kbd {
  margin-left: auto; font-family: var(--mono); font-size: 10.5px; color: var(--border-control);
  border: 1px solid var(--border-default); border-radius: 4px; padding: 1px 5px;
}

.nav .dests { display: flex; flex-direction: column; gap: 2px; padding: 0 8px; }
.nav .dest {
  display: flex; align-items: center; gap: 11px; height: 34px; padding: 0 10px;
  border-radius: 9px; font-size: 13px; color: var(--fg-muted); cursor: pointer;
}
.nav .dest:hover { background: var(--bg-surface); color: var(--fg-secondary); }
.nav .dest.on { background: var(--accent-subtle); color: var(--fg-primary); font-weight: 600; }
.nav .dest .n { margin-left: auto; font-family: var(--mono); font-size: 10.5px; color: var(--border-control); }
.nav .dest.muted { color: var(--border-control); cursor: default; }
.nav .dest.muted:hover { background: transparent; color: var(--border-control); }

.nav .sect {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 0 10px 0 14px; font-size: 11px; font-weight: 700;
  letter-spacing: 0.1em; color: var(--fg-muted);
}
.nav .addbtn {
  width: 22px; height: 22px; padding: 0; flex-shrink: 0;
  display: grid; place-items: center; border: none; border-radius: 6px;
  background: transparent; color: var(--fg-muted); cursor: pointer;
  transition: background 150ms, color 150ms;
}
.nav .addbtn:hover { background: var(--bg-surface); color: var(--accent-base); }

/* The row being named. No `type` attribute, so the full-size form-field rules
   for input[type="text"] do not apply to it. */
.nav .frow.drafting { padding: 0 6px 0 8px; }
.nav .newname {
  width: 100%; height: 24px; min-height: 24px; padding: 0 7px;
  background: var(--bg-inset); border: 1px solid var(--accent-base);
  border-radius: 6px; color: var(--fg-primary);
  font-family: inherit; font-size: 12.5px; line-height: 24px;
  outline: none;
}
.nav .newname::selection { background: var(--accent-subtle); }
.nav .frow.saving .newname { opacity: 0.55; }
.nav .frow.bad .newname { border-color: var(--danger); }
.nav .forms { display: flex; flex-direction: column; gap: 1px; padding: 0 8px; flex: 1; min-height: 44px; }
.nav .frow {
  display: flex; align-items: center; gap: 9px; height: 30px; padding: 0 10px;
  border-radius: 8px; font-size: 12.5px; color: var(--fg-muted); cursor: pointer;
}
.nav .frow:hover { background: var(--bg-surface); color: var(--fg-secondary); }
.nav .frow.on { background: var(--bg-raised); color: var(--fg-primary); }
.nav .frow .t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav .frow .n { margin-left: auto; font-family: var(--mono); font-size: 10.5px; color: var(--border-control); }

.nav .me {
  margin-top: auto; border-top: 1px solid var(--border-default); padding: 14px 14px 0;
  display: flex; align-items: center; gap: 10px;
}
.nav .me .av {
  width: 28px; height: 28px; border-radius: 999px; background: var(--bg-raised);
  border: 1px solid var(--border-strong); display: grid; place-items: center;
  font-size: 11px; font-weight: 700; color: var(--fg-secondary); flex-shrink: 0;
}
.nav .me b { font-size: 12.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---- overview ---- */

.ov { padding: 28px 32px 80px; display: flex; flex-direction: column; gap: 24px; }
.ov .sentence { max-width: 78ch; }
.ov .top { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; }
.ov .top .acts { display: flex; gap: 9px; flex-shrink: 0; }

.tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.tile { background: var(--bg-surface); border: 1px solid var(--border-default); border-radius: 12px; padding: 18px 20px; display: flex; flex-direction: column; gap: 7px; }
.tile .k { font-size: 11.5px; font-weight: 700; letter-spacing: 0.09em; color: var(--fg-muted); }
.tile .v { font-family: var(--mono); font-size: 27px; font-weight: 700; letter-spacing: -0.02em; }
.tile .s { font-size: 12px; line-height: 1.45; color: var(--fg-muted); }
.tile .s.good { color: var(--success); }

.panel { background: var(--bg-surface); border: 1px solid var(--border-default); border-radius: var(--radius-lg); padding: 22px 24px; display: flex; flex-direction: column; gap: 16px; }
.panel .ph { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; }
.panel .ph b { font-size: 11.5px; font-weight: 700; letter-spacing: 0.1em; color: var(--fg-muted); }
.panel .ph span { font-size: 12px; color: var(--border-control); }

.spark { display: flex; align-items: flex-end; gap: 4px; height: 96px; }
.spark .col { flex: 1; max-width: 72px; display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 0; }
.spark .col > i { display: block; width: 100%; border-radius: 3px 3px 2px 2px; background: var(--data-4); }
.spark .col.peak > i { background: var(--data-1); }
.spark .col > span { font-family: var(--mono); font-size: 9.5px; color: var(--border-control); }

.plist { display: flex; flex-direction: column; gap: 12px; }
.prow { display: grid; grid-template-columns: 1fr 78px 62px; gap: 14px; align-items: center; }
.prow .t { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.prow .t b { font-size: 13px; font-weight: 500; }
.prow .t span { font-size: 11.5px; color: var(--border-control); }
.prow .bar { height: 8px; border-radius: 4px; background: var(--data-track); overflow: hidden; }
.prow .bar > i { display: block; height: 100%; border-radius: 4px; background: var(--data-3); }
.prow .pc { font-family: var(--mono); font-size: 12.5px; color: var(--fg-secondary); text-align: right; }

.kv { display: flex; flex-direction: column; gap: 2px; }
.kv .r { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 9px 0; border-bottom: 1px solid var(--bg-raised); }
.kv .r:last-child { border-bottom: none; }
.kv .r .k { font-size: 12.5px; color: var(--fg-muted); }
.kv .r .v { font-size: 12.5px; color: var(--fg-primary); text-align: right; }
.kv .r .v.mono { font-family: var(--mono); font-size: 12px; }

.vlist { display: flex; flex-direction: column; gap: 2px; }
.vrow { display: grid; grid-template-columns: 46px 1fr auto; gap: 14px; align-items: baseline; padding: 11px 0; border-bottom: 1px solid var(--bg-raised); }
.vrow:last-child { border-bottom: none; }
.vrow .vn { font-family: var(--mono); font-size: 13px; font-weight: 700; color: var(--accent-base); }
.vrow .vt { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.vrow .vt b { font-size: 12.5px; font-weight: 500; line-height: 1.45; }
.vrow .vt b.none { color: var(--border-control); font-style: italic; }
.vrow .vt span { font-size: 11.5px; color: var(--border-control); }
.vrow .vr { font-family: var(--mono); font-size: 12px; color: var(--fg-muted); white-space: nowrap; }

.two { display: grid; grid-template-columns: 1.25fr 1fr; gap: 20px; align-items: start; }

@media (max-width: 1080px) {
  .app { grid-template-columns: 1fr; }
  .nav { position: static; height: auto; border-right: none; border-bottom: 1px solid var(--border-default); }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .two { grid-template-columns: 1fr; }
}


/* Vertical histogram inside a results tile. Bars are capped so a distribution
   with two values does not paint half the card; the row is left-aligned so the
   chart reads as a chart rather than as a block of colour. */
.hist { display: flex; align-items: flex-end; gap: 6px; height: 116px; }
.hist .b { flex: 1 1 0; max-width: 56px; display: flex; flex-direction: column; align-items: center; gap: 7px; min-width: 0; }
.hist .b > i { display: block; width: 100%; border-radius: 4px 4px 2px 2px; background: var(--data-2); }
.hist .b > span { font-family: var(--mono); font-size: 10px; color: var(--border-control); white-space: nowrap; }
.hist .b .n { color: var(--fg-secondary); font-size: 10.5px; }


.nav .brand .star { display: block; flex-shrink: 0; }


/* ---- fill surface header ----
   The respondent is answering a form, not visiting a product: the Shardnet mark
   sits on its own, with the form's name under it, and the product is not named. */
.fillhead { display: flex; flex-direction: column; align-items: center; gap: 12px; margin-bottom: 34px; }
.fillhead .star { display: block; }
.fillhead b { font-size: 20px; font-weight: 700; letter-spacing: -0.015em; text-align: center; text-wrap: pretty; }

/* The preview's top bar, matching the design board: 60px, full bleed, the way
   back on the left and the mark plus the form's name centred. */
.fillbar {
  position: relative;
  height: 60px; flex: none; display: flex; align-items: center;
  padding: 0 20px; background: var(--bg-inset);
  border-bottom: 1px solid var(--border-default);
}
.fillbar .title {
  position: absolute; left: 50%; transform: translateX(-50%);
  display: flex; align-items: center; gap: 12px; max-width: 50%;
}
.fillbar .star { display: block; opacity: 0.9; flex-shrink: 0; }
.fillbar .name {
  font-size: 13.5px; font-weight: 700;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* Too narrow to hold both: the way back matters more than the name, which is
   on the page underneath anyway. */
@media (max-width: 640px) { .fillbar .title { display: none; } }

.backpill {
  height: 32px; display: inline-flex; align-items: center; gap: 8px; padding: 0 12px;
  border-radius: 9px; border: 1px solid var(--border-default); background: var(--bg-surface);
  color: var(--fg-secondary); font-size: 12.5px; font-weight: 600;
  transition: color 150ms, background 150ms;
}
.backpill:hover { color: var(--fg-primary); background: var(--bg-raised); }

/* A bare icon link. The back arrow used to sit in a filled, bordered square,
   which read as a button of its own rather than a way out. */
.iconlink {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; color: var(--fg-muted);
  transition: color 150ms;
}
.iconlink:hover { color: var(--fg-primary); }

/* ---- motion ----
   Shardnet's scale: 250ms for a normal change, 400ms for an emphasised one, on
   the standard curve. Everything here is a transform/opacity or a single
   geometry property, so nothing animates a layout the browser has to reflow.
   The reduced-motion rule at the top of this file zeroes all of it. */

.track > i,
.prow .bar > i,
.progress > i { transition: width 400ms cubic-bezier(.2, 0, 0, 1); }

.hist .b > i,
.spark .col > i { transition: height 400ms cubic-bezier(.2, 0, 0, 1); }

/* An element arriving: it comes up from slightly below and fades in. Applied
   only to things that are genuinely new, never on every re-render — a card that
   re-animates whenever a sibling changes reads as a glitch. */
@keyframes rise {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: none; }
}
.rise { animation: rise 250ms cubic-bezier(0, 0, 0, 1) both; }

/* Results and overview paint once, so their cards can stagger in. The delay is
   capped so a form with thirty questions does not take three seconds to arrive. */
.grid > .card { animation: rise 260ms cubic-bezier(0, 0, 0, 1) both; }
.grid > .card:nth-child(1) { animation-delay: 0ms; }
.grid > .card:nth-child(2) { animation-delay: 30ms; }
.grid > .card:nth-child(3) { animation-delay: 60ms; }
.grid > .card:nth-child(4) { animation-delay: 90ms; }
.grid > .card:nth-child(n + 5) { animation-delay: 120ms; }

.tiles > .tile { animation: rise 240ms cubic-bezier(0, 0, 0, 1) both; }
.tiles > .tile:nth-child(2) { animation-delay: 40ms; }
.tiles > .tile:nth-child(3) { animation-delay: 80ms; }
.tiles > .tile:nth-child(4) { animation-delay: 120ms; }

/* Controls that toggle. */
.choice label,
.scale label { transition: background 150ms, border-color 150ms, color 150ms; }
.qcard .body { transition: border-color 150ms, box-shadow 150ms, background 150ms; }
.opt input, .inline-input { transition: border-color 150ms, box-shadow 150ms; }

/* What a 4xx looks like: the mark, centred, and nothing to read. */
.markonly { min-height: 100vh; display: grid; place-items: center; }
.markonly .star { display: block; opacity: 0.55; }

/* ---- context menu on a form row ---- */

.ctxmenu {
  position: fixed; z-index: 100; min-width: 150px; padding: 5px;
  display: flex; flex-direction: column; gap: 1px;
  background: var(--bg-raised); border: 1px solid var(--border-strong);
  border-radius: var(--radius-md); box-shadow: 0 12px 32px rgba(0, 0, 0, 0.55);
}
button.mi {
  height: 30px; padding: 0 10px; width: 100%;
  display: flex; align-items: center; justify-content: flex-start;
  background: none; border: none; border-radius: 7px;
  color: var(--fg-secondary); font-family: inherit; font-size: 13px; font-weight: 500;
  text-align: left; cursor: pointer;
}
button.mi:hover:not(:disabled) { background: var(--bg-surface); color: var(--fg-primary); }
button.mi.danger { color: var(--danger); }
button.mi.danger:hover:not(:disabled) { background: var(--bg-surface); color: var(--danger); }

.nav .frow.bad, .nav .forms.bad { background: rgba(240, 97, 109, 0.12); border-radius: 8px; }
/* Held on the clipboard, waiting to be pasted. */
.nav .frow.clipped { outline: 1px dashed var(--border-control); outline-offset: -1px; }
button.mi:disabled { color: var(--border-control); cursor: default; }

/* ---- ask() and say() ---- */

.sheet.ask { z-index: 120; }
.sheet.ask .box { width: min(420px, 100%); gap: 13px; padding: 22px; }
.sheet.ask h2 { font-size: 15px; font-weight: 700; letter-spacing: -0.01em; }
.sheet.ask .hint { font-size: 12.5px; line-height: 1.55; color: var(--fg-muted); text-wrap: pretty; }
/* Both buttons are flat text. A dialog is already a box; the buttons inside it
   do not need boxes of their own, and a filled Cancel outweighing a flat Delete
   points the eye at the wrong one. */
.sheet.ask .row button {
  height: 32px; padding: 0 14px; font-size: 12.5px; font-weight: 600;
  background: none; border: none; color: var(--fg-secondary);
}
.sheet.ask .row button:hover:not(:disabled) { background: var(--bg-raised); color: var(--fg-primary); }
.sheet.ask .row button.danger { color: var(--danger); }
.sheet.ask .row button.danger:hover:not(:disabled) { background: var(--bg-raised); color: var(--danger); }
.askin {
  width: 100%; height: 34px; padding: 0 10px;
  background: var(--bg-inset); border: 1px solid var(--border-strong);
  border-radius: 8px; color: var(--fg-primary);
  font-family: inherit; font-size: 13px; outline: none;
}
.askin:focus { border-color: var(--accent-base); }

.toast {
  position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%);
  z-index: 130; max-width: min(560px, calc(100vw - 40px));
  padding: 11px 15px; border-radius: 10px;
  background: var(--bg-raised); border: 1px solid var(--border-strong);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.55);
  font-size: 12.5px; line-height: 1.5; color: var(--fg-secondary);
  animation: rise 220ms cubic-bezier(0, 0, 0, 1) both;
}
.toast.bad { border-color: var(--danger); color: var(--fg-primary); }

/* The confirming button of a destructive ask(). No fill — a filled red slab
   reads as the safe default, which is the opposite of what it is. Plain text
   that greys up under the pointer, like the context menu's own Delete. */
button.danger {
  background: none; border: none; color: var(--danger); font-weight: 600;
}
button.danger:hover:not(:disabled) { background: var(--bg-raised); color: var(--danger); }
button.danger:disabled { opacity: 0.45; }

/* ---- the rule sentence ----
   A rule is edited as the sentence it reads as: the variable words open menus,
   the fixed words are just text. Taken from the generator header on the design
   board, where the control IS the sentence rather than a stack of selects with
   their labels repeated above them. */

.rulesentence {
  display: flex; flex-wrap: wrap; align-items: center; gap: 2px 3px;
  padding-top: 10px; border-top: 1px solid var(--border-default);
  font-size: 13px; line-height: 1.7;
}
.rulesentence .w { color: var(--fg-muted); padding: 0 3px; }

button.pick {
  height: 26px; padding: 0 4px 0 7px; display: inline-flex; align-items: center; gap: 2px;
  background: none; border: none; border-radius: 7px;
  color: var(--fg-primary); font-family: inherit; font-size: 13px; font-weight: 600;
  cursor: pointer; transition: background 150ms, color 150ms;
  max-width: 100%; white-space: nowrap; overflow: hidden;
}
button.pick:hover:not(:disabled) { background: var(--bg-raised); }
button.pick .ico { color: var(--fg-muted); flex: none; }
button.pick.empty { color: var(--border-control); font-weight: 500; }

/* The value, typed rather than chosen. It grows with what it holds so the
   sentence does not carry a full-width box in the middle of it. */
.wordin {
  height: 26px; min-height: 26px; width: auto; padding: 0 7px;
  background: var(--bg-inset); border: 1px solid var(--border-default); border-radius: 7px;
  color: var(--fg-primary); font-family: inherit; font-size: 13px; font-weight: 600;
  outline: none;
}
.wordin:focus { border-color: var(--accent-base); }
.wordin::-webkit-outer-spin-button, .wordin::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.wordin[type="number"] { -moz-appearance: textfield; }

button.addcond {
  height: 26px; padding: 0 8px 0 6px; display: inline-flex; align-items: center; gap: 4px;
  background: none; border: 1px dashed var(--border-strong); border-radius: 7px;
  color: var(--fg-muted); font-family: inherit; font-size: 12.5px; font-weight: 600;
  cursor: pointer; transition: color 150ms, border-color 150ms;
}
button.addcond:hover:not(:disabled) { color: var(--fg-primary); border-color: var(--fg-muted); }

/* The menu a picked word opens: the context menu, with the current choice ticked. */
.ctxmenu.picks { min-width: 170px; max-width: 320px; max-height: 300px; overflow-y: auto; }
.ctxmenu.picks .mi { gap: 10px; }
.ctxmenu.picks .mi .ico { margin-left: auto; color: var(--accent-base); flex: none; }
.ctxmenu.picks .mi.on { color: var(--fg-primary); }
.ctxmenu.picks .mi .l { flex: 1; overflow: hidden; text-overflow: ellipsis; }
.ctxmenu.picks .mi .kind {
  flex: none; width: 52px; font-size: 10.5px; font-weight: 700;
  letter-spacing: 0.06em; text-transform: uppercase; color: var(--border-control);
}

/* ---- behavior ---- */

.funnel { display: flex; flex-direction: column; gap: 3px; }
.fstep {
  display: grid; grid-template-columns: minmax(0, 190px) 1fr 68px 62px;
  gap: 14px; align-items: center; padding: 6px 0;
}
.fstep .l { font-size: 12.5px; color: var(--fg-secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fstep .bar { height: 10px; border-radius: 5px; background: var(--data-track); overflow: hidden; }
.fstep .bar > i { display: block; height: 100%; border-radius: 5px; background: var(--data-3); }
.fstep:first-child .bar > i { background: var(--data-1); }
.fstep .n { font-family: var(--mono); font-size: 12.5px; text-align: right; color: var(--fg-primary); }
.fstep .p { font-family: var(--mono); font-size: 12px; text-align: right; color: var(--fg-muted); }
/* A step that lost more than a seventh of the people the one above it had. */
.fstep.sharp .bar > i { background: var(--warning); }
.fstep.sharp .p { color: var(--warning); }

.ftable { display: flex; flex-direction: column; }
/* Not .frow: that is the nav's form row, and a table row wearing its class
   inherits its click as well as its paint. */
.bhead, .brow {
  display: grid; grid-template-columns: minmax(0, 1fr) 62px 86px 66px 66px;
  gap: 10px; align-items: center;
}
.bhead {
  padding: 0 8px 8px; border-bottom: 1px solid var(--bg-raised);
  font-size: 10.5px; font-weight: 700; letter-spacing: 0.09em; color: var(--fg-muted);
}
.bhead span:not(:first-child), .brow .v { text-align: right; }
.brow {
  padding: 10px 8px; border-radius: 8px; cursor: pointer;
  border-bottom: 1px solid var(--bg-raised);
  transition: background 150ms;
}
.brow:hover { background: var(--bg-raised); }
.brow.on { background: var(--accent-subtle); }
.brow .q { font-size: 12.5px; color: var(--fg-secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.brow .v { font-family: var(--mono); font-size: 12px; color: var(--fg-muted); }
.brow.warn .q, .brow.bad .q { color: var(--fg-primary); }
.brow.warn .v:nth-child(3) { color: var(--warning); }
.brow.bad  .v:nth-child(3), .brow.bad .v:nth-child(5) { color: var(--danger); }

.fdrill {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px;
  padding: 14px 10px 16px; margin-bottom: 4px;
  background: var(--bg-inset); border-radius: 10px;
}
.fdrill .ds { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.fdrill .k { font-size: 10.5px; font-weight: 700; letter-spacing: 0.09em; color: var(--fg-muted); }
.fdrill .v { font-family: var(--mono); font-size: 20px; font-weight: 700; color: var(--fg-primary); }
.fdrill .s { font-size: 11.5px; line-height: 1.45; color: var(--border-control); text-wrap: pretty; }

.segs { display: flex; flex-direction: column; gap: 13px; }
.seg .t { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 6px; }
.seg .t b { font-size: 12.5px; font-weight: 600; }
.seg .t span { font-family: var(--mono); font-size: 11px; color: var(--border-control); }
.seg .bar { height: 8px; border-radius: 4px; background: var(--data-track); overflow: hidden; }
.seg .bar > i { display: block; height: 100%; border-radius: 4px; background: var(--data-2); }

.panel.off { align-items: flex-start; gap: 12px; max-width: 70ch; }
.panel.off b { font-size: 15px; }
.panel.off p { font-size: 13px; line-height: 1.6; color: var(--fg-muted); margin: 0; text-wrap: pretty; }

/* The screen after a form is sent: the mark, centred, and one line. */
.thanks {
  min-height: 100vh; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 22px; padding: 40px;
}
.thanks .star { display: block; }
.thanks h2 {
  font-size: 22px; font-weight: 700; letter-spacing: -0.02em;
  text-align: center; text-wrap: pretty;
}
