@font-face {
  font-family: "Source Serif 4";
  src: url("/fonts/SourceSerif4-600.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Courier Prime";
  src: url("/fonts/CourierPrime-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Courier Prime";
  src: url("/fonts/CourierPrime-700.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  /* ---- paper & ink (warm page = worst-case bg for contrast) ---- */
  --bg: #f5f1e8;
  --surface: #fffdf7;            /* the coverage sheet */
  --screen: #101412;            /* dark rooms (login + loading) — untouched */
  --on-screen: #f0ede2;
  --screen-dim: #9aa39a;
  --screen-hairline: rgba(240, 237, 226, 0.16);
  /* ---- gold: the single accent, AA-checked on paper ---- */
  --gold: #876931;              /* AA-safe gold TEXT on paper (4.55:1): links, active slug */
  --gold-soft: #c9a86a;         /* lamp gold — DARK ROOMS + focus ring ONLY, never text on paper */
  --gold-display: #876931;      /* unified with --gold: one paper gold for ticks/rules/display */
  --gold-wash: #f1e6cf;         /* gold field fill (producer band, active gate ground); never text */
  /* the rail is ink and gold only — old review-color tints repoint to gold */
  --rev-blue: var(--gold-display);
  --rev-pink: var(--gold-display);
  --rev-yellow: var(--gold-display);
  --rev-green: var(--gold-display);
  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  --ink: #1a1a1a;               /* primary ink, 15.4:1 on paper */
  --body: #33302a;              /* serif body copy — warm near-ink (no green cast) */
  --muted: #5d564b;             /* mono labels/dt — warm neutral gray, AA normal */
  --faint: #645d51;             /* registration ticks/meta — warm gray, AA normal at small sizes */
  --border: #cfd4cb;            /* 1px HAIRLINE: ledger rows, dl separators */
  --border-strong: #1a1a1a;     /* THICK INK RULE (= --ink): field/section/frame edges */
  /* green-SaaS chrome killed — repoint to ink so legacy consumers degrade to ink-on-paper */
  --accent: var(--ink);
  --accent-strong: var(--ink);
  --accent-soft: transparent;
  /* ---- verdicts: AA-safe on both papers, used as stamp border + text ---- */
  --green: #2e7c57;             /* advance / greenlit (4.50:1) */
  --green-soft: #e4f0e7;        /* wash fill only, never text */
  --yellow: #966418;            /* conditions — ochre-amber (4.51:1); true yellow can't hit AA on paper */
  --yellow-soft: #f7eed6;       /* wash fill only */
  --red: #cc3525;               /* hold / pass — brick (4.54:1) */
  --red-soft: #f6e3df;          /* wash fill only */
  --locked: #5d564b;            /* held / locked — warm neutral (matches muted) */
  --locked-soft: #eceee9;       /* wash fill only */
  /* blue chrome killed — repoint to ink / gold-wash */
  --blue: var(--ink);
  --blue-soft: var(--gold-wash);
  /* ---- structure: brutalist hard corners, no soft shadow ---- */
  --radius: 0;
  --radius-sm: 0;
  --radius-stamp: 2px;          /* the one survivor — a rubber stamp has a hair of round */
  --shadow-sm: none;
  --shadow-md: none;
  --offset: 6px 6px 0 var(--ink);   /* the only depth cue: hard ink offset, no blur, reserved */
  /* ---- fluid type scale ---- */
  --fs-display: clamp(2.4rem, 6vw, 4.6rem);
  --fs-h2: clamp(1.7rem, 3.4vw, 2.7rem);
  --fs-h3: clamp(1.25rem, 2vw, 1.55rem);
  --fs-lead: clamp(1.1rem, 1.7vw, 1.3rem);
  --fs-slug: clamp(0.72rem, 1.1vw, 0.82rem);
  --fs-drop: clamp(2.6rem, 6vw, 4.4rem);
  --fs-micro: 0.7rem;
  /* ---- fonts (two-font law: serif + mono, no system sans) ---- */
  --serif: "Source Serif 4", Georgia, "Times New Roman", serif;
  --brand: "Courier Prime", "Courier New", Courier, ui-monospace, monospace;
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--body);
  font-family: var(--serif);
  font-size: 17px;
  line-height: 1.6;
}

h1,
h2,
h3,
h4 {
  color: var(--ink);
  font-family: var(--serif);
  text-wrap: balance;
}

p,
li,
dd {
  text-wrap: pretty;
}

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

button {
  cursor: pointer;
}

.hidden {
  display: none !important;
}

/* The slug-header: a mono coverage label + a 44x2 gold tick. Opens every section,
   echoing the homepage .step-slug / .slug-tick — the shared screenplay vocabulary. */
.eyebrow {
  align-items: center;
  color: var(--muted);
  display: flex;
  font-family: var(--brand);
  font-size: var(--fs-slug);
  font-weight: 700;
  gap: 14px;
  letter-spacing: 0.16em;
  margin: 0 0 8px;
  text-transform: uppercase;
}

.eyebrow::before {
  background: var(--gold-display);
  content: "";
  flex: none;
  height: 2px;
  width: 44px;
}

.muted {
  color: var(--muted);
}

/* ---------- Buttons & form controls ---------- */

/* Buttons are mono labels struck into ink — no fills, no rounds, no soft shadow. */
.primary-button,
.primary-inline-button {
  background: var(--ink);
  border: 2px solid var(--ink);
  border-radius: 0;
  color: var(--bg);
  font-family: var(--brand);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.13em;
  padding: 13px 24px;
  text-transform: uppercase;
  transition: background 0.15s ease, color 0.15s ease;
}

.primary-button:hover,
.primary-inline-button:hover {
  background: transparent;
  color: var(--ink);
}

.primary-button:active,
.primary-inline-button:active {
  transform: translateY(1px);
}

.primary-inline-button {
  padding: 11px 20px;
}

.primary-inline-button.yellow {
  background: var(--yellow);
  border-color: var(--yellow);
  color: var(--surface);
}

.primary-inline-button.yellow:hover {
  background: transparent;
  color: var(--yellow);
}

.primary-inline-button.red {
  background: var(--red);
  border-color: var(--red);
  color: var(--surface);
}

.primary-inline-button.red:hover {
  background: transparent;
  color: var(--red);
}

.secondary-button {
  background: transparent;
  border: 2px solid var(--border-strong);
  border-radius: 0;
  color: var(--ink);
  font-family: var(--brand);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  padding: 11px 18px;
  text-transform: uppercase;
  transition: box-shadow 0.12s ease, transform 0.12s ease;
}

.secondary-button:hover {
  background: var(--surface);
}

@media (prefers-reduced-motion: no-preference) {
  .secondary-button:hover {
    box-shadow: 4px 4px 0 var(--ink);
    transform: translate(-2px, -2px);
  }
}

.ghost-button {
  background: transparent;
  border: 0;
  border-radius: 0;
  color: var(--ink);
  font-family: var(--brand);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 9px 12px;
  text-transform: uppercase;
}

.ghost-button:hover {
  color: var(--gold);
  text-decoration: underline;
  text-decoration-color: var(--gold-display);
  text-underline-offset: 4px;
}

button:disabled {
  cursor: default;
  opacity: 0.55;
}

label {
  color: var(--muted);
  display: block;
  font-family: var(--brand);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  margin-bottom: 7px;
  text-transform: uppercase;
}

input,
select,
textarea {
  background: #ece6d8;
  border: 2px solid var(--border-strong);
  border-radius: 0;
  color: var(--ink);
  font-family: var(--serif);
  padding: 11px 13px;
  width: 100%;
}

input:focus,
select:focus,
textarea:focus {
  box-shadow: 0 0 0 2px var(--gold-display);
  outline: none;
}

textarea {
  line-height: 1.55;
  min-height: 230px;
  resize: vertical;
}

/* The logline is a few sentences, not a paste box. */
#logline {
  min-height: 84px;
}

.form-error {
  color: var(--red);
  font-family: var(--brand);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  margin: 10px 0 0;
  min-height: 1.2em;
}

/* ---------- Login ---------- */

.login-view {
  display: grid;
  min-height: 100vh;
  padding: 24px;
  place-items: center;
}

.login-shell {
  text-align: center;
  width: min(520px, 100%);
}

.login-shell h1 {
  border-bottom: 3px solid var(--ink);
  display: inline-block;
  font-family: var(--brand);
  font-size: clamp(2rem, 5.4vw, 3.2rem);
  letter-spacing: 0.1em;
  line-height: 1.1;
  margin: 0 0 18px;
  padding: 0 8px 10px;
  text-transform: uppercase;
}

.login-copy {
  color: var(--muted);
  margin: 0 auto 24px;
  max-width: 420px;
}

.login-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  margin: 0 auto;
  padding: 26px;
  text-align: left;
  width: min(420px, 100%);
}

.password-row {
  display: flex;
  gap: 10px;
}

.password-row button {
  background: var(--ink);
  border: 2px solid var(--ink);
  border-radius: 0;
  color: var(--bg);
  font-family: var(--brand);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  padding: 11px 22px;
  text-transform: uppercase;
}

.password-row button:hover {
  background: transparent;
  color: var(--ink);
}

.privacy-note {
  color: var(--faint);
  font-size: 0.85rem;
  margin: 18px 0 0;
}

