/* Examine — Financial Management Exam Suite
   Aesthetic: warm academic / Claude-edu — cream paper, ink, accent clay */

:root {
  --paper: #FAF7F2;
  --paper-2: #F2EDE4;
  --paper-3: #E9E2D3;
  --ink: #1F1A14;
  --ink-2: #3B342A;
  --ink-3: #6B6356;
  --ink-4: #9A9285;
  --rule: #D9D1BF;
  --rule-soft: #E6DFCE;

  --clay: #C76F4A;
  --clay-deep: #A8542F;
  --clay-soft: #F2D9CB;
  --moss: #6F8054;
  --moss-soft: #DDE3CD;
  --plum: #7E5A7A;
  --plum-soft: #E6D7E2;
  --gold: #B8924A;
  --teal: #4F7F8A;

  --good: #5E7A4D;
  --bad: #B05545;

  --serif: "Fraunces", "Cormorant Garamond", "Times New Roman", serif;
  --sans: "Inter", -apple-system, "Helvetica Neue", sans-serif;
  --mono: "JetBrains Mono", "SF Mono", ui-monospace, monospace;

  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 16px;

  --shadow-1: 0 1px 2px rgba(31,26,20,.04), 0 0 0 1px rgba(31,26,20,.05);
  --shadow-2: 0 4px 14px rgba(31,26,20,.06), 0 0 0 1px rgba(31,26,20,.05);
  --shadow-3: 0 12px 32px rgba(31,26,20,.10), 0 0 0 1px rgba(31,26,20,.06);
}

[data-theme="dark"] {
  --paper: #1A1814;
  --paper-2: #221F1A;
  --paper-3: #2C2823;
  --ink: #F2EDE4;
  --ink-2: #DCD5C6;
  --ink-3: #A39B8B;
  --ink-4: #6E6759;
  --rule: #3A352D;
  --rule-soft: #2C2823;
  --clay-soft: #4A2E22;
  --moss-soft: #2D3826;
  --plum-soft: #3A2C39;
  --shadow-1: 0 1px 2px rgba(0,0,0,.4), 0 0 0 1px rgba(255,255,255,.04);
  --shadow-2: 0 4px 14px rgba(0,0,0,.5), 0 0 0 1px rgba(255,255,255,.05);
  --shadow-3: 0 12px 32px rgba(0,0,0,.6), 0 0 0 1px rgba(255,255,255,.06);
}

* { box-sizing: border-box; }

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

body {
  background-image:
    radial-gradient(1200px 800px at 20% -10%, rgba(199,111,74,.04), transparent 60%),
    radial-gradient(900px 600px at 110% 10%, rgba(111,128,84,.04), transparent 60%);
  min-height: 100vh;
}

h1,h2,h3,h4 { font-family: var(--serif); font-weight: 500; letter-spacing: -0.01em; margin: 0; color: var(--ink); }
h1 { font-size: 2.4rem; line-height: 1.1; letter-spacing: -0.02em; }
h2 { font-size: 1.65rem; line-height: 1.15; }
h3 { font-size: 1.2rem; line-height: 1.25; }
h4 { font-size: 1rem; font-weight: 600; }

p { margin: 0 0 0.75em; text-wrap: pretty; color: var(--ink-2); }

a { color: var(--clay-deep); text-decoration: none; }
a:hover { text-decoration: underline; }

button { font-family: inherit; font-size: inherit; cursor: pointer; }

/* ==== Layout ==== */
.app { display: flex; flex-direction: column; min-height: 100vh; }

.topbar {
  display: flex; align-items: center; gap: 1.25rem;
  padding: 0.85rem 1.5rem;
  background: rgba(250,247,242,0.85);
  backdrop-filter: saturate(140%) blur(12px);
  border-bottom: 1px solid var(--rule);
  position: sticky; top: 0; z-index: 50;
}
[data-theme="dark"] .topbar { background: rgba(26,24,20,0.85); }

.brand { display: flex; align-items: center; gap: 0.6rem; font-family: var(--serif); font-size: 1.15rem; letter-spacing: -0.01em; color: var(--ink); }
.brand-mark {
  width: 28px; height: 28px; border-radius: 7px;
  background: linear-gradient(135deg, var(--clay) 0%, var(--clay-deep) 100%);
  display: grid; place-items: center; color: #FAF7F2; font-weight: 600; font-family: var(--serif); font-size: 0.95rem;
  box-shadow: 0 2px 6px rgba(168,84,47,.35);
}
.brand-name { font-weight: 500; }
.brand-sub { font-size: 0.78rem; color: var(--ink-3); margin-left: 0.4rem; padding-left: 0.6rem; border-left: 1px solid var(--rule); font-family: var(--sans); letter-spacing: 0.02em; text-transform: uppercase; }

