/* Trustify: minimalist editorial. Warm monochrome, serif headings, washed-out color only where it means something.
   Class names match app.js and charts.js; change the tokens below rather than hardcoding colors. */

:root {
  --bg: #FBFBFA;
  --surface: #FFFFFF;
  --surface-2: #F4F3F0;
  --border: #EAEAEA;
  --border-strong: #DAD9D4;
  --text: #111111;
  --text-2: #2F3437;
  --muted: #6F6E69;
  --brand: #111111;
  --brand-hover: #333333;
  --brand-ink: #FFFFFF;
  --focus: #1F6C9F;

  --red: #C4554D;
  --red-soft: #FDEBEC;
  --red-ink: #9F2F2D;
  --yellow: #C29343;
  --yellow-soft: #FBF3DB;
  --yellow-ink: #956400;
  --green: #548164;
  --green-soft: #EDF3EC;
  --green-ink: #346538;
  --blue: #487CA5;
  --blue-soft: #E1F3FE;
  --blue-ink: #1F6C9F;
  --gray: #A3A29E;
  --gray-soft: #F1F1EF;
  --gray-ink: #5F5E5B;

  --series-0: #2F3437;
  --series-1: #487CA5;
  --series-2: #C29343;
  --series-3: #8E7CC3;

  --font-sans: "Geist", "SF Pro Text", "Helvetica Neue", "Segoe UI", system-ui, sans-serif;
  --font-serif: "Newsreader", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --font-mono: "Geist Mono", "SF Mono", "Cascadia Mono", Consolas, monospace;

  --radius-lg: 12px;
  --radius: 8px;
  --radius-sm: 6px;
  --lift: 0 2px 8px rgba(17, 17, 17, 0.04);
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --topbar-h: 64px;
  --z-nav: 10;
  --z-topbar: 20;
  --z-scrim: 30;
  --z-drawer: 40;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #191918;
    --surface: #202020;
    --surface-2: #262625;
    --border: #2F2F2E;
    --border-strong: #3A3A38;
    --text: #EDECE8;
    --text-2: #D6D5D0;
    --muted: #A09F9A;
    --brand: #EDECE8;
    --brand-hover: #D6D5D0;
    --brand-ink: #191918;
    --focus: #8FBCE0;

    --red: #D9776F;
    --red-soft: #3A2624;
    --red-ink: #F0A8A0;
    --yellow: #D5A858;
    --yellow-soft: #3A3120;
    --yellow-ink: #E6C27A;
    --green: #6FA17F;
    --green-soft: #243226;
    --green-ink: #9CCBA7;
    --blue: #6A9CC6;
    --blue-soft: #1F2E3A;
    --blue-ink: #9CC4E4;
    --gray: #7D7C78;
    --gray-soft: #2A2A29;
    --gray-ink: #C4C3BF;

    --series-0: #D6D5D0;
    --series-1: #6A9CC6;
    --series-2: #D5A858;
    --series-3: #A99AD6;
    --lift: 0 2px 10px rgba(0, 0, 0, 0.25);
  }
}

/* ---------- base ---------- */

