
:root {
  --green-900: #0a2e1a;
  --green-800: #0d3f24;
  --green-700: #14532d;
  --green-600: #166534;
  --green-500: #16a34a;
  --green-100: #dcfce7;
  --green-50: #f0fdf4;
  --teal: #0d9488;
  --amber-bg: #fffbeb;
  --amber: #d97706;
  --red-bg: #fef2f2;
  --red: #dc2626;
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-500: #6b7280;
  --gray-700: #374151;
  --gray-900: #111827;
  --font-sans: 'Source Sans 3', 'Segoe UI', sans-serif;
  --font-display: 'Playfair Display', Georgia, serif;
  --font-mono: 'JetBrains Mono', Menlo, monospace;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: var(--font-sans);
  color: var(--gray-900);
  background: var(--gray-50);
  line-height: 1.55;
}
a { color: var(--green-700); }
main { max-width: 1100px; margin: 0 auto; padding: 0 24px 48px; }

/* Top bar */
.top-bar {
  background: var(--green-900); color: var(--green-100);
  padding: 12px 24px;
  display: flex; justify-content: space-between; align-items: center;
}
.brand-line { display: flex; align-items: center; gap: 12px; margin-right: 28px; }
.brand-mini {
  font-family: var(--font-display); font-size: 26px;
  color: var(--green-100); text-decoration: none;
  letter-spacing: 0.2px;
}
.brand-version {
  font-family: var(--font-mono); font-size: 10.5px;
  color: var(--green-100); opacity: 0.55;
  background: rgba(255,255,255,0.06);
  padding: 2px 7px; border-radius: 3px; letter-spacing: 0.5px;
  align-self: center;
}
.role-pill {
  background: var(--teal); color: white;
  font-family: var(--font-mono); font-size: 10px;
  padding: 2px 8px; border-radius: 4px; letter-spacing: 0.5px;
  text-transform: uppercase;
}
.top-actions a {
  color: var(--green-100); margin-left: 16px; text-decoration: none;
  font-size: 13px;
}
.top-actions a:hover, .top-actions a.active { color: white; }
.top-actions a.active {
  border-bottom: 2px solid var(--green-100); padding-bottom: 1px;
}

/* New top-bar layout: brand · nav · right-cluster (lang switch + try CTA) */
.top-nav { display: flex; align-items: center; flex: 1; margin: 0 24px 0 16px; gap: 4px; }
.top-nav a {
  color: var(--green-100); padding: 4px 10px; text-decoration: none;
  font-size: 13px; border-radius: 4px;
}
.top-nav a:hover { color: white; background: rgba(255,255,255,.05); }
.top-nav a.active {
  color: white; background: rgba(255,255,255,.08);
}

.top-right { display: flex; align-items: center; gap: 14px; flex-shrink: 0; }

/* Language switch — compact UA / EN toggle. Fixed-width halves so the
   pill stays the same shape regardless of which language is current. */
.lang-switch {
  display: inline-flex; align-items: center; gap: 0;
  background: rgba(255,255,255,.08); border-radius: 4px;
  font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.5px;
  overflow: hidden; flex-shrink: 0;
}
.lang-switch .lang-current,
.lang-switch .lang-other {
  width: 56px; box-sizing: border-box;
  padding: 4px 9px;
  display: inline-flex; align-items: center; justify-content: center; gap: 5px;
}
.lang-switch .lang-current {
  background: rgba(255,255,255,.15); color: white;
  font-weight: 600;
}
.lang-switch .lang-other {
  color: var(--green-100);
  text-decoration: none; transition: background .12s;
}
.lang-switch .lang-other:hover { background: rgba(255,255,255,.12); color: white; }
/* CSS-painted mini flag — works on every OS (Windows doesn't render
   regional-indicator emoji as flags). 14×10 colored bar. */
.lang-switch .lang-flag {
  display: inline-block; width: 14px; height: 10px; border-radius: 1.5px;
  box-shadow: 0 0 0 1px rgba(0,0,0,.25) inset;
}
.lang-switch .lang-flag.flag-ua {
  background: linear-gradient(to bottom, #0057b7 50%, #ffd500 50%);
}
/* Union Jack via inline SVG — the prior horizontal red/white/blue
   gradient read as the Dutch flag. Paint the actual British flag instead. */
.lang-switch .lang-flag.flag-en {
  background: #012169 url("data:image/svg+xml;utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 60 30' preserveAspectRatio='none'%3E%3Cpath d='M0,0 L60,30 M60,0 L0,30' stroke='%23fff' stroke-width='6'/%3E%3Cpath d='M0,0 L60,30 M60,0 L0,30' stroke='%23C8102E' stroke-width='2'/%3E%3Cpath d='M30,0 V30 M0,15 H60' stroke='%23fff' stroke-width='10'/%3E%3Cpath d='M30,0 V30 M0,15 H60' stroke='%23C8102E' stroke-width='6'/%3E%3C/svg%3E") center/cover no-repeat;
}

/* CTA "Try it" button — distinct from nav (action, not reading).
   Fixed min-width so button (and the lang-switch left of it) don't
   shift between UA "Спробувати →" and EN "Try it →". */
.btn-cta-try {
  background: linear-gradient(135deg, var(--green-500) 0%, var(--teal) 100%);
  color: white; padding: 11px 22px; border-radius: 7px;
  font-weight: 600; font-size: 15px; text-decoration: none;
  font-family: var(--font-sans); border: none;
  box-shadow: 0 1px 0 rgba(255,255,255,.2) inset, 0 1px 4px rgba(0,0,0,.15);
  transition: transform .12s, box-shadow .12s, filter .12s;
  white-space: nowrap;
  min-width: 180px; box-sizing: border-box; text-align: center;
  display: inline-block;
}
.btn-cta-try:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 0 rgba(255,255,255,.2) inset, 0 3px 8px rgba(0,0,0,.2);
  filter: brightness(1.05);
}
.btn-cta-try[aria-current="page"] {
  outline: 2px solid white; outline-offset: 1px;
}

@media (max-width: 700px) {
  .top-bar { flex-wrap: wrap; gap: 8px; }
  .brand-line { margin-right: 0; }
  .brand-mini { font-size: 22px; }
  .top-nav { order: 3; flex-basis: 100%; margin: 0; justify-content: center; }
  .top-right { gap: 8px; }
  .lang-switch { font-size: 10px; }
  .lang-switch .lang-current,
  .lang-switch .lang-other { width: 48px; padding: 4px 6px; }
  .btn-cta-try { padding: 8px 14px; font-size: 13px; min-width: 140px; }
}

