/* Precise — Measured & Said (DESIGN.md) x First-Principles Typography & Restraint.
   Measured Ink #14121f marks actuals and human decisions; Said Indigo #5535c9 marks predictions,
   recommendations, and active states. Crisp 1px hairlines, generous whitespace, 4px sheets, 3px controls,
   zero drop-shadow clutter, zero uppercase micro-labels, zero box-in-box cages. Light by default;
   [data-theme="dark"] flips the tokens cleanly. */

@font-face { font-family: "Bricolage Grotesque"; font-weight: 200 800; font-style: normal; font-display: swap; src: url("/fonts/bricolage.woff2") format("woff2"); }
@font-face { font-family: "Hanken Grotesk"; font-weight: 100 900; font-style: normal; font-display: swap; src: url("/fonts/hanken.woff2") format("woff2"); }
@font-face { font-family: "JetBrains Mono"; font-weight: 100 800; font-style: normal; font-display: swap; src: url("/fonts/jetbrains.woff2") format("woff2"); }

:root {
  --top: 56px;
  --ask-w: 336px;
  --pad: 36px;
  --surface: var(--sheet);
  /* Strict 3-size body scale (hero h1 & navbar wordmark exempt; zero <13px above the fold) */
  --text-heading: 1.125rem; /* 18px */
  --text-body: 0.9375rem;   /* 15px */
  --text-sm: 0.8125rem;     /* 13px */
  /* Emil Kowalski motion, timing & tactile craft tokens (strictly < 300ms for UI) */
  --ease-out-strong: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-out: var(--ease-out-strong);
  --ease-morph: ease-in-out;
  --dur-btn: 140ms;
  --dur-tooltip: 160ms;
  --dur-popover: 180ms;
  --dur-sheet: 220ms;
  --delay-tooltip: 250ms;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--ground);
  color: var(--ink-measured);
  font: 400 var(--text-body)/1.55 var(--font-prose);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
a {
  color: var(--ink-said);
}
p { margin: 0 0 10px; }
h1, h2, h3, h4 { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--ink-said); outline-offset: 2px; }
[hidden] { display: none !important; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip {
  position: absolute;
  left: -999px;
  top: 8px;
  background: var(--sheet);
  border: 1px solid var(--rule);
  padding: 8px 12px;
  border-radius: var(--r-control);
  z-index: 80;
}
.skip:focus { left: 8px; }

/* Typography: 2 primary fonts (Bricolage Grotesque + Hanken Grotesk tabular-nums); JetBrains Mono strictly for code/SQL/digests */
.framing {
  font: 600 clamp(1.85rem, 3.1vw, 2.55rem)/1.1 var(--font-framing);
  letter-spacing: -0.025em;
  color: var(--ink-measured);
  max-width: 26ch;
  overflow-wrap: anywhere;
}
h2 {
  font: 600 var(--text-heading)/1.25 var(--font-framing);
  letter-spacing: -0.015em;
  color: var(--ink-measured);
}
h3 {
  font: 600 var(--text-body)/1.35 var(--font-prose);
  color: var(--ink-measured);
}
h4 {
  font: 600 var(--text-sm)/1.35 var(--font-prose);
  color: var(--muted-deep);
  margin: 16px 0 8px;
}
.lede {
  color: var(--muted-deep);
  max-width: 65ch;
  font-size: var(--text-body);
  line-height: 1.58;
  margin-top: 12px;
}
.lede.is-small {
  font-size: var(--text-body);
  color: var(--muted);
}
.quiet {
  color: var(--muted);
  font-size: var(--text-sm);
  line-height: 1.48;
}
.label, .subhead {
  font: 600 var(--text-sm)/1.35 var(--font-prose);
  color: var(--muted-deep);
  margin: 14px 0 6px;
}
.fig {
  font-family: var(--font-prose);
  font-variant-numeric: tabular-nums;
}
.fig-head {
  font-family: inherit;
  font-variant-numeric: tabular-nums;
  font-weight: inherit;
  letter-spacing: inherit;
}
.mono-id, code, pre, .code {
  font-family: var(--font-figure);
  font-variant-numeric: tabular-nums;
}
.ink-said { color: var(--ink-said); }
.ink-measured { color: var(--ink-measured); }
.num { text-align: right; white-space: nowrap; overflow-wrap: normal; }
.problem { color: var(--bad); padding: 20px 0; }
.empty { padding: 18px 0; }
hr.rule { border: 0; border-top: 1px solid var(--hair); margin: 22px 0; }

/* Top bar: single calm line, 56px, stronger brand wordmark, clean scrolled separation */
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  height: var(--top);
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 0 24px;
  background: var(--ground);
  border-bottom: 1px solid var(--hair);
  white-space: nowrap;
}
.topbar.is-scrolled {
  background: var(--sheet);
  border-bottom-color: var(--rule);
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--ink-measured);
  text-decoration: none;
  font: 700 1.3125rem/1 var(--font-framing);
  letter-spacing: -0.035em;
  flex: none;
}
.brand .said-ring { stroke: var(--ink-said); }
.rooms {
  display: flex;
  align-items: stretch;
  gap: 4px;
  height: 100%;
}
.rooms a {
  display: inline-flex;
  align-items: center;
  padding: 0 10px;
  color: var(--muted);
  text-decoration: none;
  font: 500 var(--text-body)/1 var(--font-prose);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.rooms a[aria-current="page"] {
  color: var(--ink-measured);
  font-weight: 600;
  border-bottom-color: var(--ink-said);
}
.top-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 14px;
}
.book-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font: 500 var(--text-sm)/1 var(--font-prose);
  color: var(--muted-deep);
}
.top-link {
  display: inline-flex;
  align-items: center;
  color: var(--muted);
  text-decoration: none;
  font: 500 var(--text-sm)/1 var(--font-prose);
  padding: 6px 4px;
  border-bottom: 2px solid transparent;
}
.top-link[aria-current="page"] {
  color: var(--ink-said);
  font-weight: 600;
  border-bottom-color: var(--ink-said);
}

/* Controls: GPU-only tactile press confirmation, snap high-frequency states cleanly */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 36px;
  padding: 7px 16px;
  border: 1px solid var(--rule);
  border-radius: var(--r-control);
  background: var(--sheet);
  color: var(--ink-measured);
  font: 600 var(--text-sm)/1.2 var(--font-prose);
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  transition: transform var(--dur-btn) var(--ease-out-strong), opacity var(--dur-btn) var(--ease-out-strong);
}
.btn:disabled { opacity: 0.42; cursor: default; border-color: var(--rule); }
.btn.is-primary {
  background: var(--ink-measured);
  border-color: var(--ink-measured);
  color: var(--on-ink);
}
.btn.is-said {
  background: var(--ink-said);
  border-color: var(--ink-said);
  color: #ffffff;
}
.btn.is-quiet { background: transparent; border-color: var(--hair); }
.btn.is-danger { color: var(--bad); }
.btn.is-small { min-height: 30px; padding: 5px 12px; font-size: var(--text-sm); }
.btn-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 14px; }
.btn-row.is-tight { margin-top: 0; gap: 8px; }

.link-btn {
  appearance: none;
  border: 0;
  background: none;
  padding: 0;
  color: var(--ink-said);
  font: 600 var(--text-sm)/1.35 var(--font-prose);
  cursor: pointer;
  text-decoration: none;
}
.link-btn:disabled { opacity: 0.45; cursor: default; }

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: 1px solid transparent;
  border-radius: var(--r-control);
  background: transparent;
  color: var(--muted-deep);
  font: 500 16px/1 var(--font-prose);
  cursor: pointer;
  flex: none;
  transition: transform var(--dur-btn) var(--ease-out-strong), opacity var(--dur-btn) var(--ease-out-strong);
}

/* Connected segmented controls: mode toggle, replay steps, filters, presets, rails */
.seg {
  display: inline-flex;
  flex-wrap: nowrap;
  align-items: stretch;
  border: 1px solid var(--rule);
  border-radius: var(--r-control);
  background: var(--sheet);
  padding: 2px;
  gap: 2px;
  max-width: 100%;
}
.seg-btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 0;
  border-radius: 2px;
  background: transparent;
  color: var(--muted);
  padding: 5px 11px;
  font: 500 var(--text-sm)/1.2 var(--font-prose);
  cursor: pointer;
  white-space: nowrap;
  transition: transform var(--dur-btn) var(--ease-out-strong);
}
.seg-btn:disabled { opacity: 0.38; cursor: default; }
.seg-btn[aria-pressed="true"],
.seg-btn[aria-checked="true"],
.seg-btn[aria-selected="true"] {
  background: var(--ink-measured);
  color: var(--on-ink);
  font-weight: 600;
}
.seg-btn .fig { color: inherit; opacity: 0.72; font-size: var(--text-sm); }
.seg-btn.is-lever[aria-pressed="true"] { background: var(--ink-said); color: #ffffff; }
.seg.is-wide { display: grid; grid-template-columns: 1fr 1fr; width: 100%; }
.seg.is-wide .seg-btn { display: grid; justify-content: start; gap: 3px; text-align: left; padding: 10px 12px; white-space: normal; }
.seg.is-wide .seg-btn .quiet { font-weight: 400; font-size: var(--text-sm); color: inherit; opacity: 0.8; }
.seg.is-wrap { flex-wrap: wrap; }

.chip-btn {
  appearance: none;
  border: 1px solid var(--rule);
  border-radius: var(--r-control);
  background: var(--sheet);
  color: var(--ink-measured);
  padding: 6px 12px;
  font: 500 var(--text-sm)/1.3 var(--font-prose);
  cursor: pointer;
  text-align: left;
  transition: transform var(--dur-btn) var(--ease-out-strong);
}

/* Workspace menu */
.ws { position: relative; }
.ws-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 32px;
  padding: 4px 8px;
  border: 1px solid transparent;
  border-radius: var(--r-control);
  background: transparent;
  color: var(--muted-deep);
  font: 500 var(--text-sm)/1.2 var(--font-prose);
  cursor: pointer;
  transition: transform var(--dur-btn) var(--ease-out-strong);
}
.ws-btn[aria-expanded="true"] {
  background: var(--sheet);
  border-color: var(--rule);
  color: var(--ink-measured);
}
.ws-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--good); flex: none; }
.ws-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  z-index: 40;
  min-width: 260px;
  padding: 6px;
  background: var(--sheet);
  border: 1px solid var(--rule);
  border-radius: var(--r-sheet);
  white-space: normal;
  transform-origin: top right;
  opacity: 1;
  transform: scale(1);
  transition: transform var(--dur-popover) var(--ease-out-strong), opacity var(--dur-popover) var(--ease-out-strong);
}
@starting-style {
  .ws-menu {
    opacity: 0;
    transform: scale(0.95);
  }
}
.ws-menu-head { padding: 8px 10px; margin: 0 0 4px; border-bottom: 1px solid var(--hair); font-size: var(--text-sm); }
.ws-menu-label { padding: 8px 10px 4px; margin: 0; font: 600 var(--text-sm)/1.3 var(--font-prose); color: var(--muted); }
.ws-menu-item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-radius: var(--r-control);
  background: transparent;
  color: var(--ink-measured);
  font: 500 var(--text-sm)/1.3 var(--font-prose);
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}