* { box-sizing: border-box; }
html { background: var(--bg); scroll-behavior: smooth; scroll-padding-top: calc(var(--topbar-h) + 64px); -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font-sans); font-size: 16px; line-height: 1.6; color: var(--text-2); background: transparent; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
a { color: var(--text); text-decoration-color: var(--border-strong); text-underline-offset: 3px; }
a:hover { text-decoration-color: currentColor; }
h1, h2, h3 { margin: 0; color: var(--text); line-height: 1.15; font-weight: 600; text-wrap: balance; }
p { margin: 0; text-wrap: pretty; }
button { color: inherit; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.strong { font-weight: 600; color: var(--text); }
.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; }
[hidden] { display: none !important; }
.icon { width: 1em; height: 1em; flex: none; vertical-align: -0.125em; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

.skip-link { position: absolute; left: 16px; top: -48px; z-index: 50; padding: 8px 14px; border-radius: var(--radius-sm); background: var(--brand); color: var(--brand-ink); text-decoration: none; font-weight: 500; transition: top 200ms var(--ease); }
.skip-link:focus { top: 12px; }

/* One faint warm light source behind the page, so the canvas isn't completely flat. */
.ambient { position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background: radial-gradient(900px 520px at 88% -8%, rgba(194, 147, 67, 0.07), transparent 62%),
              radial-gradient(760px 520px at -8% 38%, rgba(72, 124, 165, 0.045), transparent 60%); }

/* ---------- top bar ---------- */

.topbar { position: sticky; top: 0; z-index: var(--z-topbar); height: var(--topbar-h); display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding-inline: clamp(16px, 4vw, 40px); background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: saturate(1.2) blur(12px); -webkit-backdrop-filter: saturate(1.2) blur(12px);
  border-bottom: 1px solid var(--border); }
.brand { display: flex; align-items: center; gap: 12px; color: inherit; text-decoration: none; }
/* Logo: a torn receipt with a check on it ("show me the receipts"), tilted like it was just slapped on the desk. */
.brand-mark { display: grid; place-items: center; width: 34px; height: 34px; flex: none; }
.brand-mark svg { width: 34px; height: 34px; overflow: visible; }
.mark-receipt { transform: rotate(-8deg); transform-origin: 16px 16px; transition: transform 400ms var(--ease); }
.mark-paper { fill: var(--brand); }
.mark-check { fill: none; stroke: var(--bg); stroke-width: 2.8; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 16; stroke-dashoffset: 0; }
.brand:hover .mark-receipt { transform: rotate(0deg) translateY(-1px); }
.brand:hover .mark-check { animation: draw-check 500ms var(--ease); }
@keyframes draw-check { from { stroke-dashoffset: 16; } }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-name { font-family: var(--font-serif); font-size: 23px; font-weight: 500; letter-spacing: -0.02em; color: var(--text); }
.brand-name em { font-style: italic; font-weight: 400; }
.brand-tag { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.04em; color: var(--muted); }

/* ---------- buttons, fields ---------- */

.btn { font: inherit; font-size: 15px; font-weight: 500; min-height: 42px; border: 1px solid transparent; border-radius: var(--radius-sm); padding: 8px 16px; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; white-space: nowrap;
  transition: background-color 200ms var(--ease), border-color 200ms var(--ease), color 200ms var(--ease), transform 120ms var(--ease), opacity 200ms; }
.btn:active:not(:disabled) { transform: scale(0.98); }
.btn .icon { width: 17px; height: 17px; }
.btn-primary { background: var(--brand); color: var(--brand-ink); }
.btn-primary:hover:not(:disabled) { background: var(--brand-hover); }
.btn-primary:disabled { opacity: 0.35; cursor: not-allowed; }
.btn-ghost { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn-ghost:hover:not(:disabled) { border-color: var(--border-strong); background: var(--surface-2); }
.btn-icon { width: 42px; padding: 0; }
.btn-link { margin-left: auto; font: inherit; font-size: 14px; font-weight: 500; background: none; border: 0; padding: 4px 2px; color: inherit; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
kbd { font-family: var(--font-mono); font-size: 11px; line-height: 1; padding: 3px 5px; border-radius: 4px; border: 1px solid color-mix(in srgb, currentColor 30%, transparent); background: color-mix(in srgb, currentColor 10%, transparent); }

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

.layout { max-width: 1120px; margin: 0 auto; padding: clamp(40px, 7vw, 88px) clamp(16px, 4vw, 40px) 64px; display: flex; flex-direction: column; gap: 28px; }
.composer { max-width: 880px; }
.eyebrow { font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); margin-bottom: 16px; }
.composer h1 { font-family: var(--font-serif); font-weight: 400; font-size: clamp(44px, 7vw, 76px); line-height: 1.02; letter-spacing: -0.035em; }
.lede { color: var(--muted); max-width: 62ch; margin: 18px 0 32px; font-size: 18px; line-height: 1.6; }

.composer-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; transition: border-color 200ms var(--ease), box-shadow 200ms var(--ease); }
.composer-card:focus-within { border-color: var(--border-strong); box-shadow: var(--lift); }
textarea { display: block; width: 100%; border: 0; resize: vertical; min-height: 168px; padding: 22px 24px; font: 17px/1.6 var(--font-sans); color: var(--text); background: transparent; }
textarea::placeholder { color: var(--muted); opacity: 0.8; }
textarea:focus-visible { outline: none; }
.composer-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 12px 12px 24px; border-top: 1px solid var(--border); flex-wrap: wrap; }
.composer-left { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; font-size: 14px; }
.char-count { font-family: var(--font-mono); font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.composer-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }

.examples { display: flex; align-items: baseline; gap: 12px 16px; margin-top: 20px; flex-wrap: wrap; }
.examples-label { font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.04em; color: var(--muted); }

/* ---------- toggle ---------- */

.toggle { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; color: var(--text-2); min-height: 32px; }
.toggle input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.toggle-track { width: 34px; height: 20px; border-radius: 999px; background: var(--border-strong); position: relative; transition: background-color 200ms var(--ease); flex: none; }
.toggle-thumb { position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: var(--surface); transition: transform 200ms var(--ease); }
.toggle input:checked + .toggle-track { background: var(--brand); }
.toggle input:checked + .toggle-track .toggle-thumb { transform: translateX(14px); background: var(--brand-ink); }
.toggle input:focus-visible + .toggle-track { outline: 2px solid var(--focus); outline-offset: 2px; }

/* ---------- chips, badges, tags ---------- */

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: var(--radius-sm); background: var(--surface); border: 1px solid var(--border); font-size: 13px; line-height: 1.4; color: var(--text-2); max-width: 100%; overflow-wrap: anywhere; }
.chip.small { font-size: 11px; padding: 1px 7px; }
.chip-button { font: inherit; font-size: 14px; min-height: 36px; padding: 6px 12px; cursor: pointer; transition: border-color 200ms var(--ease), color 200ms var(--ease), transform 120ms var(--ease); }
.chip-button:hover { border-color: var(--text); color: var(--text); }
.chip-kind { font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted); padding-right: 8px; margin-right: 2px; border-right: 1px solid var(--border); }
.chip-button:active { transform: scale(0.98); }
.chip.tone-red { background: var(--red-soft); border-color: transparent; color: var(--red-ink); }
.chip.tone-yellow { background: var(--yellow-soft); border-color: transparent; color: var(--yellow-ink); }
.chip.tone-green { background: var(--green-soft); border-color: transparent; color: var(--green-ink); }
.chip.tone-blue { background: var(--blue-soft); border-color: transparent; color: var(--blue-ink); }
.chip-link { font-family: var(--font-mono); font-size: 12px; text-decoration: none; color: var(--text-2); }
.chip-link::after { content: ""; width: 10px; height: 10px; background: currentColor; opacity: 0.6;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.6' stroke-linecap='round'%3E%3Cpath d='M9 7h8v8M17 7L7 17'/%3E%3C/svg%3E") center / contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.6' stroke-linecap='round'%3E%3Cpath d='M9 7h8v8M17 7L7 17'/%3E%3C/svg%3E") center / contain no-repeat; }
.chip-link:hover { border-color: var(--text); color: var(--text); }

.badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px 3px 8px; border-radius: 999px; font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; line-height: 1.3; white-space: nowrap;
  color: var(--gray-ink); background: var(--gray-soft); }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.tone-red { color: var(--red-ink); background: var(--red-soft); }
