/* ════════════════════════════════════════════════════════════
   ESG Investing Notes — Styles
   RequestNotes Design System: Modern SaaS Adaptive Theme
════════════════════════════════════════════════════════════ */

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

/* ── CSS Variables — Dark Mode (Default) ── */
:root {
  --bg:           #09090b;
  --surface:      #111113;
  --card:         #18181b;
  --border:       #27272a;
  --border-light: #3f3f46;
  --text:         #fafafa;
  --muted:        #a1a1aa;
  --dim:          #52525b;
  --shadow:       0 1px 3px rgba(0,0,0,0.4);
  --shadow-md:    0 4px 12px rgba(0,0,0,0.5);

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

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

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

  --topbar-height: 40px;

  font-family: 'Segoe UI', system-ui, -apple-system, 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;
  --teal-text:    #0f766e;
}

/* ── Base ── */
html { scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.65;
  transition: background-color 0.2s ease, color 0.2s ease;
  -webkit-font-smoothing: antialiased;
}

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

/* ────────────────────────────────────────────────────────────
   TOPBAR
──────────────────────────────────────────────────────────── */
.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;
  display: flex;
  align-items: center;
  padding: 0 16px;
  gap: 12px;
  max-width: 100%;
}

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

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

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

.topbar-breadcrumb {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--dim);
  flex: 1;
  overflow: hidden;
}

.brand-link {
  color: var(--muted);
  text-decoration: none;
  white-space: nowrap;
}
.brand-link:hover { color: var(--text); }

.brand-sep { color: var(--dim); }

.brand-current {
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.theme-toggle-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--muted);
  cursor: pointer;
  padding: 4px 8px;
  font-size: 13px;
  display: flex;
  align-items: center;
  transition: color .15s, border-color .15s;
}
.theme-toggle-btn:hover { color: var(--text); border-color: var(--border-light); }

.icon-light { display: none; }
.icon-dark  { display: inline; }
.light .icon-dark  { display: none; }
.light .icon-light { display: inline; }

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

.topbar-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.topbar-hamburger {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  flex-direction: column;
  gap: 4px;
  flex-shrink: 0;
}
.topbar-hamburger span {
  display: block;
  width: 18px;
  height: 2px;
  background: var(--muted);
  border-radius: 2px;
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 49;
}
.sidebar-overlay.active { display: block; }

.sidebar-header {
  padding: 12px 14px 10px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.sidebar-title {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .05em;
  color: var(--text);
  margin-bottom: 8px;
}

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

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

.sidebar-label {
  padding: 12px 14px 8px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--dim);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

#sn-toc {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
}
#sn-toc::-webkit-scrollbar { width: 3px; }
#sn-toc::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 2px; }
#sn-toc::-webkit-scrollbar-track { background: transparent; }

/* Sidebar TOC items */
.toc-item {
  border-bottom: 1px solid var(--border);
}

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

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

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

.toc-subs {
  display: none;
  background: var(--bg);
  padding: 2px 0;
}
.toc-item.open .toc-subs { display: block; }

.toc-sub {
  display: block;
  padding: 6px 12px 6px 36px;
  font-size: 12px;
  color: var(--dim);
  text-decoration: none;
  transition: color .15s, background .15s;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.toc-sub:hover { color: var(--muted); background: rgba(255,255,255,.02); }
.light .toc-sub:hover { background: rgba(0,0,0,.02); }
.toc-sub.active { color: var(--accent2); font-weight: 500; background: rgba(99,102,241,.05); }

/* Progress Footer */
.sidebar-progress-wrap {
  padding: 10px 14px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}
.sidebar-progress-label {
  font-size: 11px;
  color: var(--dim);
  margin-bottom: 5px;
}
.sidebar-progress-bar {
  height: 2px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
}
.sidebar-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));
  padding: 0;
}

.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: 24px 48px 80px;
}