/* ---------- First-run intro modal (replaces the orientation page) ---------- */

.intro-modal {
  align-items: center;
  display: flex;
  inset: 0;
  justify-content: center;
  padding: 24px;
  position: fixed;
  z-index: 200;
}

.intro-backdrop {
  background: rgba(20, 18, 15, 0.55);
  inset: 0;
  position: absolute;
}

.intro-card {
  background: var(--bg);
  border: 1px solid var(--ink);
  box-shadow: 0 18px 60px rgba(20, 18, 15, 0.28);
  max-height: calc(100vh - 48px);
  max-width: 560px;
  overflow-y: auto;
  padding: 34px 34px 30px;
  position: relative;
  width: 100%;
  z-index: 1;
}

.intro-card::before {
  background: var(--gold-display);
  content: "";
  height: 3px;
  left: 0;
  position: absolute;
  top: 0;
  width: 64px;
}

.intro-close {
  background: none;
  border: 0;
  color: var(--faint);
  cursor: pointer;
  font-size: 1.5rem;
  line-height: 1;
  padding: 4px 8px;
  position: absolute;
  right: 10px;
  top: 8px;
}

.intro-close:hover { color: var(--ink); }

.intro-card h2 {
  color: var(--ink);
  font-family: var(--serif);
  font-size: 1.55rem;
  font-weight: 600;
  margin: 6px 0 14px;
}

.intro-lead {
  color: var(--body);
  font-family: var(--serif);
  font-size: 1rem;
  line-height: 1.6;
  margin: 0 0 18px;
}

.intro-steps {
  counter-reset: intro;
  list-style: none;
  margin: 0 0 18px;
  padding: 0;
}

.intro-steps li {
  border-top: 1px solid var(--border);
  color: var(--body);
  counter-increment: intro;
  font-family: var(--serif);
  font-size: 0.95rem;
  line-height: 1.55;
  padding: 12px 0 12px 30px;
  position: relative;
}

.intro-steps li::before {
  color: var(--gold);
  content: counter(intro);
  font-family: var(--brand);
  font-weight: 700;
  left: 0;
  position: absolute;
  top: 12px;
}

.intro-steps strong { color: var(--ink); }

.intro-privacy {
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-family: var(--brand);
  font-size: 0.78rem;
  line-height: 1.6;
  margin: 0 0 22px;
  padding-top: 16px;
}

.intro-privacy a { color: var(--gold); text-decoration: none; }
.intro-privacy a:hover { text-decoration: underline; }

/* ---------- App footer (site nav from inside the workbench) ---------- */

.app-footer {
  border-top: 1px solid var(--border);
  margin-top: 64px;
  padding: 32px 24px 44px;
  text-align: center;
}

/* The dark login threshold stays clean — no paper footer under it. */
body[data-view="login"] .app-footer { display: none; }

.app-footer-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 22px;
  justify-content: center;
  margin: 0 0 16px;
}

.app-footer-nav a {
  color: var(--muted);
  font-family: var(--brand);
  font-size: 0.74rem;
  letter-spacing: 0.1em;
  text-decoration: none;
  text-transform: uppercase;
  transition: color 0.18s ease;
}

.app-footer-nav a:hover { color: var(--ink); }

.app-footer-fine {
  color: var(--faint);
  font-family: var(--brand);
  font-size: 0.72rem;
  line-height: 1.6;
  margin: 0 auto;
  max-width: 64ch;
}

/* ---------- Projects ---------- */

.projects-view {
  margin: 0 auto;
  max-width: 1120px;
  min-height: 100vh;
  padding: 0 24px 80px;
}

.projects-lede {
  color: var(--muted);
  font-family: var(--serif);
  font-size: 1.05rem;
  line-height: 1.6;
  margin: 6px 0 28px;
  max-width: 62ch;
}

.projects-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  margin: 0 0 26px;
}

.projects-grid .support-empty {
  grid-column: 1 / -1;
  text-align: center;
}

.project-card h3,
.draft-card h3 {
  font-family: var(--serif);
  font-size: 1.18rem;
  margin: 4px 0 10px;
}

.project-card-actions {
  display: flex;
  gap: 10px;
  margin-top: 14px;
}

.project-create-card input {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font: inherit;
  margin: 10px 0 4px;
  padding: 10px 12px;
  width: 100%;
}

.draft-history .draft-history-note {
  font-size: 0.92rem;
  margin: 0 0 14px;
}

.saved-read-line {
  color: var(--gold);
}

/* ---------- Workbench frame ---------- */

.workbench {
  margin: 0 auto;
  max-width: 1120px;
  padding: 0 24px 80px;
}

.topbar {
  align-items: center;
  display: flex;
  justify-content: space-between;
  padding: 26px 0 22px;
}

.topbar .eyebrow {
  margin-bottom: 2px;
}

.topbar h1 {
  font-family: var(--brand);
  font-size: 1.55rem;
  letter-spacing: 0.09em;
  line-height: 1.1;
  margin: 0;
  text-transform: uppercase;
}

.topbar-actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.mode-chip {
  align-items: center;
  background: transparent;
  border: 1px solid var(--border-strong);
  border-radius: 0;
  box-shadow: none;
  color: var(--ink);
  display: inline-flex;
  font-family: var(--brand);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  padding: 5px 11px;
  text-transform: uppercase;
}

.mode-chip.model {
  background: var(--gold-wash);
  border-color: var(--border-strong);
  color: var(--ink);
}

.mode-chip.cached {
  background: var(--bg);
  border-color: var(--border-strong);
  color: var(--muted);
}

.mode-chip.demo {
  background: var(--yellow-soft);
  border-color: var(--yellow);
  color: var(--yellow);
}

/* ---------- Flow strip ---------- */

/* The flow strip is a screenplay slug sequence, ruled top and bottom — not cards. */
.flow-strip {
  border-bottom: 2px solid var(--border-strong);
  border-top: 2px solid var(--border-strong);
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 0 0 30px;
}

.flow-step {
  align-items: start;
  background: transparent;
  border: 0;
  border-radius: 0;
  border-right: 1px solid var(--border);
  box-shadow: none;
  column-gap: 12px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  opacity: 1;
  padding: 14px 18px;
}

.flow-step:last-child {
  border-right: 0;
}

.flow-step span {
  align-self: start;
  background: transparent;
  border: 0;
  border-radius: 0;
  color: var(--faint);
  display: block;
  font-family: var(--brand);
  font-size: 1.45rem;
  font-weight: 700;
  grid-row: span 2;
  height: auto;
  line-height: 1;
  width: auto;
}

.flow-step strong {
  color: var(--faint);
  font-family: var(--brand);
  font-size: 0.82rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.flow-step small {
  color: var(--faint);
  font-size: 0.8rem;
}

.flow-step.active {
  box-shadow: inset 0 -3px 0 var(--gold-display);
}

.flow-step.active span {
  color: var(--gold);
}

.flow-step.active strong {
  color: var(--ink);
}

.flow-step.complete span,
.flow-step.complete strong {
  color: var(--ink);
}

/* ---------- Intake ---------- */

.intake-details {
  background: transparent;
  border: 2px solid var(--border-strong);
  border-radius: 0;
  box-shadow: none;
  margin: 0 0 18px;
}

.intake-details > summary {
  align-items: baseline;
  cursor: pointer;
  display: flex;
  gap: 14px;
  padding: 18px 22px;
}

.intake-details > summary > span {
  color: var(--faint);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.intake-details > summary > strong {
  color: var(--ink);
  font-weight: 650;
}

.intake-details[open] > summary {
  border-bottom: 1px solid var(--border);
}

.sample-panel,
.intake-card {
  padding: 20px 22px;
}

.sample-backup {
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 0;
}

.sample-backup > summary {
  align-items: center;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  list-style: none;
  padding: 16px 22px;
}

.sample-backup > summary::-webkit-details-marker {
  display: none;
}

/* Hide the native disclosure triangle on every sample/draft panel — the custom
   summary content is the affordance; a bare ▶ reads as broken markup. */
.sample-panel > summary {
  cursor: pointer;
  list-style: none;
}

.sample-panel > summary::-webkit-details-marker {
  display: none;
}

.sample-backup > summary strong {
  color: var(--ink);
  display: block;
  font-size: 0.98rem;
}

.sample-backup .sample-grid {
  border-top: 1px solid var(--border);
  padding: 18px 22px 22px;
}

.section-heading {
  align-items: end;
  border-bottom: 2px solid var(--border-strong);
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  justify-content: space-between;
  margin: 0 0 22px;
  padding-bottom: 12px;
}

.section-heading h2 {
  font-size: var(--fs-h2);
  letter-spacing: -0.01em;
  line-height: 1.05;
  margin: 0;
}

.compact-heading {
  margin-bottom: 14px;
}

.sample-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.sample-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: grid;
  gap: 8px;
  padding: 18px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.sample-card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-sm);
}

.sample-card.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}

.sample-card h3 {
  font-size: 1.1rem;
  margin: 0;
}

.sample-card .secondary-button {
  justify-self: start;
}

.support-empty {
  background: var(--bg);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-sm);
  color: var(--faint);
  padding: 16px;
}

.field-row {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 0 0 14px;
}

