/* ================================================================
   Investment Banking Notes — styles.css
   Design System: Modern SaaS Adaptive Theme (Dark Default + Light)
   ================================================================ */

/* ── CSS Variables ── */
:root {
  --bg:           #09090b;
  --surface:      #111113;
  --card:         #18181b;

  --border:       #27272a;
  --border-light: #3f3f46;

  --text:         #fafafa;
  --muted:        #a1a1aa;
  --dim:          #52525b;

  --accent:       #6366f1;
  --accent2:      #818cf8;
  --accent3:      #a5b4fc;

  --green:        #22c55e;
  --amber:        #f59e0b;
  --coral:        #f97316;
  --pink:         #ec4899;
  --teal:         #14b8a6;

  --shadow:       0 1px 3px rgba(0,0,0,0.4);
  --shadow-md:    0 4px 12px rgba(0,0,0,0.5);

  --radius-sm:    4px;
  --radius-md:    8px;
  --radius-lg:    12px;

  --topbar-height: 40px;
  --sidebar-width: 240px;

  font-family: 'Segoe UI', system-ui, sans-serif;
}

/* ── Light Mode ── */
.light, [data-theme="light"] {
  --bg:           #fafaf9;
  --surface:      #f4f4f5;
  --card:         #ffffff;
  --border:       #e4e4e7;
  --border-light: #d4d4d8;
  --text:         #09090b;
  --muted:        #52525b;
  --dim:          #a1a1aa;
  --shadow:       0 1px 3px rgba(0,0,0,0.06);
  --shadow-md:    0 4px 12px rgba(0,0,0,0.08);

  --green-text:   #15803d;
  --amber-text:   #b45309;
  --coral-text:   #c2410c;
  --pink-text:    #be185d;
  --teal-text:    #0f766e;
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.6;
  transition: background-color 0.2s ease, color 0.2s ease;
  overflow: hidden;
}

a { color: var(--accent2); text-decoration: none; }
a:hover { color: var(--accent); }

/* ── Theme Icons ── */
.icon-light { display: none; }
.icon-dark  { display: inline; }
.light .icon-dark  { display: none; }
.light .icon-light { display: inline; }

/* ================================================================
   TOPBAR
   ================================================================ */
.site-topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--topbar-height);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  z-index: 100;
}

.topbar-inner {
  display: flex;
  align-items: center;
  height: 100%;
  padding: 0 16px;
  gap: 12px;
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  flex-shrink: 0;
}

.topbar-logo-mark {
  background: var(--accent);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 5px;
  border-radius: var(--radius-sm);
  letter-spacing: 0.04em;
}

.topbar-logo-text {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.topbar-breadcrumb {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 1;
  min-width: 0;
}

.topbar-bc-link {
  font-size: 12px;
  color: var(--dim);
  text-decoration: none;
  white-space: nowrap;
}
.topbar-bc-link:hover { color: var(--muted); }

.topbar-bc-sep {
  font-size: 11px;
  color: var(--dim);
}

.topbar-bc-current {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-theme-toggle {
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--muted);
  cursor: pointer;
  font-size: 13px;
  padding: 3px 7px;
  flex-shrink: 0;
  transition: border-color 0.15s, color 0.15s;
}
.topbar-theme-toggle:hover { border-color: var(--border-light); color: var(--text); }

.topbar-request {
  font-size: 12px;
  font-weight: 500;
  background: var(--accent);
  color: #fff;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  flex-shrink: 0;
  transition: opacity 0.15s;
}
.topbar-request:hover { opacity: 0.85; color: #fff; }

/* ================================================================
   APP LAYOUT
   ================================================================ */
.app-layout {
  display: flex;
  height: calc(100vh - var(--topbar-height));
  margin-top: var(--topbar-height);
  overflow: hidden;
}

/* ================================================================
   SIDEBAR
   ================================================================ */
.sidebar {
  width: var(--sidebar-width);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  height: calc(100vh - var(--topbar-height));
  flex-shrink: 0;
}

.sidebar-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--dim);
  padding: 14px 14px 8px;
  flex-shrink: 0;
}

