/* =============================================================================
   SiteCalc design system — "DATUM" (2026-07-06)

   The identity is drawn from the instruments of land itself: the survey mark,
   the cadastral plan, and the Torrens register. Five colour tokens, one
   reserved: registry green (panels, primary actions, the ledger), survey
   white (the ground — documents live here), grid tint (hairlines, grid
   paper), stone (captions, metadata), and cadastral red.

   THE RED RULE — on a survey plan, existing boundaries are drawn in black;
   NEW WORK IS DRAWN IN RED. Red belongs exclusively to what could be built:
   proposed envelopes, recommended yield, the answer itself. Never buttons,
   never chrome, never decoration. When something on screen is red, it is a
   proposal. (Errors/danger use --danger, a darker functional rust.)

   Three type instruments: Archivo (display — wide-tracked caps, map labels),
   Public Sans (body — commissioned for government digital services),
   Spline Sans Mono (data — bearings, areas, refs, money; tabular always).

   Drawing conventions bind the interface: square corners (no border-radius),
   no gradients, no drop shadows — depth is stepped in green; 1px hairlines
   in grid tint; dimension ticks; one north point per plan; numbered sheets.
   In SITE FIGURES the grid + contours stay near-transparent — the parcel
   linework is the drawing; the ground barely murmurs.

   Architecture is unchanged ("a change of instrument, not of architecture"):
   HOME is a two-zone workspace — intake panel (registry green) beside the
   assessment register (paper ledger); a SESSION is a document workspace —
   green chrome around a survey-white sheet; the report is a typed drawing
   set: title block → verdict → KPI strip → numbered collapsible sections.
   ========================================================================== */

/* self-hosted variable fonts (no third-party requests) */
@font-face {
  font-family: "Archivo";
  src: url("/static/fonts/archivo-var.woff2") format("woff2");
  font-weight: 500 800; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Public Sans";
  src: url("/static/fonts/public-sans-var.woff2") format("woff2");
  font-weight: 400 600; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Public Sans";
  src: url("/static/fonts/public-sans-italic.woff2") format("woff2");
  font-weight: 400; font-style: italic; font-display: swap;
}
@font-face {
  font-family: "Spline Sans Mono";
  src: url("/static/fonts/spline-sans-mono-var.woff2") format("woff2");
  font-weight: 400 500; font-style: normal; font-display: swap;
}

:root {
  /* --- the five tokens --- */
  --paper:   #F6F8F5;   /* survey white — the ground; documents live here */
  --paper-2: #EDF1EB;   /* stepped document surface */
  --ink:     #13291F;   /* document ink — text, heavy rules, parcels */
  --ink-2:   #3E5348;   /* secondary text */
  --stone:   #66786D;   /* captions, metadata — a grey biased to the green */
  --line:    #CAD6CB;   /* hairlines */
  --grid:    #DFE8DE;   /* grid paper */

  --panel:   #0E3628;   /* registry green — chrome, panels, primary actions */
  --panel-2: #0A2A1F;   /* deeper green — the drafting table behind sheets */
  --on-panel:     #EFF5EF;
  --on-panel-dim: #9DB6A7;
  --panel-line:   rgba(239, 245, 239, 0.16);

  --red:          #C03B21;                    /* cadastral red — PROPOSALS ONLY */
  --red-soft:     rgba(192, 59, 33, 0.07);
  --red-on-panel: #E2593B;                    /* red lifted for green grounds */

  /* --- semantic aliases --- */
  --bg:            var(--paper);
  --surface:       var(--paper);
  --surface-2:     var(--paper-2);
  --border:        var(--line);
  --border-strong: #B2C2B4;
  --text:          var(--ink);
  --text-2:        var(--ink-2);
  --text-muted:    var(--stone);
  --rule:          var(--line);
  --rule-strong:   #B2C2B4;

  --primary:       var(--panel);
  --primary-hover: #154434;
  --on-primary:    var(--on-panel);
  --ring:          rgba(14, 54, 40, 0.30);

  --success:      #2F5D46;  --success-soft: #E3EDE5;
  --warning:      #7A5A1E;  --warning-soft: #F1EBDA;
  --danger:       #7A2E1D;  --danger-soft:  #F2E4DF;  /* functional, NOT cadastral red */

  /* --- type --- */
  --font-display: "Archivo", "Helvetica Neue", Arial, sans-serif;
  --font-sans:    "Public Sans", system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono:    "Spline Sans Mono", ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;

  /* --- geometry: a drawing has no border-radius; neither does the interface --- */
  --r-sm: 0;
  --r:    0;
  --r-lg: 0;
  --r-pill: 0;

  --topbar-h: 60px;
  --maxw-home: 1180px;
  --sheet-w: 1020px;    /* the paper document */
  --sheet-pad-x: 3rem;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.55;
  color: var(--text);
  background: var(--panel-2);   /* the whole app sits on the drafting table */
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
h1, h2, h3 {
  font-family: var(--font-display); font-weight: 700;
  letter-spacing: 0.02em; color: var(--ink);
}
a { color: var(--primary); }
.muted { color: var(--text-muted); }
.small { font-size: 0.85rem; }
.hidden { display: none !important; }
.spacer { flex: 1; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* --- the wordmark: SITEC△LC — a trig point where the A should be ----------- */
.wm { font-family: var(--font-display); font-weight: 800; letter-spacing: 0.05em; white-space: nowrap; }
.wm .trig {
  display: inline-block; height: 0.68em; width: auto; margin: 0 0.045em;
  vertical-align: baseline; transform: translateY(-0.005em);
}
.wm .trig .t-tri { fill: none; stroke: currentColor; stroke-width: 10; stroke-linejoin: miter; }
.wm .trig .t-dot { fill: var(--red); }
/* on registry green the datum dot lifts */
.intake-panel .wm .trig .t-dot, .rail .wm .trig .t-dot { fill: var(--red-on-panel); }

/* --- buttons ------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  padding: 0.62rem 1.1rem;
  background: var(--primary);
  color: var(--on-primary);
  border: 1px solid var(--primary);
  border-radius: 0;
  font: inherit; font-weight: 600; font-size: 0.9rem;
  text-decoration: none; cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.btn:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn:disabled { opacity: 0.45; cursor: default; }
.btn.block { width: 100%; }
.btn.ghost {
  background: transparent; color: var(--text-2); border-color: var(--border-strong);
}
.btn.ghost:hover { background: var(--surface-2); color: var(--text); border-color: var(--border-strong); }

/* --- focus visibility ---------------------------------------------------- */
:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--ring); }
/* inputs inside a framed bar show focus on the frame, not themselves */
.address-bar input:focus-visible { box-shadow: none; }

/* =============================================================================
   Shared chrome atoms (avatar, usage pill) — live on registry green
   ========================================================================== */
.usage-pill {
  font-family: var(--font-mono); font-size: 0.62rem; letter-spacing: 0.08em;
  color: var(--on-panel-dim); white-space: nowrap; font-variant-numeric: tabular-nums;
}
.usage-pill:empty { display: none; }
.avatar {
  width: 26px; height: 26px; border-radius: 0; object-fit: cover; flex: none;
  border: 1px solid var(--panel-line); background: var(--panel-2);
}
.avatar.placeholder {
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-size: 0.72rem; font-weight: 700;
  color: var(--on-panel-dim);
}

/* =============================================================================
   Centered pages (login / terms / invite claim) — a card of survey white
   on the registry
   ========================================================================== */
