/* Theme tokens.
   Light is the default. Dark applies when the user picks it (data-theme="dark") or when
   the OS prefers dark and the user hasn't explicitly chosen light. Every colour is a
   token so both themes stay in sync — never hardcode a hex in a component rule. */

:root {
  --page: #FBFBF9;
  --surface: #FFFFFF;
  --surface-sunk: #F4F3F0;
  --line: #E4E2DC;
  --line-soft: #EFEDE8;

  --ink: #0F1113;
  --ink-2: #555D67;
  --ink-3: #8B939C;

  --accent: #D6350F;
  --accent-ink: #FFFFFF;
  --accent-soft: #FBEDE9;

  --band-low: #0E7C66;
  --band-medium: #B4700A;
  --band-high: #C2410C;
  --band-unavoidable: #B42318;
  --band-info: #4338CA;

  --cost-bg: #FFF8F0;
  --cost-line: #F6D6B3;
  --cost-ink: #7A3A0C;

  --danger-bg: #FDF3F0;
  --danger-line: #F3C6BC;
  --danger-ink: #8C2A12;

  --serif: 'Instrument Serif', Georgia, serif;
  --sans: 'IBM Plex Sans', system-ui, -apple-system, sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, monospace;

  --shadow-sm: 0 1px 2px rgba(15,17,19,0.04);
  --shadow: 0 1px 2px rgba(15,17,19,0.04), 0 12px 32px rgba(15,17,19,0.06);
  --shadow-lg: 0 2px 4px rgba(15,17,19,0.04), 0 24px 60px rgba(15,17,19,0.10);

  --r-sm: 10px;
  --r: 16px;
  --r-lg: 24px;

  /* Editorial type scale — fluid, so the hero stays dramatic on a projector and
     still fits a laptop. */
  --fs-stat: clamp(72px, 13vw, 168px);
  --fs-h1: clamp(30px, 4.4vw, 52px);
  --fs-h2: clamp(24px, 3vw, 36px);
  --fs-lead: clamp(16.5px, 1.5vw, 20px);

  --ease: cubic-bezier(0.22, 0.72, 0.2, 1);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --page: #0B0D0F;
    --surface: #141719;
    --surface-sunk: #1B1F22;
    --line: #262B30;
    --line-soft: #1E2226;

    --ink: #F2F4F6;
    --ink-2: #A9B1BA;
    --ink-3: #767E88;

    --accent: #FF6A4D;
    --accent-ink: #1A0B06;
    --accent-soft: rgba(255,106,77,0.16);

    --band-low: #34D399;
    --band-medium: #FBBF24;
    --band-high: #FB923C;
    --band-unavoidable: #F87171;
    --band-info: #A5B4FC;

    --cost-bg: rgba(251,146,60,0.09);
    --cost-line: rgba(251,146,60,0.28);
    --cost-ink: #FBCFA8;

    --danger-bg: rgba(248,113,113,0.09);
    --danger-line: rgba(248,113,113,0.28);
    --danger-ink: #FCA5A5;

    --shadow-sm: 0 1px 2px rgba(0,0,0,0.4);
    --shadow: 0 1px 2px rgba(0,0,0,0.4), 0 12px 32px rgba(0,0,0,0.35);
    --shadow-lg: 0 2px 4px rgba(0,0,0,0.4), 0 24px 60px rgba(0,0,0,0.45);
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --page: #0B0D0F;
  --surface: #141719;
  --surface-sunk: #1B1F22;
  --line: #262B30;
  --line-soft: #1E2226;

  --ink: #F2F4F6;
  --ink-2: #A9B1BA;
  --ink-3: #767E88;

  --accent: #FF6A4D;
  --accent-ink: #1A0B06;
  --accent-soft: rgba(255,106,77,0.16);

  --band-low: #34D399;
  --band-medium: #FBBF24;
  --band-high: #FB923C;
  --band-unavoidable: #F87171;
  --band-info: #A5B4FC;

  --cost-bg: rgba(251,146,60,0.09);
  --cost-line: rgba(251,146,60,0.28);
  --cost-ink: #FBCFA8;

  --danger-bg: rgba(248,113,113,0.09);
  --danger-line: rgba(248,113,113,0.28);
  --danger-ink: #FCA5A5;

  --shadow-sm: 0 1px 2px rgba(0,0,0,0.4);
  --shadow: 0 1px 2px rgba(0,0,0,0.4), 0 12px 32px rgba(0,0,0,0.35);
  --shadow-lg: 0 2px 4px rgba(0,0,0,0.4), 0 24px 60px rgba(0,0,0,0.45);
  color-scheme: dark;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15.5px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button { font: inherit; color: inherit; cursor: pointer; }
.mono { font-family: var(--mono); font-size: 0.92em; }
.right { text-align: right; }
.spacer { flex: 1; }
.muted { color: var(--ink-3); }

[data-band="low"] { --band: var(--band-low); }
[data-band="medium"] { --band: var(--band-medium); }
[data-band="high"] { --band: var(--band-high); }
[data-band="unavoidable"] { --band: var(--band-unavoidable); }
[data-band="info"] { --band: var(--band-info); }
.band-text { color: var(--band, var(--ink-3)); }
.band-bg { background: var(--band, var(--line)); }

/* Scroll reveal — the one motion idea, used sparingly. */
.reveal {
  opacity: 0; transform: translateY(18px);
  transition: opacity 0.75s var(--ease), transform 0.75s var(--ease);
}
.reveal.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .reveal, .reveal.in { opacity: 1; transform: none; transition: none; }
}