/* Hero */
.hero {
  background:
    radial-gradient(ellipse at top left, var(--green-100) 0%, transparent 55%),
    radial-gradient(ellipse at bottom right, #ccfbf1 0%, transparent 55%),
    var(--gray-50);
  padding: 60px 24px 50px;
  margin: 0 -24px;
}
.hero-content { max-width: 880px; margin: 0 auto; }
.eyebrow {
  font-family: var(--font-mono); font-size: 11px; letter-spacing: 1.5px;
  text-transform: uppercase; color: var(--green-700); margin-bottom: 16px;
}
.hero h1 {
  font-family: var(--font-display); font-weight: 700; font-size: 44px;
  line-height: 1.12; color: var(--green-900); margin-bottom: 20px;
}
.hero-sub {
  font-size: 18px; color: var(--gray-700); max-width: 720px;
  margin-bottom: 28px;
}
.cta-row { display: flex; gap: 12px; flex-wrap: wrap; }
.btn {
  display: inline-block; padding: 12px 22px; border-radius: 8px;
  font-weight: 600; font-size: 15px; text-decoration: none;
  font-family: var(--font-sans); cursor: pointer; border: none;
}
.btn-primary { background: var(--green-700); color: white; }
.btn-primary:hover { background: var(--green-600); }
.btn-secondary {
  background: white; color: var(--green-700);
  border: 1px solid var(--gray-200);
}
.btn-secondary:hover { border-color: var(--green-600); }
.hero-corpus {
  margin-top: 32px; padding: 18px 22px;
  background: white; border-radius: 12px;
  border: 1px solid var(--green-100);
  box-shadow: 0 4px 14px rgba(10, 46, 26, 0.05);
  display: flex; gap: 22px; align-items: center;
  max-width: 720px;
}
.hcorpus-num {
  font-family: var(--font-display); font-size: 56px;
  color: var(--green-700); line-height: 1;
  flex-shrink: 0;
}
.hcorpus-text {
  font-size: 14.5px; color: var(--gray-700);
  line-height: 1.55;
}
.hcorpus-text strong { color: var(--green-900); }
.hero-meta {
  margin-top: 24px; font-size: 12px; color: var(--gray-500);
  font-family: var(--font-mono);
}

/* Numbers */
.numbers { padding: 50px 0 30px; }
.numbers h2, .problem h2, .how h2, .gallery h1, .try-page h1 {
  font-family: var(--font-display); font-size: 30px;
  color: var(--green-900); margin-bottom: 24px;
}
.numbers-lead {
  font-size: 15px; color: var(--gray-700); margin-bottom: 24px;
  max-width: 880px;
}
.num-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 12px;
}
.num-grid--rich {
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}
.num-card {
  background: white; border: 1px solid var(--gray-200); border-radius: 10px;
  padding: 20px 18px; border-top: 3px solid var(--green-600);
  display: flex; flex-direction: column;
}
.num-card--accent { border-top-color: var(--teal); background: linear-gradient(180deg, var(--green-50) 0%, white 40%); }
.num-big {
  font-family: var(--font-display); font-size: 38px; line-height: 1;
  color: var(--green-900);
}
.num-lbl {
  font-size: 14px; color: var(--gray-900); margin-top: 6px;
  font-weight: 700;
}
.num-detail {
  font-family: var(--font-mono); font-size: 11px; color: var(--gray-500);
  margin-top: 4px;
}
.num-text {
  font-size: 13px; color: var(--gray-700); margin-top: 10px;
  line-height: 1.5;
}
.num-text code {
  font-family: var(--font-mono); font-size: 11px;
  background: var(--gray-100); padding: 1px 5px; border-radius: 3px;
}
.num-text em { font-style: normal; font-family: var(--font-mono); font-size: 12px; color: var(--green-700); }
.num-foot {
  font-size: 13px; color: var(--gray-700); margin-top: 18px;
  padding: 14px 16px; background: var(--amber-bg);
  border-left: 3px solid var(--amber); border-radius: 4px;
}
.num-foot code { font-family: var(--font-mono); font-size: 12px; }

/* Problem */
.problem { padding: 30px 0; }
.problem-text {
  font-size: 16px; color: var(--gray-700); max-width: 880px;
  line-height: 1.65;
}

/* How it works */
.how { padding: 30px 0; }
.how-lead {
  font-size: 15px; color: var(--gray-700); max-width: 880px;
  margin-bottom: 22px;
}

/* Trust strip — sits above the data flow, sets AI/LLM expectations up front. */
.trust-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 10px;
  margin: 22px 0 18px;
}
.trust-pill {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px 14px; border-radius: 8px;
  font-size: 13.5px; line-height: 1.45;
  border: 1px solid var(--gray-200);
  background: white;
}
.trust-pill--no { border-left: 3px solid var(--red); }
.trust-pill--yes { border-left: 3px solid var(--green-600); background: var(--green-50); }
.trust-pill-mark {
  font-family: var(--font-mono); font-weight: 700;
  width: 22px; height: 22px; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%; font-size: 14px;
}
.trust-pill--no .trust-pill-mark { background: var(--red-bg); color: var(--red); }
.trust-pill--yes .trust-pill-mark { background: var(--green-100); color: var(--green-700); }
.trust-pill-text { color: var(--gray-700); }
.trust-pill-text strong { color: var(--gray-900); }

/* Data flow — replaces the prior MDT figure. Four stages on a dark backdrop
   so the open-standards / biomarker chips read as live data, not decoration. */
