/* ============================================================
   HiDoctorly — "Twilight Vellum"
   Ink ground, warm parchment, restrained amber, muted teal.
   Signature: the HI-EI-AI Line — a 0.5px living meridian that
   threads the whole surface and glows where AI and HI align.
   Type does the work. Motion is almost absent.
   ============================================================ */

:root {
  /* --- Twilight Vellum --- */
  --ink:          #0A1417;   /* ground */
  --ink-deep:     #060A0C;   /* deepest well */
  --ink-2:        #0E1A1E;   /* raised surface */
  --ink-3:        #132226;   /* raised surface, second order */
  --parchment:    #F1EBDE;   /* warm parchment */
  --amber:        #D9A566;   /* restrained warm amber */
  --amber-deep:   #A87840;
  --teal:         #3F6F73;   /* muted teal */
  --teal-lift:    #6FA3A6;   /* legible teal on ink */
  --whisper-red:  #B04A3C;   /* PROHIBITED only */

  /* --- RGB channels ---
     Every alpha colour in the sheet is composed from these rather than from a
     literal triple, so a theme override only has to restate the channel. This is
     what makes the light theme a ~40-line block instead of a second stylesheet. */
  --fg-rgb:        241,235,222;   /* parchment — the readable foreground */
  --deep-rgb:      6,10,12;
  --ink-rgb:       10,20,23;
  --ink2-rgb:      14,26,30;
  --ink3-rgb:      19,34,38;
  --amber-rgb:     217,165,102;
  --teal-rgb:      63,111,115;
  --teal-lift-rgb: 111,163,166;
  --red-rgb:       176,74,60;

  /* --- derived text + line --- */
  --text:         rgba(var(--fg-rgb),0.92);
  --text-dim:     rgba(var(--fg-rgb),0.62);
  --text-faint:   rgba(var(--fg-rgb),0.40);
  --text-ghost:   rgba(var(--fg-rgb),0.22);
  --line:         rgba(var(--fg-rgb),0.085);
  --line-2:       rgba(var(--fg-rgb),0.16);
  --line-3:       rgba(var(--fg-rgb),0.28);

  --radius:       3px;
  --radius-lg:    6px;

  /* --- type stack --- */
  --display:      'Fraunces', 'Iowan Old Style', 'Palatino Linotype', Georgia, serif;
  --sub:          'Inter Tight', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --sans:         'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --mono:         'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;

  --maxw:         1180px;
  --ease:         cubic-bezier(0.16, 1, 0.3, 1);
}

/* ============================================================
   LIGHT THEME — "Vellum Daylight"
   Not an inversion. Ink becomes warm paper, parchment becomes
   ink, and the accents are darkened so they still carry on a
   light ground: the amber and teal at their dark-mode values
   fail contrast on paper.
   Set on <html data-theme="light"> by the pre-paint script in
   renderer.tsx, so there is no flash of the wrong shell.
   ============================================================ */
[data-theme='light'] {
  --ink:          #F5F0E4;   /* warm paper ground */
  --ink-deep:     #EDE6D6;   /* recessed rails — DARKER than ground in light mode */
  --ink-2:        #FBF8F0;   /* raised surface */
  --ink-3:        #FFFDF7;   /* raised surface, second order */
  /* --parchment is used as the "strongest foreground" accent, so in light mode
     it becomes ink rather than paper. */
  --parchment:    #101A1D;

  --amber:        #8A5A1E;   /* darkened — 4.5:1 on paper */
  --amber-deep:   #6B4413;
  --teal:         #2C5457;
  --teal-lift:    #1F4144;   /* "lift" means legible, not lighter */
  --whisper-red:  #8E3427;

  /* the readable foreground channel flips to ink */
  --fg-rgb:        16,26,29;
  /* the ground channels become paper, so every veil and tint follows */
  --deep-rgb:      237,230,214;
  --ink-rgb:       245,240,228;
  --ink2-rgb:      251,248,240;
  --ink3-rgb:      255,253,247;
  --amber-rgb:     138,90,30;
  --teal-rgb:      44,84,87;
  --teal-lift-rgb: 31,65,68;
  --red-rgb:       142,52,39;

  /* ink on paper needs more alpha at the faint end than parchment on ink did */
  --text:         rgba(var(--fg-rgb),0.90);
  --text-dim:     rgba(var(--fg-rgb),0.70);
  --text-faint:   rgba(var(--fg-rgb),0.55);
  --text-ghost:   rgba(var(--fg-rgb),0.38);
  --line:         rgba(var(--fg-rgb),0.13);
  --line-2:       rgba(var(--fg-rgb),0.22);
  --line-3:       rgba(var(--fg-rgb),0.34);
}
/* The hero photograph is exposed for an ink ground; on paper it has to sit back
   and the veil has to lift rather than darken. */
[data-theme='light'] .hero-bg {
  opacity: 0.16;
  filter: saturate(40%) hue-rotate(-14deg) contrast(94%) invert(4%);
}
[data-theme='light'] .hero-veil {
  background:
    radial-gradient(ellipse 74% 58% at 12% 36%, rgba(var(--ink-rgb),0.80), rgba(var(--deep-rgb),0.62) 68%),
    linear-gradient(90deg, rgba(var(--ink-rgb),0.92) 0%, rgba(var(--ink-rgb),0.66) 62%, rgba(var(--ink-rgb),0.34) 100%),
    linear-gradient(180deg, rgba(var(--ink-rgb),0.50) 0%, rgba(var(--ink-rgb),0.74) 58%, var(--ink) 100%);
}
/* the meridian is a glow device — on paper it reads as a drawn hairline instead */
[data-theme='light'] .meridian {
  background: linear-gradient(
    180deg, transparent 0%,
    rgba(var(--amber-rgb),0.34) 6%, rgba(var(--fg-rgb),0.14) 24%,
    rgba(var(--teal-rgb),0.40) 46%, rgba(var(--fg-rgb),0.14) 68%,
    rgba(var(--amber-rgb),0.30) 88%, transparent 100%
  );
}
[data-theme='light'] .meridian-node { opacity: 0.42; filter: none; box-shadow: none; }
[data-theme='light'] .meridian-node.aligned { opacity: 0.6; box-shadow: none; }
[data-theme='light'] .hiei-rule::after,
[data-theme='light'] .hiei-rule.teal::after { box-shadow: none; opacity: 0.85; }
/* the yantra glow is additive light; on paper it must subtract */
[data-theme='light'] .yantra-core { opacity: 0.10; }
/* raised surfaces earn a whisper of shadow on paper, where a border alone reads flat */
[data-theme='light'] .card,
[data-theme='light'] .panel,
[data-theme='light'] .tier,
[data-theme='light'] .modal { box-shadow: 0 1px 2px rgba(0,0,0,0.035), 0 8px 26px rgba(0,0,0,0.045); }
[data-theme='light'] .nav { background: rgba(var(--ink-rgb),0.86); }
[data-theme='light'] ::selection { background: rgba(var(--amber-rgb),0.22); color: var(--parchment); }

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--sans);
  background: var(--ink);
  color: var(--text);
  font-size: 16px;
  line-height: 1.62;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-feature-settings: 'kern' 1, 'liga' 1;
}

::selection { background: rgba(var(--amber-rgb),0.26); color: var(--parchment); }

a { color: inherit; text-decoration: none; }

/* ============================================================
   THE HI-EI-AI LINE — 0.5px living meridian
   A hairline threading the full document. It rests at low
   presence and blooms where an AI stage meets an HI gate.
   ============================================================ */