main { display: block; }

/* Horizontal bands, each with its own breathing room — the Apple section rhythm. */
.chapter { border-top: 1px solid var(--line-soft); }
.chapter:first-of-type { border-top: none; }
/* Tinted bands break the endless cream into a rhythm. */
.chapter.tint { background: var(--surface-sunk); border-top-color: transparent; }
.wrap { max-width: 1140px; margin: 0 auto; padding: 0 32px; }
.chapter > .wrap { padding-top: 76px; padding-bottom: 76px; }
.chapter.tight > .wrap { padding-top: 40px; padding-bottom: 40px; }

.eyebrow {
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--accent); margin: 0 0 14px;
}
.chapter-title {
  font-family: var(--serif); font-weight: 400; font-size: var(--fs-h2);
  letter-spacing: -0.02em; line-height: 1.08; margin: 0 0 10px;
}
.chapter-note { margin: 0 0 30px; color: var(--ink-2); font-size: 15px; max-width: 70ch; }

/* ---------- stacked mix bar ---------- */

.stack { display: grid; gap: 16px; }
.stack-bar {
  display: flex; height: 56px; border-radius: var(--r-sm); overflow: hidden;
  box-shadow: var(--shadow-sm); background: var(--line);
}
.stack-seg {
  display: block; background: var(--band); transition: flex-basis 0.9s var(--ease);
  position: relative;
}
.stack-seg + .stack-seg { border-left: 2px solid var(--surface-sunk); }
.stack-key { display: flex; flex-wrap: wrap; gap: 22px; }
.key {
  display: inline-flex; align-items: baseline; gap: 8px;
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--ink-2);
}
.key-dot {
  width: 10px; height: 10px; border-radius: 3px; background: var(--band);
  align-self: center;
}
.key strong { font-size: 15px; color: var(--ink); letter-spacing: 0; }
.key-pct { color: var(--ink-3); letter-spacing: 0; text-transform: none; }

/* ---------- header ---------- */

header {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 16px;
  padding: 13px 32px;
  background: color-mix(in srgb, var(--page) 82%, transparent);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.3s var(--ease);
}
header.scrolled { border-bottom-color: var(--line-soft); }

.brand { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.brand-name {
  font-family: var(--serif); font-size: 21px; letter-spacing: 0.2px;
}

nav { display: flex; gap: 2px; }
.nav-item {
  border: none; background: none; padding: 7px 13px; border-radius: 999px;
  font-size: 14px; color: var(--ink-2); transition: color 0.2s var(--ease), background 0.2s var(--ease);
}
.nav-item:hover { color: var(--ink); }
.nav-item.active { background: var(--surface-sunk); color: var(--ink); }

.icon-btn {
  border: 1px solid var(--line); background: var(--surface); color: var(--ink-2);
  width: 32px; height: 32px; border-radius: 999px; line-height: 1;
  display: inline-flex; align-items: center; justify-content: center; font-size: 14px;
  transition: color 0.2s var(--ease), border-color 0.2s var(--ease);
}
.icon-btn:hover { color: var(--ink); border-color: var(--ink-3); }

.source-chip {
  display: inline-flex; align-items: center; gap: 7px;
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.04em;
  color: var(--cost-ink); padding: 5px 11px; border: 1px solid var(--cost-line);
  border-radius: 999px; background: var(--cost-bg);
}
.source-chip .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--band-medium); }