/* Tactile press feedback across buttons, pills, and toggles */
.btn:active:not(:disabled),
.icon-btn:active:not(:disabled),
.seg-btn:active:not(:disabled),
.chip-btn:active:not(:disabled),
.auto-pill:active:not(:disabled),
.ws-btn:active:not(:disabled),
.cite:active:not(:disabled) {
  transform: scale(0.97);
}

/* Shell: rooms on the left, Ask Precise docked on the right */
.shell { display: grid; grid-template-columns: minmax(0, 1fr) var(--ask-w); min-height: calc(100vh - var(--top)); }
.main-col { min-width: 0; padding: 32px var(--pad) 72px; }
.room { max-width: 1040px; margin: 0 auto; outline: none; }
.room:focus { outline: none; }
.ask {
  position: sticky;
  top: var(--top);
  height: calc(100vh - var(--top));
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 24px 20px 0;
  background: var(--sheet);
  border-left: 1px solid var(--hair);
}
body.is-locked .shell { grid-template-columns: minmax(0, 1fr); }
body.is-locked .ask { display: none; }

/* Notices */
.notices { max-width: 1040px; margin: 0 auto; }
.notices:empty { display: none; }
.notice {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  padding: 10px 14px;
  margin: 0 0 16px;
  border-left: 2px solid var(--rule);
  background: var(--sheet);
  font-size: var(--text-sm);
  line-height: 1.5;
}
.notice.is-said { border-left-color: var(--ink-said); }
.notice.is-bad { border-left-color: var(--bad); color: var(--bad); }
.notice.is-warn { border-left-color: var(--warn); }
.notice-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ink-said); flex: none; }
.notice-diff summary { cursor: pointer; color: var(--ink-said); font-weight: 600; }
.notice-diff pre { max-height: 220px; overflow: auto; font-size: var(--text-sm); }
.receipt { margin: 8px 0 0; font-size: var(--text-sm); color: var(--good); }
.receipt:empty { display: none; }
.receipt.is-bad { color: var(--bad); }
.form-msg { min-height: 1.2em; margin: 6px 0; font-size: var(--text-sm); color: var(--bad); }

/* Hairline sections (zero nested card cages) */
.block {
  margin-top: 36px;
  padding-top: 24px;
  border-top: 1px solid var(--hair);
}
.block.is-flush {
  margin-top: 28px;
  padding-top: 0;
  border-top: 0;
}
.block-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px 16px;
  margin-bottom: 14px;
}
.block-head .quiet { margin: 4px 0 0; }
.block-head .input[type="search"] { max-width: 280px; }
.room-head { padding-bottom: 4px; }
.card {
  background: var(--sheet);
  border: 1px solid var(--rule);
  border-radius: var(--r-sheet);
  padding: 20px;
  min-width: 0;
}
.surface-section {
  padding-top: 24px;
  margin-top: 28px;
  border-top: 1px solid var(--rule);
  min-width: 0;
}
.surface-section:first-child { margin-top: 0; padding-top: 0; border-top: 0; }

.plain-list { list-style: none; margin: 0 0 8px; padding: 0; }
.plain-list li { padding: 6px 0; font-size: var(--text-body); }
.plain-list.rows { border-top: 1px solid var(--hair); }
.plain-list.rows li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
  padding: 12px 0;
  border-bottom: 1px solid var(--hair);
}
.plain-list.rows li > .row-main { flex: 1 1 260px; min-width: 0; }

/* Key figure grids: sentence-case labels, tabular Hanken Grotesk figures */
.figs {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(136px, 1fr));
  gap: 14px 22px;
  margin: 16px 0;
  padding: 14px 0;
  border-top: 1px solid var(--hair);
  border-bottom: 1px solid var(--hair);
}
.fig-cell { min-width: 0; }
.fig-cell dt {
  font: 500 var(--text-sm)/1.35 var(--font-prose);
  color: var(--muted);
}
.fig-cell dd {
  margin: 3px 0 0;
  font-size: var(--text-body);
  font-weight: 600;
  color: var(--ink-measured);
  overflow-wrap: anywhere;
}
.kv {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 6px 18px;
  margin: 10px 0;
  font-size: var(--text-sm);
}
.kv dt { color: var(--muted); font-weight: 500; }
.kv dd { margin: 0; overflow-wrap: anywhere; color: var(--ink-measured); }
.kv.is-inline { grid-template-columns: repeat(auto-fit, minmax(120px, max-content) minmax(130px, 1fr)); }

/* Restrained inline semantic status indicators (reserved for table cells & genuine status) */
.badge, .state-badge, .pilot-pill {
  display: inline-flex;
  flex: none;
  width: fit-content;
  align-self: center;
  align-items: center;
  gap: 6px;
  padding: 2px 8px;
  border-radius: var(--r-chip);
  font: 600 var(--text-sm)/1.4 var(--font-prose);
  color: var(--muted-deep);
  background: var(--hair-faint);
  white-space: nowrap;
}
.state-badge::before, .pilot-pill::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  flex: none;
}
.state-badge.is-ready, .pilot-pill.is-pilot-ready, .pilot-pill.is-pilot-collecting {
  color: var(--ink-said);
  background: var(--ink-said-range);
}
.state-badge.is-collecting {
  color: var(--muted-deep);
  background: var(--hair-faint);
}
.state-badge.is-stopped, .pilot-pill.is-pilot-srm {
  color: var(--bad);
  background: color-mix(in srgb, var(--bad) 10%, transparent);
}
.state-badge.is-blocked, .pilot-pill.is-pilot-blocked {
  color: var(--muted);
  background: transparent;
}
.state-badge.is-blocked::before, .pilot-pill.is-pilot-blocked::before {
  background: transparent;
  border: 1.5px solid var(--ghost);
}
.state-badge.is-applied, .pilot-pill.is-pilot-promoted {
  color: var(--good);
  background: color-mix(in srgb, var(--good) 10%, transparent);
}
.pilot-pill.is-pilot-reverted {
  color: var(--warn);
  background: color-mix(in srgb, var(--warn) 12%, transparent);
}

.badge.is-good, .badge.is-approved_active, .badge.is-approved, .badge.is-connected, .badge.is-fresh, .badge.is-promoted, .badge.is-inside {
  color: var(--good);
  background: color-mix(in srgb, var(--good) 10%, transparent);
}
.badge.is-said, .badge.is-pending_approval, .badge.is-approval_requested, .badge.is-level, .badge.is-running, .badge.is-open {
  color: var(--ink-said);
  background: var(--ink-said-range);
}
.badge.is-waiting, .badge.is-not_connected, .badge.is-stale, .badge.is-warn {
  color: var(--warn);
  background: color-mix(in srgb, var(--warn) 11%, transparent);
}
.badge.is-bad, .badge.is-stopped, .badge.is-outside {
  color: var(--bad);
  background: color-mix(in srgb, var(--bad) 10%, transparent);
}
.badge.is-declined, .badge.is-declined_keep_locked, .badge.is-reverted, .badge.is-blocked {
  color: var(--muted);
  background: var(--hair-faint);
}

.is-bad-text { color: var(--bad); }
.is-warn-text { color: var(--warn); }
.tech { margin-top: 16px; font-size: var(--text-sm); }
.tech summary { cursor: pointer; color: var(--muted-deep); font-weight: 600; }
.code {
  white-space: pre;
  overflow: auto;
  max-height: 420px;
  padding: 12px 14px;
  background: var(--ground);
  border: 1px solid var(--hair);
  border-radius: var(--r-control);
  font-size: var(--text-sm);
  line-height: 1.5;
}
textarea.code { white-space: pre; }
.skeleton { background: var(--hair-faint); border-radius: var(--r-sheet); margin-top: 16px; animation: breathe 1.1s ease-in-out infinite; }
.skeleton.is-head { height: 64px; max-width: 640px; }
.skeleton.is-bar { height: 28px; }
.skeleton.is-table { height: 260px; }
@keyframes breathe { 50% { opacity: 0.55; } }
.is-flash { outline: 2px solid var(--ink-said); outline-offset: 3px; transition: opacity var(--dur-sheet) var(--ease-out-strong); }

/* Forms */
.form { display: grid; gap: 14px; }
.field { display: grid; gap: 6px; min-width: 0; margin: 0; border: 0; padding: 0; }
.field > span, .field > legend { font: 600 var(--text-sm)/1.3 var(--font-prose); color: var(--muted-deep); padding: 0; }
.field small { font-size: var(--text-sm); }
.field.is-end { align-content: end; }
.field-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; align-items: start; }
.field-row.is-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.field-row.is-4 { grid-template-columns: 1.2fr 1.2fr 1fr auto; align-items: end; }
.input {
  width: 100%;
  min-height: 36px;
  padding: 7px 10px;
  border: 1px solid var(--rule);
  border-radius: var(--r-control);
  background: var(--sheet);
  font-size: var(--text-body);
}
.input:focus { outline: none; border-color: var(--ink-said); box-shadow: 0 0 0 1px var(--ink-said); }
textarea.input { resize: vertical; line-height: 1.5; }
.checks { display: flex; flex-wrap: wrap; gap: 10px 20px; }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: var(--text-body); }