/* ────────────────────────────────────────────────────────────
   CONTENT TYPOGRAPHY
──────────────────────────────────────────────────────────── */
.content-container h1 {
  font-size: 28px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
  line-height: 1.3;
}
.content-container h2 {
  font-size: 22px;
  font-weight: 600;
  color: var(--text);
  margin-top: 36px;
  margin-bottom: 12px;
  line-height: 1.4;
}
.content-container h3 {
  font-size: 17px;
  font-weight: 600;
  color: var(--text);
  margin-top: 28px;
  margin-bottom: 10px;
}
.content-container h4 {
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
  margin-top: 20px;
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.body-text {
  font-size: 15px;
  color: var(--muted);
  line-height: 1.75;
  margin-bottom: 16px;
}

.content-container ul, .content-container ol {
  padding-left: 20px;
  margin-bottom: 16px;
}
.content-container li {
  font-size: 15px;
  color: var(--muted);
  line-height: 1.75;
  margin-bottom: 6px;
}
.content-container strong { color: var(--text); font-weight: 600; }
.content-container em { color: var(--accent3); font-style: italic; }

/* Difficulty badge */
.difficulty-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .05em;
  padding: 3px 10px;
  border-radius: 20px;
  margin-bottom: 20px;
  border: 1px solid;
}
.difficulty-badge.beginner   { color: #22c55e; border-color: rgba(34,197,94,.3); background: rgba(34,197,94,.08); }
.difficulty-badge.intermediate { color: #f59e0b; border-color: rgba(245,158,11,.3); background: rgba(245,158,11,.08); }
.difficulty-badge.advanced   { color: #f97316; border-color: rgba(249,115,22,.3); background: rgba(249,115,22,.08); }
.difficulty-badge.expert     { color: #f43f5e; border-color: rgba(244,63,94,.3);  background: rgba(244,63,94,.08); }

/* ────────────────────────────────────────────────────────────
   STAT CARDS
──────────────────────────────────────────────────────────── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin: 20px 0 28px;
}
.stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  border-top: 3px solid var(--accent);
}
.stat-value {
  font-size: 22px;
  font-weight: 700;
  color: var(--sv-color, var(--accent2));
  line-height: 1.2;
  margin-bottom: 4px;
}
.stat-label {
  font-size: 11px;
  color: var(--dim);
  line-height: 1.4;
}

/* ────────────────────────────────────────────────────────────
   CALLOUT BOXES
──────────────────────────────────────────────────────────── */
.callout {
  border-radius: var(--radius-md);
  padding: 14px 18px;
  margin: 20px 0;
  font-size: 14px;
  line-height: 1.65;
  border: 1px solid;
}
.callout-title {
  font-weight: 700;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-bottom: 6px;
}
.callout.info    { background: rgba(99,102,241,.07); border-color: rgba(99,102,241,.3); color: var(--muted); }
.callout.info .callout-title { color: var(--accent2); }
.callout.green   { background: rgba(34,197,94,.07);  border-color: rgba(34,197,94,.3);  color: var(--muted); }
.callout.green .callout-title { color: var(--green); }
.callout.amber   { background: rgba(245,158,11,.07); border-color: rgba(245,158,11,.3); color: var(--muted); }
.callout.amber .callout-title { color: var(--amber); }
.callout.red     { background: rgba(249,115,22,.07); border-color: rgba(249,115,22,.3); color: var(--muted); }
.callout.red .callout-title   { color: var(--coral); }
.callout.teal    { background: rgba(20,184,166,.07); border-color: rgba(20,184,166,.3); color: var(--muted); }
.callout.teal .callout-title  { color: var(--teal); }

/* ────────────────────────────────────────────────────────────
   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: 20px 0;
  font-size: 15px;
}
.formula-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--dim);
  margin-bottom: 8px;
  font-weight: 600;
}
.formula-body {
  color: var(--text);
  font-style: italic;
  font-size: 16px;
  font-weight: 500;
}
.formula-vars {
  margin-top: 10px;
  font-size: 13px;
  color: var(--muted);
  font-style: normal;
}
.formula-vars li { margin-bottom: 4px; }

/* ────────────────────────────────────────────────────────────
   TABLES
──────────────────────────────────────────────────────────── */
.table-wrapper {
  overflow-x: auto;
  margin: 20px 0;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}
thead tr {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
th {
  padding: 10px 14px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--dim);
  white-space: nowrap;
}
td {
  padding: 10px 14px;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  vertical-align: top;
  line-height: 1.55;
}
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); }

/* ────────────────────────────────────────────────────────────
   TABS
──────────────────────────────────────────────────────────── */
.tab-bar {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
  overflow-x: auto;
}
.tab-btn {
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 500;
  color: var(--dim);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  transition: color .15s, border-color .15s;
}
.tab-btn:hover { color: var(--muted); }
.tab-btn.active { color: var(--accent2); border-bottom-color: var(--accent); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ────────────────────────────────────────────────────────────
   EXPANDABLE BLOCKS
──────────────────────────────────────────────────────────── */
.expand-block {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin: 12px 0;
  overflow: hidden;
}
.expand-toggle {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: var(--surface);
  border: none;
  cursor: pointer;
  text-align: left;
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  transition: background .15s;
}
.expand-toggle:hover { background: var(--card); }
.expand-arrow { font-size: 10px; color: var(--dim); transition: transform .2s; }
.expand-block.open .expand-arrow { transform: rotate(90deg); }
.expand-content {
  display: none;
  padding: 14px 16px;
  font-size: 14px;
  color: var(--muted);
  line-height: 1.7;
  border-top: 1px solid var(--border);
}
.expand-block.open .expand-content { display: block; }

/* ────────────────────────────────────────────────────────────
   COMPARISON / HIGHLIGHT CARDS
──────────────────────────────────────────────────────────── */
.highlight-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  margin: 20px 0;
}
.highlight-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
}
.highlight-card-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 8px;
}
.highlight-card-body {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.6;
}

