/* ── DESIGN TOKENS ──────────────────────────────────────────────────────────── */
:root {
  /* v2.36 design tokens — 4px spacing scale + reading type floor (additive) */
  --sp-1: 4px;  --sp-2: 8px;  --sp-3: 12px; --sp-4: 16px;
  --sp-5: 20px; --sp-6: 24px; --sp-8: 32px;
  --fs-body:   15px;  /* primary reading text floor */
  --fs-caption:12.5px;/* cues / metadata */
  --tap-min:   44px;  /* mobile tap-target target */
  --bg:            #F4F5F7;  /* v2.54 — flat warm neutral page; replaces blue gradient */
  --surface:       #FFFFFF;  /* card / panel surface — the "paper" */
  --surface-sunken:#F0F2F5;  /* v2.54 — inset wells (answer reveal, quiet panels) */
  --border:        #D2D7DD;  /* v2.54 — single softer neutral divider */
  --radius:        12px;
  --radius-sm:     8px;
  --radius-lg:     16px;
  --primary:       #0F5EA8;
  --primary-bg:    #EAF3FF;
  --primary-dark:  #0d4f8f;
  --accent:        #0F5EA8;
  --draft-bg:      #FFFBF2;
  --draft-border:  #E8C97A;
  --draft-color:   #92600a;
  --tier1-bg:      #FEECEC;
  --tier1-color:   #b71c1c;
  --text:          #1A2332;
  --text-secondary:#44546A;
  --text-muted:    #5E6B7E;  /* v2.54 — darkened from #6B7A90 to clear WCAG AA on flatter --bg */
  --section-gap:   40px;      /* v2.54 — wider rhythm between reasoning sections (was 32) */

  /* v2.54 — semantic colour aliases (intent layer; no new hex — point at existing values) */
  --reasoning:     var(--primary);      /* blue   = structure / navigation / active state */
  --risk:          var(--tier1-color);  /* red    = red flags / high-stakes warnings */
  --risk-bg:       var(--tier1-bg);     /* red tint background for risk surfaces */
  --caution:       var(--draft-color);  /* amber  = attention states / drafts */
  --caution-bg:    var(--draft-bg);     /* amber tint background for caution surfaces */
  /* Navigation */
  --nav-height:    48px;
  /* Disclaimer removed — kept at 0 so legacy calc()s still resolve */
  --disclaimer-height: 0px;
  /* Glass & elevation */
  --glass-bg:      rgba(255, 255, 255, 0.94);
  --glass-border:  rgba(210, 220, 234, 0.80);
  --shadow-sm:     0 1px 4px rgba(0, 0, 0, 0.04);   /* v2.54 — flat paper lift, neutral grey */
  --shadow-md:     0 3px 10px rgba(0, 0, 0, 0.06);  /* v2.54 — subtle layered-paper depth */
  --shadow-lg:     0 6px 20px rgba(0, 0, 0, 0.08);  /* v2.54 — grounded elevation, not floating */
  --glow-primary:  0 0 0 3px rgba(15, 94, 168, 0.12);
  --focus-ring:    rgba(15, 94, 168, 0.28);
  --glow-tier1:    0 0 0 3px rgba(183, 28, 28, 0.09);
  --transition:    0.18s ease;

  /* ── Region colours — distinct per anatomical area ── */
  --col-lumbar:      #0F5EA8; --col-lumbar-bg:      #EAF3FF;
  --col-cervical:    #6B21A8; --col-cervical-bg:    #F4EDFF;
  --col-shoulder:    #0E7490; --col-shoulder-bg:    #E0F7FA;
  --col-hip:         #B45309; --col-hip-bg:         #FEF3C7;
  --col-knee:        #166534; --col-knee-bg:        #DCFCE7;
  --col-lower-limb:  #9A3412; --col-lower-limb-bg:  #FEF0E7;
  --col-upper-limb:  #9D174D; --col-upper-limb-bg:  #FCE7F3;
  --col-multi:       #374151; --col-multi-bg:       #F3F4F6;
  --col-ankle:       #065F46; --col-ankle-bg:       #D1FAE5;
  --col-neuro:       #1E40AF; --col-neuro-bg:       #DBEAFE;
  --col-systemic:    #7C3AED; --col-systemic-bg:    #EDE9FE;
  --col-medications: #374151; --col-medications-bg: #F3F4F6;
  --col-thoracic:    #0F766E; --col-thoracic-bg:    #CCFBF1;
  --col-pain-psych:  #BE185D; --col-pain-psych-bg:  #FCE7F3;

  /* ── SHARED TOKEN CONTRACT (cross-site standard; see design-tokens.md) ───────
     Canonical names shared with bodyease.eu. Values stay MSK-specific (blue,
     system-ui). Non-breaking: these alias existing tokens, so current CSS using
     --sp-*, --primary, etc. keeps working; new components use the shared names. */
  --space-1: var(--sp-1);  --space-2: var(--sp-2);  --space-3: var(--sp-3);
  --space-4: var(--sp-4);  --space-5: var(--sp-5);  --space-6: var(--sp-6);
  --space-8: var(--sp-8);  --space-10: 40px; --space-12: 48px;
  --space-16: 64px; --space-20: 80px;

  --text-xs:   0.75rem;  --text-sm:  0.875rem; --text-base: 1rem;
  --text-lg:   1.125rem; --text-xl:  1.25rem;  --text-2xl:  1.5rem;

  --color-primary:        var(--primary);
  --color-primary-dark:   var(--primary-dark);
  --color-accent:         var(--accent);
  --color-surface:        var(--surface);
  --color-surface-offset: var(--surface-sunken);
  --color-border:         var(--border);
  --color-text:           var(--text);
  --color-text-muted:     var(--text-muted);

  --radius-md:   var(--radius);   /* 12px */
  --radius-full: 9999px;

  --font-display: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-body:    system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

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

/* ── GLOBAL TAP HIGHLIGHT ───────────────────────────────────────────────────── */
/* Remove iOS grey flash on tap for all interactive elements */
a, button, [role="button"], summary, label, input, select, textarea {
  -webkit-tap-highlight-color: transparent;
}

body {
  /* Dyslexia-friendly: clear sans-serif stack, generous line-height, slight tracking */
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.72;
  letter-spacing: 0.012em;
  color: var(--text);
  /* v2.54 — flat warm neutral; gradient removed for calmer clinical-workspace surface */
  background: var(--bg);
  min-height: 100vh;
  min-height: 100dvh; /* iOS Safari: dvh excludes browser chrome */
  /* All text left-aligned by default */
  text-align: left;
}
/* Fixed attachment only on platforms that render it correctly */
@supports not (-webkit-touch-callout: none) {
  body { background-attachment: fixed; }
}
a { color: var(--primary); }

/* ── v3.7 — calm-clinical polish pass (taste-skill audit, filtered for clinical/ADHD/dyslexia) ──
   Applied only the on-brand, low-risk items; rejected fonts/texture/asymmetry/heavy-motion. */
/* Smooth anchor-nav scrolling (respect reduced-motion) */
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }
/* Tabular figures for data — consistent digit width across counts, progress, tiers, badges */
.home-tool-count, .home-hero-count, .fc-progress, .fc-total-chip, .fc-progress-bar-wrap,
.pres-urg-badge, .cond-count-badge, .ddx-group-title, .pres-diff-name,
.fc-title, .deck-count { font-variant-numeric: tabular-nums; }
/* Pressed feedback on interactive controls that lack it (focus rings already defined per-component) */
button:active, .home-tool-card:active, .home-hero-card:active,
.related-tool:active, .anchor-nav__link:active { transform: translateY(1px); }
/* Prevent orphaned words in headings */
h1, h2, h3, .home-hero-title, .cond-hd-title, .page-title, .tree-hero-title { text-wrap: balance; }

