/* ============================================================
   CRITCARE.IN — SHARED STYLESHEET
   This one file controls the look of EVERY page.
   ============================================================
   ▶ TO CHANGE THE WHOLE THEME: edit the color values
     in the :root block below. Every page updates at once.
   ============================================================ */

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

:root {
  --blue:       #1d5fc4;
  --blue-dark:  #164a9e;
  --blue-soft:  #eef4fd;
  --ink:        #17212f;
  --slate:      #586878;
  --line:       #e5e9ef;
  --bg:         #ffffff;
  --bg-alt:     #f6f8fb;
  --accent:     #0a9d90;
  --white:      #ffffff;
  --font-body: 'Inter', -apple-system, system-ui, sans-serif;
  --font-disp: 'Fraunces', Georgia, serif;
  --dm-transition: background 0.25s ease, color 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}

/* ============================================================
   DARK MODE
   ============================================================ */
html.dark {
  --blue:       #5aa2f5;
  --blue-dark:  #86bcf8;
  --blue-soft:  #0f1d30;
  --ink:        #e9ebef;
  --slate:      #9aa1ac;
  --line:       #262a30;
  --bg:         #0a0b0d;
  --bg-alt:     #131519;
  --accent:     #22c9b8;
  --white:      #131519;
}
html.dark body { background: var(--bg); color: var(--ink); }
html.dark .nav { background: rgba(10,11,13,0.9); border-color: var(--line); }
html.dark .nav-menu { background: #0d0d0f; }
html.dark .hero-photo-card,
html.dark .about-photo-card,
html.dark .demo-card,
html.dark .card,
html.dark .tcard,
html.dark .login-form-panel,
html.dark .login-box { background: var(--bg-alt); border-color: var(--line); color: var(--ink); }
html.dark .card:hover, html.dark .tcard:hover { border-color: var(--blue); }
html.dark .login-brand-panel { background: #0a0a0c; }
html.dark .toc,
html.dark .stats,
html.dark .stat { background: var(--bg-alt); border-color: var(--line); }
html.dark .hero, html.dark .topic-hero, html.dark .page-head { background: linear-gradient(180deg, #14161b 0%, #0a0b0d 100%); }
html.dark .ai-banner { background: linear-gradient(120deg, #0a0a0c 0%, #101218 100%); }
html.dark .drug-table th { background: #16171a; }
html.dark .drug-table tr:hover td { background: #121214; }
html.dark .drug-table td { border-color: var(--line); color: var(--slate); }
html.dark .key-box { background: #101620; border-color: var(--blue); }
html.dark .key-box p, html.dark .key-box li { color: var(--ink); }
html.dark .warn-box { background: #2a1e0a; border-color: #f59e0b; }
html.dark .warn-box p, html.dark .warn-box li { color: #fcd34d; }
html.dark .india-box { background: #2a1e0a; border-color: #f59e0b; }
html.dark .india-box p, html.dark .india-box li { color: #fcd34d; }
html.dark .update-box { background: #0a2a1e; border-color: #22c55e; }
html.dark .update-box p, html.dark .update-box li { color: #86efac; }
html.dark .pearl-card { background: #2a200a; border-color: #854d0e; }
html.dark .pearl-card p { color: #fcd34d; }
html.dark .mistake-card { background: #2a0a0a; border-color: #7f1d1d; }
html.dark .mistake-card p { color: #fca5a5; }
html.dark .exam-card { background: #0a1420; border-color: #1e3a8a; }
html.dark .exam-card p { color: #93c5fd; }
html.dark .dose-calc { background: #16171a; }
html.dark .ampoule-card { background: #0d0d0f; border-color: var(--line); }
html.dark .demo-top { background: #16171a; }
html.dark .demo-input { background: var(--bg-alt); color: var(--ink); border-color: var(--line); }
html.dark .demo-input:focus { border-color: var(--blue); }
html.dark .demo-out { background: var(--blue-soft); }
html.dark .disclaimer { background: #2a1e0a; border-color: #854d0e; color: #fcd34d; }
html.dark .fg input, html.dark .fg select { background: var(--bg-alt); color: var(--ink); border-color: var(--line); }
html.dark .lb-tabs { background: #0d0d0f; }
html.dark .lb-tab.active { background: #16171a; }
html.dark .lb-note { background: var(--blue-soft); color: var(--blue); }
html.dark .photo-meta, html.dark .about-photo-meta { background: var(--bg-alt); border-color: var(--line); }
html.dark .photo-meta-name, html.dark .about-photo-meta .nm { color: var(--ink); }
html.dark .ref-list li { border-color: var(--line); color: var(--slate); }
html.dark .section-label { border-color: var(--line); color: var(--slate); }
html.dark .ex-btn { background: var(--bg-alt); border-color: var(--line); color: var(--slate); }
html.dark .table-wrap { border-color: var(--line); }
html.dark .about-contact-mini .acm { background: var(--bg-alt); border-color: var(--line); color: var(--slate); }
html.dark .tl-item { border-color: var(--line); }
html.dark h1.display, html.dark h2.display { color: var(--ink); }
html.dark .topic-content h2 { border-color: var(--blue-soft); }
html.dark .dim { opacity: 0.5; }
html.dark .gbadge.sccm  { background: #0d1b2e; color: #7bb8f7; }
html.dark .gbadge.esicm { background: #1a1430; color: #c4b5fd; }
html.dark .gbadge.isccm { background: #2a1e0a; color: #fcd34d; }
html.dark .gbadge.kdigo { background: #0a2a1e; color: #86efac; }
html.dark .change-new { background: #0a2a1e; border-color: #166534; color: #86efac; }
html.dark .change-updated { background: #2a1e0a; border-color: #854d0e; color: #fcd34d; }
html.dark .change-reversed { background: #2a0a1e; border-color: #9d174d; color: #f9a8d4; }

/* ============================================================
   DARK MODE — topic & drug-page callout components
   (higher specificity than per-page .class rules, so these
    win over the light definitions in each page's <style>)
   ============================================================ */
/* Marino (purple) box */
html.dark .marino-box { background: #141019; border-color: #3b2a5a; }
html.dark .marino-box .mb-label { color: #c4b5fd; }
html.dark .marino-box p, html.dark .marino-box ul { color: #d8cef0; }
html.dark .marino-box strong { color: #ddd6fe; }
/* EM / Tintinalli pearl (rose) box */
html.dark .em-box { background: #1a0e12; border-color: #5a2a39; }
html.dark .em-box .mb-label { color: #fda4af; }
html.dark .em-box p, html.dark .em-box ul { color: #f0c6cf; }
html.dark .em-box strong { color: #fecdd3; }
/* Mistake card */
html.dark .mc { background: #1a0a0a; border-color: #7f1d1d; }
html.dark .mc .ml { color: #fca5a5; }
html.dark .mc p { color: #eeb4b4; }
/* guideline-rec */
html.dark .guideline-rec { background: var(--bg-alt); border-color: var(--line); }
html.dark .guideline-rec .gr-text { color: var(--ink); }
html.dark .gr-s { background: #0a2418; color: #86efac; }
html.dark .gr-c { background: #241d06; color: #fde047; }
/* book-quote */
html.dark .book-quote { background: var(--bg-alt); border-color: var(--blue); }
html.dark .book-quote p { color: var(--slate); }
html.dark .book-quote cite { color: var(--blue); }
/* info box .ec (some pages use inline styles → !important to override) */
html.dark .ec { background: #0d1b2e !important; border-color: #1e3a5f !important; }
html.dark .ec p { color: #bcd6f5 !important; }
html.dark .ec strong { color: #dbeafe !important; }
/* compare cards */
html.dark .compare-card { background: var(--bg-alt); border-color: var(--line); }
html.dark .compare-card ul { color: var(--slate); }
html.dark .compare-card li strong, html.dark .compare-card h4 { color: var(--ink); }
/* critical (red) box */
html.dark .crit-box { background: #1a0a0a; border-color: #7f1d1d; }
html.dark .crit-box h4, html.dark .crit-box .big { color: #fca5a5; }
html.dark .crit-box p { color: #eeb4b4; }
/* cold (blue) box */
html.dark .cold-box { background: #0a1626; border-color: #3b82f6; }
html.dark .cold-box h4 { color: #93c5fd; }
html.dark .cold-box p { color: #bcd6f5; }
/* PE risk-stratification cards */
html.dark .risk-high { background: #1a0a0a; border-color: #7f1d1d; }
html.dark .risk-int  { background: #241d06; border-color: #854d0e; }
html.dark .risk-low  { background: #0a2418; border-color: #15803d; }
html.dark .risk-high h4, html.dark .risk-high p { color: #fca5a5; }
html.dark .risk-int h4,  html.dark .risk-int p  { color: #fde047; }
html.dark .risk-low h4,  html.dark .risk-low p  { color: #86efac; }
/* example box (green) */
html.dark .example-box { background: #0a1f15; border-color: #15803d; }
html.dark .example-box .el { color: #86efac; }
html.dark .example-box p { color: #bfe6cf; }
html.dark .example-box strong { color: #86efac; }
/* generic card grids in topics */
html.dark .dose-card, html.dark .stage-card, html.dark .dis-card,
html.dark .target-card, html.dark .thresh-card { background: var(--bg-alt); border-color: var(--line); }
html.dark .dose-card .dv, html.dark .dis-card h4, html.dark .stage-card h5 { color: var(--ink); }
html.dark .dis-card ul, html.dark .stage-card p, html.dark .dose-card .dn { color: var(--slate); }
/* ABCDE rows (trauma) */
html.dark .abcde .row { border-color: var(--line); }
html.dark .abcde .ac h4, html.dark .abcde .ac strong { color: var(--ink); }
html.dark .abcde .ac p { color: var(--slate); }
/* step-flow (acid-base) */
html.dark .step-flow .sf { border-color: var(--line); }
html.dark .step-flow .sfc h4 { color: var(--ink); }
html.dark .step-flow .sfc p { color: var(--slate); }
html.dark .step-flow .sfc code { background: var(--bg-alt); color: var(--blue-dark); }
/* section-header source badges (sb-*) — darken light pills */
html.dark .sb-w { background: #0d1b2e; color: #93c5fd; }
html.dark .sb-m { background: #141019; color: #c4b5fd; }
html.dark .sb-g, html.dark .sb-f { background: #0a2418; color: #86efac; }
html.dark .sb-d { background: #241606; color: #fdba74; }
html.dark .sb-e { background: #1a0a0a; color: #fca5a5; }
html.dark .sb-x { background: #241d06; color: #fde047; }
html.dark .sb-r { background: var(--bg-alt); color: var(--slate); border-color: var(--line); }
html.dark .sb-extra { background: #240a1a; color: #f9a8d4; }
/* delta/severity badges that are light */
html.dark .gbadge.who { background: #16171a; color: #cbd0d6; }
html.dark .gbadge.apasl { background: #1a1430; color: #c4b5fd; }

/* ============================================================
   DARK MODE — drug reference page
   ============================================================ */
html.dark .drug-card { background: var(--bg-alt); border-color: var(--line); }
html.dark .drug-card.open { border-color: var(--accent); }
html.dark .dc-name, html.dark .dc-key { color: var(--ink); }
html.dark .dc-brand { color: var(--slate); }
html.dark .dc-body, html.dark .dsect { border-color: var(--line); }
html.dark .ctab th { background: #16171a; color: var(--slate); border-color: var(--line); }
html.dark .ctab td { border-color: var(--line); }
html.dark .c-hi { color: var(--ink); }
html.dark .corr-box, html.dark .dil-box { background: var(--bg-alt); }
html.dark .corr-row, html.dark .dil-row, html.dark .prep-step { border-color: var(--line); }
html.dark .corr-delta, html.dark .dil-r { color: var(--ink); }
html.dark .calc-box { background: var(--bg-alt); border-color: var(--accent); }
html.dark .ci-field input, html.dark .ci-field select { background: #000; color: var(--ink); border-color: var(--line); }
html.dark .ci-out { background: #000; border-color: var(--line); }
html.dark .ci-out strong { color: var(--ink); }
html.dark .v-body { background: rgba(255,255,255,.04); }
html.dark .cat-pill { background: var(--bg-alt); color: var(--slate); border-color: var(--line); }
html.dark .dp-search { background: var(--bg-alt); color: var(--ink); border-color: var(--line); }
/* drug-page side-effect chips & note boxes */
html.dark .se-r { background: #2a0d0d; color: #fca5a5; }
html.dark .se-a { background: #241606; color: #fdba74; }
html.dark .se-b { background: #0d1b2e; color: #93c5fd; }
html.dark .d-amber { background: #241d06; border-color: #854d0e; color: #fde047; }
html.dark .d-red { background: #2a0d0d; border-color: #7f1d1d; color: #fca5a5; }
html.dark .d-blue { background: #0d1b2e; border-color: #1e3a5f; color: #93c5fd; }
html.dark .d-green { background: #0a2418; border-color: #15803d; color: #86efac; }
/* spec chips on topics page */
html.dark .spec-chip.ccm { background: #0d1b2e; color: #93c5fd; }
html.dark .spec-chip.em { background: #2a0d0d; color: #fca5a5; }
html.dark .spec-chip.both { background: #1a1430; color: #c4b5fd; }
html.dark .spec-pill { background: var(--bg-alt); color: var(--ink); border-color: var(--line); }
html.dark .sec-intro { background: var(--bg-alt); border-color: var(--blue); color: var(--slate); }

/* ".mb" purple Marino box (older topic pages: acs, asthma, copd, aki, ards, mech-vent, sedation) */
html.dark .mb { background: #141019; border-color: #3b2a5a; }
html.dark .mb .ml { color: #c4b5fd; }
html.dark .mb p, html.dark .mb ul { color: #d8cef0; }
html.dark .mb strong { color: #ddd6fe; }
/* severity cards (GI) */
html.dark .sev-mild { background: #0a2418; border-color: #15803d; }
html.dark .sev-mod  { background: #241d06; border-color: #854d0e; }
html.dark .sev-sev  { background: #1a0a0a; border-color: #7f1d1d; }
html.dark .sev-mild h4 { color: #86efac; }
html.dark .sev-mod h4  { color: #fde047; }
html.dark .sev-sev h4  { color: #fca5a5; }
/* post-cardiac-arrest cards (ROSC) */
html.dark .pcas-brain { background: #0d1b2e; border-color: #1e3a5f; }
html.dark .pcas-heart { background: #1a0a0a; border-color: #7f1d1d; }
html.dark .pcas-sys   { background: #241d06; border-color: #854d0e; }
html.dark .pcas-cause { background: #0a2418; border-color: #15803d; }
html.dark .pcas-brain h4 { color: #93c5fd; }
html.dark .pcas-heart h4 { color: #fca5a5; }
html.dark .pcas-sys h4   { color: #fde047; }
html.dark .pcas-cause h4 { color: #86efac; }
/* small inline tag chips — darken light pills */
html.dark .cn { background: #0a2418; border-color: #15803d; color: #86efac; }
html.dark .cu, html.dark .gc { background: #241d06; border-color: #854d0e; color: #fde047; }
html.dark .cr { background: #240a1a; border-color: #9d174d; color: #f9a8d4; }
html.dark .trial-badge { background: #241d06; color: #fde047; }

/* Site chrome that uses background:var(--ink) (which inverts in dark) — keep dark */
html.dark .footer { background: #0a0a0c; border-top: 1px solid var(--line); }
html.dark .guidelines-strip { background: #141518; }
html.dark .footer-brand { color: #f2f2f3; }

/* ============================================================
   ACCESS GATE (client-side soft paywall)
   ============================================================ */
html.cc-locked, html.cc-locked body { overflow: hidden; }
.cc-gate {
  position: fixed; left: 0; right: 0; top: 66px; bottom: 0; z-index: 95;
  display: flex; align-items: flex-start; justify-content: center;
  padding: clamp(1.5rem, 8vh, 5rem) 1rem; overflow-y: auto;
  background: rgba(255,255,255,0.55);
  backdrop-filter: blur(9px); -webkit-backdrop-filter: blur(9px);
}
html.dark .cc-gate { background: rgba(0,0,0,0.62); }
.cc-gate-card {
  max-width: 460px; width: 100%; background: var(--bg);
  border: 1px solid var(--line); border-radius: 18px;
  padding: 2.2rem 1.8rem; text-align: center;
  box-shadow: 0 24px 70px rgba(0,0,0,0.22);
}
.cc-gate-lock { font-size: 2.4rem; margin-bottom: 0.4rem; }
.cc-gate-card h2 { font-family: var(--font-disp); font-size: 1.5rem; color: var(--ink); margin-bottom: 0.6rem; }
.cc-gate-card p { color: var(--slate); font-size: 0.92rem; line-height: 1.7; margin-bottom: 1.3rem; }
.cc-btn {
  display: block; width: 100%; padding: 0.85rem 1rem; border-radius: 10px;
  font-family: var(--font-body); font-size: 0.92rem; font-weight: 700;
  text-decoration: none; margin-bottom: 0.6rem; transition: opacity 0.2s, background 0.2s;
}
.cc-btn-primary { background: linear-gradient(135deg, #1d5fc4, #164a9e); color: #fff; }
.cc-btn-primary:hover { opacity: 0.92; }
.cc-btn-ghost { background: var(--bg-alt); color: var(--ink); border: 1px solid var(--line); }
.cc-btn-ghost:hover { border-color: var(--blue); color: var(--blue); }
.cc-gate-free { margin-top: 1.1rem; font-size: 0.78rem; color: var(--slate); line-height: 1.8; }
.cc-gate-free a { color: var(--blue); text-decoration: none; font-weight: 600; }
.cc-gate-free a:hover { text-decoration: underline; }

/* Lock badge on locked topic/feature cards */
.cc-lock-badge {
  display: inline-block; margin-top: 0.7rem; font-size: 0.66rem; font-weight: 800;
  letter-spacing: 0.03em; text-transform: uppercase; padding: 0.25rem 0.6rem;
  border-radius: 6px; background: #fef3c7; color: #92400e;
}
html.dark .cc-lock-badge { background: #241d06; color: #fde047; }
.cc-card-locked { position: relative; }
.nav-pro a, a.nav-pro { color: var(--accent) !important; font-weight: 800; }
.sr-lock { font-size: 0.8rem; }

/* Pearl of the Day (MCQ widget) */
.pearl-widget { max-width: 720px; margin: 0 auto; border: 1px solid var(--line); border-radius: 16px; padding: 1.5rem; background: var(--bg); box-shadow: 0 6px 24px rgba(0,0,0,0.06); }
.pearl-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.pearl-badge { font-size: 0.74rem; font-weight: 800; letter-spacing: 0.04em; text-transform: uppercase; color: #fff; background: linear-gradient(135deg, #f59e0b, #d97706); padding: 0.3rem 0.8rem; border-radius: 20px; }
.pearl-topic { font-size: 0.72rem; font-weight: 700; color: var(--slate); background: var(--bg-alt); border: 1px solid var(--line); padding: 0.25rem 0.7rem; border-radius: 20px; }
.pearl-q { font-size: 1rem; font-weight: 700; color: var(--ink); line-height: 1.5; margin-bottom: 1rem; }
.pearl-opts { display: flex; flex-direction: column; gap: 0.55rem; }
.pearl-opt { display: flex; align-items: center; gap: 0.7rem; text-align: left; width: 100%; padding: 0.8rem 1rem; border: 1.5px solid var(--line); border-radius: 10px; background: var(--bg); color: var(--ink); font-family: var(--font-body); font-size: 0.9rem; cursor: pointer; transition: border-color 0.15s, background 0.15s; }
.pearl-opt:hover { border-color: var(--blue); }
.pearl-letter { flex-shrink: 0; width: 24px; height: 24px; border-radius: 50%; background: var(--bg-alt); border: 1px solid var(--line); display: grid; place-items: center; font-size: 0.78rem; font-weight: 800; color: var(--slate); }
.pearl-opt.locked { cursor: default; }
.pearl-opt.correct { border-color: #22c55e; background: rgba(34,197,94,0.12); }
.pearl-opt.correct .pearl-letter { background: #22c55e; color: #fff; border-color: #22c55e; }
.pearl-opt.wrong { border-color: #ef4444; background: rgba(239,68,68,0.10); }
.pearl-opt.wrong .pearl-letter { background: #ef4444; color: #fff; border-color: #ef4444; }
.pearl-exp { display: none; margin-top: 1rem; padding: 0.9rem 1.1rem; background: var(--bg-alt); border: 1px solid var(--line); border-radius: 10px; font-size: 0.86rem; color: var(--ink); line-height: 1.65; }
.pearl-exp.show { display: block; }
.pearl-ok { color: #15803d; } .pearl-no { color: #b91c1c; }

/* Reading progress bar + Save button (article pages, logged-in) */
.cc-readbar { position: fixed; top: 0; left: 0; height: 3px; width: 0; background: var(--accent); z-index: 200; transition: width 0.1s linear; }
.cc-save-btn { position: fixed; right: 1rem; bottom: 5.2rem; z-index: 120; background: var(--bg); border: 1.5px solid var(--blue); color: var(--blue); font-weight: 700; font-size: 0.82rem; padding: 0.55rem 0.95rem; border-radius: 30px; cursor: pointer; box-shadow: 0 4px 16px rgba(0,0,0,0.18); font-family: var(--font-body); }
.cc-save-btn.saved { background: var(--blue); color: #fff; }
.cc-save-btn:hover { opacity: 0.92; }
@media (min-width: 821px) { .cc-save-btn { bottom: 1.5rem; } }
.cc-later-btn { position: fixed; right: 1rem; bottom: 8.6rem; z-index: 120; background: var(--bg); border: 1.5px solid var(--accent); color: var(--accent); font-weight: 700; font-size: 0.82rem; padding: 0.55rem 0.95rem; border-radius: 30px; cursor: pointer; box-shadow: 0 4px 16px rgba(0,0,0,0.18); font-family: var(--font-body); }
.cc-later-btn.queued { background: var(--accent); color: #fff; }
.cc-later-btn:hover { opacity: 0.92; }
@media (min-width: 821px) { .cc-later-btn { bottom: 4.9rem; } }

/* Login banner (shown only to logged-out visitors) */
.cc-login-banner {
  max-width: 1160px; margin: 1.2rem auto 0; padding: 0.9rem 1.2rem;
  display: flex; align-items: center; gap: 0.8rem; flex-wrap: wrap;
  background: linear-gradient(135deg, var(--blue-soft), var(--bg));
  border: 1px solid var(--blue); border-radius: 12px;
}
html.cc-auth .cc-login-banner { display: none; }
.cc-login-banner .ccb-ic { font-size: 1.3rem; }
.cc-login-banner p { font-size: 0.85rem; color: var(--ink); margin: 0; flex: 1; min-width: 200px; line-height: 1.5; }
.cc-login-banner a.ccb-btn { background: var(--blue); color: #fff; font-size: 0.8rem; font-weight: 700; padding: 0.5rem 1rem; border-radius: 8px; text-decoration: none; white-space: nowrap; }
.cc-login-banner a.ccb-btn:hover { opacity: 0.9; }

/* Dark mode toggle button */
.dm-toggle {
  display: flex; align-items: center; gap: 0.4rem;
  padding: 0.4rem 0.75rem; border-radius: 8px;
  background: var(--bg-alt); border: 1.5px solid var(--line);
  cursor: pointer; font-size: 0.78rem; font-weight: 700;
  transition: var(--dm-transition); color: var(--slate);
  flex-shrink: 0; margin-left: 0.5rem; letter-spacing: 0.01em;
  font-family: var(--font-body);
}
.dm-toggle:hover { border-color: var(--blue); color: var(--blue); background: var(--blue-soft); }
.dm-toggle .dm-icon { font-size: 0.9rem; }
.dm-toggle .dm-label { display: block; }
@media (max-width: 820px) { .dm-toggle .dm-label { display: none; } .dm-toggle { padding: 0.4rem 0.5rem; } }

/* Apply transition to everything */
*, *::before, *::after { transition: var(--dm-transition); }

html { scroll-behavior: smooth; }
body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }

/* ============================================================
   NAVIGATION (appears on every page)
   ============================================================ */
.nav {
  position: sticky; top: 0; z-index: 100;
  background: rgba(255,255,255,0.9);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 5%;
  height: 66px;
}
.nav-brand { display: flex; align-items: center; gap: 10px; text-decoration: none; margin-right: 1.6rem; flex-shrink: 0; }
.nav-mark {
  width: 36px; height: 36px;
  background: var(--blue);
  border-radius: 10px;
  display: grid; place-items: center;
  color: #fff; font-size: 1.05rem;
  box-shadow: 0 2px 8px rgba(29,95,196,0.26);
}
.nav-name { font-weight: 800; font-size: 1.05rem; color: var(--ink); letter-spacing: -0.02em; }
.nav-name span { color: var(--blue); }
.nav-menu { display: flex; align-items: center; gap: 1.25rem; list-style: none; margin-left: auto; }
.nav-menu a {
  text-decoration: none;
  color: var(--slate);
  font-size: 0.84rem; font-weight: 600;
  letter-spacing: 0.01em;
  white-space: nowrap;
  transition: color 0.18s;
}
.nav-menu a:hover { color: var(--blue); }
.nav-menu a.active { color: var(--blue); }
.nav-cta {
  background: var(--blue); color: #fff !important;
  padding: 0.5rem 1.1rem; border-radius: 7px;
  font-weight: 700 !important;
  transition: background 0.18s, transform 0.15s;
}
.nav-cta:hover { background: var(--blue-dark); transform: translateY(-1px); }

/* "More" dropdown (secondary nav items, grouped by access.js) */
.nav-more { position: relative; }
.nav-more > .nav-more-btn { cursor: pointer; display: inline-flex; align-items: center; gap: 3px; }
.nav-more-menu {
  display: none; list-style: none; position: absolute; top: calc(100% + 8px); right: 0;
  background: var(--bg); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: 0 12px 34px rgba(0,0,0,0.14); padding: 0.45rem; min-width: 180px;
  flex-direction: column; gap: 0.1rem; z-index: 140;
}
.nav-more.open > .nav-more-menu { display: flex; }
.nav-more-menu li { width: 100%; }
.nav-more-menu a { display: block; padding: 0.55rem 0.75rem; border-radius: 8px; font-size: 0.85rem; }
.nav-more-menu a:hover { background: var(--bg-alt); }
html.dark .nav-more-menu { background: #0d0d0f; border-color: var(--line); }

/* mobile nav toggle */
.nav-toggle { display: none; background: none; border: none; font-size: 1.5rem; cursor: pointer; color: var(--ink); }

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex; align-items: center; gap: 0.5rem;
  padding: 0.85rem 1.7rem; border-radius: 8px;
  font-family: var(--font-body); font-weight: 700; font-size: 0.9rem;
  text-decoration: none; cursor: pointer; border: none;
  transition: transform 0.16s, box-shadow 0.16s, background 0.18s;
}
.btn:hover { transform: translateY(-1px); }
.btn-blue { background: var(--blue); color: #fff; box-shadow: 0 2px 10px rgba(23,60,120,0.18); }
.btn-blue:hover { background: var(--blue-dark); box-shadow: 0 5px 18px rgba(23,60,120,0.24); }
.btn-line { background: #fff; color: var(--ink); border: 1.5px solid var(--line); }
.btn-line:hover { border-color: var(--blue); color: var(--blue); }
.btn-wa { background: #25D366; color: #fff; box-shadow: 0 4px 16px rgba(37,211,102,0.3); }
.btn-wa:hover { background: #1eb858; }

/* ============================================================
   SHARED SECTION BITS
   ============================================================ */
.wrap { max-width: 1160px; margin: 0 auto; }
.eyebrow {
  display: inline-flex; align-items: center; gap: 0.55rem;
  font-size: 0.72rem; font-weight: 700;
  letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--blue); margin-bottom: 0.8rem;
}
.eyebrow::before { content: ''; width: 22px; height: 2px; background: var(--blue); }
h1.display {
  font-family: var(--font-disp);
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.1;
  color: var(--ink);
}
h2.display {
  font-family: var(--font-disp);
  font-weight: 600;
  font-size: clamp(1.7rem, 3vw, 2.5rem);
  letter-spacing: -0.01em;
  line-height: 1.15;
  color: var(--ink);
}

/* ============================================================
   FOOTER (appears on every page)
   ============================================================ */
.footer {
  background: var(--ink);
  padding: 2.5rem 5%;
}
.footer-inner {
  max-width: 1160px; margin: 0 auto;
  display: flex; justify-content: space-between; align-items: center;
  flex-wrap: wrap; gap: 1rem;
}
.footer-brand { font-weight: 800; color: #fff; font-size: 1rem; }
.footer-brand span { color: var(--accent); }
.footer p { font-size: 0.8rem; color: rgba(255,255,255,0.4); }
.footer-links { display: flex; gap: 1.5rem; list-style: none; }
.footer-links a { color: rgba(255,255,255,0.55); text-decoration: none; font-size: 0.82rem; transition: color 0.18s; }
.footer-links a:hover { color: var(--accent); }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 960px) {
  .nav-menu {
    display: none;
    position: absolute; top: 66px; left: 0; right: 0;
    background: #fff; flex-direction: column; align-items: flex-start;
    padding: 1rem 5%; gap: 1rem;
    border-bottom: 1px solid var(--line);
    box-shadow: 0 8px 24px rgba(0,0,0,0.06);
    margin-left: 0;
  }
  html.dark .nav-menu { background: #0d0d0f; }
  .nav-menu.open { display: flex; }
  .nav-toggle { display: block; }
  /* flatten the "More" dropdown into the mobile list */
  .nav-more { width: 100%; }
  .nav-more > .nav-more-btn { display: none; }
  .nav-more-menu { display: flex; position: static; box-shadow: none; border: none; padding: 0; background: transparent; min-width: 0; gap: 1rem; }
}
@media (max-width: 820px) {
  .footer-inner { flex-direction: column; text-align: center; }
}

/* ============================================================
   TOPIC DETAIL PAGES
   ============================================================ */
.topic-hero { background: linear-gradient(180deg, var(--blue-soft), #fff); padding: 3rem 5% 2.5rem; }
.breadcrumb { font-size: 0.78rem; color: var(--slate); margin-bottom: 1rem; }
.breadcrumb a { color: var(--blue); text-decoration: none; }
.breadcrumb a:hover { text-decoration: underline; }
.topic-hero h1 { font-family: var(--font-disp); font-weight: 600; font-size: clamp(1.8rem,3.5vw,2.8rem); letter-spacing: -0.01em; margin-bottom: 0.8rem; color: var(--ink); }
.topic-hero-meta { display: flex; gap: 0.6rem; flex-wrap: wrap; align-items: center; }
.topic-tag { font-size: 0.68rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; background: var(--blue-soft); color: var(--blue-dark); padding: 0.25rem 0.6rem; border-radius: 5px; }
.topic-tag.red { background: #fef2f2; color: #b91c1c; }
.topic-tag.green { background: #f0fdf4; color: #166534; }
.topic-updated { font-size: 0.78rem; color: var(--slate); }
.topic-reviewed { margin-top: 0.9rem; font-size: 0.78rem; color: var(--slate); display: flex; align-items: center; flex-wrap: wrap; gap: 0.3rem 0.5rem; padding: 0.5rem 0.8rem; background: rgba(255,255,255,0.6); border: 1px solid var(--line); border-radius: 8px; width: fit-content; max-width: 100%; }
.topic-reviewed strong { color: var(--ink); font-weight: 700; }
.topic-reviewed .tr-ic { font-size: 0.9rem; }
.topic-reviewed .tr-cred { color: var(--slate); opacity: 0.85; }
html.dark .topic-reviewed { background: rgba(255,255,255,0.05); }

.topic-layout { max-width: 1160px; margin: 0 auto; padding: 2.5rem 5% 4rem; display: grid; grid-template-columns: 210px 1fr; gap: 3rem; align-items: start; }
/* min-width:0 lets the content column shrink so wide tables scroll INSIDE it
   instead of expanding the whole page off-screen (the mobile "zoom out" bug) */
.topic-content { min-width: 0; overflow-wrap: break-word; }
.topic-content table { max-width: 100%; }
.topic-sidebar { position: sticky; top: 90px; min-width: 0; }
.toc { background: var(--bg-alt); border: 1px solid var(--line); border-radius: 10px; padding: 1.2rem; }
.toc-title { font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em; color: var(--slate); margin-bottom: 0.8rem; }
.toc-list { list-style: none; display: flex; flex-direction: column; gap: 0.3rem; }
.toc-list a { font-size: 0.82rem; color: var(--slate); text-decoration: none; padding: 0.25rem 0.6rem; display: block; transition: color 0.18s, border-color 0.18s; border-left: 2px solid transparent; }
.toc-list a:hover { color: var(--blue); border-left-color: var(--blue); }
.toc-back { display: block; margin-top: 1rem; font-size: 0.8rem; color: var(--blue); text-decoration: none; font-weight: 600; }
.toc-back:hover { text-decoration: underline; }

.topic-content section { margin-bottom: 2.8rem; }
.topic-content h2 { font-family: var(--font-disp); font-weight: 600; font-size: 1.5rem; color: var(--ink); margin-bottom: 1rem; padding-bottom: 0.5rem; border-bottom: 2px solid var(--blue-soft); }
.topic-content h3 { font-size: 0.98rem; font-weight: 700; color: var(--ink); margin: 1.3rem 0 0.5rem; }
.topic-content p { color: var(--slate); font-size: 0.95rem; line-height: 1.85; margin-bottom: 0.8rem; }
.topic-content ul, .topic-content ol { color: var(--slate); font-size: 0.95rem; line-height: 1.8; padding-left: 1.4rem; margin-bottom: 0.9rem; }
.topic-content li { margin-bottom: 0.25rem; }
.topic-content strong { color: var(--ink); font-weight: 600; }

.key-box { background: var(--blue-soft); border-left: 3px solid var(--blue); border-radius: 0 8px 8px 0; padding: 1rem 1.2rem; margin: 1.2rem 0; }
.key-box .kb-label { font-size: 0.67rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em; color: var(--blue-dark); margin-bottom: 0.45rem; }
.key-box p, .key-box li { color: var(--ink); font-size: 0.9rem; line-height: 1.75; margin-bottom: 0.3rem; }
.key-box ul { margin-bottom: 0; }

.warn-box { background: #fff8ec; border-left: 3px solid #f59e0b; border-radius: 0 8px 8px 0; padding: 1rem 1.2rem; margin: 1.2rem 0; }
.warn-box .kb-label { font-size: 0.67rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em; color: #92400e; margin-bottom: 0.45rem; }
.warn-box p, .warn-box li { color: #78350f; font-size: 0.9rem; line-height: 1.75; margin-bottom: 0.3rem; }
.warn-box ul { padding-left: 1.2rem; margin-bottom: 0; }

.table-wrap { overflow-x: auto; border-radius: 8px; border: 1px solid var(--line); margin: 1rem 0; }
.drug-table { width: 100%; border-collapse: collapse; font-size: 0.87rem; }
.drug-table th { background: var(--ink); color: #fff; padding: 0.6rem 0.9rem; text-align: left; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; }
.drug-table td { padding: 0.65rem 0.9rem; border-bottom: 1px solid var(--line); color: var(--slate); vertical-align: top; }
.drug-table tr:last-child td { border-bottom: none; }
.drug-table tr:hover td { background: var(--bg-alt); }
.drug-table td strong { color: var(--ink); }

.evidence-pill { display: inline-block; font-size: 0.6rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.06em; padding: 0.12rem 0.4rem; border-radius: 4px; margin-left: 0.35rem; vertical-align: middle; }
.ep-1a { background: #dcfce7; color: #166534; }
.ep-1b { background: #d1fae5; color: #065f46; }
.ep-2a { background: #fef9c3; color: #854d0e; }

@media (max-width: 820px) {
  .topic-layout { grid-template-columns: 1fr; gap: 1.5rem; }
  .topic-sidebar { position: static; }
  .toc { display: none; }
}

/* ============================================================
   8-SECTION FORMAT — Standard topic structure
   ============================================================ */
.section-badge {
  display: inline-flex; align-items: center; gap: 0.5rem;
  font-size: 0.68rem; font-weight: 800; text-transform: uppercase;
  letter-spacing: 0.1em; padding: 0.3rem 0.8rem; border-radius: 20px;
  margin-bottom: 0.8rem;
}
.sb-washington { background: #dbeafe; color: #1e40af; }
.sb-marino    { background: #ede9fe; color: #5b21b6; }
.sb-guideline { background: #dcfce7; color: #166534; }
.sb-drugs     { background: #ffedd5; color: #9a3412; }
.sb-flowchart { background: #f0fdf4; color: #14532d; border: 1px solid #86efac; }
.sb-mistakes  { background: #fee2e2; color: #991b1b; }
.sb-exam      { background: #fef9c3; color: #854d0e; }
.sb-refs      { background: var(--bg-alt); color: var(--slate); border: 1px solid var(--line); }

.flowchart-step {
  display: grid; grid-template-columns: auto 1fr;
  gap: 0; margin: 0; position: relative;
}
.flowchart-step::before {
  content: ''; position: absolute; left: 20px; top: 40px;
  width: 2px; height: calc(100% - 20px); background: var(--line); z-index: 0;
}
.flowchart-step:last-child::before { display: none; }
.fc-node {
  width: 40px; height: 40px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: .9rem; color: #fff;
  position: relative; z-index: 1; margin-right: 1rem; margin-bottom: 1rem;
}
.fc-content {
  background: var(--bg-alt); border: 1px solid var(--line); border-radius: 10px;
  padding: 1rem 1.2rem; margin-bottom: .8rem; flex: 1;
}
.fc-content h4 { font-size: .88rem; font-weight: 700; color: var(--ink); margin-bottom: .4rem; }
.fc-content p, .fc-content ul { font-size: .85rem; color: var(--slate); line-height: 1.7; margin: 0; }
.fc-content ul { padding-left: 1.1rem; }
.fc-content strong { color: var(--ink); }
.fc-red    { background: #ef4444; }
.fc-orange { background: #f97316; }
.fc-yellow { background: #eab308; }
.fc-green  { background: #22c55e; }
.fc-blue   { background: var(--blue); }
.fc-purple { background: #8b5cf6; }
.fc-teal   { background: #14b8a6; }
.fc-gray   { background: #6b7280; }

/* ---- PATHOPHYSIOLOGY CASCADE FLOWCHART ---- */
/* Reusable top-to-bottom "how the disease progresses" flow: trigger → mechanism
   steps → pathological end-state, with fork/merge branch support. Pure CSS,
   dark-mode aware, prints, and stacks cleanly on mobile. */
.patho-flow { display: flex; flex-direction: column; align-items: center; gap: 0; margin: 1.5rem 0; padding: 1.5rem 1.2rem; background: var(--bg-alt); border: 1px solid var(--line); border-radius: 16px; }
.patho-flow-title { font-size: .7rem; font-weight: 800; text-transform: uppercase; letter-spacing: .12em; color: var(--slate); margin-bottom: 1.1rem; text-align: center; }
.pf-node { width: 100%; max-width: 500px; background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: .8rem 1.15rem; text-align: center; font-size: .87rem; line-height: 1.5; color: var(--ink); box-shadow: 0 1px 2px rgba(15,31,61,.06), 0 5px 14px rgba(15,31,61,.05); }
.pf-node strong { color: var(--blue-dark); font-weight: 700; }
.pf-node .pf-sub { display: block; font-size: .75rem; color: var(--slate); margin-top: .28rem; line-height: 1.45; font-weight: 400; }
.pf-tag { display: inline-block; font-size: .57rem; font-weight: 800; text-transform: uppercase; letter-spacing: .1em; padding: .14rem .55rem; border-radius: 20px; margin-bottom: .4rem; background: var(--blue-soft); color: var(--blue-dark); }
.pf-trigger { background: linear-gradient(135deg, #fffdf5, #fff6e3); border-color: #fcd34d; box-shadow: 0 1px 2px rgba(180,120,0,.08), 0 6px 16px rgba(245,158,11,.12); }
.pf-trigger .pf-tag { background: #f59e0b; color: #fff; }
.pf-end { background: linear-gradient(135deg, #fff6f6, #ffe9e9); border-color: #f87171; box-shadow: 0 1px 2px rgba(180,0,0,.08), 0 6px 16px rgba(220,38,38,.14); }
.pf-end .pf-tag { background: #dc2626; color: #fff; }
.pf-end strong { color: #991b1b; }
/* connector arrow between nodes — clean chevron */
.pf-arrow { width: 2px; height: 26px; background: var(--line); position: relative; flex-shrink: 0; }
.pf-arrow::after { content: ''; position: absolute; bottom: 3px; left: 50%; width: 8px; height: 8px; border-right: 2px solid var(--slate); border-bottom: 2px solid var(--slate); transform: translateX(-50%) rotate(45deg); border-radius: 0 0 2px 0; }
/* optional italic label alongside an arrow */
.pf-arrow.pf-lbl span { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); white-space: nowrap; font-size: .68rem; font-style: italic; color: var(--slate); }
/* fork into parallel branches, with optional convergence back to one path */
.pf-split { position: relative; display: flex; gap: 1rem; width: 100%; max-width: 560px; padding-top: 26px; }
.pf-split::before { content: ''; position: absolute; top: 0; left: 25%; right: 25%; height: 2px; background: var(--line); }
.pf-split .pf-node { position: relative; max-width: none; flex: 1; }
.pf-split .pf-node::before { content: ''; position: absolute; top: -26px; left: 50%; transform: translateX(-50%); width: 2px; height: 26px; background: var(--line); }
.pf-split.pf-converge { padding-bottom: 26px; }
.pf-split.pf-converge::after { content: ''; position: absolute; bottom: 0; left: 25%; right: 25%; height: 2px; background: var(--line); }
.pf-split.pf-converge .pf-node::after { content: ''; position: absolute; bottom: -26px; left: 50%; transform: translateX(-50%); width: 2px; height: 26px; background: var(--line); }
html.dark .pf-trigger { background: linear-gradient(135deg, #241a05, #2e2206); border-color: #a16207; }
html.dark .pf-end { background: linear-gradient(135deg, #2a0c0c, #320f0f); border-color: #b91c1c; }
html.dark .pf-end strong { color: #fca5a5; }
html.dark .pf-node { box-shadow: 0 2px 10px rgba(0,0,0,.35); }
@media (max-width: 560px) {
  .pf-split { flex-direction: column; gap: 0; padding-top: 0; }
  .pf-split::before, .pf-split.pf-converge::after, .pf-split.pf-converge .pf-node::after { display: none; }
  .pf-split .pf-node:first-child::before { display: none; }
  .pf-split .pf-node + .pf-node { margin-top: 26px; }
  .pf-split .pf-node + .pf-node::before { display: block; }
}

/* ---- GUIDELINE BADGES ---- */
.guideline-row { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0.8rem 0 1.4rem; }
.gbadge { font-size: 0.68rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; padding: 0.28rem 0.65rem; border-radius: 5px; }
.gbadge.sccm  { background: #dbeafe; color: #1e40af; }
.gbadge.esicm { background: #ede9fe; color: #5b21b6; }
.gbadge.isccm { background: #fef3c7; color: #92400e; }
.gbadge.kdigo { background: #dcfce7; color: #166534; }
.gbadge.who   { background: #fce7f3; color: #9d174d; }
.gbadge.apasl { background: #ffedd5; color: #9a3412; }

/* ---- INDIA BOX ---- */
.india-box { background: #fffbeb; border-left: 3px solid #f59e0b; border-radius: 0 8px 8px 0; padding: 1rem 1.2rem; margin: 1.2rem 0; }
.india-box .kb-label { color: #b45309; font-size: 0.67rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em; margin-bottom: 0.45rem; }
.india-box p, .india-box li { color: #78350f; font-size: 0.9rem; line-height: 1.75; margin-bottom: 0.3rem; }
.india-box ul { padding-left: 1.2rem; margin-bottom: 0; }

/* ---- UPDATE BOX ---- */
.update-box { background: #f0fdf4; border-left: 3px solid #22c55e; border-radius: 0 8px 8px 0; padding: 1rem 1.2rem; margin: 1.2rem 0; }
.update-box .kb-label { color: #15803d; font-size: 0.67rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em; margin-bottom: 0.45rem; }
.update-box p, .update-box li { color: #14532d; font-size: 0.9rem; line-height: 1.75; margin-bottom: 0.3rem; }
.update-box ul { padding-left: 1.2rem; margin-bottom: 0; }

/* ---- REFERENCES ---- */
.references-section { margin-top: 3rem; padding-top: 2rem; border-top: 2px solid var(--blue-soft); }
.references-section h2 { font-family: var(--font-body); font-size: 0.95rem; font-weight: 700; color: var(--ink); margin-bottom: 1.2rem; letter-spacing: 0.01em; }
.ref-list { list-style: none; counter-reset: ref; }
.ref-list li { counter-increment: ref; font-size: 0.8rem; color: var(--slate); line-height: 1.7; padding: 0.45rem 0 0.45rem 2.2rem; position: relative; border-bottom: 1px solid var(--line); }
.ref-list li:last-child { border-bottom: none; }
.ref-list li::before { content: "[" counter(ref) "]"; position: absolute; left: 0; color: var(--blue); font-weight: 700; font-size: 0.75rem; top: 0.55rem; }
.ref-list li strong { color: var(--ink); }

/* ============================================================
   MOBILE OPTIMISATION — Full responsive overhaul
   ============================================================ */

/* Safe area insets for iPhone notch/home bar */
body {
  padding-bottom: env(safe-area-inset-bottom, 0);
}
.nav {
  padding-top: env(safe-area-inset-top, 0);
}

/* Touch targets — minimum 44x44px for all interactive elements */
.nav-menu a, .btn, .dm-toggle, .cat-tab, .score-tab {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}
.calc-btn, .calc-btn-sm { min-height: 52px; }

@media (max-width: 820px) {
  /* Nav */
  .nav { height: auto; min-height: 60px; padding: 0.75rem 4%; }
  .nav-name { font-size: 0.95rem; }
  .dm-toggle .dm-label { display: none; }
  .dm-toggle { padding: 0.4rem 0.5rem; }

  /* Topic hero */
  .topic-hero { padding: 2rem 4% 1.8rem; }
  .topic-hero h1 { font-size: clamp(1.4rem, 6vw, 2rem); }
  .topic-hero-meta { flex-wrap: wrap; gap: 0.35rem; }
  .topic-updated { font-size: 0.7rem; }

  /* Topic layout — sidebar hidden on mobile, TOC moves inline */
  .topic-layout { grid-template-columns: 1fr; gap: 0; padding: 1.2rem 4%; }
  .topic-sidebar { display: none; }
  .topic-content { padding: 0; }
  .topic-content section { margin-bottom: 2rem; }
  .topic-content h2 { font-size: 1.15rem; }
  .topic-content h3 { font-size: .95rem; }
  .topic-content p, .topic-content ul, .topic-content li { font-size: .88rem; }
  /* Any wide table scrolls horizontally within the column instead of
     widening the page (prevents the whole article rendering zoomed-out) */
  .topic-content table { display: block; width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .topic-content { overflow-x: hidden; }

  /* Tables — horizontal scroll on mobile */
  .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .drug-table { min-width: 500px; }
  .drug-table th, .drug-table td { font-size: .78rem; padding: 0.5rem 0.6rem; }

  /* Cards */
  .tcard, .card, .feature-card { padding: 1.2rem; }
  .tcard-desc, .card-desc, .feature-card p { font-size: .82rem; }

  /* Scores page tabs */
  .score-tabs-inner, .category-tabs-inner { gap: 0; padding: 0 4%; }
  .score-tab, .cat-tab { padding: .75rem .8rem; font-size: .76rem; }
  .scores-grid { grid-template-columns: 1fr; }
  .score-card { border-radius: 10px; }

  /* Topics page */
  .topics-area { padding: 1.5rem 4%; }
  .grid { grid-template-columns: 1fr; }

  /* Key boxes, warn boxes */
  .key-box, .warn-box, .india-box, .update-box { padding: .9rem 1rem; }
  .key-box p, .warn-box p, .india-box p { font-size: .85rem; }

  /* References */
  .ref-list li { font-size: .78rem; padding: .4rem 0 .4rem 2rem; }

  /* Guideline badges */
  .guideline-row { gap: 0.3rem; flex-wrap: wrap; }
  .gbadge { font-size: .64rem; padding: .2rem .5rem; }

  /* Section badges */
  .sb { font-size: .62rem; padding: .25rem .65rem; }

  /* Marina/update boxes */
  .mb, .marino-box { padding: 1rem; }
  .mb p, .mb ul, .marino-box p { font-size: .85rem; }

  /* Flowchart */
  .fs { gap: .6rem; }
  .fn { width: 34px; height: 34px; font-size: .8rem; }
  .fb { padding: .8rem 1rem; }
  .fb h4 { font-size: .84rem; }
  .fb p, .fb ul { font-size: .82rem; }

  /* Footer */
  .footer { padding: 2rem 4%; }
  .footer-links { gap: 1rem; flex-wrap: wrap; justify-content: center; }

  /* Scores calculator field rows */
  .field-row { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 480px) {
  /* Smallest phones */
  .hero-btns { flex-direction: column; }
  .hero-btns .btn { text-align: center; justify-content: center; }
  .spec-inner { grid-template-columns: 1fr; }
  .spec-item { border-right: none !important; border-bottom: 1px solid var(--line); }
  .spec-item:last-child { border-bottom: none; }
  .how-grid { grid-template-columns: 1fr; }
  .ai-banner { padding: 1.5rem; }
  .feature-grid { grid-template-columns: 1fr; }
  .pearl-grid { grid-template-columns: 1fr; }
  .drug-table th, .drug-table td { font-size: .72rem; padding: 0.4rem 0.5rem; }

  /* ABG calculator field rows — single column on tiny screens */
  .field-row { grid-template-columns: 1fr; }
  .abg-wrap { padding: 1rem 3%; }

  /* Score cards */
  .score-field select, .score-field input { font-size: .82rem; }
}

/* ── Prevent zoom on input focus (iOS) ── */
input[type="number"],
input[type="text"],
input[type="email"],
input[type="password"],
select,
textarea {
  font-size: 16px !important;
}
@media (max-width: 820px) {
  input[type="number"],
  select { font-size: 16px !important; }
}

/* ── Sticky bottom nav on mobile (topic pages) ── */
.mobile-nav-bar {
  display: none;
}
@media (max-width: 820px) {
  .mobile-nav-bar {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    bottom: env(safe-area-inset-bottom, 0);
    background: var(--bg);
    border-top: 1px solid var(--line);
    z-index: 200;
    padding: 0.4rem 0;
    box-shadow: 0 -2px 12px rgba(0,0,0,0.08);
  }
  .mobile-nav-bar a {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.2rem;
    text-decoration: none;
    color: var(--slate);
    font-size: 0.62rem;
    font-weight: 600;
    padding: 0.4rem 0;
    transition: color .2s;
  }
  .mobile-nav-bar a .mn-icon { font-size: 1.2rem; }
  .mobile-nav-bar a.active, .mobile-nav-bar a:hover { color: var(--blue); }
  /* Add bottom padding to body content so it clears the nav bar */
  body { padding-bottom: calc(64px + env(safe-area-inset-bottom, 0)); }
}

/* ============================================================
   SEARCH — Button + Overlay
   ============================================================ */
.cc-search-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: 8px;
  background: var(--bg-alt); border: 1.5px solid var(--line);
  color: var(--slate); cursor: pointer; margin-right: 0.4rem;
  transition: var(--dm-transition);
  flex-shrink: 0;
}
.cc-search-btn:hover { border-color: var(--blue); color: var(--blue); background: var(--blue-soft); }
.cc-search-btn svg { display: block; }

/* Overlay backdrop */
#cc-search-overlay {
  display: none; position: fixed; inset: 0; z-index: 9999;
  background: rgba(14,22,36,0.55); backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  align-items: flex-start; justify-content: center;
  padding: 5vh 5% 0;
}
#cc-search-overlay.active { display: flex; }

.cc-search-modal {
  background: var(--bg); border: 1px solid var(--line);
  border-radius: 14px; box-shadow: 0 24px 60px rgba(10,20,40,0.2);
  width: 100%; max-width: 680px; overflow: hidden;
}

.cc-search-header { padding: 1rem 1rem 0.8rem; border-bottom: 1px solid var(--line); }
.cc-search-input-wrap {
  display: flex; align-items: center; gap: 0.7rem;
  background: var(--bg-alt); border: 1.5px solid var(--line);
  border-radius: 10px; padding: 0.6rem 0.9rem;
}
.cc-search-input-wrap:focus-within { border-color: var(--blue); }
.cc-search-icon { color: var(--slate); flex-shrink: 0; }
.cc-search-input {
  flex: 1; border: none; background: transparent;
  font-family: var(--font-body); font-size: 1rem; color: var(--ink);
  outline: none; min-width: 0;
}
.cc-search-input::placeholder { color: var(--slate); }
.cc-search-esc {
  font-size: 0.7rem; font-weight: 700; color: var(--slate);
  border: 1.5px solid var(--line); border-radius: 5px;
  padding: 0.15rem 0.45rem; cursor: pointer; flex-shrink: 0;
  font-family: var(--font-body); background: var(--bg);
  transition: var(--dm-transition);
}
.cc-search-esc:hover { border-color: var(--blue); color: var(--blue); }

.cc-search-results {
  max-height: 60vh; overflow-y: auto; padding: 0.5rem 0.8rem 0.8rem;
}
.sr-hint {
  font-size: 0.85rem; color: var(--slate); padding: 1rem 0.4rem;
  line-height: 1.6; margin: 0;
}
.sr-item {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.3rem 0.6rem;
  text-decoration: none; color: inherit;
  padding: 0.75rem 0.6rem; border-radius: 8px;
  transition: background 0.15s; border-bottom: 1px solid var(--line);
}
.sr-item:last-child { border-bottom: none; }
.sr-item:hover { background: var(--blue-soft); }
.sr-type {
  font-size: 0.6rem; font-weight: 800; text-transform: uppercase;
  letter-spacing: 0.06em; padding: 0.15rem 0.45rem; border-radius: 4px;
  flex-shrink: 0;
}
.sr-topic  { background: #dbeafe; color: #1e40af; }
.sr-score  { background: #dcfce7; color: #166534; }
.sr-tool   { background: #ede9fe; color: #5b21b6; }
.sr-page   { background: var(--bg-alt); color: var(--slate); border: 1px solid var(--line); }
.sr-title  { font-weight: 700; font-size: 0.92rem; color: var(--ink); flex: 1 0 100%; }
.sr-desc   { font-size: 0.8rem; color: var(--slate); line-height: 1.5; flex: 1 0 100%; }
.sr-item mark { background: #fef08a; color: #713f12; border-radius: 2px; padding: 0 1px; }

/* Dark mode search */
html.dark #cc-search-overlay { background: rgba(5,10,18,0.7); }
html.dark .cc-search-modal { background: var(--bg-alt); border-color: var(--line); }
html.dark .cc-search-input-wrap { background: var(--bg); border-color: var(--line); }
html.dark .cc-search-input { color: var(--ink); }
html.dark .cc-search-esc { background: var(--bg); border-color: var(--line); color: var(--slate); }
html.dark .sr-item:hover { background: var(--blue-soft); }
html.dark .sr-item mark { background: #713f12; color: #fef08a; }
html.dark .cc-search-btn { background: var(--bg-alt); border-color: var(--line); color: var(--slate); }

@media (max-width: 820px) {
  #cc-search-overlay { padding: 3vh 4% 0; }
  .cc-search-modal { border-radius: 12px; }
  .cc-search-input { font-size: 0.9rem; }
  .cc-search-results { max-height: 70vh; }
}