.meridian {
  position: fixed;
  top: 0; bottom: 0; left: 50%;
  width: 1px;
  transform: translateX(-50%) scaleX(0.5); /* true 0.5px */
  transform-origin: center;
  background: linear-gradient(
    180deg,
    transparent 0%,
    rgba(var(--amber-rgb),0.28) 6%,
    rgba(var(--fg-rgb),0.10) 24%,
    rgba(var(--teal-rgb),0.34) 46%,
    rgba(var(--fg-rgb),0.10) 68%,
    rgba(var(--amber-rgb),0.24) 88%,
    transparent 100%
  );
  pointer-events: none;
  z-index: 0;
}

/* the travelling bloom — position driven by scroll progress in app.js */
.meridian-node {
  position: fixed;
  left: 50%;
  top: 0;
  width: 1px; height: 132px;
  transform: translateX(-50%);
  pointer-events: none;
  z-index: 0;
  background: linear-gradient(180deg, transparent, var(--amber), transparent);
  opacity: 0.5;
  filter: blur(0.4px);
  box-shadow: 0 0 14px 1px rgba(var(--amber-rgb),0.34);
  transition: opacity .6s var(--ease), box-shadow .6s var(--ease), background .6s var(--ease);
  will-change: top;
}
/* when the bloom sits over a signed / gated region it turns teal — AI + HI aligned */
.meridian-node.aligned {
  background: linear-gradient(180deg, transparent, var(--teal-lift), transparent);
  box-shadow: 0 0 20px 2px rgba(var(--teal-lift-rgb),0.42);
  opacity: 0.78;
}
@media (max-width: 900px) { .meridian, .meridian-node { display: none; } }
@media (prefers-reduced-motion: reduce) { .meridian-node { display: none; } }
/* The meridian is a reading-surface signature. Inside the dense workspace the
   gate glows carry it instead — a centre line would read as an artifact there. */
body:has(#logout-btn) .meridian,
body:has(#logout-btn) .meridian-node { display: none; }

/* horizontal HI-EI-AI rule — a hairline with a single glowing node */
.hiei-rule {
  position: relative; height: 1px; border: 0; margin: 0;
  background: linear-gradient(90deg, transparent, var(--line-2) 18%, var(--line-2) 82%, transparent);
  transform: scaleY(0.5);
}
.hiei-rule::after {
  content: ''; position: absolute; left: 50%; top: -2px;
  width: 5px; height: 5px; border-radius: 50%;
  transform: translateX(-50%);
  background: var(--amber);
  box-shadow: 0 0 10px 2px rgba(var(--amber-rgb),0.4);
  opacity: 0.7;
}
.hiei-rule.teal::after { background: var(--teal-lift); box-shadow: 0 0 10px 2px rgba(var(--teal-lift-rgb),0.4); }

/* content sits above the meridian */
.nav, section, .foot, .modal-veil { position: relative; z-index: 1; }

/* ---------- Type ---------- */
.serif   { font-family: var(--display); font-weight: 400; letter-spacing: -0.012em; }
.mono    { font-family: var(--mono); font-variant-ligatures: none; font-variant-numeric: tabular-nums; }

h1, h2, h3, h4 { margin: 0; font-weight: 500; letter-spacing: -0.02em; line-height: 1.14; }

.display {
  font-family: var(--display);
  font-optical-sizing: auto;
  font-variation-settings: 'SOFT' 0, 'WONK' 1;
  font-size: clamp(2.55rem, 6.1vw, 5.05rem);
  line-height: 1.0;
  letter-spacing: -0.038em;
  font-weight: 380;
  color: var(--parchment);
}
.h2 {
  font-family: var(--display);
  font-optical-sizing: auto;
  font-variation-settings: 'SOFT' 0, 'WONK' 1;
  font-size: clamp(1.85rem, 3.5vw, 2.95rem);
  line-height: 1.08; letter-spacing: -0.032em; font-weight: 380;
  color: var(--parchment);
}
.h3 {
  font-family: var(--sub);
  font-size: clamp(1.06rem, 1.6vw, 1.22rem);
  font-weight: 600; letter-spacing: -0.014em; color: var(--parchment);
}

.lede { font-size: clamp(1.03rem, 1.5vw, 1.24rem); line-height: 1.62; color: var(--text-dim); font-weight: 350; }

/* wide-tracked all-caps subhead — Söhne-adjacent, set in Inter Tight */
.eyebrow {
  font-family: var(--sub);
  font-size: 0.66rem;
  text-transform: uppercase;
  letter-spacing: 0.26em;
  color: var(--text-faint);
  font-weight: 600;
}
.eyebrow-amber { color: var(--amber); }

.muted { color: var(--text-dim); }
.faint { color: var(--text-faint); }
.amberc { color: var(--amber); }
.tealc  { color: var(--teal-lift); }
.redc   { color: var(--whisper-red); }

em.wonk { font-style: italic; color: var(--amber); font-variation-settings: 'SOFT' 40, 'WONK' 1; }

/* ---------- Layout ---------- */
.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 28px; }
.wrap-narrow { max-width: 748px; margin: 0 auto; padding: 0 28px; }
.wrap-wide { max-width: 1420px; margin: 0 auto; padding: 0 28px; }

section { position: relative; }
.pad     { padding: clamp(70px, 10.5vw, 138px) 0; }
.pad-sm  { padding: clamp(46px, 7vw, 82px) 0; }

.rule { height: 1px; background: var(--line); border: 0; margin: 0; }

.grid { display: grid; gap: 26px; }
.g2 { grid-template-columns: repeat(2, 1fr); }
.g3 { grid-template-columns: repeat(3, 1fr); }
.g4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 940px) { .g3, .g4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 680px) { .g2, .g3, .g4 { grid-template-columns: 1fr; } }