.identity {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 5px 12px 5px 10px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface);
  max-width: 42ch; overflow: hidden;
}
.identity-dot { width: 7px; height: 7px; border-radius: 50%; flex: none; background: var(--ink-3); }
.identity-dot[data-role="admin"]   { background: var(--accent); }
.identity-dot[data-role="dean"]    { background: var(--band-medium); }
.identity-dot[data-role="advisor"] { background: var(--band-low); }
.identity-dot[data-role="student"] { background: #6366F1; }
.identity-role {
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--ink); flex: none;
}
.identity-email {
  font-size: 12.5px; color: var(--ink-3);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* ---------- hero ---------- */

/* A colour wash behind the hero so the top of the page isn't a blank field. */
.hero {
  position: relative; overflow: hidden;
  background:
    radial-gradient(120% 140% at 88% -30%, color-mix(in srgb, var(--accent) 14%, transparent), transparent 62%),
    radial-gradient(90% 120% at 8% -10%, color-mix(in srgb, var(--band-medium) 10%, transparent), transparent 58%);
}
.hero > .wrap { padding-top: 88px; padding-bottom: 60px; position: relative; }
.hero-stat {
  font-family: var(--serif); font-weight: 400;
  font-size: var(--fs-stat); line-height: 0.86;
  letter-spacing: -0.045em; margin: 0 0 6px;
  color: var(--band, var(--ink));
}
.hero-stat.accent { color: var(--accent); }
/* Five- and six-character figures (32,593) would otherwise run off the page. */
.hero-stat.long { font-size: clamp(52px, 8.5vw, 116px); letter-spacing: -0.04em; }
.hero-sub strong { color: var(--ink); font-weight: 600; }

.hero-grid {
  display: grid; grid-template-columns: 1.25fr 0.75fr;
  gap: 56px; align-items: center;
}
.hero-aside { display: grid; justify-items: center; gap: 20px; }

/* ---------- perspective picker (demo) ---------- */

.picker { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px; }
.pick-card {
  display: grid; gap: 8px; text-align: left; padding: 26px;
  border-radius: var(--r); border: 1px solid var(--line);
  background: linear-gradient(180deg, color-mix(in srgb, var(--band) 9%, var(--surface)), var(--surface) 72%);
  box-shadow: var(--shadow-sm);
  transition: transform 0.22s var(--ease), box-shadow 0.22s var(--ease), border-color 0.22s var(--ease);
}
.pick-card:hover, .pick-card:focus-visible {
  transform: translateY(-3px); box-shadow: var(--shadow);
  border-color: color-mix(in srgb, var(--band) 45%, var(--line)); outline: none;
}
.pick-role {
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--band);
}
.pick-who { font-family: var(--serif); font-size: 27px; line-height: 1.1; letter-spacing: -0.02em; }
.pick-sees { font-size: 14.5px; color: var(--ink-2); line-height: 1.5; }
.pick-cannot { font-size: 13px; color: var(--ink-3); line-height: 1.45; }
.pick-go {
  margin-top: 8px; font-size: 13.5px; color: var(--band); font-weight: 500;
}

.source-chip.demo { cursor: pointer; }
.source-chip .switch-hint {
  border-left: 1px solid var(--cost-line); padding-left: 8px; margin-left: 2px;
  text-transform: uppercase; letter-spacing: 0.1em; opacity: 0.75;
}
.source-chip.demo:hover { border-color: var(--band-medium); }

/* ---------- agent preview (landing hero) ---------- */