.field-group {
  min-width: 0;
}

.field-hint {
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.45;
  margin: 6px 0 0;
}

.intent-hint {
  color: var(--muted);
  font-size: 0.82rem;
  margin: -4px 0 16px;
}

/* The paste well reads like a script page: Courier on stock. */
#material {
  font-family: var(--brand);
  font-size: 0.92rem;
  line-height: 1.6;
}

/* Material is the hero input; everything else is optional context. */
.field-required {
  color: var(--gold);
  font-family: var(--brand);
  font-size: 0.64rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.intent-details {
  border-top: 1px solid var(--border);
  margin: 16px 0 0;
}

.intent-details > summary {
  color: var(--muted);
  cursor: pointer;
  font-family: var(--brand);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  padding: 14px 0 0;
  text-transform: uppercase;
}

.intent-details > summary .field-optional {
  color: var(--gold);
  text-transform: lowercase;
}

.intent-details .intent-row {
  margin-top: 16px;
}

.field-optional {
  color: var(--faint);
  font-size: 0.78rem;
  font-weight: 400;
  letter-spacing: 0.02em;
  text-transform: lowercase;
}

.intent-row input {
  width: 100%;
}

.field-label {
  color: var(--muted);
  display: block;
  font-family: var(--brand);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  margin: 0 0 8px;
  text-transform: uppercase;
}

.format-toggle {
  display: grid;
  gap: 0;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.format-option {
  background: var(--surface);
  border: 2px solid var(--border-strong);
  border-radius: 0;
  color: var(--body);
  cursor: pointer;
  font-family: var(--brand);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  margin-left: -2px;
  min-height: 44px;
  padding: 9px 8px;
  text-transform: uppercase;
}

.format-option:first-child {
  margin-left: 0;
}

.format-option:hover {
  background: var(--bg);
}

.format-option.active {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--surface);
  position: relative;
  z-index: 1;
}

.intake-card form > .field-group {
  margin-bottom: 14px;
}

.intake-actions {
  align-items: center;
  display: flex;
  gap: 14px;
  justify-content: space-between;
  margin-top: 4px;
}

.sample-source {
  color: var(--faint);
  font-size: 0.85rem;
  font-weight: 600;
  margin: 0;
}

.upload-status {
  align-items: center;
  background: var(--blue-soft);
  border: 1px solid rgba(61, 90, 115, 0.28);
  border-radius: var(--radius-sm);
  display: flex;
  gap: 16px;
  justify-content: space-between;
  margin: 0 0 10px;
  padding: 14px 16px;
}

.upload-status h3 {
  font-size: 1rem;
  margin: 0 0 4px;
}

.upload-status p {
  margin: 0 0 4px;
}

/* ---------- Loading & error ---------- */

.error-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  margin: 0 0 18px;
  padding: 30px;
  text-align: center;
}

.loading-panel {
  align-items: center;
  background: rgba(16, 20, 18, 0.55);
  display: grid;
  inset: 0;
  padding: 24px;
  place-items: center;
  position: fixed;
  z-index: 40;
}

.loading-dialog {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  max-width: 560px;
  padding: 30px;
  text-align: center;
  width: min(100%, 560px);
}

.loading-panel h2,
.error-panel h2 {
  margin: 0 0 8px;
}

.loading-panel .muted {
  margin: 0 auto 12px;
  max-width: 520px;
}

.progress-track {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 0;
  height: 10px;
  margin: 18px 0 12px;
  overflow: hidden;
}

.progress-track span {
  background: linear-gradient(90deg, var(--accent), var(--blue));
  display: block;
  height: 100%;
  transition: width 0.35s ease;
  width: 0;
}

.loading-timer {
  color: var(--accent);
  font-size: 1.05rem;
  font-variant-numeric: tabular-nums;
  font-weight: 750;
  margin: 0 0 16px;
}

.loading-steps {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}

.loading-steps span {
  animation: pulse 1.6s ease-in-out infinite;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  padding: 7px 14px;
  text-transform: uppercase;
}

.loading-steps span:nth-child(2) { animation-delay: 0.2s; }
.loading-steps span:nth-child(3) { animation-delay: 0.4s; }
.loading-steps span:nth-child(4) { animation-delay: 0.6s; }
.loading-steps span:nth-child(5) { animation-delay: 0.8s; }

@keyframes pulse {
  0%, 100% { opacity: 0.45; }
  50% { opacity: 1; }
}

.error-panel {
  border-color: rgba(179, 54, 42, 0.4);
  border-left: 4px solid var(--red);
  text-align: left;
}

.error-panel.waiting {
  border-color: rgba(176, 129, 38, 0.38);
  border-left-color: var(--yellow);
}

.error-panel .decision-actions {
  margin-top: 16px;
}

/* ---------- Report ---------- */

.report {
  display: grid;
  gap: 56px;
}

/* Sections are flat regions of one document, divided by their heading rule — not cards. */
.report-section {
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  margin: 0;
  padding: 0;
}

/* The diagnosis is the document's framed master header — the one true sheet. */
.diagnosis-card {
  background: var(--surface);
  border: 3px solid var(--border-strong);
  border-radius: 0;
  box-shadow: none;
  padding: 0;
}

.diagnosis-card h2 {
  font-family: var(--serif);
  font-size: clamp(1.5rem, 2.6vw, 2.05rem);
  line-height: 1.25;
  margin: 0 0 14px;
}

.thesis-body {
  color: var(--body);
  font-family: var(--serif);
  font-size: 1.12rem;
  line-height: 1.65;
  margin: 0 0 12px;
}

.diagnosis-card .muted {
  margin: 0 0 12px;
}

.primary-question {
  border-left: 3px solid var(--border-strong);
  color: var(--muted);
  font-style: italic;
  margin: 0 0 14px;
  padding-left: 14px;
}

.gate-policy {
  color: var(--faint);
  font-size: 0.9rem;
  margin: 0 0 6px;
}

.headline-grid {
  border-top: 2px solid var(--border-strong);
  display: grid;
  gap: 0;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 22px;
  padding-top: 18px;
}

.headline-card {
  background: transparent;
  border-radius: 0;
  padding: 0 22px 0 0;
}

.headline-card.creative {
  border-right: 1px solid var(--border);
}

.headline-card.commercial {
  padding: 0 0 0 22px;
}

.headline-card h3 {
  font-family: var(--serif);
  font-size: var(--fs-h3);
  font-weight: 600;
  line-height: 1.3;
  margin: 6px 0 0;
}

.engine-line {
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-family: var(--brand);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  margin: 20px 0 0;
  padding-top: 16px;
}

.engine-line.model { color: var(--gold); }
.engine-line.cached { color: var(--muted); }
.engine-line.demo { color: var(--yellow); }

.diagnosis-card .secondary-button {
  margin-top: 14px;
}

/* ---------- Gate review ---------- */

.journey-line {
  color: var(--muted);
  font-size: 0.92rem;
  margin: 0 0 14px;
}

.journey-line strong {
  color: var(--ink);
}

.gate-rail {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin: 0 0 16px;
}

/* The four phases as a stack of collapsible coverage cards (the read, not a drive-task). */
.gate-intro {
  color: var(--muted);
  font-family: var(--serif);
  margin: 0 0 22px;
  max-width: 66ch;
}

/* §2: one-at-a-time advancement control beneath the revealed phase. */
.gate-advance {
  align-items: flex-start;
  border-top: 2px solid var(--border-strong);
  display: flex;
  flex-direction: column;
  gap: 18px;
  margin-top: 2px;
  padding-top: 26px;
}

.gate-advance .muted {
  font-family: var(--serif);
  margin: 0;
  max-width: 66ch;
}

.gate-advance.stalled {
  border-top-color: var(--gold);
}

.gate-stall-line {
  color: var(--ink);
  font-family: var(--serif);
  line-height: 1.55;
  margin: 0;
  max-width: 66ch;
}

.gate-advance-button {
  align-self: flex-start;
}

/* The single most obvious action at the end of a pass: bring the next draft. */
.upload-new-pass {
  align-self: stretch;
  font-size: 0.95rem;
  letter-spacing: 0.14em;
  padding: 18px 24px;
  text-align: center;
  width: 100%;
}

/* ---------- Tabbed stage-ledger read ----------
   The read is one document split into stage tabs. #report-body[data-tabbed]
   shows exactly one panel group at a time, keyed off data-active-tab:
     - a phase tab ("phase-N") shows #gate-section (with only the matching
       .gate-card.tab-active visible) and hides the synthesis family;
     - the Verdict tab shows the synthesis family and hides #gate-section.
   This is a class/attribute toggle over the existing sections — the section
   DOM is never restructured, so the verdict-first DOM order (and the print /
   Download-PDF linear document, which expands everything) is preserved. */

/* Phase tab: only the gate section shows; synthesis sections hide. */
#report-body[data-tabbed]:not([data-active-tab="verdict"]) > section:not(#gate-section) {
  display: none;
}
/* Within the gate section, only the active phase's card shows. */
#report-body[data-tabbed]:not([data-active-tab="verdict"]) #gate-report .gate-card:not(.tab-active) {
  display: none;
}
/* Verdict tab: the gate section hides; the synthesis family shows (each section
   still respects its own .hidden class when its renderer left it empty). */