/* ── DISCLAIMER BAR — hidden (sole user, personal revision tool) ─────────────── */
#disclaimer-bar { display: none; }

/* ── TOP NAVIGATION BAR ─────────────────────────────────────────────────────── */
#top-nav {
  position: fixed;
  top: 0;
  left: 0; right: 0;
  z-index: 900;
  height: var(--nav-height, 48px);
  background: var(--glass-bg);
  backdrop-filter: blur(14px) saturate(1.3);
  -webkit-backdrop-filter: blur(14px) saturate(1.3);
  border-bottom: 1px solid var(--glass-border);
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
}
.top-nav-inner {
  display: flex;
  align-items: center;
  gap: 4px;
  width: 100%;
  max-width: 1040px;
  margin: 0 auto;
  padding: 0 16px;
}
.nav-brand {
  font-size: 14px;
  font-weight: 700;
  color: var(--primary);
  text-decoration: none;
  letter-spacing: -0.01em;
  margin-right: 12px;
  white-space: nowrap;
  flex-shrink: 0;
}
.nav-brand:hover { color: var(--primary-dark); }
.nav-links-group {
  display: flex;
  align-items: center;
  gap: 2px;
  flex: 1;
}
/* Wide desktop: centre brand + links as one cluster on the content axis,
   instead of stranding them at the left edge of the 1040px inner box */