.agent-preview {
  width: 100%; max-width: 420px; cursor: pointer;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); overflow: hidden;
  box-shadow: var(--shadow-lg);
  transition: transform 0.3s var(--ease), box-shadow 0.3s var(--ease), border-color 0.3s var(--ease);
}
.agent-preview:hover, .agent-preview:focus-visible {
  transform: translateY(-4px); border-color: color-mix(in srgb, var(--accent) 40%, var(--line));
  outline: none;
}
.ap-bar {
  display: flex; align-items: center; gap: 6px;
  padding: 11px 16px; border-bottom: 1px solid var(--line-soft);
  background: var(--surface-sunk);
}
.ap-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--line); }
.ap-dot:first-child { background: color-mix(in srgb, var(--accent) 65%, transparent); }
.ap-title {
  margin-left: 8px; font-family: var(--mono); font-size: 10.5px;
  letter-spacing: 0.08em; color: var(--ink-3);
}
.ap-body { padding: 24px 20px 20px; }
.ap-heading {
  font-family: var(--serif); font-size: 26px; letter-spacing: -0.02em;
  margin: 0 0 18px; color: var(--ink);
}
.ap-starters { display: grid; gap: 9px; margin-bottom: 18px; }
.ap-starter {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 12px 15px; border-radius: var(--r-sm);
  border: 1px solid var(--line); background: var(--page);
  font-size: 13px; color: var(--ink-2);
}
.ap-starter i { font-style: normal; color: var(--ink-3); }
.agent-preview:hover .ap-starter { border-color: color-mix(in srgb, var(--accent) 26%, var(--line)); }
.ap-composer {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 7px 7px 16px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--page);
}
.ap-placeholder { flex: 1; font-size: 13.5px; color: var(--ink-3); }
.ap-send {
  width: 30px; height: 30px; border-radius: 50%; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--accent); color: var(--accent-ink); font-size: 14px;
}

/* ---------- donut ---------- */

.donut-wrap { position: relative; width: 100%; max-width: 230px; }
.donut { width: 100%; height: auto; display: block; }
.donut-track { fill: none; stroke: var(--line); stroke-width: 18; }
.donut-seg {
  fill: none; stroke: var(--band); stroke-width: 18; stroke-linecap: butt;
  transition: stroke-dasharray 0.9s var(--ease);
}
.donut-centre {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 2px; pointer-events: none;
}
.donut-value {
  font-family: var(--serif); font-size: clamp(30px, 3.6vw, 44px);
  line-height: 1; letter-spacing: -0.03em; color: var(--ink);
}
.donut-value .pc { font-size: 0.5em; }
.donut-label {
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--ink-3);
}
.donut-key { display: flex; flex-wrap: wrap; gap: 14px; justify-content: center; }
.donut-key .key { font-size: 10px; gap: 6px; }
.donut-key .key strong { font-size: 13px; }
.hero-headline {
  font-family: var(--serif); font-weight: 400; font-size: var(--fs-h1);
  line-height: 1.08; letter-spacing: -0.022em; margin: 0; max-width: 20ch;
  text-wrap: pretty;
}
.hero-sub {
  margin: 20px 0 0; color: var(--ink-2); font-size: var(--fs-lead);
  max-width: 62ch; line-height: 1.5; text-wrap: pretty;
}

/* ---------- landing ---------- */

.hero-headline .q { color: var(--accent); }
.cta-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.btn-lg { padding: 16px 30px; font-size: 16.5px; }
.btn-ghost {
  padding: 16px 26px; border-radius: 999px; font-size: 16.5px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  transition: border-color 0.2s var(--ease), background 0.2s var(--ease);
}
.btn-ghost:hover { border-color: var(--ink-3); background: var(--surface-sunk); }

.tiles-3 { grid-template-columns: repeat(3, 1fr); }
.tile-head { font-family: var(--serif); font-size: 25px; line-height: 1.15; margin: 0 0 10px; letter-spacing: -0.015em; }

.role-rows { display: grid; gap: 12px; }
.role-row {
  display: grid; grid-template-columns: 130px 1fr; gap: 20px; align-items: center;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r);
  padding: 20px 24px; color: var(--ink-2); font-size: 15px;
}
.role-row .role-name { font-weight: 600; color: var(--ink); }
.role-row em { font-style: normal; color: var(--ink); }

.teaser { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; }

/* ---------- chat ---------- */

/* In chat the page itself must not scroll — the thread does, so the composer can
   stay pinned like a real chat client. */
body.chat-mode { overflow: hidden; }
.chat {
  display: flex; flex-direction: column;
  height: calc(100vh - 58px); height: calc(100dvh - 58px);
}
.chat-thread { flex: 1; overflow-y: auto; scroll-behavior: smooth; }
.chat-thread-inner {
  max-width: 780px; margin: 0 auto; padding: 40px 24px 24px;
  display: flex; flex-direction: column; gap: 26px;
}