.badge.tone-yellow { color: var(--yellow-ink); background: var(--yellow-soft); }
.badge.tone-green { color: var(--green-ink); background: var(--green-soft); }
.badge.tone-blue { color: var(--blue-ink); background: var(--blue-soft); }
.badge.tone-gray { color: var(--gray-ink); background: var(--gray-soft); }

/* ---------- loading and alerts ---------- */

.loading { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); gap: 16px 40px; padding: clamp(24px, 4vw, 36px); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); }
.loading-head { display: flex; align-items: flex-start; gap: 14px; grid-column: 1 / -1; }
.loading-pulse { flex: none; width: 10px; height: 10px; margin-top: 9px; border-radius: 50%; background: var(--text); animation: pulse 1.6s ease-in-out infinite; }
.loading-text { font-family: var(--font-serif); font-size: 26px; line-height: 1.25; color: var(--text); letter-spacing: -0.01em; }
.loading-hint { font-size: 14px; color: var(--muted); margin-top: 4px; }
.loading-steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; font-size: 15px; }
.loading-steps li { display: flex; align-items: center; gap: 12px; color: var(--muted); transition: color 300ms var(--ease); }
.loading-steps li[data-state="current"] { color: var(--text); font-weight: 500; }
.loading-steps li[data-state="done"] { color: var(--text-2); }
.step-mark { flex: none; display: grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; border: 1.5px solid var(--border-strong); color: var(--brand-ink); }
.step-mark .icon { width: 12px; height: 12px; stroke-width: 3; }
.loading-steps li[data-state="current"] .step-mark { border-color: var(--text); box-shadow: inset 0 0 0 4px var(--surface); background: var(--text); animation: pulse 1.6s ease-in-out infinite; }
.loading-steps li[data-state="done"] .step-mark { border-color: var(--brand); background: var(--brand); }
.skeleton { display: flex; flex-direction: column; gap: 12px; padding-left: 40px; border-left: 1px solid var(--border); }
.skeleton span { display: block; height: 12px; border-radius: 4px; background: var(--surface-2); animation: pulse 1.8s ease-in-out infinite; }
.skeleton span:nth-child(2) { width: 88%; }
.skeleton span:nth-child(3) { width: 64%; }
.skeleton .skeleton-title { height: 30px; width: 48%; margin-bottom: 4px; }
.skeleton-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 12px; }
.skeleton-row span { height: 56px; border-radius: var(--radius); }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.45; } }

.alert { padding: 14px 18px; border-radius: var(--radius); font-size: 15px; }
.alert.tone-red { background: var(--red-soft); color: var(--red-ink); }
.alert.tone-yellow { background: var(--yellow-soft); color: var(--yellow-ink); }

/* ---------- results: verdict ---------- */

.results { display: flex; flex-direction: column; gap: 24px; counter-reset: section; }

