/* QA-Genius v2 design system.
 * Tokens first, then the shell, then components. Every colour is a token so
 * the dark theme is a re-declaration and nothing else.
 *
 * The palette is cobalt (the rail, links, focus), sunny yellow (the one main
 * button on a screen) and red-orange (warnings and counts that matter).
 * Status colours are reserved (ok/warn/bad/info) and always ship with a word,
 * never hue alone. The risk heat map uses one sequential ramp for magnitude.
 *
 * Three families: Source Serif 4 for titles and big numbers, Noto Sans for
 * everything you read, JetBrains Mono for small labels, ids and code. */

/* ---------------------------------------------------------------- tokens */
:root{
  color-scheme:light;

  /* Surfaces: cool paper canvas, true-white cards so they lift. */
  --canvas:#F4F5FA;
  --canvas-2:#ECEEF7;
  --card:#FFFFFF;
  --card-2:#F8F9FD;
  --card-3:#EDF0FA;
  --rail:#202F77;
  --rail-2:#2E3F99;
  --rail-ink:#FFFFFF;
  --rail-ink-2:#C9D1F5;

  --border:#E6E9F4;
  --border-strong:#D3D8EA;

  /* Ink, darkest first. The old set read at 15:1 / 7.7:1 / 4.9:1 on a card,
   * which was legal and still thin on a bright screen. These clear 18:1,
   * 12:1 and 7.5:1, so a sentence holds its weight at 15px. */
  --text:#0F1430;
  --text-2:#2E3553;
  --muted:#4B5373;

  --accent:#2E3F99;
  --accent-2:#4C5FD5;
  --accent-deep:#202F77;
  --accent-soft:#DEE4FF;
  --accent-ink:#263484;
  --on-accent:#FFFFFF;

  /* The one main button on a screen, and nothing else. */
  --cta:#FFD166;
  --cta-hover:#FFC53D;
  --on-cta:#1B2140;

  /* A big filled strip is not a button. It is the same yellow here and a
   * muted amber in the dark, where a full-width block of --cta glares. */
  --strip:#FFD166;
  --on-strip:#1B2140;

  /* What a reader types into. A field the same colour as the card it sits
   * on has no shape of its own; in the dark that was the whole problem. */
  --field:#FFFFFF;

  /* The count beside My stories, on the rail. */
  --count-bg:#3D4EB5;
  --count-fg:#FFFFFF;

  /* Warnings, counts that matter, high risk. */
  --alert:#FF6A4D;
  --alert-soft:#FFE8E2;

  /* Reserved status scale. Never used for series identity. */
  --ok-bg:#E3F5EC;   --ok-fg:#17694A;   --ok-line:#2E9E6B;
  --warn-bg:#FFF3CF; --warn-fg:#7A5A00; --warn-line:#E0A800;
  --bad-bg:#FFE8E2;  --bad-fg:#B23A1E;  --bad-line:#E2553A;
  --info-bg:#E8ECFF; --info-fg:#2E3F99; --info-line:#4C5FD5;

  /* Sequential ramp (magnitude). One hue, light -> dark. */
  --seq-1:#FFF1EC; --seq-2:#FFDCD2; --seq-3:#FFBFAE;
  --seq-4:#FF9A82; --seq-5:#F2694A; --seq-6:#D14228;

  --r-sm:8px; --r:10px; --r-card:16px; --r-lg:20px;

  /* One height for every control and button, so a select never stands
   * taller than the input beside it. --form-w keeps a line readable. */
  --ctl-h:40px; --ctl-h-sm:32px; --ctl-h-lg:44px; --form-w:760px;

  --shadow-1:0 1px 2px rgba(27,33,64,.05);
  --shadow-2:0 2px 6px rgba(27,33,64,.05), 0 12px 32px -12px rgba(27,33,64,.18);
  --shadow-3:0 28px 64px -18px rgba(27,33,64,.34);
  --ring:0 0 0 3px rgba(46,63,153,.32);

  --rail-w:252px;
  --ease:cubic-bezier(.2,.7,.3,1);

  --font-serif:"Source Serif 4",Georgia,"Times New Roman",serif;
  --font-sans:"Noto Sans",system-ui,-apple-system,"Segoe UI",sans-serif;
  --font-mono:"JetBrains Mono",ui-monospace,monospace;
}

:root[data-theme="dark"]{
  color-scheme:dark;
  --canvas:#0E1430;
  --canvas-2:#0A0F27;
  --card:#161E42;
  --card-2:#1C2550;
  --card-3:#232C5E;
  --rail:#0A0F27;
  --rail-2:#1F2A66;
  --rail-ink:#FFFFFF;
  --rail-ink-2:#C9D1F5;

  --border:#2A3466;
  --border-strong:#3A4680;

  --text:#F2F4FC;
  --text-2:#CDD3EE;
  --muted:#A3ABCF;

  --accent:#9DAEFF;
  --accent-2:#B4C1FF;
  --accent-deep:#C9D4FF;
  --accent-soft:#26306A;
  --accent-ink:#D5DDFF;
  --on-accent:#0E1430;

  /* The yellow stays yellow in the dark; it is the same one button. */
  --cta:#FFD166;
  --cta-hover:#FFC53D;
  --on-cta:#1B2140;

  /* A whole strip of #FFD166 on a dark page is a lamp. The amber carries
   * the same meaning at a size a reader can look at. */
  --strip:#E8B84A;
  --on-strip:#1B2140;

  /* Darker than the card behind it, so a box has an edge of its own.
     #0F1636 was rgb 15,22,54 against a page of rgb 14,20,48: a difference
     nobody could see. This one reads as a well in the card. */
  --field:#0A1029;
  /* The amber strip as a soft fill rather than a solid bar: a full-width
     block of yellow on a dark page is a lamp. */
  --strip-soft:rgba(232,184,74,.16);
  --strip-soft-ink:#F2C96B;
  --strip-soft-line:#E8B84A;

  --count-bg:#3D4EB5;
  --count-fg:#FFFFFF;

  --alert:#FF8A70;
  --alert-soft:#4A2419;

  --ok-bg:#123D2C;   --ok-fg:#7FD9AE;   --ok-line:#2E9E6B;
  --warn-bg:#3B2E0A; --warn-fg:#F0C66A; --warn-line:#E0A800;
  --bad-bg:#3C1A12;  --bad-fg:#FFA48C;  --bad-line:#E2553A;
  --info-bg:#1B2456; --info-fg:#A9B8FF; --info-line:#4C5FD5;

  /* The old floor was #2A1E26, which on a #0E1430 canvas was a square
     nobody could see at all. The ramp starts somewhere visible now. */
  --seq-1:#3A2B33; --seq-2:#55342C; --seq-3:#75402D;
  --seq-4:#99502F; --seq-5:#BC5B39; --seq-6:#E0714A;

  --shadow-1:0 1px 2px rgba(0,0,0,.4);
  --shadow-2:0 2px 6px rgba(0,0,0,.3), 0 12px 32px -12px rgba(0,0,0,.6);
  --shadow-3:0 28px 64px -18px rgba(0,0,0,.75);
  /* Yellow in the dark, cobalt in the light: the ring is always the colour
   * with the most room against the surface behind it. */
  --ring:0 0 0 3px rgba(255,209,102,.45);
}

/* The hidden attribute wins. A component rule that sets display (.row, .btn,
 * .card) used to beat it, so elements the JS had hidden stayed on screen -
 * the bug desk showed a broken screenshot preview with nothing attached. */
[hidden]{display:none !important}

/* ------------------------------------------------------------ base type */
*{box-sizing:border-box}
html,body{margin:0;padding:0}
html{scroll-behavior:smooth}
/* 450 is Noto Sans's variable axis a little above regular: the same shapes
 * with enough ink to hold a line of 15px text. The old -webkit-font-smoothing
 * was what thinned every sentence on a Mac, so it is gone. */
body{background:var(--canvas);color:var(--text);
  font-family:var(--font-sans);
  font-size:15px;font-weight:450;line-height:1.55;
  text-rendering:optimizeLegibility}
/* Titles and big numbers are serif; the weight stays light because the
 * shape, not the ink, is what makes a serif title read as a title. */
h1,h2,h3,h4,.num,.display,.stat-num{font-family:var(--font-serif);
  font-weight:500;letter-spacing:-.008em}
code,pre,.mono{font-family:var(--font-mono)}
a{color:var(--accent);text-underline-offset:2px}
::selection{background:var(--accent-soft);color:var(--accent-ink)}

/* One ring on every focusable thing: cobalt on light, yellow on dark. */
:focus-visible{outline:none;box-shadow:var(--ring);border-radius:4px}
/* …except the title of a result, which the page moves the keyboard to
   after an AI run. Tab cannot reach it, so a ring round it is only a
   box drawn round a heading nobody pressed. */
[tabindex="-1"]:focus,[tabindex="-1"]:focus-visible{outline:none;box-shadow:none}

/* ---------------------------------------------------------------- shell */
.layout{min-height:100vh}

.sidebar{position:fixed;inset:0 auto 0 0;width:var(--rail-w);z-index:40;
  background:var(--rail);color:var(--rail-ink);
  display:flex;flex-direction:column;overflow-y:auto;
  border-right:1px solid rgba(255,255,255,.06)}
.sidebar::after{content:"";position:absolute;inset:0;pointer-events:none;
  background:radial-gradient(460px 240px at 0% 0%,rgba(255,255,255,.07),transparent 70%)}
.sidebar>*{position:relative;z-index:1}

/* A yellow square with a cobalt star, the name in serif, the room it is
 * in underneath in mono. */