.chat-empty { padding: 8vh 0 0; text-align: left; }
.chat-empty-title {
  font-family: var(--serif); font-weight: 400; font-size: clamp(34px, 5vw, 52px);
  letter-spacing: -0.025em; line-height: 1.08; margin: 0 0 14px;
}
.chat-empty-sub { color: var(--ink-2); font-size: var(--fs-lead); margin: 0 0 32px; max-width: 54ch; }
.starters { display: grid; gap: 10px; }
.starter {
  display: flex; justify-content: space-between; align-items: center; gap: 16px;
  text-align: left; padding: 16px 20px; border-radius: var(--r);
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  font-size: 15px; box-shadow: var(--shadow-sm);
  transition: border-color 0.2s var(--ease), transform 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
.starter span { color: var(--ink-3); transition: transform 0.2s var(--ease), color 0.2s var(--ease); }
.starter:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: var(--shadow); }
.starter:hover span { color: var(--accent); transform: translateX(3px); }

.msg { display: flex; gap: 14px; animation: msgIn 0.4s var(--ease) both; }
@keyframes msgIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .msg { animation: none; } }

.msg.you { justify-content: flex-end; }
.msg.you .bubble {
  background: var(--accent); color: var(--accent-ink);
  padding: 13px 18px; border-radius: 20px 20px 5px 20px;
  max-width: 82%; font-size: 15.5px; line-height: 1.5;
}
.msg.genie .msg-avatar {
  width: 26px; height: 26px; border-radius: 50%; flex: none; margin-top: 2px;
  background: linear-gradient(145deg, var(--accent), color-mix(in srgb, var(--accent) 55%, #7C2D12));
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.msg-body { font-size: 16px; line-height: 1.62; color: var(--ink); padding-top: 1px; }
.msg-body p { margin: 0 0 12px; }
.msg-body p:last-child { margin-bottom: 0; }
.msg-body ul { margin: 0 0 12px; padding-left: 22px; }
.msg-body li { margin-bottom: 6px; }
.msg-body strong { font-weight: 600; }
.msg-body.is-error { color: var(--danger-ink); }

.typing { display: inline-flex; gap: 5px; align-items: center; height: 22px; }
.typing i {
  width: 7px; height: 7px; border-radius: 50%; background: var(--ink-3);
  animation: blink 1.3s ease-in-out infinite;
}
.typing i:nth-child(2) { animation-delay: 0.18s; }
.typing i:nth-child(3) { animation-delay: 0.36s; }
@keyframes blink { 0%,80%,100% { opacity: 0.25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }

.chat-composer {
  border-top: 1px solid var(--line-soft);
  background: color-mix(in srgb, var(--page) 92%, transparent);
  backdrop-filter: blur(12px);
  padding: 16px 24px 20px;
}
.composer-inner { max-width: 780px; margin: 0 auto; }
.composer-box {
  display: flex; align-items: center; gap: 8px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 26px; padding: 6px 6px 6px 20px;
  box-shadow: var(--shadow);
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
.composer-box:focus-within { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft), var(--shadow); }
.composer-input {
  flex: 1; border: none; background: none; outline: none;
  font-family: var(--sans); font-size: 16.5px; color: var(--ink); padding: 12px 0;
}
.composer-input::placeholder { color: var(--ink-3); }
.composer-send {
  width: 40px; height: 40px; border-radius: 50%; border: none; flex: none;
  background: var(--accent); color: var(--accent-ink); font-size: 17px; line-height: 1;
  transition: filter 0.2s var(--ease), transform 0.2s var(--ease);
}
.composer-send:hover { filter: brightness(1.08); }
.composer-send:active { transform: scale(0.94); }
.composer-send:disabled { opacity: 0.4; cursor: default; }
.composer-note { margin: 12px 0 0; font-size: 11.5px; color: var(--ink-3); text-align: center; }

.btn-primary {
  padding: 14px 26px; border: none; border-radius: 999px;
  background: var(--accent); color: var(--accent-ink); font-weight: 500; font-size: 15.5px;
  transition: filter 0.2s var(--ease), transform 0.2s var(--ease);
}
.btn-primary:hover { filter: brightness(1.07); }
.btn-primary:active { transform: scale(0.98); }
.btn-primary:disabled { opacity: 0.55; cursor: default; }

.suggestions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.suggestion {
  border: 1px solid var(--line); background: var(--surface); border-radius: 999px;
  padding: 8px 15px; font-size: 13.5px; color: var(--ink-2);
  transition: color 0.2s var(--ease), border-color 0.2s var(--ease), background 0.2s var(--ease);
}
.suggestion:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }

.answer {
  margin-top: 22px; padding-top: 22px; border-top: 1px solid var(--line-soft);
  font-size: var(--fs-lead); line-height: 1.6; color: var(--ink);
}
.answer p { margin: 0 0 12px; }
.answer p:last-child { margin-bottom: 0; }
.answer ul { margin: 0 0 12px; padding-left: 22px; }
.answer li { margin-bottom: 6px; }
.answer strong { font-weight: 600; }
.answer-error { color: var(--band-high); }
.answer.thinking { display: flex; align-items: center; gap: 10px; color: var(--ink-2); }
.pulse {
  width: 8px; height: 8px; border-radius: 50%; background: var(--accent);
  animation: pulse 1.1s ease-in-out infinite;
}
@keyframes pulse { 0%,100% { opacity: 0.25; transform: scale(0.8); } 50% { opacity: 1; transform: scale(1.15); } }

/* ---------- layout ---------- */

.split { display: grid; grid-template-columns: 1.55fr 1fr; gap: 28px; align-items: start; }
.split-even { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: start; }

.panel {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r); padding: 24px; box-shadow: var(--shadow-sm);
}
.panel-label {
  margin: 0 0 14px; font-family: var(--mono); font-size: 10.5px;
  letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-3);
}
.panel-title { font-family: var(--serif); font-weight: 400; font-size: 28px; margin: 0 0 2px; letter-spacing: -0.01em; }
.panel-meta { margin: 0 0 20px; color: var(--ink-3); font-size: 12px; }
.panel-body { margin: 0 0 12px; color: var(--ink-2); }
.panel-body:last-child { margin-bottom: 0; }
.panel-note { margin: 6px 0 0; font-size: 12.5px; color: var(--ink-3); line-height: 1.5; display: block; }
.prose { max-width: 74ch; }

.rail { display: flex; flex-direction: column; gap: 20px; position: sticky; top: 78px; }

.notice {
  padding: 20px 22px; border: 1px dashed var(--line); border-radius: var(--r);
  color: var(--ink-2); background: var(--surface);
}
.notice-error {
  border-style: solid; border-color: var(--danger-line);
  background: var(--danger-bg); color: var(--danger-ink);
}

/* ---------- student cards ---------- */

.student-grid { display: grid; gap: 14px; }
.student-card {
  text-align: left; width: 100%;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r);
  padding: 20px 22px; box-shadow: var(--shadow-sm);
  transition: border-color 0.22s var(--ease), box-shadow 0.22s var(--ease), transform 0.22s var(--ease);
}
.student-card:hover { border-color: var(--ink-3); box-shadow: var(--shadow); transform: translateY(-2px); }
.student-card.selected {
  border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft), var(--shadow);
}
.student-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.student-name { font-weight: 600; font-size: 16.5px; display: block; letter-spacing: -0.01em; }
.student-id { font-family: var(--mono); font-size: 11.5px; color: var(--ink-3); display: block; margin-top: 2px; }
.student-card-foot {
  display: flex; justify-content: space-between; margin-top: 16px;
  padding-top: 14px; border-top: 1px solid var(--line-soft);
  font-size: 12.5px; color: var(--ink-2);
}