.dataflow {
  display: grid;
  grid-template-columns: 1fr auto 1fr auto 1fr auto 1fr;
  gap: 0; align-items: stretch;
  background: linear-gradient(135deg, #0a2e1a 0%, #0d3f24 60%, #0f4d2c 100%);
  padding: 26px 22px; border-radius: 12px;
  margin: 0 0 28px;
  box-shadow: 0 1px 0 rgba(0,0,0,.04);
}
.dataflow-stage {
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(220,252,231,.10);
  border-radius: 10px;
  padding: 16px 14px;
  color: var(--green-100);
  display: flex; flex-direction: column; gap: 9px;
  min-width: 0;
}
.dataflow-stage[data-stage="1"] { border-top: 3px solid var(--teal); }
.dataflow-stage[data-stage="2"] { border-top: 3px solid #38bdf8; }
.dataflow-stage[data-stage="3"] { border-top: 3px solid var(--amber); }
.dataflow-stage[data-stage="4"] { border-top: 3px solid var(--green-500); }
.dataflow-num {
  font-family: var(--font-mono); font-size: 10.5px;
  color: var(--green-100); opacity: .55; letter-spacing: 1px;
}
.dataflow-title {
  font-family: var(--font-display); font-size: 17px;
  color: white; line-height: 1.25;
}
.dataflow-body {
  font-size: 12.5px; line-height: 1.5;
  color: rgba(220,252,231,.85);
}
.dataflow-body strong { color: white; }
.dataflow-arrow {
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; color: var(--green-100); opacity: .35;
  padding: 0 4px; user-select: none;
}
.biomarker-row, .std-row {
  display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px;
}
.biomarker {
  font-family: var(--font-mono); font-size: 10.5px;
  background: rgba(220,38,38,.18); color: #fecaca;
  border: 1px solid rgba(252,165,165,.30);
  padding: 2px 7px; border-radius: 3px; letter-spacing: 0.3px;
}
.std-pill {
  font-family: var(--font-mono); font-size: 10.5px;
  background: rgba(13,148,136,.22); color: #99f6e4;
  border: 1px solid rgba(94,234,212,.30);
  padding: 2px 7px; border-radius: 3px; letter-spacing: 0.3px;
}
.flow-list { list-style: none; padding: 0; margin: 4px 0 0; font-size: 12.5px; }
.flow-list li {
  display: flex; align-items: baseline; gap: 8px;
  padding: 3px 0; color: rgba(220,252,231,.85);
}
.rf-tag {
  font-family: var(--font-mono); font-size: 9.5px; font-weight: 600;
  padding: 1px 6px; border-radius: 3px; flex-shrink: 0;
  letter-spacing: 0.5px;
}
.rf-tag.rf-red { background: var(--red); color: white; }
.rf-tag.rf-amber { background: var(--amber); color: white; }
.rf-tag.rf-teal { background: var(--teal); color: white; }

@media (max-width: 980px) {
  .dataflow { grid-template-columns: 1fr; padding: 18px 14px; }
  .dataflow-arrow { transform: rotate(90deg); padding: 6px 0; font-size: 18px; }
}

/* Why-today CTA block — closes the section with concrete reasons + CTA. */
.why-today {
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: 12px;
  padding: 26px 24px;
}
.why-today-h {
  font-family: var(--font-display); font-size: 24px;
  color: var(--green-900); margin-bottom: 16px; line-height: 1.2;
}
.why-today-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}
.why-card {
  background: var(--green-50);
  border-left: 3px solid var(--green-600);
  padding: 13px 15px; border-radius: 6px;
}
.why-card-h {
  font-weight: 600; color: var(--green-900);
  font-size: 14.5px; margin-bottom: 5px;
}
.why-card p {
  font-size: 13px; color: var(--gray-700); line-height: 1.5;
}
.why-card p strong { color: var(--green-900); }
.why-today-foot {
  font-size: 14px; color: var(--gray-700);
  line-height: 1.6; margin-bottom: 18px;
  background: var(--red-bg);
  border-left: 3px solid var(--red);
  border-radius: 0 4px 4px 0;
  padding: 12px 14px;
}

/* Gallery */
.gallery { padding: 32px 0; }
.gallery .lead {
  font-size: 15px; color: var(--gray-700); margin-bottom: 20px;
  max-width: 760px;
}
.case-controls {
  display: flex; flex-wrap: wrap; align-items: center;
  gap: 16px; margin-bottom: 22px;
}
.case-chips {
  display: flex; flex-wrap: wrap; gap: 8px; flex: 1 1 auto;
}
.case-chip {
  font: inherit; font-size: 13px;
  padding: 6px 12px; border-radius: 999px;
  border: 1px solid var(--gray-200);
  background: white; color: var(--gray-700);
  cursor: pointer;
  transition: border-color .15s, background .15s, color .15s;
}
.case-chip:hover { border-color: var(--green-600); color: var(--green-900); }
.case-chip.is-active {
  background: var(--green-100); border-color: var(--green-600);
  color: var(--green-900);
}
.case-chip .chip-n {
  font-family: var(--font-mono); font-size: 11px;
  color: var(--gray-500); margin-left: 4px;
}
.case-chip.is-active .chip-n { color: var(--green-700); }
.case-sort {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 13px; color: var(--gray-700);
}
.case-sort select {
  font: inherit; font-size: 13px;
  padding: 5px 8px; border-radius: 6px;
  border: 1px solid var(--gray-200);
  background: white; color: var(--gray-900);
  cursor: pointer;
}
.case-empty {
  padding: 40px 0; text-align: center;
  color: var(--gray-500); font-size: 14px;
}
.case-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px; margin-bottom: 36px;
}
.case-card {
  display: block; background: white; border-radius: 10px;
  border: 1px solid var(--gray-200); padding: 18px;
  text-decoration: none; color: var(--gray-900);
  transition: border-color .15s, box-shadow .15s, transform .15s;
}
.case-card:hover {
  border-color: var(--green-600);
  box-shadow: 0 6px 16px rgba(10, 46, 26, .07);
  transform: translateY(-1px);
}
.case-badge-row {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
  margin-bottom: 10px;
}
.case-badge {
  display: inline-block; font-family: var(--font-mono);
  font-size: 10px; letter-spacing: 1px; text-transform: uppercase;
  padding: 3px 8px; border-radius: 4px;
}
.case-json-only {
  display: inline-block; font-family: var(--font-mono);
  font-size: 9.5px; letter-spacing: 0.6px;
  padding: 2px 7px; border-radius: 3px;
  background: var(--gray-100); color: var(--gray-500);
  cursor: help;
}
.bdg-plan { background: var(--green-100); color: var(--green-700); }
.bdg-diag { background: var(--amber-bg); color: var(--amber); }
.case-card h3 {
  font-family: var(--font-display); font-size: 18px;
  color: var(--green-900); margin-bottom: 8px; line-height: 1.25;
}
.case-card p { font-size: 13px; color: var(--gray-700); }
.case-foot {
  margin-top: 12px; font-family: var(--font-mono);
  font-size: 11px; color: var(--gray-500);
}

.kb-stats { margin-top: 16px; }

/* Try page */
.try-page { padding: 32px 0; }
.try-page .lead {
  font-size: 15px; color: var(--gray-700); margin-bottom: 24px;
  max-width: 800px;
}
.try-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 20px;
  align-items: start;
}
.try-input label {
  display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px;
  font-size: 12px; text-transform: uppercase; letter-spacing: 0.5px;
  color: var(--gray-700); font-weight: 600;
}
.try-input select, .try-input textarea {
  font-family: var(--font-mono); font-size: 13px;
  padding: 10px 12px; border: 1px solid var(--gray-200);
  border-radius: 6px; background: white;
}
.try-input textarea {
  width: 100%; resize: vertical; line-height: 1.45;
  min-height: 380px;
}
.try-input select { width: 100%; }
.try-input select:focus, .try-input textarea:focus {
  outline: 2px solid var(--green-600); outline-offset: 0;
  border-color: var(--green-600);
}
.try-actions { display: flex; gap: 8px; margin-top: 8px; }
.status {
  font-family: var(--font-mono); font-size: 12px; color: var(--gray-700);
  padding: 8px 12px; min-height: 32px; margin-top: 12px;
  background: var(--gray-50); border-radius: 4px;
  border-left: 3px solid var(--gray-200);
}
.status[data-kind="ok"] {
  background: var(--green-50); border-left-color: var(--green-500);
  color: var(--green-800);
}
.status[data-kind="warn"] {
  background: #fff8e1; border-left-color: #f59e0b;
  color: #92400e;
}
.error {
  font-family: var(--font-mono); font-size: 12px; color: var(--red);
  background: var(--red-bg); padding: 10px 12px; border-radius: 4px;
  margin-top: 10px; white-space: pre-wrap;
  border-left: 3px solid var(--red);
}
.try-output {
  background: white; border: 1px solid var(--gray-200);
  border-radius: 10px; min-height: 600px;
  display: flex; flex-direction: column; overflow: hidden;
}
.placeholder {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 40px; text-align: center; color: var(--gray-500);
}
.placeholder-icon {
  font-size: 48px; color: var(--green-600); margin-bottom: 16px;
  font-family: var(--font-display);
}
#resultFrame {
  flex: 1; width: 100%; height: 800px; border: none;
}