@media (min-width: 1041px) {
  .top-nav-inner { justify-content: center; }
  .nav-links-group { flex: 0 0 auto; }
}
.nav-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  text-decoration: none;
  transition: background var(--transition), color var(--transition);
  white-space: nowrap;
}
.nav-link:hover { background: var(--primary-bg); color: var(--primary); }
.nav-link.active {
  background: var(--primary-bg);
  color: var(--primary);
  font-weight: 700;
  box-shadow: inset 0 -2px 0 var(--primary);
}
.nav-link-icon { font-size: 15px; line-height: 1; }

/* ── BACK TO TOP ─────────────────────────────────────────────────────────────── */
#back-to-top {
  position: fixed;
  bottom: 28px;
  right: 24px;
  z-index: 800;
  width: 42px; height: 42px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  border: none;
  cursor: pointer;
  font-size: 18px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow-md);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease, box-shadow var(--transition);
}
#back-to-top.visible { opacity: 1; pointer-events: auto; }
#back-to-top:hover { background: var(--primary-dark); box-shadow: var(--shadow-lg); transform: translateY(-2px); }

/* ── APP SHELL ──────────────────────────────────────────────────────────────── */
#app {
  padding-top: var(--nav-height, 48px);
  min-height: 100vh;
  min-height: 100dvh;
  transition: margin-right 0.25s ease;
}
#app.panel-open { margin-right: 320px; }

/* ── PAGE CONTAINERS ────────────────────────────────────────────────────────── */
.page      { max-width: 820px;  margin: 0 auto; padding: 20px 18px 56px; }
.page-wide { max-width: 1040px; margin: 0 auto; padding: 20px 18px 56px; }
.home-page { max-width: 680px;  margin: 0 auto; padding: 20px 16px 72px; }
.conditions-page { max-width: 960px; margin: 0 auto; padding: 20px 16px 72px; }

/* ── DESKTOP UNIFIED CONTAINER (≥768px) — matches Home page 820px column ─── */
@media (min-width: 768px) {
  .pres-page,
  .scripts-page,
  .mb-page,
  .more-page,
  .conditions-page {
    max-width: 820px;
    margin: 0 auto;
  }
}

/* ── TYPOGRAPHY ─────────────────────────────────────────────────────────────── */
.app-title    { font-size: 26px; font-weight: 700; color: var(--text);    margin-bottom: 6px; }
.app-subtitle { font-size: 15px; color: var(--text-secondary); margin-bottom: 0; }

/* Unified section / zone heading */
.section-heading,
.zone-heading {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-secondary);
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1.5px solid var(--border);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
h2 { font-size: 22px; font-weight: 700; color: var(--text); margin-bottom: 8px; line-height: 1.35; }
h3 { font-size: 17px; font-weight: 700; color: var(--text); margin-bottom: 4px; line-height: 1.4; }