#report-body[data-tabbed][data-active-tab="verdict"] > #gate-section {
  display: none;
}

.gate-replay {
  align-self: flex-start;
  margin-top: 18px;
}

.gate-card {
  border-top: 1px solid var(--border);
}

.gate-card:first-of-type {
  border-top: 2px solid var(--border-strong);
}

.gate-card:last-of-type {
  border-bottom: 2px solid var(--border-strong);
}

.gate-card[open] {
  background: transparent;
}

.gate-card > summary {
  align-items: baseline;
  column-gap: 16px;
  cursor: pointer;
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr) auto;
  list-style: none;
  padding: 18px 44px 18px 16px;
  position: relative;
}

.gate-card > summary::-webkit-details-marker {
  display: none;
}

.gate-card > summary::after {
  color: var(--faint);
  content: "+";
  font-family: var(--brand);
  font-size: 1.2rem;
  position: absolute;
  right: 18px;
  top: 16px;
}

.gate-card[open] > summary::after {
  content: "\2013";
}

.gate-card > summary:hover {
  background: var(--bg);
}

.gate-card[open] > summary:hover {
  background: transparent;
}

.gate-card .gate-number {
  align-self: start;
  grid-row: span 2;
}

.gate-card[open] .gate-number {
  color: var(--gold);
}

.gate-card .gate-name {
  align-self: baseline;
  color: var(--ink);
  font-family: var(--serif);
  font-size: var(--fs-h3);
  font-weight: 600;
  grid-column: 2;
}

.gate-card .gate-pov {
  grid-column: 2;
}

.gate-card .status {
  align-self: center;
  grid-column: 3;
  grid-row: 1 / span 2;
  justify-self: end;
}

.gate-card-body {
  padding: 0 16px 28px 72px;
}

.gate-card.locked {
  opacity: 0.72;
}

.gate-card .verdict-stamp {
  margin: 4px 0 16px;
}

.gate-card .gate-notes {
  border-left: 0;
  margin-top: 18px;
  padding-left: 0;
}

/* Cosmetic / clerical items: set aside from the read, flagged for cleanup. */
.gate-cleanup {
  border-top: 1px solid var(--border);
  margin-top: 20px;
  padding-top: 16px;
}

.cleanup-note {
  color: var(--muted);
  font-size: 0.92rem;
  font-style: italic;
  margin: 0 0 12px;
}

/* On narrow screens the phase name gets the full column; the status chip drops below it. */
@media (max-width: 560px) {
  .gate-card > summary {
    column-gap: 12px;
    grid-template-columns: 38px minmax(0, 1fr);
    padding-right: 36px;
  }
  .gate-card .status {
    grid-column: 2;
    grid-row: auto;
    justify-self: start;
    margin-top: 6px;
  }
  .gate-card-body {
    padding-left: 18px;
  }
}

.gate-step {
  align-items: start;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0;
  column-gap: 12px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  padding: 14px 16px;
  text-align: left;
  transition: background 0.15s ease;
}

.gate-step:hover {
  background: var(--bg);
}

.gate-step.active {
  background: var(--gold-wash);
}

.gate-step.locked {
  opacity: 0.7;
}

/* Phase number as a hung mono drop-figure — the rail reads like a script's scene index. */
.gate-number {
  align-items: start;
  background: transparent;
  border: 0;
  border-radius: 0;
  color: var(--faint);
  display: block;
  font-family: var(--brand);
  font-size: 1.7rem;
  font-weight: 700;
  grid-row: span 3;
  height: auto;
  justify-content: start;
  line-height: 1;
  width: auto;
}

.gate-step.active .gate-number {
  background: transparent;
  border-color: transparent;
  color: var(--gold);
}

.gate-name {
  color: var(--ink);
  font-size: 0.92rem;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.gate-pov {
  color: var(--faint);
  font-family: var(--brand);
  font-size: 0.72rem;
  letter-spacing: 0.03em;
}

.mini-status,
.status {
  border-radius: 999px;
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 750;
  letter-spacing: 0.04em;
  padding: 3px 10px;
  text-transform: uppercase;
  width: fit-content;
}

.status {
  font-size: 0.78rem;
  padding: 5px 13px;
}

.mini-status.green, .status.green { background: var(--green-soft); color: var(--green); }
.mini-status.yellow, .status.yellow { background: var(--yellow-soft); color: var(--yellow); }
.mini-status.red, .status.red { background: var(--red-soft); color: var(--red); }
.mini-status.locked, .status.locked { background: var(--locked-soft); color: var(--locked); }

.gate-panel {
  display: grid;
  gap: 24px;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr) minmax(0, 1fr);
  margin: 0 0 16px;
}

.stage-topline {
  align-items: start;
  display: flex;
  gap: 14px;
  justify-content: space-between;
  margin: 0 0 8px;
}

.stage-topline h3 {
  font-family: var(--serif);
  font-size: var(--fs-h3);
  margin: 0;
}

.score-line {
  color: var(--faint);
  font-size: 0.85rem;
  font-weight: 650;
  margin: 0 0 10px;
}

.gate-question {
  color: var(--muted);
  font-style: italic;
  margin: 0 0 10px;
}

.item-body {
  color: var(--body);
  margin: 0 0 10px;
}

.evidence-line {
  color: var(--faint);
  font-size: 0.85rem;
  margin: 0;
}

.gate-notes {
  border-left: 1px solid var(--border);
  padding-left: 24px;
}

.gate-list {
  color: var(--body);
  display: grid;
  font-size: 0.93rem;
  gap: 8px;
  list-style: none;
  margin: 0 0 18px;
  padding: 0;
}

.gate-list li {
  padding-left: 18px;
  position: relative;
}

.gate-list li::before {
  color: var(--accent);
  content: "—";
  left: 0;
  position: absolute;
}

.note-meta {
  color: var(--faint);
  display: block;
  font-size: 0.8rem;
  letter-spacing: 0.02em;
  margin-top: 3px;
}

.tier-conditions {
  margin: 4px 0 14px;
}

.tier-conditions summary {
  color: var(--muted);
  cursor: pointer;
  font-size: 0.85rem;
}

.tier-conditions ul {
  margin-top: 10px;
}

/* ---------- Revision read: draft over draft ---------- */

.coverage-flag {
  color: var(--yellow);
}

.revision-delta {
  display: grid;
  gap: 6px 22px;
  grid-template-columns: 190px minmax(0, 1fr);
  margin: 0 0 22px;
}

.revision-delta dt {
  color: var(--muted);
  font-family: var(--brand);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  padding-top: 2px;
}

.revision-delta dd {
  color: var(--body);
  line-height: 1.6;
  margin: 0 0 8px;
}

.revision-scores {
  margin-bottom: 22px;
}

.persists-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding-left: 18px;
}

/* ---------- v0.4: disposition, tier, writer-facing, proofread, notes ---------- */

.takeaway-eyebrow {
  margin: 0 0 10px;
}

.stamp.disposition {
  border-radius: 3px;
  font-size: 0.82rem;
  letter-spacing: 0.1em;
  padding: 8px 16px;
  rotate: -1deg;
}

.tier-chip {
  align-self: center;
  background: transparent;
  border: 1px solid var(--border-strong);
  border-radius: 0;
  color: var(--ink);
  font-family: var(--brand);
  font-size: 0.74rem;
  letter-spacing: 0.06em;
  padding: 6px 12px;
  text-transform: uppercase;
}

.threshold-line {
  color: var(--muted);
  font-size: 0.92rem;
  margin: 0 0 10px;
}

/* Tier & budget section */
#tier-panel .tier-line { color: var(--ink); font-size: 1.02rem; margin: 0 0 10px; }
.tier-intent li { line-height: 1.6; }

/* Writer-facing mentor card */
.writer-facing-section .wf-frame {
  color: var(--muted);
  font-family: var(--serif);
  font-style: italic;
  margin: 0 0 18px;
  max-width: 64ch;
}
/* The producer note is the one warm field on the page — gold stock, ink margin rule. */
.wf-card {
  background: var(--gold-wash);
  border: 0;
  border-left: 3px solid var(--border-strong);
  border-radius: 0;
  box-shadow: none;
  padding: 26px 30px;
}
.wf-headline { margin: 0 0 16px; }
.wf-prose {
  color: var(--ink);
  font-family: var(--serif);
  font-size: var(--fs-lead);
  line-height: 1.55;
  margin: 0 0 14px;
}
.wf-scope {
  border-left: 2px solid var(--border-strong);
  color: var(--muted);
  font-style: italic;
  margin: 0 0 20px;
  padding-left: 14px;
}
/* Conversational memo beats — a producer talking, not labeled blocks. */
.wf-beat {
  color: var(--body);
  font-family: var(--serif);
  font-size: 1.04rem;
  line-height: 1.65;
  margin: 0 0 12px;
}
.wf-lead {
  color: var(--ink);
  font-weight: 650;
}
.wf-gold-wrap {
  border-top: 1px solid var(--border);
  display: grid;
  gap: 14px;
  grid-template-columns: 1fr 1fr;
  margin-top: 18px;
  padding-top: 16px;
}
.wf-gold-label {
  color: var(--gold);
  font-family: var(--brand);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  margin: 0 0 8px;
  text-transform: uppercase;
}
.wf-gold {
  color: var(--body);
  font-family: var(--serif);
  list-style: none;
  margin: 0;
  padding: 0;
}
.wf-gold li {
  line-height: 1.55;
  margin: 0 0 4px;
  padding-left: 14px;
  position: relative;
}
.wf-gold li::before { color: var(--gold); content: "—"; left: 0; position: absolute; }