#toc-nav {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 4px 8px 8px;
}

#toc-nav::-webkit-scrollbar { width: 3px; }
#toc-nav::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 2px; }
#toc-nav::-webkit-scrollbar-track { background: transparent; }

/* Toc items */
.toc-item { margin-bottom: 2px; }

a.toc-header, a.toc-sub { text-decoration: none; color: inherit; display: flex; }

.toc-header {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  color: var(--muted);
  transition: background 0.12s, color 0.12s;
  width: 100%;
}
.toc-header:hover { background: rgba(255,255,255,.04); color: var(--text); }
.light .toc-header:hover { background: rgba(0,0,0,.04); }
.toc-header.active {
  border-left: 2px solid var(--accent);
  background: rgba(99,102,241,.07);
  color: var(--accent);
}

.toc-icon { font-size: 13px; flex-shrink: 0; }
.toc-label { flex: 1; line-height: 1.3; }

.toc-chevron {
  font-size: 8px;
  color: var(--dim);
  transition: transform 0.2s ease;
  flex-shrink: 0;
}
.toc-item.open .toc-chevron { transform: rotate(90deg); }

.toc-subs {
  display: none;
  padding: 2px 0 4px 28px;
}
.toc-item.open .toc-subs { display: block; }

.toc-sub {
  display: block;
  padding: 5px 8px;
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  color: var(--dim);
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
  margin-bottom: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.toc-sub:hover { background: rgba(255,255,255,.03); color: var(--muted); }
.light .toc-sub:hover { background: rgba(0,0,0,.03); }
.toc-sub.active { color: var(--accent2); font-weight: 500; }

/* Progress bar */
.sidebar-footer {
  padding: 10px 14px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.progress-meta {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--dim);
  margin-bottom: 5px;
}

.progress-bar {
  height: 2px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  width: 0%;
  transition: width .4s ease;
}

/* ================================================================
   MAIN CONTENT
   ================================================================ */
.main-content {
  flex: 1;
  overflow-y: auto;
  height: calc(100vh - var(--topbar-height));
  background: var(--bg);
  padding: 0 0 64px;
}

.main-header {
  padding: 16px 48px 0;
  max-width: 960px;
  margin: 0 auto;
}

.breadcrumb {
  font-size: 12px;
  color: var(--dim);
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 4px;
}
.breadcrumb .bc-active { color: var(--muted); }

#content-area {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 48px 64px;
}

/* ================================================================
   CONTENT CONTAINER
   ================================================================ */
.content-container { padding-top: 28px; }

.content-container h1,
.content-container h2 {
  font-size: 24px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
  line-height: 1.3;
}

.content-container h3 {
  font-size: 17px;
  font-weight: 600;
  color: var(--accent2);
  margin: 28px 0 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}

.content-container h4 {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin: 20px 0 8px;
}

.content-container p,
.body-text {
  font-size: 15px;
  color: var(--muted);
  line-height: 1.7;
  margin-bottom: 14px;
}

.content-container ul,
.content-container ol {
  margin: 0 0 14px 20px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.7;
}

.content-container li { margin-bottom: 5px; }

.content-container strong { color: var(--text); font-weight: 600; }

.content-container em { color: var(--muted); font-style: italic; }

/* ── Difficulty Badge ── */
.difficulty-badge {
  display: inline-block;
  font-size: 12px;
  font-weight: 500;
  padding: 3px 10px;
  border-radius: 20px;
  margin-bottom: 20px;
  border: 1px solid transparent;
}
.difficulty-badge.beginner     { color: var(--green);  border-color: var(--green);  background: rgba(34,197,94,.08); }
.difficulty-badge.intermediate { color: var(--amber);  border-color: var(--amber);  background: rgba(245,158,11,.08); }
.difficulty-badge.advanced     { color: var(--coral);  border-color: var(--coral);  background: rgba(249,115,22,.08); }
.difficulty-badge.expert       { color: #ef4444;        border-color: #ef4444;        background: rgba(239,68,68,.08); }

/* ================================================================
   STAT CARDS
   ================================================================ */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin: 20px 0 28px;
}

.stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  border-top-width: 2px;
}

.stat-value {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 4px;
  line-height: 1;
}

.stat-label {
  font-size: 12px;
  color: var(--dim);
  line-height: 1.4;
}

@media (max-width: 700px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ================================================================
   TABLES
   ================================================================ */
.table-wrapper {
  overflow-x: auto;
  margin: 16px 0 20px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
}

.table-wrapper table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

.table-wrapper th {
  background: var(--surface);
  color: var(--muted);
  font-weight: 600;
  text-align: left;
  padding: 10px 14px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border);
}

.table-wrapper td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--muted);
  vertical-align: top;
  line-height: 1.5;
}

.table-wrapper tr:last-child td { border-bottom: none; }

tr:hover td { background: rgba(255,255,255,.02); }
.light tr:hover td { background: rgba(0,0,0,.02); }

/* ================================================================
   CALLOUT BOXES
   ================================================================ */
.callout {
  border-left: 3px solid var(--accent);
  background: rgba(99,102,241,.07);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 14px 18px;
  margin: 16px 0;
  font-size: 14px;
  color: var(--muted);
  line-height: 1.65;
}

.callout-green  { border-left-color: var(--green);  background: rgba(34,197,94,.06); }
.callout-amber  { border-left-color: var(--amber);  background: rgba(245,158,11,.06); }
.callout-coral  { border-left-color: var(--coral);  background: rgba(249,115,22,.06); }
.callout-teal   { border-left-color: var(--teal);   background: rgba(20,184,166,.06); }

.callout strong { color: var(--text); }

/* ── Core Insight / Warning Boxes ── */
.insight-box {
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  background: var(--card);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  padding: 16px 20px;
  margin: 20px 0;
}
.insight-box .insight-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 6px;
}
.insight-box p { margin-bottom: 0; }

.warning-box { border-left-color: var(--amber); }
.warning-box .insight-label { color: var(--amber); }
.danger-box  { border-left-color: var(--coral); }
.danger-box  .insight-label { color: var(--coral); }

/* ================================================================
   FORMULA BLOCKS
   ================================================================ */
.formula-block {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  margin: 16px 0;
  font-size: 15px;
}

.formula-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--dim);
  margin-bottom: 8px;
  font-weight: 600;
}

.formula-body {
  color: var(--text);
  font-style: italic;
  font-family: 'Segoe UI', system-ui, sans-serif;
}

.formula-vars {
  margin-top: 10px;
  font-size: 13px;
  color: var(--dim);
  line-height: 1.8;
}

/* ================================================================
   STEP BLOCKS
   ================================================================ */
.step-list { list-style: none; margin: 0 0 16px; padding: 0; counter-reset: steps; }
.step-item {
  display: flex;
  gap: 14px;
  margin-bottom: 14px;
  counter-increment: steps;
}
.step-num {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: rgba(99,102,241,.15);
  color: var(--accent2);
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 1px;
}
.step-body { font-size: 14px; color: var(--muted); line-height: 1.65; }
.step-body strong { color: var(--text); }

/* ================================================================
   TABS
   ================================================================ */
.tab-group { margin: 16px 0 20px; }

.tab-btns {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 0;
  flex-wrap: wrap;
}

.tab-btn {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 8px 14px;
  font-size: 13px;
  color: var(--dim);
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
  margin-bottom: -1px;
}
.tab-btn:hover { color: var(--muted); }
.tab-btn.active { color: var(--accent2); border-bottom-color: var(--accent); }

.tab-panel { display: none; padding: 20px 0 4px; }
.tab-panel.active { display: block; }