/* Desk: opens directly with h1; calm post-headline metadata; zero boxes above the fold */
.desk-head .lede b { font-weight: 600; font-variant-numeric: tabular-nums; }
.desk-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 0;
  margin: 14px 0 0;
  font-size: var(--text-sm);
  line-height: 1.5;
  color: var(--muted);
}
.desk-meta > span, .desk-meta > button { white-space: nowrap; }
.desk-meta > :not(:last-child)::after { content: "·"; margin: 0 9px; color: var(--axis); }
.desk-meta b { font-weight: 600; }
.desk-mode-live::before {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 7px;
  border-radius: 50%;
  background: var(--good);
  vertical-align: 1px;
}
.goal-link {
  appearance: none;
  border: 0;
  background: none;
  padding: 0;
  color: var(--ink-said);
  font: 500 var(--text-sm)/1.5 var(--font-prose);
  cursor: pointer;
}
.desk-cta { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-top: 22px; }

/* Opportunity breakdown: 2-part proportional split + direct-labeled Tufte inline horizontal bars + inline inspector */
.obar { margin-top: 22px; }
.obar-split { display: flex; gap: 3px; height: 8px; border-radius: 2px; overflow: hidden; }
.obar-split-part { display: block; height: 100%; }
.obar-split-part.is-testable { background: var(--ink-said); }
.obar-split-part.is-hygiene { background: var(--ink-measured); opacity: 0.78; }
.obar-cols { display: grid; grid-template-columns: minmax(0, 1.08fr) minmax(0, 1fr); gap: 28px; margin-top: 16px; }
.obar-col { min-width: 0; }
.obar-col + .obar-col { padding-left: 24px; border-left: 1px solid var(--hair); }
.obar-col-head { display: flex; align-items: center; gap: 8px; }
.obar-col-title { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 10px; }
.obar-swatch { width: 10px; height: 10px; border-radius: 2px; flex: none; }
.is-testable .obar-swatch { background: var(--ink-said); }
.is-hygiene .obar-swatch { background: var(--ink-measured); }
.obar-bucket-label { font: 600 var(--text-body)/1.35 var(--font-prose); color: var(--ink-measured); }
.obar-bucket-fig { font-size: var(--text-body); font-weight: 600; color: var(--ink-measured); }
.is-testable .obar-bucket-fig { color: var(--ink-said); }
.obar-bucket-share { font-size: var(--text-sm); color: var(--muted); }
.obar-range { margin: 3px 0 12px 18px; font-size: var(--text-sm); color: var(--muted); }
.obar-rows { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.obar-row {
  appearance: none;
  display: grid;
  gap: 6px;
  width: 100%;
  padding: 8px 10px;
  border: 1px solid transparent;
  border-radius: 3px;
  background: transparent;
  text-align: left;
  cursor: pointer;
  color: var(--ink-measured);
}
.obar-row.is-selected { background: var(--surface); border-color: var(--ink-said); }
.obar-row-top { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.obar-row-label { font: 500 var(--text-sm)/1.35 var(--font-prose); color: var(--ink-measured); }
.obar-row.is-selected .obar-row-label { color: var(--ink-said); font-weight: 600; }
.obar-row-vals { display: inline-flex; align-items: baseline; gap: 7px; white-space: nowrap; font-size: var(--text-sm); color: var(--ink-measured); }
.obar-row-vals b { font-weight: 600; }
.obar-row-pct { color: var(--muted); font-size: 0.78rem; min-width: 28px; text-align: right; }
.obar-track { display: block; width: 100%; height: 5px; border-radius: 2px; background: var(--hair); overflow: hidden; }
.obar-fill { display: block; height: 100%; border-radius: 2px; }
.obar-fill.is-testable { background: var(--ink-said); }
.obar-fill.is-hygiene { background: var(--ink-measured); opacity: 0.72; }
.obar-detail {
  margin-top: 16px;
  padding: 16px 18px;
  background: var(--surface);
  border: 1px solid var(--hair);
  border-left: 3px solid var(--ink-said);
  border-radius: 4px;
  display: grid;
  gap: 10px;
}
.obar-detail.is-hygiene { border-left-color: var(--ink-measured); }
.obar-detail-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 8px 16px; }
.obar-detail-head h3 { margin: 0; font: 600 1rem/1.3 var(--font-prose); color: var(--ink-measured); }
.obar-detail-nums { display: inline-flex; flex-wrap: wrap; align-items: baseline; gap: 10px; font-size: var(--text-sm); }
.obar-detail-body { margin: 0; font-size: var(--text-sm); line-height: 1.5; color: var(--muted-deep); max-width: 78ch; }
.obar-detail-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin-top: 2px; }

/* Sleek hairline replay bar (zero card box, single connected segmented step control) */
.replay {
  display: grid;
  grid-template-columns: auto minmax(80px, 1fr) auto;
  align-items: center;
  gap: 12px 20px;
  margin-top: 26px;
  padding: 14px 0;
  border-top: 1px solid var(--hair);
  border-bottom: 1px solid var(--hair);
}
.replay-text { font-size: var(--text-sm); color: var(--muted-deep); margin: 0; }
.replay-text b { font-weight: 600; color: var(--ink-measured); }
.replay-track { height: 3px; background: var(--rule); border-radius: 2px; overflow: hidden; }
.replay-fill {
  display: block;
  height: 100%;
  background: var(--ink-said);
}

/* 72-hour dot timeline: open hairline canvas (hidden entirely when empty) */
.dots { padding: 4px 0; }
.dots-chart { min-height: 62px; }
.dots-svg { display: block; overflow: visible; }
.axis-line { stroke: var(--rule); stroke-width: 1; }
.axis-tick { stroke: var(--axis); stroke-width: 1; }
.grid-line { stroke: var(--hair-faint); stroke-width: 1; }
.axis-label { fill: var(--muted); font: 500 12px var(--font-prose); font-variant-numeric: tabular-nums; }
.dot { cursor: pointer; outline: none; }
.dot-stem { stroke: var(--rule); stroke-width: 1; }
.dot-mark { stroke: var(--ground); stroke-width: 1.5; }
.dot-label { fill: var(--muted-deep); font: 500 12px var(--font-prose); font-variant-numeric: tabular-nums; }
.dot.is-ready .dot-mark { fill: var(--ink-said); }
.dot.is-collecting .dot-mark { fill: var(--ink-measured); }
.dot.is-stopped .dot-mark { fill: var(--bad); }
.dot.is-blocked .dot-mark { fill: var(--ground); stroke: var(--ghost); }
.dot.is-applied .dot-mark { fill: var(--good); }
.dot:focus-visible .dot-mark { stroke: var(--ink-said); stroke-width: 2.5; }
.dots-key { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 8px 0 0; font-size: var(--text-sm); color: var(--muted); }
.dots-key-item::before { content: ""; display: inline-block; width: 8px; height: 8px; margin-right: 6px; border-radius: 50%; vertical-align: 0; }
.dots-key-item.is-ready::before { background: var(--ink-said); }
.dots-key-item.is-collecting::before { background: var(--ink-measured); }
.dots-key-item.is-stopped::before { background: var(--bad); }
.dots-key-item.is-blocked::before { border: 1.5px solid var(--ghost); width: 7px; height: 7px; }

/* Tables: clean hairline alignment on the page ground, sentence-case headers */
table { border-collapse: collapse; width: 100%; }
th {
  font: 500 var(--text-sm)/1.35 var(--font-prose);
  color: var(--muted);
  text-align: left;
  padding: 9px 10px;
  border-bottom: 1px solid var(--rule);
}
td {
  padding: 12px 10px;
  border-bottom: 1px solid var(--hair);
  vertical-align: top;
  font-size: var(--text-body);
  overflow-wrap: anywhere;
}
.loops {
  table-layout: fixed;
  border-top: 1px solid var(--rule);
}
.loops th:first-child, .loops td:first-child { padding-left: 2px; }
.loops th:last-child, .loops td:last-child { padding-right: 2px; }
.loops .c-control { width: 23%; }
.loops .c-change { width: 24%; }
.loops .c-evidence { width: 20%; }
.loops .c-eta { width: 9%; }
.loops .c-outcome { width: 24%; }
.loop-row { cursor: pointer; }
.loop-row:focus-visible { outline: 2px solid var(--ink-said); outline-offset: -2px; }
.loop-label { display: block; font-weight: 600; color: var(--ink-measured); }
.loop-sub { display: block; margin-top: 3px; color: var(--muted); font-size: var(--text-sm); }
.loop-change { font-size: var(--text-sm); color: var(--muted-deep); }
.loop-evidence { display: flex; flex-wrap: wrap; align-items: center; gap: 5px 8px; }
.state-word { font: 600 var(--text-sm)/1.25 var(--font-prose); color: var(--muted-deep); }
.state-word.is-ready { color: var(--ink-said); }
.state-word.is-stopped { color: var(--bad); }
.loop-outcome { display: block; font-size: var(--text-sm); }
.row-cta { display: inline-block; margin-top: 4px; color: var(--ink-said); font: 600 var(--text-sm)/1.25 var(--font-prose); }
.row-cta.is-bad { color: var(--bad); }
.bullet { display: block; flex: none; }
.bullet-track { fill: var(--rule); }
.bullet-fill { fill: var(--ink-measured); }
.bullet-gate { stroke: var(--ink-said); stroke-width: 1.5; }
.bullet.is-stopped .bullet-fill { fill: var(--bad); }
.bullet.is-blocked .bullet-fill { fill: var(--ghost); }
.pbar.is-short .bullet-fill { fill: var(--warn); }