/* Proofread — one expand, grouped category tabs */
.proofread-all > summary,
.proofread-group > summary {
  cursor: pointer;
  font-family: var(--brand);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.proofread-all > summary { color: var(--ink); margin-bottom: 14px; }
.proofread-groups { display: grid; gap: 0; }
.proofread-group {
  background: transparent;
  border: 0;
  border-top: 1px solid var(--border);
  border-radius: 0;
  padding: 12px 4px;
}
.proofread-group:first-of-type { border-top: 2px solid var(--border-strong); }
.proofread-group > summary { display: flex; gap: 10px; align-items: center; }
.proofread-cat { font-family: var(--brand); letter-spacing: 0.04em; text-transform: uppercase; }
.proofread-count {
  background: var(--ink);
  border-radius: 0;
  color: var(--bg);
  font-family: var(--brand);
  font-size: 0.7rem;
  padding: 1px 8px;
}
.proofread-list { display: grid; gap: 10px; list-style: none; margin: 14px 0 0; padding: 0; }
.proofread-row { display: grid; grid-template-columns: 80px minmax(0, 1fr); gap: 12px; }
.proofread-loc { color: var(--faint); font-family: var(--brand); font-size: 0.8rem; }
.proofread-body { display: grid; gap: 3px; }
.proofread-found { color: var(--muted); font-size: 0.9rem; }
.proofread-fix { color: var(--green); font-size: 0.9rem; }

/* Structured 4-field notes */
.structured-notes { gap: 14px; }
.structured-note { display: grid; gap: 5px; }
.note-head { color: var(--ink); }
.note-detail-fields { display: grid; gap: 2px; }
.note-field { color: var(--muted); font-size: 0.9rem; }
.note-field strong { color: var(--body); }
.note-badge {
  border: 1px solid var(--border-strong);
  border-radius: 0;
  font-family: var(--brand);
  font-size: 0.66rem;
  letter-spacing: 0.06em;
  margin-left: 6px;
  padding: 1px 7px;
  text-transform: uppercase;
}
.note-badge.keystone { border-color: var(--gold); color: var(--gold); }
.note-badge.luxury { border-color: var(--green); color: var(--green); }
.note-badge.carried { border-color: var(--border-strong); color: var(--muted); }

#revision-panel .support-list {
  display: grid;
  gap: 10px;
  margin-bottom: 6px;
}

#revision-panel > .eyebrow {
  margin: 0 0 10px;
}

.context-panel {
  align-content: start;
  border-left: 1px solid var(--border);
  display: grid;
  gap: 12px;
  padding-left: 24px;
}

.context-note {
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
}

.context-note h4 {
  font-size: 0.82rem;
  margin: 0 0 4px;
}

.context-note p {
  color: var(--body);
  font-size: 0.88rem;
  margin: 0 0 4px;
}

.context-note span {
  color: var(--faint);
  font-size: 0.78rem;
}

.context-note.muted-note p {
  color: var(--faint);
}

/* ---------- Decision box ---------- */

.decision-box {
  border-radius: var(--radius);
  padding: 20px 22px;
}

.decision-box.green { background: var(--green-soft); }
.decision-box.yellow { background: var(--yellow-soft); }
.decision-box.red { background: var(--red-soft); }
.decision-box.locked { background: var(--locked-soft); }

.decision-kicker {
  color: var(--faint);
  font-size: 0.74rem;
  font-weight: 750;
  letter-spacing: 0.08em;
  margin: 0 0 6px;
  text-transform: uppercase;
}

.decision-box > p:not(.decision-kicker) {
  color: var(--ink);
  font-weight: 550;
  margin: 0 0 8px;
}

.journey-log {
  border-left: 2px solid rgba(28, 38, 32, 0.15);
  color: var(--muted);
  font-size: 0.86rem;
  list-style: none;
  margin: 10px 0 4px;
  padding: 0 0 0 14px;
}

.journey-log li {
  margin: 0 0 4px;
}

.decision-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

/* ---------- Rewrite plan ---------- */

.support-list {
  display: grid;
  gap: 12px;
}

/* The rewrite plan is a ranked ledger — rows butt and share rules. */
#rewrite-plan {
  gap: 0;
}

.rewrite-item {
  align-items: start;
  background: transparent;
  border: 0;
  border-top: 1px solid var(--border);
  border-radius: 0;
  display: block;
  overflow: visible;
  padding: 0;
}

.rewrite-item:first-of-type {
  border-top: 2px solid var(--border-strong);
}

.rewrite-item > summary {
  align-items: baseline;
  cursor: pointer;
  display: grid;
  gap: 4px 18px;
  grid-template-columns: 54px minmax(0, 1fr) auto 24px;
  padding: 18px 4px;
}

/* The rank is a hung mono drop-figure — the page reads like a numbered call sheet. */
.rank {
  align-items: start;
  background: transparent;
  border-radius: 0;
  color: var(--faint);
  display: block;
  font-family: var(--brand);
  font-size: 2.1rem;
  font-weight: 700;
  height: auto;
  justify-content: start;
  line-height: 0.85;
  width: auto;
}

.item-title {
  font-family: var(--serif);
  font-size: 1.14rem;
  margin: 0 0 4px;
}

.tag {
  background: transparent;
  border: 1px solid var(--border-strong);
  border-radius: 0;
  color: var(--ink);
  font-family: var(--brand);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 3px 9px;
  text-transform: uppercase;
  white-space: nowrap;
}

.note-disclosure > summary {
  list-style: none;
}

.note-disclosure > summary::-webkit-details-marker {
  display: none;
}

.note-disclosure > summary::after {
  color: var(--faint);
  content: "+";
  font-weight: 800;
  justify-self: end;
}

.rewrite-item > summary::after {
  align-self: start;
  grid-column: 4;
  grid-row: 1;
}

.note-disclosure[open] > summary::after {
  content: "-";
}

.note-detail {
  border-top: 1px solid var(--border);
  color: var(--body);
  display: grid;
  gap: 8px;
  padding: 14px 18px 16px;
}

.note-detail p {
  margin: 0;
}

.note-detail strong {
  color: var(--ink);
}

/* ---------- Support sections ---------- */

.support-section {
  display: grid;
  gap: 12px;
}

.support-disclosure {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.support-disclosure > summary {
  color: var(--ink);
  cursor: pointer;
  font-weight: 650;
  padding: 14px 18px;
}

.support-disclosure[open] > summary {
  border-bottom: 1px solid var(--border);
}

.support-disclosure > div,
.support-disclosure > .section-heading,
.support-disclosure > .muted,
.support-disclosure > .comparison-grid,
.support-disclosure > .trust-list {
  padding: 14px 18px;
}

.role-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.role-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  padding: 0;
}

.role-item > summary {
  align-items: center;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  padding: 14px 16px;
}

.role-item h3 {
  font-size: 1rem;
  margin: 0;
}

.role-evidence {
  color: var(--faint);
  font-size: 0.88rem;
}

.evidence-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin: 0 0 10px;
  overflow: hidden;
  padding: 14px 16px;
}

.evidence-item:last-child {
  margin-bottom: 0;
}

.evidence-item.note-disclosure {
  padding: 0;
}

.evidence-item.note-disclosure > summary {
  align-items: center;
  cursor: pointer;
  display: flex;
  gap: 12px;
  justify-content: space-between;
  padding: 14px 16px;
}

.evidence-item .item-title {
  font-size: 0.98rem;
}

.comparison-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.comparison-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
}

.comparison-item h3 {
  font-size: 0.95rem;
  margin: 0 0 6px;
}

.trust-list {
  display: grid;
  gap: 8px;
}

.trust-list span {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm);
  color: var(--body);
  display: block;
  font-size: 0.9rem;
  padding: 10px 14px;
}

/* ---------- Responsive ---------- */