/* ── BREADCRUMB ─────────────────────────────────────────────────────────────── */
.breadcrumb { font-size: 14px; font-weight: 500; color: var(--text-secondary); margin-bottom: 16px; }
.breadcrumb a { color: var(--primary); text-decoration: none; font-weight: 600; }
.breadcrumb a:hover { text-decoration: underline; }

/* ── BACK LINK ──────────────────────────────────────────────────────────────── */
.back-link {
  display: inline-flex;
  align-items: center;
  margin-bottom: 10px;
  color: var(--primary);
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  min-height: 36px;
}
.back-link:hover { text-decoration: underline; }

/* ── ABOUT PAGE ─────────────────────────────────────────────────────────────── */
.about-section {
  background: var(--glass-bg);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 18px 20px;
  margin-bottom: 14px;
}
.about-section h3 { font-size: 15px; font-weight: 700; margin-bottom: 10px; color: var(--text); }
.about-section p,
.about-section li { font-size: 14px; line-height: 1.8; color: var(--text-secondary); }
.about-section ul { margin-left: 18px; margin-top: 6px; }

/* ── ERROR STATE ────────────────────────────────────────────────────────────── */
.error-msg {
  background: var(--tier1-bg);
  border: 1.5px solid var(--tier1-color);
  color: #7f0000;
  padding: 18px;
  border-radius: var(--radius);
  margin-top: 32px;
}

/* ── ACCESSIBILITY ──────────────────────────────────────────────────────────── */
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0;
  margin: -1px; overflow: hidden; clip: rect(0,0,0,0);
  white-space: nowrap; border: 0;
}
:focus-visible { outline: 2px solid var(--primary); outline-offset: 3px; box-shadow: var(--glow-primary); }
.diagram-container svg .clickable:focus { outline: 3px solid var(--primary); outline-offset: 3px; }
.diagram-container svg .clickable[tabindex] { cursor: pointer; }

/* ── Rational Override Banner ── */
.bp-override-banner {
  display: flex; gap: 20px; flex-wrap: wrap;
  background: #fff8f8; border: 1.5px solid rgba(183,28,28,0.25);
  border-left: 5px solid var(--tier1-color);
  border-radius: var(--radius); padding: 14px 18px;
  margin-bottom: 18px; box-shadow: var(--shadow-sm);
}
.bp-override-left { flex: 1; min-width: 220px; }
.bp-override-heading {
  display: flex; align-items: center; gap: 8px; margin-bottom: 6px;
}
.bp-override-icon { font-size: 16px; }
.bp-override-title {
  font-size: 13px; font-weight: 800; color: var(--tier1-color); line-height: 1.3;
}
.bp-override-sub {
  font-size: 12px; color: var(--text-secondary); line-height: 1.55;
  margin-bottom: 10px;
}
.bp-override-chips { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 8px; }
.bp-override-chip {
  font-size: 11px; font-weight: 700; padding: 3px 9px;
  background: rgba(183,28,28,0.1); color: var(--tier1-color);
  border: 1px solid rgba(183,28,28,0.3); border-radius: 10px;
}
.bp-override-999 { margin-top: 8px; }
.bp-override-999-label {
  font-size: 10px; font-weight: 800; text-transform: uppercase;
  color: var(--tier1-color); letter-spacing: 0.05em; display: block; margin-bottom: 4px;
}
.bp-override-999-list {
  margin: 0; padding-left: 16px;
  font-size: 12px; color: #7f1111; line-height: 1.6;
}
.bp-override-right {
  flex-shrink: 0; display: flex; flex-direction: column; gap: 6px;
  border-left: 1px solid rgba(183,28,28,0.15); padding-left: 16px;
  min-width: 160px;
}
.bp-override-esc-label {
  font-size: 10px; font-weight: 800; text-transform: uppercase;
  color: var(--text-muted); letter-spacing: 0.05em;
}
.bp-override-links { display: flex; flex-direction: column; gap: 5px; }
.bp-override-link {
  font-size: 12px; font-weight: 600; color: var(--primary);
  text-decoration: none; padding: 4px 8px;
  background: var(--primary-bg); border-radius: var(--radius-sm);
  border: 1px solid rgba(15,94,168,0.15);
  transition: background var(--transition);
}
.bp-override-link:hover { background: #d0e6ff; }

/* ── 4-column grid ── */
.blueprint-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  align-items: start;
}