/* Result toolbar (PDF + lang switcher) — appears above #resultFrame
   once a Plan / DiagnosticBrief is rendered. */
.result-toolbar {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 12px; padding: 10px 14px; background: var(--gray-50);
  border: 1px solid var(--gray-200); border-bottom: none;
  border-top-left-radius: 10px; border-top-right-radius: 10px;
}
.rt-btn {
  font-family: var(--font-sans); font-size: 13px; font-weight: 600;
  background: var(--green-700); color: white;
  border: none; border-radius: 6px; padding: 8px 14px;
  cursor: pointer; transition: background 0.15s;
}
.rt-btn:hover { background: var(--green-800); }
.rt-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.rt-lang-group {
  display: flex; align-items: center; gap: 6px;
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px;
  color: var(--gray-700); font-weight: 600;
}
.rt-lang-label { margin-right: 2px; }
.rt-lang-btn {
  font-family: var(--font-mono); font-size: 11px; font-weight: 600;
  letter-spacing: 0.5px;
  background: white; color: var(--gray-700);
  border: 1px solid var(--gray-200); border-radius: 4px;
  padding: 5px 10px; cursor: pointer; transition: all 0.15s;
}
.rt-lang-btn:hover { background: var(--gray-100); }
.rt-lang-btn.is-active {
  background: var(--green-700); color: white; border-color: var(--green-700);
}
.rt-lang-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* Questionnaire UI (try.html) */
.quest-toolbar {
  display: flex; gap: 16px; align-items: flex-end; margin: 18px 0 14px;
  flex-wrap: wrap; padding: 14px 18px; background: white;
  border: 1px solid var(--gray-200); border-radius: 10px;
}
.qt-label {
  display: flex; flex-direction: column; gap: 4px; min-width: 220px;
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px;
  color: var(--gray-700); font-weight: 600;
}
.qt-label select, .qt-label input, .qt-label textarea {
  font-family: var(--font-sans); font-size: 13px;
  padding: 8px 10px; border: 1px solid var(--gray-200);
  border-radius: 6px; background: white;
  text-transform: none; letter-spacing: normal; font-weight: 400;
  color: var(--gray-900);
}
.qt-spacer { flex: 1; }
.qt-modes {
  display: inline-flex; border: 1px solid var(--gray-200);
  border-radius: 7px; overflow: hidden; background: var(--gray-50);
}
.mode-btn {
  background: transparent; color: var(--gray-700); border: none;
  padding: 8px 14px; font-size: 12.5px; cursor: pointer;
  font-family: var(--font-sans); font-weight: 600;
}
.mode-btn.active {
  background: var(--green-700); color: white;
}
.qt-reset {
  padding: 8px 14px; font-size: 12.5px;
}
.quest-grid {
  display: grid; grid-template-columns: 1fr 380px; gap: 18px;
  margin-bottom: 24px; align-items: start;
}
.quest-form-pane {
  background: white; border: 1px solid var(--gray-200);
  border-radius: 10px; padding: 20px 22px;
}
#jsonPane textarea { width: 100%; font-family: var(--font-mono); }
.quest-empty {
  text-align: center; color: var(--gray-500); padding: 60px 20px;
  font-size: 14px;
}
.quest-intro {
  background: var(--green-50); border-left: 3px solid var(--green-600);
  padding: 12px 16px; border-radius: 4px; margin-bottom: 18px;
  font-size: 13.5px; color: var(--gray-700); line-height: 1.55;
}
.quest-group {
  border-top: 1px solid var(--gray-100); padding-top: 18px; margin-top: 18px;
}
.quest-group:first-child { border-top: none; padding-top: 0; margin-top: 0; }
.quest-group h3 {
  font-family: var(--font-display); font-size: 17px;
  color: var(--green-900); margin-bottom: 4px;
}
.quest-group-desc {
  font-size: 12.5px; color: var(--gray-500); margin-bottom: 12px;
}
.quest-q {
  margin: 14px 0; padding: 12px 14px;
  background: var(--gray-50); border-radius: 6px;
  border-left: 2px solid var(--gray-200);
}
.quest-q-head {
  display: flex; justify-content: space-between; align-items: flex-start;
  margin-bottom: 6px; gap: 12px;
}
.quest-q-label {
  font-weight: 600; font-size: 13.5px; color: var(--gray-900); flex: 1;
}
.quest-q input[type="number"], .quest-q input[type="text"], .quest-q select {
  width: 100%; max-width: 320px; padding: 7px 10px;
  border: 1px solid var(--gray-200); border-radius: 5px;
  font-family: var(--font-sans); font-size: 13px; background: white;
}
.quest-q input:focus, .quest-q select:focus {
  outline: 2px solid var(--green-600); outline-offset: 0;
  border-color: var(--green-600);
}
.quest-units {
  display: inline-block; margin-left: 8px; font-size: 12px;
  color: var(--gray-500); font-family: var(--font-mono);
}
.quest-helper {
  font-size: 12px; color: var(--gray-500);
  margin-top: 6px; line-height: 1.45;
}
.quest-triggers {
  display: flex; flex-wrap: wrap; gap: 4px; margin-top: 8px;
}
.trigger-pill {
  font-family: var(--font-mono); font-size: 10px;
  background: var(--green-100); color: var(--green-700);
  padding: 2px 6px; border-radius: 3px; letter-spacing: 0.3px;
}
.impact-pill {
  display: inline-block; font-family: var(--font-mono); font-size: 9.5px;
  letter-spacing: 0.6px; padding: 2px 7px; border-radius: 3px;
  text-transform: uppercase; font-weight: 600;
}
.impact-critical { background: var(--red-bg); color: var(--red); }
.impact-required { background: var(--amber-bg); color: var(--amber); }
.impact-recommended { background: var(--green-100); color: var(--green-700); }
.impact-optional { background: var(--gray-100); color: var(--gray-500); }

.quest-q[data-impact="critical"] {
  border-left: 4px solid var(--red);
  background: linear-gradient(to right, color-mix(in srgb, var(--red) 6%, var(--gray-50)), var(--gray-50) 60%);
}
.quest-q[data-impact="required"] {
  border-left: 4px solid var(--amber);
  background: linear-gradient(to right, color-mix(in srgb, var(--amber) 6%, var(--gray-50)), var(--gray-50) 60%);
}
.quest-q[data-impact="recommended"] { border-left: 3px solid var(--green-600); }