.nav { display: flex; gap: 0.15rem; margin-left: auto; }
.nav-btn {
  background: transparent; border: 0; color: var(--ink-2);
  padding: 0.45rem 0.8rem; font-size: 0.88rem; font-weight: 500;
  border-radius: 8px;
  letter-spacing: -0.005em;
}
.nav-btn:hover { background: var(--paper-3); color: var(--ink); }
.nav-btn.active { background: var(--ink); color: var(--paper); }
[data-theme="dark"] .nav-btn.active { background: var(--paper-2); color: var(--ink); border: 1px solid var(--rule); }

.role-toggle {
  display: inline-flex; background: var(--paper-3); border-radius: 999px; padding: 3px;
  border: 1px solid var(--rule); margin-left: 1rem;
}
.role-toggle button {
  background: transparent; border: 0; color: var(--ink-3);
  padding: 0.32rem 0.85rem; font-size: 0.78rem; font-weight: 600; letter-spacing: 0.02em;
  border-radius: 999px; text-transform: uppercase;
}
.role-toggle button.on { background: var(--paper); color: var(--ink); box-shadow: var(--shadow-1); }

.icon-btn {
  background: transparent; border: 1px solid var(--rule); color: var(--ink-2);
  width: 34px; height: 34px; border-radius: 8px;
  display: grid; place-items: center;
}
.icon-btn:hover { background: var(--paper-3); color: var(--ink); }

/* ==== Main container ==== */
.main { padding: 2rem clamp(1rem, 4vw, 3rem); max-width: 1340px; width: 100%; margin: 0 auto; }

.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 2rem; margin-bottom: 2rem; flex-wrap: wrap; }
.page-head .eyebrow { font-size: 0.75rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--clay-deep); font-weight: 600; margin-bottom: 0.4rem; }
.page-head p { color: var(--ink-3); max-width: 56ch; margin: 0.5rem 0 0; }

/* ==== Hero / Home ==== */
.hero {
  display: grid; grid-template-columns: 1.4fr 1fr; gap: 3rem;
  padding: 3.5rem 0 2rem;
  border-bottom: 1px solid var(--rule);
  margin-bottom: 2.5rem;
}
.hero h1 { font-size: clamp(2.5rem, 5vw, 4rem); line-height: 1.02; }
.hero h1 em { font-style: italic; color: var(--clay-deep); }
.hero-sub { color: var(--ink-3); font-size: 1.1rem; max-width: 50ch; margin-top: 1.2rem; }

.hero-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; align-content: end; }
.hero-stat { background: var(--paper-2); border: 1px solid var(--rule); border-radius: var(--r-md); padding: 1rem 1.1rem; }
.hero-stat .num { font-family: var(--serif); font-size: 2rem; font-weight: 500; line-height: 1; color: var(--ink); }
.hero-stat .lbl { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--ink-3); margin-top: 0.4rem; }

@media (max-width: 820px) {
  .hero { grid-template-columns: 1fr; gap: 1.5rem; padding: 2rem 0 1rem; }
  .hero-stats { grid-template-columns: repeat(2, 1fr); }
}

