/* ═══════════════════════════════════════════════════════════════
   Healthcare Modeling Notes — Styles
   RequestNotes | Finance › Sector Modeling › Healthcare Modeling
═══════════════════════════════════════════════════════════════ */

/* ── Color tokens: Dark (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,.4);
  --shadow-md:    0 4px 12px rgba(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;
}

/* ── Color tokens: 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,.06);
  --shadow-md:    0 4px 12px rgba(0,0,0,.08);
  --green-text:   #15803d;
  --amber-text:   #b45309;
  --coral-text:   #c2410c;
  --teal-text:    #0f766e;
}

/* ── Reset & base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; }
body {
  font-family: 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  transition: background-color .2s ease, color .2s ease;
}

/* ── 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: 200;
}
.topbar-inner {
  display: flex;
  align-items: center;
  height: 100%;
  padding: 0 20px;
  gap: 12px;
}
.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: var(--radius-sm);
  letter-spacing: .03em;
}
.topbar-logo-text {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}
.topbar-breadcrumb {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 1;
  overflow: hidden;
}
.topbar-bc-link {
  font-size: 12px;
  color: var(--muted);
  text-decoration: none;
  white-space: nowrap;
  transition: color .15s;
}
.topbar-bc-link:hover { color: var(--text); }
.topbar-bc-sep { font-size: 11px; color: var(--dim); }
.topbar-bc-current {
  font-size: 12px;
  color: var(--text);
  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;
  padding: 4px 8px;
  font-size: 12px;
  transition: color .15s, border-color .15s;
}
.topbar-theme-toggle: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;
  color: var(--accent2);
  text-decoration: none;
  white-space: nowrap;
  padding: 4px 10px;
  border: 1px solid var(--accent);
  border-radius: var(--radius-sm);
  transition: background .15s, color .15s;
}
.topbar-request:hover { background: var(--accent); color: #fff; }

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

/* ── Sidebar ── */
.sidebar {
  width: 260px;
  flex-shrink: 0;
  border-right: 1px solid var(--border);
  background: var(--surface);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  height: calc(100vh - var(--topbar-height));
}
.sidebar-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--dim);
  padding: 14px 16px 8px;
  border-bottom: 1px solid var(--border);
}
#toc-nav {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
}
#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 ── */
a.toc-header, a.toc-sub { text-decoration: none; color: inherit; display: flex; }
.toc-item { border-bottom: 1px solid var(--border); }
.toc-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  font-size: 13px;
  color: var(--muted);
  cursor: pointer;
  transition: color .15s, background .15s;
}
.toc-header:hover { color: var(--text); background: rgba(255,255,255,.03); }
.light .toc-header:hover { background: rgba(0,0,0,.03); }
.toc-header.active {
  color: var(--accent);
  background: rgba(99,102,241,.07);
  border-left: 2px solid var(--accent);
}
.toc-icon { font-size: 14px; flex-shrink: 0; width: 18px; text-align: center; }
.toc-label { flex: 1; font-weight: 500; }
.toc-chevron {
  font-size: 9px;
  color: var(--dim);
  transition: transform .2s ease;
  pointer-events: all;
}
.toc-item.open .toc-chevron { transform: rotate(90deg); }
.toc-subs { display: none; }
.toc-item.open .toc-subs { display: block; }
.toc-sub {
  display: block;
  padding: 6px 14px 6px 40px;
  font-size: 12px;
  color: var(--dim);
  text-decoration: none;
  transition: color .15s, background .15s;
}
.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; }

/* ── Sidebar footer / progress ── */
.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));
  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: 32px 48px 64px;
}

/* ── Content container ── */
.content-container { max-width: 860px; }

/* ── Typography ── */
.topic-title {
  font-size: 28px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.25;
  margin-bottom: 8px;
}
.topic-subtitle {
  font-size: 15px;
  color: var(--muted);
  margin-bottom: 20px;
  line-height: 1.5;
}
.section-title {
  font-size: 20px;
  font-weight: 600;
  color: var(--text);
  margin: 32px 0 12px;
}
.subsection-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  margin: 24px 0 10px;
}
.body-text {
  font-size: 14px;
  color: var(--muted);
  line-height: 1.75;
  margin-bottom: 14px;
}
.body-text strong { color: var(--text); font-weight: 600; }