.centered {
  min-height: 100vh; display: grid; place-items: center; padding: 2rem 1.25rem;
}
.auth-card {
  width: 100%; max-width: 420px;
  background: var(--paper);
  border: 1px solid var(--panel-2);
  padding: 2.6rem 2.4rem;
  text-align: center;
}
.auth-mark {
  font-family: var(--font-display); font-size: 1.9rem; font-weight: 800;
  letter-spacing: 0.05em; color: var(--ink); margin: 0;
}
.auth-eyebrow {
  font-family: var(--font-mono); font-size: 0.62rem; letter-spacing: 0.22em;
  text-transform: uppercase; color: var(--stone); font-weight: 500; margin-bottom: 0.55rem;
}
.auth-tagline { color: var(--text-2); margin: 0.7rem 0 2rem; line-height: 1.55; }
.auth-fine { color: var(--text-muted); font-size: 0.8rem; margin-top: 1.4rem; }
.auth-divider {
  height: 1px; background: var(--line); margin: 1.8rem 0; border: none;
}

/* Google sign-in button (bordered, real Google mark) */
.google-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.7rem;
  width: 100%;
  padding: 0.72rem 1rem;
  background: var(--paper); color: var(--ink);
  border: 1px solid var(--border-strong);
  font-weight: 600; font-size: 0.92rem; text-decoration: none;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.google-btn:hover { background: var(--paper-2); border-color: var(--stone); }
.google-btn svg { width: 18px; height: 18px; flex: none; }

/* Terms acceptance card */
.terms-icon {
  width: 46px; height: 46px; margin: 0 auto 1rem;
  display: grid; place-items: center;
  background: var(--panel); color: var(--on-panel);
}
.terms-link {
  display: inline-flex; align-items: center; gap: 0.5rem;
  margin: 1.4rem 0 0.4rem;
  padding: 0.7rem 1rem;
  width: 100%;
  background: var(--paper-2); border: 1px solid var(--line);
  color: var(--panel); font-weight: 600; font-size: 0.9rem; text-decoration: none;
  justify-content: center;
}
.terms-link:hover { border-color: var(--stone); }
.consent {
  display: flex; align-items: flex-start; gap: 0.6rem;
  text-align: left; margin: 1.4rem 0 1.6rem;
  color: var(--text-2); font-size: 0.9rem; line-height: 1.5; cursor: pointer;
}
.consent input { margin-top: 0.18rem; width: 16px; height: 16px; accent-color: var(--primary); flex: none; }

/* =============================================================================
   HOME — a two-zone workspace: the intake panel (registry green) and the
   assessment register (paper ledger). The home is the practice's file room.
   ========================================================================== */
.view { min-height: 100vh; }
.home-shell { display: flex; min-height: 100vh; }

/* --- intake panel ----------------------------------------------------------- */
.intake-panel {
  position: sticky; top: 0; align-self: flex-start;
  width: clamp(360px, 36vw, 480px); flex: none; height: 100vh; overflow-y: auto;
  background: var(--panel); border-right: 1px solid var(--panel-line);
  padding: 2rem 2.4rem 1.6rem;
  display: flex; flex-direction: column;
  color: var(--on-panel);
}
.intake-mid { margin: auto 0; padding: 3rem 0; }
.ask {
  margin: 0; font-family: var(--font-display); font-weight: 600;
  font-size: clamp(1.5rem, 2.2vw, 1.95rem); line-height: 1.2;
  letter-spacing: 0.015em; color: var(--on-panel); text-wrap: balance; max-width: 16ch;
}
.ask-sub {
  margin: 0.9rem 0 0; color: var(--on-panel-dim); font-size: 0.88rem;
  line-height: 1.6; max-width: 36ch;
}

/* --- greeting (develo users) -------------------------------------------------
   Time-of-day greeting takes the headline spot; the question leads the sub.
   Letters rise out of a blur one by one, then the rest of the panel settles. */
.ask.greet { max-width: none; }
.greet-text { text-wrap: balance; }
.gw { display: inline-block; white-space: pre; }
.gc {
  display: inline-block; opacity: 0;
  animation: greet-char 0.65s cubic-bezier(0.2, 0.7, 0.3, 1) forwards;
}
@keyframes greet-char {
  from { opacity: 0; transform: translateY(0.35em); filter: blur(6px); }
  to { opacity: 1; transform: none; filter: none; }
}
.ask-q { display: block; color: var(--on-panel); font-weight: 600; margin-bottom: 0.15rem; }
.greet-run ~ .ask-sub, .greet-run ~ .address-bar, .greet-run ~ .side-tabs {
  animation: greet-rise 0.8s cubic-bezier(0.2, 0.7, 0.3, 1) both;
}
.greet-run ~ .ask-sub { animation-delay: 0.6s; }
.greet-run ~ .address-bar { animation-delay: 0.78s; }
.greet-run ~ .side-tabs { animation-delay: 0.94s; }
@keyframes greet-rise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  .gc, .greet-run ~ .ask-sub, .greet-run ~ .address-bar, .greet-run ~ .side-tabs {
    animation: none !important; opacity: 1 !important; transform: none !important; filter: none !important;
  }
}

/* the address bar is a strip of survey white set into the green */
.address-bar {
  display: flex; align-items: stretch; gap: 0;
  margin: 1.7rem 0 0;
  background: var(--paper);
  border: none; padding: 0;
  transition: box-shadow 0.15s ease;
}
.address-bar:focus-within { box-shadow: 0 0 0 2px rgba(239, 245, 239, 0.32); }
.address-bar input {
  flex: 1; min-width: 0; border: none; background: transparent; font: inherit;
  font-size: 0.92rem; color: var(--text); padding: 0.85rem 1rem;
}
.address-bar input:focus { outline: none; }
.address-bar input::placeholder { color: var(--stone); }
.address-bar .go {
  flex: none; width: 47px; height: auto; padding: 0; border-radius: 0;
  background: var(--panel-2); border: none; border-left: 1px solid var(--panel-line);
  color: var(--on-panel);
}
.address-bar .go:hover { background: var(--panel); }
.address-bar .go svg { width: 17px; height: 17px; }

.intake-foot { display: flex; flex-direction: column; gap: 0.8rem; padding-top: 1.2rem; }
.intake-foot .src {
  font-family: var(--font-mono); font-size: 0.58rem; font-weight: 500; letter-spacing: 0.15em;
  text-transform: uppercase; color: var(--on-panel-dim);
  border-top: 1px solid var(--panel-line); padding-top: 0.9rem;
}
.me { display: flex; align-items: center; gap: 0.6rem; }
.me-email {
  font-family: var(--font-mono); font-size: 0.64rem; color: var(--on-panel-dim);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0;
}
.me .usage-pill { margin-left: auto; }
.me-out { font-size: 0.72rem; color: var(--on-panel-dim); text-decoration: none; white-space: nowrap; }
.me-out:hover { color: var(--on-panel); }