.row { display: flex; align-items: center; gap: 13px; }
.between { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.wrapf { flex-wrap: wrap; }

/* ---------- Nav ---------- */
.nav {
  position: sticky; top: 0; z-index: 50;
  background: rgba(var(--deep-rgb),0.80);
  backdrop-filter: saturate(150%) blur(16px);
  border-bottom: 1px solid var(--line);
}
.nav-in { display: flex; align-items: center; justify-content: space-between; height: 64px; }

/* ---------- Theme toggle ----------
   One button, both glyphs present in the DOM. Which one is visible is decided by
   the data-theme attribute rather than by JS mutating the markup, so the pre-paint
   script in renderer.tsx sets the correct glyph before the first frame. */
.theme-toggle {
  position: relative;
  width: 32px; height: 32px; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  padding: 0; margin: 0 2px;
  border: 1px solid var(--line-2); border-radius: 50%;
  background: transparent; color: var(--text-faint);
  cursor: pointer; -webkit-appearance: none; appearance: none;
  transition: color .22s var(--ease), border-color .22s var(--ease), background .22s var(--ease);
}
.theme-toggle:hover { color: var(--amber); border-color: rgba(var(--amber-rgb),0.45); background: rgba(var(--amber-rgb),0.07); }
.theme-toggle:focus-visible { outline: 1px solid var(--amber); outline-offset: 2px; }
.theme-toggle-icon {
  position: absolute; font-size: 0.795rem; line-height: 1;
  transition: opacity .26s var(--ease), transform .34s var(--ease);
}
/* dark shell: offer the sun (what you would switch TO) */
.theme-toggle-icon--sun  { opacity: 1; transform: rotate(0deg) scale(1); }
.theme-toggle-icon--moon { opacity: 0; transform: rotate(-70deg) scale(0.55); }
[data-theme='light'] .theme-toggle-icon--sun  { opacity: 0; transform: rotate(70deg) scale(0.55); }
[data-theme='light'] .theme-toggle-icon--moon { opacity: 1; transform: rotate(0deg) scale(1); }
@media (prefers-reduced-motion: reduce) { .theme-toggle-icon { transition: none; } }

/* ---------- How-to cards — doctor-facing onboarding ---------- */
.howto { display: grid; grid-template-columns: 34px 1fr; gap: 16px; align-items: start; }
.howto-ic {
  width: 32px; height: 32px; border-radius: 50%; margin-top: 2px;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid rgba(var(--amber-rgb),0.34);
  background: rgba(var(--amber-rgb),0.07);
  color: var(--amber); font-size: 0.74rem; flex-shrink: 0;
}

/* ---------- Security harness chips — the inherited EQCompanion controls ---------- */
.harness { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 4px; }
.harness-item {
  display: inline-flex; align-items: center; gap: 7px;
  border: 1px solid var(--line-2); border-radius: 100px;
  padding: 5px 12px 5px 10px;
  font-family: var(--sub); font-size: 0.685rem; font-weight: 500;
  color: var(--text-dim); background: rgba(var(--teal-rgb),0.07);
}
.harness-item i { font-size: 0.62rem; color: var(--teal-lift); }

/* the privacy claims read as a lead-in, then the explanation */
.privacy-t { color: var(--text); font-family: var(--sub); font-weight: 600; }

/* The differentiator block in the hero. Amber-anchored so it reads as the
   single most important claim on the page without shouting. */
.edge {
  max-width: 592px;
  padding: 17px 20px 18px;
  border: 1px solid rgba(var(--amber-rgb), 0.34);
  border-left: 2px solid var(--amber);
  border-radius: 5px;
  background: linear-gradient(
    100deg,
    rgba(var(--amber-rgb), 0.075),
    rgba(var(--amber-rgb), 0.015) 62%,
    transparent
  );
}
.edge-tag {
  display: inline-block;
  font-family: var(--mono);
  font-size: 0.605rem;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--amber);
}
.edge-lede {
  font-family: var(--sub);
  font-size: 0.945rem;
  line-height: 1.58;
  color: var(--text);
}
.edge-lede em { color: var(--amber); font-style: normal; font-weight: 600; }