/* Column card */
.bp-col {
  border-radius: var(--radius);
  border: 1px solid var(--glass-border);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  display: flex; flex-direction: column;
}

/* Column header — distinct accent per column */
.bp-col-header {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 13px 14px 11px;
  border-top: 4px solid transparent;   /* top accent bar */
}
.bp-col-icon { font-size: 18px; flex-shrink: 0; margin-top: 1px; }
.bp-col-header-text { display: flex; flex-direction: column; gap: 2px; }
.bp-col-title { font-size: 13px; font-weight: 800; color: var(--text); line-height: 1.2; }
.bp-col-helper { font-size: 11px; color: var(--text-muted); line-height: 1.45; }

.bp-col-header--history  { background: #F0F6FF; border-top-color: var(--col-lumbar); }
.bp-col-header--redflags { background: #FFF5F5; border-top-color: var(--tier1-color); }
.bp-col-header--diffs    { background: #F8F4FF; border-top-color: var(--col-cervical); }
.bp-col-header--biomech  { background: #F0FBF4; border-top-color: var(--col-knee); }

.bp-col-body { padding: 12px 13px 16px; display: flex; flex-direction: column; gap: 12px; }

/* ── Col 1: Key Questions ── */
.bp-q-group { display: flex; flex-direction: column; gap: 5px; }
.bp-q-group-label {
  font-size: 10px; font-weight: 800; text-transform: uppercase;
  letter-spacing: 0.06em; padding: 2px 0 5px;
  border-bottom: 1px solid var(--border);
}
.bp-q-group-label--t1 { color: var(--tier1-color); border-color: rgba(183,28,28,0.2); }
.bp-q-group-label--t2 { color: #92600a; border-color: rgba(184,120,10,0.2); }
.bp-q-group-label--t3 { color: var(--text-muted); }

.bp-q-row {
  display: flex; align-items: flex-start; gap: 7px;
  padding: 8px 10px; border-radius: var(--radius-sm);
  border-left: 3px solid transparent;
}
.bp-q-row--tier-1 { background: var(--tier1-bg); border-color: var(--tier1-color); }
.bp-q-row--tier-2 { background: #FFFBF2; border-color: #d97706; }
.bp-q-row--tier-3 { background: var(--bg); border-color: #d1d5db; }
.bp-q-icon { font-size: 10px; flex-shrink: 0; margin-top: 3px; }
.bp-q-body { display: flex; flex-direction: column; gap: 4px; }
.bp-q-text { font-size: 12px; line-height: 1.6; color: var(--text); }
.bp-q-tag {
  font-size: 10px; font-weight: 700; color: var(--text-secondary);
  background: rgba(0,0,0,0.06); border-radius: 6px;
  padding: 1px 7px; align-self: flex-start;
}

/* ── Col 2: Red Flags ── */
.bp-flag-group { display: flex; flex-direction: column; gap: 5px; }
.bp-flag-group-label {
  font-size: 10px; font-weight: 800; text-transform: uppercase;
  letter-spacing: 0.05em; padding-bottom: 4px;
  border-bottom: 1px solid var(--border);
}
.bp-flag-group--t1 .bp-flag-group-label { color: var(--tier1-color); border-color: rgba(183,28,28,0.2); }
.bp-flag-group--t2 .bp-flag-group-label { color: #92600a; }
.bp-flag-row {
  display: flex; align-items: flex-start; gap: 8px;
  font-size: 12px; line-height: 1.6; color: var(--text);
  padding: 6px 9px; border-radius: var(--radius-sm);
}
.bp-flag-row--t1 { background: var(--tier1-bg); }
.bp-flag-row--t2 { background: #FFFBF2; }
.bp-flag-dot {
  width: 7px; height: 7px; border-radius: 50%;
  flex-shrink: 0; margin-top: 5px;
}
.bp-flag-row--t1 .bp-flag-dot { background: var(--tier1-color); }
.bp-flag-row--t2 .bp-flag-dot { background: #d97706; }

/* ── Col 3: Differentials ── */
.bp-diff-group { display: flex; flex-direction: column; gap: 5px; }
.bp-diff-group-label {
  font-size: 10px; font-weight: 800; text-transform: uppercase;
  letter-spacing: 0.05em; color: var(--text-muted); padding-bottom: 4px;
  border-bottom: 1px solid var(--border);
}
.bp-diff-row {
  padding: 7px 9px; border-radius: var(--radius-sm);
  border-left: 3px solid transparent;
  display: flex; flex-direction: column; gap: 2px;
}
.bp-diff-row--t1 { border-color: var(--tier1-color); background: var(--tier1-bg); }
.bp-diff-row--t2 { border-color: #d97706; background: #FFFBF2; }
.bp-diff-row--t3 { border-color: #d1d5db; background: var(--bg); }
.bp-diff-row-top { display: flex; align-items: center; gap: 6px; }
.bp-diff-link {
  font-size: 12px; font-weight: 600; color: var(--text);
  text-decoration: none; line-height: 1.4; flex: 1;
}
a.bp-diff-link:hover { color: var(--primary); text-decoration: underline; }
.bp-diff-badge {
  font-size: 9px; font-weight: 800; padding: 1px 5px;
  border-radius: 5px; flex-shrink: 0; line-height: 1.5;
}
.bp-diff-badge--t1 { background: var(--tier1-color); color: #fff; }
.bp-diff-badge--t2 { background: #d97706; color: #fff; }

/* Rationale — collapsed by default */
.bp-diff-rationale-wrap { margin-top: 3px; }
.bp-diff-rationale-toggle {
  font-size: 10px; font-weight: 700; color: var(--text-muted);
  cursor: pointer; list-style: none; -webkit-appearance: none;
  letter-spacing: 0.03em;
}
.bp-diff-rationale-toggle::-webkit-details-marker { display: none; }
.bp-diff-rationale-wrap[open] .bp-diff-rationale-toggle { color: var(--primary); }
.bp-diff-rationale {
  font-size: 11px; color: var(--text-secondary); line-height: 1.55;
  margin: 4px 0 2px; padding-left: 1px;
}

/* ── Col 4: Biomechanical Factors ── */
.bp-bmf-row {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 7px 0; border-bottom: 1px solid var(--border);
}
.bp-bmf-row:last-child { border-bottom: none; }
.bp-bmf-num {
  width: 22px; height: 22px; border-radius: 50%; flex-shrink: 0;
  background: var(--col-knee); color: #fff;
  font-size: 10px; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
  margin-top: 1px;
}
.bp-bmf-text { font-size: 12px; line-height: 1.6; color: var(--text); }
.bp-empty { font-size: 12px; color: var(--text-muted); line-height: 1.5; }

/* ── Cognitive Bias Strip ── */
.bp-bias-strip {
  margin-top: 16px;
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); overflow: hidden;
}
.bp-bias-summary {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 14px; cursor: pointer; list-style: none;
  -webkit-appearance: none; user-select: none;
  background: #F8F9FB;
}
.bp-bias-summary::-webkit-details-marker { display: none; }
.bp-bias-icon { font-size: 14px; flex-shrink: 0; }
.bp-bias-title { font-size: 12px; font-weight: 700; color: var(--text-secondary); flex: 1; }
.bp-bias-count {
  font-size: 11px; color: var(--text-muted);
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 10px; padding: 1px 8px;
}
.bp-bias-body {
  padding: 10px 14px 12px; display: flex; flex-direction: column; gap: 8px;
  border-top: 1px solid var(--border);
}
.bp-bias-row {
  display: flex; align-items: flex-start; gap: 10px;
}
.bp-bias-dot {
  width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0;
  background: var(--col-cervical); margin-top: 5px;
}
.bp-bias-text { font-size: 13px; line-height: 1.6; color: var(--text); }

/* ── Blueprint responsive ── */
@media (max-width: 1100px) {
  .blueprint-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
}
@media (max-width: 767px) {
  .blueprint-page { padding: 10px 12px 80px; }
  .blueprint-grid { grid-template-columns: 1fr; gap: 10px; }
  .blueprint-title { font-size: 18px; }
  .bp-override-banner { flex-direction: column; gap: 12px; }
  .bp-override-right { border-left: none; padding-left: 0; border-top: 1px solid rgba(183,28,28,0.15); padding-top: 10px; }
}

/* ── Markdown content elements ── */
.is-para {
  font-size: 13.5px; color: var(--text);
  margin: 0 0 10px;
  line-height: 1.65;
}
.is-list {
  margin: 0 0 10px;
  padding-left: 18px;
}
.is-list li {
  font-size: 13.5px; color: var(--text);
  margin-bottom: 5px;
  line-height: 1.6;
}
.is-subheading {
  font-size: 13px; font-weight: 700;
  color: var(--text-secondary);
  margin: 14px 0 6px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--border);
  text-transform: uppercase; letter-spacing: 0.03em;
}
.is-empty {
  color: var(--text-muted); font-style: italic; font-size: 13px;
}
.is-table {
  width: 100%; border-collapse: collapse;
  font-size: 12.5px; margin-bottom: 12px;
  overflow-x: auto; display: block;
}
.is-table th {
  background: var(--bg);
  font-weight: 600; color: var(--text-secondary);
  padding: 6px 10px; text-align: left;
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
}
.is-table td {
  padding: 6px 10px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  vertical-align: top;
  line-height: 1.5;
}
.is-table tr:last-child td { border-bottom: none; }
.is-table tr:nth-child(even) td { background: var(--bg); }

/* ── Blueprint differential script link ── */
.bp-diff-script-link {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  margin-left: 6px;
  padding: 1px 7px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  font-size: 11px; font-weight: 500;
  text-decoration: none;
  transition: var(--transition);
  white-space: nowrap;
  vertical-align: middle;
}
.bp-diff-script-link:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-bg);
}

/* ── GLOBAL: typography tightening ──────────────────────────────────────── */
.source-cite { font-size: 12px; color: var(--text-muted); }
.badge-home-region {
  font-size: 11px;
  padding: 2px 9px;
  border-radius: 10px;
}

/* Increase card border-radius globally */
.card, .about-section, .med-section, .pres-section,
.pres-diff-row, .checklist-item {
  border-radius: var(--radius);
}
.chip { border-radius: 99px; }

/* Standardise page bottom padding for bottom nav */
.page, .page-wide, .home-page, .conditions-page {
  padding-bottom: calc(72px + env(safe-area-inset-bottom, 0px));
}

/* ── Sticky offset variables ───────────────────────────────────────────────
   --section-sticky-offset: plain px value (not calc) so JS can parseFloat it.
   Equals: --nav-height (48px) + anchor-nav height (~52px) + 8px gap = 108px.
   Mobile ≤767px adds a little extra for potential chip-wrap.
   ───────────────────────────────────────────────────────────────────────── */
:root {
  --anchor-nav-height: 52px;
  --section-sticky-offset: 108px;
}
@media (max-width: 767px) {
  :root { --section-sticky-offset: 120px; }
}
@media (max-width: 480px) {
  :root { --section-sticky-offset: 136px; }
}

/* Every anchor-nav target — scroll-margin-top for keyboard/programmatic focus */
.cond-section {
  scroll-margin-top: var(--section-sticky-offset);
}

/* ══════════════════════════════════════════════════════════════════════════
   v2.23 — Tree header compression + Condition-page shell finish
   ══════════════════════════════════════════════════════════════════════════ */