/* --- the assessment register (paper ledger) --------------------------------- */
.register-zone { flex: 1; min-width: 0; height: 100vh; overflow-y: auto; padding: 2.6rem 3rem 3rem; }
.register {
  max-width: 880px; margin: 0 auto; background: var(--paper);
  padding: 0 2.4rem 1.6rem;
}
.register-head {
  display: flex; justify-content: space-between; align-items: baseline; gap: 1rem;
  padding: 1.2rem 0 0.8rem; border-bottom: 2px solid var(--ink);
}
.register-head .eyebrow { color: var(--ink); }
.register-rows { display: flex; flex-direction: column; border-bottom: 2px solid var(--ink); }
.register-rows .reg-row:last-child { border-bottom: none; }
.reg-row {
  display: grid; grid-template-columns: 2.8rem 1fr auto 1.4rem; gap: 1.1rem;
  align-items: baseline; width: 100%; text-align: left; cursor: pointer;
  font: inherit; background: none; border: none;
  padding: 0.95rem 0.4rem 1rem 0; border-bottom: 1px solid var(--line);
  transition: background 0.12s ease;
}
.reg-row:hover { background: var(--paper-2); box-shadow: inset 3px 0 0 var(--ink); padding-left: 0.7rem; }
.reg-row .no {
  font-family: var(--font-mono); font-size: 0.7rem; font-weight: 500;
  color: var(--stone); font-variant-numeric: tabular-nums;
}
.reg-row .addr {
  font-weight: 600; font-size: 0.98rem;
  color: var(--ink); line-height: 1.3; min-width: 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.reg-row .when {
  font-family: var(--font-mono); font-size: 0.64rem; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--stone); white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.reg-row .go { color: var(--line); transition: color 0.12s ease; font-size: 0.9rem; }
.reg-row:hover .go { color: var(--ink); }

/* user-history variant (admin): an extra column naming who ran it */
.reg-row.hist { grid-template-columns: 2.8rem minmax(0, 1fr) auto auto 1.4rem; }
.reg-row .user {
  font-family: var(--font-mono); font-size: 0.68rem; color: var(--ink-2);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 16rem;
}

.reg-empty {
  padding: 3rem 0 2.6rem; text-align: center; color: var(--stone); font-size: 0.9rem;
}
.reg-empty .big {
  display: block; font-family: var(--font-display); font-size: 1.05rem; font-weight: 700;
  letter-spacing: 0.05em; text-transform: uppercase;
  color: var(--ink-2); margin-bottom: 0.4rem;
}

/* --- register side-tabs (admin: Assessments / Invites) -----------------------
   Text tabs in the drawing-set voice; the active tab carries the datum accent. */
.side-tabs { display: flex; gap: 1.3rem; margin-top: 1.5rem; }
.side-tab {
  font-family: var(--font-mono); font-size: 0.62rem; font-weight: 500;
  letter-spacing: 0.18em; text-transform: uppercase; cursor: pointer;
  color: var(--on-panel-dim); background: none;
  border: none; border-bottom: 2px solid transparent; border-radius: 0;
  padding: 0 0 0.4rem;
  transition: color 0.12s ease, border-color 0.12s ease;
}
.side-tab:hover { color: var(--on-panel); }
.side-tab.on { color: var(--on-panel); border-bottom-color: var(--red-on-panel); }

/* invited-guest allowance note (under the address bar, on green) */
.allowance-note { margin: 0.9rem 0 0; font-size: 0.84rem; line-height: 1.5; color: var(--on-panel); }

/* --- the invite register (admin, paper ledger) ------------------------------- */
.reg-actions { display: inline-flex; align-items: center; gap: 1rem; }
.new-invite {
  font: inherit; font-size: 0.78rem; font-weight: 600; cursor: pointer; white-space: nowrap;
  background: var(--panel); color: var(--on-panel); border: 1px solid var(--panel);
  border-radius: 0; padding: 0.4rem 0.85rem;
}
.new-invite:hover { background: var(--primary-hover); }
.new-invite:disabled { opacity: 0.5; cursor: default; }
.inv-row {
  display: grid; grid-template-columns: 2.8rem minmax(0, 1fr) auto auto auto;
  gap: 1.1rem; align-items: center;
  padding: 0.85rem 0.4rem 0.9rem 0; border-bottom: 1px solid var(--line);
}
.register-rows .inv-row:last-child { border-bottom: none; }
.inv-row .no {
  font-family: var(--font-mono); font-size: 0.7rem; font-weight: 500;
  color: var(--stone); font-variant-numeric: tabular-nums;
}
.inv-row .who { min-width: 0; }
.inv-row .email {
  display: block; font-weight: 600; font-size: 0.92rem; color: var(--ink);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.inv-row .email.unclaimed { color: var(--stone); font-weight: 400; font-style: italic; }
.inv-row .date {
  display: block; margin-top: 0.15rem;
  font-family: var(--font-mono); font-size: 0.62rem; letter-spacing: 0.04em;
  color: var(--stone); font-variant-numeric: tabular-nums;
}
.inv-row .uses {
  font-family: var(--font-mono); font-size: 0.72rem; color: var(--ink-2);
  white-space: nowrap; font-variant-numeric: tabular-nums;
}
.inv-acts { display: flex; gap: 0.4rem; }
.mini-btn {
  font: inherit; font-size: 0.72rem; font-weight: 600; cursor: pointer; white-space: nowrap;
  color: var(--ink-2); background: var(--paper);
  border: 1px solid var(--border-strong); border-radius: 0;
  padding: 0.3rem 0.62rem;
  transition: color 0.12s ease, border-color 0.12s ease;
}
.mini-btn:hover { color: var(--ink); border-color: var(--ink); }
.mini-btn.danger:hover { color: var(--danger); border-color: var(--danger); }
.mini-btn:disabled { opacity: 0.5; cursor: default; }

/* --- invite claim page (guest sign-up card) ---------------------------------- */
.claim-form { display: flex; flex-direction: column; gap: 0.8rem; margin-top: 0.4rem; }
.claim-form input {
  font: inherit; font-size: 0.95rem; padding: 0.7rem 0.9rem;
  color: var(--text); background: var(--paper);
  border: 1px solid var(--border-strong); border-radius: 0;
}
.claim-form input:focus { outline: none; border-color: var(--panel); box-shadow: 0 0 0 3px var(--ring); }
.claim-err { color: var(--danger); font-size: 0.84rem; margin: 0.9rem 0 0; }

/* =============================================================================
   Workspace — SESSION view: document workspace (green chrome + paper sheet)
   ========================================================================== */
.session { display: flex; height: 100vh; min-height: 0; background: var(--panel-2); }

/* --- index rail ------------------------------------------------------------ */
.rail {
  width: 236px; flex: none; height: 100%; overflow-y: auto;
  background: var(--panel); border-right: 1px solid var(--panel-line);
  padding: 1.4rem 1.25rem 1.2rem; display: flex; flex-direction: column; gap: 1.3rem;
  color: var(--on-panel);
}
.rail-wordmark {
  font-size: 1.02rem; color: var(--on-panel); text-align: left;
  background: none; border: none; padding: 0; cursor: pointer;
  font-family: var(--font-sans);
}
.rail-wordmark .wm { font-size: 1.02rem; }
.intake-panel .rail-wordmark .wm { font-size: 1.22rem; }
.rail-wordmark .tag {
  display: block; font-family: var(--font-mono); font-size: 0.56rem; font-weight: 500;
  letter-spacing: 0.24em; color: var(--on-panel-dim); margin-top: 0.3rem; text-transform: uppercase;
}
/* small BETA mark beside the wordmark */
.beta {
  display: inline-block; vertical-align: 0.42em; margin-left: 0.5rem;
  font-family: var(--font-mono); font-size: 0.5rem; font-weight: 500;
  letter-spacing: 0.16em; text-transform: uppercase; line-height: 1;
  padding: 0.18rem 0.34rem; border-radius: 0;
  color: var(--on-panel-dim); border: 1px solid var(--panel-line);
}
.auth-mark .beta {
  font-size: 0.6rem; vertical-align: 0.85em;
  color: var(--stone); border-color: var(--line);
}
.back-btn {
  display: inline-flex; align-items: center; gap: 0.45rem; align-self: flex-start;
  background: none; border: 1px solid var(--panel-line); border-radius: 0;
  cursor: pointer; padding: 0.4rem 0.75rem;
  color: var(--on-panel-dim); font: inherit; font-size: 0.78rem; font-weight: 600;
}
.back-btn:hover { color: var(--on-panel); border-color: var(--on-panel-dim); }

.rail-h {
  font-family: var(--font-mono); font-size: 0.58rem; font-weight: 500; letter-spacing: 0.2em;
  text-transform: uppercase; color: var(--on-panel-dim); margin-bottom: 0.55rem;
}
.index { display: flex; flex-direction: column; }
.index a {
  display: flex; gap: 0.65rem; align-items: baseline; text-decoration: none;
  padding: 0.32rem 0.5rem 0.32rem 0.65rem; border-left: 2px solid transparent;
  color: var(--on-panel-dim); font-size: 0.82rem;
}
.index a .n { font-family: var(--font-mono); font-size: 0.66rem; color: var(--on-panel-dim); width: 1.3rem; flex: none; }
.index a:hover { color: var(--on-panel); }
.index a.on { border-left-color: var(--red-on-panel); color: var(--on-panel); }
.index a.on .n { color: var(--on-panel); }

.rail-meta {
  border-top: 1px solid var(--panel-line); padding-top: 1rem; margin-top: auto;
  display: flex; flex-direction: column; gap: 0.5rem;
}
.rail-kv { display: flex; justify-content: space-between; gap: 0.6rem; font-size: 0.72rem; }
.rail-kv .k { font-family: var(--font-mono); font-size: 0.6rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--on-panel-dim); flex: none; }
.rail-kv .v { color: var(--on-panel); font-variant-numeric: tabular-nums; text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rail-kv .v.ok::before {
  content: ""; display: inline-block; width: 6px; height: 6px;
  background: #7FB08A; margin-right: 0.35rem; vertical-align: 1px;
}
.rail-kv .v.run::before {
  content: ""; display: inline-block; width: 6px; height: 6px;
  background: var(--on-panel-dim); margin-right: 0.35rem; vertical-align: 1px;
}

.rail-actions { display: flex; flex-direction: column; gap: 0.5rem; }
.rbtn {
  font: inherit; font-size: 0.8rem; font-weight: 600; padding: 0.5rem 0.8rem;
  border-radius: 0; cursor: pointer; text-align: center;
}
.rbtn.line { background: transparent; color: var(--on-panel-dim); border: 1px solid var(--panel-line); }
.rbtn.line:hover { color: var(--on-panel); border-color: var(--on-panel-dim); }
.rail-user {
  font-family: var(--font-mono); font-size: 0.6rem; color: var(--on-panel-dim);
  letter-spacing: 0.04em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* --- canvas + paper sheet ---------------------------------------------------- */
.canvas { flex: 1; min-width: 0; overflow-y: auto; display: flex; flex-direction: column; }
.sheet {
  width: 100%; max-width: var(--sheet-w); margin: 2.2rem auto 2.6rem; flex: none;
  background: var(--paper);
  padding: 0 0 1.6rem;
}
.transcript-inner { display: flex; flex-direction: column; }

/* generic padded block for pre-report content on the sheet */
.pblock { padding: 0.8rem var(--sheet-pad-x); }

/* user turn — a query annotation, not a bubble */
.annot { padding: 1.1rem var(--sheet-pad-x) 0.4rem; }
.annot .k {
  font-family: var(--font-mono); font-size: 0.6rem; font-weight: 500;
  letter-spacing: 0.2em; text-transform: uppercase; color: var(--stone);
  margin-bottom: 0.25rem;
}
.annot .t { color: var(--ink); font-weight: 600; font-size: 0.95rem; white-space: pre-wrap; max-width: 70ch; }

/* assistant turn — document prose */
.prose { color: var(--ink-2); max-width: 72ch; line-height: 1.62; overflow-wrap: anywhere; }
.prose a { color: var(--panel); text-decoration: underline; text-underline-offset: 2px; }
.prose p { margin: 0 0 0.7rem; }
.prose > :last-child { margin-bottom: 0; }
.prose h3 { font-size: 1rem; margin: 0.2rem 0 0.55rem; text-transform: uppercase; letter-spacing: 0.05em; }
.prose h4 { font-size: 0.9rem; margin: 0.9rem 0 0.4rem; text-transform: uppercase; letter-spacing: 0.05em; }
.prose h5 { font-size: 0.82rem; margin: 0.8rem 0 0.3rem; color: var(--ink-2); text-transform: uppercase; letter-spacing: 0.05em; }
.prose ul, .prose ol { margin: 0.4rem 0 0.75rem; padding-left: 1.35rem; }
.prose li { margin: 0.28rem 0; }
.prose li::marker { color: var(--stone); }
.prose strong { font-weight: 600; color: var(--ink); }
.prose code {
  font-family: var(--font-mono); font-size: 0.85em;
  background: var(--paper-2); border: 1px solid var(--line);
  padding: 0.08rem 0.34rem;
}
.md-table { width: 100%; border-collapse: collapse; margin: 0.6rem 0; font-size: 0.88rem; }
.md-table th, .md-table td {
  text-align: left; padding: 0.5rem 0.7rem; border-bottom: 1px solid var(--line); vertical-align: top;
  overflow-wrap: normal;   /* don't inherit .prose's anywhere — no mid-word breaks in cells */
}
.md-table td:first-child { font-weight: 600; color: var(--ink); }
.md-table th {
  font-family: var(--font-mono); font-size: 0.6rem; font-weight: 500; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--stone); border-bottom: 1px solid var(--border-strong);
  white-space: nowrap;
}
.md-table tbody tr:last-child td { border-bottom: none; }

.thinking {
  padding: 0.5rem var(--sheet-pad-x);
  color: var(--text-muted); font-size: 0.85rem; font-style: italic;
}
.thinking::after { content: ""; animation: dots 1.2s steps(4, end) infinite; }
@keyframes dots { 0%{content:""} 25%{content:"."} 50%{content:".."} 75%{content:"..."} }

/* tool activity — ONE ephemeral progress line; removed when the turn settles */
.runline {
  display: flex; align-items: center; gap: 0.6rem;
  padding: 0.75rem var(--sheet-pad-x);
  font-family: var(--font-mono); font-size: 0.7rem; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--stone);
}
.runline-spin {
  width: 13px; height: 13px; border-radius: 50%; flex: none;
  border: 2px solid var(--line); border-top-color: var(--panel);
  animation: report-spin 0.7s linear infinite;
}

/* file outputs — a quiet downloads row (links only, no logs) */
.downloads {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem;
  margin: 0.5rem var(--sheet-pad-x);
}
.downloads-k {
  font-family: var(--font-mono); font-size: 0.6rem; font-weight: 500;
  letter-spacing: 0.16em; text-transform: uppercase; color: var(--stone);
  margin-right: 0.3rem;
}
.download {
  font-size: 0.8rem; text-decoration: none; font-weight: 600;
  background: var(--paper); color: var(--ink);
  border: 1px solid var(--border-strong); padding: 0.4rem 0.75rem;
}
.download:hover { background: var(--paper-2); border-color: var(--ink); }

/* approval card */
.approval-card {
  margin: 0.6rem var(--sheet-pad-x);
  border: 1.5px solid var(--panel); background: var(--paper);
  padding: 1rem 1.1rem;
}
.approval-card.resolved { opacity: 0.6; }
.approval-title {
  font-family: var(--font-mono); font-size: 0.62rem; font-weight: 500;
  letter-spacing: 0.18em; text-transform: uppercase; color: var(--panel); margin-bottom: 0.55rem;
}
.approval-item { margin: 0.25rem 0; }
.approval-desc { font-size: 0.9rem; color: var(--text); }
.approval-actions { display: flex; gap: 0.5rem; margin-top: 0.8rem; }

.error-note {
  margin: 0.6rem var(--sheet-pad-x); align-self: flex-start;
  color: var(--danger); background: var(--danger-soft); border: 1px solid #DCC0B6;
  padding: 0.55rem 0.8rem; font-size: 0.86rem;
}

.brief-confirm {
  margin: 0.4rem var(--sheet-pad-x); align-self: flex-start;
  color: var(--success); background: var(--success-soft); border: 1px solid #C2D4C5;
  padding: 0.5rem 0.8rem; font-size: 0.86rem;
}

/* =============================================================================
   Candidate picker — a ledger on paper
   ========================================================================== */
.picker-card { padding: 1rem var(--sheet-pad-x) 1.3rem; }
.picker-title {
  font-family: var(--font-mono); font-size: 0.62rem; font-weight: 500;
  letter-spacing: 0.18em; text-transform: uppercase; color: var(--stone); margin-bottom: 0.7rem;
}
.picker-list { display: flex; flex-direction: column; border-top: 2px solid var(--ink); }
.picker-btn {
  text-align: left; cursor: pointer; font: inherit; font-size: 0.92rem; font-weight: 600;
  background: none; color: var(--ink);
  border: none; border-bottom: 1px solid var(--line); padding: 0.62rem 0.7rem;
  transition: background 0.12s ease;
}
.picker-btn:hover { background: var(--paper-2); }
.picker-btn.chosen { background: var(--paper-2); box-shadow: inset 3px 0 0 var(--ink); }
.picker-btn:disabled { cursor: default; opacity: 0.55; }
.picker-alt { display: flex; gap: 0.5rem; margin-top: 0.9rem; }
.picker-input {
  flex: 1; font: inherit; font-size: 0.92rem; color: var(--text);
  background: var(--paper); border: 1px solid var(--border-strong);
  padding: 0.55rem 0.7rem;
}
.picker-input:focus { outline: none; border-color: var(--panel); box-shadow: 0 0 0 3px var(--ring); }
.picker-go {
  cursor: pointer; font: inherit; font-size: 0.9rem; font-weight: 600; white-space: nowrap;
  background: var(--panel); color: var(--on-panel); border: none;
  padding: 0.55rem 0.9rem;
}
.picker-go:hover { background: var(--primary-hover); }
.picker-alt :disabled { opacity: 0.6; cursor: default; }

/* =============================================================================
   Site-plan figure (phase 1, standalone on the sheet) — drawn to convention:
   the grid is near-transparent; the parcel linework is the drawing.
   ========================================================================== */
.plan-fig { margin: 1rem var(--sheet-pad-x) 1.2rem; }
.plan-fig-cap { margin: 0 0 0.6rem; }
.plan-fig-title {
  margin: 0; font-family: var(--font-display); font-weight: 700; font-size: 1.05rem;
  line-height: 1.25; letter-spacing: 0.04em; text-transform: uppercase; color: var(--ink);
}
.plan-fig-sub { margin: 0.25rem 0 0; font-size: 0.85rem; color: var(--stone); }
.plan-frame {
  /* isolate: the negative-z contour layer must sit above THIS background,
     not escape below it into the page's stacking order */
  position: relative; overflow: hidden; isolation: isolate;
  border: 1px solid var(--line); padding: 1rem 1.1rem;
  background:
    repeating-linear-gradient(0deg, transparent 0 23px, rgba(223, 232, 222, 0.55) 23px 24px),
    repeating-linear-gradient(90deg, transparent 0 23px, rgba(223, 232, 222, 0.55) 23px 24px),
    var(--paper-2);
}
/* svg height follows the drawing's real aspect (viewBox is shrink-wrapped to
   the site); the cap keeps tall-narrow parcels from towering past the page —
   the content letterboxes horizontally when it engages */
.plan-frame svg { width: 100%; height: auto; max-height: 620px; display: block; }
/* the contour field is a full-bleed ground layer BEHIND the drawing — it
   stretches over the entire frame (padding included), never the shrink-wrap */
.plan-frame svg.plan-contours {
  position: absolute; inset: 0; z-index: -1;
  width: 100%; height: 100%; max-height: none; pointer-events: none;
}
.plan-frame-cap {
  display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; margin-top: 0.5rem;
  font-family: var(--font-mono); font-size: 0.58rem; font-weight: 500; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--stone);
}
.lot-chips { display: flex; flex-wrap: wrap; gap: 0.45rem; margin-top: 0.7rem; }
.lot-chip {
  font-family: var(--font-mono); font-size: 0.66rem; letter-spacing: 0.06em; color: var(--ink-2);
  background: var(--paper); border: 1px solid var(--line);
  padding: 0.22rem 0.65rem; font-variant-numeric: tabular-nums;
}
.lot-chip.total { border-color: var(--ink); color: var(--ink); font-weight: 500; }