.quest-whatif {
  margin-top: 10px; padding: 8px 10px;
  background: white; border: 1px dashed var(--gray-200);
  border-left: 3px solid var(--green-600);
  border-radius: 4px;
  font-size: 12px;
}
.quest-whatif .whatif-head {
  font-family: var(--font-mono); font-size: 10px;
  text-transform: uppercase; letter-spacing: 0.6px;
  color: var(--green-700); font-weight: 600; margin-bottom: 5px;
}
.quest-whatif ul { list-style: none; padding: 0; margin: 0; }
.quest-whatif li {
  color: var(--gray-700); margin: 3px 0;
  line-height: 1.5;
}
.quest-whatif .whatif-alt {
  font-weight: 600; color: var(--gray-900); margin-right: 4px;
}
.quest-whatif code {
  font-size: 11px; padding: 1px 5px; background: var(--gray-100);
  border-radius: 3px; color: var(--green-900);
}
.quest-whatif .wf-add { color: var(--red); font-weight: 600; }
.quest-whatif .wf-rm { color: var(--gray-500); font-weight: 600; }

/* Locked state — fields pre-filled from a loaded example. Visually
   muted but legible; the user opts in to editing via the personalize
   button which removes .locked from every wrapper. */
.quest-q.locked {
  opacity: 0.78;
}
.quest-q.locked input,
.quest-q.locked select,
.quest-q.locked textarea {
  background: var(--gray-100); color: var(--gray-700);
  cursor: not-allowed;
}
.quest-q.locked .quest-q-label::after {
  content: " 🔒"; font-size: 11px; opacity: 0.6;
}

.example-lock-banner {
  display: flex; gap: 14px; align-items: center; justify-content: space-between;
  background: var(--green-50); border: 1px solid var(--green-600);
  border-left: 4px solid var(--green-600);
  padding: 12px 16px; border-radius: 6px; margin-bottom: 18px;
}
.example-lock-banner .elb-text {
  font-size: 13px; line-height: 1.5; color: var(--gray-700); flex: 1;
}
.example-lock-banner .elb-btn {
  white-space: nowrap; flex-shrink: 0;
}

.quest-side {
  position: sticky; top: 20px;
  display: flex; flex-direction: column; gap: 12px;
}
.quest-impact-card {
  background: white; border: 1px solid var(--gray-200);
  border-radius: 10px; padding: 18px 20px;
}
.quest-impact-card h3 {
  font-family: var(--font-display); font-size: 18px;
  color: var(--green-900); margin-bottom: 14px;
}
.impact-progress { margin-bottom: 16px; }
.impact-bar {
  background: var(--gray-100); height: 8px; border-radius: 4px;
  overflow: hidden; margin-bottom: 6px;
}
.impact-bar-fill {
  background: linear-gradient(90deg, var(--green-500), var(--green-600));
  height: 100%; width: 0%; transition: width .3s ease;
}
.impact-stats {
  display: flex; justify-content: space-between; font-size: 12px;
  color: var(--gray-700); font-family: var(--font-mono);
}
.impact-pct { font-weight: 700; color: var(--green-700); }
.impact-section { margin: 14px 0; padding-top: 12px; border-top: 1px solid var(--gray-100); }
.impact-section h4 {
  font-size: 12px; text-transform: uppercase; letter-spacing: 0.5px;
  color: var(--gray-700); margin-bottom: 8px; font-weight: 700;
}
.impact-section ul { list-style: none; padding: 0; }
.impact-section li {
  font-size: 12.5px; color: var(--gray-900); margin: 4px 0;
  line-height: 1.4;
}
.impact-section .muted { color: var(--gray-500); font-style: italic; }
.impact-section code {
  font-family: var(--font-mono); font-size: 11px;
  background: var(--gray-100); padding: 1px 5px; border-radius: 3px;
  color: var(--green-800);
}