.logo { display: flex; align-items: baseline; gap: 9px; }
.logo-mark {
  font-family: var(--display); font-size: 1.38rem; letter-spacing: -0.03em;
  color: var(--parchment); font-weight: 420;
  font-variation-settings: 'SOFT' 0, 'WONK' 1;
}
/* the "Hi" carries the human-intelligence gate colour */
.logo-mark i { font-style: normal; color: var(--amber); }
.logo-sub {
  font-family: var(--sub); font-size: 0.6rem; letter-spacing: 0.24em; font-weight: 600;
  text-transform: uppercase; color: var(--text-faint); padding-bottom: 2px;
}
.nav-links { display: flex; gap: 28px; align-items: center; }
.nav-links a { font-size: 0.855rem; color: var(--text-dim); transition: color .2s var(--ease); }
.nav-links a:hover { color: var(--parchment); }
@media (max-width: 900px) { .nav-links .hide-sm { display: none; } }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 9px;
  font-family: var(--sub); font-size: 0.865rem; font-weight: 600;
  padding: 10px 19px; border-radius: var(--radius);
  border: 1px solid transparent; cursor: pointer;
  transition: all .22s var(--ease); white-space: nowrap;
  letter-spacing: -0.006em;
}
.btn-primary { background: var(--parchment); color: var(--ink-deep); }
.btn-primary:hover { background: #fff; }
.btn-ghost { border-color: var(--line-2); color: var(--text); background: transparent; }
.btn-ghost:hover { border-color: var(--line-3); background: rgba(var(--fg-rgb),0.035); }
.btn-amber { background: var(--amber); color: #17100A; }
.btn-amber:hover { background: #E6B67C; }
.btn-teal { background: transparent; border-color: rgba(var(--teal-lift-rgb),0.4); color: var(--teal-lift); }
.btn-teal:hover { background: rgba(var(--teal-rgb),0.14); }
.btn-sm { padding: 6px 13px; font-size: 0.795rem; }
.btn:disabled { opacity: 0.42; cursor: not-allowed; }
.btn-danger { border: 1px solid rgba(var(--red-rgb),0.42); color: var(--whisper-red); background: transparent; }
.btn-danger:hover { background: rgba(var(--red-rgb),0.1); }

/* ---------- Hero ---------- */
.hero { position: relative; overflow: hidden; border-bottom: 1px solid var(--line); }
.hero-bg {
  position: absolute; inset: 0;
  background-image: url('/static/img/hero-lattice.jpg');
  background-size: cover; background-position: center right;
  opacity: 0.52; filter: saturate(55%) hue-rotate(-14deg) contrast(108%);
}
.hero-veil {
  position: absolute; inset: 0;
  background:
    radial-gradient(ellipse 74% 58% at 12% 36%, rgba(var(--ink-rgb),0.62), rgba(var(--deep-rgb),0.90) 68%),
    linear-gradient(90deg, rgba(var(--deep-rgb),0.62) 0%, rgba(var(--deep-rgb),0.30) 62%, rgba(var(--deep-rgb),0.10) 100%),
    linear-gradient(180deg, rgba(var(--deep-rgb),0.44) 0%, rgba(var(--ink-rgb),0.72) 58%, var(--ink) 100%);
}
.hero-in { position: relative; padding: clamp(82px, 12.5vw, 162px) 0 clamp(70px, 10vw, 120px); }
.hero-copy { max-width: 716px; }

.hero-badge {
  display: inline-flex; align-items: center; gap: 9px;
  border: 1px solid var(--line-2); border-radius: 100px;
  padding: 6px 15px 6px 11px; margin-bottom: 30px;
  background: rgba(var(--ink2-rgb),0.72);
  font-family: var(--sub); font-size: 0.635rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.2em; color: var(--text-dim);
}
.dot { width: 5px; height: 5px; border-radius: 50%; background: var(--teal-lift); box-shadow: 0 0 0 3px rgba(var(--teal-rgb),0.2); }

.hero h1 em { font-style: italic; color: var(--amber); font-variation-settings: 'SOFT' 50, 'WONK' 1; }

/* the stage chain — a real sequence, so it earns its numbers */
.chain {
  display: flex; align-items: stretch; gap: 0; flex-wrap: wrap;
  margin-top: 40px; border-top: 1px solid var(--line); padding-top: 20px;
}
.chain-link { display: flex; align-items: baseline; gap: 8px; padding-right: 20px; }
.chain-link .n {
  font-family: var(--mono); font-size: 0.62rem; color: var(--amber); letter-spacing: 0.06em;
}
.chain-link .l {
  font-family: var(--sub); font-size: 0.7rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.15em; color: var(--text-dim);
}
.chain-link + .chain-link { border-left: 1px solid var(--line); padding-left: 20px; }

/* ---------- Cards ---------- */
.card {
  background: var(--ink-2); border: 1px solid var(--line);
  border-radius: var(--radius-lg); padding: 25px;
  transition: border-color .25s var(--ease);
}
.card:hover { border-color: var(--line-2); }
.card-num {
  font-family: var(--mono); font-size: 0.655rem; color: var(--amber);
  letter-spacing: 0.1em; margin-bottom: 15px; display: block;
}

.panel {
  background: var(--ink-2); border: 1px solid var(--line); border-radius: var(--radius-lg);
}
.panel-head {
  padding: 14px 20px; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap;
}
.panel-body { padding: 20px; }

/* ---------- Evidence integrity visibility ---------- */
.integrity-preview { position: relative; overflow: hidden; }
.integrity-preview::before {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(circle at 82% 24%, rgba(var(--teal-rgb),0.11), transparent 34%);
}
.integrity-preview > .wrap { position: relative; }
.integrity-step {
  min-height: 176px; padding: 20px; border: 1px solid var(--line);
  border-radius: var(--radius-lg); background: rgba(var(--fg-rgb),0.018);
}
.integrity-step:hover { border-color: rgba(var(--teal-rgb),0.42); }
.integrity-number {
  display: inline-block; color: var(--amber); font-size: 0.68rem; letter-spacing: 0.14em;
}
.integrity-onboarding { border-color: rgba(var(--teal-rgb),0.35); }
.integrity-onboarding[hidden] { display: none; }
.integrity-onboarding-grid {
  display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 18px;
}
.integrity-onboarding-grid > div { min-width: 0; }
.link-amber { color: var(--amber); text-decoration: underline; text-decoration-color: rgba(var(--amber-rgb),0.45); text-underline-offset: 3px; }
.link-amber:hover { color: var(--parchment); }

/* seam card — the six gaps. TODAY above, the seam below. */
.seam { border-left: 1px solid var(--line-2); padding: 4px 0 4px 22px; position: relative; }
.seam::before {
  content: ''; position: absolute; left: -1px; top: 4px; width: 1px; height: 26px;
  background: var(--amber); box-shadow: 0 0 8px 1px rgba(var(--amber-rgb),0.35);
}
.seam-t { font-family: var(--sub); font-size: 1rem; font-weight: 600; color: var(--parchment); letter-spacing: -0.012em; }
.seam-tag {
  font-family: var(--mono); font-size: 0.615rem; letter-spacing: 0.13em; text-transform: uppercase;
}

/* ---------- Badges / chips (JetBrains Mono) ---------- */
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--mono); font-size: 0.635rem; font-weight: 500;
  text-transform: uppercase; letter-spacing: 0.1em;
  padding: 3px 8px; border-radius: 2px; border: 1px solid var(--line-2);
  color: var(--text-dim); background: rgba(var(--fg-rgb),0.02);
  font-variant-numeric: tabular-nums;
}
.chip-supported   { color: var(--teal-lift);   border-color: rgba(var(--teal-rgb),0.48);  background: rgba(var(--teal-rgb),0.14); }
.chip-partial     { color: var(--amber);       border-color: rgba(var(--amber-rgb),0.42); background: rgba(var(--amber-rgb),0.10); }
.chip-unsupported { color: rgba(var(--fg-rgb),0.66); border-color: var(--line-2);      background: rgba(var(--fg-rgb),0.04); }
.chip-prohibited  { color: var(--whisper-red); border-color: rgba(var(--red-rgb),0.46);   background: rgba(var(--red-rgb),0.12); }
.chip-tier { color: var(--text-faint); }

/* ---------- Strength meter ---------- */
.meter { height: 2px; background: var(--line-2); border-radius: 2px; overflow: hidden; }
.meter > i { display: block; height: 100%; border-radius: 2px; transition: width .5s var(--ease); }
.m-strong       > i { background: var(--teal-lift); }
.m-moderate     > i { background: var(--amber); }
.m-limited      > i { background: var(--amber-deep); }
.m-insufficient > i { background: var(--whisper-red); }

/* ---------- Forms ---------- */
label.fl {
  display: block; font-family: var(--sub); font-size: 0.645rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.19em; color: var(--text-faint);
  margin-bottom: 7px;
}
input.fi, textarea.fi, select.fi {
  width: 100%; background: var(--ink-deep); border: 1px solid var(--line-2);
  border-radius: var(--radius); color: var(--text); padding: 11px 13px;
  font-family: var(--sans); font-size: 0.92rem; transition: border-color .2s var(--ease), box-shadow .2s var(--ease);
}
textarea.fi { resize: vertical; line-height: 1.62; min-height: 118px; }
input.fi:focus, textarea.fi:focus, select.fi:focus {
  outline: none; border-color: var(--amber); box-shadow: 0 0 0 3px rgba(var(--amber-rgb),0.11);
}
input.fi::placeholder, textarea.fi::placeholder { color: var(--text-ghost); }
.field { margin-bottom: 17px; }
.hint { font-size: 0.775rem; color: var(--text-faint); margin-top: 6px; line-height: 1.55; }

/* inline "what does this control do" mark — the explanation is the title attribute,
   so it works without JS and is read out by screen readers */
.help {
  display: inline-flex; align-items: center; justify-content: center;
  width: 13px; height: 13px; margin-left: 3px;
  border: 1px solid var(--line-2); border-radius: 50%;
  font-family: var(--sub); font-size: 0.55rem; font-weight: 600;
  color: var(--text-faint); cursor: help; flex-shrink: 0;
}
.help:hover { color: var(--amber); border-color: rgba(var(--amber-rgb),0.5); }

/* ---------- Auth modal — yantra glow + canon quote ---------- */
.modal-veil {
  position: fixed; inset: 0; z-index: 120;
  background: rgba(var(--deep-rgb),0.86);
  backdrop-filter: blur(7px);
  display: flex; align-items: center; justify-content: center;
  padding: 24px; overflow: auto;
}
.modal {
  width: 100%; max-width: 940px;
  display: grid; grid-template-columns: 1fr 1fr;
  background: var(--ink-2); border: 1px solid var(--line-2);
  border-radius: 8px; overflow: hidden;
  box-shadow: 0 40px 120px rgba(0,0,0,0.6);
}
.modal-aside {
  position: relative; overflow: hidden;
  padding: 42px 38px;
  background: var(--ink-deep);
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column; justify-content: space-between;
  min-height: 460px;
}
/* the yantra — concentric hairlines with an amber core */
.yantra {
  position: absolute; left: 50%; top: 50%; width: 460px; height: 460px;
  transform: translate(-50%, -50%);
  pointer-events: none; opacity: 0.85;
}
.yantra i {
  position: absolute; inset: 0; margin: auto; border-radius: 50%;
  border: 1px solid rgba(var(--amber-rgb),0.14);
}
.yantra i:nth-child(1) { width: 132px; height: 132px; border-color: rgba(var(--amber-rgb),0.3); }
.yantra i:nth-child(2) { width: 226px; height: 226px; }
.yantra i:nth-child(3) { width: 330px; height: 330px; border-color: rgba(var(--teal-rgb),0.22); }
.yantra i:nth-child(4) { width: 440px; height: 440px; border-color: rgba(var(--fg-rgb),0.05); }
/* the core glow is lifted off the quote's optical centre so the serif stays
   crisp — the bloom reads as light behind the rings, not behind the words */
.yantra-core {
  position: absolute; left: 50%; top: 31%; width: 190px; height: 190px;
  transform: translate(-50%, -50%);
  background: radial-gradient(circle, rgba(var(--amber-rgb),0.15) 0%, rgba(var(--amber-rgb),0.045) 42%, transparent 70%);
  filter: blur(8px);
}
/* stack the real content above the decorative yantra without disturbing its
   absolute positioning — :not() keeps this off the decoration itself */
.modal-aside > *:not(.yantra):not(.yantra-core) { position: relative; z-index: 1; }
.canon-quote {
  font-family: var(--display); font-weight: 350;
  font-size: clamp(1.18rem, 1.9vw, 1.5rem); line-height: 1.42;
  letter-spacing: -0.022em; color: var(--parchment);
  font-variation-settings: 'SOFT' 20, 'WONK' 1;
}
.canon-attr { font-family: var(--mono); font-size: 0.63rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--text-faint); margin-top: 16px; }
.modal-main { position: relative; padding: 40px 38px; min-width: 0; }
.modal-close {
  position: absolute; right: 12px; top: 10px; z-index: 3;
  display: flex; align-items: center; justify-content: center;
  width: 30px; height: 30px;
  background: transparent; border: 1px solid transparent; color: var(--text-faint);
  font-family: var(--sans); font-size: 1.15rem; line-height: 1;
  text-decoration: none; cursor: pointer; border-radius: 3px;
  transition: color .18s ease, background .18s ease, border-color .18s ease;
}
.modal-close:hover { color: var(--parchment); background: rgba(var(--fg-rgb),0.06); border-color: var(--line-2); }
@media (max-width: 820px) {
  .modal { grid-template-columns: 1fr; max-width: 480px; }
  .modal-aside { min-height: 0; padding: 30px 26px; border-right: 0; border-bottom: 1px solid var(--line); }
  .yantra { width: 320px; height: 320px; }
  .modal-main { padding: 30px 26px; }
}