.chip {
  font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.08em; text-transform: uppercase;
  padding: 4px 10px; border-radius: 999px; white-space: nowrap;
  color: var(--band, var(--ink-3));
  border: 1px solid color-mix(in srgb, var(--band, var(--ink-3)) 38%, transparent);
  background: color-mix(in srgb, var(--band, var(--ink-3)) 9%, transparent);
}

.signals { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; }
.signal {
  font-size: 12px; color: var(--ink-2); background: var(--surface-sunk);
  border-radius: 999px; padding: 5px 11px;
}

.disclosure-toggle {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  width: 100%; margin-top: 18px; padding: 13px 18px;
  background: none; border: 1px solid var(--line); border-radius: 999px;
  font-size: 13.5px; color: var(--ink-2);
  transition: color 0.2s var(--ease), border-color 0.2s var(--ease);
}
.disclosure-toggle:hover { color: var(--ink); border-color: var(--ink-3); }

.provenance {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px;
  margin: 20px 0 0; font-size: 12px; color: var(--ink-3);
}
.provenance .mono {
  background: var(--surface-sunk); border-radius: 999px; padding: 4px 11px; color: var(--ink-2);
}

/* ---------- tables ---------- */

.table { border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; background: var(--surface); }
.table-head, .table-row {
  display: grid; grid-template-columns: 2fr 1fr 1fr 0.6fr; gap: 12px; align-items: center;
  padding: 13px 20px; text-align: left;
}
.table-head {
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--ink-3); background: var(--surface-sunk); border-bottom: 1px solid var(--line);
}
.table-row {
  width: 100%; background: none; border: none;
  border-bottom: 1px solid var(--line-soft); font-size: 14.5px; color: var(--ink);
  transition: background 0.18s var(--ease);
}
.table-row:last-child { border-bottom: none; }
.table-row:not(.static):hover { background: var(--surface-sunk); }
.table-row.static { cursor: default; }
.redacted {
  font-family: var(--mono); font-size: 11.5px; color: var(--band-unavoidable);
  background: color-mix(in srgb, var(--band-unavoidable) 10%, transparent);
  border-radius: 999px; padding: 3px 10px; justify-self: start; letter-spacing: 0.06em;
}