/* ==== Set cards ==== */
.cta-row { display: flex; gap: 0.75rem; margin-top: 1.6rem; }
.btn {
  display: inline-flex; align-items: center; gap: 0.5rem;
  padding: 0.7rem 1.1rem; border-radius: 999px; font-weight: 600; font-size: 0.92rem;
  border: 1px solid transparent; transition: transform .12s ease, background .12s;
  text-decoration: none;
}
.btn-primary { background: var(--ink); color: var(--paper); }
.btn-primary:hover { transform: translateY(-1px); background: var(--clay-deep); color: #fff; text-decoration: none; }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--rule); }
.btn-ghost:hover { background: var(--paper-3); text-decoration: none; }
.btn-clay { background: var(--clay); color: #fff; }
.btn-clay:hover { background: var(--clay-deep); transform: translateY(-1px); color: #fff; text-decoration: none; }

.set-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1.25rem; }
.set-card {
  position: relative;
  background: var(--paper-2); border: 1px solid var(--rule); border-radius: var(--r-lg);
  padding: 1.4rem 1.4rem 1.2rem;
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s;
  cursor: pointer;
  overflow: hidden;
}
.set-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-2); border-color: var(--ink-4); }
.set-card .accent { position: absolute; top: 0; left: 0; right: 0; height: 4px; background: var(--accent, var(--clay)); }
.set-card .num { font-family: var(--serif); font-size: 0.9rem; color: var(--ink-3); letter-spacing: 0.18em; text-transform: uppercase; }
.set-card h3 { margin: 0.5rem 0 0.6rem; font-size: 1.25rem; }
.set-card .meta { display: flex; gap: 0.5rem; flex-wrap: wrap; margin: 0.6rem 0 1rem; }
.tag {
  font-size: 0.72rem; padding: 0.22rem 0.55rem; border-radius: 999px;
  background: var(--paper-3); color: var(--ink-2); border: 1px solid var(--rule);
  letter-spacing: 0.01em; font-weight: 500;
}
.tag.diff-Standard { background: var(--moss-soft); color: #3F4F2C; border-color: transparent; }
.tag.diff-Standard\+ { background: var(--clay-soft); color: var(--clay-deep); border-color: transparent; }
.tag.diff-Advanced { background: #F2E0BF; color: #7A5A1F; border-color: transparent; }
.tag.diff-Advanced\+ { background: var(--plum-soft); color: var(--plum); border-color: transparent; }
[data-theme="dark"] .tag.diff-Standard { color: #B6CB8E; }
[data-theme="dark"] .tag.diff-Standard\+ { color: #E5B49D; }
[data-theme="dark"] .tag.diff-Advanced { color: #E6C97E; background: #4A3A1A; }
[data-theme="dark"] .tag.diff-Advanced\+ { color: #C9A8C5; }

.set-card .progress { height: 4px; border-radius: 999px; background: var(--paper-3); overflow: hidden; margin-top: 0.7rem; }
.set-card .progress > div { height: 100%; background: var(--accent, var(--clay)); transition: width .4s ease; }
.set-card .micro { display: flex; justify-content: space-between; font-size: 0.78rem; color: var(--ink-3); margin-top: 0.5rem; }

/* ==== Practice / Exam Mode ==== */
.exam-shell { display: grid; grid-template-columns: 280px 1fr; gap: 2rem; }
@media (max-width: 980px) { .exam-shell { grid-template-columns: 1fr; } }

.q-rail { background: var(--paper-2); border: 1px solid var(--rule); border-radius: var(--r-lg); padding: 1rem; height: fit-content; position: sticky; top: 80px; }
.q-rail h4 { font-family: var(--sans); font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.12em; color: var(--ink-3); margin-bottom: 0.7rem; font-weight: 600; }

.q-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 5px; }
.q-pill {
  aspect-ratio: 1; display: grid; place-items: center;
  font-family: var(--mono); font-size: 0.78rem; font-weight: 500;
  background: var(--paper); border: 1px solid var(--rule); color: var(--ink-3); border-radius: 6px;
  transition: all .12s;
}
.q-pill:hover { border-color: var(--ink); color: var(--ink); }
.q-pill.answered { background: var(--paper-3); color: var(--ink); border-color: var(--ink-4); }
.q-pill.current { background: var(--ink); color: var(--paper); border-color: var(--ink); }
[data-theme="dark"] .q-pill.current { background: var(--paper); color: var(--paper-2); }
.q-pill.correct { background: var(--moss-soft); color: var(--good); border-color: var(--good); }
.q-pill.wrong { background: var(--clay-soft); color: var(--bad); border-color: var(--bad); }
.q-pill.flagged::after { content:""; position: absolute; }

.rail-meta { margin-top: 1.1rem; padding-top: 1.1rem; border-top: 1px solid var(--rule); display: flex; flex-direction: column; gap: 0.55rem; font-size: 0.85rem; color: var(--ink-2); }
.rail-meta .row { display: flex; justify-content: space-between; }
.rail-meta .row .v { font-family: var(--mono); color: var(--ink); font-weight: 500; }

.q-card {
  background: var(--paper-2); border: 1px solid var(--rule); border-radius: var(--r-lg);
  padding: 2rem 2.2rem; box-shadow: var(--shadow-1);
}
.q-meta { display: flex; align-items: center; gap: 0.8rem; margin-bottom: 1rem; flex-wrap: wrap; }
.q-num { font-family: var(--serif); color: var(--ink-3); font-size: 0.85rem; letter-spacing: 0.18em; text-transform: uppercase; }
.q-stem { font-family: var(--serif); font-size: 1.35rem; line-height: 1.4; color: var(--ink); margin-bottom: 1.5rem; letter-spacing: -0.005em; }
.q-stem em { color: var(--clay-deep); font-style: italic; }

.choices { display: flex; flex-direction: column; gap: 0.55rem; }
.choice {
  display: flex; gap: 1rem; align-items: flex-start;
  padding: 0.95rem 1.1rem; background: var(--paper);
  border: 1px solid var(--rule); border-radius: var(--r-md); cursor: pointer;
  transition: all .12s ease;
}
.choice:hover { border-color: var(--ink-3); }
.choice.selected { background: var(--clay-soft); border-color: var(--clay); }
[data-theme="dark"] .choice.selected { background: rgba(199,111,74,0.18); }
.choice.correct { background: var(--moss-soft); border-color: var(--good); }
[data-theme="dark"] .choice.correct { background: rgba(94,122,77,0.18); }
.choice.incorrect { background: var(--clay-soft); border-color: var(--bad); }
[data-theme="dark"] .choice.incorrect { background: rgba(176,85,69,0.18); }
.choice.dim { opacity: 0.55; }

.choice-letter {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--paper-3); color: var(--ink-2); font-weight: 600; font-size: 0.88rem;
  display: grid; place-items: center; flex-shrink: 0; font-family: var(--serif);
  border: 1px solid var(--rule);
}
.choice.selected .choice-letter { background: var(--clay); color: #fff; border-color: var(--clay); }
.choice.correct .choice-letter { background: var(--good); color: #fff; border-color: var(--good); }
.choice.incorrect .choice-letter { background: var(--bad); color: #fff; border-color: var(--bad); }
.choice-text { flex: 1; line-height: 1.45; color: var(--ink); }

.feedback {
  margin-top: 1.4rem; padding: 1.1rem 1.2rem;
  background: var(--paper); border-left: 3px solid var(--clay);
  border-radius: 0 var(--r-md) var(--r-md) 0;
  animation: slideIn .35s ease;
}
.feedback.correct { border-left-color: var(--good); }
.feedback.wrong { border-left-color: var(--bad); }
.feedback h4 { font-family: var(--sans); font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--ink-3); margin-bottom: 0.5rem; font-weight: 700; }
.feedback p { font-family: var(--serif); font-size: 1.02rem; color: var(--ink); margin: 0; }

@keyframes slideIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.q-actions { display: flex; justify-content: space-between; align-items: center; margin-top: 1.7rem; padding-top: 1.4rem; border-top: 1px solid var(--rule); gap: 1rem; flex-wrap: wrap; }
.q-actions .left { display: flex; gap: 0.5rem; }

/* ==== Mode banner ==== */
.mode-banner {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 0.7rem 1.1rem; margin-bottom: 1rem;
  background: var(--paper-2); border: 1px solid var(--rule); border-radius: var(--r-md);
  font-size: 0.86rem;
}
.mode-banner .label { color: var(--ink-3); }
.mode-banner .switch { display: inline-flex; gap: 0; background: var(--paper); border: 1px solid var(--rule); border-radius: 8px; overflow: hidden; }
.mode-banner .switch button { background: transparent; border: 0; padding: 0.4rem 0.8rem; font-size: 0.82rem; color: var(--ink-3); font-weight: 500; }
.mode-banner .switch button.on { background: var(--ink); color: var(--paper); }
[data-theme="dark"] .mode-banner .switch button.on { background: var(--paper); color: var(--paper-2); }

.timer { font-family: var(--mono); font-size: 0.9rem; color: var(--ink-2); }
.timer.warn { color: var(--clay-deep); font-weight: 600; }

/* ==== Results ==== */
.results-hero { text-align: center; padding: 3rem 1rem; }
.score-ring { position: relative; width: 200px; height: 200px; margin: 0 auto 2rem; }
.score-ring svg { transform: rotate(-90deg); width: 100%; height: 100%; }
.score-ring .val { position: absolute; inset: 0; display: grid; place-items: center; flex-direction: column; }
.score-ring .val .pct { font-family: var(--serif); font-size: 3.5rem; font-weight: 500; line-height: 1; color: var(--ink); }
.score-ring .val .lbl { font-size: 0.78rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-3); margin-top: 0.4rem; }

.results-summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 1rem; max-width: 760px; margin: 0 auto 2.5rem; }
.summary-tile { background: var(--paper-2); border: 1px solid var(--rule); border-radius: var(--r-md); padding: 1.1rem 1rem; text-align: left; }
.summary-tile .num { font-family: var(--serif); font-size: 1.7rem; line-height: 1; }
.summary-tile .lbl { font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--ink-3); margin-top: 0.4rem; }

.review-list { display: flex; flex-direction: column; gap: 0.6rem; max-width: 920px; margin: 0 auto; }
.review-item {
  display: grid; grid-template-columns: auto 1fr auto; gap: 1rem; align-items: center;
  padding: 0.9rem 1.1rem; background: var(--paper-2); border: 1px solid var(--rule); border-radius: var(--r-md);
  cursor: pointer; transition: border-color .15s;
}
.review-item:hover { border-color: var(--ink-4); }
.review-item .ix { font-family: var(--mono); color: var(--ink-3); font-size: 0.82rem; }
.review-item .stem { font-family: var(--serif); font-size: 0.96rem; color: var(--ink-2); line-height: 1.35; }
.review-item .badge { font-size: 0.75rem; padding: 0.2rem 0.55rem; border-radius: 999px; font-weight: 600; }
.review-item .badge.correct { background: var(--moss-soft); color: var(--good); }
.review-item .badge.wrong { background: var(--clay-soft); color: var(--bad); }
.review-item .badge.skipped { background: var(--paper-3); color: var(--ink-3); }

/* ==== Analytics ==== */
.analytics-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }
@media (max-width: 980px) { .analytics-grid { grid-template-columns: 1fr; } }

.panel {
  background: var(--paper-2); border: 1px solid var(--rule); border-radius: var(--r-lg);
  padding: 1.5rem 1.6rem;
}
.panel h3 { margin-bottom: 1rem; }
.panel .panel-sub { font-size: 0.85rem; color: var(--ink-3); margin-bottom: 1.2rem; }

.topic-row { display: grid; grid-template-columns: 180px 1fr 60px; gap: 0.8rem; align-items: center; padding: 0.45rem 0; }
.topic-row .lbl { font-size: 0.86rem; color: var(--ink-2); }
.topic-row .bar { height: 8px; background: var(--paper-3); border-radius: 999px; overflow: hidden; }
.topic-row .bar > div { height: 100%; border-radius: 999px; transition: width .5s ease; }
.topic-row .pct { text-align: right; font-family: var(--mono); font-size: 0.85rem; color: var(--ink-2); }

.heatmap { display: grid; grid-template-columns: repeat(15, 1fr); gap: 4px; }
.heat-cell { aspect-ratio: 1; border-radius: 3px; background: var(--paper-3); }
.heat-cell.correct { background: var(--good); }
.heat-cell.wrong { background: var(--bad); }
.heat-cell.skipped { background: var(--ink-4); opacity: 0.4; }

/* ==== Browse ==== */
.filters { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 1.4rem; }
.filter-chip {
  padding: 0.4rem 0.85rem; background: var(--paper-2); border: 1px solid var(--rule); border-radius: 999px;
  font-size: 0.82rem; color: var(--ink-2); font-weight: 500;
  display: inline-flex; align-items: center; gap: 0.4rem;
}
.filter-chip:hover { border-color: var(--ink-4); }
.filter-chip.active { background: var(--ink); color: var(--paper); border-color: var(--ink); }
[data-theme="dark"] .filter-chip.active { background: var(--paper); color: var(--paper-2); }
.filter-chip .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--c, var(--clay)); }