.kept {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 36px;
}
.kept-col h2 { margin-bottom: 6px; }
.kept-col li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--hair);
  padding: 8px 0;
  font-size: var(--text-body);
}

/* Slide-over sheets: start directly with h2 title (zero eyebrow kickers) */
.scrim { position: fixed; inset: 0; width: 100vw; height: 100vh; z-index: 50; background: rgba(20, 18, 31, 0.28); transition: opacity var(--dur-popover) var(--ease-out-strong); }
:root[data-theme="dark"] .scrim { background: rgba(0, 0, 0, 0.55); }
.sheet {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 55;
  display: flex;
  flex-direction: column;
  width: min(740px, 100vw);
  background: var(--sheet);
  border-left: 1px solid var(--rule);
  transform: translateX(20px);
  opacity: 0;
  transition: transform var(--dur-sheet) var(--ease-out-strong), opacity var(--dur-popover) var(--ease-out-strong);
  outline: none;
}
.sheet.is-narrow { width: min(560px, 100vw); }
.sheet.is-open { transform: none; opacity: 1; }
.sheet-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 26px 16px;
  border-bottom: 1px solid var(--hair);
}
.sheet-title {
  font: 600 1.375rem/1.2 var(--font-framing);
  letter-spacing: -0.02em;
  color: var(--ink-measured);
}
.sheet-sub {
  margin: 4px 0 0;
  font-size: var(--text-sm);
  color: var(--muted);
}
.sheet-body, .drawer-body, .outcome-drawer .sheet-body { flex: 1; overflow-y: auto; padding: 20px 26px 96px; }
.sheet-foot { padding: 12px 26px 16px; border-top: 1px solid var(--hair); background: var(--sheet); }
.sheet-section { margin-top: 24px; padding-top: 18px; border-top: 1px solid var(--hair); }
.sheet-section > h3 { margin-bottom: 10px; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.two-col p { font-size: var(--text-body); max-width: 65ch; }
.loop-lead { display: grid; grid-template-columns: auto 1fr; gap: 12px; align-items: start; }
.loop-lead p { margin: 0; max-width: 65ch; }
.loop-actions { display: grid; gap: 8px; }
.loop-actions-row { display: grid; gap: 8px; }
.loop-actions .input { min-height: 32px; padding: 5px 10px; font-size: var(--text-sm); margin: 0; }
.loop-actions-note { margin: 0; font-size: var(--text-sm); }

/* Confidence sequence chart */
.cseq { margin: 0; }
.cseq-chart { min-height: 232px; }
.cseq-svg { display: block; }
.cseq-band { fill: var(--ink-said-range); }
.cseq-edge { fill: none; stroke: var(--ink-said); stroke-width: 1; opacity: 0.45; }
.cseq-estimate { fill: none; stroke: var(--ink-said); stroke-width: 1.75; }
.cseq-point { fill: var(--ink-said); }
.cseq-threshold { stroke: var(--ghost); stroke-width: 1.25; stroke-dasharray: 5 4; }
.cseq-threshold-label { fill: var(--ghost); }
.cseq-wait { stroke: var(--ghost); stroke-width: 1; stroke-dasharray: 2 3; }
.cseq-acted { stroke: var(--ink-measured); stroke-width: 1.5; }
.cseq-acted-label { fill: var(--ink-measured); font: 600 12px var(--font-prose); }
.cseq-projected { stroke: var(--ink-said); stroke-width: 1; stroke-dasharray: 3 3; }
.cseq-stopped-line { stroke: var(--bad); stroke-width: 1.5; stroke-dasharray: 4 3; }
.cseq-stopped-label { fill: var(--bad); font: 600 12px var(--font-prose); }
.cseq-caption { margin-top: 10px; font-size: var(--text-sm); color: var(--muted-deep); max-width: 65ch; }

.diff td, .diff th, .data td, .data th, .ledger td, .ledger th { padding: 9px 10px; }
.diff td { font-size: var(--text-sm); }
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border-top: 1px solid var(--rule); }
.data { font-size: var(--text-sm); }
.data td { font-size: var(--text-sm); white-space: nowrap; overflow-wrap: normal; }
.arm-score-table { width: max-content; min-width: 100%; }
.arm-score-table th, .arm-score-table td, .arm-score-table .arm-label { white-space: nowrap; overflow-wrap: normal; word-break: normal; }
.ledger { table-layout: fixed; border-top: 1px solid var(--rule); }
.ledger th:first-child, .ledger td:first-child { padding-left: 2px; }
.ledger th:nth-child(1) { width: 34%; }
.ledger th:nth-child(2) { width: 24%; }
.ledger tr.is-link { cursor: pointer; }
.sm-zero { stroke: var(--axis); stroke-width: 1; }
.sm-said { fill: var(--ink-said); }
.sm-measured { fill: var(--ink-measured); }
.sm-measured.is-loss, .sm-said.is-loss { fill: var(--bad); }
.key::before { content: ""; display: inline-block; width: 10px; height: 6px; margin-right: 6px; vertical-align: 1px; }
.key.is-said::before { background: var(--ink-said); }
.key.is-measured::before { background: var(--ink-measured); }
.score-line { font-size: var(--text-body); max-width: 65ch; margin-bottom: 14px; }

/* Proof designer (clean hairline sections, zero nested card cages) */
.proof-form { padding: 18px 0 6px; margin-top: 12px; border-top: 1px solid var(--hair); }
.proof-form .field-row.is-3 { grid-template-columns: minmax(115px, 0.85fr) minmax(105px, 0.7fr) minmax(240px, 1.8fr); }
.proof-result { margin-top: 22px; }
.bp-headline { font: 600 var(--text-heading)/1.3 var(--font-framing); letter-spacing: -0.015em; margin: 0 0 6px; }
.cells { list-style: none; margin: 16px 0 0; padding: 0; border-top: 1px solid var(--rule); }
.cell { padding: 16px 0; border-bottom: 1px solid var(--hair); }
.cell.is-infeasible { border-left: 2px solid var(--bad); padding-left: 14px; }
.cell.is-underpowered { border-left: 2px solid var(--warn); padding-left: 14px; }
.cell-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px 12px; }
.cell-head h3 { flex: 1; }
.speed { font-size: var(--text-sm); font-weight: 600; color: var(--ink-said); white-space: nowrap; }
.cell .quiet { margin: 4px 0 8px; }
.badge-line { font-size: var(--text-sm); margin: 8px 0 0; }
.bp-notes { margin-top: 18px; font-size: var(--text-body); max-width: 65ch; }
.bp-notes p { margin-bottom: 8px; }
.cell-gate { margin: 10px 0 0; font-size: var(--text-sm); color: var(--muted-deep); }

/* Campaigns (clean hairline rows, zero outer card box) */
.camp-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--rule); }
.camp {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) 148px minmax(0, 1.9fr) 176px;
  gap: 8px 18px;
  align-items: center;
  padding: 14px 4px;
  border-bottom: 1px solid var(--hair);
}
.camp.is-current { background: var(--sheet); }
.camp-promise { display: flex; flex-direction: column; gap: 4px; font-size: var(--text-sm); }
.outcome-line { margin: 0; font-size: var(--text-sm); color: var(--muted-deep); }
.outcome-line.is-waiting b { color: var(--warn); }
.camp-open {
  appearance: none;
  border: 0;
  background: none;
  padding: 0;
  color: var(--ink-measured);
  font: 600 var(--text-body)/1.35 var(--font-prose);
  text-align: left;
  cursor: pointer;
  border-bottom: 1px solid transparent;
}
.camp-name .loop-sub { display: block; }
.camp-title-row { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px; }
.camp-order-id { font-size: var(--text-sm); font-weight: 600; color: var(--ink-said); }

/* Outcome contract */
.worlds { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin: 16px 0 20px; }
.world {
  appearance: none;
  display: grid;
  align-content: start;
  gap: 4px;
  padding: 12px 14px;
  border: 1px solid var(--rule);
  border-radius: var(--r-control);
  background: var(--sheet);
  text-align: left;
  cursor: pointer;
  font: 400 var(--text-sm)/1.4 var(--font-prose);
}
.world b { font-weight: 600; font-size: var(--text-body); }
.world .quiet { font-size: var(--text-sm); }
.world[aria-checked="true"] { border-color: var(--ink-said); box-shadow: inset 0 0 0 1px var(--ink-said); background: var(--ink-said-range); }
.contract-fields { display: grid; gap: 12px; }
.contract-sentence { font-size: var(--text-body); padding: 12px 16px; background: var(--ground); border-left: 2px solid var(--ink-said); max-width: 65ch; }
.inherit-path { font-size: var(--text-sm); font-weight: 600; color: var(--ink-said); }