@media (max-width: 980px) {
  .workbench {
    padding: 0 16px 60px;
  }

  .topbar {
    align-items: start;
    flex-direction: column;
    gap: 12px;
  }

  .flow-strip,
  .field-row,
  .headline-grid,
  .sample-grid,
  .comparison-grid,
  .role-grid {
    grid-template-columns: 1fr;
  }

  /* Stacked headlines: a hairline between, not a stray vertical rule or indent. */
  .headline-card.creative {
    border-bottom: 1px solid var(--border);
    border-right: 0;
    padding: 0 0 16px;
  }

  .headline-card.commercial {
    padding: 16px 0 0;
  }

  .gate-rail {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .gate-panel {
    grid-template-columns: 1fr;
  }

  .gate-notes,
  .context-panel {
    border-left: 0;
    border-top: 1px solid var(--border);
    padding-left: 0;
    padding-top: 16px;
  }

  .diagnosis-card {
    padding: 24px;
  }

  .rewrite-item {
    grid-template-columns: none;
  }

  .rewrite-item > summary {
    grid-template-columns: 40px minmax(0, 1fr) 20px;
  }

  .rewrite-item .tag {
    grid-column: 2;
    width: fit-content;
  }

  .rewrite-item > summary::after {
    grid-column: 3;
    grid-row: 1;
  }
}

@media (max-width: 560px) {
  .gate-rail {
    grid-template-columns: 1fr;
  }

  .revision-delta {
    gap: 2px;
    grid-template-columns: 1fr;
  }

  .revision-delta dd {
    margin-bottom: 12px;
  }

  .intake-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .primary-button {
    width: 100%;
  }

  .upload-status {
    align-items: stretch;
    flex-direction: column;
  }
}

.upload-row {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 0 0 10px;
}

.upload-note {
  color: var(--faint);
  font-size: 0.82rem;
  margin: 0;
}

.home-link {
  color: var(--faint);
  display: inline-block;
  font-family: var(--brand);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  margin-bottom: 12px;
  text-decoration: none;
  text-transform: uppercase;
}

.home-link:hover {
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 4px;
}

.topbar-actions .home-link {
  margin-bottom: 0;
  padding: 9px 6px;
}

/* ---------- Brand handoff: the dark threshold and the room ---------- */

.login-view {
  background: var(--screen);
  color: var(--on-screen);
  position: relative;
}

.login-view::before {
  background-image: var(--grain);
  content: "";
  inset: 0;
  opacity: 0.055;
  pointer-events: none;
  position: absolute;
}

.login-shell { position: relative; }

.login-view .login-shell h1 {
  border-bottom-color: var(--on-screen);
  color: var(--on-screen);
}

.login-view .eyebrow,
.login-view .login-copy,
.login-view .privacy-note { color: var(--screen-dim); }

.login-view .home-link { color: var(--screen-dim); }
.login-view .home-link:hover { color: var(--on-screen); }

.login-view .login-panel {
  background: var(--surface);
  border-color: transparent;
}

/* The staged wait is the dark room: the page the chairs are reading. */
.loading-panel {
  background: var(--screen);
  border-color: var(--screen);
  color: var(--on-screen);
  position: relative;
}

.loading-panel::before {
  background-image: var(--grain);
  content: "";
  inset: 0;
  opacity: 0.055;
  pointer-events: none;
  position: absolute;
}

.loading-dialog { position: relative; }

.loading-panel h2 {
  color: var(--on-screen);
  font-family: var(--serif);
}

.loading-panel .eyebrow,
.loading-panel .muted,
.loading-panel .loading-timer { color: var(--screen-dim); }

.loading-panel .progress-track {
  background: rgba(240, 237, 226, 0.12);
}

.loading-panel #loading-progress { background: var(--gold-soft); }

.chair-board {
  display: grid;
  gap: 0;
  list-style: none;
  margin: 22px auto 18px;
  max-width: 480px;
  padding: 0;
  text-align: left;
}

.chair-board li {
  align-items: baseline;
  border-top: 1px solid var(--screen-hairline);
  display: flex;
  font-family: var(--brand);
  justify-content: space-between;
  padding: 12px 4px;
}

.chair-board li:last-child { border-bottom: 1px solid var(--screen-hairline); }

.chair-name {
  color: var(--on-screen);
  font-size: 0.92rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.chair-state {
  color: var(--screen-dim);
  font-size: 0.82rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.chair-state[data-state="reading"] {
  color: var(--gold-soft);
  animation: chair-reading 1.4s ease-in-out infinite;
}

@keyframes chair-reading {
  50% { opacity: 0.45; }
}

.chair-state[data-state="green"] { color: var(--green); text-shadow: 0 0 18px currentColor; }
.chair-state[data-state="yellow"] { color: var(--yellow); text-shadow: 0 0 18px currentColor; }
.chair-state[data-state="red"] { color: var(--red); text-shadow: 0 0 18px currentColor; }
.chair-state[data-state="skipped"] { color: var(--screen-dim); text-decoration: line-through; }
.chair-state[data-state="failed"] { color: var(--red); }

.loading-panel #cancel-run {
  border: 1px solid var(--screen-hairline);
  color: var(--screen-dim);
  margin-top: 8px;
}

.loading-panel #cancel-run:hover {
  background: rgba(240, 237, 226, 0.07);
  color: var(--on-screen);
}

/* ---------- Verdict stamps ---------- */

.verdict-stamp {
  border: 3px solid;
  border-radius: 3px;
  display: inline-flex;
  flex-direction: column;
  font-family: var(--brand);
  font-size: 1.5rem;
  font-weight: 700;
  gap: 2px;
  letter-spacing: 0.18em;
  line-height: 1;
  margin: 0 0 16px;
  padding: 10px 18px 9px;
  rotate: -2deg;
  text-transform: uppercase;
  transform-origin: center;
}

.verdict-stamp .stamp-term {
  font-size: 0.66rem;
  letter-spacing: 0.22em;
  opacity: 0.85;
}

.verdict-stamp.green { border-color: var(--green); color: var(--green); background: var(--green-soft); }
.verdict-stamp.yellow { border-color: var(--yellow); color: var(--yellow); background: var(--yellow-soft); }
.verdict-stamp.red { border-color: var(--red); color: var(--red); background: var(--red-soft); }
.verdict-stamp.held { border-color: var(--locked); color: var(--locked); background: var(--locked-soft); font-size: 1rem; rotate: 1.5deg; }

/* The disposition stamp is uppercase at 1.5rem; on a phone "ADVANCE WITH
   CONDITIONS" runs ~440px and pushes the page sideways. Shrink it and let it
   wrap so it sits inside a 375px column. */
@media (max-width: 560px) {
  .verdict-stamp {
    font-size: 1.05rem;
    letter-spacing: 0.08em;
    max-width: 100%;
  }
  .verdict-stamp .stamp-term { white-space: normal; }
}

@media (prefers-reduced-motion: no-preference) {
  #report:not(.stamped) .verdict-stamp { opacity: 0; scale: 1.5; }
  #report.stamped .verdict-stamp {
    opacity: 1;
    scale: 1;
    transition: opacity 0.22s ease-out, scale 0.32s cubic-bezier(0.34, 1.4, 0.64, 1);
  }
}

/* The 1.5x stamp-drop overshoots a phone column (even an invisible scaled box
   widens the page); on mobile the stamp just fades in at scale 1, so it can
   never push the page sideways. */
@media (max-width: 560px) {
  #report:not(.stamped) .verdict-stamp { scale: 1; }
}

/* Diagnosis is the framed master sheet — a notarized coverage form. */
.diagnosis-card {
  overflow: visible;
  padding: 0 0 24px;
  position: relative;
}

.diagnosis-card .stripe {
  display: none;
}

/* Loose content sits in from the frame; the slug head and the ledger run full-bleed. */
.diagnosis-card > .takeaway-eyebrow,
.diagnosis-card > .coverage-verdict,
.diagnosis-card > .gate-policy,
.diagnosis-card > .headline-grid,
.diagnosis-card > .engine-line,
.diagnosis-card > .sample-upgrade {
  margin-left: clamp(20px, 3vw, 32px);
  margin-right: clamp(20px, 3vw, 32px);
}

.diagnosis-card .coverage-head {
  border-bottom: 2px solid var(--border-strong);
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  font-family: var(--brand);
  font-size: 0.76rem;
  gap: 6px 24px;
  letter-spacing: 0.06em;
  margin: 0 0 20px;
  padding: 14px clamp(20px, 3vw, 32px);
}

.coverage-flag { color: var(--gold); }

.takeaway-eyebrow { margin-top: 0; }

.coverage-verdict {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 22px;
}

.sample-upgrade {
  background: var(--gold-wash);
  border: 2px solid var(--border-strong);
  border-radius: 0;
  margin-top: 18px;
  padding: 16px 18px;
}
.sample-upgrade .muted { color: var(--ink); margin: 0 0 12px; }

.stamp {
  border: 2px solid;
  border-radius: var(--radius-stamp);
  display: inline-block;
  font-family: var(--brand);
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  padding: 7px 18px;
  rotate: -2deg;
  text-transform: uppercase;
}

.stamp + .stamp { rotate: 1.5deg; }
.stamp.green { border-color: var(--green); color: var(--green); }
.stamp.yellow { border-color: var(--yellow); color: var(--yellow); }
.stamp.red { border-color: var(--red); color: var(--red); }

/* The thesis/read/asks ledger: a ruled register, full-bleed across the sheet. */
.diagnosis-card .coverage-body {
  border-top: 2px solid var(--border-strong);
  display: grid;
  gap: 0;
  grid-template-columns: 120px minmax(0, 1fr);
  margin: 0 0 22px;
}

.diagnosis-card .coverage-body dt {
  align-self: stretch;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  border-right: 1px solid var(--border);
  color: var(--muted);
  font-family: var(--brand);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  margin: 0;
  padding: 14px 14px 14px clamp(20px, 3vw, 32px);
}

.diagnosis-card .coverage-body dd {
  border-bottom: 1px solid var(--border);
  color: var(--ink);
  margin: 0;
  padding: 14px clamp(20px, 3vw, 32px) 14px 20px;
}

.diagnosis-card .coverage-body dd:first-of-type {
  font-family: var(--serif);
  font-size: var(--fs-lead);
  line-height: 1.45;
}