/* P4: enriched fired-RF item — shows id + direction + definition + sources. */
.rf-fired-item {
  background: var(--green-50); border-left: 3px solid var(--green-600);
  border-radius: 4px; padding: 8px 10px; margin: 6px 0 !important;
}
.rf-fired-head {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  margin-bottom: 4px;
}
.rf-fired-head code {
  font-size: 10.5px;
}
.rf-dir {
  font-family: var(--font-mono); font-size: 9.5px; letter-spacing: 0.5px;
  padding: 1px 6px; border-radius: 3px; text-transform: uppercase;
  font-weight: 600;
}
.rf-dir-hold        { background: var(--red-bg, #fef2f2); color: var(--red, #b91c1c); }
.rf-dir-intensify   { background: var(--amber-bg, #fef3c7); color: var(--amber, #b45309); }
.rf-dir-de-escalate { background: var(--gray-100); color: var(--gray-700); }
.rf-dir-investigate { background: var(--gray-100); color: var(--gray-500); }
.rf-fired-defn {
  font-size: 11.5px; color: var(--gray-700); line-height: 1.45;
  margin-bottom: 4px;
}
.rf-fired-srcs { display: flex; flex-wrap: wrap; gap: 3px; }
.rf-src-chip {
  font-family: var(--font-mono); font-size: 9.5px;
  background: var(--gray-100); color: var(--gray-700);
  padding: 1px 5px; border-radius: 3px;
}
.quest-cta {
  margin-top: 6px; display: flex; flex-direction: column; gap: 8px;
}
.quest-cta button { width: 100%; }
.quest-cta button:disabled {
  opacity: 0.5; cursor: not-allowed;
}

/* Plan result modal — replaces the old in-page .quest-output section so
   the form stays the focus of the page and the rendered plan only shows
   when the user wants to look at it. */
.plan-modal {
  position: fixed; inset: 0; z-index: 9995;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(2px);
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  animation: oo-fadein 0.18s ease-out;
}
.plan-modal[hidden] { display: none; }
.plan-modal-card {
  background: white; border-radius: 12px;
  width: min(1000px, 100%); height: min(880px, 92vh);
  display: flex; flex-direction: column; overflow: hidden;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.35);
}
.plan-modal-toolbar {
  display: flex; flex-wrap: wrap; align-items: center;
  justify-content: space-between; gap: 12px;
  padding: 10px 14px; background: var(--gray-50);
  border-bottom: 1px solid var(--gray-200);
}
.plan-modal-actions { display: flex; gap: 8px; align-items: center; }
.plan-modal-card #resultFrame {
  flex: 1; width: 100%; border: none; background: white;
}
.rt-btn-ghost {
  background: white !important; color: var(--gray-700) !important;
  border: 1px solid var(--gray-200) !important;
  font-weight: 700; padding: 6px 10px;
}
.rt-btn-ghost:hover {
  background: var(--gray-100) !important; color: var(--green-700) !important;
}

@media (max-width: 900px) {
  .quest-grid { grid-template-columns: 1fr; }
  .quest-side { position: static; }
}
@media (max-width: 800px) {
  .hero h1 { font-size: 32px; }
  .problem-grid, .try-grid { grid-template-columns: 1fr; }
}

/* Generation lock — overlay modal during full-plan generation. Hard-blocks
   form interaction (via inert on <main>) so the rendered plan corresponds
   to a stable input snapshot. Released in runEngine's finally{{}}. */
.generating-overlay {{
  position: fixed; inset: 0; z-index: 9999;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(2px);
  display: flex; align-items: center; justify-content: center;
  animation: oo-fadein 0.18s ease-out;
}}
.generating-overlay[hidden] {{ display: none; }}
.generating-card {{
  background: white; border-radius: 12px;
  padding: 28px 36px; max-width: 460px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
  text-align: center;
}}
.generating-card h3 {{
  margin: 14px 0 8px; font-family: var(--font-display);
  font-size: 22px; color: var(--green-900);
}}
.generating-card p {{
  margin: 6px 0; font-size: 14px; color: var(--gray-700); line-height: 1.5;
}}
.generating-hint {{
  font-size: 12px; color: var(--gray-600);
  font-family: var(--font-mono); margin-top: 14px;
}}
.generating-spinner {{
  width: 36px; height: 36px; margin: 0 auto;
  border: 3px solid var(--gray-200); border-top-color: var(--green-700);
  border-radius: 50%; animation: oo-spin 0.9s linear infinite;
}}
@keyframes oo-spin {{ to {{ transform: rotate(360deg); }} }}
@keyframes oo-fadein {{ from {{ opacity: 0; }} to {{ opacity: 1; }} }}

/* Init overlay — first-run engine load with named stages so the doctor
   sees what's happening instead of mystery lag. Lower z-index than the
   generating overlay so a generate-click re-uses init for first run, and
   subsequent clicks use the lighter generating overlay. */
.init-overlay {{
  position: fixed; inset: 0; z-index: 9990;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(2px);
  display: flex; align-items: center; justify-content: center;
  animation: oo-fadein 0.18s ease-out;
}}
.init-overlay[hidden] {{ display: none; }}
.init-card {{
  background: white; border-radius: 12px;
  padding: 28px 36px; max-width: 540px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
}}
.init-card h3 {{
  margin: 0 0 6px; font-family: var(--font-display);
  font-size: 22px; color: var(--green-900);
}}
.init-lead {{
  margin: 0 0 18px; font-size: 13px; color: var(--gray-700); line-height: 1.5;
}}
.init-stages {{
  list-style: none; padding: 0; margin: 0 0 14px;
  display: flex; flex-direction: column; gap: 6px;
  counter-reset: none;
}}
.init-stages .stage {{
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px; border-radius: 8px;
  background: var(--gray-100);
  font-size: 14px; color: var(--gray-700);
  transition: background 0.18s, color 0.18s;
}}
.init-stages .stage::before {{
  content: '○'; color: var(--gray-400); font-size: 16px;
  width: 20px; text-align: center; flex-shrink: 0;
  font-family: var(--font-mono);
}}
.init-stages .stage.active {{
  background: white; color: var(--green-900);
  border: 1px solid var(--green-700); font-weight: 500;
}}
.init-stages .stage.active::before {{
  content: '⟳'; color: var(--green-700);
  display: inline-block;
  animation: oo-spin 0.9s linear infinite;
}}
.init-stages .stage.done {{
  color: var(--gray-700);
}}
.init-stages .stage.done::before {{
  content: '✓'; color: var(--green-700); font-weight: bold;
}}
.init-stages .stage.error {{
  background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5;
}}
.init-stages .stage.error::before {{
  content: '✗'; color: #dc2626;
}}
.init-hint {{
  margin: 0; font-size: 12px; color: var(--gray-600);
  font-style: italic; line-height: 1.5;
}}

/* Info pages (capabilities / limitations) */
.info-page { padding: 32px 0 48px; }
.info-page h1 {
  font-family: var(--font-display); font-size: 36px;
  color: var(--green-900); margin-bottom: 10px;
}
.info-page .lead {
  font-size: 16px; color: var(--gray-700); max-width: 820px;
  margin-bottom: 28px; line-height: 1.6;
}
.info-section { margin-top: 36px; }
.info-section h2 {
  font-family: var(--font-display); font-size: 24px;
  color: var(--green-900); margin-bottom: 14px;
}
.info-section p { font-size: 14.5px; color: var(--gray-700); margin-bottom: 12px; }
.info-section .info-text {
  max-width: 820px; line-height: 1.6;
}
.flow-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 10px; margin: 18px 0;
}
.flow-step {
  background: white; border: 1px solid var(--gray-200);
  border-radius: 10px; padding: 14px 14px;
  border-top: 3px solid var(--green-600);
}
.flow-step .flow-num {
  font-family: var(--font-mono); font-size: 11px;
  color: var(--green-700); margin-bottom: 6px;
  letter-spacing: 1px; text-transform: uppercase;
}
.flow-step .flow-title {
  font-weight: 700; font-size: 14px;
  color: var(--gray-900); margin-bottom: 6px;
  font-family: var(--font-display);
}
.flow-step .flow-desc {
  font-size: 12.5px; color: var(--gray-700); line-height: 1.45;
}
.flow-step code {
  font-family: var(--font-mono); font-size: 11px;
  background: var(--gray-100); padding: 1px 5px; border-radius: 3px;
}

/* Promotional infographic hero (capabilities page) */
.promo-info {
  margin: 28px 0 36px;
  padding: 32px 32px 28px;
  background:
    radial-gradient(circle at 0% 0%, rgba(22, 163, 74, 0.18), transparent 55%),
    radial-gradient(circle at 100% 100%, rgba(13, 148, 136, 0.18), transparent 55%),
    linear-gradient(135deg, var(--green-900) 0%, var(--green-800) 60%, #082017 100%);
  border-radius: 14px;
  color: #e9f5ec;
  box-shadow: 0 12px 32px rgba(10, 46, 26, 0.18);
  position: relative; overflow: hidden;
}
.promo-info::before {
  content: ""; position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.04) 1px, transparent 1px);
  background-size: 28px 28px;
  pointer-events: none; opacity: 0.5;
}
.promo-info > * { position: relative; }
.promo-eyebrow {
  font-family: var(--font-mono); font-size: 11px; letter-spacing: 2px;
  text-transform: uppercase; color: #6ee7b7; opacity: 0.85;
  margin-bottom: 10px;
}
.promo-headline {
  font-family: var(--font-display); font-weight: 700;
  font-size: 34px; line-height: 1.18; color: white;
  margin-bottom: 14px; max-width: 880px;
}
.promo-headline em {
  font-style: normal; color: #6ee7b7;
  background: linear-gradient(120deg, #6ee7b7 0%, #5eead4 100%);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
.promo-sub {
  font-size: 15px; line-height: 1.55; color: #c5e0cd;
  max-width: 780px; margin-bottom: 26px;
}
.promo-sub strong { color: white; font-weight: 600; }

.promo-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(145px, 1fr));
  gap: 14px; margin-bottom: 26px;
  padding: 18px 0; border-top: 1px solid rgba(255,255,255,0.12);
  border-bottom: 1px solid rgba(255,255,255,0.12);
}
.promo-stat { text-align: left; }
.promo-stat-num {
  font-family: var(--font-display); font-weight: 900;
  font-size: 38px; line-height: 1; color: white;
  letter-spacing: -0.02em;
}
.promo-stat-num .promo-stat-plus { color: #6ee7b7; font-weight: 700; }
.promo-stat-lbl {
  font-size: 12px; line-height: 1.4; color: #a7c7b1;
  margin-top: 6px; text-transform: uppercase; letter-spacing: 0.6px;
  font-weight: 500;
}

.promo-flow {
  display: grid;
  grid-template-columns: 1fr auto 1fr auto 1.2fr;
  gap: 12px; align-items: stretch;
  margin-bottom: 26px;
}
.promo-flow-card {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(110, 231, 183, 0.22);
  border-radius: 10px; padding: 14px 16px;
  backdrop-filter: blur(2px);
}
.promo-flow-card.is-output {
  background: linear-gradient(135deg, rgba(110,231,183,0.16), rgba(94,234,212,0.10));
  border-color: rgba(110, 231, 183, 0.45);
}
.promo-flow-tag {
  font-family: var(--font-mono); font-size: 10px; letter-spacing: 1.2px;
  text-transform: uppercase; color: #6ee7b7; margin-bottom: 6px;
}
.promo-flow-title {
  font-family: var(--font-display); font-weight: 700;
  font-size: 17px; color: white; line-height: 1.2; margin-bottom: 6px;
}
.promo-flow-desc {
  font-size: 12.5px; line-height: 1.45; color: #b8d3c0;
}
.promo-flow-desc code {
  font-family: var(--font-mono); font-size: 10.5px;
  background: rgba(255,255,255,0.08); color: #e9f5ec;
  padding: 1px 5px; border-radius: 3px;
}
.promo-flow-arrow {
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-size: 26px;
  color: #6ee7b7; opacity: 0.7; font-weight: 400;
}
.promo-flow-tracks {
  display: flex; gap: 6px; margin-top: 8px;
}
.promo-flow-track {
  flex: 1; padding: 6px 8px; border-radius: 4px;
  font-size: 11px; color: #e9f5ec;
  background: rgba(255,255,255,0.10);
  border-left: 2px solid #6ee7b7;
}
.promo-flow-track.is-alt { border-left-color: #5eead4; opacity: 0.85; }
.promo-flow-track-label {
  font-family: var(--font-mono); font-size: 9px; letter-spacing: 0.8px;
  text-transform: uppercase; color: #6ee7b7; display: block;
}

.promo-pillars {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}
.promo-pillar {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 10px; padding: 14px 16px;
  display: flex; gap: 12px; align-items: flex-start;
}
.promo-pillar-num {
  font-family: var(--font-display); font-size: 22px; font-weight: 900;
  color: #6ee7b7; line-height: 1; flex-shrink: 0;
  min-width: 28px;
}
.promo-pillar-title {
  font-weight: 700; font-size: 13px; color: white;
  margin-bottom: 4px; letter-spacing: 0.2px;
}
.promo-pillar-desc {
  font-size: 12px; line-height: 1.45; color: #b8d3c0;
}

@media (max-width: 760px) {
  .promo-info { padding: 22px 18px; }
  .promo-headline { font-size: 26px; }
  .promo-flow {
    grid-template-columns: 1fr;
  }
  .promo-flow-arrow { transform: rotate(90deg); padding: 4px 0; }
}
@media print {
  .promo-info {
    background: white; color: var(--gray-900);
    border: 1px solid var(--green-700);
    box-shadow: none;
  }
  .promo-info::before { display: none; }
  .promo-headline, .promo-stat-num, .promo-flow-title, .promo-pillar-title { color: var(--green-900); }
  .promo-headline em { -webkit-text-fill-color: initial; color: var(--green-700); background: none; }
  .promo-eyebrow, .promo-flow-tag, .promo-pillar-num, .promo-stat-num .promo-stat-plus { color: var(--green-700); }
  .promo-sub, .promo-stat-lbl, .promo-flow-desc, .promo-pillar-desc { color: var(--gray-700); }
  .promo-flow-card, .promo-pillar { border-color: var(--gray-200); background: var(--gray-50); }
  .promo-flow-arrow { color: var(--green-700); }
  .promo-flow-track { background: white; border-left-color: var(--green-600); color: var(--gray-900); }
  .promo-flow-track-label { color: var(--green-700); }
}

.gap-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}
.gap-card {
  background: white; border: 1px solid var(--gray-200);
  border-radius: 10px; padding: 16px 18px;
  border-left: 3px solid var(--amber);
}
.gap-card .gap-tag {
  font-family: var(--font-mono); font-size: 11px;
  color: var(--amber); letter-spacing: 0.5px; text-transform: uppercase;
  margin-bottom: 6px;
}
.gap-card h3 {
  font-family: var(--font-display); font-size: 17px;
  color: var(--green-900); margin-bottom: 8px;
}
.gap-card p { font-size: 13px; color: var(--gray-700); line-height: 1.5; }
.gap-card.gap-hard { border-left-color: var(--red); }
.gap-card.gap-hard .gap-tag { color: var(--red); }
.spec-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}
.spec-card {
  background: white; border: 1px solid var(--gray-200);
  border-radius: 10px; padding: 18px 20px;
  display: flex; flex-direction: column;
  transition: border-color .15s, box-shadow .15s;
}
.spec-card:hover {
  border-color: var(--green-600);
  box-shadow: 0 4px 14px rgba(10, 46, 26, 0.06);
}
.spec-card-head {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 10px; flex-wrap: wrap;
}
.spec-tag {
  display: inline-block; color: white;
  font-family: var(--font-mono); font-size: 10px;
  letter-spacing: 0.6px; text-transform: uppercase;
  padding: 3px 8px; border-radius: 4px; font-weight: 600;
}
.spec-id {
  font-family: var(--font-mono); font-size: 11px;
  color: var(--gray-500);
}
.spec-card h3 {
  font-family: var(--font-display); font-size: 17px;
  color: var(--green-900); margin-bottom: 8px; line-height: 1.3;
}
.spec-card p {
  font-size: 13px; color: var(--gray-700);
  line-height: 1.5; flex: 1; margin-bottom: 12px;
}
.spec-card-foot {
  display: flex; gap: 14px; align-items: center;
  font-size: 12.5px; padding-top: 10px;
  border-top: 1px solid var(--gray-100);
}
.spec-card-foot a {
  color: var(--green-700); text-decoration: none; font-weight: 600;
}
.spec-card-foot a:hover { text-decoration: underline; }
.spec-card-foot .spec-raw {
  color: var(--gray-500); font-weight: 400; font-family: var(--font-mono);
  font-size: 11px;
}
.q-list {
  background: var(--green-50); border: 1px solid var(--green-100);
  border-radius: 8px; padding: 14px 18px; margin: 12px 0;
}
.q-list h4 {
  font-family: var(--font-display); font-size: 15px;
  color: var(--green-900); margin-bottom: 8px;
}
.q-list ul { padding-left: 18px; font-size: 13px; color: var(--gray-700); }
.q-list li { margin-bottom: 4px; line-height: 1.5; }
.q-list code {
  font-family: var(--font-mono); font-size: 11px;
  background: white; padding: 1px 5px; border-radius: 3px;
  color: var(--green-800);
}
.callout {
  background: var(--amber-bg); border-left: 3px solid var(--amber);
  padding: 12px 16px; border-radius: 4px; margin: 16px 0;
  font-size: 13.5px; color: var(--gray-900); line-height: 1.55;
}
.callout.callout-good {
  background: var(--green-50); border-left-color: var(--green-600);
}
.callout.callout-hard {
  background: var(--red-bg); border-left-color: var(--red);
}
.kv-table {
  width: 100%; border-collapse: collapse; font-size: 13px;
  margin-top: 10px;
}
.kv-table th, .kv-table td {
  text-align: left; padding: 8px 10px;
  border-bottom: 1px solid var(--gray-100);
}
.kv-table th {
  background: var(--gray-50); font-weight: 600;
  color: var(--gray-700); font-size: 11px;
  text-transform: uppercase; letter-spacing: 0.04em;
}
.kv-table code {
  font-family: var(--font-mono); font-size: 11px;
  background: var(--gray-100); padding: 1px 5px; border-radius: 3px;
}