/* Control */
.tabs {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 0 16px;
  margin-top: 22px;
  border-bottom: 1px solid var(--rule);
}
.tab {
  display: inline-flex;
  align-items: center;
  padding: 10px 2px;
  color: var(--muted);
  text-decoration: none;
  font: 500 var(--text-sm)/1.2 var(--font-prose);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  white-space: nowrap;
}
.tab[aria-current="page"] { color: var(--ink-measured); font-weight: 600; border-bottom-color: var(--ink-said); }
.tabs-divider {
  align-self: center;
  margin: 0 0 0 4px;
  padding-left: 14px;
  border-left: 1px solid var(--rule);
  font: 500 var(--text-sm)/1 var(--font-prose);
  color: var(--ghost);
  white-space: nowrap;
}
.tab-panel { padding-top: 6px; }
.rule-input { min-height: 68px; font-size: var(--text-body); }
.rule-card { margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--rule); }
.rule-explain { font-size: var(--text-body); max-width: 65ch; }
.measure-line { font-size: var(--text-sm); color: var(--muted-deep); }
.plain-list.rows li.unlock, li.unlock {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 10px 16px;
  align-items: start;
}
.plain-list.rows li.unlock > .badge, li.unlock > .badge { align-self: start; margin-top: 2px; }
.unlock-text { min-width: 0; }
.plain-list.rows li.unlock > .btn-row, .unlock .btn-row {
  grid-column: 1 / -1;
  margin-top: 2px;
}
.methods-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: 22px; margin-top: 14px; }
.method-list { max-height: 520px; overflow-y: auto; border-top: 1px solid var(--rule); }
.method-list li { padding: 0; border-bottom: 1px solid var(--hair); }
.method {
  appearance: none;
  display: grid;
  gap: 3px;
  width: 100%;
  padding: 10px 6px;
  border: 0;
  background: none;
  text-align: left;
  cursor: pointer;
}
.method .mono-id { font-size: var(--text-sm); color: var(--ink-said); font-weight: 600; }
.method .quiet { font-size: var(--text-sm); }
.spine { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.spine-card { padding-top: 14px; border-top: 1px solid var(--rule); }
.spine-card .mono-id { font-weight: 600; color: var(--ink-said); margin-bottom: 8px; }
.stages { margin: 0; padding-left: 20px; font-size: var(--text-sm); }
.stages li { padding: 3px 0; }
.calls .call-curl { flex-basis: 100%; margin-top: 0; }
.calls .call-curl .code { max-height: 160px; }

/* Hairline prompt rows (Ask Precise starters & Rule examples: zero bordered card buttons) */
.prompt-list {
  display: grid;
  border-top: 1px solid var(--hair);
}
.prompt-row, .ask-chip {
  appearance: none;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding: 11px 2px;
  border: 0;
  border-bottom: 1px solid var(--hair);
  border-radius: 0;
  background: transparent;
  color: var(--ink-measured);
  font: 500 var(--text-sm)/1.4 var(--font-prose);
  text-align: left;
  cursor: pointer;
}
.prompt-row::after, .ask-chip::after {
  content: "→";
  color: var(--axis);
  flex: none;
  transition: transform var(--dur-btn) var(--ease-out-strong);
}

/* Ask Precise docked sidebar */
.ask-head { display: flex; align-items: baseline; justify-content: space-between; }
.ask-title { font: 600 var(--text-heading)/1.25 var(--font-framing); letter-spacing: -0.015em; }
.ask-opening { margin: 0; font-size: var(--text-sm); color: var(--muted); line-height: 1.5; }
.ask-chips { display: grid; border-top: 1px solid var(--hair); }
.ask-chips.is-follow { margin-top: 14px; }
.ask-answers { flex: 1; }
.ask-answers:empty { flex: 1; }
.ask-q { margin: 8px 0 10px; font: 600 var(--text-sm)/1.45 var(--font-prose); color: var(--ink-measured); }
.ask-a { padding: 14px 0; border-top: 1px solid var(--hair); font-size: var(--text-body); line-height: 1.52; }
.ask-summary { font-size: var(--text-body); }
.ask-refusal { color: var(--muted-deep); }
.ask-part { font-size: var(--text-sm); color: var(--muted-deep); }
.ask-figures { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0; }
.cite {
  appearance: none;
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  padding: 4px 9px;
  border: 1px solid var(--rule);
  border-radius: var(--r-control);
  background: var(--ground);
  font: 500 var(--text-sm)/1.3 var(--font-prose);
  cursor: pointer;
  transition: transform var(--dur-btn) var(--ease-out-strong);
}
.cite .fig { color: var(--ink-said); font-weight: 600; }
.cite-label { color: var(--muted-deep); }
.ask-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.ask-meta { margin: 10px 0 0; font: 500 var(--text-sm)/1.35 var(--font-prose); color: var(--ghost); }
.ask-form {
  position: sticky;
  bottom: 0;
  display: flex;
  gap: 8px;
  padding: 14px 0 18px;
  margin-top: auto;
  background: var(--sheet);
  border-top: 1px solid var(--hair);
}
.ask-form input {
  flex: 1;
  min-width: 0;
  min-height: 36px;
  padding: 7px 10px;
  border: 1px solid var(--rule);
  border-radius: var(--r-control);
  background: var(--ground);
  font-size: var(--text-sm);
}
.ask-form input:focus { outline: none; border-color: var(--ink-said); background: var(--sheet); }

/* Inline definitions */
.term.has-def { border-bottom: 1px dotted var(--ink-said); cursor: help; }
.glossary-popover {
  position: fixed;
  z-index: 70;
  max-width: min(380px, calc(100vw - 24px));
  max-height: calc(100vh - 24px);
  overflow-y: auto;
  overflow-x: auto;
  overflow-wrap: anywhere;
  padding: 16px 18px;
  background: var(--sheet);
  border: 1px solid var(--ink-measured);
  border-radius: var(--r-sheet);
  font-size: var(--text-body);
  transform-origin: top left;
  opacity: 1;
  transform: scale(1);
  transition: transform var(--dur-popover) var(--ease-out-strong), opacity var(--dur-popover) var(--ease-out-strong);
}
@starting-style {
  .glossary-popover {
    opacity: 0;
    transform: scale(0.95);
  }
}
.glossary-popover table, .ask-a table { max-width: 100%; display: block; overflow-x: auto; }
.ask-a pre { max-width: 100%; overflow-x: auto; }
.gp-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.gp-head .icon-btn { width: 28px; height: 28px; font-size: 16px; }
.glossary-popover h3 { margin: 0 0 4px; font: 600 var(--text-heading)/1.25 var(--font-framing); }
.gp-cat { margin: 0 0 10px; font-size: var(--text-sm); color: var(--muted); }
.gp-short { font-weight: 500; }
.gp-why, .gp-related { font-size: var(--text-sm); color: var(--muted-deep); }
.gp-ask { margin-top: 6px; }

/* Sign-in gate */
.gate { max-width: 980px; margin: 16px auto 0; }
.gate-intro { max-width: 65ch; padding-bottom: 28px; }
.gate-intro .notice { margin-top: 14px; }
.gate-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 28px; align-items: start; padding-top: 24px; border-top: 1px solid var(--rule); }
.gate-grid .card h2 { margin-bottom: 6px; }
.gate-recent { margin-top: 18px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.gate-recent .label { width: 100%; margin: 0; }
.gate-preview { margin-top: 16px; }

/* Buying goal, tables, Move sheet, Deal Board */
.goal-panel { display: grid; gap: 16px; }
.goal-seg, .seg.is-wide.goal-seg { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.pass-through-field { gap: 10px; }
.pass-through-row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.pass-range { flex: 1 1 200px; accent-color: var(--ink-said); }
.pass-num { width: 84px; flex: none; }

.data td.is-wrap, .data th.is-wrap { white-space: normal; word-break: break-word; overflow-wrap: anywhere; }
.basket-table { table-layout: fixed; }
.basket-table th:first-child, .basket-table td:first-child { width: 42%; white-space: normal; word-break: break-word; overflow-wrap: anywhere; }
.basket-table th:nth-child(2), .basket-table td:nth-child(2) { width: 26%; white-space: normal; overflow-wrap: anywhere; }
.deal-table th { white-space: normal; overflow-wrap: normal; word-break: normal; padding: 9px 7px; }
.deal-table td { padding: 10px 7px; }
.deal-table th:first-child, .deal-table td:first-child { min-width: 175px; max-width: 240px; white-space: normal; word-break: break-word; overflow-wrap: anywhere; }
.deal-controls { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 16px; margin: 16px 0 14px; }
.deal-controls .input[type="search"] { max-width: 280px; }

.ledger-divider td { padding: 14px 10px 8px; color: var(--muted); font-weight: 600; font-size: var(--text-sm); border-top: 1px solid var(--rule); border-bottom: 1px solid var(--hair); }
.ledger-loop-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; }
.is-excluded-row td, .is-reverted-row td { color: var(--muted); }
.sample-tick-toast { margin-top: 14px; }
.notice-diff-body { margin-top: 8px; padding: 10px 12px; background: var(--ground); border-left: 2px solid var(--rule); font-size: var(--text-sm); }
.notice-diff-body ul { margin: 4px 0 0; padding-left: 18px; }

.move-scope { font-size: var(--text-sm); color: var(--muted-deep); margin-top: 8px; max-width: 65ch; }
.move-diff tr.is-changed td:last-child { color: var(--ink-said); font-weight: 600; }
.rails-seg { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); width: 100%; margin: 12px 0 14px; }
.rails-seg .seg-btn { display: grid; justify-content: start; gap: 2px; text-align: left; padding: 10px 12px; white-space: normal; }
.rail-detail { padding-top: 8px; }
.rail-caveat { margin-top: 10px; font-size: var(--text-sm); color: var(--muted); max-width: 65ch; }
.move-actions-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.sql-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 8px; }
.rail-not-applicable { color: var(--muted); font-style: italic; }
.rail-warnings { display: grid; gap: 8px; margin: 10px 0; }
.rail-warnings .notice { margin: 0; }

/* Dual-Gate Pacing indicators (booked pace < 92% NEVER green) */
.dual-pacing, .dual-pacing-inline { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.dual-pacing-inline { margin-top: 6px; }
.dual-pacing-box { padding: 10px 0; margin-bottom: 8px; border-bottom: 1px solid var(--hair); }
.dual-pacing-box .quiet { margin: 6px 0 0; }
.pace-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border-radius: var(--r-chip);
  font-size: var(--text-sm);
  font-weight: 600;
  line-height: 1.4;
  white-space: nowrap;
  background: var(--hair-faint);
  color: var(--muted-deep);
}
.pace-pill.is-good { color: var(--good); background: color-mix(in srgb, var(--good) 10%, transparent); }
.pace-pill.is-warn { color: var(--warn); background: color-mix(in srgb, var(--warn) 12%, transparent); }
.pace-pill.is-bad { color: var(--bad); background: color-mix(in srgb, var(--bad) 11%, transparent); }
.pace-pill.is-neutral, .pace-pill.is-unknown { color: var(--muted); background: var(--hair-faint); }

/* Live In-Flight Pilot indicators */
.pilot-pills { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 6px; }
.loop-lead-badges { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.cert-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: var(--r-chip);
  font-size: var(--text-sm);
  font-weight: 600;
  line-height: 1.4;
  color: var(--good);
  background: color-mix(in srgb, var(--good) 10%, transparent);
  white-space: nowrap;
}

