:root {
  --bg: #f6f7f9;
  --panel: #ffffff;
  --ink: #1a2230;
  --muted: #5b6575;
  --line: #e3e7ee;
  --accent: #4f46e5;
  --accent-soft: #eef0ff;
  --ok: #0f7b4f;
  --ok-soft: #e7f6ee;
  --warn: #92610a;
  --warn-soft: #fdf3df;
  --bad: #a13333;
  --bad-soft: #fbeaea;
  --info: #14538a;
  --info-soft: #e7f1fb;
}
.dark {
  --bg: #14171d;
  --panel: #1d2129;
  --ink: #e8ebf1;
  --muted: #9aa4b2;
  --line: #2c323d;
  --accent: #8b85ff;
  --accent-soft: #262a44;
  --ok: #5fd39c;
  --ok-soft: #1d3328;
  --warn: #e5b566;
  --warn-soft: #383018;
  --bad: #e58a8a;
  --bad-soft: #3a2222;
  --info: #7db8e8;
  --info-soft: #1c2c3d;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.topbar {
  position: sticky; top: 0; z-index: 10;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  max-width: 1200px; margin: 0 auto; padding: 10px 20px;
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
}
.brand { font-weight: 700; white-space: nowrap; }
.topnav { display: flex; gap: 4px; flex-wrap: wrap; flex: 1; }
.topnav a {
  color: var(--muted); font-size: 13px; padding: 6px 10px; border-radius: 6px;
}
.topnav a:hover { background: var(--accent-soft); color: var(--accent); text-decoration: none; }
#theme-toggle {
  border: 1px solid var(--line); background: var(--panel); border-radius: 6px;
  padding: 6px 10px; cursor: pointer; font-size: 14px;
}

.layout {
  max-width: 1200px; margin: 0 auto; padding: 24px 20px 64px;
  display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 32px;
}
.sidenav { position: sticky; top: 72px; align-self: start; display: flex; flex-direction: column; gap: 2px; }
.sidenav a { color: var(--muted); font-size: 13px; padding: 5px 8px; border-radius: 6px; }
.sidenav a:hover { background: var(--accent-soft); color: var(--accent); text-decoration: none; }
.sidenav-title {
  font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--muted); margin: 12px 8px 6px; font-weight: 600;
}
.progress-box { margin-top: 20px; border-top: 1px solid var(--line); padding-top: 4px; }
.progress-track { height: 6px; background: var(--line); border-radius: 3px; overflow: hidden; margin: 4px 8px; }
.progress-track span { display: block; height: 100%; width: 0; background: var(--accent); transition: width 240ms ease; }
.progress-label { font-size: 12px; color: var(--muted); margin: 4px 8px; }

.content { min-width: 0; }
.content section {
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
  padding: 24px 28px; margin-bottom: 24px;
  scroll-margin-top: 80px;
}
h1 { font-size: 26px; line-height: 1.2; margin: 0 0 8px; }
h2 { font-size: 19px; margin: 0 0 12px; }
h3 { font-size: 15px; margin: 18px 0 6px; }
.lede { color: var(--muted); font-size: 16px; margin-top: 0; }
.callout {
  background: var(--info-soft); border-left: 3px solid var(--info);
  padding: 10px 14px; border-radius: 0 8px 8px 0; margin: 14px 0; font-size: 14px;
}
.callout.tip { background: var(--ok-soft); border-left-color: var(--ok); }
.data-table { width: 100%; border-collapse: collapse; font-size: 14px; margin: 10px 0; }
.data-table th {
  text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--line);
}
.data-table td { padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.data-table tr:last-child td { border-bottom: none; }
.pill {
  display: inline-block; font-size: 12px; font-weight: 600;
  padding: 2px 10px; border-radius: 999px; white-space: nowrap;
}
.pill-lead { background: var(--info-soft); color: var(--info); }
.pill-qualified { background: var(--accent-soft); color: var(--accent); }
.pill-proposal { background: var(--warn-soft); color: var(--warn); }
.pill-negotiation { background: var(--bad-soft); color: var(--bad); }
.pill-won { background: var(--ok-soft); color: var(--ok); }
.pill-lost { background: var(--line); color: var(--muted); }

.svg-box { margin: 14px 0; }
.svg-box svg { width: 100%; height: auto; display: block; }
.svg-label { font: 600 13px -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; fill: var(--ink); }
.svg-sub { font: 12px -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; fill: var(--muted); }
.svg-head { font: 700 14px -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; fill: var(--ink); }

.quiz .q { border-top: 1px solid var(--line); padding: 12px 0; }
.quiz .q:first-child { border-top: none; }
.reveal {
  border: 1px solid var(--line); background: var(--panel); color: var(--accent);
  border-radius: 6px; padding: 5px 12px; cursor: pointer; font-size: 13px;
}
.reveal:hover { background: var(--accent-soft); }
.answer { display: none; background: var(--ok-soft); border-radius: 8px; padding: 8px 12px; font-size: 14px; }
.answer.open { display: block; }

.done-check {
  display: flex; align-items: center; gap: 8px; margin-top: 16px;
  font-size: 13px; color: var(--muted); cursor: pointer;
}
.done-check input { width: 16px; height: 16px; accent-color: var(--accent); }
.done-check:has(input:checked) { color: var(--ok); }

.glossary dt { font-weight: 700; margin-top: 10px; }
.glossary dd { margin: 2px 0 0 0; color: var(--muted); font-size: 14px; }
.final { margin-top: 18px; }
.cta {
  display: inline-block; background: var(--accent); color: #fff; font-weight: 600;
  padding: 10px 18px; border-radius: 8px;
}
.cta:hover { text-decoration: none; filter: brightness(1.08); }
.footer { text-align: center; color: var(--muted); font-size: 12px; padding: 0 0 32px; }

@media (max-width: 860px) {
  .layout { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .sidenav { position: static; flex-direction: row; flex-wrap: wrap; border-bottom: 1px solid var(--line); padding-bottom: 10px; }
  .sidenav-title, .progress-box { display: none; }
  .content section { padding: 18px; }
}
@media print {
  .topbar, .sidenav, .footer, .reveal, .done-check { display: none !important; }
  .layout { display: block; }
  .content section { border: none; padding: 0 0 16px; page-break-inside: avoid; }
  .answer { display: block !important; }
}