/* ── Difficulty badge ── */
.difficulty-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 20px;
  margin-bottom: 20px;
  letter-spacing: .03em;
}
.difficulty-badge.beginner      { background: rgba(34,197,94,.12);  color: var(--green); border: 1px solid rgba(34,197,94,.3); }
.difficulty-badge.intermediate  { background: rgba(245,158,11,.12); color: var(--amber); border: 1px solid rgba(245,158,11,.3); }
.difficulty-badge.advanced      { background: rgba(249,115,22,.12); color: var(--coral); border: 1px solid rgba(249,115,22,.3); }
.difficulty-badge.expert        { background: rgba(239,68,68,.12);  color: #ef4444;      border: 1px solid rgba(239,68,68,.3); }

/* ── Stat grid ── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 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: 3px solid var(--accent);
}
.stat-value {
  font-size: 22px;
  font-weight: 700;
  color: var(--sv-color, var(--accent2));
  margin-bottom: 4px;
  line-height: 1.2;
}
.stat-label {
  font-size: 11px;
  color: var(--dim);
  text-transform: uppercase;
  letter-spacing: .05em;
}

/* ── Callout boxes ── */
.callout {
  border-left: 3px solid var(--accent);
  background: rgba(99,102,241,.06);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 12px 16px;
  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); }
.callout-title {
  font-weight: 700;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .05em;
  margin-bottom: 4px;
}

/* ── Formula block ── */
.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: .06em;
  color: var(--dim);
  margin-bottom: 8px;
}
.formula-body {
  color: var(--text);
  font-style: italic;
  font-weight: 500;
  line-height: 1.8;
}
.formula-vars {
  margin-top: 10px;
  font-style: normal;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.8;
}

/* ── Tables ── */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  margin: 16px 0;
}
.data-table th {
  text-align: left;
  padding: 8px 12px;
  background: var(--surface);
  color: var(--muted);
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .04em;
  border-bottom: 1px solid var(--border);
}
.data-table td {
  padding: 8px 12px;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  vertical-align: top;
  line-height: 1.6;
}
.data-table td strong { color: var(--text); }
tr:hover td { background: rgba(255,255,255,.02); }
.light tr:hover td { background: rgba(0,0,0,.02); }

/* ── Country tabs ── */
.country-tabs {
  margin: 20px 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
}
.country-tab-btns {
  display: flex;
  flex-wrap: wrap;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.country-tab-btn {
  padding: 8px 14px;
  font-size: 12px;
  color: var(--muted);
  background: transparent;
  border: none;
  border-right: 1px solid var(--border);
  cursor: pointer;
  transition: all .15s ease;
  white-space: nowrap;
}
.country-tab-btn:hover { color: var(--text); background: rgba(255,255,255,.03); }
.light .country-tab-btn:hover { background: rgba(0,0,0,.03); }
.country-tab-btn.active { color: var(--accent); border-bottom: 2px solid var(--accent); background: rgba(99,102,241,.06); }
.country-tab-panel { display: none; padding: 16px 20px; }
.country-tab-panel.active { display: block; }
.country-tab-panel p { font-size: 13px; color: var(--muted); line-height: 1.7; margin-bottom: 8px; }
.country-tab-panel ul { padding-left: 18px; }
.country-tab-panel li { font-size: 13px; color: var(--muted); line-height: 1.7; margin-bottom: 4px; }
.country-tab-panel strong { color: var(--text); }

/* ── Expandable blocks ── */
.expandable-block { border: 1px solid var(--border); border-radius: var(--radius-md); margin: 12px 0; overflow: hidden; }
.expandable-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;
  color: var(--text);
  font-weight: 500;
}
.expandable-toggle:hover { background: rgba(255,255,255,.03); }
.expandable-arrow { font-size: 11px; color: var(--dim); transition: transform .2s; }
.expandable-block.open .expandable-arrow { transform: rotate(90deg); }
.expandable-content { display: none; padding: 14px 16px; border-top: 1px solid var(--border); font-size: 14px; color: var(--muted); line-height: 1.7; }
.expandable-block.open .expandable-content { display: block; }

/* ── Subtopic nav strip ── */
.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;
}

/* ── Prev / Next footer ── */
.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; }

/* ── Quiz ── */
.topic-quick-check, .mini-quiz-section {
  margin-top: 40px;
  padding-top: 32px;
  border-top: 1px solid var(--border);
}
.topic-quick-check h3, .mini-quiz-section h3 { font-size: 18px; font-weight: 600; margin-bottom: 4px; }
.mini-quiz-block { margin-bottom: 32px; }
.mini-quiz-block h4 {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--muted);
  margin-bottom: 16px;
}
.quiz-question { margin-bottom: 20px; }
.quiz-q { font-size: 14px; font-weight: 500; color: var(--text); margin-bottom: 10px; line-height: 1.6; }
.quiz-options { display: flex; flex-direction: column; gap: 6px; }
.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: border-color .15s, color .15s;
}
.quiz-opt:hover { border-color: var(--accent2); color: var(--text); }
.quiz-opt.correct { background: rgba(34,197,94,.1); border-color: var(--green); color: var(--green); }
.quiz-opt.wrong   { background: rgba(239,68,68,.1);  border-color: #ef4444;     color: #ef4444; }
.quiz-question.answered .quiz-opt { pointer-events: none; }
.quiz-explain { display: none; margin-top: 10px; padding: 10px 14px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 13px; color: var(--muted); line-height: 1.65; }
.quiz-question.answered .quiz-explain { display: block; }

/* ── Knowledge check ── */
.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; }
.kc-answer strong { color: var(--text); }
.kc-answer p { margin-bottom: 8px; }