/* ================================================================
   COUNTRY TABS
   ================================================================ */
.country-tabs { margin: 16px 0 20px; }

.country-tab-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}

.country-tab-btn {
  padding: 5px 12px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  font-size: 12.5px;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.country-tab-btn:hover { border-color: var(--border-light); color: var(--text); }
.light .country-tab-btn:hover { border-color: var(--border-light); }
.country-tab-btn.active {
  border-color: var(--accent);
  color: var(--accent2);
  background: rgba(99,102,241,.07);
  font-weight: 500;
}

.country-tab-panel { display: none; font-size: 14px; color: var(--muted); line-height: 1.65; }
.country-tab-panel.active { display: block; }

/* ================================================================
   COMPARISON CARDS
   ================================================================ */
.compare-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 16px 0;
}

.compare-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
}
.compare-card-title {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 10px;
}

.compare-card ul { margin-left: 14px; font-size: 13.5px; }
.compare-card li { margin-bottom: 5px; }

/* ================================================================
   QUIZ & KNOWLEDGE CHECK
   ================================================================ */
/* Mini Quiz Section */
.mini-quiz-section {
  margin-top: 40px;
  padding-top: 32px;
  border-top: 1px solid var(--border);
}
.mini-quiz-section h3 { margin-bottom: 4px; }
.mini-quiz-block { margin-bottom: 32px; }
.mini-quiz-block h4,
.knowledge-check-block h4 {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--muted);
  margin-bottom: 16px;
}

/* Topic Quick Check */
.topic-quick-check {
  margin-top: 40px;
  padding-top: 32px;
  border-top: 1px solid var(--border);
}
.topic-quick-check h3 { margin-bottom: 4px; }

/* MCQ */
.quiz-question { margin-bottom: 20px; }

.quiz-q {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 10px;
}

.quiz-options { display: flex; flex-direction: column; gap: 6px; }

.quiz-opt {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 9px 14px;
  text-align: left;
  font-size: 13.5px;
  color: var(--muted);
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.quiz-opt:hover { border-color: var(--border-light); color: var(--text); }
.quiz-opt.correct { border-color: var(--green); color: var(--green); background: rgba(34,197,94,.08); }
.quiz-opt.wrong   { border-color: var(--coral); color: var(--coral); background: rgba(249,115,22,.08); }

.quiz-explain {
  display: none;
  margin-top: 10px;
  padding: 10px 14px;
  background: var(--surface);
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  color: var(--muted);
  border-left: 2px solid var(--green);
}
.quiz-question.answered .quiz-explain { display: block; }

/* KC Items */
.kc-item {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin-bottom: 10px;
  overflow: hidden;
}
.kc-question {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 12px 16px;
  background: var(--surface);
  border: none;
  cursor: pointer;
  text-align: left;
  gap: 12px;
}
.kc-question:hover { background: rgba(99,102,241,.05); }
.light .kc-question:hover { background: rgba(99,102,241,.04); }
.kc-q-text {
  font-size: 14px;
  color: var(--text);
  font-weight: 500;
  line-height: 1.5;
}
.kc-toggle {
  font-size: 11px;
  color: var(--muted);
  flex-shrink: 0;
  margin-top: 3px;
  transition: transform .2s ease;
}
.kc-item.open .kc-toggle { transform: rotate(180deg); }
.kc-answer {
  display: none;
  padding: 14px 16px;
  border-top: 1px solid var(--border);
  background: var(--bg);
  font-size: 14px;
  line-height: 1.65;
  color: var(--text);
}
.kc-item.open .kc-answer { display: block; }

/* ================================================================
   SUBTOPIC NAVIGATION
   ================================================================ */
.subtopic-nav {
  margin-top: 36px;
  padding: 14px 0 10px;
  border-top: 1px solid var(--border);
}

.subtopic-nav-label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--dim);
  margin-bottom: 8px;
}