/* attestation strip at the foot of the form */
.attest {
  border: 1px solid var(--line-2); border-radius: var(--radius);
  padding: 11px 13px; background: rgba(var(--fg-rgb),0.02);
  display: flex; gap: 10px; align-items: flex-start;
}
.attest .mono { color: var(--amber); font-size: 0.6rem; letter-spacing: 0.12em; white-space: nowrap; padding-top: 2px; }

/* ---------- Stage rail ---------- */
.rail { display: flex; align-items: stretch; border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden; }
.rail-step {
  flex: 1; padding: 12px 14px; border-right: 1px solid var(--line);
  background: var(--ink-2); position: relative; min-width: 0;
}
.rail-step:last-child { border-right: 0; }
.rail-step .k { font-family: var(--mono); font-size: 0.585rem; letter-spacing: 0.12em; color: var(--text-ghost); }
.rail-step .v {
  font-family: var(--sub); font-size: 0.795rem; font-weight: 600; margin-top: 3px; color: var(--text-dim);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; letter-spacing: -0.008em;
}
.rail-step.done { background: rgba(var(--teal-rgb),0.1); }
.rail-step.done .v { color: var(--teal-lift); }
.rail-step.done .k { color: rgba(var(--teal-lift-rgb),0.6); }
.rail-step.active { background: rgba(var(--amber-rgb),0.08); }
.rail-step.active .v { color: var(--amber); }
.rail-step.active::after {
  content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 1px;
  background: var(--amber); box-shadow: 0 0 8px 1px rgba(var(--amber-rgb),0.4);
}

/* ---------- Source list ---------- */
.src { padding: 16px 0; border-bottom: 1px solid var(--line); }
.src:last-child { border-bottom: 0; }
.src-title { font-size: 0.935rem; line-height: 1.45; color: var(--text); font-weight: 450; }
.src-title a:hover { color: var(--amber); }
.src-meta {
  font-family: var(--mono); font-size: 0.645rem; color: var(--text-faint); margin-top: 6px;
  letter-spacing: 0.02em; font-variant-numeric: tabular-nums;
}
.src-snip { font-size: 0.845rem; color: var(--text-dim); margin-top: 9px; line-height: 1.56; }

/* ---------- Claim card ---------- */
.claim { border-left: 1px solid var(--line-2); padding: 12px 0 12px 16px; margin-bottom: 14px; }
.claim.v-SUPPORTED   { border-left-color: var(--teal-lift); }
.claim.v-PARTIAL     { border-left-color: var(--amber); }
.claim.v-UNSUPPORTED { border-left-color: var(--line-3); }
.claim.v-PROHIBITED  { border-left-color: var(--whisper-red); }
.claim-text { font-size: 0.915rem; line-height: 1.58; }
.claim-foot { margin-top: 9px; display: flex; gap: 7px; align-items: center; flex-wrap: wrap; }
.cite {
  font-family: var(--mono); font-size: 0.63rem; color: var(--teal-lift);
  border: 1px solid rgba(var(--teal-rgb),0.36); border-radius: 2px; padding: 2px 6px;
  font-variant-numeric: tabular-nums;
}
.cite:hover { background: rgba(var(--teal-rgb),0.14); }

/* ---------- Validator chain ---------- */
.vrow {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 0.855rem;
}
.vrow:last-child { border-bottom: 0; }
.vname { font-family: var(--mono); font-size: 0.705rem; color: var(--text-dim); letter-spacing: 0.02em; }
.vpass { color: var(--teal-lift); font-family: var(--mono); font-size: 0.675rem; letter-spacing: 0.1em; }
.vfail { color: var(--whisper-red); font-family: var(--mono); font-size: 0.675rem; letter-spacing: 0.1em; }

/* ---------- Gate banner ---------- */
.gate {
  border: 1px solid rgba(var(--amber-rgb),0.32); background: rgba(var(--amber-rgb),0.055);
  border-radius: var(--radius-lg); padding: 16px 18px; position: relative;
}
.gate.blocked  { border-color: rgba(var(--red-rgb),0.42); background: rgba(var(--red-rgb),0.07); }
.gate.approved { border-color: rgba(var(--teal-rgb),0.42); background: rgba(var(--teal-rgb),0.09); }
/* the meridian glows where the gate is signed — AI + HI aligned */
.gate.approved::before {
  content: ''; position: absolute; left: -1px; top: 12px; bottom: 12px; width: 1px;
  background: var(--teal-lift); box-shadow: 0 0 10px 1px rgba(var(--teal-lift-rgb),0.45);
}