/* Bayesian Posterior Shrinkage Strip (loop-sheet.js) */
.bayes-strip { padding-top: 18px; border-top: 1px solid var(--hair); }
.bayes-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.bayes-head h3 { margin: 0; }
.bayes-weight { font-size: var(--text-sm); font-weight: 600; color: var(--ink-said); }
.bayes-svg { display: block; width: 100%; height: auto; max-height: 76px; }
.bayes-axis { stroke: var(--rule); stroke-width: 1.25; }
.bayes-ci-bar { fill: var(--ink-said-range); }
.bayes-ci-cap { stroke: var(--ink-measured); stroke-width: 1.25; }
.bayes-pull { stroke: var(--ink-said); stroke-width: 1.5; stroke-dasharray: 4 3; }
.bayes-prior { fill: var(--sheet); stroke: var(--ink-said); stroke-width: 2; }
.bayes-observed { stroke: var(--ink-measured); stroke-width: 2.25; }
.bayes-posterior { fill: var(--ink-measured); stroke: var(--sheet); stroke-width: 1.5; }
.bayes-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px; margin-top: 8px; font-size: var(--text-sm); color: var(--muted-deep); }
.bayes-key::before { content: ""; display: inline-block; margin-right: 6px; vertical-align: middle; }
.bayes-key.is-prior::before { width: 9px; height: 9px; border-radius: 50%; border: 2px solid var(--ink-said); background: var(--sheet); }
.bayes-key.is-observed::before { width: 2px; height: 11px; background: var(--ink-measured); }
.bayes-key.is-posterior::before { width: 9px; height: 9px; border-radius: 50%; background: var(--ink-measured); }
.bayes-key.is-ci::before { width: 12px; height: 6px; background: var(--ink-said-range); border-left: 1px solid var(--ink-measured); border-right: 1px solid var(--ink-measured); }
.bayes-note { margin: 8px 0 0; }

/* Multi-cycle Bayesian Calibration Strip (desk.js): hairline columns, zero nested cards */
.cal-strip .block-head { margin-bottom: 12px; }
.cal-deltas { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: var(--text-sm); font-weight: 600; }
.cal-body { display: grid; gap: 14px; }
.cal-svg { display: block; width: 100%; height: auto; min-height: 64px; max-height: 80px; }
.cal-target-80 { stroke: var(--ghost); stroke-width: 1; stroke-dasharray: 4 3; }
.cal-line-mae { fill: none; stroke: var(--ink-measured); stroke-width: 1.75; }
.cal-line-cov { fill: none; stroke: var(--ink-said); stroke-width: 1.75; }
.cal-dot-mae { fill: var(--ink-measured); }
.cal-dot-cov { fill: var(--ground); stroke: var(--ink-said); stroke-width: 1.75; }
.cal-cards {
  list-style: none;
  margin: 0;
  padding: 12px 0 0;
  border-top: 1px solid var(--hair);
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 12px 20px;
}
.cal-card { display: grid; gap: 3px; }
.cal-week { font: 600 var(--text-sm)/1.3 var(--font-prose); color: var(--muted); }
.cal-metric { font-size: var(--text-sm); }
.cal-n { font-size: var(--text-sm); }

/* Custody, Output Policy & Cloud IAM Grants (control.js) */
.custody-panel { display: grid; gap: 14px; }
.custody-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; }
.policy-pill {
  display: inline-flex;
  align-items: center;
  padding: 2px 9px;
  border-radius: var(--r-chip);
  font-size: var(--text-sm);
  font-weight: 600;
  white-space: nowrap;
}
.policy-pill.is-measured { background: var(--hair-faint); color: var(--ink-measured); border: 1px solid var(--rule); }
.policy-pill.is-said { background: var(--ink-said-range); color: var(--ink-said); border: 1px solid var(--ink-said-pale); }
.grants-list { display: grid; gap: 18px; }
.grant-card { padding-top: 14px; border-top: 1px solid var(--hair); }
.grant-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 8px 12px; margin-bottom: 10px; }
.grant-head .quiet { margin: 2px 0 0; font-size: var(--text-sm); }
.grant-code { margin: 0; max-height: 220px; background: var(--sheet); }

/* Clean Room & Auto-Reconciliation sections (zero nested card cages) */
.cleanroom-panel { display: grid; gap: 0; }
.cleanroom-section {
  padding-top: 24px;
  margin-top: 28px;
  border-top: 1px solid var(--rule);
  display: grid;
  gap: 12px;
}
.cleanroom-section:first-child { margin-top: 24px; }
.cleanroom-meta { margin: 0; font-size: var(--text-sm); color: var(--muted); }
.cleanroom-output:empty, .cleanroom-ledger:empty, .device-graph-output:empty, .reconcile-verify-output:empty, .reconcile-intake-output:empty { display: none; }

/* Dedicated 1-Page Executive / CFO Brief (#/brief): architectural tearsheet, zero box-in-box clutter */
.brief { display: grid; gap: 16px; }
.brief-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.brief-actions-spacer { flex: 1; }
.brief-toast { font-size: var(--text-sm); color: var(--good); font-weight: 600; }
.brief-sheet {
  background: var(--sheet);
  border: 1px solid var(--rule);
  border-radius: var(--r-sheet);
  padding: 28px 30px;
  display: grid;
  gap: 22px;
}
.brief-header { display: grid; gap: 10px; padding-bottom: 16px; border-bottom: 2px solid var(--ink-measured); }
.brief-title-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; }
.brief-title { font: 600 clamp(1.45rem, 2.3vw, 1.9rem)/1.12 var(--font-framing); letter-spacing: -0.025em; color: var(--ink-measured); }
.brief-brand-tag { display: inline-flex; align-items: center; gap: 7px; font-size: var(--text-sm); font-weight: 600; color: var(--muted-deep); }
.brief-mark { color: var(--ink-measured); flex: none; }
.brief-mark .said-ring { stroke: var(--ink-said); }
.brief-meta-strip { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; font-size: var(--text-sm); color: var(--muted-deep); }
.brief-mode-badge { font-weight: 600; color: var(--ink-measured); }
.brief-mode-badge.is-live-measured { color: var(--good); }
.brief-mode-badge.is-historical { color: var(--ink-measured); }
.brief-mode-badge.is-sample { color: var(--muted); }
.brief-meta-item { white-space: nowrap; }
.brief-row { display: grid; gap: 10px; padding-top: 16px; border-top: 1px solid var(--hair); }
.brief-row:first-of-type { padding-top: 0; border-top: 0; }
.brief-sec-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px; }
.brief-sec-label { font: 600 var(--text-body)/1.3 var(--font-framing); color: var(--ink-measured); margin: 0; }
.brief-scale-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.brief-kpi { display: grid; align-content: start; gap: 3px; }
.brief-kpi-label { font: 500 var(--text-sm)/1.35 var(--font-prose); color: var(--muted); }
.brief-kpi-val { font-size: 1.3125rem; font-weight: 600; line-height: 1.2; color: var(--ink-measured); }
.brief-kpi-sub { font-size: var(--text-sm); color: var(--muted); line-height: 1.4; }
.brief-grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; }
.brief-card { display: grid; align-content: start; gap: 6px; padding-top: 14px; border-top: 2px solid var(--rule); }
.brief-card.is-measured { border-top-color: var(--ink-measured); }
.brief-card.is-said { border-top-color: var(--ink-said); }
.brief-card-kicker { margin: 0; font: 600 var(--text-sm)/1.35 var(--font-prose); }
.brief-card-big { margin: 0; font-size: 1.625rem; font-weight: 600; line-height: 1.15; letter-spacing: -0.02em; }
.brief-card-status { font: 600 var(--text-heading)/1.3 var(--font-framing); color: var(--ink-measured); }
.brief-card-sub { margin: 0; font-size: var(--text-sm); color: var(--muted-deep); line-height: 1.48; }
.brief-measured-split { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 18px; margin: 4px 0 2px; }
.brief-measured-metric { display: grid; align-content: start; gap: 3px; }
.brief-measured-label { font-size: var(--text-sm); color: var(--muted); font-weight: 500; }
.brief-measured-note { font-size: var(--text-sm); color: var(--muted); }
.brief-stat-pills { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.brief-split-list { display: grid; grid-template-columns: 1fr auto; gap: 5px 14px; margin: 8px 0 0; padding-top: 10px; border-top: 1px solid var(--hair); font-size: var(--text-sm); }
.brief-split-list dt { color: var(--muted-deep); }
.brief-split-list dd { margin: 0; text-align: right; font-weight: 600; }
.brief-footnote { margin: 0; font-size: var(--text-sm); color: var(--muted); line-height: 1.45; }
.brief-highlight { padding-top: 10px; display: grid; gap: 14px; }
.brief-highlight-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 8px 14px; }
.brief-highlight-title { margin: 0; font: 600 var(--text-body)/1.35 var(--font-prose); color: var(--ink-measured); }
.brief-highlight-sub { margin: 3px 0 0; font-size: var(--text-sm); color: var(--muted-deep); max-width: 65ch; }
.brief-highlight-badges { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.brief-impact-fig { font-weight: 600; font-size: var(--text-sm); color: var(--ink-said); }
.brief-next-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; padding-top: 12px; border-top: 1px solid var(--hair); }
.brief-next-cell { display: grid; align-content: start; gap: 5px; }
.brief-next-val { margin: 0; font-size: var(--text-sm); color: var(--ink-measured); line-height: 1.45; }
.brief-econ-table { border-top: 1px solid var(--rule); }
.brief-econ-table th { padding: 8px 10px; font-size: var(--text-sm); }
.brief-econ-table td { padding: 9px 10px; font-size: var(--text-sm); }
.brief-split-sub { display: block; font-size: var(--text-sm); color: var(--muted); font-weight: 400; }
.brief-footer { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 12px; padding-top: 12px; border-top: 1px solid var(--hair); font-size: var(--text-sm); color: var(--muted); }