/* Page footer */
.page-foot {
  margin-top: 36px; padding-top: 18px;
  border-top: 1px solid var(--gray-200);
  font-size: 12px; color: var(--gray-500);
}
.page-foot a { color: var(--green-700); }

/* ── Variant actionability — ESCAT / OncoKB tier badges ──
   Mirrored from the engine's embedded HTML render so static-site
   pages can use the same tier-badge palette without re-defining it.
   The engine HTML carries its own embedded copy (render.py _CSS) for
   self-contained Plan documents. */
.tier-badge {
  display: inline-block; padding: 2px 8px; border-radius: 4px;
  font-family: 'JetBrains Mono', Menlo, monospace;
  font-size: 11px; font-weight: 700;
  letter-spacing: 0.4px; white-space: nowrap;
}
.escat-IA, .escat-IB { background: #16a34a; color: white; }
.escat-IIA, .escat-IIB { background: #facc15; color: #713f12; }
.escat-IIIA, .escat-IIIB { background: #f97316; color: white; }
.escat-IV { background: #f3f4f6; color: #374151; }
.escat-X { background: #e5e7eb; color: #374151; }

.oncokb-1 { background: #16a34a; color: white; }
.oncokb-2 { background: #86efac; color: #14532d; }
.oncokb-3A { background: #facc15; color: #713f12; }
.oncokb-3B { background: #f97316; color: white; }
.oncokb-4 { background: #f3f4f6; color: #374151; }
.oncokb-R1, .oncokb-R2 { background: #dc2626; color: white; }

/* ── NSZU availability badges — per-drug coverage flag rendered next
   to each regimen component. Render-time metadata only (engine never
   reads these — CHARTER §8.3 invariant). Mirrored in
   knowledge_base/engine/render_styles.py for the embedded Plan HTML. */
.nszu-badge {
  display: inline-block; padding: 2px 8px; border-radius: 4px;
  font-size: 0.85em; font-weight: 600; white-space: nowrap;
  margin-left: 6px; vertical-align: middle;
}
.nszu-covered { background: #d4edda; color: #155724; }     /* green */
.nszu-partial { background: #fff3cd; color: #856404; }     /* yellow */
.nszu-oop { background: #ffe5cc; color: #804000; }         /* orange */
.nszu-not-registered { background: #f8d7da; color: #721c24; } /* red */

/* ── Patient mode ──────────────────────────────────────────────────
   Patient-facing renderer styles. Distinct typography (larger body
   text, longer line-height) and a calmer palette than the clinician
   bundle. Mirrored in knowledge_base/engine/render_styles.py for the
   embedded engine HTML so the Pyodide bundle ships the same look. */

.patient-report {
  max-width: 800px;
  margin: 0 auto;
  padding: 24px 32px;
  font-family: 'Source Sans 3', system-ui, sans-serif;
  font-size: 18px;
  line-height: 1.7;
  color: #2c3e50;
}

.patient-report h1 { font-size: 2.2em; margin: 0 0 12px; color: #1a3a5c; }
.patient-report h2 {
  font-size: 1.6em; margin: 32px 0 16px; color: #1a3a5c;
  border-bottom: 2px solid #e8f0fa; padding-bottom: 8px;
}
.patient-report h3 { font-size: 1.2em; margin: 20px 0 8px; color: #1a3a5c; }

.patient-subhead { font-size: 1.1em; color: #5a6e80; margin-bottom: 24px; }

.patient-badge {
  display: inline-block;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 1em;
  font-weight: 600;
  margin: 4px 0;
}
.patient-good { background: #d4edda; color: #155724; }
.patient-warn { background: #fff3cd; color: #856404; }
.patient-info { background: #d1ecf1; color: #0c5460; }
.patient-emergency { background: #f8d7da; color: #721c24; }

.patient-nszu {
  display: inline-block;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 0.95em;
  font-weight: 500;
  margin-top: 4px;
}
.patient-nszu-covered { background: #d4edda; color: #155724; }
.patient-nszu-partial { background: #fff3cd; color: #856404; }
.patient-nszu-oop { background: #ffe5cc; color: #804000; }
.patient-nszu-not-registered { background: #f8d7da; color: #721c24; }

.drug-explanation {
  background: #f8fafc;
  border-left: 4px solid #3b82f6;
  padding: 16px 20px;
  margin: 16px 0;
  border-radius: 4px;
}
.drug-explanation .lay-language {
  font-size: 1em;
  margin: 8px 0;
  color: #2c3e50;
}

.emergency-list {
  background: #fff5f5;
  border-left: 4px solid #dc2626;
  padding: 16px 20px;
  margin: 16px 0;
  list-style: none;
}
.emergency-list li {
  margin: 12px 0;
  font-weight: 500;
}

.ask-doctor {
  background: #f0f9ff;
  border-left: 4px solid #0ea5e9;
  padding: 20px;
  border-radius: 4px;
  margin: 24px 0;
}
.ask-doctor ul { margin: 12px 0 0 20px; }
.ask-doctor li { margin: 8px 0; line-height: 1.5; }

.patient-disclaimer {
  margin-top: 48px;
  padding-top: 24px;
  border-top: 2px solid #e2e8f0;
  font-size: 0.95em;
  color: #5a6e80;
}

@media (max-width: 600px) {
  .patient-report { padding: 16px 20px; font-size: 16px; }
  .patient-report h1 { font-size: 1.8em; }
  .patient-report h2 { font-size: 1.4em; }
}

@media print {
  .patient-report { font-size: 14pt; }
  .patient-disclaimer { page-break-before: avoid; }
}

/* ── Sign-off badges (CHARTER §6.1) ────────────────────────────────
   Mirrored from knowledge_base/engine/render_styles.py — keep in sync
   when the engine-emitted classes change. */
.track-signoff { margin: 4px 0 8px 0; }
.signoff-badge {
  display: inline-block; padding: 4px 10px; border-radius: 4px;
  font-size: 0.85em; font-weight: 600; line-height: 1.3;
  border: 1px solid transparent;
}
.signoff-pending  { background: #fef2f2; color: #991b1b; border-color: #fecaca; }
.signoff-partial  { background: #fffbeb; color: #92400e; border-color: #fde68a; }
.signoff-complete { background: #ecfdf5; color: #065f46; border-color: #a7f3d0; }