/* ---------- Tables — tabular numerals throughout ---------- */
table.t { width: 100%; border-collapse: collapse; font-size: 0.87rem; font-variant-numeric: tabular-nums; }
table.t th {
  text-align: left; font-family: var(--sub); font-size: 0.635rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.18em; color: var(--text-faint);
  padding: 10px 12px; border-bottom: 1px solid var(--line-2); white-space: nowrap;
}
table.t td { padding: 12px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.t tr:last-child td { border-bottom: 0; }
table.t tbody tr:hover { background: rgba(var(--fg-rgb),0.018); }

/* ---------- Pricing ---------- */
.tier {
  background: var(--ink-2); border: 1px solid var(--line); border-radius: var(--radius-lg);
  padding: 28px 24px; display: flex; flex-direction: column; position: relative;
}
.tier.featured { border-color: rgba(var(--amber-rgb),0.38); background: var(--ink-3); }
.tier.featured::before {
  content: ''; position: absolute; left: 24px; right: 24px; top: -1px; height: 1px;
  background: var(--amber); box-shadow: 0 0 10px 1px rgba(var(--amber-rgb),0.4);
}
.tier-name { font-family: var(--sub); font-size: 0.68rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.2em; color: var(--text-faint); }
.tier-price {
  font-family: var(--display); font-size: 2.15rem; font-weight: 380; color: var(--parchment);
  letter-spacing: -0.03em; margin-top: 14px; line-height: 1;
  font-variant-numeric: tabular-nums; font-variation-settings: 'SOFT' 0, 'WONK' 1;
}
.tier-per { font-family: var(--mono); font-size: 0.66rem; color: var(--text-faint); letter-spacing: 0.08em; margin-top: 7px; }
.tier ul { list-style: none; padding: 0; margin: 20px 0 0; }
.tier li {
  font-size: 0.85rem; color: var(--text-dim); padding: 7px 0 7px 18px; position: relative; line-height: 1.5;
}
.tier li::before {
  content: ''; position: absolute; left: 0; top: 15px; width: 7px; height: 1px; background: var(--amber-deep);
}

/* ---------- Retrieval spine ---------- */
.spine-tier {
  display: grid; grid-template-columns: 74px 1fr; gap: 20px;
  padding: 20px 0; border-bottom: 1px solid var(--line);
}
.spine-tier:last-child { border-bottom: 0; }
.spine-n { font-family: var(--mono); font-size: 0.66rem; color: var(--amber); letter-spacing: 0.1em; padding-top: 4px; }
@media (max-width: 620px) { .spine-tier { grid-template-columns: 1fr; gap: 8px; } }

/* ---------- Utility ---------- */
.stack > * + * { margin-top: 13px; }
.stack-lg > * + * { margin-top: 25px; }
.tc { text-align: center; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.mt0{margin-top:0}.mt1{margin-top:8px}.mt2{margin-top:16px}.mt3{margin-top:24px}.mt4{margin-top:36px}.mt5{margin-top:52px}
.mb0{margin-bottom:0}.mb1{margin-bottom:8px}.mb2{margin-bottom:16px}.mb3{margin-bottom:24px}.mb4{margin-bottom:36px}.mb5{margin-bottom:52px}
.small { font-size: 0.83rem; }
.xs { font-size: 0.745rem; }
.nowrap { white-space: nowrap; }
.hidden { display: none !important; }
.tnum { font-variant-numeric: tabular-nums; }

/* ---------- Spinner ---------- */
.spin {
  width: 14px; height: 14px; border: 1.5px solid rgba(var(--fg-rgb),0.16);
  border-top-color: var(--amber); border-radius: 50%;
  animation: sp .72s linear infinite; display: inline-block; vertical-align: -2px;
}
@keyframes sp { to { transform: rotate(360deg); } }

.pulse { animation: pl 2.1s ease-in-out infinite; }
@keyframes pl { 0%,100% { opacity: 1 } 50% { opacity: 0.52 } }

/* ---------- Reveal on scroll ---------- */
.rv { opacity: 0; transform: translateY(14px); transition: opacity .75s var(--ease), transform .75s var(--ease); }
.rv.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) { .rv { opacity: 1; transform: none; } }

/* ---------- About page ---------- */
.about-page { overflow: hidden; }
.about-hero {
  min-height: 610px; display: flex; align-items: center; padding: 116px 0 92px;
  background:
    radial-gradient(circle at 76% 32%, rgba(var(--teal-rgb),0.16), transparent 27%),
    linear-gradient(135deg, var(--ink-deep), var(--ink) 58%, var(--ink-2));
  border-bottom: 1px solid var(--line);
}
.about-hero-grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 80px; align-items: center; }
.about-title { max-width: 760px; }
.about-title em, .about-boundary-quote em { color: var(--amber); font-style: italic; }
.about-signal {
  padding: 26px; border: 1px solid rgba(var(--amber-rgb),0.32); border-radius: var(--radius-lg);
  background: linear-gradient(150deg, rgba(var(--amber-rgb),0.09), rgba(var(--teal-rgb),0.06));
  box-shadow: 0 22px 60px rgba(0,0,0,0.18);
}
.about-signal-mark, .about-audience-index { color: var(--amber); letter-spacing: .16em; }
.about-signal p { margin: 42px 0 34px; font-size: 1.48rem; line-height: 1.26; color: var(--parchment); }
.about-signal-rule { display: block; width: 62px; height: 1px; margin-bottom: 17px; background: var(--amber); opacity: .65; }
.about-split { display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr); gap: 92px; align-items: start; }
.about-split--align { align-items: center; }
.about-origin { background: var(--ink-2); border-bottom: 1px solid var(--line); }
.about-copy { max-width: 650px; color: var(--text-dim); }
.about-copy p { margin: 0 0 18px; }
.about-copy p:last-child { margin-bottom: 0; }
.about-copy strong { color: var(--parchment); font-weight: 600; }
.about-principles { border-bottom: 1px solid var(--line); }
.about-principle-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.about-principle { min-height: 246px; padding: 22px; }
.about-number { color: var(--teal-lift); font-size: .68rem; letter-spacing: .14em; }
.about-principle h3 { font-size: 1rem; }
.about-principle p, .about-audience p { line-height: 1.64; }
.about-for { background: var(--ink-deep); border-bottom: 1px solid var(--line); }
.about-audience-list { border-top: 1px solid var(--line-2); }
.about-audience { display: grid; grid-template-columns: 42px 1fr; gap: 16px; padding: 20px 0; border-bottom: 1px solid var(--line-2); }
.about-audience-index { padding-top: 4px; }
.about-owner { border-bottom: 1px solid var(--line); }
.about-owner-card { display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr); gap: 92px; padding: 34px 0; border-top: 1px solid rgba(var(--amber-rgb),0.24); border-bottom: 1px solid rgba(var(--amber-rgb),0.24); }
.about-boundary { padding-bottom: 118px; }
.about-boundary-quote { max-width: 760px; margin-left: auto; margin-right: auto; font-size: clamp(1.25rem, 2.4vw, 1.8rem); line-height: 1.45; color: var(--text-dim); }
@media (max-width: 900px) {
  .about-hero-grid, .about-split, .about-owner-card { grid-template-columns: 1fr; gap: 42px; }
  .about-hero { padding: 92px 0 74px; min-height: 0; }
  .about-signal { max-width: 420px; }
  .about-principle-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 560px) {
  .about-principle-grid { grid-template-columns: 1fr; }
  .about-principle { min-height: auto; }
}

/* ---------- Toast ---------- */
#toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(80px);
  background: var(--ink-3); border: 1px solid var(--line-2); color: var(--text);
  padding: 12px 18px; border-radius: var(--radius); font-size: 0.865rem;
  z-index: 200; opacity: 0; transition: all .3s var(--ease); pointer-events: none;
  max-width: 90vw; box-shadow: 0 16px 48px rgba(0,0,0,0.55);
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.err { border-color: rgba(var(--red-rgb),0.52); }
#toast.ok  { border-color: rgba(var(--teal-rgb),0.5); }

/* ---------- Footer + legal stitch ---------- */
.foot { border-top: 1px solid var(--line); padding: 46px 0 0; }
.foot a:hover { color: var(--parchment); }
.legal-stitch {
  margin-top: 40px; border-top: 1px solid var(--line);
  padding: 18px 0 32px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  font-family: var(--mono); font-size: 0.635rem; letter-spacing: 0.1em;
  color: var(--text-ghost); text-transform: uppercase;
}
.legal-stitch b { color: var(--text-faint); font-weight: 500; }

/* ---------- App shell / three-column workspace ---------- */
.ws {
  display: grid;
  grid-template-columns: 244px minmax(0, 1fr) 344px;
  gap: 0;
  align-items: start;
  min-height: calc(100vh - 64px);
  /* the column tint lives on the grid so both rails read full-height even
     when their content is shorter than the editor column */
  background: linear-gradient(
    90deg,
    var(--ink-deep) 0 244px,
    var(--ink) 244px calc(100% - 344px),
    var(--ink-deep) calc(100% - 344px) 100%
  );
}
.ws-rail {
  border-right: 1px solid var(--line); background: transparent;
  padding: 22px 0; position: sticky; top: 64px;
  max-height: calc(100vh - 64px); overflow: auto;
}
.ws-main { padding: 24px 28px 90px; min-width: 0; }
.ws-gov {
  border-left: 1px solid var(--line); background: transparent;
  padding: 22px 20px 60px; position: sticky; top: 64px;
  max-height: calc(100vh - 64px); overflow: auto;
}
.ws-sec { padding: 0 18px; margin-bottom: 24px; }
.ws-sec-h {
  font-family: var(--sub); font-size: 0.615rem; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.2em; color: var(--text-ghost); margin-bottom: 11px;
}
.ws-item {
  display: block; padding: 8px 18px; font-size: 0.85rem; color: var(--text-dim);
  border-left: 1px solid transparent; transition: all .18s var(--ease);
}
.ws-item:hover { color: var(--text); background: rgba(var(--fg-rgb),0.025); }
.ws-item.on { color: var(--amber); border-left-color: var(--amber); background: rgba(var(--amber-rgb),0.06); }
.ws-stage {
  display: flex; align-items: baseline; gap: 10px; padding: 7px 18px;
  border-left: 1px solid transparent; font-size: 0.83rem; color: var(--text-faint);
  transition: all .18s var(--ease);
}
.ws-stage .n { font-family: var(--mono); font-size: 0.6rem; letter-spacing: 0.08em; }
.ws-stage:hover { color: var(--text-dim); background: rgba(var(--fg-rgb),0.02); }
.ws-stage.done { color: var(--teal-lift); border-left-color: rgba(var(--teal-rgb),0.5); }
.ws-stage.active { color: var(--amber); border-left-color: var(--amber); background: rgba(var(--amber-rgb),0.06); }