/* The rail is ink and gold only: active = ink rule + gold figure, locked = dashed. */
.gate-step { border-top: 3px solid var(--border); }
.gate-step.active { border-top-color: var(--border-strong); }
.gate-step.locked { border-top-color: var(--locked); border-top-style: dashed; }

.gate-panel {
  border-left: 3px solid var(--border-strong);
  padding-left: clamp(16px, 2.5vw, 28px);
}

/* Phase status reads as a flat, squared mono verdict chip struck on paper (no glow). */
.mini-status,
.status {
  background: transparent;
  border: 1px solid var(--border-strong);
  border-radius: 0;
  font-family: var(--brand);
  text-transform: uppercase;
}

.mini-status.green, .status.green { background: var(--green-soft); border-color: var(--green); color: var(--green); }
.mini-status.yellow, .status.yellow { background: var(--yellow-soft); border-color: var(--yellow); color: var(--yellow); }
.mini-status.red, .status.red { background: var(--red-soft); border-color: var(--red); color: var(--red); }
.mini-status.locked, .status.locked { background: var(--locked-soft); border-color: var(--locked); color: var(--locked); }

/* Journey as a call sheet strip. */
.journey-wrap {
  align-items: start;
  display: flex;
  gap: 12px;
  justify-content: space-between;
}

.journey-log {
  font-family: var(--brand);
  font-size: 0.82rem;
}

.journey-copy {
  font-size: 0.72rem;
  padding: 4px 10px;
}

/* Gold focus ring everywhere (brand accent in the workbench). */
:focus-visible {
  outline: 2px solid var(--gold-soft);
  outline-offset: 2px;
}

/* Inside the dark room the dialog is part of the dark, not a paper card. */
.loading-panel .loading-dialog {
  background: transparent;
  border: 0;
  box-shadow: none;
}

.loading-panel #loading-title { color: var(--on-screen); }

/* ---------- Upload preparation states ---------- */

.upload-status.preparing {
  background: var(--screen);
  border: 0;
  border-radius: var(--radius);
  color: var(--on-screen);
  padding: 22px 24px;
  position: relative;
}

.upload-status.preparing::before {
  background-image: var(--grain);
  border-radius: var(--radius);
  content: "";
  inset: 0;
  opacity: 0.055;
  pointer-events: none;
  position: absolute;
}

.upload-prep { position: relative; }

.upload-status.preparing .eyebrow { color: var(--screen-dim); }

.upload-status.preparing h3 {
  color: var(--on-screen);
  font-family: var(--brand);
  font-size: 1.05rem;
  letter-spacing: 0.04em;
  margin: 0 0 14px;
  overflow-wrap: anywhere;
}

.upload-track {
  background: rgba(240, 237, 226, 0.14);
  border-radius: 0;
  height: 6px;
  margin: 0 0 10px;
  overflow: hidden;
}

.upload-track span {
  background: var(--gold-soft);
  border-radius: 0;
  display: block;
  height: 100%;
  transition: width 0.25s ease;
  width: 3%;
}

.upload-status.preparing .score-line { color: var(--gold-soft); }

.upload-warning {
  color: var(--screen-dim);
  font-size: 0.85rem;
  margin: 6px 0 14px;
}

.upload-status.preparing #cancel-upload {
  border: 1px solid var(--screen-hairline);
  color: var(--screen-dim);
}

.upload-status.preparing #cancel-upload:hover {
  background: rgba(240, 237, 226, 0.07);
  color: var(--on-screen);
}

.upload-status.failed {
  border-color: rgba(179, 54, 42, 0.5);
  border-left: 4px solid var(--red);
}

/* While a file is preparing, the rest of the intake politely steps back. */
body.upload-pending .sample-panel,
body.upload-pending .format-toggle,
body.upload-pending #material {
  opacity: 0.45;
  pointer-events: none;
}

#update-notice {
  align-items: center;
  background: var(--screen);
  border-top: 1px solid var(--gold);
  bottom: 0;
  color: var(--on-screen);
  display: flex;
  flex-wrap: wrap;
  font-family: "Courier Prime", "Courier New", monospace;
  font-size: 0.9rem;
  gap: 10px 18px;
  justify-content: center;
  left: 0;
  padding: 12px 20px;
  position: fixed;
  right: 0;
  z-index: 60;
}

#update-notice button {
  background: none;
  border: none;
  border-bottom: 1px solid var(--gold-soft);
  color: var(--gold-soft);
  cursor: pointer;
  font: inherit;
  padding: 0 0 1px;
}

#update-notice button:hover {
  color: var(--on-screen);
}

body.has-update-notice {
  padding-bottom: 72px;
}

/* ===================================================================== */
/* App cleanup: dark login gate, non-collapsable Material, obvious        */
/* "add a logline" fold-out, previous-reads + example-read cards.         */
/* ===================================================================== */

/* Login — a clean dark threshold, not a paper box floating on dark. */
.login-view .home-link {
  display: inline-block;
  font-family: var(--brand);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  margin: 0 0 30px;
  text-decoration: none;
  text-transform: lowercase;
}
.login-view .login-panel {
  background: transparent;
  border: 0;
  box-shadow: none;
  margin: 24px auto 0;
  padding: 0;
  width: min(400px, 100%);
}
/* Login keeps to a few text styles: title, one body line (copy + note share it),
   the input, and the button. */
.login-view .login-copy,
.login-view .privacy-note {
  font-family: var(--serif);
  font-size: 0.96rem;
  line-height: 1.55;
  margin: 0 auto;
  max-width: 380px;
}
.login-view .login-copy { margin-bottom: 26px; }
.login-view .privacy-note { margin-top: 22px; }
.login-view .login-panel input {
  background: rgba(240, 237, 226, 0.05);
  border: 1px solid rgba(240, 237, 226, 0.24);
  color: var(--on-screen);
}
.login-view .login-panel input::placeholder { color: var(--screen-dim); }
.login-view .login-panel input:focus {
  border-color: var(--gold-soft);
  box-shadow: 0 0 0 1px var(--gold-soft);
}
.login-view .password-row button {
  background: var(--on-screen);
  border-color: var(--on-screen);
  color: var(--screen);
}
.login-view .password-row button:hover {
  background: transparent;
  color: var(--on-screen);
}

/* Material — a plain, always-visible section (no summary/collapse). */
.intake-section { margin: 0 0 28px; }
.intake-head {
  align-items: baseline;
  border-bottom: 2px solid var(--border-strong);
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
  margin: 0 0 18px;
  padding-bottom: 10px;
}
.intake-head h2 {
  font-size: var(--fs-h2);
  letter-spacing: -0.01em;
  margin: 0;
}
.intake-status { color: var(--muted); font-size: 0.92rem; margin: 0; }
.intake-card { border: 2px solid var(--border-strong); }

/* "Add a logline, comps, or genre" — an unmistakable fold-out, not a faint line. */
.intent-details {
  border: 1px dashed var(--gold);
  margin: 22px 0 4px;
}
.intent-details > summary {
  align-items: center;
  background: rgba(135, 105, 49, 0.06);
  color: var(--ink);
  display: flex;
  font-size: 0.82rem;
  gap: 10px;
  letter-spacing: 0.04em;
  list-style: none;
  padding: 14px 16px;
}
.intent-details > summary::-webkit-details-marker { display: none; }
.intent-details > summary::before {
  color: var(--gold);
  content: "+";
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 0.8;
}
.intent-details[open] > summary::before { content: "\2013"; }
.intent-details[open] > summary { border-bottom: 1px solid var(--border); }
.intent-details > summary:hover { background: rgba(135, 105, 49, 0.11); }
.intent-details > .field-group,
.intent-details > .field-row,
.intent-details > .intent-hint { margin-left: 16px; margin-right: 16px; }
.intent-details > .field-group { margin-top: 16px; }
.intent-details > .intent-hint { margin-bottom: 16px; }

/* Previous reads — its own section below Material, not a collapsable. */
.draft-history { margin: 0 0 28px; }

/* Example reads sit in the projects list, marked apart from the writer's own. */
.example-card { border-style: dashed; }
.example-card .eyebrow { color: var(--gold); }

/* Gray placeholder text truncates cleanly instead of clipping mid-word. */
input { text-overflow: ellipsis; }

/* ===================================================================== */
/* The read: left TOC, Download PDF, clearer expanders, print watermark.  */
/* ===================================================================== */

/* The read is its own page: a header (back + download), full-width read column. */
.read-view {
  margin: 0 auto;
  max-width: 1120px;
  min-height: 100vh;
  padding: 22px 24px 80px;
}
.read-header {
  align-items: center;
  background: var(--bg);
  display: flex;
  gap: 16px;
  justify-content: space-between;
  margin: 0 0 6px;
  padding: 8px 0;
  position: sticky;
  top: 0;
  z-index: 10;
}
#download-pdf { font-size: 0.76rem; }
#back-to-material { font-size: 0.82rem; }

/* TOC lives in the page's LEFT MARGIN — it never narrows the read column. Shown
   only when the margin is wide enough to hold it (the text always fills 1120). */