.browse-list { display: flex; flex-direction: column; gap: 0.65rem; }
.browse-card {
  background: var(--paper-2); border: 1px solid var(--rule); border-radius: var(--r-md);
  padding: 1rem 1.2rem;
  display: grid; grid-template-columns: auto 1fr auto; gap: 1rem; align-items: start;
}
.browse-card:hover { border-color: var(--ink-4); }
.browse-card .ix { font-family: var(--mono); color: var(--ink-3); font-size: 0.82rem; min-width: 60px; }
.browse-card .stem { font-family: var(--serif); font-size: 1.02rem; color: var(--ink); margin-bottom: 0.5rem; }
.browse-card .answer { font-size: 0.86rem; color: var(--good); margin-top: 0.4rem; padding-top: 0.5rem; border-top: 1px dashed var(--rule); }
.browse-card .topic-tag {
  font-size: 0.7rem; padding: 0.18rem 0.5rem; border-radius: 999px;
  background: var(--paper-3); color: var(--ink-2); border: 1px solid var(--rule); font-weight: 500;
}

/* ==== Case viewer ==== */
.case-shell { display: grid; grid-template-columns: 1fr 320px; gap: 2rem; }
@media (max-width: 1100px) { .case-shell { grid-template-columns: 1fr; } }

.case-section { background: var(--paper-2); border: 1px solid var(--rule); border-radius: var(--r-lg); margin-bottom: 1rem; overflow: hidden; }
.case-section header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.95rem 1.3rem; cursor: pointer;
  border-bottom: 1px solid transparent;
}
.case-section.open header { border-bottom-color: var(--rule); background: var(--paper-3); }
.case-section header h3 { font-size: 1.05rem; font-family: var(--serif); margin: 0; }
.case-section header .step { font-family: var(--mono); font-size: 0.78rem; color: var(--ink-3); margin-right: 0.8rem; }
.case-section .body { padding: 1.3rem; max-height: 0; overflow: hidden; transition: max-height .35s ease, padding .25s ease; padding-top: 0; padding-bottom: 0; }
.case-section.open .body { max-height: 2000px; padding: 1.3rem; }