.subtopic-nav-links {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.subtopic-nav-link {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 12px;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--border);
  text-decoration: none;
  transition: color .15s, border-color .15s;
}
.subtopic-nav-link:hover { color: var(--text); border-color: var(--accent); }
.subtopic-nav-link.active {
  color: var(--accent);
  border-color: var(--accent);
  background: rgba(99,102,241,.07);
  font-weight: 500;
  pointer-events: none;
}

/* Prev / Next */
.topic-nav-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
  gap: 8px;
}
.topic-nav-prev, .topic-nav-next {
  font-size: 13px;
  color: var(--accent2);
  text-decoration: none;
  transition: color .15s;
}
.topic-nav-prev:hover, .topic-nav-next:hover { color: var(--accent); }
.topic-nav-next { margin-left: auto; }

/* ================================================================
   CHEATSHEET
   ================================================================ */
.cheatsheet-section {
  margin-bottom: 28px;
}
.cheatsheet-section:last-child { margin-bottom: 0; }

.cheatsheet-section > h3 {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent);
  margin-bottom: 14px;
  padding-left: 10px;
  border-left: 3px solid var(--accent);
  padding-bottom: 0;
  border-bottom: none;
}

.cs-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 10px 0; }
.cs-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; margin: 10px 0; }

@media (max-width: 700px) {
  .cs-grid-2, .cs-grid-3 { grid-template-columns: 1fr; }
}

.cs-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px;
}

.cs-card-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--accent2);
  padding-bottom: 8px;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.cs-items { display: flex; flex-direction: column; gap: 5px; }
.cs-items span {
  font-size: 12.5px;
  color: var(--muted);
  padding-bottom: 5px;
  border-bottom: 1px solid var(--border);
  line-height: 1.5;
}
.cs-items span:last-child { border-bottom: none; padding-bottom: 0; }
.cs-items strong { color: var(--text); }

.cs-formula-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin: 10px 0;
}

@media (max-width: 700px) { .cs-formula-grid { grid-template-columns: 1fr; } }

.cs-formula-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-top: 3px solid var(--accent);
  border-radius: var(--radius-md);
  padding: 14px;
}

.cs-f-name {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--accent2);
  margin-bottom: 8px;
}

.cs-f-formula {
  font-family: 'Courier New', monospace;
  font-size: 13px;
  color: var(--accent3);
  background: var(--surface);
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
}

.cs-f-note {
  font-size: 12px;
  color: var(--dim);
  line-height: 1.5;
}

.cs-formula-compact { border: 1px solid var(--border); border-radius: var(--radius-md); overflow: hidden; margin: 10px 0; }
.cs-fc-row {
  display: grid;
  grid-template-columns: 220px 28px 1fr;
  align-items: baseline;
  padding: 9px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.cs-fc-row:last-child { border-bottom: none; }
.cs-fc-row:nth-child(odd) { background: var(--surface); }
.cs-fc-name { color: var(--text); font-weight: 500; }
.cs-fc-eq { color: var(--dim); }
.cs-fc-formula { font-family: 'Courier New', monospace; color: var(--accent3); }

/* ================================================================
   LIGHT MODE OVERRIDES
   ================================================================ */
.light .code-block { background: #18181b; border-color: #27272a; }
.light .code-block code { color: #fafafa; }
.light .diagram { background: #18181b; border-color: #27272a; }
.light .toc-header:hover { background: rgba(0,0,0,.04); }
.light .toc-sub:hover    { background: rgba(0,0,0,.03); }
.light tr:hover td       { background: rgba(0,0,0,.02); }

/* ================================================================
   RESPONSIVE
   ================================================================ */
@media (max-width: 768px) {
  :root { --sidebar-width: 220px; }
  #content-area { padding: 0 20px 64px; }
  .main-header  { padding: 12px 20px 0; }
}

@media (max-width: 600px) {
  .sidebar { width: 200px; }
  .main-content { padding: 0; }
  .topbar-breadcrumb { display: none; }
}