/* report progress line */
.report-gen {
  display: flex; align-items: center; gap: 0.6rem;
  padding: 0.9rem var(--sheet-pad-x);
  color: var(--stone); font-family: var(--font-mono); font-size: 0.7rem;
  letter-spacing: 0.1em; text-transform: uppercase;
}
.report-gen-spin {
  width: 13px; height: 13px; border-radius: 50%;
  border: 2px solid var(--line); border-top-color: var(--panel);
  animation: report-spin 0.7s linear infinite;
}
@keyframes report-spin { to { transform: rotate(360deg); } }

/* =============================================================================
   Development brief — sentence composer
   ========================================================================== */
.intake-card { padding: 1.4rem var(--sheet-pad-x) 1.8rem; border-top: 1.5px solid var(--ink); margin-top: 0.8rem; }
.intake-card.resolved { opacity: 0.55; pointer-events: none; }
.sentence {
  font-family: var(--font-display); font-weight: 600;
  font-size: clamp(1.15rem, 2vw, 1.5rem); line-height: 1.5; letter-spacing: 0.01em;
  color: var(--ink); max-width: 34ch; margin: 0 0 1.8rem;
}
.sentence .slot {
  color: var(--ink); font-weight: 700;
  border-bottom: 2px solid var(--ink); padding-bottom: 0.05em; white-space: nowrap;
}
.sentence .slot.unset { color: var(--stone); font-weight: 600; border-bottom-style: dashed; border-bottom-color: var(--border-strong); }