/* Country tab pattern */
.country-tabs { margin: 20px 0; }
.country-tab-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 14px;
}
.country-tab-btn {
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 500;
  color: var(--dim);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  cursor: pointer;
  transition: all .15s;
}
.country-tab-btn:hover { color: var(--muted); border-color: var(--border-light); }
.country-tab-btn.active { color: var(--teal); border-color: var(--teal); background: rgba(20,184,166,.08); }
.country-panel { display: none; }
.country-panel.active { display: block; }

/* ────────────────────────────────────────────────────────────
   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; }

/* Quiz questions */
.quiz-question {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 14px;
}
.quiz-q {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 12px;
  line-height: 1.6;
}
.quiz-options {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
}
.quiz-opt {
  text-align: left;
  padding: 8px 12px;
  font-size: 13px;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all .15s;
  line-height: 1.5;
}
.quiz-opt:hover:not(:disabled) { border-color: var(--accent); color: var(--text); }
.quiz-opt.correct { border-color: var(--green); background: rgba(34,197,94,.1); color: var(--green); }
.quiz-opt.wrong   { border-color: var(--coral); background: rgba(249,115,22,.1); color: var(--coral); }
.quiz-opt:disabled { cursor: not-allowed; }

.quiz-explain {
  display: none;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.65;
  padding: 12px;
  background: var(--surface);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}
.quiz-question.answered .quiz-explain { display: block; }

/* Knowledge Check Items */
.kc-section  { padding-bottom: 16px; }
.quiz-section { padding-bottom: 16px; }
.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(--muted);
}
.kc-item.open .kc-answer { display: block; }

/* ────────────────────────────────────────────────────────────
   SUBTOPIC NAV & PREV/NEXT
──────────────────────────────────────────────────────────── */
.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;
  cursor: pointer;
}
.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;
}

.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: 40px;
}
.cheatsheet-section h2 {
  font-size: 16px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--dim);
  border-bottom: 1px solid var(--border);
  padding-bottom: 8px;
  margin-bottom: 16px;
}

/* Formula cards */
.cs-formula-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}
.cs-formula-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-top: 3px solid var(--accent);
  border-radius: var(--radius-md);
  padding: 14px 16px;
}
.cs-f-name {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--accent2);
  margin-bottom: 6px;
}
.cs-f-formula {
  font-size: 14px;
  font-style: italic;
  color: var(--text);
  margin-bottom: 8px;
  font-weight: 500;
}
.cs-f-vars {
  font-size: 12px;
  color: var(--dim);
  line-height: 1.6;
}