.hero { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 32px 48px; padding: clamp(24px, 4.5vw, 48px);
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); }
.hero-main { min-width: 0; }
.hero-kicker { font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.hero-title { display: flex; align-items: center; gap: 16px; font-family: var(--font-serif); font-weight: 400; font-size: clamp(40px, 6vw, 64px); line-height: 1.02; letter-spacing: -0.035em; margin: 14px 0 18px; color: var(--text); }
.hero-icon { flex: none; display: grid; place-items: center; width: 48px; height: 48px; border-radius: var(--radius); background: var(--gray-soft); color: var(--gray-ink); }
.hero-icon .icon { width: 26px; height: 26px; stroke-width: 2.2; }
.hero.tone-red .hero-title { color: var(--red-ink); } .hero.tone-red .hero-icon { background: var(--red-soft); color: var(--red-ink); }
.hero.tone-yellow .hero-title { color: var(--yellow-ink); } .hero.tone-yellow .hero-icon { background: var(--yellow-soft); color: var(--yellow-ink); }
.hero.tone-green .hero-title { color: var(--green-ink); } .hero.tone-green .hero-icon { background: var(--green-soft); color: var(--green-ink); }
.hero.tone-blue .hero-title { color: var(--blue-ink); } .hero.tone-blue .hero-icon { background: var(--blue-soft); color: var(--blue-ink); }
.hero-message { font-size: 19px; line-height: 1.5; color: var(--text); max-width: 56ch; }
.hero-summary { color: var(--muted); margin-top: 10px; max-width: 64ch; }
.hero-chart { display: flex; flex-direction: column; align-items: center; gap: 18px; padding-left: 48px; border-left: 1px solid var(--border); }
.pasted { grid-column: 1 / -1; border-top: 1px solid var(--border); padding-top: 16px; }
.pasted summary { cursor: pointer; color: var(--muted); font-size: 14px; }
.pasted p { white-space: pre-wrap; margin-top: 10px; color: var(--muted); max-height: 220px; overflow: auto; font-size: 15px; }

.donut { width: 168px; height: 168px; }
.donut-track { stroke: var(--surface-2); }
.donut-value { font-family: var(--font-serif); font-size: 40px; fill: var(--text); letter-spacing: -0.02em; }
.donut-label { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.05em; fill: var(--muted); text-transform: uppercase; }

.tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin-top: 32px; border-top: 1px solid var(--border); }
.tiles .stat { background: transparent; border-radius: 0; padding: 18px 16px 0; border-left: 1px solid var(--border); }
.tiles .stat:first-child { border-left: 0; padding-left: 0; }
.tiles .stat-value { font-family: var(--font-serif); font-size: 36px; font-weight: 400; letter-spacing: -0.02em; line-height: 1.1; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 8px; }
.stats-wrap { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
.stat { background: var(--surface-2); border-radius: var(--radius); padding: 12px 14px; min-width: 0; }
.stat-value { font-size: 22px; font-weight: 600; color: var(--text); letter-spacing: -0.01em; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.stat-label { font-size: 13px; color: var(--muted); line-height: 1.4; margin-top: 2px; }
.stat-value.tone-red { color: var(--red-ink); }
.stat-value.tone-yellow { color: var(--yellow-ink); }
.stat-value.tone-green { color: var(--green-ink); }
.stat-value.tone-blue { color: var(--blue-ink); }
.stat-value.stat-value-sm, .tiles .stat-value.stat-value-sm { font-family: var(--font-sans); font-size: 15px; font-weight: 600; line-height: 1.35; }

.legend { display: flex; flex-wrap: wrap; gap: 8px 16px; font-size: 13px; color: var(--muted); }
.legend-stack { flex-direction: column; gap: 6px; min-width: 164px; }
.legend-item { display: inline-flex; align-items: center; gap: 8px; }
.legend-item strong { margin-left: auto; padding-left: 16px; color: var(--text); font-family: var(--font-mono); font-weight: 500; font-variant-numeric: tabular-nums; }
.legend-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.legend-swatch { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }

/* ---------- section menu ---------- */

.jump { position: sticky; top: var(--topbar-h); z-index: var(--z-nav); display: flex; gap: 4px 24px; overflow-x: auto; scrollbar-width: none; padding: 0 4px;
  margin-block: -8px; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-bottom: 1px solid var(--border); }
.jump::-webkit-scrollbar { display: none; }
.jump a { flex: none; display: inline-flex; align-items: center; gap: 8px; min-height: 48px; color: var(--muted); text-decoration: none; font-size: 14px; font-weight: 500; box-shadow: inset 0 -2px 0 transparent; transition: color 200ms var(--ease), box-shadow 200ms var(--ease); }
.jump a:hover { color: var(--text); }
.jump a[aria-current="true"] { color: var(--text); box-shadow: inset 0 -2px 0 var(--text); }
.jump .count { font-family: var(--font-mono); font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }

/* ---------- sections and cards ---------- */

.panel { counter-increment: section; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: clamp(20px, 4vw, 40px); display: flex; flex-direction: column; gap: 24px; }
.panel-head { display: grid; grid-template-columns: auto 1fr; column-gap: 16px; align-items: baseline; }
.panel-head::before { content: counter(section, decimal-leading-zero); font-family: var(--font-mono); font-size: 12px; color: var(--muted); letter-spacing: 0.04em; grid-row: 1; }
.panel-head h2 { font-family: var(--font-serif); font-weight: 400; font-size: clamp(26px, 3.2vw, 32px); letter-spacing: -0.02em; }
.panel-head p { grid-column: 2; margin-top: 6px; font-size: 15px; max-width: 70ch; }
.subpanel { display: flex; flex-direction: column; gap: 14px; }
.subpanel h3 { font-size: 17px; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); gap: 16px; align-items: start; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 20px; display: flex; flex-direction: column; gap: 14px; min-width: 0; transition: box-shadow 200ms var(--ease), border-color 200ms var(--ease); }
.card:hover { box-shadow: var(--lift); border-color: var(--border-strong); }
.card-head { display: flex; align-items: flex-start; flex-wrap: wrap; gap: 8px 12px; }
.card-head .badge { margin-top: 3px; }
.card-title { font-size: 17px; font-weight: 600; letter-spacing: -0.01em; flex: 1 1 200px; min-width: 0; }
.card-summary { color: var(--muted); font-size: 15px; }
.quote { margin: 0; padding: 2px 0 2px 16px; border-left: 2px solid var(--border-strong); color: var(--text); font-family: var(--font-serif); font-style: italic; font-size: 18px; line-height: 1.45; overflow-wrap: anywhere; }
.quote-inline { font-family: var(--font-serif); font-style: italic; font-size: 17px; color: var(--text); }

.rows { display: grid; grid-template-columns: max-content 1fr; gap: 10px 20px; margin: 0; font-size: 15px; }
.rows dt { font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.03em; color: var(--muted); padding-top: 3px; }
.rows dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.rows-stacked { grid-template-columns: 1fr; gap: 2px; }
.rows-stacked dt { margin-top: 10px; }
.rows-stacked dt:first-child { margin-top: 0; }
.big-inline { font-family: var(--font-serif); font-size: 26px; font-weight: 400; color: var(--text); }
.complaints { display: flex; flex-direction: column; gap: 8px; }
.progress-line { display: flex; align-items: center; gap: 12px; }
.progress { flex: 1; height: 6px; border-radius: 999px; background: var(--surface-2); overflow: hidden; min-width: 80px; }
.progress-fill { height: 100%; border-radius: 999px; background: var(--text); transition: width 600ms var(--ease); }
.progress-fill.tone-red { background: var(--red); }
.progress-fill.tone-green { background: var(--green); }
.progress-fill.tone-blue { background: var(--blue); }

.compare { display: grid; grid-template-columns: 150px 1fr; gap: 20px; align-items: center; }
.compare > .stat { background: transparent; padding: 0; }
.compare > .stat .stat-value { font-family: var(--font-serif); font-weight: 400; font-size: 40px; line-height: 1; }

/* ---------- bars and charts ---------- */

.hbars { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.hbar-row { display: grid; grid-template-columns: minmax(90px, 38%) 1fr auto; align-items: center; gap: 12px; font-size: 14px; }
.hbar-row.is-highlight .hbar-label { color: var(--text); font-weight: 600; }
.hbar-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); }
.hbar-track { height: 8px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.hbar-fill { height: 100%; border-radius: 999px; background: var(--gray); transition: width 600ms var(--ease); }
.hbar-value { font-family: var(--font-mono); font-size: 13px; font-weight: 500; color: var(--text); font-variant-numeric: tabular-nums; white-space: nowrap; }
.hbar-value.muted { color: var(--muted); }
.hbars-stacked .hbar-row { grid-template-columns: 1fr auto; grid-template-areas: "label value" "track track"; row-gap: 6px; }
.hbars-stacked .hbar-label { grid-area: label; white-space: normal; }
.hbars-stacked .hbar-value { grid-area: value; }
.hbars-stacked .hbar-track { grid-area: track; }
.tone-neutral { background: var(--gray); }
.hbar-fill.tone-red { background: var(--red); }
.hbar-fill.tone-yellow { background: var(--yellow); }
.hbar-fill.tone-green { background: var(--green); }
.hbar-fill.tone-blue { background: var(--blue); }
.tone-series-0 { background: var(--series-0); }
.tone-series-1 { background: var(--series-1); }
.tone-series-2 { background: var(--series-2); }
.tone-series-3 { background: var(--series-3); }

.chart-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: 16px; }
.mini-chart { border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 16px 18px; display: flex; flex-direction: column; gap: 14px; }
.mini-chart.is-claimed.tone-red { border-color: var(--red); box-shadow: inset 3px 0 0 var(--red); }
.mini-chart.is-claimed.tone-yellow { border-color: var(--yellow); box-shadow: inset 3px 0 0 var(--yellow); }
.mini-chart.is-claimed.tone-green { border-color: var(--green); box-shadow: inset 3px 0 0 var(--green); }
.mini-title { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-weight: 600; font-size: 15px; color: var(--text); }
.mini-title .chip { flex: none; white-space: nowrap; }
.school-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.answer { padding: 20px 22px; border-radius: var(--radius-lg); background: var(--blue-soft); }
.answer-kicker { font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.05em; text-transform: uppercase; color: var(--blue-ink); margin-bottom: 8px; }
.answer p { font-family: var(--font-serif); font-size: 20px; line-height: 1.45; color: var(--text); max-width: 70ch; }
.answer-notes { margin: 12px 0 0; padding-left: 18px; font-size: 14px; color: var(--text-2); display: flex; flex-direction: column; gap: 4px; }
.school-head h3 { font-family: var(--font-serif); font-weight: 400; font-size: 26px; }