/* ---------- buffer panel ---------- */

.band-track { display: flex; gap: 6px; margin: 6px 0 20px; }
.band-seg { flex: 1; display: flex; flex-direction: column; gap: 8px; }
.band-bar { height: 5px; border-radius: 999px; display: block; background: var(--line); }
.band-seg.on .band-bar { background: var(--band); }
.band-label {
  font-family: var(--mono); font-size: 9.5px; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--ink-3);
}
.band-seg.on .band-label { color: var(--band); }

.cost {
  background: var(--cost-bg); border: 1px solid var(--cost-line); border-radius: var(--r-sm);
  padding: 16px 18px; color: var(--cost-ink); font-size: 14.5px; line-height: 1.5;
}
.cost-lg { font-size: var(--fs-lead); padding: 22px 24px; border-radius: var(--r); }

.stats { margin: 20px 0 0; display: grid; gap: 0; }
.stats div {
  display: flex; justify-content: space-between; align-items: baseline; gap: 12px;
  padding: 11px 0; border-bottom: 1px solid var(--line-soft);
}
.stats div:last-child { border-bottom: none; }
.stats dt { margin: 0; color: var(--ink-2); font-size: 13.5px; }
.stats dd { margin: 0; color: var(--ink); }

.actions { display: grid; gap: 8px; }
.action {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  text-align: left; padding: 13px 16px; border-radius: var(--r-sm);
  border: 1px solid var(--line); background: var(--surface); font-size: 13.5px;
  transition: border-color 0.2s var(--ease), background 0.2s var(--ease);
}
.action:hover { border-color: var(--ink-3); background: var(--surface-sunk); }
.action .done { font-family: var(--mono); font-size: 11px; color: var(--band-low); }

/* ---------- student view ---------- */

.buffer-figures { display: grid; grid-template-columns: repeat(3, 1fr); gap: 32px; }
.figure-value { font-family: var(--serif); font-size: clamp(38px, 5vw, 56px); margin: 0; line-height: 1; letter-spacing: -0.03em; }
.meter {
  position: relative; height: 12px; border-radius: 999px;
  background: var(--surface-sunk); margin: 34px 0 10px; overflow: hidden;
}
.meter-fill {
  display: block; height: 100%; border-radius: 999px; background: var(--band, var(--accent));
  transition: width 0.9s var(--ease);
}
.meter-mark { position: absolute; top: -4px; bottom: -4px; width: 2px; background: var(--ink); opacity: 0.5; }
.meter-legend {
  display: flex; justify-content: space-between; margin: 0;
  font-family: var(--mono); font-size: 11px; color: var(--ink-3);
}