@media (max-width: 1280px) {
  .ws {
    grid-template-columns: 220px minmax(0, 1fr);
    background: linear-gradient(90deg, var(--ink-deep) 0 220px, var(--ink) 220px 100%);
  }
  .ws-gov {
    grid-column: 1 / -1; border-left: 0; border-top: 1px solid var(--line);
    position: static; max-height: none; padding: 22px 28px 70px; background: var(--ink-deep);
  }
}
@media (max-width: 900px) {
  .ws { grid-template-columns: 1fr; background: var(--ink); }
  .ws-rail { border-right: 0; border-bottom: 1px solid var(--line); position: static; max-height: none; background: var(--ink-deep); }
  .ws-main { padding: 20px 20px 60px; }
  .ws-gov { padding: 20px 20px 50px; }
}

/* legacy two-column shell (dashboard) */
.shell { display: grid; grid-template-columns: 244px 1fr; min-height: calc(100vh - 64px); }
.side { border-right: 1px solid var(--line); padding: 24px 0; background: var(--ink-deep); }
.main { padding: 30px 32px 80px; min-width: 0; }
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .side { border-right: 0; border-bottom: 1px solid var(--line); }
  .main { padding: 22px 20px 60px; }
}

/* ============================================================
   Private Secured Consult
   Every colour below composes from the RGB channel tokens, so the light
   theme inherits this block without a single extra override.
   ============================================================ */

.consult-shell {
  display: grid;
  grid-template-columns: 262px 1fr;
  height: calc(100vh - 64px);
  min-height: 0;
}