/* Reference grid cards */
.cs-grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}
.cs-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}
.cs-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px;
}
.cs-card-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
  margin-bottom: 10px;
}
.cs-items {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.cs-items span {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
}
.cs-items span strong { color: var(--text); font-weight: 600; }

/* ────────────────────────────────────────────────────────────
   LIGHT MODE COMPONENT OVERRIDES
──────────────────────────────────────────────────────────── */
.light .code-block              { background: #18181b; border-color: #27272a; }
.light .code-block code         { color: #fafafa; }
.light .formula-block           { background: var(--surface); }
.light .quiz-opt                { background: var(--surface); }
.light .expand-toggle           { background: var(--surface); }
.light .kc-question             { background: var(--surface); }
.light .stat-card               { background: var(--card); }
.light .highlight-card          { background: var(--card); }
.light .cs-formula-card         { background: var(--card); }
.light .cs-card                 { background: var(--card); }

/* ────────────────────────────────────────────────────────────
   MOBILE RESPONSIVE (≤ 767px)
──────────────────────────────────────────────────────────── */
.mobile-nav-toggle { display: none; }

@media (max-width: 767px) {
  .topbar-hamburger { display: flex; }
  .app-layout {
    display: block;
    overflow: visible;
  }
  .main-content {
    height: auto;
    overflow-y: visible;
    padding: 0;
  }
  .sidebar {
    position: fixed;
    top: var(--topbar-height);
    left: 0;
    bottom: 0;
    width: 280px;
    height: calc(100vh - var(--topbar-height));
    z-index: 200;
    transform: translateX(-100%);
    transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 4px 0 24px rgba(0,0,0,0.4);
  }
  .sidebar.mobile-open { transform: translateX(0); }

  .sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    top: var(--topbar-height);
    background: rgba(0,0,0,0.6);
    z-index: 199;
    opacity: 0;
    transition: opacity 0.28s ease;
  }
  .sidebar-overlay.active { display: block; opacity: 1; }

  .mobile-nav-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    position: fixed;
    top: calc(var(--topbar-height) + 12px);
    right: 0;
    z-index: 198;
    width: 44px;
    height: 44px;
    padding: 0 0 0 6px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-right: none;
    border-radius: 22px 0 0 22px;
    color: #6366f1;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    box-shadow: -2px 2px 8px rgba(0,0,0,0.25);
  }
  .mobile-nav-toggle:hover,
  .mobile-nav-toggle:focus-visible {
    background: var(--card);
    color: #6366f1;
    outline: none;
  }
  .mobile-nav-toggle[aria-expanded="true"] {
    color: var(--accent);
    border-color: var(--accent);
  }
  .mobile-nav-icon { width: 18px; height: 18px; flex-shrink: 0; }
  .light .mobile-nav-toggle { box-shadow: -2px 2px 8px rgba(0,0,0,0.1); }

  .topbar-breadcrumb { display: none; }

  .main-header { padding: 12px 18px 0; }
  #content-area { padding: 0 18px 80px; max-width: 100%; }

  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .cs-grid-2 { grid-template-columns: 1fr; }
  .cs-grid-3 { grid-template-columns: repeat(2, 1fr); }
  .cs-formula-grid { grid-template-columns: 1fr; }
  .highlight-grid { grid-template-columns: 1fr; }

  .topic-nav-footer {
    flex-direction: column;
    gap: 10px;
    margin-top: 28px;
    padding-top: 20px;
  }
  .topic-nav-prev,
  .topic-nav-next {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 48px;
    padding: 12px 16px;
    font-size: 14px;
    font-weight: 500;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    color: var(--accent2);
    text-align: center;
    margin-left: 0;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
  }
  .topic-nav-prev:hover, .topic-nav-next:hover {
    background: var(--card);
    border-color: var(--accent);
    color: var(--accent);
  }

  .subtopic-nav-links { gap: 6px; }
  .subtopic-nav-link { font-size: 12px; padding: 5px 10px; }

  .table-wrapper {
    margin: 14px -18px;
    border-radius: 0;
    border-left: none;
    border-right: none;
  }

  .content-container h2 { font-size: 20px; }
  .content-container h3 { font-size: 15px; }
  .content-container h1 { font-size: 24px; }
}