.columns-chart { display: flex; flex-direction: column; gap: 16px; }
.column-groups { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(180px, 1fr); gap: 20px; overflow-x: auto; padding-bottom: 4px; }
.column-group { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.column-bars { height: 190px; display: flex; align-items: flex-end; gap: 8px; padding: 0 6px; border-bottom: 1px solid var(--border-strong); }
.column-slot { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 6px; }
.column-value { font-family: var(--font-mono); font-size: 12px; color: var(--text); font-variant-numeric: tabular-nums; }
.column-bar { width: 100%; max-width: 40px; border-radius: 4px 4px 0 0; transition: height 600ms var(--ease); }
.column-bar.is-empty { background: var(--border); }
.column-label { font-size: 13px; color: var(--muted); text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

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

.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius-lg); }
.table { width: 100%; border-collapse: collapse; font-size: 15px; }
.table th, .table td { padding: 12px 16px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: top; }
.table thead th { font-family: var(--font-mono); font-size: 12px; font-weight: 500; letter-spacing: 0.03em; color: var(--muted); background: var(--surface-2); }
.table tbody tr:last-child th, .table tbody tr:last-child td { border-bottom: 0; }
.table tbody th { font-weight: 600; color: var(--text); white-space: nowrap; }
.table td.num { text-align: right; font-variant-numeric: tabular-nums; }
.table .quote-cell { font-family: var(--font-serif); font-style: italic; font-size: 16px; min-width: 200px; color: var(--text); }
.table tr.is-claimed th, .table tr.is-claimed td { font-weight: 600; }
.table tr.is-claimed.tone-red td, .table tr.is-claimed.tone-red th { background: var(--red-soft); color: var(--red-ink); }
.table tr.is-claimed.tone-yellow td, .table tr.is-claimed.tone-yellow th { background: var(--yellow-soft); color: var(--yellow-ink); }
.table tr.is-claimed.tone-green td, .table tr.is-claimed.tone-green th { background: var(--green-soft); color: var(--green-ink); }
.table-compact td, .table-compact th { padding: 9px 14px; }