.logo{padding:22px 18px 18px;font-family:var(--font-serif);
  font-weight:600;font-size:19px;letter-spacing:-.01em;
  display:flex;align-items:center;gap:11px;color:#fff;text-decoration:none}
.logo-mark{width:34px;height:34px;flex:0 0 34px;border-radius:10px;
  background:var(--cta);color:#202F77;
  display:inline-flex;align-items:center;justify-content:center;
  font-size:17px;font-weight:700;line-height:1;
  box-shadow:0 2px 10px rgba(0,0,0,.25)}
.logo-words{line-height:1.15}
.logo-sub{display:block;font-family:var(--font-mono);font-size:13px;
  font-weight:500;letter-spacing:.14em;text-transform:uppercase;
  color:var(--rail-ink-2);margin-top:3px}

.nav-group{padding:10px 12px 2px}
.nav-label{padding:10px 12px 8px;font-family:var(--font-mono);font-size:13px;
  font-weight:500;letter-spacing:.14em;text-transform:uppercase;
  color:var(--rail-ink-2)}
.nav{display:flex;flex-direction:column;gap:2px;padding:0}
.nav a{display:flex;align-items:center;gap:12px;padding:10px 14px;
  border-radius:var(--r);color:var(--rail-ink-2);text-decoration:none;
  font-weight:500;font-size:14.5px;position:relative;
  transition:background .14s var(--ease),color .14s var(--ease)}
.nav-n{font-family:var(--font-mono);font-size:13px;letter-spacing:.04em;
  color:var(--rail-ink-2);flex:0 0 16px;opacity:.85}
.nav a:hover{background:rgba(255,255,255,.07);color:#fff}
.nav a.active{background:var(--rail-2);color:#fff;font-weight:600}
.nav a.active .nav-n{color:#fff;opacity:1}
/* Three yellow pixels against the cobalt: where you are, at a glance. */
.nav a.active::before{content:"";position:absolute;left:0;top:50%;
  transform:translateY(-50%);width:3px;height:70%;border-radius:0 3px 3px 0;
  background:var(--cta)}
.nav-tag{margin-left:auto;font-family:var(--font-mono);font-size:13px;
  letter-spacing:.06em;text-transform:uppercase;padding:2px 7px;
  border-radius:999px;background:rgba(255,255,255,.12);color:var(--rail-ink-2)}

.rail-foot{margin-top:auto;padding:16px;display:flex;flex-direction:column;
  gap:4px;border-top:1px solid rgba(255,255,255,.1)}
/* "LOCAL-FIRST · NO ACCOUNT" wants 225px at .12em and the rail gives it
   219px, so it broke onto a second line with "ACCOUNT" alone. At .06em it
   takes 206px and still reads as the spaced-out mono label it is; nowrap
   keeps it one line if the wording ever grows, and the sideways-scroll
   check in scripts/check_polish.py catches it if it grows too far. */
.rail-foot-label{font-family:var(--font-mono);font-size:13px;font-weight:500;
  letter-spacing:.06em;text-transform:uppercase;color:var(--rail-ink);
  white-space:nowrap}
.rail-foot-line{font-size:13px;color:var(--rail-ink-2)}
.rail-foot strong{color:var(--rail-ink);font-weight:600}

.main{margin-left:var(--rail-w);min-width:0;display:flex;flex-direction:column;
  min-height:100vh}

.topbar{position:sticky;top:0;z-index:30;height:58px;flex:0 0 58px;
  display:flex;align-items:center;gap:10px;padding:0 24px;
  border-bottom:1px solid var(--border);
  background:color-mix(in srgb,var(--canvas) 86%,transparent);
  backdrop-filter:saturate(1.4) blur(10px)}
.crumb{display:flex;align-items:center;gap:7px;font-size:13.5px;
  color:var(--text-2);font-weight:500;min-width:0}
.crumb b{font-weight:700;color:var(--text);letter-spacing:-.005em}
.crumb .sep{color:var(--muted)}
.topbar-right{margin-left:auto;display:flex;align-items:center;gap:8px}

:root[data-theme="dark"] .theme-sun{display:none}
:root:not([data-theme="dark"]) .theme-moon{display:none}
.theme-moon,.theme-sun{display:inline-flex}

/* The key chip is a calm outline button. It is never yellow and never
 * red-orange: the yellow on a screen belongs to that screen's one main
 * button, and this is not it. */
.key-chip{display:inline-flex;align-items:center;gap:8px;
  padding:7px 13px;border-radius:999px;cursor:pointer;
  border:1px solid var(--border-strong);background:var(--card);
  color:var(--text);font-weight:600;font-size:13px;font-family:inherit;
  box-shadow:var(--shadow-1);
  transition:border-color .14s var(--ease),box-shadow .14s var(--ease)}
.key-chip:hover{border-color:var(--accent);box-shadow:var(--shadow-2)}
.key-chip.empty{background:var(--card);color:var(--accent);
  border-color:var(--accent)}
.key-chip svg{width:14px;height:14px}
/* With a key saved the dot says so and the keyhole steps out, except on a
 * narrow phone where the dot alone would be all that is left of the chip. */
.key-chip:not(.empty) #key-chip-icon{display:none}
@media (max-width:420px){.key-chip:not(.empty) #key-chip-icon{display:block}}
.dot{width:7px;height:7px;border-radius:50%;background:var(--ok-line);
  box-shadow:0 0 0 3px color-mix(in srgb,var(--ok-line) 20%,transparent)}

.content{padding:26px 24px 72px;max-width:1080px;width:100%;margin:0 auto}

/* ----------------------------------------------------------- page header */
/* One header on every page: a small mono label, a serif title, one line of
 * plain words, and -- on the right -- an outlined pill of counts. */
.page-head{margin:2px 0 22px;display:grid;
  grid-template-columns:minmax(0,1fr) auto;gap:10px 18px;align-items:start}
.page-head > :not(.page-pill){grid-column:1}
.page-head h1,h1.page-title{margin:0;font-family:var(--font-serif);
  font-size:40px;font-weight:500;line-height:1.1;letter-spacing:-.012em}
h1.page-title-hero{font-size:56px}
.page-head .lede{margin:7px 0 0;color:var(--text-2);font-size:15px;max-width:68ch}
.page-head .row{margin-top:14px}
.page-pill{grid-column:2;grid-row:1 / span 3;justify-self:end;align-self:center;
  font-family:var(--font-mono);font-size:13px;font-weight:500;
  letter-spacing:.08em;text-transform:uppercase;color:var(--text-2);
  background:var(--card);
  border:1px solid var(--border-strong);border-radius:999px;padding:5px 12px;
  white-space:nowrap}
.eyebrow{display:inline-flex;align-items:center;gap:8px;
  font-family:var(--font-mono);font-size:13px;font-weight:500;
  letter-spacing:.14em;text-transform:uppercase;
  color:var(--accent);margin-bottom:9px}
.card-title{margin:0 0 10px;font-family:var(--font-serif);font-size:22px;
  font-weight:500;letter-spacing:-.008em;line-height:1.25}
@media (max-width:760px){
  .page-head{grid-template-columns:minmax(0,1fr)}
  .page-pill{grid-column:1;grid-row:auto;justify-self:start}
  .page-head h1,h1.page-title{font-size:30px}
  h1.page-title-hero{font-size:34px}
}

/* --------------------------------------------------------------- cards */
.card{background:var(--card);border:1px solid var(--border);
  border-radius:var(--r-card);padding:24px;margin-bottom:16px;
  box-shadow:var(--shadow-1)}
.card-raised{box-shadow:var(--shadow-2)}
/* One size for a card title, one for a sub-section inside it. */
.card h2{margin:0 0 10px;font-size:22px;font-weight:500;letter-spacing:-.008em}
.card h3{margin:18px 0 8px;font-family:var(--font-sans);font-size:14px;
  font-weight:600;letter-spacing:-.008em}
.card > h3:first-child{margin-top:0}
/* Where an h3 is the card's own title rather than a section inside it. */
.risk-card h3,#insights-explanation-card > h3{margin:0 0 8px;font-size:15.5px}
.panel-head h2,.drawer-head h2{font-size:20px}
.card p{margin:8px 0;color:var(--text-2)}
.card > :last-child{margin-bottom:0}
.card-quiet{background:var(--card-2);box-shadow:none}
/* A card that holds nothing but a form stops where the form stops, instead
 * of stretching a 760px column across a 1080px page. Result cards, which
 * carry tables and code, keep the full width. */
.card-form{max-width:calc(var(--form-w) + 48px)}

/* A section card deep in a result gets a hairline accent so the eye can
 * find where one answer stops and the next begins. */
.card-section{position:relative;padding-left:22px}
.card-section::before{content:"";position:absolute;left:0;top:18px;bottom:18px;
  width:3px;border-radius:0 3px 3px 0;background:var(--accent);opacity:.3}

.panel{background:var(--card);border:1px solid var(--border);
  border-radius:var(--r-lg);box-shadow:var(--shadow-2);overflow:hidden;
  margin-bottom:18px}
.panel-head{display:flex;align-items:center;gap:12px;flex-wrap:wrap;
  padding:16px 22px;border-bottom:1px solid var(--border);background:var(--card-2)}
.panel-head h2{margin:0;font-size:16px}
.panel-body{padding:20px 22px}

/* The hero band a long answer opens with: verdict, score, the one meter. */
.verdict{position:relative;overflow:hidden;border-radius:var(--r-lg);
  border:1px solid var(--border);box-shadow:var(--shadow-2);
  background:linear-gradient(160deg,var(--card),var(--card-2));
  padding:22px;margin-bottom:16px;
  display:grid;grid-template-columns:auto 1fr;gap:22px;align-items:center}
.verdict::after{content:"";position:absolute;inset:0;pointer-events:none;
  background:radial-gradient(520px 200px at 100% 0%,var(--accent-soft),transparent 72%);
  opacity:.75}
.verdict>*{position:relative;z-index:1}
/* The ring sizes itself from one number, and the number inside sizes itself
 * from the ring, so "100%" fits the same way "7%" does at every width. */
.score-ring{--ring-size:104px;
  width:var(--ring-size);height:var(--ring-size);flex:0 0 var(--ring-size);
  border-radius:50%;
  display:grid;place-items:center;position:relative;
  background:conic-gradient(var(--ring-color,var(--accent)) calc(var(--pct,0)*1%),
    var(--card-3) 0)}
.score-ring::before{content:"";position:absolute;inset:9px;border-radius:50%;
  background:var(--card);box-shadow:inset 0 1px 3px rgba(28,24,16,.07)}
.score-ring .score-num{position:relative;font-family:var(--font-serif);
  font-size:clamp(17px,calc(var(--ring-size) * .25),26px);
  font-weight:700;letter-spacing:-.03em;line-height:1;
  /* Same width for every digit, so 100 is never wider than the circle. */
  font-variant-numeric:tabular-nums;font-feature-settings:"tnum" 1;
  display:inline-flex;align-items:baseline;justify-content:center;
  white-space:nowrap;max-width:calc(var(--ring-size) - 32px)}
/* The unit is a footnote to the number, never half the room it takes. */
/* A footnote to the number, with a floor: at .55em of a 13px ring the
   per-cent sign came out at 7px. */
.score-ring .score-num .pct{font-size:max(12px,.55em);font-weight:600;
  margin-left:.04em}
.score-ring .score-of{position:relative;font-size:13px;color:var(--muted);
  margin-top:1px;letter-spacing:.04em}
@media (max-width:620px){.score-ring{--ring-size:92px}}
.verdict h2{margin:0 0 4px;font-size:21px;letter-spacing:-.022em}
.verdict p{margin:0;color:var(--text-2);max-width:62ch}
@media (max-width:620px){.verdict{grid-template-columns:1fr;text-align:left}}

/* A faded sample of the answer, so the right half of the Story step is not
   half a page of nothing before the first press. */
.result-preview{opacity:.55;pointer-events:none;user-select:none}
.result-preview .preview-head{margin:14px 0 4px;font-weight:600;font-size:14px}
.result-preview .preview-sub{margin:0;font-size:13px;color:var(--text-2)}
.result-preview .preview-score{display:flex;align-items:center;gap:14px;
  margin-top:8px}
.result-preview .preview-score .preview-head{margin:0}
.preview-ring{width:64px;height:64px;flex:0 0 64px;border-radius:50%;
  border:7px solid var(--border-strong)}
.preview-chips{gap:6px;margin:0}
.preview-lines{margin:4px 0 12px;padding-left:18px;color:var(--text-2);
  font-size:13px}
.preview-lines li{margin:3px 0}
/* A button that reads as a link: it is an offer, not the next step. */
.btn.link-button{background:transparent;border-color:transparent;
  box-shadow:none;padding-left:4px;padding-right:4px;
  color:var(--accent);text-decoration:underline;font-weight:600}
.btn.link-button:hover{background:transparent;color:var(--accent-deep)}

/* ------------------------------------------------------- numbers & tiles */
.stat-row{display:grid;grid-template-columns:repeat(auto-fit,minmax(150px,1fr));
  gap:12px;margin-bottom:16px}
.stat{background:var(--card);border:1px solid var(--border);
  border-radius:var(--r-card);padding:15px 17px;box-shadow:var(--shadow-1);
  transition:transform .16s var(--ease),box-shadow .16s var(--ease)}
.stat:hover{transform:translateY(-1px);box-shadow:var(--shadow-2)}
.stat .num,.stat-num{font-family:var(--font-serif);font-size:30px;
  font-weight:500;line-height:1.1;letter-spacing:-.01em;display:block}
.stat .num .unit{font-size:16px;font-weight:600;color:var(--text-2);
  letter-spacing:0;margin-left:1px}
.stat .lbl,.stat-label{font-size:13px;color:var(--text-2);margin-top:4px;
  font-weight:500}
.stat-accent .num{color:var(--accent)}
.stat.stat-bad{background:var(--bad-bg);border-color:color-mix(in srgb,var(--bad-line) 34%,transparent)}
.stat.stat-bad .num,.stat.stat-bad .lbl{color:var(--bad-fg)}
.stat.stat-ok{background:var(--ok-bg);border-color:color-mix(in srgb,var(--ok-line) 30%,transparent)}
.stat.stat-ok .num,.stat.stat-ok .lbl{color:var(--ok-fg)}
/* Worth knowing, not worth worrying about. Red is for a real problem. */
.stat.stat-warn{background:var(--warn-bg);border-color:color-mix(in srgb,var(--warn-line) 32%,transparent)}
.stat.stat-warn .num,.stat.stat-warn .lbl{color:var(--warn-fg)}

/* Meter: the fill carries severity, the track is a quiet step of the surface. */
.meter{height:8px;border-radius:999px;background:var(--card-3);
  overflow:hidden;margin:6px 0 10px}
.meter-fill{display:block;height:100%;border-radius:999px;transition:width .45s var(--ease)}
.meter-fill.ok{background:var(--ok-line)}
.meter-fill.warn{background:var(--warn-line)}
.meter-fill.bad{background:var(--bad-line)}
.stat .meter{margin:9px 0 0}
/* A stat with its own small ring beside the number. */
.stat-with-ring{display:flex;align-items:center;gap:14px;
  justify-content:space-between}
.score-ring.stat-ring{--ring-size:56px}
.score-ring.stat-ring::before{inset:5px}
/* The clamp's floor is sized for the big ring; at 56px "100%" needs its own
 * floor or it runs over the edge of the circle. */
.score-ring.stat-ring .score-num{font-size:13px;
  max-width:calc(var(--ring-size) - 18px)}
.stat-row-4{grid-template-columns:repeat(auto-fit,minmax(190px,1fr))}
/* One compact row: four numbers that belong together, at a height that
   does not push the risks themselves below the fold. */
.stat-row-tight{gap:10px;margin-bottom:14px}
.stat-row-tight .stat{padding:10px 14px}
.stat-row-tight .stat .num{font-size:24px}
.stat-row-tight .stat .lbl{margin-top:2px}

/* ---------------------------------------------------------------- pills */
.pill{display:inline-flex;align-items:center;gap:5px;padding:3px 9px;
  border-radius:999px;font-size:13px;font-weight:600;white-space:nowrap;
  letter-spacing:.005em;line-height:1.5}
.pill::before{content:"";width:5px;height:5px;border-radius:50%;
  background:currentColor;opacity:.72;flex:0 0 5px}
.pill.ok{background:var(--ok-bg);color:var(--ok-fg)}
.pill.warn{background:var(--warn-bg);color:var(--warn-fg)}
.pill.bad{background:var(--bad-bg);color:var(--bad-fg)}
.pill.info{background:var(--info-bg);color:var(--info-fg)}
.pill.accent{background:var(--accent-soft);color:var(--accent-ink)}
.pill.neutral{background:var(--card-3);color:var(--text-2)}
.pill.small{font-size:13px;padding:2px 7px}
/* The mono pills (RPN, ids) read as labels, not states. */
.pill.plain::before{display:none}

/* ------------------------------------------------- shared components (R1) */
/* Chips: a small round label. A chip is a state or an id, never a button -
 * the filter buttons keep .btn.chip and their own rule further down. */
.chip{display:inline-flex;align-items:center;gap:5px;padding:3px 10px;
  border-radius:999px;font-size:13px;font-weight:600;line-height:1.6;
  white-space:nowrap;background:var(--card-3);color:var(--text-2);
  border:1px solid transparent}
.chip-ok{background:var(--ok-bg);color:var(--ok-fg)}
.chip-warn{background:var(--warn-bg);color:var(--warn-fg)}
.chip-bad{background:var(--bad-bg);color:var(--bad-fg)}
.chip-info{background:var(--info-bg);color:var(--info-fg)}
.chip-id{font-family:var(--font-mono);font-size:13px;font-weight:500;
  letter-spacing:.02em;background:var(--accent-soft);color:var(--accent-ink)}
/* An id is a label, not a state, so it never carries the pill's dot. */
.pill.chip-id{font-family:var(--font-mono);font-size:13px}
.pill.chip-id::before{display:none}

/* A trace reads left to right: story, then criterion, then test. */
.trace{display:flex;align-items:center;gap:6px;flex-wrap:wrap;max-width:100%}
/* A chip is normally one unbreakable word. A trace chip may hold a list, so
   it is allowed to break rather than to widen the page it sits on. */
.trace .chip{max-width:100%;white-space:normal;overflow-wrap:anywhere}
.trace .arrow{color:var(--alert);font-weight:700;font-size:13px;
  line-height:1;user-select:none}

/* A note box: one line of plain words with a coloured edge.
 * The drawer's own .note is more specific, so it keeps its look. */
.note,.note-box{border-left:3px solid var(--info-line);background:var(--info-bg);
  color:var(--info-fg);border-radius:0 var(--r) var(--r) 0;
  padding:11px 14px;margin:12px 0;font-size:13.5px}
.note.note-warn,.note-box.note-warn{border-left-color:var(--warn-line);
  background:var(--warn-bg);color:var(--warn-fg)}
.note.note-bad,.note-box.note-bad{border-left-color:var(--bad-line);
  background:var(--bad-bg);color:var(--bad-fg)}
.note.note-ok,.note-box.note-ok{border-left-color:var(--ok-line);
  background:var(--ok-bg);color:var(--ok-fg)}
.note a,.note-box a{color:inherit;font-weight:600}
.note > :first-child,.note-box > :first-child{margin-top:0}
.note > :last-child,.note-box > :last-child{margin-bottom:0}

/* An icon tile: a 32px rounded square holding one outline icon. */
.icon-tile{width:32px;height:32px;flex:0 0 32px;border-radius:var(--r-sm);
  display:grid;place-items:center;background:var(--accent-soft);
  color:var(--accent-ink)}
.icon-tile svg{width:17px;height:17px;display:block}
.icon-tile.tile-ok{background:var(--ok-bg);color:var(--ok-fg)}
.icon-tile.tile-warn{background:var(--warn-bg);color:var(--warn-fg)}
.icon-tile.tile-bad{background:var(--bad-bg);color:var(--bad-fg)}
.icon-tile.tile-info{background:var(--info-bg);color:var(--info-fg)}
.icon-tile.tile-alert{background:var(--alert-soft);color:var(--bad-fg)}
.icon-tile.tile-quiet{background:var(--card-3);color:var(--text-2)}
.icon-tile-lg{width:40px;height:40px;flex:0 0 40px;border-radius:var(--r)}
.icon-tile-lg svg{width:20px;height:20px}

/* A count that wants to be noticed, next to a title. */
.count-badge{display:inline-grid;place-items:center;min-width:24px;height:24px;
  padding:0 7px;border-radius:999px;background:var(--alert);
  /* White on this orange is 2.8:1. The dark ink is 5.5:1 and still reads
   * as the loud badge it is meant to be. */
  color:var(--on-cta);
  font-size:13px;font-weight:700;line-height:1}

/* -------------------------------------------------------------- buttons */
/* Three sizes, one height each, matching the controls. A secondary button no
 * longer lifts on hover - only the primary moves, so the eye knows which one
 * the page wants you to press. */
.btn{display:inline-flex;align-items:center;justify-content:center;gap:8px;
  height:var(--ctl-h);padding:0 16px;border-radius:var(--r);
  border:1px solid var(--border-strong);background:var(--card);
  color:var(--text);font-weight:600;cursor:pointer;font-family:inherit;
  text-decoration:none;font-size:14px;line-height:1.35;white-space:nowrap;
  box-shadow:var(--shadow-1);
  transition:box-shadow .14s var(--ease),filter .14s var(--ease),
    background .14s var(--ease),border-color .14s var(--ease)}
.btn:hover{border-color:var(--text-2);box-shadow:var(--shadow-2);transform:none}
.btn:active{box-shadow:var(--shadow-1)}
.btn:focus-visible{outline:none;box-shadow:var(--ring)}
/* The one main button on a screen. Yellow, dark text, nothing else is. */
.btn-primary{background:var(--cta);border-color:var(--cta);
  color:var(--on-cta);font-weight:600;
  box-shadow:0 1px 2px rgba(27,33,64,.12)}
.btn-primary:hover{background:var(--cta-hover);border-color:var(--cta-hover);
  filter:none;box-shadow:0 4px 14px -4px rgba(224,168,0,.6)}
.btn-primary:active{background:var(--cta-hover);box-shadow:none}
/* Save inside an open pop-up. A pop-up is its own screen state: while it is
   open it is the thing the page wants you to press, and while it is closed
   it is not on the screen at all. That is why it is yellow without being a
   second .btn-primary in the markup behind it. */
.btn.btn-pop-save{background:var(--cta);border-color:var(--cta);
  color:var(--on-cta);font-weight:600;
  box-shadow:0 1px 2px rgba(27,33,64,.12)}
.btn.btn-pop-save:hover{background:var(--cta-hover);border-color:var(--cta-hover);
  filter:none;box-shadow:0 4px 14px -4px rgba(224,168,0,.6)}
.btn.btn-pop-save:active{background:var(--cta-hover);box-shadow:none}
.btn-ghost{background:transparent;border-color:transparent;box-shadow:none;
  color:var(--text-2)}
.btn-ghost:hover{background:var(--card-2);border-color:var(--border);
  color:var(--text)}
/* Delete, Remove, Clear: quiet until you hover, then unmistakably red. */
.btn-danger{background:transparent;color:var(--bad-fg);box-shadow:none;
  border-color:color-mix(in srgb,var(--bad-line) 55%,transparent)}
.btn-danger:hover{background:var(--bad-bg);border-color:var(--bad-line);
  box-shadow:none}
.btn:disabled,.btn[aria-disabled="true"]{opacity:.55;cursor:not-allowed;
  box-shadow:var(--shadow-1)}
/* A working button is disabled so it cannot be pressed twice, but it is not
 * switched off: it keeps its colour and shows its spinner. */
.btn[aria-busy="true"]:disabled{opacity:1;cursor:progress}
.btn-small,.btn-sm{height:var(--ctl-h-sm);padding:0 12px;font-size:13px;
  border-radius:var(--r-sm)}
.btn-large{height:var(--ctl-h-lg);padding:0 20px;font-size:15px}
.btn-block{width:100%}
.btn-icon{width:36px;height:36px;padding:0;flex:0 0 36px;
  color:var(--text-2);border-color:var(--border)}
.btn-icon:hover{color:var(--text);border-color:var(--border-strong)}
.btn svg{width:15px;height:15px}
.btn-icon svg{width:16px;height:16px}

/* Working: the button keeps its width, the label says what is happening and
 * a spinner turns in front of it. */
/* The spinner takes its 13px out of the side padding, and app.js has already
 * pinned min-width to the idle width, so the button does not change size and
 * nothing on the row shifts under the cursor. */
.btn[aria-busy="true"]{pointer-events:none;padding-left:6px;padding-right:6px}
.btn[aria-busy="true"] .btn-label{opacity:.85}
.btn[aria-busy="true"]::before{content:"";width:13px;height:13px;
  flex:0 0 13px;border-radius:50%;
  border:2px solid color-mix(in srgb,currentColor 25%,transparent);
  border-top-color:currentColor;animation:spin .7s linear infinite}

/* Buttons that are not shaped like a button. They carry .btn so every button
 * on the page belongs to the system, and take their own shape back here -
 * .btn on its own would make a filter chip 40px tall. */
.btn.key-chip{height:auto;padding:7px 13px;border-radius:999px;font-size:13px;
  border-color:var(--border);box-shadow:var(--shadow-1)}
.btn.key-chip:hover{border-color:var(--border-strong);box-shadow:var(--shadow-2)}
.btn.to-top{padding:0;border-radius:50%}
.btn.chip{height:var(--ctl-h-sm);padding:0 12px;border-radius:999px;
  font-size:13px;font-weight:500;color:var(--text-2);
  border-color:var(--border)}
.btn.chip:hover{border-color:var(--border-strong)}
.btn.chip.now{color:var(--accent-ink);font-weight:650}
.btn.file-tab{height:auto;min-height:var(--ctl-h-sm);padding:8px 10px;
  justify-content:flex-start;text-align:left;font-weight:500;
  font-size:13px;white-space:normal;border-color:var(--border);
  box-shadow:none}
.btn.file-tab:hover{border-color:var(--border-strong);box-shadow:none}
/* box-shadow:none took the focus ring with it: a tab you had tabbed to
   looked exactly like one you had not. */
.btn.file-tab:focus-visible{box-shadow:var(--ring)}
.btn.file-tab.now{font-weight:650}

/* ------------------------------------------------------------- controls */
/* Every text-like control shares one height, one border and one focus ring.
 * .ctl is for controls built outside a .field; inside one the element
 * selectors carry it, so no template has to remember the class. */
.ctl,
.field input:not([type=checkbox]):not([type=radio]):not([type=file]),
.field select,.field textarea{
  height:var(--ctl-h);padding:0 12px;font:inherit;font-size:14px;
  border:1px solid var(--border-strong);border-radius:var(--r);
  background:var(--field);color:var(--text);width:100%;
  transition:border-color .14s var(--ease),box-shadow .14s var(--ease)}
.field textarea,textarea.ctl{height:auto;min-height:132px;padding:10px 12px;
  line-height:1.6;resize:vertical}
/* An optional long-text field should not shout as loud as a required one. */
.field textarea.short,textarea.ctl.short{min-height:84px}
/* A hint, not an answer. Faded and italic everywhere, so nothing in a
 * field ever reads like something that was typed into it. */
.ctl::placeholder,.field input::placeholder,
.field textarea::placeholder,input::placeholder,textarea::placeholder{
  color:var(--muted);font-style:italic;opacity:1}

/* Select: one chevron, same height as the inputs. The stroke is a literal
 * because a data URI cannot read a custom property; #858C84 is --muted in
 * the light theme and still reads on the dark card. */
.field select,select.ctl{appearance:none;-webkit-appearance:none;
  padding-right:36px;
  background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23858C84' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat:no-repeat;background-position:right 12px center;
  background-size:12px}

/* A count of attempts is not a sentence: give it the width of a number. */
.field input[type=number],input.ctl[type=number]{width:140px;
  font-variant-numeric:tabular-nums}

.ctl:focus,.ctl:focus-visible,
.field :is(input,select,textarea):focus,
.field :is(input,select,textarea):focus-visible{
  outline:none;border-color:var(--accent);box-shadow:var(--ring)}
.ctl[aria-invalid=true],
.field :is(input,select,textarea)[aria-invalid=true]{border-color:var(--bad-line)}
.ctl:disabled,.field :is(input,select,textarea):disabled{
  background:var(--card-2);color:var(--muted);cursor:not-allowed}

input[type=checkbox],input[type=radio]{width:16px;height:16px;
  accent-color:var(--accent);margin:0;vertical-align:-3px}
.choice{display:inline-flex;align-items:center;gap:8px;min-height:32px;
  cursor:pointer}
/* A checkbox row sits beside its neighbours. Without this, `.field > label`
 * blockifies it and four options become four lines. */
.field > label.choice{display:inline-flex}

/* --------------------------------------------------------------- fields */
/* One order everywhere: label, then hint, then the control, then the help
 * line and its counter. _form_fields.html is the only place that writes it. */
.field{margin-bottom:18px}
.field > label,.field > legend.label{display:block;font-size:14px;
  font-weight:500;margin-bottom:3px;color:var(--text)}
/* "(optional)" reads the same wherever it sits - beside a field label or in
 * a collapsible section's summary. */
.opt{font-weight:400;color:var(--muted)}
.field .hint{display:block;font-size:13px;color:var(--text-2);margin:0 0 7px}
.field-under{display:flex;justify-content:space-between;gap:12px;
  margin-top:6px;font-size:13px;color:var(--muted)}
.field-under .counter{font-variant-numeric:tabular-nums;white-space:nowrap}
.field-under .counter.near{color:var(--warn-fg)}
.field-under .counter.over{color:var(--bad-fg);font-weight:600}
.field-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));
  gap:12px;margin-bottom:18px}
.field-grid .field{margin-bottom:0}
.field-pair{display:grid;grid-template-columns:repeat(2,140px);gap:12px}
.field-pair label{font-size:13px;font-weight:500;color:var(--text-2);
  margin-bottom:4px;display:block}
/* ------------------------------------------------- principal QA (shadow QA)
 * Everything Shadow QA adds carries the same label: one accent pill, same
 * words, same size, on every desk. The blocks around it stay quiet so the
 * AI's own answer is still the thing you read first.
 */
/* One chip for the senior tester, the same amber on every desk. It is written
 * as .pill.pq-label because .pill.accent would otherwise win on specificity
 * and paint it cobalt on the test-cases card. */
.pill.pq-label,.chip.pq-label,.pq-label{flex:none;letter-spacing:.01em;
  font-weight:500;background:var(--warn-bg);color:var(--warn-fg)}
.pill.pq-label::before,.pq-label::before{display:none}
.pq-epic{border-color:color-mix(in srgb,var(--warn-line) 40%,transparent);
  background:linear-gradient(160deg,var(--warn-bg),var(--card));
  margin-bottom:16px}
.pq-epic-head{gap:9px;align-items:center;margin:0 0 8px}
.pq-epic-head strong{font-size:16px;color:var(--warn-fg)}
.pq-pills{gap:6px;flex-wrap:wrap;margin:0 0 9px}
.pq-split-link{margin-top:4px}
.pq-clean{gap:8px;align-items:center;margin:0 0 16px}
.pq-notes{list-style:none;margin:0;padding:0;display:grid;gap:9px}
.pq-note{display:flex;flex-wrap:wrap;align-items:baseline;gap:7px;
  padding:9px 11px;border-radius:var(--r-card);background:var(--card-2);
  border-left:3px solid var(--border)}
.pq-note.warn{border-left-color:var(--warn-line)}
.pq-note.info{border-left-color:var(--info-fg)}
.pq-note strong{font-weight:620}
.pq-note .muted{flex:1 1 220px}
/* A card the AI did not write. The hairline says so without shouting. */
.tc-card.pq-case{border-left:3px solid var(--accent);background:var(--card-2)}
.pq-why{margin:2px 0 0;color:var(--text-2);font-size:13px}
.pq-card-actions{margin-top:10px;gap:8px}
/* The senior tester's own card, marked by the one red-orange edge. */
.pq-review{border-left:3px solid var(--alert)}
.pq-review-head{gap:9px;align-items:center;margin:0}
.pq-review-line{margin:7px 0 0}
.pq-review[open] .pq-review-more{margin-top:11px}
.pq-review summary{cursor:pointer;list-style:none}
.pq-review summary::-webkit-details-marker{display:none}
.pq-review summary .pq-more-word{color:var(--accent);font-size:13px}
.pq-review ul{margin:6px 0 0;padding-left:18px}
/* A test that argues with a criterion: amber, because somebody has to
   decide which of the two is right. */
.pq-conflicts{list-style:none;padding-left:0;margin:6px 0 0}
.pq-conflicts li{background:var(--warn-bg);color:var(--warn-fg);
  border-left:3px solid var(--warn-line);border-radius:var(--r-sm);
  padding:8px 11px;margin:6px 0}
.pq-review li{margin:3px 0}


@media (max-width:640px){.field-grid{grid-template-columns:minmax(0,1fr)}}
/* No control is narrower than its content on a phone. */
@media (max-width:480px){
  .field-pair{grid-template-columns:repeat(2,minmax(0,1fr))}
  .field input[type=number],input.ctl[type=number]{width:100%}
}

/* ---------------------------------------------------- form layout */
/* A form is a column of fields you read down, so it stops at a readable
 * width even when the card it sits in runs the full page. Results keep the
 * whole width - a table has no reason to be 760px. */
.form-body{max-width:var(--form-w)}
.form-actions{display:flex;gap:8px;align-items:center;flex-wrap:wrap;
  border-top:1px solid var(--border);padding-top:16px;margin-top:6px}
.form-note{font-size:13px;color:var(--text-2);margin:8px 0 0}
.form-note:empty{display:none}
.field-link{margin:6px 0 0;font-size:13px}
/* The key is hidden; Show sits beside it rather than under it. */
.secret-row{display:flex;gap:8px;align-items:center}
.secret-row input{flex:1 1 auto;min-width:0}
/* Show stands the same height as the field it sits against. */
.secret-row .btn{flex:0 0 auto;height:var(--ctl-h);padding:0 14px;font-size:13px}
/* A text box that reads like a password field, so browsers never offer to
   fill it with a saved login. Show takes the class off.

   -webkit-text-security is what Chrome, Safari and Firefox 118 and later
   understand; `text-security` without the prefix is not a property any
   browser has, so it is gone. A browser without it gets app.js's
   fallback, which makes the box a password field after all. */
.masked{-webkit-text-security:disc}
.field-error{margin:6px 0 0;font-size:13px;color:var(--bad-fg)}
.field-error[hidden]{display:none}
/* An empty state is not a form, so its buttons get air instead of a rule. */
.empty-actions{display:flex;gap:8px;align-items:center;flex-wrap:wrap;
  margin-top:12px}
@media (max-width:480px){.empty-actions .btn{flex:1 1 100%}}
.repro-line{margin:10px 0 0}
@media (max-width:480px){
  .form-actions .btn{flex:1 1 100%}
  .form-actions .spacer{display:none}
}

fieldset{border:none;margin:0 0 15px;padding:0}
legend{padding:0}
details > summary{cursor:pointer;font-weight:600;font-size:14px;padding:8px 0;
  list-style:none;display:flex;align-items:center;gap:7px;color:var(--text-2)}
details > summary::-webkit-details-marker{display:none}
details > summary::before{content:"";width:0;height:0;
  border-left:5px solid currentColor;border-top:4px solid transparent;
  border-bottom:4px solid transparent;transition:transform .16s var(--ease)}
details[open] > summary::before{transform:rotate(90deg)}
details > summary:hover{color:var(--text)}

/* --------------------------------------------------------------- steps */
/* One strip, four numbered circles joined by a thin line. The circle you
 * are on is yellow and its label is bold; a step you have finished shows a
 * tick instead of its number. */
.steps{display:flex;margin:0 0 20px;padding:6px;list-style:none;
  background:var(--card);border:1px solid var(--border);
  border-radius:var(--r-card);box-shadow:var(--shadow-1);flex-wrap:wrap}
.steps li{flex:1 1 180px;min-width:0;position:relative}
/* The line runs from this step's circle to the next one's. */
.steps li:not(:last-child)::after{content:"";position:absolute;z-index:0;
  left:calc(14px + 28px);right:0;top:50%;height:1px;background:var(--border)}
.steps li a,.steps li > span{position:relative;z-index:1;
  display:flex;align-items:center;gap:10px;
  padding:10px 14px;border-radius:var(--r);font-size:13.5px;font-weight:500;
  color:var(--text-2);text-decoration:none;background:var(--card);
  transition:color .14s var(--ease),background .14s var(--ease)}
.steps li a:hover{color:var(--text);background:var(--card-2);
  text-decoration:none}
.step-n{width:28px;height:28px;flex:0 0 28px;border-radius:50%;
  display:inline-grid;place-items:center;font-family:var(--font-mono);
  font-size:13px;font-weight:600;letter-spacing:.02em;
  background:var(--card-3);color:var(--text-2);line-height:1;
  box-shadow:0 0 0 4px var(--card)}
.steps li.done .step-n{background:var(--ok-bg);color:var(--ok-fg);
  font-size:0}
.steps li.done .step-n::before{content:"✓";font-family:var(--font-sans);
  font-size:13px;font-weight:700;line-height:1}
.steps li.done a{color:var(--text)}
/* A step you can open but have not finished. */
.steps li.ready a{color:var(--text)}
.steps li.now a,.steps li.now > span{color:var(--text);font-weight:700}
.steps li.now .step-n{background:var(--cta);color:var(--on-cta);
  font-weight:500}
/* A locked step is still a word you must be able to read: the lock icon
 * carries the state, not a wash of opacity that drops contrast under 4.5:1. */
.steps li.locked > span,.steps li.locked a{cursor:not-allowed;
  box-shadow:none;color:var(--text-2)}
.steps li.locked .step-n{background:var(--card-3);color:var(--text-2)}
.steps li.locked a:hover{color:var(--text-2);background:var(--card)}
/* Locked or not, the keyboard can still land here, so it has to show where
   it is: the rule above outranks the one ring every other control gets. */
.steps li.locked a:focus-visible{box-shadow:var(--ring)}
.step-text{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.step-lock{margin-left:auto;opacity:.7;flex:0 0 auto}
.step-lock svg{width:13px;height:13px;display:block}

/* --------------------------------------------------------------- tables */
/* One table: a quiet header band in mono, 14px rows, a hover you can see.
 * .grid is the name the templates already use; .table is the same thing. */
table.grid,table.table{width:100%;border-collapse:separate;border-spacing:0;
  font-size:14px;border:1px solid var(--border);border-radius:var(--r-card);
  overflow:hidden}
table.grid th,table.grid td,table.table th,table.table td{text-align:left;
  padding:11px 14px;border-bottom:1px solid var(--border);vertical-align:top}
table.grid th,table.table th{font-family:var(--font-mono);font-size:13px;
  color:var(--text-2);font-weight:500;letter-spacing:.06em;
  text-transform:uppercase;background:var(--card-2)}
table.grid tbody tr:last-child td,table.table tbody tr:last-child td{
  border-bottom:none}
table.grid tbody tr,table.table tbody tr{transition:background .12s var(--ease)}
table.grid tbody tr:hover,table.table tbody tr:hover{background:var(--card-2)}
table.grid td:not(:first-child){font-variant-numeric:tabular-nums}
/* On a phone a table scrolls inside its own card. Letting it set the width
 * of the page instead is how a long "Say instead" column used to push the
 * whole story desk sideways. */
@media (max-width:860px){
  table.grid,table.table{display:block;overflow-x:auto;max-width:100%}
}

/* A row you can open: the whole row is the button, and the chevron says so. */
tr.row-open > td{cursor:pointer}
.row-chevron{width:14px;height:14px;color:var(--muted);flex:0 0 14px;
  transition:transform .16s var(--ease)}
[aria-expanded="true"] .row-chevron{transform:rotate(90deg)}

pre.code{background:var(--card-2);border:1px solid var(--border);
  border-radius:var(--r);padding:14px 16px;overflow:auto;
  font-size:13px;line-height:1.65;position:relative}
:root[data-theme="dark"] pre.code{background:var(--canvas-2)}
/* Code reads as code: the same cobalt-navy block in both themes, with the
 * line numbers drawn by the counter rather than pasted into the text. */
pre.code-dark,:root[data-theme="dark"] pre.code-dark{background:#0E1430;
  border-color:#2A3466;color:#E9ECF8;font-size:13px;padding:14px 16px 14px 0}
pre.code-dark{display:flex;gap:14px}
pre.code-dark code{display:block;white-space:pre;min-width:0;flex:1}
/* The numbers hold their place while the code scrolls past them.
   #6B7392 read at 3.9:1 on this block, which is under the 4.5:1 a line of
   text has to clear. #7C84A6 clears it at 4.9:1. */
.code-gutter{flex:0 0 auto;text-align:right;white-space:pre;color:#7C84A6;
  user-select:none;padding-left:16px;border-right:1px solid #2A3466;
  padding-right:12px;position:sticky;left:0;background:#0E1430;z-index:1}
mark{background:var(--warn-bg);color:var(--warn-fg);border-radius:3px;
  padding:1px 3px;font-weight:600}

/* ------------------------------------------------------------- utility */
.htmx-indicator{display:none}
.htmx-request .htmx-indicator{display:inline-flex}
.htmx-request.htmx-indicator{display:inline-flex}
/* A busy button keeps its label - app.js swaps the word and adds the
 * spinner. Hiding the label here left an empty button mid-request. */
/* .muted is what the templates put on a second-level sentence, so it takes
 * the second ink, not the quietest one. --muted itself is kept for text that
 * really is minor: a timestamp, a hint under a field, a placeholder. */
.muted{color:var(--text-2)}
.small{font-size:13px}
.row{display:flex;gap:10px;align-items:center;flex-wrap:wrap}
.key-panel{border:1px solid var(--accent)}
.spacer{flex:1}

/* A working spinner, not a bare line of grey text. */
.spin{width:13px;height:13px;flex:0 0 13px;border-radius:50%;
  border:2px solid color-mix(in srgb,currentColor 25%,transparent);
  border-top-color:currentColor;animation:spin .7s linear infinite;
  display:inline-block;vertical-align:-2px;margin-right:7px}
@keyframes spin{to{transform:rotate(360deg)}}

.working{display:inline-flex;align-items:center;gap:2px;color:var(--accent);
  font-weight:600;font-size:13.5px}
/* The one calm line under a card that is working. It says how long this
 * usually takes, so nobody reloads the page at twenty seconds. */
.busy-note{margin:-6px 0 16px;padding:0 2px;color:var(--text-2);
  font-size:13.5px}

/* Answers fade up as HTMX swaps them in. */
@keyframes rise{from{opacity:0;transform:translateY(7px)}to{opacity:1;transform:none}}
.rise,#story-output>*,#duel-output>*,#bug-output>*,#insights-output>*,
#risk-output>*,#test-cases-output>*,#automation-output>*{
  animation:rise .3s var(--ease) both}

@media (prefers-reduced-motion:reduce){
  *,*::before,*::after{animation-duration:.001ms !important;
    animation-iteration-count:1 !important;transition-duration:.001ms !important}
  html{scroll-behavior:auto}
}

/* A saved answer must never be mistaken for a fresh one. */
.example-flag{display:flex;align-items:center;gap:9px;padding:10px 14px;
  border-radius:var(--r);background:var(--info-bg);color:var(--info-fg);
  border:1px solid color-mix(in srgb,var(--info-line) 28%,transparent);
  font-size:13.5px;font-weight:500;margin-bottom:14px}
.example-flag strong{font-weight:700}
.example-flag .example-keep{margin-left:auto;flex:0 0 auto}
.example-flag svg{width:16px;height:16px;flex:0 0 16px}

.answered-by{display:flex;align-items:center;gap:7px;margin-top:16px;
  padding-top:13px;border-top:1px solid var(--border);
  font-size:13px;color:var(--muted)}

/* Empty states: say what is missing and offer the way out.
 * Named -state so it never collides with .key-chip.empty in the topbar. */
.empty-state{text-align:center;padding:34px 24px}
.empty-mark{width:46px;height:46px;border-radius:13px;margin:0 auto 14px;
  display:grid;place-items:center;background:var(--accent-soft);
  color:var(--accent)}
.empty-mark svg{width:22px;height:22px}
.empty-state h2{margin:0 0 6px;font-size:18px}
.empty-state p{margin:0 auto 16px;max-width:46ch;color:var(--text-2)}
.empty-state .row{justify-content:center}
.empty-mark-bad{background:var(--bad-bg);color:var(--bad-fg)}
.error-card{border-color:color-mix(in srgb,var(--bad-line) 30%,transparent)}
.error-card .empty-state{padding:26px 20px}

/* The form you have already filled in folds away once the answer arrives,
 * so the answer is what you land on, not a wall of inputs you must scroll. */
.input-bar{display:none;align-items:center;gap:11px;font-size:14px}
.input-card.collapsed{padding:12px 18px}
.input-card.collapsed .input-body{display:none}
.input-card.collapsed .input-bar{display:flex}
.input-bar .what{font-weight:650;flex:0 0 auto}
.input-bar .said{color:var(--muted);flex:1;min-width:0;overflow:hidden;
  text-overflow:ellipsis;white-space:nowrap;font-size:13.5px}

.to-top{position:fixed;right:22px;bottom:22px;z-index:35;
  width:40px;height:40px;border-radius:50%;display:grid;place-items:center;
  background:var(--card);border:1px solid var(--border-strong);
  color:var(--text-2);cursor:pointer;box-shadow:var(--shadow-2);
  opacity:0;visibility:hidden;transform:translateY(8px);
  transition:opacity .2s var(--ease),transform .2s var(--ease),
    visibility .2s var(--ease)}
.to-top.show{opacity:1;visibility:visible;transform:none}
.to-top:hover{color:var(--text);border-color:var(--text-2)}
.to-top svg{width:16px;height:16px}

/* ---------------------------------------------------------- keys drawer */
.scrim{position:fixed;inset:0;z-index:55;background:rgba(18,32,24,.42);
  backdrop-filter:blur(2px);opacity:0;transition:opacity .22s var(--ease)}
.scrim.open{opacity:1}

.drawer{position:fixed;top:0;right:0;bottom:0;width:430px;max-width:94vw;
  background:var(--card);border-left:1px solid var(--border);
  padding:22px;overflow-y:auto;z-index:60;box-shadow:var(--shadow-3);
  transform:translateX(105%);transition:transform .26s var(--ease)}
.drawer.open{transform:none}
.drawer-head{display:flex;align-items:center;justify-content:space-between;
  gap:12px;margin-bottom:6px}
.drawer-head h2{margin:0;font-size:18px}
.drawer h3{margin:20px 0 9px;font-size:15px}
.drawer .note{background:var(--accent-soft);color:var(--accent-ink);
  border-radius:var(--r);padding:11px 13px;font-size:13px;font-style:normal;
  display:block;margin:0 0 14px}

.key-list{list-style:none;margin:0;padding:0;display:flex;
  flex-direction:column;gap:10px}
.key-row{background:var(--card-2);border:1px solid var(--border);
  border-radius:var(--r);padding:12px 16px 14px}
/* Five buttons wrapped onto three lines in a 430px drawer. Two stay out,
   the three used once in a key's life sit under More, and the row holds. */
.key-actions{flex-wrap:nowrap;gap:6px;align-items:center}
.key-actions .more-menu{margin-left:auto}
.key-actions .btn{white-space:nowrap}
.key-main{display:flex;gap:8px;align-items:center;flex-wrap:wrap;
  margin-bottom:10px}
.key-main code{font-size:13px;color:var(--text-2)}
.key-test-result{margin-left:4px}
.key-num{font-weight:700;color:var(--muted);font-size:13px}
.key-edit-form{display:flex;flex-direction:column;gap:8px;margin-top:8px}
.key-edit-form select,.key-edit-form input{padding:8px 10px;
  border:1px solid var(--border-strong);border-radius:var(--r);
  background:var(--field);color:var(--text);font:inherit}

/* ------------------------------------------- requirements desks (R2) */
/* Two columns on a desk, one under 1100px: what you fill in on the left,
   what came back on the right, and the long answer full width under both. */
.req-split{display:grid;grid-template-columns:minmax(0,62fr) minmax(0,38fr);
  gap:16px;align-items:start;margin-bottom:16px}
.req-split > .card{margin-bottom:0}
.req-main{max-width:none}
.req-side:empty{display:none}
/* `1fr` keeps an automatic min-content floor, so one wide descendant
   stretched the whole desk past the phone it was being read on. */
@media (max-width:1100px){.req-split{grid-template-columns:minmax(0,1fr)}}

/* The card title and whatever sits on its right, on one line. */
.card-head{margin:0 0 12px;align-items:center}
.card-head .card-title{margin:0}

.story-box{font-family:var(--font-serif);font-size:16px;line-height:1.6}
.story-box::placeholder{font-family:var(--font-serif);font-style:italic}
.story-hint{display:block;margin:-10px 0 18px;font-size:13px;color:var(--text-2)}

/* How clear, with reasons. */
.clarity-score{display:flex;align-items:center;gap:12px;flex-wrap:wrap}
.clarity-num{font-family:var(--font-serif);font-size:40px;line-height:1;
  font-weight:400}
.clarity-of{font-size:15px;color:var(--muted);margin-left:3px}
.clarity-score .chip{margin-left:auto}
/* Yellow where the story is clear, red-orange where it is not: one bar,
   read left to right. */
.clarity-bar{height:8px;border-radius:999px;background:var(--card-3);
  overflow:hidden;margin:12px 0 10px}
.clarity-bar-fill{display:block;height:100%;border-radius:999px;
  background:linear-gradient(90deg,var(--cta),var(--alert));
  transition:width .45s var(--ease)}
.clarity-line{margin:0 0 14px;color:var(--text-2);font-size:13.5px}
.reasons{display:flex;flex-direction:column;gap:9px;margin-bottom:14px}
.reason{border:1px solid var(--border);border-radius:var(--r);
  background:var(--card);padding:11px 13px}
.reason-title{margin:0;font-weight:600;font-size:13.5px}
.reason-detail{margin:3px 0 0;color:var(--text-2);font-size:13px}
.reason-say{margin:5px 0 0;font-size:13px}
.reason-say-label{font-family:var(--font-mono);font-size:13px;
  letter-spacing:.1em;text-transform:uppercase;color:var(--muted);
  margin-right:6px}

/* ------------------------------------------------------------- overview */
/* The Overview is one hero, one step bar, the workbench beside what needs
   attention, then four ways in. Everything on it comes from the run in this
   browser; nothing is invented to fill a box. */
.overview-grid{display:grid;grid-template-columns:minmax(0,1.45fr) minmax(0,1fr);
  gap:16px;margin-bottom:16px;align-items:stretch}
@media (max-width:1000px){.overview-grid{grid-template-columns:minmax(0,1fr)}}

#overview-steps .step-state{margin-left:auto;font-size:13px;
  color:var(--text-2);white-space:nowrap}
#overview-steps li.done .step-state{color:var(--ok-fg)}
/* Ship carries its decision, not its freshness: a green tick beside
   "Not ready" told the reader the opposite of the verdict. */
#overview-steps li.step-warn .step-state{color:var(--warn-fg)}
#overview-steps li.step-bad .step-state{color:var(--bad-fg)}
.steps li.step-warn a{color:var(--text)}
.steps li.step-warn .step-n{background:var(--warn-bg);color:var(--warn-fg);
  font-size:0}
.steps li.step-warn .step-n::before{content:"!";font-family:var(--font-sans);
  font-size:13px;font-weight:700}
.steps li.step-bad a{color:var(--text)}
.steps li.step-bad .step-n{background:var(--bad-bg);color:var(--bad-fg);
  font-size:0}
.steps li.step-bad .step-n::before{content:"¹5";font-family:var(--font-sans);
  font-size:13px;font-weight:700}

/* The workbench is the one cobalt block on the page: your story, how clear
   it is, and the single question still open. */
.bench{background:var(--rail-2);color:#fff;border-radius:var(--r-card);
  padding:24px;box-shadow:var(--shadow-2);position:relative;overflow:hidden;
  display:flex;flex-direction:column;gap:14px}
.bench::after{content:"";position:absolute;inset:0;pointer-events:none;
  background:radial-gradient(420px 220px at 100% 0%,rgba(255,255,255,.1),transparent 70%)}
.bench > *{position:relative;z-index:1}
.bench-top{display:flex;align-items:center;gap:12px}
.bench-label{font-family:var(--font-mono);font-size:13px;font-weight:500;
  letter-spacing:.14em;text-transform:uppercase;color:var(--rail-ink-2)}
.bench-slot{margin-left:auto;display:flex;align-items:center;gap:8px;
  flex-wrap:wrap;justify-content:flex-end}
.bench-count{font-size:13px;color:var(--rail-ink-2);white-space:nowrap}
.btn.bench-step{width:28px;height:28px;padding:0;flex:0 0 28px;
  border-radius:50%;background:rgba(255,255,255,.14);border-color:transparent;
  color:#fff;box-shadow:none}
.btn.bench-step:hover{background:rgba(255,255,255,.26);border-color:transparent;
  box-shadow:none}
.btn.bench-new{background:rgba(255,255,255,.14);border-color:transparent;
  color:#fff;box-shadow:none}
.btn.bench-new:hover{background:rgba(255,255,255,.26);border-color:transparent;
  box-shadow:none}
.bench-others{margin:0;font-size:13px;color:var(--rail-ink-2)}
.bench-body{display:flex;flex-direction:column;gap:12px}
.bench-chips{display:flex;gap:6px;flex-wrap:wrap}
.bench-chip{background:rgba(255,255,255,.15);color:#fff}
.bench-story{margin:0;font-family:var(--font-serif);font-size:23px;
  font-weight:400;line-height:1.35;
  display:-webkit-box;-webkit-line-clamp:3;-webkit-box-orient:vertical;
  overflow:hidden}
.bench-empty{color:var(--rail-ink-2)}
/* What this story already has, under its words. */
.bench-facts{margin:8px 0 0;color:var(--rail-ink-2);font-size:13px}
.bench-sub{margin:0;color:var(--rail-ink-2);font-size:13.5px;max-width:46ch}
.bench-actions{margin-top:2px}
.bench-score{display:flex;align-items:baseline;gap:10px}
.bench-score-label{font-size:13.5px;color:var(--rail-ink-2)}
.bench-score-num{margin-left:auto;font-family:var(--font-serif);font-size:30px;
  line-height:1}
.bench-score-of{font-size:13px;color:var(--rail-ink-2);margin-left:3px}
.bench-bar{height:8px;border-radius:999px;background:rgba(255,255,255,.18);
  overflow:hidden}
.bench-bar-fill{display:block;height:100%;border-radius:999px;
  background:var(--cta);transition:width .45s var(--ease)}
/* The one open question, in the one colour that means "your turn". */
.bench-strip{display:flex;align-items:center;gap:12px;flex-wrap:wrap;
  margin-top:auto;padding:12px 14px;border-radius:var(--r);
  border:1px solid transparent;
  background:var(--strip);color:var(--on-strip);font-size:13.5px;font-weight:500}
.bench-strip-text{flex:1 1 220px;min-width:0}
.bench-strip-link{margin-left:auto;color:inherit;font-weight:700;
  white-space:nowrap}
/* In the dark the same strip is a soft wash with an amber edge: solid
   #E8B84A across a card read as a brown block with a light on it. */
:root[data-theme="dark"] .bench-strip{background:var(--strip-soft);
  color:var(--strip-soft-ink);border-color:var(--strip-soft-line)}

/* What needs attention: at most three rows, worst first. */
.attention{display:flex;flex-direction:column;margin-bottom:0}
.attention-head{display:flex;align-items:center;gap:10px;margin-bottom:6px}
.attention-head .card-title{margin:0}
.attention-head .count-badge{margin-left:auto}
#attention-list{display:flex;flex-direction:column}
.attention-row{display:flex;align-items:flex-start;gap:12px;padding:13px 0;
  border-top:1px solid var(--border);text-decoration:none;color:inherit}
.attention-row:first-child{border-top:none}
.attention-row:hover{background:var(--card-2)}
.attention-words{display:flex;flex-direction:column;gap:2px;min-width:0;flex:1}
.attention-title{font-weight:600;font-size:14px}
.attention-detail{font-size:13px;color:var(--text-2)}
.attention-row .row-chevron{margin-top:8px}
.attention-foot{margin:auto 0 0;padding-top:14px;font-size:13.5px;font-weight:600}
.attention-foot a{display:inline-flex;align-items:center;gap:6px;
  text-decoration:none}

/* Four ways in, under everything else. */
.action-cards{display:grid;grid-template-columns:repeat(auto-fit,minmax(230px,1fr));
  gap:14px;margin-bottom:16px}
.action-card{display:flex;flex-direction:column;gap:9px;padding:20px;
  background:var(--card);border:1px solid var(--border);
  border-radius:var(--r-card);box-shadow:var(--shadow-1);
  text-decoration:none;color:inherit;
  transition:transform .16s var(--ease),box-shadow .16s var(--ease),
    border-color .16s var(--ease)}
.action-card:hover{transform:translateY(-2px);box-shadow:var(--shadow-2);
  border-color:var(--border-strong)}
.action-card .card-title{margin:0;font-size:18px}
.action-card p{margin:0;color:var(--text-2);font-size:13.5px;line-height:1.55}
.action-card .go{margin-top:auto;padding-top:9px;font-size:13px;font-weight:600;
  color:var(--accent);display:inline-flex;align-items:center;gap:6px}
.action-card:hover .go{gap:9px}

/* ------------------------------------------------------------ home grid */
.desk-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(262px,1fr));
  gap:14px;margin-bottom:22px}
.desk{display:flex;flex-direction:column;gap:9px;padding:20px;
  background:var(--card);border:1px solid var(--border);
  border-radius:var(--r-card);box-shadow:var(--shadow-1);
  text-decoration:none;color:inherit;position:relative;overflow:hidden;
  transition:transform .16s var(--ease),box-shadow .16s var(--ease),
    border-color .16s var(--ease)}
.desk:hover{transform:translateY(-2px);box-shadow:var(--shadow-2);
  border-color:color-mix(in srgb,var(--accent) 36%,transparent)}
.desk-mark{width:38px;height:38px;border-radius:11px;display:grid;
  place-items:center;background:var(--accent-soft);color:var(--accent)}
.desk-mark svg{width:19px;height:19px}
.desk h3{margin:0;font-size:16px;font-weight:700;letter-spacing:-.015em}
.desk p{margin:0;color:var(--text-2);font-size:13.5px;line-height:1.55}
.desk .go{margin-top:auto;padding-top:9px;font-size:13px;font-weight:650;
  color:var(--accent);display:inline-flex;align-items:center;gap:5px}
.desk:hover .go{gap:8px}
.desk.soon{opacity:.72}
.desk.soon .desk-mark{background:var(--card-3);color:var(--muted)}

/* ----------------------------------------------- duel, forks, tooltips */
.fork-wrap{position:relative;display:inline-block}
.fork-mark{cursor:help}
.tip{display:none;position:absolute;left:0;top:1.6em;z-index:20;
  width:270px;max-width:80vw;background:var(--card);
  border:1px solid var(--border-strong);border-radius:var(--r);
  padding:11px 13px;font-size:13px;color:var(--text);
  box-shadow:var(--shadow-2)}
.fork-mark:hover + .tip,.fork-mark:focus + .tip,
.fork-wrap:hover .tip,.fork-wrap:focus-within .tip{display:block}
.duel-readers{display:grid;grid-template-columns:1fr 1fr;gap:14px}
.duel-col{background:var(--card-2);border:1px solid var(--border);
  border-radius:var(--r);padding:14px 16px}
.duel-col h3{margin-top:0}
tr.diff-row td:first-child{box-shadow:inset 3px 0 0 var(--warn-line)}
@media (max-width:768px){.duel-readers{grid-template-columns:minmax(0,1fr)}}

/* -------------------------------------------- test cases: chips & cards */
.filter-chips{margin:0 0 14px}
/* The filter buttons. They carry .btn as well as .chip, and this rule is
 * scoped to that pair: a plain .chip is the label component above, and used
 * to end up wearing this button's border inside a table row. */
.btn.chip{padding:5px 12px;border-radius:999px;font-size:13px;cursor:pointer;
  border:1px solid var(--border);background:var(--card);color:var(--text-2);
  font-family:inherit;font-weight:500;box-shadow:var(--shadow-1);
  transition:border-color .14s var(--ease),color .14s var(--ease),
    background .14s var(--ease)}
.btn.chip:hover{background:var(--card-2);color:var(--text);
  border-color:var(--border-strong)}
.btn.chip.now{background:var(--accent-soft);color:var(--accent-ink);
  border-color:color-mix(in srgb,var(--accent) 36%,transparent);font-weight:650}
/* Each id is its own box, so a narrow column wraps between ids and never
 * splits TC- from the number that follows it. */
.tc-ids{display:inline-flex;flex-wrap:wrap;gap:4px;vertical-align:-1px}
.tc-id{white-space:nowrap;font-size:13px;background:var(--card-3);
  color:var(--text-2);border-radius:var(--r-sm);padding:1px 5px}
.tc-reasons{min-width:160px}

/* ── the test-cases table ───────────────────────────────────────────────
 * It reads as a table and behaves as a list: one row per case, and the row
 * itself is the button that opens the whole case underneath it. */
.tc-table{display:flex;flex-direction:column;gap:6px;margin-bottom:16px}
.tc-cols{display:grid;
  grid-template-columns:28px 86px minmax(140px,1.4fr) minmax(140px,1.6fr)
    minmax(96px,.7fr) minmax(80px,.5fr) minmax(90px,.7fr) 16px;
  gap:12px;align-items:center}
.tc-head-row{display:grid;
  grid-template-columns:28px 86px minmax(140px,1.4fr) minmax(140px,1.6fr)
    minmax(96px,.7fr) minmax(80px,.5fr) minmax(90px,.7fr) 16px;
  gap:12px;align-items:center;padding:9px 14px;
  background:var(--card-2);border:1px solid var(--border);
  border-radius:var(--r);font-family:var(--font-mono);font-size:13px;
  font-weight:500;letter-spacing:.06em;text-transform:uppercase;
  color:var(--text-2)}
.tc-row-card{padding:0;margin:0;overflow:hidden}
.tc-row{display:grid;grid-template-columns:28px 1fr;align-items:center;
  padding:0 0 0 14px;gap:0}
.btn.tc-row-main{display:grid;
  grid-template-columns:86px minmax(140px,1.4fr) minmax(140px,1.6fr)
    minmax(96px,.7fr) minmax(80px,.5fr) minmax(90px,.7fr) 16px;
  gap:12px;align-items:center;width:100%;height:auto;min-height:52px;
  padding:11px 14px;text-align:left;background:transparent;border:none;
  box-shadow:none;border-radius:0;font-weight:400;font-size:14px;
  white-space:normal}
.btn.tc-row-main:hover{background:var(--card-2);border:none;box-shadow:none}
/* The row sets box-shadow:none at the same weight as .btn:focus-visible and
   later in the file, so the ring needs saying again here. */
.btn.tc-row-main:focus-visible{box-shadow:var(--ring)}
.tc-cell{min-width:0}
.tc-col-title{font-weight:600;display:flex;flex-wrap:wrap;gap:6px;
  align-items:center}
.tc-col-expect{color:var(--text-2);font-size:13px}
.tc-col-linked{display:flex;flex-wrap:wrap;gap:4px}
.tc-body{padding:4px 18px 18px 56px;border-top:1px solid var(--border)}
.tc-body > :first-child{margin-top:12px}
/* The senior tester's own rows carry the same hairline they always did. */
.tc-card.pq-case{border-left:3px solid var(--alert)}
@media (max-width:1000px){
  .tc-head-row{display:none}
  .btn.tc-row-main{grid-template-columns:1fr;gap:5px;padding:12px 14px}
  .tc-row{padding-left:10px}
  .tc-body{padding-left:18px}
  .tc-col-id,.tc-col-kind,.tc-col-priority,.tc-col-linked{display:inline-flex;
    flex-wrap:wrap;gap:5px}
  .btn.tc-row-main .row-chevron{position:absolute;right:14px;top:16px}
  .btn.tc-row-main{position:relative}
}

.tc-card h3{margin:0 0 8px;font-size:15.5px}
.tc-steps{margin:8px 0;padding-left:21px}
.tc-steps li{margin:3px 0}
.tc-card h3 .tc-select{margin-right:7px;vertical-align:middle;
  accent-color:var(--accent)}
/* The selection bar follows the list it belongs to. Stuck to the top it has
 * to be a surface, not a pane: a see-through bar shows half a line of the
 * card sliding under it, which reads as a drawing mistake. Solid in both
 * themes, and above the cards but under the topbar and the key drawer. */
/* Flush under the topbar (58px tall), so no strip of the list can scroll
   through the gap between the two. */
#tc-select-bar{position:sticky;top:58px;z-index:12;background:var(--card);
  transition:box-shadow .16s var(--ease),border-color .16s var(--ease)}
/* The lift is for being stuck, so it is only there while it is. */
#tc-select-bar.is-stuck{border-bottom-color:var(--border-strong);
  box-shadow:var(--shadow-2)}
/* One pixel of nothing, watched to tell "stuck" from "in the page". */
.tc-stick-sentinel{height:1px;margin-bottom:-1px}
/* Jumping to a card must not park it under the bar. */
.tc-card{scroll-margin-top:calc(58px + var(--tc-bar-h,64px) + 8px)}

/* ------------------------------------------- criteria editor & coverage */
/* One criterion is one row card: a status tile, the line a reader knows it
   by, the whole thing underneath, and what it is linked to on the right.
   Clicking the words turns them into the box they were always editable in. */
.ac-list{display:flex;flex-direction:column;gap:10px;margin:14px 0}
.ac-row{display:flex;gap:12px;align-items:flex-start;padding:14px;
  border:1px solid var(--border);border-radius:var(--r-card);
  background:var(--card)}
.ac-row[data-state="decision"]{border-color:color-mix(in srgb,var(--warn-line) 45%,transparent)}
.ac-row[data-state="changed"]{border-color:color-mix(in srgb,var(--info-line) 40%,transparent)}
.ac-words{flex:1;min-width:0}
.ac-title{margin:0;font-weight:600;font-size:14px}
/* Given, When and Then keep their own lines when the card is only
   being read. Squashed into one paragraph, three steps read as one
   sentence and nobody could see what the criterion actually asked. */
.ac-text{margin:4px 0 0;color:var(--text-2);font-size:13px;cursor:text;
  white-space:pre-line}
.ac-text:hover{color:var(--text)}
/* A criterion with nothing in it yet is still three lines tall, so there
   is something to press. It was 0 px high and could not be clicked. */
.ac-text{min-height:calc(1.55em * 3)}
.ac-text-empty{color:var(--muted);font-style:italic}
.ac-row textarea{width:100%;min-height:66px;resize:vertical;margin-top:4px}
.ac-side{display:flex;flex-direction:column;align-items:flex-end;gap:8px;
  flex:0 0 auto}
.ac-actions{flex-wrap:nowrap;align-items:flex-start}
.trace-rows{display:flex;flex-direction:column;gap:8px;margin:12px 0}
@media (max-width:640px){
  .ac-row{flex-wrap:wrap}
  .ac-side{flex-direction:row;align-items:center;width:100%;
    justify-content:space-between}
}
/* At 390px the row's icon tile, words and four buttons added up to more
   than the screen, so a criterion ran off the side and "+ Add criterion"
   went with it. Nothing in here may be wider than its parent. */
@media (max-width:460px){
  .ac-row{padding:12px;gap:10px}
  .ac-words{flex:1 1 100%}
  .ac-text,.ac-title{overflow-wrap:anywhere}
  .ac-side{align-items:stretch;gap:8px}
  .ac-actions{flex-wrap:wrap;width:100%}
  .ac-actions .btn{flex:0 0 auto}
  .card-head .btn{flex:0 0 auto;white-space:nowrap}
  .card-head{flex-wrap:wrap}
}
.tc-form fieldset{border:none;margin:14px 0;padding:0}
.tc-form legend{padding:0}
/* Checkbox rows use .choice from the control system now; this keeps any
 * older markup that still says .check reading the same. */
.check,.choice{font-size:14px;color:var(--text-2);margin-right:14px}

.depth-line{font-weight:600;margin:6px 0}
.depth-line.thin{color:var(--warn-fg)}
.depth-line.solid{color:var(--ok-fg)}
#refine-panel{margin-top:14px}
.proposal{box-shadow:inset 3px 0 0 var(--accent),var(--shadow-1)}
.delta-line{margin:8px 0;font-size:14px}
.delta{font-weight:700}
.delta.good{color:var(--ok-fg)}
.delta.bad{color:var(--bad-fg)}
.delta.same{color:var(--text-2)}
.diff-added{box-shadow:inset 3px 0 0 var(--ok-line),var(--shadow-1)}
.diff-changed{box-shadow:inset 3px 0 0 var(--warn-line),var(--shadow-1)}
.diff-removed{box-shadow:inset 3px 0 0 var(--bad-line),var(--shadow-1)}
.field-change{margin:10px 0;padding-left:12px;
  border-left:1px solid var(--border)}
.field-change p{margin:2px 0}
.before,.tc-steps.before li{color:var(--muted);text-decoration:line-through}
.after{color:var(--text)}

.findings{margin:12px 0;padding-left:18px;font-size:14px}
.findings li{margin:4px 0}
.findings li.error{color:var(--bad-fg)}
.findings li.warning{color:var(--warn-fg)}
.picked-chips{display:flex;flex-wrap:wrap;gap:6px;margin:12px 0 8px}
.picked-chip{max-width:100%;white-space:normal;text-align:left}
.picked-id{font-family:var(--font-mono);font-size:13px;
  color:var(--accent-ink)}
.picked-cases{margin:8px 0;padding-left:20px;font-size:14px}
.picked-cases li{margin:3px 0}
.setup-steps{margin:8px 0 14px;padding-left:22px}
.setup-steps li{margin:4px 0;font-family:var(--font-mono);
  font-size:13px}

/* The file list used to take a 236px column out of the card, which left
   the code itself a narrow strip with every line scrolling sideways. The
   tabs sit in a row above it now and the code box gets the whole card. */
.file-view{display:grid;grid-template-columns:minmax(0,1fr);gap:12px;
  align-items:start}
.file-list{display:flex;flex-wrap:wrap;gap:5px}
.file-tab{text-align:left;padding:8px 10px;border-radius:var(--r-sm);
  cursor:pointer;border:1px solid var(--border);background:var(--card);
  color:var(--text-2);font-family:var(--font-mono);
  font-size:13px;word-break:break-all;transition:background .12s var(--ease)}
.file-tab:hover{background:var(--card-2);color:var(--text)}
.file-tab.now{background:var(--accent-soft);color:var(--accent-ink);
  border-color:color-mix(in srgb,var(--accent) 36%,transparent);font-weight:650}
/* A grid child is as wide as its widest line unless it is told otherwise,
 * so one long line of generated code pushed the whole page sideways at
 * 1150 px. The column may shrink; the code scrolls inside it. */
/* Generated code gets the wide column: the checks beside it are short
   lines, and a 580px strip made every line of a real test scroll. */
@media (min-width:1101px){
  /* 688 of track, less the card's 24px of padding each side, leaves the
     code itself the 640px a line of a real test needs. */
  .req-split.code-split{grid-template-columns:minmax(688px,1fr) minmax(0,300px)}
}
.file-code{min-width:0;width:100%}
/* Sideways scrolling belongs to this box and to nothing around it. */
.file-code pre.code{margin-top:0;max-height:62vh;overflow-x:auto;max-width:100%}
/* Wrap lines: the same code with no sideways scroll at all. */
.file-code.wrap pre.code code{white-space:pre-wrap;overflow-wrap:anywhere}
.file-code.wrap pre.code{overflow-x:hidden}
.file-tab{max-width:100%}

/* ── automation: the checks column ────────────────────────────────────── */
.check-tiles{display:flex;flex-direction:column;gap:10px;margin:12px 0 16px}
.check-tile{display:flex;gap:11px;align-items:flex-start;padding:12px 14px;
  border:1px solid var(--border);border-radius:var(--r);background:var(--card)}
.check-tile.tile-ok{background:var(--ok-bg);
  border-color:color-mix(in srgb,var(--ok-line) 35%,transparent)}
.check-tile.tile-warn{background:var(--warn-bg);
  border-color:color-mix(in srgb,var(--warn-line) 35%,transparent)}
.check-tile.tile-bad{background:var(--bad-bg);
  border-color:color-mix(in srgb,var(--bad-line) 35%,transparent)}
.check-tile.tile-info{background:var(--info-bg);
  border-color:color-mix(in srgb,var(--info-line) 30%,transparent)}
.check-mark{width:22px;height:22px;flex:0 0 22px;border-radius:50%;
  display:grid;place-items:center;font-size:13px;font-weight:700;
  background:rgba(255,255,255,.65);line-height:1}
:root[data-theme="dark"] .check-mark{background:rgba(255,255,255,.12)}
.check-tile.tile-ok .check-mark{color:var(--ok-fg)}
.check-tile.tile-warn .check-mark{color:var(--warn-fg)}
.check-tile.tile-bad .check-mark{color:var(--bad-fg)}
.check-tile.tile-info .check-mark{color:var(--info-fg)}
.check-title{margin:0;font-weight:600;font-size:13.5px}
.check-line{margin:3px 0 0;font-size:13px;opacity:1}
.check-more summary{font-size:13px;padding:6px 0 0}
.check-more .grid{margin-top:6px;font-size:13px}
.file-code-head{margin-bottom:8px}

/* ----------------------------------------------------------- bug desk */
.bad-line{color:var(--bad-fg);font-weight:600;font-size:13px}
.warn-line{color:var(--warn-fg)}
/* A mark, one line, one button - and once a file is attached the zone steps
 * aside for a compact row, so the form does not carry both. */
.drop-zone{border:1.5px dashed var(--border-strong);border-radius:var(--r);
  padding:20px 16px;text-align:center;background:var(--card-2);
  display:flex;flex-direction:column;align-items:center;gap:9px;
  transition:border-color .14s var(--ease),background .14s var(--ease)}
.drop-zone:hover{border-color:var(--accent)}
.drop-zone.over{border-color:var(--accent);background:var(--accent-soft)}
.drop-zone p{margin:0}
.drop-mark{width:26px;height:26px;color:var(--muted)}
.drop-line{font-size:13.5px;color:var(--text-2)}
.file-row{display:flex;align-items:center;gap:10px;padding:8px 10px;
  border:1px solid var(--border);border-radius:var(--r);
  background:var(--card-2)}
.file-name{font-size:13.5px;word-break:break-all}
.attached-list{list-style:none;margin:0;padding:0;display:flex;
  flex-direction:column;gap:8px}
.shot-thumb{width:64px;height:64px;object-fit:cover;border-radius:var(--r-sm);
  border:1px solid var(--border);flex:0 0 64px}
.shot-shown{margin-bottom:10px}
.shot-shown figcaption{color:var(--text-2);font-size:13px;margin-top:4px}
.check-rows{list-style:none;margin:12px 0 0;padding:0;font-size:14px}
.check-rows li{margin:7px 0;display:flex;gap:8px;align-items:baseline;
  flex-wrap:wrap}
.checklist{list-style:none;margin:8px 0;padding:0;font-size:14px}
.checklist li{margin:4px 0}
.two-cols{display:grid;grid-template-columns:1fr 1fr;gap:18px;margin-top:8px}
.two-cols h3{margin:0 0 4px;font-size:13px;color:var(--text-2);
  letter-spacing:.07em;text-transform:uppercase;font-weight:700}
@media (max-width:768px){.two-cols{grid-template-columns:minmax(0,1fr)}}

/* ---------------------------------------------------------- risk radar */
.risk-split{display:grid;grid-template-columns:330px 1fr;gap:18px;
  align-items:start}
/* The risk list is the wide column now; the map sits under both. */
.risk-split-2{grid-template-columns:minmax(0,60fr) minmax(0,40fr)}
@media (max-width:1100px){.risk-split-2{grid-template-columns:minmax(0,1fr)}}
.risk-heat h3{margin:16px 0 6px;font-size:13px;color:var(--text-2);
  letter-spacing:.07em;text-transform:uppercase;font-weight:700}
.risk-heat h3:first-child{margin-top:0}

table.heat{border-collapse:separate;border-spacing:3px;width:100%}
.heat-axis{font-size:13px;color:var(--text-2);font-weight:700;
  text-align:center;padding:2px;white-space:nowrap;letter-spacing:.04em}
/* The axis says "Bad 5" and "Likely 3" in words. Under 420px the row has no
 * space for them, so it keeps "B5" and "L3" and the words stay in aria-label. */
.heat-axis .axis-short{display:none}
@media (max-width:419px){
  .heat-axis .axis-long{display:none}
  .heat-axis .axis-short{display:inline}
  .heat-axis{width:24px}}
/* Sequential: one hue, light -> dark, carrying magnitude. Every cell with a
 * risk also shows its id, so the colour is never the only channel. */
.heat-cell{border-radius:var(--r-sm);height:46px;vertical-align:middle;
  text-align:center;padding:2px;background:var(--seq-1);
  border:1px solid transparent;transition:transform .14s var(--ease),
    box-shadow .14s var(--ease)}
.heat-cell.s1{background:var(--seq-1)}
.heat-cell.s2{background:var(--seq-2)}
.heat-cell.s3{background:var(--seq-3)}
.heat-cell.s4{background:var(--seq-4)}
.heat-cell.s5{background:var(--seq-5)}
.heat-cell.s6{background:var(--seq-6)}
/* In the dark two neighbouring squares of the ramp run together, so the map
   reads as one block. A hairline between them is all it takes. */
:root[data-theme="dark"] .heat-cell{border-color:var(--border)}
.heat-cell.s5 .pill,.heat-cell.s6 .pill{background:rgba(255,255,255,.9);
  color:#7A2718}
.heat-cell.has-risk{cursor:pointer}
.heat-cell.has-risk:hover{transform:scale(1.07);box-shadow:var(--shadow-2);
  position:relative;z-index:2}
.heat-cell.picked{border-color:var(--text);box-shadow:var(--shadow-2)}
/* One row of ids, each its own pill, so two in a cell never read as "R1R6". */
.heat-ids{display:flex;flex-wrap:wrap;gap:3px;justify-content:center;
  align-items:center}
.heat-cell .pill{font-size:13px;padding:1px 6px;
  background:rgba(255,255,255,.76);color:#7A2718;font-weight:700}
.heat-cell .pill::before{display:none}
.heat-labels{display:flex;justify-content:space-between;margin:5px 0 0;
  font-size:13px;color:var(--muted)}
/* Legend for the ramp: low -> high, with the words, not the hue alone. */
.heat-key{display:flex;align-items:center;gap:7px;margin-top:12px;
  font-size:13px;color:var(--muted)}
.heat-key .ramp{display:flex;flex:1;height:7px;border-radius:999px;
  overflow:hidden}
.heat-key .ramp i{flex:1;display:block}

/* The answer, before the evidence: which high risks have no test and the
   one button that fixes all of them. */
.todo-strip{display:flex;align-items:center;gap:16px;flex-wrap:wrap;
  padding:16px 20px;margin-bottom:14px;border-radius:var(--r-card);
  border:1px solid var(--border);box-shadow:var(--shadow-1)}
.todo-strip-bad{background:var(--alert-soft);
  border-color:color-mix(in srgb,var(--bad-line) 38%,transparent)}
/* Fields on this strip and every other dark card keep an edge of their own. */
:root[data-theme="dark"] .field :is(input,select,textarea),
:root[data-theme="dark"] .ctl{border-color:var(--border-strong)}
.todo-strip-ok{background:var(--ok-bg);padding:11px 20px;
  border-color:color-mix(in srgb,var(--ok-line) 32%,transparent)}
.todo-strip-words{flex:1 1 320px;min-width:0}
.todo-strip-head{margin:0;font-family:var(--font-serif);font-size:20px;
  font-weight:500;letter-spacing:-.01em}
.todo-strip-bad .todo-strip-head{color:var(--bad-fg)}
.todo-strip-ok .todo-strip-head{color:var(--ok-fg);font-size:16px}
.todo-strip-names{margin:4px 0 0;font-size:13px;color:var(--text-2)}

.risk-list{display:flex;flex-direction:column;gap:10px}
/* One risk is one row: the score on the left, what it is in the middle, and
   the one thing to do about it on the right. */
.risk-card{margin:0;display:flex;gap:14px;align-items:flex-start;padding:16px;
  cursor:pointer;transition:border-color .14s var(--ease),
    box-shadow .14s var(--ease)}
.risk-card:hover{border-color:var(--border-strong)}
.risk-card.picked{border-color:var(--accent);box-shadow:var(--shadow-2)}
.risk-score-badge{width:54px;flex:0 0 54px;border-radius:var(--r);
  padding:7px 0;text-align:center;background:var(--info-bg);
  color:var(--info-fg)}
.risk-score-badge.risk-high{background:var(--alert-soft);color:var(--bad-fg)}
.risk-score-badge.risk-medium{background:var(--warn-bg);color:var(--warn-fg)}
.risk-score-num{display:block;font-family:var(--font-serif);font-size:22px;
  line-height:1.1}
.risk-score-of{display:block;font-size:12px;opacity:.85}
.risk-words{flex:1;min-width:0}
h3.risk-title{margin:0;font-weight:600;font-size:15px;line-height:1.4}
.risk-effect{margin:3px 0 0;color:var(--text-2);font-size:13px}
.risk-chips{display:flex;flex-wrap:wrap;gap:5px;margin-top:8px}
.risk-action{flex:0 0 auto}
.risk-trace{position:sticky;top:74px}
.risk-detail-title{margin:0 0 12px}
/* The panel leads with what you can do about the risk. */
.panel-actions{align-items:center;gap:8px;flex-wrap:wrap;margin-bottom:4px}
.risk-scores-line{margin:14px 0 0;font-size:13px;color:var(--text-2);
  display:flex;flex-wrap:wrap;align-items:center;gap:6px}
.risk-scores-line strong{color:var(--text);font-weight:600}
.risk-scores-edit{margin-top:8px}
.risk-why{margin-top:14px;padding-top:12px;border-top:1px solid var(--border)}
.risk-why summary{cursor:pointer;font-size:13px;font-weight:600;
  color:var(--text-2)}
.risk-why > :not(summary){margin-top:8px}
.risk-accept{margin-top:10px}
.risk-accepted-line{margin:0 0 8px;font-size:13px;color:var(--text-2)}
.risk-accept-form{margin-top:10px;padding-top:10px;
  border-top:1px solid var(--border)}
@media (max-width:1100px){.risk-trace{position:static}}
@media (max-width:560px){
  .risk-card{flex-wrap:wrap}
  .risk-action{width:100%}
  .risk-action .btn{width:100%}
}
.risk-card h3{margin:0 0 9px;font-size:15.5px;line-height:1.4}
.coverage{font-weight:600;display:inline-flex;align-items:center;gap:6px}
.coverage.ok{color:var(--ok-fg)}
.coverage.warn{color:var(--warn-fg)}
.coverage.bad{color:var(--bad-fg)}
.score-row{margin-top:10px}
/* "How hard to notice" broke across two lines and the box ended up under
   its own label. The three fields wrap as whole fields, never inside one. */
.score-field{font-size:13px;color:var(--text-2);display:inline-flex;gap:6px;
  align-items:center;white-space:nowrap}
.score-row{flex-wrap:wrap;gap:10px}
/* Three scores side by side: the control system's 140px would push the last
 * one onto its own line, so they keep a number's width. */
.field .score-field input,.score-field input{width:68px;padding:0 8px;
  height:var(--ctl-h-sm);border:1px solid var(--border-strong);
  border-radius:var(--r-sm);background:var(--field);color:var(--text);
  font:inherit;font-size:13px;font-variant-numeric:tabular-nums}
@media (max-width:980px){.risk-split{grid-template-columns:minmax(0,1fr)}
  .risk-heat{position:static}}

/* ------------------------------------------------------------ source card */
/* "Is this built from my latest work?" — the same answer, in the same place,
 * on every desk. Three states, each with a colour AND an icon AND words, so
 * the state never rests on colour alone. */
.source-card{display:flex;align-items:flex-start;gap:12px;flex-wrap:wrap;
  padding:14px 18px;margin:0 0 16px;border-radius:var(--r-card);
  border:1px solid var(--border);background:var(--card);
  box-shadow:var(--shadow-1)}
.source-card:empty{display:none}
.source-mark{width:19px;height:19px;flex:0 0 19px;margin-top:2px}
.source-body{flex:1 1 280px;min-width:0}
.source-title{margin:0;font-size:14px;font-weight:500;color:var(--text)}
.source-detail,.source-extra{margin:4px 0 0;font-size:13px;color:var(--text-2)}
.source-actions{display:flex;gap:8px;flex-wrap:wrap;align-items:center}
.source-card .btn{flex:0 0 auto}

.source-card.none .source-mark{color:var(--muted)}
/* Amber: something upstream moved on. --warn-fg on --warn-bg clears 4.5:1 in
 * both themes, which is why the text colour is set and not inherited. */
.source-card.stale{background:var(--warn-bg);
  border-color:color-mix(in srgb,var(--warn-line) 45%,transparent)}
.source-card.stale .source-mark{color:var(--warn-fg)}
.source-card.stale .source-title{color:var(--warn-fg)}
.source-card.stale .source-detail,.source-card.stale .source-extra{
  color:color-mix(in srgb,var(--warn-fg) 86%,var(--text))}
.source-card.fresh{background:var(--ok-bg);
  border-color:color-mix(in srgb,var(--ok-line) 40%,transparent)}
.source-card.fresh .source-mark{color:var(--ok-fg)}
.source-card.fresh .source-title{color:var(--ok-fg)}
.source-card.fresh .source-extra{color:color-mix(in srgb,var(--ok-fg) 86%,var(--text))}
/* Ship check's own list of inputs that lag behind its verdict. */
.source-older{margin:6px 0 0;font-size:13px;padding:8px 10px;
  border-radius:var(--r);background:var(--warn-bg);color:var(--warn-fg)}
.source-older a{color:var(--warn-fg);font-weight:600}
.source-older .muted{color:color-mix(in srgb,var(--warn-fg) 78%,transparent)}

@media (prefers-reduced-motion:no-preference){
  .source-card{animation:source-in .15s var(--ease)}
}
@keyframes source-in{from{opacity:0;transform:translateY(-4px)}to{opacity:1;transform:none}}

/* Once the source card is on screen with a story behind it, the desk's own
 * summary card says the same thing twice. It stays in the page, hidden, so
 * the card can still press its Find risks and Load example buttons. */
body[data-has-story="yes"] #risk-root [data-input-card="Your run"]{display:none}

/* An out-of-date answer is kept and read-only until it is rebuilt. Dimming
 * the whole block took its words under 4.5:1 against the page, so only the
 * panel is dimmed and the text keeps its contrast. */
.stale-result{background:var(--card-2);border-radius:var(--r);
  box-shadow:inset 0 0 0 1px var(--border)}
.stale-result button,.stale-result a,.stale-result input,
.stale-result select,.stale-result summary{pointer-events:none}
.stale-result-note{margin:0 0 8px;font-style:italic}

/* While the card offers the action, the desk's own copy of it is a secondary
 * button: one primary per screen, and it is the one the card is pointing at. */
body[data-card-primary="risks"] #risk-find.btn-primary,
body[data-card-primary="risks"] #risk-paste-find.btn-primary,
/* The to-do strip's button is the desk's own main action too, so it steps
   down for the same reason the Find risks button does. */
body[data-card-primary="risks"] #risk-write-tests.btn-primary,
body[data-card-primary="risks"] .risk-write-one.btn-primary,
body[data-card-primary="test_cases"] #tc-generate.btn-primary,
body[data-card-primary="matrix"] #matrix-suggest.btn-primary,
body[data-card-primary="automation"] #automation-generate.btn-primary{
  background:var(--card);border-color:var(--border-strong);color:var(--text);
  box-shadow:var(--shadow-1)}
body[data-card-primary="risks"] #risk-find.btn-primary:hover,
body[data-card-primary="risks"] #risk-paste-find.btn-primary:hover,
body[data-card-primary="risks"] #risk-write-tests.btn-primary:hover,
body[data-card-primary="risks"] .risk-write-one.btn-primary:hover,
body[data-card-primary="test_cases"] #tc-generate.btn-primary:hover,
body[data-card-primary="matrix"] #matrix-suggest.btn-primary:hover,
body[data-card-primary="automation"] #automation-generate.btn-primary:hover{
  border-color:var(--text-2);box-shadow:var(--shadow-2);filter:none}

/* ------------------------------------------------------------ next strip */
/* Where to go next, with each desk's state under its name, so a reader never
 * has to open a desk to find out it is stale. */
.next-strip{display:flex;align-items:center;gap:8px;flex-wrap:wrap;
  margin:0 0 12px}
.next-label{font-size:13px;font-weight:600;color:var(--text-2)}
.next-chip{display:inline-flex;align-items:center;gap:7px;padding:7px 12px;
  border:1px solid var(--border);border-radius:var(--r);background:var(--card);
  text-decoration:none;color:var(--text);box-shadow:var(--shadow-1);
  transition:border-color .14s var(--ease),box-shadow .14s var(--ease)}
.next-chip:hover{border-color:var(--border-strong);box-shadow:var(--shadow-2);
  text-decoration:none}
.next-name{font-size:13.5px;font-weight:600}
.next-state{font-size:13px;color:var(--text-2)}
.next-chip[data-state="stale"]{border-color:color-mix(in srgb,var(--warn-line) 45%,transparent)}
.next-chip[data-state="stale"] .next-state{color:var(--warn-fg)}
.next-chip[data-state="fresh"] .next-state{color:var(--ok-fg)}
/* The mark is a status, not a picture: one small size, whatever shape it is.
 * An SVG with no width of its own fills whatever box it lands in, which is
 * how a tick ended up as tall as the chip and squeezed the name into a
 * column. The size belongs to the component, never to the element. */
.next-mark{width:14px;height:14px;flex:0 0 14px;display:block}
svg.next-mark{color:var(--ok-line)}
.next-mark.dot-stale{width:8px;height:8px;flex:0 0 8px;border-radius:50%;
  background:var(--warn-line)}
@media (max-width:480px){
  /* The chip may wrap onto two lines; it keeps its padding and its mark. */
  .next-chip{flex:1 1 100%;justify-content:flex-start;flex-wrap:wrap;
    row-gap:2px}
}

/* ── the "My stories" page ─────────────────────────────────────────────── */
.stories-bar .field{margin-bottom:0;min-width:180px}
/* The search field holds its own hint: "Search by ID or story text" wrapped
   onto two lines in 180px. The two selects keep theirs. */
.stories-bar .field:first-child{flex:1 1 300px;min-width:260px}
/* Labels on one line with their fields: the three boxes used to sit at
   three different heights because one hint wrapped and the others did not. */
.stories-bar .row{align-items:flex-start;gap:12px}
.stories-bar .field .hint{min-height:2.6em}
.story-card{margin-bottom:10px}
.story-card.story-open{border-color:var(--accent)}
.story-head{gap:8px;margin-bottom:8px}
.story-title{margin:0;font-family:var(--font-serif);font-size:19px;
  line-height:1.35;display:-webkit-box;-webkit-line-clamp:2;
  -webkit-box-orient:vertical;overflow:hidden}
.story-facts{margin:6px 0 0;font-size:13px;color:var(--text-2)}
.story-actions{margin-top:12px;gap:8px}
.story-actions .story-status{width:auto;min-width:140px;height:var(--ctl-h-sm);
  font-size:13px}
.story-inline{margin-top:10px;gap:8px}
.story-inline input{width:auto;min-width:140px;height:var(--ctl-h-sm);
  font-size:13px;border:1px solid var(--border-strong);
  border-radius:var(--r-sm);padding:0 10px;background:var(--card);
  color:var(--text)}
.delete-all-box{margin-top:14px;border-color:color-mix(in srgb,var(--bad-line) 40%,transparent)}
@media (max-width:640px){
  .stories-bar .row{flex-direction:column;align-items:stretch}
  .stories-bar .field{width:100%}
  .story-actions .btn,.story-actions .story-status{flex:1 1 44%}
}

/* ------------------------------------------------- stories in this browser */
.nav-stories{display:flex;align-items:center;gap:10px;margin-top:8px;
  padding:10px 14px;border-radius:var(--r);color:var(--rail-ink-2);
  text-decoration:none;font-weight:500;font-size:14px;position:relative;
  border-top:1px solid rgba(255,255,255,.1)}
.nav-stories:hover{background:rgba(255,255,255,.07);color:#fff}
.nav-stories.active{background:var(--rail-2);color:#fff}
/* rgba(255,255,255,.14) over the rail gave the number about 3:1 against
   the badge it sat in. A real token, and a real contrast. */
.nav-count{margin-left:auto;font-family:var(--font-mono);font-size:13px;
  font-weight:600;padding:2px 7px;border-radius:999px;
  background:var(--count-bg);color:var(--count-fg)}
.save-status{margin-left:14px;font-size:13px;color:var(--muted);
  white-space:nowrap}
.save-status.save-status-bad{color:var(--bad-fg);font-weight:600}
@media (max-width:640px){.save-status{display:none}}

/* The Save draft popover, and the one line that says it worked. */
.draft-pop{position:relative;margin:12px 0;max-width:420px;
  box-shadow:var(--shadow-2)}
.toast{position:fixed;left:50%;bottom:24px;transform:translate(-50%,12px);
  z-index:70;padding:11px 18px;border-radius:999px;background:var(--text);
  color:var(--canvas);font-size:13.5px;font-weight:600;
  box-shadow:var(--shadow-2);opacity:0;pointer-events:none;
  transition:opacity .2s var(--ease),transform .2s var(--ease)}
.toast.toast-on{opacity:1;transform:translate(-50%,0)}

/* ---------------------------------------------------------- nav status */
.nav-status{display:inline-flex;align-items:center;margin-left:auto;
  flex:0 0 auto}
.nav-status .dot-stale{width:8px;height:8px;border-radius:50%;
  background:var(--warn-line);display:block}
.nav-status .tick-fresh{width:13px;height:13px;display:block;color:var(--ok-line)}
.sr-only{position:absolute;width:1px;height:1px;overflow:hidden;
  clip-path:inset(50%);white-space:nowrap}

@media (max-width:480px){
  .source-card{padding:12px 14px}
  .source-card .btn,.source-actions{width:100%}
  .source-actions .btn{flex:1 1 100%}
}

/* ------------------------------------------------------------ test matrix */
.matrix-notes{margin:0 0 12px}
.matrix-factor{padding:12px 0;border-bottom:1px solid var(--border)}
.matrix-factor:last-child{border-bottom:none}
.matrix-factor-head{margin-bottom:8px}
.matrix-factor-name{max-width:240px}
.matrix-values{display:flex;flex-wrap:wrap;gap:6px;align-items:center}
.matrix-add-value{width:130px;height:var(--ctl-h-sm);font-size:13px}
/* A value reads as a removable chip, not a table cell. */
.chip-value{display:inline-flex;align-items:center;gap:4px;padding:3px 4px 3px 10px;
  border-radius:999px;background:var(--card-3);color:var(--text);font-size:13px}
.btn.btn-icon-tiny{width:18px;height:18px;min-width:0;padding:0;flex:0 0 18px;
  border-radius:50%;border-color:transparent;background:transparent;
  box-shadow:none;font-size:14px;line-height:1;color:var(--text-2)}
.btn.btn-icon-tiny:hover{background:var(--bad-bg);color:var(--bad-fg);
  border-color:transparent;box-shadow:none}
.btn.btn-icon-tiny:focus-visible{box-shadow:var(--ring)}
.matrix-reason{margin:6px 0 0}
.matrix-rule-list{list-style:none;margin:0;padding:0;display:flex;
  flex-direction:column;gap:8px}
.matrix-rule{display:flex;align-items:center;gap:8px;flex-wrap:wrap;
  padding:8px 10px;border:1px solid var(--border);border-radius:var(--r);
  background:var(--card-2);font-size:13.5px}
.matrix-rule .ctl{width:auto;min-width:120px;height:var(--ctl-h-sm);font-size:13px}
.matrix-table td{vertical-align:middle}
/* A pinned run is one the team always wants, so it is marked as kept. */
.matrix-pinned td{background:var(--accent-soft)}
.stat-accent .num{color:var(--accent)}
/* A header a screen reader reads and the eye does not. It is anchored in its
 * own cell, or it drifts and widens the page. */
.matrix-pin-col{position:relative}
.visually-hidden{position:absolute;left:0;top:0;width:1px;height:1px;
  overflow:hidden;clip-path:inset(50%);white-space:nowrap}
/* The runs table scrolls inside its card rather than stretching the page. */
.table-scroll{overflow-x:auto;max-width:100%}

/* ------------------------------------------------------------- ship check */
/* The decision, full width, in the colour its own rules chose. */
.ship-banner{display:flex;align-items:center;gap:20px;flex-wrap:wrap;
  padding:24px 26px;margin-bottom:16px;border-radius:var(--r-card);
  border:1px solid var(--border);background:var(--card);
  box-shadow:var(--shadow-1)}
.ship-banner-words{flex:1 1 320px;min-width:0}
/* Inside the banner the freshness card is one line, not a card: no box, no
 * background, no shadow -- it belongs to the banner it sits in. */
.source-card.source-in-banner{background:transparent;border:none;
  box-shadow:none;padding:0;margin:10px 0 0;font-size:13px;
  align-items:center;gap:8px}
.source-card.source-in-banner .source-title{font-size:13px}
.source-card.source-in-banner .source-mark{width:16px;height:16px;flex:0 0 16px;
  margin-top:0}
.source-card.source-in-banner .source-detail,
.source-card.source-in-banner .source-extra{font-size:13px}
.source-card.source-in-banner .source-body{flex:1 1 220px}

/* One status line, on every desk and inside the decision card: a dot, a
   sentence, and the desks worth opening. Three lines that could disagree
   with one another became this. */
.status-line{display:flex;align-items:baseline;flex-wrap:wrap;gap:6px;
  margin:0;font-size:13px;color:var(--text-2)}
.status-dot{width:9px;height:9px;flex:0 0 9px;border-radius:50%;
  align-self:center}
.status-dot.dot-ok{background:var(--ok-line)}
.status-dot.dot-warn{background:var(--warn-line)}
.status-words{font-weight:500}
.status-desk{color:inherit;font-weight:600;text-decoration:underline}
.source-card.status-only{background:transparent;border:none;box-shadow:none;
  padding:0;margin:8px 0 0}

/* "Fix first:", and the one thing to fix. */
.ship-fix-first{margin:8px 0 10px;font-size:15px;line-height:1.5}
.ship-fix-label{font-family:var(--font-mono);font-size:13px;font-weight:600;
  letter-spacing:.04em;text-transform:uppercase;margin-right:6px}
.ship-banner-actions{margin-top:14px}
.grade-points{margin:0;font-size:13px;font-weight:500}

/* While the verdict is being worked out: the shape of it, not a blank. */
.ship-banner.ship-working{background:var(--card-2)}
.skeleton{background:linear-gradient(90deg,
  color-mix(in srgb,var(--border) 70%,transparent) 25%,
  color-mix(in srgb,var(--border-strong) 70%,transparent) 50%,
  color-mix(in srgb,var(--border) 70%,transparent) 75%);
  background-size:200% 100%;border-radius:6px;
  animation:skeleton-sweep 1.3s ease-in-out infinite}
.skeleton-title{height:30px;width:min(280px,70%);margin:8px 0 10px}
.skeleton-line{height:13px;width:min(420px,90%);margin:0 0 8px}
.skeleton-line.short{width:min(220px,55%)}
.skeleton-circle{width:78px;height:78px;border-radius:50%;flex:0 0 78px}
@keyframes skeleton-sweep{from{background-position:200% 0}to{background-position:-200% 0}}
@media (prefers-reduced-motion:reduce){.skeleton{animation:none}}

/* Path to Ready: one numbered step per thing to do, worst first. */
.ship-path{margin-bottom:16px}
.path-list{list-style:none;counter-reset:step;margin:12px 0 0;padding:0;
  display:flex;flex-direction:column;gap:2px}
.path-step{counter-increment:step;display:grid;
  grid-template-columns:1fr auto;gap:12px;align-items:start;
  padding:14px 0;border-top:1px solid var(--border)}
.path-step:first-child{border-top:none}
.path-words{min-width:0}
.path-do{margin:0;font-weight:600;font-size:15px;line-height:1.45;
  display:flex;gap:10px;align-items:baseline}
.path-do::before{content:counter(step);font-family:var(--font-mono);
  font-size:13px;font-weight:600;color:var(--text-2);flex:0 0 auto}
.path-why{margin:4px 0 0 24px;font-size:13px}
.path-side{display:flex;gap:8px;align-items:center;flex-wrap:wrap}
.path-step .ship-accept-form{grid-column:1 / -1;margin-left:24px}
.path-step .checklist{margin:6px 0 0 24px}

/* All checks: one row each, evidence on the left, status on the right. */
.check-table{display:flex;flex-direction:column;margin-top:10px}
.check-row{display:grid;grid-template-columns:1fr auto;gap:12px;
  align-items:start;padding:12px 0;border-top:1px solid var(--border)}
.check-row:first-child{border-top:none}
.check-words{min-width:0}
.check-name{margin:0;font-weight:600;font-size:14px}
.check-evidence{margin:3px 0 0;font-size:13px}
.check-status{align-self:start;white-space:nowrap}
.ship-story-card .ship-story-text{margin:8px 0 0;color:var(--text-2);
  max-width:80ch;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;
  overflow:hidden}
.ship-story-card{margin-bottom:16px}
.ship-banner-label{font-family:var(--font-mono);font-size:13px;font-weight:500;
  letter-spacing:.14em;text-transform:uppercase;color:var(--text-2)}
.ship-banner .ship-verdict-label{margin:6px 0 6px;font-size:32px;
  font-family:var(--font-serif);font-weight:400;letter-spacing:-.01em}
.ship-banner p{margin:0 0 4px}
.ship-banner.ship-ok{background:var(--ok-bg);
  border-color:color-mix(in srgb,var(--ok-line) 35%,transparent)}
.ship-banner.ship-warn{background:var(--warn-bg);
  border-color:color-mix(in srgb,var(--warn-line) 35%,transparent)}
.ship-banner.ship-bad{background:var(--bad-bg);
  border-color:color-mix(in srgb,var(--bad-line) 35%,transparent)}

/* The grade: a letter in a ring, and the sums behind it one press away. */
.grade-holder{position:relative;flex:0 0 auto;display:flex;
  flex-direction:column;align-items:center;gap:6px;text-align:center}
.btn.grade-open{font-size:13px}
.btn.grade-circle{width:78px;height:78px;padding:0;border-radius:50%;
  border:3px solid currentColor;background:transparent;
  display:grid;place-items:center;box-shadow:none}
.btn.grade-circle:hover{background:rgba(255,255,255,.4);box-shadow:none}
.btn.grade-circle:focus-visible{box-shadow:var(--ring)}
:root[data-theme="dark"] .btn.grade-circle:hover{background:rgba(255,255,255,.08)}
.grade-letter{font-family:var(--font-serif);font-size:30px;font-weight:500;
  line-height:1}
.grade-why{position:absolute;right:0;top:calc(100% + 8px);z-index:20;
  width:min(320px,80vw);margin:0;box-shadow:var(--shadow-2);
  padding:14px 16px;text-align:left}
.grade-why-head{margin:0 0 6px}
.grade-lines{margin:0;padding-left:18px;font-size:13px;color:var(--text-2)}
.grade-lines li{margin:3px 0}

/* The evidence receipt: one tile per check that ran. */
.receipt{display:grid;grid-template-columns:repeat(auto-fit,minmax(240px,1fr));
  gap:10px;margin:14px 0}
.receipt-tile{display:flex;gap:11px;align-items:flex-start;padding:13px 14px;
  border:1px solid var(--border);border-radius:var(--r);background:var(--card-2)}
.receipt-mark{font-size:13px;font-weight:700;line-height:1}
.receipt-words{min-width:0}
.receipt-title{margin:0;font-weight:600;font-size:14px}
.receipt-line{margin:3px 0 0;font-size:13px;color:var(--text-2)}
.todo-list{display:flex;flex-direction:column;gap:10px;margin-top:12px}
.todo-row{margin:0}
.accepted-row{padding:12px 0;border-bottom:1px solid var(--border)}
.accepted-row:last-child{border-bottom:none}

.ship-story .ship-story-text{margin:6px 0 10px;color:var(--text);max-width:80ch}
/* The quiet half of the empty state. With a report already on the page the
   only thing missing is the story text, so this is a note on one line, not
   a front door — and its button stays secondary so the report keeps the
   page's one yellow button. */
.ship-story-note{display:flex;align-items:center;gap:14px;flex-wrap:wrap;
  padding:14px 18px}
.ship-story-note p{margin:0}
.ship-verdict{display:block;padding:24px 26px}
.ship-verdict .ship-verdict-label{margin:8px 0 6px;font-size:28px;letter-spacing:-.028em}
.ship-verdict.ship-ok{border-color:color-mix(in srgb,var(--ok-line) 40%,transparent);
  background:color-mix(in srgb,var(--ok-bg) 55%,var(--card))}
.ship-verdict.ship-warn{border-color:color-mix(in srgb,var(--warn-line) 40%,transparent);
  background:color-mix(in srgb,var(--warn-bg) 55%,var(--card))}
.ship-verdict.ship-bad{border-color:color-mix(in srgb,var(--bad-line) 40%,transparent);
  background:color-mix(in srgb,var(--bad-bg) 55%,var(--card))}
.ship-checks{display:flex;flex-direction:column;gap:10px;margin:16px 0}
.ship-row{padding:14px 16px}
.ship-row-head{align-items:center;gap:10px}
.ship-row-title{font-size:15.5px;letter-spacing:-.012em}
.ship-row-summary{margin:8px 0 0;color:var(--text-2)}
.ship-accepted-note{margin:6px 0 0;color:var(--text-2)}
.ship-details{margin-top:10px}
.ship-details summary{cursor:pointer;font-size:13px;color:var(--text-2)}
.ship-details ul{margin:8px 0 0;padding-left:20px;color:var(--text-2);font-size:13.5px}
.ship-accept-row{margin-top:10px}
.ship-accept-form{margin-top:10px;padding-top:10px;border-top:1px solid var(--border)}
.ship-accept-form textarea{width:100%}

/* Print / save as PDF: the verdict and the seven checks, nothing else.
   ship_check.js opens every <details> and adds .ship-print before printing. */
@media print{
  .sidebar,.topbar,.to-top,.scrim,#keys-drawer,.ship-actions,
  .ship-accept-row,.ship-accept-form,.ship-unaccept,.ship-row-link,
  .ship-accept,.path-side,.ship-banner-actions{display:none!important}
  /* The grade is part of the paper record; the popover is not. */
  .grade-why{display:none!important}
  .btn.grade-open{display:none!important}
  .ship-banner{break-inside:avoid}
  .req-split{display:block}
  :root{--rail-w:0px}
  .main{margin-left:0}
  .content{padding:0}
  body{background:#fff;color:#000}
  .card,.verdict{break-inside:avoid;box-shadow:none;border-color:#bbb}
  .ship-details ul{display:block}
  /* ship_check.js opens each <details> and sets .ship-print on <body>; with
     them all open the summary row is just noise on paper. */
  .ship-print .ship-details summary{display:none}
  .ship-print .ship-details ul{margin-top:0}
  .ship-details summary{list-style:none}
  a[href]::after{content:""}
}

/* ------------------------------------------------------------ responsive */
@media (max-width:900px){
  :root{--rail-w:0px}
  .sidebar{position:static;width:auto;height:auto;flex-direction:row;
    align-items:center;gap:6px;overflow-x:auto;padding:0 12px;
    border-right:none;border-bottom:1px solid rgba(255,255,255,.1)}
  .nav-n{display:none}
  .nav a.active{background:var(--rail-2)}
  .sidebar::after{display:none}
  .logo{padding:12px 8px 12px 4px;flex:0 0 auto;font-size:15px}
  .logo-sub{display:none}
  .nav-group{padding:0;display:flex;align-items:center}
  .nav-label,.rail-foot{display:none}
  .nav{flex-direction:row;padding:0;gap:4px}
  .nav a{padding:7px 10px;font-size:13.5px;white-space:nowrap}
  /* In the horizontal strip the status sits next to its label; pushing it to
   * the far right with margin-left:auto would stretch every link. */
  .nav-status{margin-left:4px}
  .nav a.active::before{left:0;top:auto;bottom:-1px;transform:none;
    width:100%;height:3px;border-radius:3px 3px 0 0;background:var(--cta)}
  .main{margin-left:0}
  .topbar{padding:0 14px;height:54px;flex:0 0 54px}
  .crumb .crumb-root{display:none}
  .content{padding:18px 14px 64px}
  .page-head h1{font-size:22px}
  .verdict{padding:18px;gap:16px}
  .to-top{right:14px;bottom:14px}
}

@media (max-width:640px){
  /* The rail is a strip you scroll. The fade at the right edge says there is
   * more, and app.js scrolls the desk you are on into view on load, so
   * "Risk radar" is never left as "Risk rada…". */
  .sidebar{scroll-snap-type:x proximity;scrollbar-width:none;
    -webkit-mask-image:linear-gradient(to right,#000 85%,transparent);
    mask-image:linear-gradient(to right,#000 85%,transparent)}
  .sidebar::-webkit-scrollbar{display:none}
  .nav a{scroll-snap-align:center}
  .nav a:last-child{margin-right:26px}
  .content{padding:16px 16px 60px}
  .card{padding:16px 16px}
  .verdict{padding:16px;gap:14px}
  .pq-note{flex-direction:column;gap:4px}
  .steps li{flex:1 1 100%}
  .field-pair{grid-template-columns:repeat(2,minmax(0,1fr))}
  table.grid th,table.grid td{padding:8px 9px}
}

@media (max-width:420px){
  /* The chip keeps the key's state; its words move into the label. */
  #key-chip-text{position:absolute;width:1px;height:1px;overflow:hidden;
    clip-path:inset(50%);white-space:nowrap}
  .btn.key-chip{padding:7px 10px;gap:6px}
}

/* ── "What's this?" for the few QA words a tester has to learn ──────────────
   The mark sits inline after the word, so the button must not change the
   line height of the heading it lives in. The panel is positioned against
   the mark and uses the same tokens as every other card, which is what makes
   it readable in both themes without a second rule. */
.explain{position:relative;display:inline-flex;align-items:center;white-space:nowrap}
.explain-btn{appearance:none;background:none;border:0;cursor:pointer;
  margin:0 0 0 4px;padding:0 2px;line-height:1;font-size:13px;
  color:var(--muted);border-radius:4px}
.explain-btn:hover,.explain-btn:focus-visible{color:var(--accent-2)}
.explain-btn:focus-visible{outline:2px solid var(--accent-2);outline-offset:2px}
.explain-btn[aria-expanded="true"]{color:var(--accent-2)}
.explain-panel{position:absolute;z-index:40;top:calc(100% + 7px);left:0;
  width:max(240px,min(320px,78vw));white-space:normal;
  background:var(--card);color:var(--text);border:1px solid var(--border-strong);
  border-radius:10px;box-shadow:var(--shadow-2);
  padding:10px 12px;font-size:13px;font-weight:400;line-height:1.5;
  text-transform:none;letter-spacing:normal}
.explain-panel strong{display:block;margin-bottom:2px;color:var(--text)}

@media (max-width:560px){
  /* Near the right edge a left-anchored panel runs off the page. */
  .explain-panel{left:auto;right:0}
}

/* ── which story you are on, and what another tab did to it ────────────────
   The id chip is the story's own, beside the page title on every desk. It is
   a different element from .page-pill, which a desk fills with its own
   counts: the two used to share one slot, so opening Risk radar replaced
   "CART-204 · Draft" with "9 risks" and the reader lost the thread. */
.page-head .story-chip{grid-column:1;justify-self:start;margin-bottom:6px}

/* The bar that says another tab moved first. It sits above everything on
   the page because it is about the page, not about one card on it. */
.story-bar{display:flex;align-items:center;gap:14px;flex-wrap:wrap;
  margin-bottom:18px;padding:12px 16px;
  border-left:3px solid var(--warn-line)}
.story-bar-words{flex:1 1 260px;min-width:0;font-weight:500}
.story-bar-actions{display:flex;gap:8px;flex-wrap:wrap}

/* ── More ▾ ─────────────────────────────────────────────────────────────────
   A row of actions keeps one main button and two next to it; everything
   else lives here, so nothing wraps onto a second line at 1440px. */
.more-menu{position:relative;display:inline-flex}
.more-list{position:absolute;z-index:45;top:calc(100% + 6px);right:0;
  min-width:200px;display:flex;flex-direction:column;align-items:stretch;
  gap:2px;padding:6px;background:var(--card);
  border:1px solid var(--border-strong);border-radius:var(--r);
  box-shadow:var(--shadow-2)}
.more-list .btn{justify-content:flex-start;width:100%;white-space:nowrap}

/* What "Write a test" did, at the top of that risk's own panel. It used to
   be a trip to another page and a list the reader had to search. */
.risk-written{margin:0 0 12px}
.risk-written-link{white-space:nowrap;font-weight:600}