.whatif { display: grid; gap: 0; }
.whatif-row {
  display: flex; justify-content: space-between; gap: 12px; align-items: baseline;
  padding: 13px 0; border-bottom: 1px solid var(--line-soft); font-size: 14.5px;
}
.whatif-row:last-child { border-bottom: none; }

/* ---------- tiles / bars ---------- */

.tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; }
.tile {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r); padding: 24px; box-shadow: var(--shadow-sm);
  transition: box-shadow 0.22s var(--ease), transform 0.22s var(--ease);
  position: relative; overflow: hidden;
}
/* Every tile is toned — a soft wash of its own colour, no top rule. */
.tile[data-band]:not([data-band=""]) {
  background: linear-gradient(180deg, color-mix(in srgb, var(--band) 10%, var(--surface)), var(--surface) 78%);
  border-color: color-mix(in srgb, var(--band) 24%, var(--line));
}
.tile:hover { box-shadow: var(--shadow); transform: translateY(-2px); }
.tile-value {
  font-family: var(--serif); font-size: clamp(38px, 4.4vw, 54px); line-height: 1;
  margin: 0; letter-spacing: -0.03em;
}

.bars { display: grid; gap: 14px; }
.bar-row { display: grid; grid-template-columns: 96px 1fr 34px; gap: 14px; align-items: center; }
.bar-row.wide { grid-template-columns: minmax(0, 1.25fr) 2fr auto auto; gap: 12px; }
.bar-label { font-family: var(--mono); font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--band, var(--ink-3)); }
.bar-label-name {
  font-size: 13.5px; color: var(--ink);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.bar-track { height: 10px; border-radius: 999px; background: var(--surface-sunk); overflow: hidden; }
.chapter.tint .bar-track { background: var(--page); }
.bar-fill { display: block; height: 100%; border-radius: 999px; background: var(--band, var(--line)); transition: width 0.9s var(--ease); }
.bar-row.empty .bar-fill { opacity: 0.3; }
.bar-n { text-align: right; color: var(--ink); font-size: 13.5px; font-weight: 500; }
.bar-pct {
  text-align: right; font-size: 11.5px; color: var(--band, var(--ink-3));
  min-width: 34px;
}

/* ---------- how it works ---------- */

.lineage { display: grid; gap: 0; }
.lineage-row {
  display: grid; grid-template-columns: 104px 1fr; gap: 20px; align-items: start;
  padding: 18px 0; border-bottom: 1px solid var(--line-soft);
}
.lineage-row:last-child { border-bottom: none; }
.lineage-layer { font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.12em; color: var(--accent); padding-top: 3px; }
.lineage-what { display: block; font-size: 15.5px; }

.code {
  font-family: var(--mono); font-size: 12.5px; line-height: 1.7;
  background: var(--surface-sunk); border: 1px solid var(--line); border-radius: var(--r-sm);
  padding: 20px; overflow-x: auto; white-space: pre; margin: 0; color: var(--ink);
}

.notbuilt { padding: 14px 0; border-bottom: 1px solid var(--line-soft); }
.notbuilt:last-child { border-bottom: none; }
.notbuilt-what { font-size: 15.5px; display: block; }

/* ---------- footer ---------- */

footer {
  border-top: 1px solid var(--line-soft);
  padding: 32px; display: flex; gap: 20px; flex-wrap: wrap;
  font-size: 12px; color: var(--ink-3);
  max-width: 1140px; margin: 0 auto;
}

/* ---------- responsive ---------- */

@media (max-width: 900px) {
  header { padding: 11px 18px; gap: 12px; flex-wrap: wrap; }
  .identity { max-width: 100%; }
  .wrap { padding: 0 20px; }
  .chapter > .wrap { padding-top: 52px; padding-bottom: 52px; }
  .hero > .wrap { padding-top: 56px; padding-bottom: 40px; }
  .split, .split-even, .tiles, .buffer-figures, .hero-grid, .picker { grid-template-columns: 1fr; }
  .hero-grid { gap: 34px; }
  .donut-wrap { max-width: 190px; }
  .agent-preview { max-width: 100%; }
  .buffer-figures { gap: 22px; }
  .rail { position: static; }
  .table-head, .table-row { grid-template-columns: 1.6fr 1fr 0.8fr; font-size: 13.5px; padding: 12px 14px; }
  .table-head span:nth-child(4), .table-row span:nth-child(4) { display: none; }
  footer { padding: 24px 20px; }
}