.params-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.55rem 1.5rem; }
.params-grid .row { display: flex; justify-content: space-between; padding: 0.45rem 0; border-bottom: 1px solid var(--rule-soft); font-size: 0.9rem; }
.params-grid .row:last-child { border-bottom: 0; }
.params-grid .row .k { color: var(--ink-3); }
.params-grid .row .v { font-family: var(--mono); color: var(--ink); font-weight: 500; }

.trap-card {
  display: grid; grid-template-columns: auto 1fr auto; gap: 0.9rem; align-items: center;
  padding: 0.85rem 1rem; margin-bottom: 0.6rem;
  background: var(--paper); border: 1px solid var(--rule); border-radius: var(--r-md);
}
.trap-card .ic {
  width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center;
  font-weight: 700; font-size: 0.78rem; letter-spacing: 0.05em;
}
.trap-card.exclude .ic { background: var(--clay-soft); color: var(--clay-deep); }
.trap-card.include .ic { background: var(--moss-soft); color: var(--good); }
.trap-card .nm { font-weight: 600; color: var(--ink); }
.trap-card .why { font-size: 0.85rem; color: var(--ink-3); margin-top: 0.15rem; }
.trap-card .verdict { font-family: var(--mono); font-size: 0.75rem; padding: 0.25rem 0.55rem; border-radius: 999px; font-weight: 700; letter-spacing: 0.05em; }
.trap-card.exclude .verdict { background: var(--clay-soft); color: var(--clay-deep); }
.trap-card.include .verdict { background: var(--moss-soft); color: var(--good); }