.verdict-line { font-weight: 600; font-size: 15px; }
.verdict-line.tone-red { color: var(--red-ink); }
.verdict-line.tone-yellow { color: var(--yellow-ink); }
.verdict-line.tone-green { color: var(--green-ink); }
.verdict-line.tone-gray { color: var(--gray-ink); }
.callout { padding: 10px 14px; border-radius: var(--radius); font-size: 15px; }
.callout.tone-yellow { background: var(--yellow-soft); color: var(--yellow-ink); }

/* ---------- sources ---------- */

.evidence { font-size: 14px; border-top: 1px solid var(--border); padding-top: 12px; }
.evidence summary { cursor: pointer; color: var(--muted); font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.03em; list-style-position: inside; }
.evidence summary:hover { color: var(--text); }
.evidence ul { list-style: none; padding: 0; margin: 12px 0 0; display: flex; flex-direction: column; gap: 12px; }
.evidence li { display: grid; grid-template-columns: auto 1fr; gap: 10px; align-items: baseline; }
.evidence-body { min-width: 0; overflow-wrap: anywhere; color: var(--text-2); }
.evidence-body a { font-weight: 500; }
.kind { flex: none; font-family: var(--font-mono); font-size: 10.5px; font-weight: 500; letter-spacing: 0.05em; text-transform: uppercase; padding: 2px 7px; border-radius: 999px; background: var(--gray-soft); color: var(--gray-ink); white-space: nowrap; }
.kind-official { background: var(--blue-soft); color: var(--blue-ink); }
.kind-guidance { background: var(--green-soft); color: var(--green-ink); }
.kind-web { background: var(--yellow-soft); color: var(--yellow-ink); }
.kind-community { background: var(--red-soft); color: var(--red-ink); }
.source-links { margin: 0; padding-left: 18px; font-size: 15px; }
.web-figures { display: flex; flex-direction: column; gap: 8px; }

/* ---------- lists ---------- */

.plain-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; }
.plain-list li { display: flex; align-items: baseline; flex-wrap: wrap; gap: 10px 12px; padding: 14px 0; border-top: 1px solid var(--border); }
.plain-list li:first-child { border-top: 0; padding-top: 0; }
.checklist { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; }
.checklist li { display: flex; gap: 14px; align-items: flex-start; padding: 14px 0; border-top: 1px solid var(--border); }
.checklist li:first-child { border-top: 0; padding-top: 0; }
.checklist input { width: 20px; height: 20px; margin: 2px 0 0; accent-color: var(--brand); flex: none; cursor: pointer; }
.checklist label { cursor: pointer; color: var(--text); font-size: 16px; }
.checklist input:checked + label { color: var(--muted); text-decoration: line-through; text-decoration-color: var(--border-strong); }

/* ---------- history drawer ---------- */

.scrim { position: fixed; inset: 0; background: rgba(17, 17, 17, 0.28); z-index: var(--z-scrim); animation: fade-in 200ms var(--ease); }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(440px, 100vw); background: var(--surface); border-left: 1px solid var(--border); z-index: var(--z-drawer); display: flex; flex-direction: column; animation: slide-in 280ms var(--ease); }
.drawer-head { display: flex; align-items: center; justify-content: space-between; height: var(--topbar-h); padding: 0 12px 0 24px; border-bottom: 1px solid var(--border); }
.drawer-head h2 { font-family: var(--font-serif); font-weight: 400; font-size: 24px; }
.history-list { overflow: auto; padding: 8px 0; display: flex; flex-direction: column; }
.history-list > p { padding: 16px 24px; }
.history-item { font: inherit; text-align: left; display: flex; flex-direction: column; gap: 6px; align-items: flex-start; padding: 16px 24px; border: 0; border-bottom: 1px solid var(--border); background: transparent; color: var(--text); cursor: pointer; transition: background-color 200ms var(--ease); }
.history-item:hover { background: var(--surface-2); }
.history-snippet { font-size: 15px; line-height: 1.45; }
@keyframes fade-in { from { opacity: 0; } }
@keyframes slide-in { from { transform: translateX(24px); opacity: 0; } }

/* ---------- voice typing ---------- */

.mic { gap: 8px; }
.mic[data-state="recording"] { background: var(--red-ink); border-color: var(--red-ink); color: #FFFFFF; animation: ring 1.6s ease-out infinite; }
.mic[data-state="recording"]:hover:not(:disabled) { background: var(--red-ink); border-color: var(--red-ink); }
.mic[data-state="transcribing"] { opacity: 0.55; cursor: progress; }
@keyframes ring { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--red) 45%, transparent); } 100% { box-shadow: 0 0 0 10px transparent; } }
.voice-status { display: flex; align-items: center; gap: 12px; margin: 0 16px 14px; padding: 10px 14px; border-radius: var(--radius); font-size: 14px; background: var(--red-soft); color: var(--red-ink); }
.voice-status[data-state="transcribing"] { background: var(--surface-2); color: var(--text-2); }
.voice-status[data-state="error"] { background: var(--yellow-soft); color: var(--yellow-ink); }
.voice-dot { flex: none; width: 8px; height: 8px; border-radius: 50%; background: currentColor; animation: pulse 1.2s ease-in-out infinite; }
.voice-status[data-state="error"] .voice-dot { animation: none; }
.voice-meter { display: inline-flex; align-items: center; gap: 3px; height: 18px; flex: none; }
.voice-meter i { width: 3px; height: 18px; border-radius: 2px; background: currentColor; transform: scaleY(0.2); transition: transform 80ms linear; }
.voice-status:not([data-state="recording"]) .voice-meter { display: none; }

