:root {
  --bg:       #0f1117;
  --surface:  #181c27;
  --border:   #2a2f42;
  --accent:   #f0a500;
  --accent2:  #3b82f6;
  --text:     #dce3f0;
  --muted:    #7a839a;
  --code-bg:  #141720;
  --success:  #22c55e;
  --danger:   #f87171;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Sora', sans-serif;
  font-size: 15px;
  line-height: 1.7;
  min-height: 100vh;
}

/* ── Topbar ── */
.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 12px 40px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.badge {
  background: var(--accent);
  color: #000;
  font-weight: 700;
  font-size: 11px;
  padding: 3px 10px;
  border-radius: 4px;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.breadcrumb { color: var(--muted); font-size: 13px; }
.breadcrumb span { color: var(--accent); }

/* ── Hero ── */
.hero {
  background: linear-gradient(135deg, #131828 0%, #0f1117 60%);
  border-bottom: 1px solid var(--border);
  padding: 52px 40px 40px;
  position: relative;
  overflow: hidden;
}
.hero::before {
  content: '';
  position: absolute; inset: 0;
  background:
    radial-gradient(ellipse 600px 300px at 80% 50%, rgba(240,165,0,.06), transparent),
    radial-gradient(ellipse 400px 400px at 10% 80%, rgba(59,130,246,.05), transparent);
  pointer-events: none;
}
.hero-inner { max-width: 820px; }
.hero h1 {
  font-size: 30px; font-weight: 700;
  letter-spacing: -.01em; line-height: 1.25;
  margin-bottom: 14px;
}
.hero h1 em { font-style: normal; color: var(--accent); }
.hero p { color: var(--muted); max-width: 580px; font-size: 14.5px; }
.hero-meta { display: flex; gap: 24px; margin-top: 24px; flex-wrap: wrap; }
.meta-pill {
  display: flex; align-items: center; gap: 7px;
  background: rgba(255,255,255,.04);
  border: 1px solid var(--border);
  border-radius: 6px; padding: 6px 14px;
  font-size: 13px; color: var(--muted);
}

/* ── Layout ── */
.layout {
  display: grid;
  grid-template-columns: 230px 1fr;
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 20px 60px;
}

/* ── Sidebar ── */
.sidebar {
  padding: 32px 24px 32px 0;
  border-right: 1px solid var(--border);
  position: sticky; top: 0;
  align-self: start;
  height: 100vh; overflow-y: auto;
}
.toc-label {
  font-size: 10.5px; font-weight: 600;
  letter-spacing: .1em; text-transform: uppercase;
  color: var(--muted); margin-bottom: 14px;
}
.toc-list { list-style: none; }
.toc-list li { margin-bottom: 2px; }
.toc-list a {
  display: flex; align-items: center; gap: 8px;
  color: var(--muted); text-decoration: none;
  font-size: 13px; padding: 6px 10px;
  border-radius: 6px; transition: all .15s;
}
.toc-list a:hover, .toc-list a.active {
  background: rgba(240,165,0,.08); color: var(--accent);
}
.toc-num {
  background: var(--border); color: var(--muted);
  font-size: 10px; font-weight: 700;
  width: 18px; height: 18px; border-radius: 4px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

/* ── Content ── */
.content { padding: 40px 0 40px 40px; }

/* ── Prereq banner ── */
.prereq {
  display: flex; gap: 14px; align-items: flex-start;
  background: rgba(59,130,246,.07);
  border: 1px solid rgba(59,130,246,.2);
  border-radius: 10px; padding: 16px 20px; margin-bottom: 30px;
}
.prereq-icon { font-size: 20px; flex-shrink: 0; }
.prereq-body { font-size: 13.5px; color: #93c5fd; line-height: 1.6; }
.prereq-body strong { color: var(--accent2); }

/* ── Section card ── */
.section {
  margin-bottom: 30px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px; overflow: hidden;
  scroll-margin-top: 24px;
}
.section-header {
  display: flex; align-items: center; gap: 14px;
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
  background: rgba(255,255,255,.02);
}
.section-num {
  width: 32px; height: 32px; border-radius: 8px;
  background: rgba(240,165,0,.12);
  border: 1px solid rgba(240,165,0,.25);
  color: var(--accent); font-size: 13px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.section-title { font-size: 15.5px; font-weight: 600; color: #fff; }
.section-subtitle { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.section-body { padding: 20px 24px; }

/* ── Steps ── */
.steps { list-style: none; counter-reset: steps; }
.steps li {
  counter-increment: steps;
  display: flex; gap: 14px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(255,255,255,.04);
  align-items: flex-start;
}
.steps li:last-child { border-bottom: none; }
.steps li::before {
  content: counter(steps);
  width: 24px; height: 24px; border-radius: 50%;
  background: rgba(59,130,246,.12);
  border: 1px solid rgba(59,130,246,.3);
  color: var(--accent2); font-size: 11px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; margin-top: 1px;
}
.steps li .text { flex: 1; }

/* ── Code / value blocks ── */
code {
  background: var(--code-bg);
  border: 1px solid var(--border);
  color: var(--accent);
  font-family: 'JetBrains Mono', monospace;
  font-size: 12.5px; padding: 1px 7px; border-radius: 4px;
}
.value-block {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 6px; padding: 8px 14px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px; color: var(--accent); margin: 6px 0;
}

/* ── Callout ── */
.callout {
  display: flex; gap: 14px; align-items: flex-start;
  background: rgba(34,197,94,.07);
  border: 1px solid rgba(34,197,94,.2);
  border-radius: 10px; padding: 16px 20px; margin-top: 16px;
}
.callout-icon { font-size: 22px; flex-shrink: 0; }
.callout-text { font-size: 14px; color: #a3e6b8; line-height: 1.6; }
.callout-text strong { color: var(--success); }

/* ── Tables & Ext Grids (from FSRM) ── */
.ext-grid { display: flex; flex-wrap: wrap; gap: 6px; }
.ext-chip {
  background: rgba(255,255,255,.05);
  border: 1px solid var(--border);
  border-radius: 4px; padding: 2px 6px;
  font-family: 'JetBrains Mono', monospace; font-size: 12px; color: var(--text);
}
table { width: 100%; border-collapse: collapse; margin-top: 16px; }
th, td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--border); }
th { background: rgba(255,255,255,.02); font-size: 13px; color: var(--muted); font-weight: 600; }
.tip {
  background: rgba(240,165,0,.08); border-left: 3px solid var(--accent);
  padding: 12px 16px; border-radius: 0 6px 6px 0; font-size: 13.5px; color: #fde08b;
}

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

@media (max-width: 700px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .content { padding: 24px 0; }
  .hero, .topbar { padding-left: 20px; padding-right: 20px; }
}