.steps-list { display: flex; flex-direction: column; }
.step-row {
  display: grid; grid-template-columns: auto 1fr auto; gap: 1rem; align-items: center;
  padding: 0.85rem 1rem; border: 1px solid var(--rule); background: var(--paper);
  margin-bottom: 0.5rem; border-radius: var(--r-md);
}
.step-row.highlight { background: linear-gradient(90deg, var(--clay-soft), var(--paper) 60%); border-color: var(--clay); }
[data-theme="dark"] .step-row.highlight { background: linear-gradient(90deg, rgba(199,111,74,.18), var(--paper)); }
.step-row .ix { font-family: var(--serif); color: var(--ink-3); font-size: 0.95rem; min-width: 24px; }
.step-row .lbl { color: var(--ink-2); font-size: 0.95rem; }
.step-row .lbl .detail { display: block; font-size: 0.8rem; color: var(--ink-3); margin-top: 0.18rem; font-family: var(--mono); }
.step-row .v { font-family: var(--mono); font-size: 1rem; font-weight: 600; color: var(--ink); }

.sens-table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.sens-table th, .sens-table td { text-align: left; padding: 0.7rem 0.9rem; border-bottom: 1px solid var(--rule); }
.sens-table th { font-family: var(--sans); font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--ink-3); font-weight: 600; }
.sens-table td.npv { font-family: var(--mono); color: var(--ink); }
.sens-table td .pill { font-size: 0.75rem; padding: 0.2rem 0.5rem; border-radius: 999px; font-weight: 700; }
.sens-table td .pill.accept { background: var(--moss-soft); color: var(--good); }
.sens-table td .pill.reject { background: var(--clay-soft); color: var(--bad); }
.sens-table td .pill.flip { background: var(--plum-soft); color: var(--plum); }

.memo-card {
  background: var(--paper); border: 1px solid var(--rule); border-left: 4px solid var(--clay);
  padding: 1.4rem 1.6rem; border-radius: 0 var(--r-md) var(--r-md) 0;
  font-family: var(--serif); line-height: 1.55; color: var(--ink);
}
.memo-card .meta { font-family: var(--sans); font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.12em; color: var(--ink-3); margin-bottom: 0.7rem; font-weight: 600; }

/* ==== Tweaks Panel ==== */
.tweaks {
  position: fixed; right: 1.2rem; bottom: 1.2rem; z-index: 80;
  background: var(--paper); border: 1px solid var(--rule); border-radius: var(--r-lg);
  box-shadow: var(--shadow-3);
  width: 280px; padding: 1rem 1.2rem;
}
.tweaks h4 { font-family: var(--sans); font-weight: 700; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--ink-3); margin-bottom: 0.9rem; display: flex; justify-content: space-between; align-items: center; }
.tweak-row { display: flex; justify-content: space-between; align-items: center; padding: 0.45rem 0; font-size: 0.88rem; }
.tweak-row label { color: var(--ink-2); }
.theme-pick { display: inline-flex; gap: 4px; background: var(--paper-2); padding: 3px; border-radius: 8px; border: 1px solid var(--rule); }
.theme-pick button { background: transparent; border: 0; padding: 0.25rem 0.55rem; font-size: 0.78rem; color: var(--ink-3); border-radius: 5px; }
.theme-pick button.on { background: var(--ink); color: var(--paper); }
[data-theme="dark"] .theme-pick button.on { background: var(--paper); color: var(--paper-2); }