.controls { display: flex; flex-direction: column; gap: 1.4rem; }
.ctl .k {
  font-family: var(--font-mono); font-size: 0.58rem; font-weight: 500; letter-spacing: 0.16em;
  text-transform: uppercase; color: var(--stone); margin-bottom: 0.5rem;
}
.tile-row { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.tile {
  font: inherit; font-size: 0.86rem; font-weight: 600; cursor: pointer;
  background: var(--paper); color: var(--ink-2);
  border: 1px solid var(--border-strong); padding: 0.5rem 0.95rem;
  transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}
.tile:hover { border-color: var(--ink); color: var(--ink); }
.tile.on { background: var(--panel); color: var(--on-panel); border-color: var(--panel); }

.numrow { display: flex; flex-wrap: wrap; gap: 1.2rem 2rem; align-items: flex-start; }
.stepper-c {
  display: inline-flex; align-items: stretch;
  border: 1px solid var(--border-strong); overflow: hidden;
}
.stepper-c .step {
  width: 34px; height: 34px; border: none; cursor: pointer;
  background: var(--paper); color: var(--ink); font-size: 1.05rem; line-height: 1;
  display: inline-flex; align-items: center; justify-content: center;
}
.stepper-c .step:hover { background: var(--paper-2); }
.step-val {
  min-width: 2.4rem; display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--font-mono); font-weight: 500; font-size: 0.95rem; color: var(--ink); font-variant-numeric: tabular-nums;
  border-left: 1px solid var(--line); border-right: 1px solid var(--line);
}
.segmented {
  display: inline-flex; width: fit-content;
  border: 1px solid var(--border-strong); overflow: hidden;
}
.seg {
  border: none; border-right: 1px solid var(--line); background: var(--paper);
  font: inherit; font-size: 0.86rem; font-weight: 600; color: var(--ink-2);
  padding: 0.45rem 0.8rem; min-width: 2.3rem; cursor: pointer;
  transition: background 0.1s ease, color 0.1s ease;
}
.seg:last-child { border-right: none; }
.seg:hover { color: var(--ink); background: var(--paper-2); }
.seg.on { background: var(--panel); color: var(--on-panel); }