/* Executive Autopilot Front End (#/autopilot): airy, 1-number business view in Measured & Said */
.auto-room { max-width: 820px; margin: 0 auto; display: grid; gap: 28px; padding-top: 4px; }
.auto-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--hair);
}
.auto-identity { display: flex; align-items: center; gap: 10px; }
.auto-book { font: 600 var(--text-body)/1.3 var(--font-framing); color: var(--ink-measured); }
.auto-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--muted-deep);
}
.auto-status.is-live { color: var(--good); font-weight: 600; }
.auto-status.is-live::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--good); }
.auto-pills { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.auto-pill {
  appearance: none;
  padding: 5px 11px;
  border: 1px solid var(--rule);
  border-radius: var(--r-control);
  background: var(--sheet);
  color: var(--muted-deep);
  font-size: var(--text-sm);
  font-weight: 500;
  cursor: pointer;
  transition: transform var(--dur-btn) var(--ease-out-strong);
}
.auto-pill.is-active { border-color: var(--ink-said); color: var(--ink-said); }
.auto-pill b { color: var(--ink-measured); font-weight: 600; }
.auto-pill.is-active b { color: var(--ink-said); }
.auto-pill.is-link { border-color: transparent; background: transparent; color: var(--ink-said); padding-right: 2px; }
.auto-home { display: grid; gap: 0; }
.auto-hero { padding: 18px 0 36px; border-bottom: 1px solid var(--rule); display: grid; gap: 12px; }
.auto-title {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 12px;
  margin: 0;
}
.auto-money {
  font: 600 clamp(3.25rem, 7vw, 5.25rem)/1.02 var(--font-framing);
  letter-spacing: -0.04em;
  color: var(--ink-measured);
}
.auto-unit {
  font: 500 clamp(1.125rem, 2vw, 1.5rem)/1.2 var(--font-framing);
  color: var(--muted);
}
.auto-lede { font-size: 1.0625rem; line-height: 1.56; color: var(--muted-deep); max-width: 60ch; margin: 2px 0 0; }
.auto-book-note { margin: 0; }
.auto-hero-links { display: flex; flex-wrap: wrap; align-items: center; gap: 14px 24px; margin-top: 8px; }
.auto-drill-link {
  appearance: none;
  border: 0;
  border-bottom: 1px solid var(--ink-said);
  background: transparent;
  padding: 0 0 2px;
  font: 600 var(--text-body)/1.35 var(--font-prose);
  color: var(--ink-said);
  cursor: pointer;
}
.auto-decision {
  padding: 32px 0 8px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 18px 28px;
}
.auto-decision-copy { flex: 1 1 380px; display: grid; gap: 6px; }
.auto-decision-label { margin: 0; font: 600 var(--text-sm)/1.3 var(--font-prose); color: var(--ink-said); }
.auto-decision h2 { font: 600 clamp(1.35rem, 2.2vw, 1.7rem)/1.18 var(--font-framing); letter-spacing: -0.02em; }
.auto-decision-sub { margin: 0; font-size: var(--text-body); color: var(--muted-deep); line-height: 1.52; max-width: 56ch; }
.auto-decision-actions { flex: none; }
.auto-page { display: grid; gap: 18px; }
.auto-back {
  appearance: none;
  justify-self: start;
  border: 0;
  background: transparent;
  padding: 0;
  font: 500 var(--text-sm)/1.3 var(--font-prose);
  color: var(--muted);
  cursor: pointer;
}
.auto-bigval {
  margin: 0;
  font: 600 clamp(2.1rem, 4.5vw, 3.25rem)/1.08 var(--font-framing);
  letter-spacing: -0.03em;
  color: var(--ink-measured);
}
.auto-breakdown { border-top: 1px solid var(--rule); display: grid; margin-top: 6px; }
.auto-row {
  appearance: none;
  width: 100%;
  border: 0;
  border-bottom: 1px solid var(--hair);
  background: transparent;
  padding: 20px 6px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 24px;
  text-align: left;
  cursor: pointer;
}
.auto-row-copy { flex: 1 1 360px; display: grid; gap: 4px; }
.auto-row-title { font: 600 1.03125rem/1.3 var(--font-framing); color: var(--ink-measured); }
.auto-row-sub { font-size: var(--text-sm); color: var(--muted-deep); line-height: 1.48; }
.auto-row-right { display: grid; justify-items: end; gap: 3px; flex: none; }
.auto-row-val { font: 600 1.25rem/1.2 var(--font-prose); letter-spacing: -0.015em; }
.auto-panel {
  background: var(--sheet);
  border: 1px solid var(--rule);
  border-radius: var(--r-sheet);
  padding: 20px 22px;
  display: grid;
  gap: 12px;
}
.auto-panel h2, .auto-panel h3 { margin: 0; }
.auto-items { display: grid; border-top: 1px solid var(--hair); }
.auto-item {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px 18px;
  padding: 13px 0;
  border-bottom: 1px solid var(--hair);
}
.auto-item:last-child { border-bottom: 0; padding-bottom: 0; }
.auto-item-copy { flex: 1 1 320px; display: grid; gap: 4px; }
.auto-item-copy .quiet { margin: 0; }
.auto-item-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.auto-item-right { display: grid; justify-items: end; gap: 4px; flex: none; }
.auto-tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: var(--r-chip);
  background: var(--hair-faint);
  color: var(--muted-deep);
  font-size: var(--text-sm);
  font-weight: 500;
  white-space: nowrap;
}
.auto-tag.is-good { color: var(--good); background: color-mix(in srgb, var(--good) 10%, transparent); font-weight: 600; }
.auto-detail-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--hair); }
.auto-detail-list li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--hair);
  font-size: var(--text-sm);
}
.auto-detail-list li:last-child { border-bottom: 0; }
.auto-more-wrap { display: grid; gap: 12px; justify-items: start; }
.auto-actions { margin-top: 6px; align-items: center; }

/* Pass 2: Beat-2 Upstream Control Strip, Inline Goal Switcher, SRM Banner, Campaigns & SQL polish */
.upstream-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  margin-top: 16px;
  background: var(--hair);
  border: 1px solid var(--hair);
  border-radius: 4px;
  overflow: hidden;
}
.upstream-cell {
  background: var(--surface);
  padding: 12px 14px;
  display: grid;
  gap: 3px;
  align-content: start;
  text-align: left;
}
button.upstream-cell {
  appearance: none;
  border: 0;
  width: 100%;
  cursor: pointer;
}
a.upstream-cell {
  text-decoration: none;
  cursor: pointer;
}
.upstream-label { font: 600 0.78rem/1.3 var(--font-prose); color: var(--muted); }
.upstream-val { font: 600 var(--text-sm)/1.35 var(--font-prose); color: var(--ink-measured); }
.upstream-sub { font-size: 0.78rem; line-height: 1.4; color: var(--muted-deep); margin: 0; }
.portal-goal-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 16px;
  margin-top: 14px;
  padding: 10px 0;
  border-top: 1px solid var(--hair);
  border-bottom: 1px solid var(--hair);
}
.portal-goal-bar .seg { width: auto; }
.srm-banner {
  padding: 14px 16px;
  border: 1px solid var(--bad);
  border-left: 3px solid var(--bad);
  border-radius: 4px;
  background: var(--surface);
  display: grid;
  gap: 6px;
}
.camp-summary-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 16px;
  margin-top: 18px;
  padding: 12px 0;
  border-top: 1px solid var(--hair);
  border-bottom: 1px solid var(--hair);
}
.camp-summary-copy {
  margin: 0;
  font-size: var(--text-sm);
  line-height: 1.45;
  color: var(--muted-deep);
  flex: 1 1 320px;
}
.camp-view-block { margin-top: 18px; padding-top: 0; border-top: 0; }
.camp-outcome-lift { color: var(--good); font-weight: 500; }
.deal-controls-right { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.sql-preload-note {
  margin: 0 0 12px;
  padding: 8px 12px;
  border-left: 2px solid var(--ink-said);
  background: var(--sheet);
  font-size: var(--text-sm);
  color: var(--muted-deep);
}

/* Stage 1: Custody & Ownership Strip/Banner, Cross-Wholesaler Capability Ledger, Connect in Claude (MCP) */
.custody-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
  margin-top: 12px;
  padding: 10px 14px;
  background: var(--sheet);
  border: 1px solid var(--hair);
  border-left: 2px solid var(--ink-measured);
  border-radius: var(--r-control);
  font-size: var(--text-sm);
  line-height: 1.45;
  color: var(--muted-deep);
}
.custody-strip.is-compact { padding: 9px 12px; }
.custody-strip-copy { flex: 1 1 320px; min-width: 0; }
.custody-banner {
  margin-top: 18px;
  padding: 18px 20px;
  background: var(--sheet);
  border: 1px solid var(--rule);
  border-left: 2px solid var(--ink-measured);
  border-radius: var(--r-sheet);
}
.custody-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  margin-top: 12px;
  background: var(--hair);
  border: 1px solid var(--hair);
  border-radius: var(--r-control);
  overflow: hidden;
}
.custody-cell {
  background: var(--ground);
  padding: 12px 14px;
  display: grid;
  gap: 4px;
  align-content: start;
}
.custody-cell-label { font: 600 0.78rem/1.3 var(--font-prose); color: var(--muted); }
.custody-cell-val { font-size: var(--text-sm); font-weight: 600; color: var(--ink-measured); }
.custody-cell-sub { margin: 0; font-size: 0.78rem; line-height: 1.42; color: var(--muted-deep); }