.toggle { width: 36px; height: 20px; border-radius: 999px; background: var(--paper-3); border: 1px solid var(--rule); position: relative; cursor: pointer; padding: 0; }
.toggle::after { content:""; position: absolute; left: 2px; top: 1px; width: 16px; height: 16px; border-radius: 50%; background: var(--paper); box-shadow: 0 1px 2px rgba(0,0,0,.15); transition: left .15s; }
.toggle.on { background: var(--clay); }
.toggle.on::after { left: 18px; background: #fff; }

/* ==== Misc ==== */
.kbd {
  font-family: var(--mono); font-size: 0.72rem; font-weight: 600;
  padding: 0.15rem 0.4rem; border-radius: 4px;
  background: var(--paper-3); border: 1px solid var(--rule); color: var(--ink-2);
}

.empty { text-align: center; padding: 3rem; color: var(--ink-3); }

.divider { height: 1px; background: var(--rule); margin: 1.6rem 0; }

.fade-in { animation: fadeIn .3s ease; }

/* Topic dot helper */
.t-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin-right: 6px; vertical-align: middle; }

.section-title {
  font-family: var(--serif); font-size: 1.1rem; margin: 1.4rem 0 0.7rem;
  display: flex; align-items: center; gap: 0.7rem;
}
.section-title::before { content:""; width: 4px; height: 18px; background: var(--clay); border-radius: 2px; }

.scroll-area { max-height: 70vh; overflow-y: auto; padding-right: 0.5rem; }
.scroll-area::-webkit-scrollbar { width: 6px; }
.scroll-area::-webkit-scrollbar-thumb { background: var(--rule); border-radius: 3px; }

/* ==== Boot splash (pre-Babel) ==== */
.boot-splash {
  min-height: 100vh; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 0.9rem;
  color: var(--ink-3); font-family: var(--sans);
}
.boot-mark {
  width: 56px; height: 56px; border-radius: 14px;
  background: linear-gradient(135deg, var(--clay), var(--clay-deep));
  display: grid; place-items: center; color: #FAF7F2;
  font-family: var(--serif); font-weight: 500; font-size: 1.7rem;
  box-shadow: 0 6px 18px rgba(168,84,47,.28);
}
.boot-text { font-size: 0.86rem; letter-spacing: 0.04em; }

/* ==== Beta pill in topbar ==== */
.beta-pill {
  margin-left: 0.55rem;
  font-size: 0.62rem; font-weight: 700; letter-spacing: 0.14em;
  background: var(--plum-soft); color: var(--plum);
  padding: 0.2rem 0.5rem; border-radius: 999px;
  font-family: var(--sans);
}

/* ==== User pill in topbar ==== */
.user-pill {
  display: inline-flex; align-items: center; gap: 0.5rem;
  background: var(--paper-2); border: 1px solid var(--rule);
  padding: 0.25rem 0.65rem 0.25rem 0.3rem; border-radius: 999px;
  color: var(--ink-2); margin-left: 0.4rem;
  font-family: var(--sans); font-size: 0.82rem; font-weight: 500;
  max-width: 180px;
}
.user-pill:hover { border-color: var(--ink-4); color: var(--ink); }
.user-pill .user-nm {
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 130px;
}
.user-ini {
  width: 24px; height: 24px; border-radius: 50%;
  background: linear-gradient(135deg, var(--clay), var(--clay-deep));
  color: #FAF7F2; display: grid; place-items: center;
  font-family: var(--serif); font-weight: 600; font-size: 0.82rem;
  flex-shrink: 0;
}