.intake-err { color: var(--danger); font-size: 0.82rem; min-height: 1rem; margin: 0.8rem 0 0; }
.intake-run { margin-top: 0.4rem; display: flex; align-items: center; gap: 1.1rem; }
.runbtn {
  font: inherit; font-size: 0.95rem; font-weight: 600; cursor: pointer;
  background: var(--panel); color: var(--on-panel); border: 1px solid var(--panel);
  padding: 0.72rem 1.4rem;
}
.runbtn:hover { background: var(--primary-hover); }
.runbtn:disabled { opacity: 0.5; cursor: default; }
.intake-run .cost {
  font-family: var(--font-mono); font-size: 0.62rem; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--stone);
}

/* =============================================================================
   The report — a numbered sheet in a drawing set
   ========================================================================== */
.report { margin-top: 1.2rem; font-family: var(--font-sans); }

/* --- title block: an engineering title block, bordered like a plan --- */
.tblock { border: 1.5px solid var(--ink); margin: 1.4rem var(--sheet-pad-x) 0; }
.tblock-top {
  display: flex; justify-content: space-between; align-items: baseline; gap: 1rem;
  padding: 0.8rem 1.1rem 0.7rem; border-bottom: 1px solid var(--line);
}
.eyebrow {
  font-family: var(--font-mono); font-size: 0.62rem; font-weight: 500; letter-spacing: 0.2em;
  text-transform: uppercase; color: var(--stone);
}
.docref {
  font-family: var(--font-mono); font-size: 0.66rem; font-weight: 500;
  color: var(--stone); letter-spacing: 0.14em; text-transform: uppercase;
  font-variant-numeric: tabular-nums;
}
.tblock-title { padding: 1.1rem 1.1rem 1rem; }
.tblock-title h1 {
  margin: 0; font-family: var(--font-display); font-weight: 800;
  font-size: clamp(1.25rem, 2.4vw, 1.7rem);
  line-height: 1.18; letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--ink); text-wrap: balance;
}
.tblock-title .scheme-line { margin: 0.55rem 0 0; font-size: 0.9rem; color: var(--ink-2); }
.tblock-title .scheme-line strong { color: var(--ink); font-weight: 600; }
.tblock-meta { display: grid; grid-template-columns: repeat(4, 1fr); border-top: 1px solid var(--line); }
.tcell { padding: 0.65rem 1.1rem 0.7rem; border-right: 1px solid var(--line); min-width: 0; }
.tcell:last-child { border-right: none; }
.tcell .k {
  font-family: var(--font-mono); font-size: 0.56rem; font-weight: 500; letter-spacing: 0.16em;
  text-transform: uppercase; color: var(--stone); margin-bottom: 0.22rem;
}
.tcell .v { font-size: 0.84rem; font-weight: 600; color: var(--ink); line-height: 1.3; font-variant-numeric: tabular-nums; }

/* --- verdict spread: the answer, drawn in red, beside the plan --- */
/* cover layout follows the SITE'S SHAPE (user request 2026-07-07):
   horizontal parcels stack — verdict strip on top, figure at FULL sheet width;
   vertical/square parcels split — verdict beside a half-width figure, as the
   tall drawing fills that column anyway. renderReport adds .split by aspect. */
.cover { display: grid; grid-template-columns: 1fr; border-bottom: 1.5px solid var(--ink); margin-top: 1.6rem; border-top: 1.5px solid var(--ink); }
.verdict {
  background: var(--paper); color: var(--ink);
  padding: 1.7rem var(--sheet-pad-x) 1.6rem;
  border-bottom: 1px solid var(--line);
  display: flex; flex-direction: column;
}
.cover.split { grid-template-columns: 5fr 7fr; }
.cover.split .verdict {
  border-bottom: none; border-right: 1px solid var(--line);
  padding: 1.7rem 1.8rem 1.6rem var(--sheet-pad-x);
}
.cover.split .verdict-facts { grid-template-columns: 1fr 1fr; }
.cover.split .plan-frame { padding: 1.3rem 1.5rem 1rem; }
.verdict .lbl {
  font-family: var(--font-mono); font-size: 0.6rem; font-weight: 500; letter-spacing: 0.2em;
  text-transform: uppercase; color: var(--red);
}
.verdict-num { display: flex; align-items: baseline; gap: 0.9rem; margin: 0.9rem 0 0.3rem; }
.verdict-num .n {
  font-family: var(--font-display); font-weight: 800; font-size: clamp(3.2rem, 6vw, 4.8rem);
  line-height: 0.9; letter-spacing: 0; color: var(--red); font-variant-numeric: tabular-nums;
}
.verdict-num .u {
  font-weight: 600; font-size: 1.1rem; line-height: 1.3;
  color: var(--ink); max-width: 11rem;
}
.verdict-head {
  font-family: var(--font-display); font-weight: 800; font-size: 1.2rem; line-height: 1.3;
  letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--ink); margin: 0.9rem 0 0.3rem;
}
.pathchip {
  align-self: flex-start; margin-top: 1rem;
  font-family: var(--font-mono); font-size: 0.58rem; font-weight: 500; letter-spacing: 0.12em;
  text-transform: uppercase; padding: 0.28rem 0.6rem;
}
.pathchip.dts { color: var(--success); border: 1px solid var(--success); }
.pathchip.pa  { color: var(--warning); border: 1px solid var(--warning); }
.verdict .why { margin: 1.1rem 0 0; font-size: 0.88rem; line-height: 1.6; color: var(--ink-2); }
.verdict-facts { margin-top: auto; padding-top: 1.4rem; display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.9rem 1.2rem; }
.vfact .k {
  font-family: var(--font-mono); font-size: 0.56rem; font-weight: 500; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--stone); margin-bottom: 0.18rem;
}
.vfact .v { font-size: 0.84rem; font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; }

.cover .plan-frame { border: none; margin: 0; padding: 1.5rem var(--sheet-pad-x) 1.1rem; display: flex; flex-direction: column; justify-content: center; }

/* --- KPI strip: figures in the mono, checkable like a ledger --- */
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); border-bottom: 1.5px solid var(--ink); }
.kpi { padding: 1rem 1.3rem 1.05rem; border-right: 1px solid var(--line); min-width: 0; }
.kpi:first-child { padding-left: var(--sheet-pad-x); }
.kpi:last-child { border-right: none; }
.kpi .k {
  font-family: var(--font-mono); font-size: 0.56rem; font-weight: 500; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--stone);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.kpi .v { display: flex; align-items: baseline; gap: 0.35rem; margin-top: 0.4rem; flex-wrap: wrap; }
.kpi .n {
  font-family: var(--font-mono); font-weight: 500; font-size: 1.3rem; line-height: 1.1;
  color: var(--ink); font-variant-numeric: tabular-nums;
}
.kpi .u { font-family: var(--font-mono); font-size: 0.72rem; font-weight: 400; color: var(--stone); }