/* ---------- spoken results ---------- */

.speaker { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin-top: 24px; padding: 14px 16px; border-radius: var(--radius-lg); background: var(--surface-2); }
.speaker-btn { background: var(--brand); color: var(--brand-ink); min-height: 40px; }
.speaker-btn:hover:not(:disabled) { background: var(--brand-hover); }
.speaker-btn:disabled { opacity: 0.6; cursor: progress; }
.speaker[data-state="blocked"] .speaker-btn { animation: ring 1.6s ease-out infinite; }
.speaker-status { font-size: 14px; color: var(--muted); }
.speaker[data-state="error"] .speaker-status { color: var(--yellow-ink); }
.speaker .btn-link { margin-left: 0; color: var(--muted); }
.speaker .btn-link:hover { color: var(--text); }
.speaker-bars { display: none; align-items: flex-end; gap: 3px; height: 16px; }
.speaker[data-state="playing"] .speaker-bars { display: inline-flex; }
.speaker-bars i { width: 3px; height: 100%; border-radius: 2px; background: var(--text); transform-origin: bottom; animation: bounce 0.9s ease-in-out infinite; }
.speaker-bars i:nth-child(2) { animation-delay: 0.15s; }
.speaker-bars i:nth-child(3) { animation-delay: 0.3s; }
.speaker-bars i:nth-child(4) { animation-delay: 0.45s; }
@keyframes bounce { 0%, 100% { transform: scaleY(0.3); } 50% { transform: scaleY(1); } }
.speaker-caption { flex-basis: 100%; margin: 4px 0 0; font-family: var(--font-serif); font-size: 19px; line-height: 1.6; color: var(--muted); max-width: 68ch; }
.speaker-caption span { transition: color 300ms var(--ease), background-color 300ms var(--ease); }
.speaker-caption .is-current { color: var(--text); background: color-mix(in srgb, var(--yellow) 22%, transparent); border-radius: 3px; box-decoration-break: clone; -webkit-box-decoration-break: clone; }

/* ---------- YouTube ---------- */

.video-hint { display: flex; align-items: center; gap: 12px; margin: 0 16px 14px; padding: 10px 14px; border-radius: var(--radius); background: var(--surface-2); color: var(--text-2); font-size: 14px; }
.video-hint strong { color: var(--text); }
.video-hint-icon { display: grid; place-items: center; flex: none; width: 26px; height: 26px; border-radius: var(--radius-sm); background: var(--brand); color: var(--brand-ink); }
.video-hint-icon svg { width: 12px; height: 12px; }
.video { grid-column: 1 / -1; display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 24px; align-items: center; padding-bottom: 32px; border-bottom: 1px solid var(--border); }
.video-thumb { position: relative; display: block; aspect-ratio: 16 / 9; max-width: 100%; border-radius: var(--radius); overflow: hidden; background: var(--surface-2); }
.video-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; filter: saturate(0.85); transition: filter 300ms var(--ease), transform 600ms var(--ease); }
.video-thumb:hover img { filter: saturate(1); transform: scale(1.02); }
.video-play { position: absolute; inset: 0; margin: auto; width: 44px; height: 44px; display: grid; place-items: center; border-radius: 50%; background: rgba(17, 17, 17, 0.78); color: #FFFFFF; }
.video-play .icon { width: 18px; height: 18px; margin-left: 2px; }
.video-meta { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.video-title { font-family: var(--font-serif); font-weight: 400; font-size: 24px; line-height: 1.25; letter-spacing: -0.01em; overflow-wrap: anywhere; }
.video-title a { color: inherit; text-decoration: none; }
.video-title a:hover { text-decoration: underline; text-decoration-color: var(--border-strong); }
.time-link { flex: none; margin-left: auto; display: inline-flex; align-items: center; gap: 5px; padding: 3px 8px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--surface); color: var(--text); font-family: var(--font-mono); font-size: 12px; font-variant-numeric: tabular-nums; text-decoration: none; white-space: nowrap; transition: border-color 200ms var(--ease); }
.time-link .icon { width: 9px; height: 9px; }
.time-link:hover { border-color: var(--text); }

.timeline { padding: 12px 8px 0; }
.timeline-track { position: relative; height: 4px; border-radius: 999px; background: var(--surface-2); }
.timeline-checked { position: absolute; inset: 0 auto 0 0; border-radius: 999px; background: color-mix(in srgb, var(--text) 18%, transparent); }
.timeline-marker { position: absolute; top: 50%; width: 14px; height: 14px; border-radius: 50%; transform: translate(-50%, -50%); border: 2px solid var(--surface); background: var(--gray); transition: transform 200ms var(--ease); }
.timeline-marker::after { content: ""; position: absolute; inset: -10px; }
.timeline-marker:hover, .timeline-marker:focus-visible { transform: translate(-50%, -50%) scale(1.4); z-index: 2; }
.timeline-marker.tone-red { background: var(--red); z-index: 1; }
.timeline-marker.tone-yellow { background: var(--yellow); }
.timeline-marker.tone-green { background: var(--green); }
.timeline-marker.tone-blue { background: var(--blue); }
.timeline-axis { position: relative; height: 22px; margin-top: 12px; font-family: var(--font-mono); font-size: 11px; }
.timeline-axis span { position: absolute; transform: translateX(-50%); font-variant-numeric: tabular-nums; }
.timeline-axis span:first-child { transform: none; }
.timeline-axis span:last-child { transform: translateX(-100%); }
.timeline-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; }
.timeline-list li { display: grid; grid-template-columns: 76px auto minmax(0, 1fr); align-items: baseline; gap: 12px; padding: 14px 0; border-top: 1px solid var(--border); }
.timeline-list .time-link { margin-left: 0; justify-content: center; }
.timeline-text { min-width: 0; overflow-wrap: anywhere; }
.timeline-text strong { color: var(--text); font-weight: 600; }