/* ==== Auth screen ==== */
.auth-screen {
  min-height: 100vh; display: grid; place-items: center;
  padding: 2rem 1rem;
  background:
    radial-gradient(900px 600px at 15% -10%, rgba(199,111,74,.10), transparent 60%),
    radial-gradient(800px 500px at 100% 110%, rgba(126,90,122,.10), transparent 60%),
    var(--paper);
}
.auth-card {
  width: min(440px, 100%); background: var(--paper-2);
  border: 1px solid var(--rule); border-radius: var(--r-lg);
  box-shadow: var(--shadow-3);
  padding: 1.8rem 1.8rem 1.5rem;
  position: relative;
}
.auth-brand { display: flex; align-items: center; gap: 0.7rem; margin-bottom: 1.4rem; }
.auth-title { font-family: var(--serif); font-size: 1.25rem; line-height: 1; color: var(--ink); }
.auth-sub { font-size: 0.74rem; color: var(--ink-3); letter-spacing: 0.06em; text-transform: uppercase; margin-top: 0.2rem; }
.auth-pitch h1 {
  font-size: 1.55rem; line-height: 1.18; letter-spacing: -0.01em;
  margin-bottom: 0.5rem;
}
.auth-pitch h1 em { font-style: italic; color: var(--clay-deep); }
.auth-pitch p { font-size: 0.92rem; color: var(--ink-3); }
.auth-tabs {
  display: inline-flex; background: var(--paper); border: 1px solid var(--rule);
  padding: 3px; border-radius: 10px; margin: 1rem 0 0.9rem;
}
.auth-tabs button {
  background: transparent; border: 0; color: var(--ink-3);
  padding: 0.4rem 0.9rem; font-size: 0.84rem; font-weight: 600;
  border-radius: 7px;
}
.auth-tabs button.on { background: var(--ink); color: var(--paper); }
.auth-tabs button:disabled { opacity: 0.45; cursor: not-allowed; }
[data-theme="dark"] .auth-tabs button.on { background: var(--paper); color: var(--paper-2); }

.auth-form { display: flex; flex-direction: column; }
.auth-label {
  font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--ink-3); font-weight: 600;
  margin: 0.85rem 0 0.4rem;
}
.auth-label .hint { text-transform: none; letter-spacing: normal; color: var(--ink-4); font-weight: 500; margin-left: 0.3rem; }
.auth-input {
  width: 100%; box-sizing: border-box;
  padding: 0.65rem 0.85rem; border: 1px solid var(--rule);
  border-radius: var(--r-md); background: var(--paper);
  color: var(--ink); font-family: var(--sans); font-size: 0.95rem;
  outline: none;
}
.auth-input:focus { border-color: var(--clay); box-shadow: 0 0 0 3px rgba(199,111,74,.15); }
.auth-error {
  margin-top: 0.7rem; padding: 0.55rem 0.8rem;
  background: var(--clay-soft); color: var(--clay-deep);
  border-radius: var(--r-sm); font-size: 0.85rem;
  border-left: 3px solid var(--clay);
}
.auth-submit {
  margin-top: 1rem; width: 100%; justify-content: center;
}
.auth-fineprint { font-size: 0.78rem; color: var(--ink-3); margin: 1rem 0 0; line-height: 1.45; }
.auth-beta {
  position: absolute; top: 1rem; right: 1.1rem;
  font-size: 0.62rem; font-weight: 700; letter-spacing: 0.14em;
  color: var(--plum); background: var(--plum-soft);
  padding: 0.2rem 0.5rem; border-radius: 999px;
}

.user-list { display: flex; flex-direction: column; gap: 0.4rem; margin-bottom: 0.4rem; }
.user-row {
  display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 0.4rem;
}
.user-row .pick {
  display: flex; align-items: center; gap: 0.7rem;
  padding: 0.55rem 0.75rem; background: var(--paper);
  border: 1px solid var(--rule); border-radius: var(--r-md);
  color: var(--ink); text-align: left; flex: 1;
  font-size: 0.92rem;
}
.user-row.on .pick { border-color: var(--clay); background: var(--clay-soft); }
[data-theme="dark"] .user-row.on .pick { background: rgba(199,111,74,0.18); }
.user-row .pick .nm { flex: 1; font-family: var(--serif); }
.user-row .pick .lock {
  font-family: var(--mono); font-size: 0.66rem; letter-spacing: 0.08em;
  background: var(--paper-3); color: var(--ink-3);
  padding: 0.18rem 0.45rem; border-radius: 999px;
}
.user-row .pick .lock.open { color: var(--ink-4); }
.user-row .rm {
  width: 30px; height: 30px; border-radius: 8px;
  background: transparent; border: 1px solid var(--rule); color: var(--ink-3);
  display: grid; place-items: center;
}
.user-row .rm:hover { border-color: var(--bad); color: var(--bad); background: var(--clay-soft); }

@media (max-width: 720px) {
  .topbar { flex-wrap: wrap; gap: 0.7rem; padding: 0.7rem 1rem; }
  .nav { order: 4; flex-basis: 100%; margin-left: 0; }
  .user-pill .user-nm { display: none; }
}