/* --- numbered sections with hanging gutters --- */
.rsec {
  display: grid; grid-template-columns: 56px 1fr; gap: 0 1.6rem;
  padding: 1.6rem var(--sheet-pad-x) 1.9rem; border-top: 1px solid var(--line);
}
.rsec:first-of-type { border-top: none; }
.gut { padding-top: 0.15rem; }
.gut .n {
  font-family: var(--font-mono); font-size: 0.8rem; font-weight: 500;
  color: var(--red); letter-spacing: 0.08em; font-variant-numeric: tabular-nums;
}
/* section dropdown: header always visible, content collapses (default state) */
.rsec-inner { min-width: 0; }
.rsec-toggle {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  width: 100%; background: none; border: none; padding: 0.1rem 0; cursor: pointer;
  font: inherit; text-align: left;
}
.rsec-title {
  margin: 0; font-family: var(--font-mono); font-weight: 500; font-size: 0.74rem;
  letter-spacing: 0.2em; text-transform: uppercase; color: var(--ink); text-wrap: balance;
  transition: color 0.12s ease;
}
.rsec-toggle:hover .rsec-title { color: var(--stone); }
.rsec .chev {
  display: inline-flex; flex: none; color: var(--stone);
  transition: transform 0.18s ease, color 0.12s ease;
}
.rsec-toggle:hover .chev { color: var(--ink); }
.rsec.collapsed .chev { transform: rotate(-90deg); }
.rsec-content { margin-top: 1.1rem; }
.rsec.collapsed .rsec-content { display: none; }
.rsec.collapsed { padding-bottom: 1.4rem; }
.rsec-cap { font-size: 0.83rem; color: var(--stone); margin: 0 0 1.1rem; max-width: 60ch; }
.rmuted { margin: 0; color: var(--text-muted); font-style: italic; font-size: 0.9rem; }
.rnote {
  margin: 0.9rem 0 0; font-size: 0.85rem; color: var(--ink-2);
  border-left: 2px solid var(--line); padding-left: 0.8rem; max-width: 64ch;
}

/* unified data table — every report section displays its information tabularly */
.dtable-wrap { overflow-x: auto; }
.dtable { width: 100%; border-collapse: collapse; }
.dtable th {
  font-family: var(--font-mono); font-size: 0.58rem; font-weight: 500; letter-spacing: 0.16em;
  text-transform: uppercase; color: var(--stone); text-align: left;
  padding: 0.3rem 1.2rem 0.5rem 0; border-bottom: 2px solid var(--ink);
}
.dtable td {
  font-size: 0.86rem; color: var(--ink-2); line-height: 1.5; vertical-align: top;
  padding: 0.62rem 1.2rem 0.62rem 0; border-bottom: 1px solid var(--line);
  font-variant-numeric: tabular-nums;
}
.dtable th:last-child, .dtable td:last-child { padding-right: 0; }
.dtable th.num, .dtable td.num { text-align: right; }
.dtable td.strong { font-weight: 600; color: var(--ink); }
.dtable td.lab { font-weight: 600; color: var(--ink); white-space: nowrap; }
.dtable td.dim { font-size: 0.78rem; color: var(--stone); }
.dtable td.figure { font-family: var(--font-mono); font-size: 0.92rem; font-weight: 500; color: var(--ink); white-space: nowrap; }
.dtable td .sub { display: block; font-size: 0.75rem; font-weight: 400; color: var(--stone); margin-top: 0.2rem; }
/* highlighted row — the proposal: selected pathway / recommended scenario is
   drawn in red, as survey convention demands of new work */
.dtable tr.sel td { background: var(--red-soft); color: var(--ink); }
.dtable tr.sel td:first-child { box-shadow: inset 3px 0 0 var(--red); padding-left: 0.7rem; font-weight: 600; }

.chip {
  display: inline-block; font-family: var(--font-mono); font-size: 0.56rem; font-weight: 500;
  letter-spacing: 0.12em; text-transform: uppercase;
  padding: 0.2rem 0.55rem; white-space: nowrap;
}
.chip.high { background: var(--danger-soft); color: var(--danger); }
.chip.mod  { background: var(--warning-soft); color: var(--warning); }
.chip.adv  { background: var(--paper-2); color: var(--ink-2); }
.chip.dts  { background: var(--success-soft); color: var(--success); }
.chip.pa   { background: var(--warning-soft); color: var(--warning); }
.chip.none { background: var(--paper-2); color: var(--stone); }

/* inline row tags — red text only: the proposal marker */
.seltag, .rectag {
  font-family: var(--font-mono); font-size: 0.54rem; font-weight: 500; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--red); background: none;
  padding: 0; margin-left: 0.6rem;
  vertical-align: 1px; white-space: nowrap;
}

/* TNV value + tag (inside the DTS numerics table) */
.tnv { display: inline-flex; align-items: baseline; gap: 0.45rem; font-variant-numeric: tabular-nums; flex-wrap: wrap; }
.tnv .val { font-family: var(--font-mono); font-size: 0.86rem; font-weight: 500; color: var(--ink); }
.tnv .tag {
  font-family: var(--font-mono); font-size: 0.52rem; font-weight: 500; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--ink-2); border: 1px solid var(--border-strong);
  padding: 0.08rem 0.34rem;
}

/* recommendation */
.rec-line {
  margin: 0 0 1.3rem; font-size: 1.05rem; font-weight: 600;
  line-height: 1.55; color: var(--ink); max-width: 62ch;
}
.constraints { margin-top: 1.5rem; }
.constraints .h {
  font-family: var(--font-mono); font-size: 0.58rem; font-weight: 500; letter-spacing: 0.16em;
  text-transform: uppercase; color: var(--stone); margin-bottom: 0.4rem;
  padding-bottom: 0.35rem; border-bottom: 2px solid var(--ink);
}
.constraints ol { list-style: none; counter-reset: c; margin: 0; padding: 0; }
.constraints li {
  counter-increment: c; display: flex; gap: 0.9rem;
  padding: 0.55rem 0; border-bottom: 1px solid var(--line); font-size: 0.88rem; color: var(--ink-2);
}
.constraints li::before {
  content: counter(c, decimal-leading-zero);
  font-family: var(--font-mono); font-size: 0.7rem; font-weight: 500; color: var(--stone);
  padding-top: 0.12rem; flex: none; font-variant-numeric: tabular-nums;
}
/* maximum achievable — an upside is NEW WORK: it is drawn in red */
.upside {
  margin-top: 1.4rem; border: 1.5px solid var(--red); padding: 0.85rem 1.1rem;
  font-size: 0.85rem; color: var(--ink-2); max-width: 68ch;
}
.upside b { color: var(--red); }

/* market */
.rlead { margin: 0 0 0.9rem; font-size: 0.94rem; line-height: 1.58; color: var(--ink-2); max-width: 68ch; }
.rkv { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.55rem; margin: 0 0 1.2rem; font-size: 0.9rem; color: var(--ink-2); }
.rkv-k {
  font-family: var(--font-mono); font-size: 0.58rem; letter-spacing: 0.14em; text-transform: uppercase;
  font-weight: 500; color: var(--stone);
}
.spreadchip {
  display: inline-block; font-family: var(--font-mono); font-size: 0.54rem; font-weight: 500;
  letter-spacing: 0.1em; text-transform: uppercase; padding: 0.16rem 0.5rem; white-space: nowrap;
}
.spreadchip.tight { background: var(--paper-2); color: var(--ink-2); }
.spreadchip.wide { background: var(--warning-soft); color: var(--warning); }
.spreadchip.est { background: var(--paper-2); color: var(--stone); }