.wholesaler-table td, .wholesaler-table th { padding: 10px 10px; }
.wholesaler-table td:first-child .loop-sub { white-space: nowrap; }
.wholesaler-ready { margin-top: 14px; }
.cap-chips { display: flex; flex-wrap: wrap; gap: 5px; }
.cap-chip {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  border: 1px solid var(--hair);
  border-radius: var(--r-chip);
  background: var(--ground);
  font: 500 0.78rem/1.3 var(--font-prose);
  color: var(--muted-deep);
  white-space: nowrap;
}
.cap-chip.is-yes { color: var(--good); border-color: color-mix(in srgb, var(--good) 28%, var(--hair)); background: color-mix(in srgb, var(--good) 8%, transparent); }
.cap-chip.is-warn { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 32%, var(--hair)); background: color-mix(in srgb, var(--warn) 10%, transparent); font-weight: 600; }
.cap-chip.is-said { color: var(--ink-said); border-color: var(--ink-said-pale); background: var(--ink-said-range); font-weight: 600; }
.cap-chip.is-muted { color: var(--muted); }

.mcp-card {
  margin-top: 28px;
  padding: 20px 22px;
  background: var(--sheet);
  border: 1px solid var(--rule);
  border-left: 2px solid var(--ink-said);
  border-radius: var(--r-sheet);
}
.mcp-endpoint-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  padding: 9px 12px;
  background: var(--ground);
  border: 1px solid var(--hair);
  border-radius: var(--r-control);
}
.mcp-url { font-size: var(--text-sm); color: var(--ink-measured); font-weight: 500; overflow-wrap: anywhere; }
.mcp-examples { margin-top: 14px; }
.mcp-prompt-list li { padding: 8px 0; font-size: var(--text-sm); color: var(--ink-measured); }
.mcp-safety { margin: 12px 0 0; font-weight: 500; color: var(--muted-deep); }
.camp-show-all { margin-top: 14px; padding-top: 10px; border-top: 1px solid var(--hair); }

/* Hover rules strictly scoped to fine pointer devices so touch taps never stick */
@media (hover: hover) and (pointer: fine) {
  a:hover { color: var(--ink-said-hover); }
  .brand:hover { color: var(--ink-measured); }
  .rooms a:hover { color: var(--ink-measured); }
  .top-link:hover { color: var(--ink-measured); }
  .btn:hover:not(:disabled) { border-color: var(--ink-measured); }
  .btn.is-primary:hover:not(:disabled) { background: var(--ink-hover); border-color: var(--ink-hover); }
  .btn.is-said:hover:not(:disabled) { background: var(--ink-said-hover); border-color: var(--ink-said-hover); }
  .btn.is-quiet:hover:not(:disabled) { border-color: var(--rule); background: var(--sheet); }
  .btn.is-danger:hover:not(:disabled) { border-color: var(--bad); }
  .link-btn:hover:not(:disabled) { color: var(--ink-said-hover); text-decoration: underline; }
  .icon-btn:hover { background: var(--sheet); border-color: var(--rule); color: var(--ink-measured); }
  .seg-btn:hover:not(:disabled) { color: var(--ink-measured); background: var(--hair-faint); }
  .chip-btn:hover { border-color: var(--ink-said); color: var(--ink-said); }
  .ws-btn:hover { background: var(--sheet); border-color: var(--rule); color: var(--ink-measured); }
  .ws-menu-item:hover { background: var(--hair-faint); }
  .goal-link:hover { color: var(--ink-said-hover); text-decoration: underline; }
  .obar-row:hover { background: var(--surface); border-color: var(--hair); }
  .dot:hover .dot-mark { stroke: var(--ink-said); stroke-width: 2.5; }
  .loop-row:hover td { background: var(--sheet); }
  .ledger tr.is-link:hover td { background: var(--sheet); }
  .camp:hover { background: var(--sheet); }
  .camp-open:hover { color: var(--ink-said); border-bottom-color: var(--ink-said); }
  .world:hover { border-color: var(--ink-measured); }
  .tab:hover { color: var(--ink-measured); }
  .method:hover { background: var(--sheet); }
  .prompt-row:hover, .ask-chip:hover { color: var(--ink-said); }
  .prompt-row:hover::after, .ask-chip:hover::after { color: var(--ink-said); transform: translateX(3px); }
  .cite:hover { border-color: var(--ink-said); }
  .term.has-def:hover { color: var(--ink-said); }
  .auto-pill:hover { border-color: var(--ink-said); color: var(--ink-said); }
  .auto-pill.is-link:hover { border-color: transparent; text-decoration: underline; }
  .auto-drill-link:hover { color: var(--ink-said-hover); border-bottom-color: var(--ink-said-hover); }
  .auto-back:hover { color: var(--ink-measured); }
  .auto-row:hover { background: var(--sheet); }
  button.upstream-cell:hover, a.upstream-cell:hover { background: var(--ground); }
}

/* Responsive layout: tablet & 390px mobile with zero horizontal overflow */
@media (max-width: 1179px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .ask { position: static; height: auto; border-left: 0; border-top: 1px solid var(--rule); padding-bottom: 20px; }
  .book-pill { display: none; }
  .custody-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  .gate-grid, .kept, .two-col, .worlds, .spine, .methods-grid, .field-row, .field-row.is-3, .field-row.is-4, .seg.is-wide, .seg.is-wide.goal-seg, .seg.rails-seg, .brief-scale-grid, .brief-grid-2, .brief-next-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .camp { grid-template-columns: minmax(0, 1fr); }
  .replay { grid-template-columns: minmax(0, 1fr); }
  .obar-cols { grid-template-columns: 1fr; gap: 18px; }
  .obar-col + .obar-col { padding-left: 0; padding-top: 14px; border-left: 0; border-top: 1px solid var(--hair); }
  .upstream-strip { grid-template-columns: 1fr; }
  .custody-grid { grid-template-columns: 1fr; }
  .plain-list.rows li.unlock, li.unlock { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  :root { --pad: 16px; }
  .topbar { gap: 8px; padding: 0 12px; overflow: visible; }
  .brand { font-size: 1.125rem; gap: 5px; }
  .brand svg { width: 19px; height: 19px; }
  .rooms { gap: 2px; }
  .rooms a { padding: 0 6px; font-size: var(--text-sm); }
  .top-right { gap: 4px; }
  .topbar .seg, .topbar .top-link, .topbar .theme-btn, .ws-name { display: none; }
  .ws-btn { padding: 4px 6px; }
  .main-col { padding: 20px var(--pad) 48px; }
  .framing { font-size: 1.625rem; }
  .loops { display: block; overflow-x: auto; table-layout: auto; -webkit-overflow-scrolling: touch; }
  .loops th, .loops td { min-width: 112px; }
  .loops th:first-child, .loops td:first-child { min-width: 190px; }
  .loops th.num, .loops td.num { min-width: 76px; }
  .sheet-head, .sheet-body, .sheet-foot { padding-left: 16px; padding-right: 16px; }
  .brief-sheet { padding: 18px 16px; }
}

/* Rockstar UX Pass 1 polish helpers (Measured & Said) */
.seg-btn.is-accent { color: var(--ink-said); border: 1px solid var(--ink-said); background: var(--ink-said-range); font-weight: 600; }
.move-unchanged { margin-top: 12px; }
.move-unchanged .table-wrap { margin-top: 8px; }
.replay-preview-bar { padding-top: 10px; border-top: 1px solid var(--hair); }
.brief-run-rate { color: var(--ink-measured); font-weight: 500; }
.proof-settings { margin-top: 12px; padding: 10px 0; border-top: 1px solid var(--hair); border-bottom: 1px solid var(--hair); }
.bp-group-title { font: 600 var(--text-sm)/1.3 var(--font-prose); color: var(--muted-deep); margin: 0 0 6px; }

/* Cut all spatial travel (transform: none) while preserving crisp opacity fades */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
  }
  .sheet,
  .glossary-popover,
  .ws-menu,
  .btn:active:not(:disabled),
  .icon-btn:active:not(:disabled),
  .seg-btn:active:not(:disabled),
  .chip-btn:active:not(:disabled),
  .auto-pill:active:not(:disabled),
  .ws-btn:active:not(:disabled),
  .cite:active:not(:disabled),
  .prompt-row::after,
  .ask-chip::after {
    transform: none !important;
    transition: opacity var(--dur-btn) var(--ease-out-strong) !important;
  }
}

/* 1-Page Letter / A4 Print Stylesheet for Executive / CFO Brief */
@media print {
  @page { size: letter portrait; margin: 0.42in; }
  html, body { background: #ffffff !important; color: #14121f !important; font-size: 11px !important; line-height: 1.38 !important; }
  .topbar, .ask, .notices, .brief-actions, .brief-screen-only, #overlays, #glossary-popover, .skip { display: none !important; }
  .shell { display: block !important; min-height: auto !important; }
  .main-col { padding: 0 !important; }
  .room { max-width: 100% !important; margin: 0 !important; }
  .brief { gap: 0 !important; }
  .brief-sheet { border: 1px solid #d9d6e6 !important; border-radius: 0 !important; padding: 14px 16px !important; gap: 11px !important; background: #ffffff !important; }
  .brief-header { padding-bottom: 9px !important; gap: 6px !important; border-bottom: 2px solid #14121f !important; }
  .brief-title { font-size: 18px !important; color: #14121f !important; }
  .brief-meta-strip { font-size: 10.5px !important; gap: 6px 12px !important; }
  .brief-mode-badge, .brief-card.is-measured, .brief-card.is-said, .pace-pill, .badge { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .brief-row, .brief-card, .brief-highlight, .brief-econ-table { break-inside: avoid; page-break-inside: avoid; }
  .brief-scale-grid { grid-template-columns: repeat(3, minmax(0, 1fr)) !important; gap: 10px !important; }
  .brief-grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; gap: 14px !important; }
  .brief-next-grid { grid-template-columns: repeat(3, minmax(0, 1fr)) !important; gap: 10px !important; }
  .brief-kpi-val { font-size: 15px !important; }
  .brief-kpi-sub, .brief-footnote, .brief-card-sub, .brief-next-val { font-size: 10px !important; }
  .brief-card { padding-top: 8px !important; }
  .brief-card-big { font-size: 19px !important; }
  .brief-card-status { font-size: 13.5px !important; }
  .brief-econ-table th, .brief-econ-table td { padding: 5px 8px !important; font-size: 10.5px !important; }
  .brief-footer { padding-top: 7px !important; font-size: 9.5px !important; }
}