.transcript summary { cursor: pointer; color: var(--muted); font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.03em; }
.transcript-lines { list-style: none; padding: 0; margin: 14px 0 0; max-height: 480px; overflow: auto; display: flex; flex-direction: column; gap: 2px; }
.transcript-line { display: grid; grid-template-columns: 76px minmax(0, 1fr); gap: 12px; align-items: baseline; padding: 8px 10px; border-radius: var(--radius-sm); font-size: 15px; }
.transcript-line .time-link { margin-left: 0; justify-content: center; }
.transcript-line.is-unchecked { color: var(--muted); }
.transcript-line.is-flagged { box-shadow: inset 2px 0 0 var(--gray); background: var(--gray-soft); }
.transcript-line.is-flagged.tone-red { box-shadow: inset 2px 0 0 var(--red); background: var(--red-soft); }
.transcript-line.is-flagged.tone-yellow { box-shadow: inset 2px 0 0 var(--yellow); background: var(--yellow-soft); }
.transcript-line.is-flagged.tone-green { box-shadow: inset 2px 0 0 var(--green); background: var(--green-soft); }
.transcript-line.is-flagged.tone-blue { box-shadow: inset 2px 0 0 var(--blue); background: var(--blue-soft); }
.transcript-divider { padding: 14px 10px 6px; border-top: 1px dashed var(--border-strong); margin-top: 8px; font-family: var(--font-mono); font-size: 12px; color: var(--muted); }

.footer { max-width: 1120px; margin: 0 auto; padding: 24px clamp(16px, 4vw, 40px) 48px; border-top: 1px solid var(--border); font-size: 14px; color: var(--muted); }

/* ---------- entrance motion ---------- */

.reveal { opacity: 0; transform: translateY(12px); transition: opacity 600ms var(--ease), transform 600ms var(--ease); transition-delay: calc(var(--i, 0) * 80ms); }
.reveal.is-visible { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 1ms !important; animation-iteration-count: 1 !important; transition-duration: 1ms !important; transition-delay: 0ms !important; }
  .reveal { opacity: 1; transform: none; }
}

/* ---------- smaller screens ---------- */

@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; }
  .hero-chart { flex-direction: row; align-items: center; justify-content: flex-start; padding-left: 0; border-left: 0; padding-top: 24px; border-top: 1px solid var(--border); }
  .loading { grid-template-columns: 1fr; }
  .skeleton { padding-left: 0; border-left: 0; }
}

@media (max-width: 760px) {
  :root { --topbar-h: 58px; }
  .brand-tag { display: none; }
  .composer h1 { font-size: clamp(44px, 13vw, 60px); }
  .lede { font-size: 17px; margin-bottom: 24px; }
  textarea { min-height: 150px; padding: 18px; font-size: 16px; }
  .composer-bar { padding: 12px; gap: 12px; }
  .composer-left { width: 100%; justify-content: space-between; padding: 0 4px; }
  .composer-actions { width: 100%; margin-left: 0; }
  .composer-actions .btn { flex: 1; min-height: 48px; }
  .mic[hidden] + .btn { flex: 1; }
  kbd { display: none; }
  .video-hint, .voice-status { margin-inline: 12px; }
  .hero-title { gap: 12px; }
  .hero-icon { width: 40px; height: 40px; }
  .hero-icon .icon { width: 22px; height: 22px; }
  .donut { width: 128px; height: 128px; }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tiles .stat { padding: 16px 12px 16px 0; border-left: 0; border-bottom: 1px solid var(--border); }
  .tiles .stat:nth-child(even) { padding-left: 16px; border-left: 1px solid var(--border); }
  .tiles .stat:nth-last-child(-n + 2) { border-bottom: 0; }
  .tiles .stat-value { font-size: 30px; }
  .panel-head { grid-template-columns: 1fr; }
  .panel-head::before { margin-bottom: 6px; }
  .panel-head p { grid-column: 1; }
  .grid, .chart-grid { grid-template-columns: 1fr; }
  .compare { grid-template-columns: 1fr; gap: 12px; }
  .rows { grid-template-columns: 1fr; gap: 2px; }
  .rows dt { margin-top: 10px; }
  .rows dt:first-child { margin-top: 0; }
  .video { grid-template-columns: 1fr; }
  .hbar-row { grid-template-columns: 1fr auto; grid-template-areas: "label value" "track track"; row-gap: 6px; }
  .hbar-label { grid-area: label; white-space: normal; }
  .hbar-value { grid-area: value; }
  .hbar-track { grid-area: track; }
  .timeline-list li { grid-template-columns: 76px minmax(0, 1fr); }
  .timeline-list li .badge { grid-column: 2; justify-self: start; }
  .timeline-list li .timeline-text { grid-column: 1 / -1; }
  .btn-ghost#history-btn { min-height: 40px; }
}