/* ---- thread rail ---- */
.consult-rail {
  border-right: 1px solid var(--line);
  background: var(--ink-deep);
  display: flex; flex-direction: column; min-height: 0;
}
.consult-rail-head { padding: 16px; border-bottom: 1px solid var(--line); }
.consult-rail-scroll { flex: 1; overflow-y: auto; padding: 8px 0; min-height: 0; }
.consult-rail-item {
  display: block; padding: 10px 16px; border-left: 2px solid transparent;
  transition: background .18s var(--ease), border-color .18s var(--ease);
}
.consult-rail-item:hover { background: rgba(var(--fg-rgb),0.035); }
.consult-rail-item.is-active {
  background: rgba(var(--amber-rgb),0.07); border-left-color: var(--amber);
}
.consult-rail-title {
  display: block; font-family: var(--sub); font-size: 0.855rem; line-height: 1.4;
  color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.consult-rail-item.is-active .consult-rail-title { color: var(--amber); }
.consult-rail-meta { display: block; font-size: 0.62rem; color: var(--text-faint); margin-top: 3px; letter-spacing: 0.06em; }
.consult-rail-foot { padding: 16px; border-top: 1px solid var(--line); }

/* ---- main column ---- */
.consult-main { display: flex; flex-direction: column; min-height: 0; min-width: 0; background: var(--ink); }
.consult-head {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 16px;
  padding: 20px 30px 16px; border-bottom: 1px solid var(--line); flex-wrap: wrap;
}
.consult-integrity-strip {
  display: flex; align-items: center; justify-content: space-between; gap: 18px; flex-wrap: wrap;
  padding: 11px 30px; border-bottom: 1px solid var(--line);
  background: rgba(var(--teal-rgb),0.045);
}
.consult-integrity-copy { display: flex; align-items: baseline; gap: 10px; }
.consult-integrity-items { display: flex; flex-wrap: wrap; gap: 7px 15px; }
.consult-integrity-items span {
  font-family: var(--mono); font-size: 0.61rem; letter-spacing: 0.04em; color: var(--text-dim); white-space: nowrap;
}
.consult-integrity-items i { color: var(--teal-lift); margin-right: 4px; }
.consult-transcript { flex: 1; overflow-y: auto; padding: 26px 30px 30px; min-height: 0; }

/* ---- empty state ---- */
.consult-empty { max-width: 780px; }
.consult-diff { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.consult-diff-col {
  padding: 15px 17px; border: 1px solid var(--line); border-radius: var(--radius-lg);
  background: rgba(var(--fg-rgb),0.018);
}
.consult-diff-col.is-ours {
  border-color: rgba(var(--amber-rgb),0.32);
  background: linear-gradient(160deg, rgba(var(--amber-rgb),0.065), transparent 70%);
}
.consult-diff-list { margin: 0; padding-left: 17px; }
.consult-diff-list li {
  font-family: var(--sub); font-size: 0.83rem; line-height: 1.55;
  color: var(--text-dim); margin-bottom: 6px;
}
.consult-diff-col.is-ours .consult-diff-list li { color: var(--text); }
.consult-seeds { display: flex; flex-wrap: wrap; gap: 8px; }
.consult-seed {
  padding: 8px 13px; border: 1px solid var(--line-2); border-radius: 100px;
  background: transparent; color: var(--text-dim); cursor: pointer;
  font-family: var(--sub); font-size: 0.8rem; text-align: left;
  transition: border-color .18s var(--ease), color .18s var(--ease);
}
.consult-seed:hover { border-color: rgba(var(--amber-rgb),0.5); color: var(--amber); }

/* ---- turns ---- */
.turn { margin-bottom: 30px; }
.turn-q {
  display: flex; gap: 11px; align-items: flex-start;
  padding: 13px 16px; border-radius: var(--radius-lg);
  border: 1px solid var(--line-2); background: rgba(var(--fg-rgb),0.032);
  max-width: 82ch;
}
.turn-q-text { font-family: var(--sub); font-size: 0.93rem; line-height: 1.6; color: var(--text); white-space: pre-wrap; }
.turn-badge {
  flex: none; font-family: var(--mono); font-size: 0.6rem; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--text-faint); padding-top: 3px;
}
.turn-a { margin-top: 16px; max-width: 82ch; }

/* gate strip — the provenance of the answer, always visible */
.gate-strip {
  display: flex; flex-wrap: wrap; gap: 7px; align-items: center;
  padding-bottom: 12px; margin-bottom: 14px; border-bottom: 1px solid var(--line);
}
.answer-lede {
  font-family: var(--sub); font-size: 1.005rem; line-height: 1.68; color: var(--text);
  margin: 0 0 18px;
}
.a-sec { margin-bottom: 16px; }
.a-sec-h {
  font-family: var(--mono); font-size: 0.645rem; letter-spacing: 0.13em;
  text-transform: uppercase; color: var(--amber); margin-bottom: 5px;
  display: flex; align-items: baseline; gap: 7px;
}
/* Priority rank. Carries real meaning — 1 is what to act on first — so it is a
   visible token rather than relying on the reader inferring rank from order. */
.a-rank {
  flex: 0 0 auto;
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 15px; height: 15px; padding: 0 3px;
  border: 1px solid rgba(var(--amber-rgb),0.5);
  border-radius: 3px;
  font-size: 0.58rem; line-height: 1;
  color: var(--amber); background: rgba(var(--amber-rgb),0.09);
}
.a-sec-b { font-family: var(--sub); font-size: 0.9rem; line-height: 1.64; color: var(--text-dim); margin: 0; }

.a-block {
  padding: 14px 16px; border-radius: var(--radius-lg); border: 1px solid var(--line);
  background: rgba(var(--fg-rgb),0.022); margin-bottom: 14px;
}
.a-block.is-direction { border-left: 2px solid var(--teal-lift); }
.a-block.is-gap { border-left: 2px solid var(--amber); }
.a-block.is-boundary { border-left: 2px solid var(--whisper-red); }
.a-step { display: flex; gap: 10px; margin-bottom: 11px; }
.a-step:last-child { margin-bottom: 0; }
.a-step-n {
  flex: none; font-family: var(--mono); font-size: 0.66rem; color: var(--teal-lift);
  padding-top: 2px; min-width: 16px;
}
.a-step-t { font-family: var(--sub); font-size: 0.88rem; line-height: 1.55; color: var(--text); margin: 0; }
.a-step-w { font-family: var(--sub); font-size: 0.805rem; line-height: 1.5; color: var(--text-faint); margin: 3px 0 0; }

/* claim + source ledgers */
.led-toggle {
  display: inline-flex; align-items: center; gap: 7px; cursor: pointer;
  font-family: var(--mono); font-size: 0.645rem; letter-spacing: 0.11em;
  text-transform: uppercase; color: var(--text-faint); background: none;
  border: 0; padding: 6px 0; transition: color .18s var(--ease);
}
.led-toggle:hover { color: var(--amber); }
/* The claim and source toggles sit as inline-flex siblings, so without an explicit
   row they butt together and read as one run-on string ("CLAIM LEDGER · 10> SOURCES
   SEARCHED · 20"). Wrapping them in a spaced row keeps each one legible as its own
   control. */
.led-row { display: flex; flex-wrap: wrap; gap: 20px; align-items: center; }
.led { border-top: 1px solid var(--line); margin-top: 4px; padding-top: 10px; }
.claim-row { padding: 9px 0; border-bottom: 1px solid var(--line); }
.claim-row:last-child { border-bottom: 0; }
.claim-t { font-family: var(--sub); font-size: 0.855rem; line-height: 1.55; color: var(--text); margin: 0 0 5px; }
.src-row { padding: 9px 0; border-bottom: 1px solid var(--line); }
.src-row:last-child { border-bottom: 0; }
.src-t { font-family: var(--sub); font-size: 0.845rem; line-height: 1.5; color: var(--text); margin: 0; }
.src-m { font-family: var(--mono); font-size: 0.635rem; color: var(--text-faint); margin-top: 3px; }
.src-t a { color: var(--teal-lift); }

/* refusal — the de-identification gate stopping a turn */
.refusal {
  padding: 16px 18px; border-radius: var(--radius-lg);
  border: 1px solid rgba(var(--red-rgb),0.42); border-left: 2px solid var(--whisper-red);
  background: rgba(var(--red-rgb),0.07); max-width: 82ch; margin-top: 16px;
}
.phi-flag {
  display: flex; justify-content: space-between; gap: 12px; padding: 6px 0;
  border-bottom: 1px solid rgba(var(--red-rgb),0.16);
}
.phi-flag:last-child { border-bottom: 0; }
.phi-label { font-family: var(--sub); font-size: 0.82rem; color: var(--text); }
.phi-ex { font-family: var(--mono); font-size: 0.7rem; color: var(--whisper-red); }

/* ---- composer ---- */
.consult-composer { border-top: 1px solid var(--line); padding: 14px 30px 18px; background: var(--ink-deep); }
.consult-input-wrap {
  border: 1px solid var(--line-2); border-radius: var(--radius-lg);
  background: rgba(var(--fg-rgb),0.028); transition: border-color .2s var(--ease);
}
.consult-input-wrap:focus-within { border-color: rgba(var(--amber-rgb),0.5); }
.consult-input {
  width: 100%; border: 0; background: transparent; resize: vertical;
  padding: 13px 15px 8px; color: var(--text);
  font-family: var(--sub); font-size: 0.95rem; line-height: 1.6; min-height: 58px;
}
.consult-input:focus { outline: none; }
.consult-input::placeholder { color: var(--text-ghost); }
.consult-actions {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  padding: 7px 11px 9px; flex-wrap: wrap;
}
.consult-mode {
  display: inline-flex; align-items: center; gap: 6px; cursor: pointer;
  font-family: var(--mono); font-size: 0.645rem; letter-spacing: 0.09em;
  text-transform: uppercase; color: var(--text-faint); padding-left: 4px;
}
.consult-mode input { accent-color: var(--amber); }
.consult-attached { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 9px; }
.att-pill {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 5px 10px; border: 1px solid rgba(var(--teal-rgb),0.4);
  background: rgba(var(--teal-rgb),0.1); border-radius: 100px;
  font-family: var(--mono); font-size: 0.655rem; color: var(--teal-lift);
}
.att-pill button { background: none; border: 0; color: inherit; cursor: pointer; opacity: 0.6; padding: 0; }
.att-pill button:hover { opacity: 1; }

/* thinking indicator — names the stage so the wait is legible, not dead air */
.thinking {
  display: flex; align-items: center; gap: 10px; padding: 14px 16px;
  border: 1px dashed var(--line-2); border-radius: var(--radius-lg);
  max-width: 82ch; margin-top: 16px;
}
.thinking-t { font-family: var(--mono); font-size: 0.7rem; letter-spacing: 0.08em; color: var(--text-dim); }

@media (max-width: 980px) {
  .consult-shell { grid-template-columns: 1fr; height: auto; }
  .consult-rail { border-right: 0; border-bottom: 1px solid var(--line); }
  .consult-rail-scroll { max-height: 190px; }
  .consult-diff { grid-template-columns: 1fr; }
  .integrity-onboarding-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .consult-head, .consult-transcript, .consult-composer, .consult-integrity-strip { padding-left: 18px; padding-right: 18px; }
}

@media (max-width: 620px) {
  .integrity-onboarding-grid { grid-template-columns: 1fr; gap: 14px; }
  .integrity-step { min-height: 0; }
  .consult-integrity-copy { display: block; }
  .consult-integrity-copy .xs { display: block; margin-top: 4px; }
  .consult-integrity-items { gap: 7px 12px; }
}

/* live dictation — a recording indicator has to be unmistakable, because the
   user needs to know at a glance whether a microphone is open */
#dictate-btn.is-live {
  color: var(--whisper-red);
  border-color: rgba(var(--red-rgb),0.5);
  background: rgba(var(--red-rgb),0.1);
}
#dictate-btn.is-live i { animation: pulse-mic 1.15s ease-in-out infinite; }
@keyframes pulse-mic { 0%,100% { opacity: 1 } 50% { opacity: 0.3 } }

/* No browser speech engine (Firefox, Safari-as-PWA). The button stays enabled
   and points at the device's own dictation key instead of going dead: a greyed
   out control would teach an iPad user that voice input is impossible here,
   which is untrue and would cost us the feature on the exact devices a ward
   round actually uses. Muted, not disabled. */
#dictate-btn.is-fallback { opacity: 0.72; }
#dictate-btn.is-fallback i { opacity: 0.8; }

/* drop target for a dragged document */
.consult-transcript.is-drop {
  outline: 1px dashed rgba(var(--teal-rgb),0.55);
  outline-offset: -8px;
  background: rgba(var(--teal-rgb),0.03);
}