.report-toc { display: none; }
@media (min-width: 1500px) {
  .report-toc {
    display: block;
    left: calc((100vw - 1120px) / 2 - 172px);
    position: fixed;
    top: 104px;
    width: 156px;
    z-index: 5;
  }
  .toc-title {
    color: var(--faint);
    font-family: var(--brand);
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    margin: 0 0 12px;
    text-transform: uppercase;
  }
  .toc-list { list-style: none; margin: 0; padding: 0; }
  .toc-list li { margin: 0; }
  .toc-list a {
    border-left: 2px solid var(--border);
    color: var(--muted);
    display: block;
    font-size: 0.84rem;
    line-height: 1.3;
    padding: 5px 0 5px 12px;
    text-decoration: none;
    transition: color 0.15s ease, border-color 0.15s ease;
  }
  .toc-list a:hover { border-left-color: var(--gold); color: var(--ink); }
}

/* ---------- Stage ledger strip (the persistent phase nav) ----------
   A print-brutalist pipeline, NOT pills: a single ink rule carrying mono
   number blocks + uppercase labels + hard SQUARE verdict ticks. Sticky under
   the read header; the Verdict sits at the far right behind a heavier gap. */
.stage-ledger {
  background: var(--bg);
  border-bottom: 2px solid var(--border-strong);
  margin: 0 0 28px;
  /* As a grid child of .report, min-width:auto refuses to shrink and the whole
     page scrolls sideways on mobile; 0 lets the rail be the scroller instead. */
  min-width: 0;
  position: sticky;
  top: 44px;
  z-index: 9;
}
.ledger-rail {
  display: flex;
  align-items: stretch;
  gap: 0;
  overflow-x: auto;
  scrollbar-width: none;
}
.ledger-rail::-webkit-scrollbar { display: none; }
.ledger-gap {
  flex: 1 1 auto;
  min-width: 16px;
  align-self: stretch;
}
.ledger-entry {
  background: transparent;
  border: 0;
  border-radius: 0;
  cursor: pointer;
  display: grid;
  grid-template-columns: auto auto 1fr;
  grid-template-rows: auto auto;
  column-gap: 8px;
  row-gap: 2px;
  align-items: center;
  padding: 12px 18px 11px 12px;
  text-align: left;
  position: relative;
  flex: 0 0 auto;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  scroll-snap-align: start;
}
.ledger-entry.disabled { cursor: default; }
.ledger-num {
  grid-column: 1;
  grid-row: 1 / span 2;
  font-family: var(--brand);
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--faint);
  border: 1px solid var(--border);
  padding: 2px 5px;
  line-height: 1;
  align-self: center;
}
.ledger-tick {
  grid-column: 2;
  grid-row: 1 / span 2;
  justify-self: start;
  align-self: center;
  width: 8px;
  height: 8px;
  margin-right: 2px;
}
.ledger-label {
  grid-column: 3;
  grid-row: 1;
  font-family: var(--brand);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
}
.ledger-sub {
  grid-column: 3;
  grid-row: 2;
  font-family: var(--brand);
  font-size: 0.64rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--faint);
  white-space: nowrap;
}
.ledger-tick.waiting { background: transparent; border: 1px solid var(--faint); }
.ledger-tick.reading {
  background: var(--gold);
  animation: chair-reading 1.4s ease-in-out infinite;
}
.ledger-tick.advance { background: var(--green); }
.ledger-tick.advance-with-conditions { background: var(--yellow); }
.ledger-tick.hold { background: var(--red); }
.ledger-tick.locked {
  background: transparent;
  width: auto; height: auto;
  font-family: var(--brand);
  font-weight: 700;
  color: var(--faint);
  line-height: 1;
}
.ledger-tick.verdict-locked {
  background: transparent;
  border: 2px dashed var(--faint);
  width: 9px; height: 9px;
}
/* A ready entry is ink; the active one is struck (ink-filled num + gold rule). */
.ledger-entry:not(.disabled):hover { background: var(--surface); }
.ledger-entry:not(.disabled) .ledger-label { color: var(--ink); }
.ledger-entry.active { border-bottom-color: var(--gold); }
.ledger-entry.active .ledger-num {
  background: var(--ink);
  color: var(--surface);
  border-color: var(--ink);
}
.ledger-entry.active .ledger-label { color: var(--ink); font-weight: 700; }
.ledger-entry.disabled .ledger-label { color: var(--faint); }
/* The Verdict destination is the payoff, not a peer — heavier left edge. */
.ledger-verdict {
  border-left: 2px solid var(--border-strong);
  padding-left: 18px;
}

/* Inline "a room is reading…" state — replaces the old full-screen loading
   overlay so the read shell stays visible while a room reads. */
.stage-reading {
  border: 2px solid var(--border-strong);
  background: var(--surface);
  padding: 16px 18px;
  margin: 0 0 28px;
}
.stage-reading-line {
  align-items: center;
  display: flex;
  font-family: var(--serif);
  font-size: 1.02rem;
  gap: 10px;
  margin: 0;
}
.stage-reading-dot {
  background: var(--gold);
  flex: 0 0 auto;
  height: 9px;
  width: 9px;
  animation: chair-reading 1.4s ease-in-out infinite;
}
.stage-reading-meta {
  align-items: center;
  color: var(--muted);
  display: flex;
  font-family: var(--brand);
  font-size: 0.78rem;
  gap: 16px;
  letter-spacing: 0.06em;
  margin: 10px 0 0;
}
.stage-reading-cancel { font-size: 0.74rem; }

/* The mobile sequence caption is hidden on desktop (the strip carries the
   full label + number) and shown under the scroller on narrow screens. */
.ledger-caption { display: none; }

/* Mobile: the strip becomes a horizontal scroller with a sticky sequence
   caption, and an edge fade signalling more rooms to the right. */
@media (max-width: 720px) {
  .stage-ledger {
    top: 40px;
    -webkit-mask-image: linear-gradient(90deg, #000 88%, transparent 100%);
            mask-image: linear-gradient(90deg, #000 88%, transparent 100%);
  }
  .ledger-rail { scroll-snap-type: x proximity; }
  .ledger-gap { display: none; }
  .ledger-entry { padding: 11px 14px 10px 10px; }
  /* Keep the per-entry status sub visible on mobile so a disposition tick — esp.
     the weakest-contrast amber — always carries its CONDITIONS/HOLD label; status
     must never ride on color alone. */
  .ledger-caption {
    display: block;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    color: var(--muted);
    font-family: var(--brand);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    margin: 0 0 22px;
    padding: 9px 4px;
    position: sticky;
    text-transform: uppercase;
    top: 86px;
    z-index: 8;
  }
}

/* Let the section title be the header — drop the eyebrow bars on the read. */
#report-body .section-heading .eyebrow { display: none; }

/* The flow-strip stepper doesn't fit now the read is its own page. */
.flow-strip { display: none; }

/* Only the copy-pass groups get the +/- toggle — nothing else on the read. */
.proofread-group > summary {
  align-items: baseline;
  cursor: pointer;
  display: flex;
  gap: 10px;
  list-style: none;
}
.proofread-group > summary::-webkit-details-marker { display: none; }
.proofread-group > summary::before {
  color: var(--gold);
  content: "+";
  flex: 0 0 auto;
  font-family: var(--brand);
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.2;
}
.proofread-group[open] > summary::before { content: "\2013"; }

/* Collapsed phase cards get a chevron so it's clear they open. */
.gate-card > summary { position: relative; }
.gate-card > summary::after {
  color: var(--faint);
  content: "\25BE";
  margin-left: auto;
  transition: transform 0.15s ease;
}
.gate-card[open] > summary::after { transform: rotate(180deg); }

/* PDF: a The Read Before watermark, every section expanded, the chrome gone. */
.print-watermark { display: none; }

@media print {
  .topbar, .flow-strip, #report-toc, .read-header, .report-actions, .home-link,
  .mode-chip, .intake-section, .draft-history, .loading-panel, .error-panel,
  .stage-ledger, .ledger-caption, .stage-reading, .gate-advance, .read-close,
  #chrome, .update-bar, .has-update-notice { display: none !important; }
  html, body { background: #fff !important; color: #000 !important; }
  #app, .workbench, #report, .report-body { display: block !important; }
  /* The tabbed read flattens to ONE linear coverage document for print/PDF:
     every stage panel and every phase card expands, regardless of the active
     tab, so the Download-PDF document is the whole read in order. (read-close
     holds only interactive CTAs and stays hidden, above.) */
  #report-body[data-tabbed] > section:not(.read-close):not(.hidden),
  #report-body[data-tabbed] #gate-report .gate-card { display: block !important; }
  /* Expand every collapsed section so the whole read prints. */
  details > *:not(summary) { display: block !important; }
  details > summary::before,
  .gate-card > summary::after { content: "" !important; }
  .gate-card, .diagnosis-card, .evidence-item, .sample-card,
  .comparison-item, .proofread-row { break-inside: avoid; }
  .print-watermark {
    color: rgba(0, 0, 0, 0.06);
    display: block;
    font-family: var(--brand);
    font-size: 4.6rem;
    font-weight: 700;
    left: 50%;
    letter-spacing: 0.12em;
    position: fixed;
    text-transform: uppercase;
    top: 45%;
    transform: translate(-50%, -50%) rotate(-30deg);
    white-space: nowrap;
    z-index: 9999;
  }
}