/* ── Cheatsheet ── */
.cheatsheet-section { margin-bottom: 32px; }
.cheatsheet-section h3 { font-size: 14px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--accent2); border-bottom: 1px solid var(--border); padding-bottom: 8px; margin-bottom: 12px; }
.cheat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 10px; }
.cheat-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 12px 14px; }
.cheat-term { font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 4px; }
.cheat-def  { font-size: 12px; color: var(--muted); line-height: 1.6; }
.cheat-formula { font-size: 12px; color: var(--accent3); font-style: italic; margin-top: 4px; }

/* ── Code block ── */
.code-block { background: #18181b; border: 1px solid #27272a; border-radius: var(--radius-md); margin: 16px 0; overflow: hidden; }
.light .code-block { background: #18181b; border-color: #27272a; }
.code-header { background: #111113; border-bottom: 1px solid #27272a; padding: 6px 14px; font-size: 11px; color: #71717a; }
.light .code-header { background: #111113; border-color: #27272a; }
.code-block code { display: block; padding: 16px; font-size: 13px; color: #fafafa; font-family: 'Cascadia Code', 'Fira Code', monospace; line-height: 1.7; overflow-x: auto; white-space: pre; }
.light .code-block code { color: #fafafa; }

/* ── Misc helpers ── */
.tag-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 20px;
  margin-right: 4px;
}
.tag-pharma   { background: rgba(99,102,241,.12); color: var(--accent2); border: 1px solid rgba(99,102,241,.3); }
.tag-hospital { background: rgba(249,115,22,.12); color: var(--coral);   border: 1px solid rgba(249,115,22,.3); }
.tag-insurance{ background: rgba(20,184,166,.12); color: var(--teal);    border: 1px solid rgba(20,184,166,.3); }
.tag-device   { background: rgba(34,197,94,.12);  color: var(--green);   border: 1px solid rgba(34,197,94,.3); }
.tag-biotech  { background: rgba(245,158,11,.12); color: var(--amber);   border: 1px solid rgba(245,158,11,.3); }

.highlight-box {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  margin: 16px 0;
}
.highlight-box h4 { font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 8px; }
.highlight-box p  { font-size: 13px; color: var(--muted); line-height: 1.7; margin-bottom: 6px; }
.highlight-box ul { padding-left: 18px; }
.highlight-box li { font-size: 13px; color: var(--muted); line-height: 1.7; margin-bottom: 4px; }

.kc-section   { padding-bottom: 16px; }
.quiz-section { padding-bottom: 16px; }

/* ══════════════════════════════════════════════════════════════
   MOBILE RESPONSIVE (≤ 767px)
══════════════════════════════════════════════════════════════ */
@media (max-width: 767px) {
  .mobile-nav-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    position: fixed;
    top: calc(var(--topbar-height) + 8px);
    right: 0;
    z-index: 150;
    width: 42px;
    height: 42px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-right: none;
    border-radius: 20px 0 0 20px;
    cursor: pointer;
    color: var(--accent);
    padding: 0;
  }
  .mobile-nav-icon { width: 20px; height: 20px; }
  .mobile-nav-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.5);
    z-index: 149;
  }
  .mobile-nav-overlay.visible { display: block; }
  .sidebar {
    position: fixed;
    top: var(--topbar-height);
    left: -260px;
    height: calc(100vh - var(--topbar-height));
    z-index: 160;
    transition: left .25s ease;
    box-shadow: 4px 0 20px rgba(0,0,0,.4);
  }
  .sidebar.mobile-open { left: 0; }
  .app-layout { flex-direction: column; }
  .main-content { height: auto; overflow-y: visible; }
  #content-area { padding: 20px 20px 48px; }
  .main-header { padding: 12px 20px 0; }
  .topic-title { font-size: 22px; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .data-table { font-size: 12px; }
  .data-table th, .data-table td { padding: 6px 8px; }
  .country-tab-btn { padding: 6px 10px; font-size: 11px; }
  .topic-nav-prev, .topic-nav-next {
    display: block;
    width: 100%;
    padding: 14px 16px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    text-align: center;
    font-size: 14px;
    color: var(--accent2);
    min-height: 44px;
  }
  .topic-nav-next { margin-left: 0; }
  .topbar-breadcrumb { display: none; }
}

/* ── Mobile toggle hidden on desktop ── */
@media (min-width: 768px) {
  .mobile-nav-toggle { display: none; }
  .mobile-nav-overlay { display: none !important; }
}