/* small table subheading (e.g. "End-product pricing") */
.subhead {
  margin: 1.8rem 0 0.6rem; font-family: var(--font-mono);
  font-size: 0.6rem; font-weight: 500; letter-spacing: 0.16em;
  text-transform: uppercase; color: var(--ink-2);
}

.rsplit { display: grid; grid-template-columns: 1fr 1fr; gap: 1.4rem 2.4rem; margin-top: 1.5rem; }
.rcol-h {
  font-family: var(--font-mono); font-size: 0.58rem; font-weight: 500; letter-spacing: 0.16em;
  text-transform: uppercase; margin-bottom: 0.45rem; padding-bottom: 0.35rem;
  border-bottom: 2px solid var(--border-strong);
}
.rcol-h.pos { border-bottom-color: var(--success); color: var(--success); }
.rcol-h.neg { border-bottom-color: var(--warning); color: var(--warning); }
.rlist { margin: 0; padding: 0; list-style: none; }
.rlist li { padding: 0.4rem 0; border-bottom: 1px solid var(--line); font-size: 0.85rem; color: var(--ink-2); }
.rlist li:last-child { border-bottom: none; }

.sources {
  margin: 1.5rem 0 0; font-size: 0.72rem; line-height: 1.8;
  color: var(--stone); letter-spacing: 0.02em;
}
.sources b { color: var(--ink-2); font-weight: 600; }
.sources a {
  color: var(--ink-2); text-decoration: underline;
  text-decoration-color: var(--line); text-underline-offset: 2px;
}
.sources a:hover { color: var(--ink); text-decoration-color: var(--ink); }
.rcaveat {
  margin: 0.9rem 0 0; font-size: 0.76rem; font-style: italic; color: var(--stone);
  max-width: 80ch; line-height: 1.55;
}

/* one-click report actions (owner only) — mono instrument buttons under the
   cover figure (Exports) and after the sections (Precedent). Buttons are
   chrome, so per the red rule they are NEVER red. Hidden in print. */
.report-actions {
  display: flex; align-items: center; flex-wrap: wrap; gap: 0.5rem;
  margin-top: 0.9rem; padding-top: 0.85rem; border-top: 1px solid var(--line);
}
.report-actions.standalone {
  margin: 1.6rem var(--sheet-pad-x) 0; padding-top: 1rem;
}
.ra-label {
  font-family: var(--font-mono); font-size: 0.6rem; font-weight: 500;
  letter-spacing: 0.18em; text-transform: uppercase; color: var(--stone);
  margin-right: 0.5rem;
}
.act-btn {
  font-family: var(--font-mono); font-size: 0.66rem; font-weight: 500;
  letter-spacing: 0.1em; text-transform: uppercase; cursor: pointer;
  color: var(--ink-2); background: var(--paper);
  border: 1px solid var(--border-strong); border-radius: 0;
  padding: 0.45rem 0.8rem;
  transition: color 0.12s ease, border-color 0.12s ease, background 0.12s ease;
}
/* action buttons fill registry green on hover — green is chrome's colour */
.act-btn:hover { color: var(--on-panel); border-color: var(--panel); background: var(--panel); }
.act-btn:disabled { opacity: 0.45; cursor: default; }

/* §03 pathway pages — the PA / DTS switch. Same drafting-tool button as
   .act-btn; the open page's tab holds the green fill. */
.path-tabs { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 0.9rem; }
.path-tab {
  font-family: var(--font-mono); font-size: 0.66rem; font-weight: 500;
  letter-spacing: 0.1em; text-transform: uppercase; cursor: pointer;
  color: var(--ink-2); background: var(--paper);
  border: 1px solid var(--border-strong); border-radius: 0;
  padding: 0.45rem 0.8rem;
  transition: color 0.12s ease, border-color 0.12s ease, background 0.12s ease;
}
.path-tab:hover, .path-tab.active {
  color: var(--on-panel); border-color: var(--panel); background: var(--panel);
}

/* sheet footer */
.sheet-foot {
  margin-top: 0.6rem; padding: 1rem var(--sheet-pad-x) 0; border-top: 2px solid var(--ink);
  display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
  font-family: var(--font-mono); font-size: 0.58rem; font-weight: 500; letter-spacing: 0.16em;
  text-transform: uppercase; color: var(--stone);
}

/* =============================================================================
   Responsive
   ========================================================================== */
@media (max-width: 1080px) {
  .cover.split { grid-template-columns: 1fr; }
  .cover.split .verdict { border-right: none; border-bottom: 1px solid var(--line); }
  .kpis, .tblock-meta { grid-template-columns: repeat(2, 1fr); }
  .kpi, .tcell { border-bottom: 1px solid var(--line); }
  .verdict-facts { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 900px) {
  :root { --sheet-pad-x: 1.3rem; }
  .session { flex-direction: column; height: 100vh; }
  .rail {
    width: 100%; height: auto; flex: none; flex-direction: row; flex-wrap: wrap;
    align-items: center; padding: 0.7rem 1rem; gap: 0.7rem;
  }
  .rail-wordmark .wm { font-size: 0.92rem; }
  .rail-wordmark .tag, .rail-index-wrap, .rail-meta, .rail-user { display: none; }
  .rail-actions { margin-left: auto; flex-direction: row; }
  .canvas { flex: 1; }
  .sheet { margin: 0.9rem auto 1.4rem; }
  .rsec { grid-template-columns: 1fr; gap: 0.4rem; }
  .gut { display: flex; gap: 0.8rem; align-items: baseline; }
  .rsplit, .verdict-facts { grid-template-columns: 1fr; }
  .dtable { min-width: 560px; }   /* tables scroll inside .dtable-wrap on narrow screens */
}
@media (max-width: 900px) {
  .home-shell { flex-direction: column; min-height: 100vh; }
  .intake-panel {
    position: static; width: 100%; height: auto; padding: 1.6rem 1.4rem 1.4rem;
  }
  .intake-mid { margin: 0; padding: 1.2rem 0 0.4rem; }
  .ask { max-width: none; }
  .register-zone { height: auto; overflow: visible; padding: 1.6rem 1rem 2.4rem; }
  .register { padding: 0 1.2rem 1.2rem; }
  .reg-row { grid-template-columns: 2.2rem 1fr auto; }
  .reg-row .go { display: none; }
  .reg-row .addr { white-space: normal; }
  .reg-row.hist { grid-template-columns: 2.2rem 1fr auto; grid-auto-rows: auto; row-gap: 0.3rem; }
  .reg-row.hist .user { grid-column: 2; max-width: none; }
  .inv-row { grid-template-columns: 2.2rem 1fr auto; grid-auto-rows: auto; row-gap: 0.5rem; }
  .inv-row .uses { display: none; }
  .inv-acts { grid-column: 2 / -1; }
}

/* =============================================================================
   Print — "Export PDF" prints the document sheet only
   ========================================================================== */
@media print {
  body, body.in-session { background: #fff; }
  .rail, .runline, .downloads, .annot, .prose, .thinking,
  .picker-card, .intake-card, .approval-card, .plan-fig, .report-gen,
  .error-note, .brief-confirm, .report-actions { display: none !important; }
  .session { display: block; height: auto; }
  .canvas { overflow: visible; display: block; }
  .sheet { margin: 0; max-width: none; }
  .report { margin-top: 0; }
  .verdict, .plan-frame, .kpi, .tblock, .dtable tr { break-inside: avoid; }
  .dtable thead { display: table-header-group; }   /* repeat column headers across page breaks */
  /* the exported PDF is always the FULL document, whatever is collapsed on screen */
  .rsec.collapsed .rsec-content { display: block !important; }
  .rsec.collapsed { padding-bottom: 2rem; }
  .chev { display: none !important; }
  .dtable tr.sel td, .verdict { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
