/* ── CONDITION SEARCH ───────────────────────────────────────────────────────── */
.condition-search-wrap { margin-bottom: 14px; }
.condition-search-input {
  width: 100%;
  max-width: 400px;
  padding: 9px 14px;
  font-size: 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  outline: none;
  color: var(--text);
}
.condition-search-input:focus { border-color: var(--primary); box-shadow: var(--glow-primary); }

/* ── CONDITION LINKS (tree / checklist pages) ───────────────────────────────── */
.condition-links {
  display: flex; align-items: center; flex-wrap: wrap;
  gap: 8px; margin: 12px 0 16px;
}
.condition-links-label { font-size: 13px; font-weight: 600; color: var(--text-muted); }
.condition-link {
  display: inline-block;
  padding: 4px 12px;
  background: var(--primary-bg);
  color: var(--primary);
  border: 1px solid #b3d0f0;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.15s;
}
.condition-link:hover { background: #c5d8fb; }

/* ── CONDITION DETAIL PAGE ──────────────────────────────────────────────────── */
.condition-backlinks {
  display: flex; align-items: center; flex-wrap: wrap;
  gap: 8px; margin-bottom: 20px;
}
.condition-backlinks-label { font-size: 13px; font-weight: 600; color: var(--text-muted); }
.condition-backlink {
  display: inline-block;
  padding: 4px 12px;
  background: var(--primary-bg);
  color: var(--primary);
  border: 1px solid #b3d0f0;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.15s;
}
.condition-backlink:hover { background: #c5d8fb; }

.cond-section {
  margin: 14px 0;
  padding: 14px 18px;
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  border-left-width: 3px;
  border-left-color: var(--border);
}
.cond-section-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 10px;
}
.cond-list {
  list-style: none; padding: 0; margin: 0;
  display: flex; flex-direction: column; gap: 6px;
}
.cond-list li {
  font-size: 14px; line-height: 1.55;
  padding-left: 16px; position: relative;
  color: var(--text-secondary);
}
.cond-list li::before { content: '–'; position: absolute; left: 0; color: var(--border); }

/* Section accent colours */
.cond-redflags { border-left-color: var(--tier1-color); background: #fff8f8; }
.cond-redflags .cond-section-title { color: var(--tier1-color); }
.cond-redflags li { color: #7f0000; }

.cond-neuro { border-left-color: var(--primary); }
.cond-neuro .cond-section-title { color: var(--primary); }

.cond-diffs { border-left-color: #4a148c; }
.cond-diffs .cond-section-title { color: #4a148c; }

.cond-safety { border-left-color: #e65100; }
.cond-safety .cond-section-title { color: #e65100; }

.cond-sources { border-left-color: var(--border); }
.cond-sources .cond-section-title { color: var(--text-muted); }
.cond-sources li { font-size: 13px; }

/* ── CONDITION GROUP DESCRIPTION ────────────────────────────────────────────── */
.cond-group-desc {
  font-size: 13px; color: var(--text-muted);
  margin: 2px 0 14px; line-height: 1.55;
  padding-left: 12px;
  border-left: 2px solid var(--border);
}

/* ── CONDITION SUB-GROUPS (regional anatomy) ─────────────────────────────────── */
.cond-subgroup {
  margin-top: 18px;
  /* <details> reset */
  list-style: none;
}
.cond-subgroup[open] > .cond-subgroup-note,
.cond-subgroup[open] > .cond-group-grid,
.cond-subgroup[open] > .masq-list { display: block; }

/* <summary> as the styled header — remove default triangle */
.cond-subgroup-header {
  display: flex; align-items: center; gap: 7px;
  padding: 7px 12px;
  border-radius: 6px;
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.05em; color: var(--text-muted);
  background: var(--bg);
  border: 1px solid var(--border);
  margin-bottom: 0;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  list-style: none; /* Firefox */
}
.cond-subgroup-header::-webkit-details-marker { display: none; } /* Chrome/Safari */
.cond-subgroup-header::marker { display: none; }

/* Chevron indicator */
.cond-subgroup-header::after {
  content: '▾';
  font-size: 11px;
  opacity: 0.5;
  margin-left: 4px;
  transition: transform 0.2s ease;
  display: inline-block;
}
.cond-subgroup[open] > .cond-subgroup-header::after {
  transform: rotate(180deg);
}

/* Spacing only when open */
.cond-subgroup[open] > .cond-subgroup-header { margin-bottom: 10px; border-radius: 6px 6px 0 0; }

.cond-subgroup-icon { font-size: 14px; }
.cond-subgroup-count {
  margin-left: auto;
  font-size: 10px; font-weight: 600;
  color: var(--text-muted);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1px 6px;
}

/* Referral sub-group — blue theme */
.cond-subgroup-referral > .cond-subgroup-header {
  color: #2c5282; background: #EBF4FF; border-color: #bee3f8;
}
.cond-subgroup-referral .cond-subgroup-count { color: #2c5282; border-color: #bee3f8; }

/* Masquerader sub-group — muted slate theme (softened from amber) */
.cond-subgroup-masquerader > .cond-subgroup-header {
  color: #5a6478; background: var(--bg); border-color: var(--border);
}
.cond-subgroup-masquerader .cond-subgroup-count { color: #5a6478; border-color: var(--border); }

.cond-subgroup-note {
  font-size: 12px; color: var(--text-muted);
  margin: 0 0 10px; line-height: 1.5;
  padding: 0 2px;
}

/* Referral condition card — subtle blue tint */
.card-referral {
  background: rgba(235, 244, 255, 0.85);
  border-color: #bee3f8;
}
.card-referral:hover { border-color: #90cdf4; box-shadow: var(--shadow-md), 0 0 0 3px rgba(44,82,130,0.08); }

/* ── MASQUERADER ITEMS (homepage) ────────────────────────────────────────────── */
.masq-list { display: flex; flex-direction: column; gap: 7px; }
.masq-item {
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--border);
}
.masq-item-tier1 { border-left-color: var(--tier1-color); background: rgba(254, 236, 236, 0.65); }
.masq-item-tier2 { border-left-color: #e65100; background: rgba(255, 243, 224, 0.65); }
.masq-item-tier3 { border-left-color: var(--primary); }

.masq-item-body { display: flex; flex-direction: column; gap: 3px; }
.masq-item-top {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 8px; flex-wrap: wrap;
}
.masq-item-label { font-size: 14px; font-weight: 700; color: var(--text); line-height: 1.35; }
.masq-item-chips { display: flex; gap: 4px; flex-wrap: wrap; flex-shrink: 0; }
.masq-item-note { font-size: 12px; color: var(--text-secondary); line-height: 1.5; margin: 0; }

/* ── CONDITIONS PAGE HEADER ──────────────────────────────────────────────────── */
.conditions-page-header { margin-bottom: 14px; }

/* ── Condition page quick-link row ────────────────────────────────────────── */
.condition-quick-links {
  display: flex; flex-direction: column; gap: 8px;
  margin-top: 14px;
}

/* Illness Script entry button */
.is-script-entry-btn {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--primary);
  background: var(--primary-bg);
  color: var(--primary);
  font-size: 13px; font-weight: 600;
  text-decoration: none;
  transition: var(--transition);
}
.is-script-entry-btn:hover { background: var(--primary); color: #fff; }
.is-script-entry-icon  { font-size: 16px; flex-shrink: 0; }
.is-script-entry-label { font-weight: 700; flex: 1; }
.is-script-entry-sub   { font-size: 11px; font-weight: 400; opacity: 0.75; }
.is-script-entry-arrow { font-size: 18px; font-weight: 300; margin-left: auto; opacity: 0.7; }

/* Condition → Blueprint entry button (reverse lookup) */
.condition-blueprint-btn {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  border: 1.5px solid rgba(15, 94, 168, 0.35);
  background: var(--primary-bg);
  color: var(--primary);
  font-size: 13px; font-weight: 600;
  text-decoration: none;
  transition: var(--transition);
}
.condition-blueprint-btn:hover { background: var(--primary); color: #fff; }
.condition-blueprint-icon { font-size: 16px; flex-shrink: 0; }
.condition-blueprint-label { flex: 1; font-weight: 700; }
.condition-blueprint-sub { font-size: 11px; font-weight: 400; opacity: 0.75; }
.condition-blueprint-arrow { font-size: 18px; font-weight: 300; margin-left: auto; opacity: 0.7; }

/* ── ANCHOR NAVIGATION — condition pages ─────────────────────────────────── */
/* v2.45 — sticky bar + fade affordance live on the wrapper; the nav itself is the scroller */
.anchor-nav-wrap {
  position: sticky;
  top: var(--nav-height, 48px);
  z-index: 10;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  margin-bottom: 14px;
}
.anchor-nav-wrap::before,
.anchor-nav-wrap::after {
  content: ''; position: absolute; top: 0; bottom: 1px; width: 30px;
  pointer-events: none; opacity: 0; transition: opacity 0.15s ease; z-index: 2;
}
.anchor-nav-wrap::after  { right: 0; background: linear-gradient(to right, rgba(255,255,255,0), var(--surface)); }
.anchor-nav-wrap::before { left: 0;  background: linear-gradient(to left,  rgba(255,255,255,0), var(--surface)); }
.anchor-nav-wrap.has-overflow:not(.at-end)::after    { opacity: 1; }
.anchor-nav-wrap.has-overflow:not(.at-start)::before  { opacity: 1; }
.anchor-nav {
  display: flex;
  flex-wrap: nowrap;            /* v2.42 — single row, never wraps */
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  scroll-snap-type: x proximity;
  scroll-padding-inline-start: 12px;  /* v2.45 — tabs don't sit hard against the start edge */
  scroll-padding-inline-end: 34px;    /* v2.54 — snapped tab clears the 30px trailing fade mask */
  gap: 4px;
  padding: 5px 0;
  /* v2.54 — MUST come after the `padding` shorthand or it gets reset to 0 (latent bug since v2.51) */
  padding-inline-end: 34px;           /* trailing breath so last tab fully clears the fade (was silently 0) */
}
.anchor-nav::-webkit-scrollbar { display: none; }
.anchor-nav a,
.anchor-nav__link {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--primary);
  text-decoration: none;
  padding: 4px 9px;
  min-height: 32px;            /* v4.42 — compact bar; mobile tightens further */
  flex-shrink: 0;             /* never compress — labels keep natural width */
  scroll-snap-align: start;
  display: inline-flex;
  align-items: center;
  border-radius: 6px;
  border: 1px solid var(--primary-bg);
  white-space: nowrap;
}
.anchor-nav a:hover,
.anchor-nav__link:hover { background: var(--primary-bg); }
.anchor-nav__link {
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
}

/* ── Condition page shell ────────────────────────────────────────────────── */
.cond-page { max-width: 780px; }

/* Page header */
.cond-page-hd {
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}
.cond-back-link {
  display: inline-flex;
  align-items: center;
  font-size: 13px;
  font-weight: 600;
  color: var(--primary);
  text-decoration: none;
  margin-bottom: 10px;
  min-height: 36px;
}
.cond-back-link:hover { text-decoration: underline; }
.cond-hd-badges {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.cond-hd-title {
  font-size: 24px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.025em;
  line-height: 1.2;
  margin: 0 0 14px;
}

/* CTA action group */
.cond-cta-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}
.cond-cta-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--text-secondary);
  transition: background var(--transition), border-color var(--transition), color var(--transition);
  min-height: 36px;
  white-space: nowrap;
}
.cond-cta-btn:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-bg); }
.cond-cta-btn--bp {
  background: var(--primary-bg);
  border-color: var(--primary);
  color: var(--primary);
}
.cond-cta-btn--bp:hover { background: var(--primary); color: #fff; }
.cond-cta-btn--pres { border-color: rgba(15, 94, 168, 0.3); }

/* Related pathway chips row */
.cond-pathway-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.cond-pathway-row-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  flex-shrink: 0;
}
.cond-pathway-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 20px;
  background: var(--primary-bg);
  border: 1px solid rgba(15, 94, 168, 0.2);
  color: var(--primary);
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
  transition: background var(--transition);
}
.cond-pathway-chip:hover { background: #c5d8fb; }

.cond-source-cite {
  font-size: 11.5px;
  color: var(--text-muted);
  margin: 4px 0 0;
  line-height: 1.5;
}

/* ── Condition sections — enhanced card treatment ──────────────────────── */
.cond-section {
  margin: var(--sp-5) 0;
  padding: var(--sp-5) var(--sp-5);
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  border-left-width: 4px;
  border-left-color: var(--border);
  box-shadow: var(--shadow-sm);
}
/* v2.55 Phase 4 — section title becomes a real heading with a leading accent,
   so sections read as distinct layers instead of a flat stack of equal blocks. */
.cond-section-title {
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
  margin-bottom: var(--sp-3);
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}
.cond-section-title::before {
  content: "";
  width: 3px; height: 15px; border-radius: 2px;
  background: var(--border);
  flex-shrink: 0;
}
/* Inline variant (used inside details summary) */
.cond-section-title--inline { margin-bottom: 0; }
.cond-section-title--inline::before { display: none; }

/* ── v2.55 Phase 4 — VISUAL TIERS (applied by section id; works on condition + presentation) ──
   Risk > Reasoning > Reference. Elevation + accent + title colour establish the layers. */

/* Reasoning tier — primary thinking surfaces: lifted, reasoning-blue accent */
#key-questions.cond-section,
#differentials.cond-section,
#related-tools.cond-section,
#reasoning.cond-section,
#illness-script.cond-section {
  border-left-color: var(--reasoning);
  box-shadow: var(--shadow-md);
}
#key-questions .cond-section-title,
#differentials .cond-section-title,
#related-tools .cond-section-title,
#reasoning .cond-section-title,
#illness-script .cond-section-title { color: var(--reasoning); }
#key-questions .cond-section-title::before,
#differentials .cond-section-title::before,
#related-tools .cond-section-title::before,
#reasoning .cond-section-title::before,
#illness-script .cond-section-title::before { background: var(--reasoning); }

/* Reference tier — supporting lookups: flat, calm, recede behind reasoning */
#medications.cond-section,
#neuro.cond-section,
#safety-net.cond-section,
#short-term-plan.cond-section,
#long-term-plan.cond-section,
#pres-med-background.cond-section,
.cond-sources.cond-section {
  box-shadow: none;
  background: var(--surface-sunken);
}
.cond-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.cond-list li {
  font-size: 15px;
  line-height: 1.65;
  color: var(--text-secondary);
  padding-left: 16px;
  position: relative;
}
.cond-list li::before { content: '–'; position: absolute; left: 0; color: var(--border); }

/* Section accent colours */
.cond-redflags {
  border-left-color: var(--tier1-color);
  background: #fff8f8;
  padding: 0;
  border: none;
  box-shadow: none;
}
.cond-redflags .warning-callout {
  margin: 0;
  background: var(--risk-bg);          /* v2.54 — stronger risk tint (was faint #fff8f8) */
  border-left-color: var(--risk);
  border-left-width: 5px;
  border-top: 1px solid rgba(183,28,28,0.18);
  border-right: 1px solid rgba(183,28,28,0.18);
  border-bottom: 1px solid rgba(183,28,28,0.18);
  box-shadow: var(--shadow-sm);        /* v2.54 — subtle lift signals highest-stakes section */
}
.cond-redflags .warning-callout__label { color: var(--tier1-color); }
.cond-redflags .warning-callout__list  { color: #7f1111; }
.cond-redflags .warning-callout__list li::before { color: rgba(183,28,28,0.45); }
.cond-neuro { border-left-color: var(--primary); }
.cond-neuro .cond-section-title { color: var(--primary); }
.cond-neuro .cond-list li { color: #1a237e; }
.cond-diffs { border-left-color: #7c3aed; background: #faf5ff; }
.cond-diffs .cond-section-title { color: #5b21b6; }
.cond-safety { border-left-color: #d97706; background: #fffbeb; }
.cond-safety .cond-section-title { color: #92400e; }
.cond-plan-short { border-left-color: #15803d; background: #f0fdf4; }
.cond-plan-short .cond-section-title { color: #15803d; }
.cond-plan-long { border-left-color: #0e7490; background: #f0fdff; }
.cond-plan-long .cond-section-title { color: #0e7490; }
.cond-sources { border-left-color: var(--border); }
.cond-sources .cond-section-title { color: var(--text-muted); }

/* Illness script block inside condition page */
.cond-script-block {
  border-left-color: #0e7490;
  background: #f0fdff;
}
.cond-script-block .cond-section-title { color: #0e7490; }
.cond-script-hint {
  font-size: 12px;
  color: var(--text-muted);
  margin: -4px 0 10px;
  font-style: normal;
}

/* Related presentations section (details element) */
.cond-related {
  border-left-color: var(--primary);
  background: var(--primary-bg);
}
.cond-section-summary {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  list-style: none;
  user-select: none;
  -webkit-user-select: none;
  min-height: 44px;
}
.cond-section-summary::-webkit-details-marker { display: none; }
details.cond-section[open] .cond-section-summary::after { content: '▲'; font-size: 9px; opacity: 0.4; margin-left: auto; }
details.cond-section:not([open]) .cond-section-summary::after { content: '▼'; font-size: 9px; opacity: 0.4; margin-left: auto; }

.cond-count-badge {
  font-size: 11px;
  font-weight: 700;
  background: rgba(15, 94, 168, 0.12);
  color: var(--primary);
  border-radius: 10px;
  padding: 1px 7px;
}

/* Presentation chips inside related section */
.cond-pres-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding-top: 10px;
}
.cond-pres-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 13px;
  border-radius: 99px;
  background: var(--surface);
  border: 1.5px solid rgba(15, 94, 168, 0.25);
  color: var(--primary);
  font-size: 12.5px;
  font-weight: 600;
  text-decoration: none;
  transition: background var(--transition), border-color var(--transition);
  min-height: 36px;
}
.cond-pres-chip:hover { background: var(--primary); color: #fff; border-color: var(--primary); }

/* Bottom action bar */
.cond-bottom-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 20px 0 8px;
  border-top: 1px solid var(--border);
  margin-top: 16px;
}

/* ── Mobile: condition page ──────────────────────────────────────────────── */
@media (max-width: 767px) {
  /* Header vertical spacing — reduce wasted space before first content */
  .cond-back-link  { margin-bottom: 6px; }
  .cond-hd-badges  { margin-bottom: 5px; }
  .cond-hd-title   { font-size: 20px; margin-bottom: 10px; }
  .cond-cta-group  { gap: 6px; margin-bottom: 8px; }

  /* Anchor nav — tighter before first section */
  .anchor-nav { padding: 7px 0; }
  .anchor-nav-wrap { margin-bottom: 10px; }

  /* Warning callout — match section padding on mobile (fixes padding mismatch with other sections) */
  .warning-callout { padding: 12px 14px; }

  /* Section cards */
  .cond-cta-btn { font-size: 12.5px; padding: 7px 11px; }
  .cond-section { padding: 12px 14px; margin: 8px 0; }
  /* v2.35a/v2.35b — presentation pages only: trim the page gutter and section side
     padding so content sits wider (closer to hero text width) and feels less boxed-in
     on mobile. The 4px section accent border is kept so hierarchy is preserved. */
  .pres-detail-page { padding-left: 10px; padding-right: 10px; }
  .pres-detail-page .cond-section { padding-left: 6px; padding-right: 6px; }
  .cond-list li { font-size: 14.5px; }
  /* Sources: quieter on mobile */
  .cond-sources { padding: 8px 12px; }
  .cond-sources .cond-section-title { font-size: 10.5px; }
  .cond-pres-chips { gap: 6px; }
  .cond-pres-chip { font-size: 12px; padding: 5px 11px; }
  .cond-bottom-bar { padding: 16px 0 4px; }
}

/* ══════════════════════════════════════════════════════════════════════════
   v2.23a — Sticky anchor-nav scroll-offset fix
   Root cause: .anchor-nav is position:sticky at top:48px (~52px tall).
   scrollIntoView() lands targets at top:0 — hidden under the sticky stack.
   Fix: scroll-margin-top on every .cond-section so scrollIntoView accounts
   for the full sticky stack: --nav-height (48px) + anchor-nav (52px) + 8px gap.
   ══════════════════════════════════════════════════════════════════════════ */

/* ── Condition: CTA button hierarchy ───────────────────────────────────── */

/* All Conditions → ghost (lowest emphasis) */
.cond-cta-btn--conds {
  background: transparent;
  border-color: var(--border);
  color: var(--text-secondary);
  font-weight: 500;
}
.cond-cta-btn--conds:hover {
  border-color: var(--text-muted);
  color: var(--text);
  background: var(--bg);
}

/* Presentations → secondary (blue-tinted, not filled) */
.cond-cta-btn--pres {
  border-color: rgba(15, 94, 168, 0.4);
  color: var(--primary);
  background: var(--primary-bg);
}
.cond-cta-btn--pres:hover {
  background: rgba(15, 94, 168, 0.14);
  border-color: var(--primary);
}

/* ── Condition: tighter header card ────────────────────────────────────── */
.cond-page-hd {
  margin-bottom: 16px;
  padding-bottom: 14px;
}

/* Source cite inside header: visually de-emphasised */
.cond-source-cite {
  font-size: 11px;
  color: var(--text-muted);
  margin: 2px 0 0;
}

/* ── Phase 1C — Medication context block ───────────────────────────────── */
.cond-med-context {
  border-left-color: #B45309;
  background: #FFFDF5;
}
.cond-med-context .cond-section-title { color: #92400E; }
.cond-med-link {
  display: inline-block;
  margin-top: 10px;
  font-size: 12px; font-weight: 600;
  color: var(--primary);
  text-decoration: none;
}
.cond-med-link:hover { text-decoration: underline; }



/* ════════════════════════════════════════════════════════════════════════════
   v2.58 : conditions ledger (dense rows; replaces the card grid)
   ════════════════════════════════════════════════════════════════════════════ */
.cond-ledger {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.cond-row {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 10px 7px 12px;
  min-height: 46px;
  border-bottom: 1px solid var(--border);
  border-left: 3px solid transparent;
  text-decoration: none;
  transition: background var(--transition);
}
.cond-ledger > .cond-row:last-child { border-bottom: none; }
a.cond-row:hover { background: var(--primary-bg); }
a.cond-row:hover .cond-row__name { color: var(--primary); }
.cond-row__main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.cond-row__name { font-size: 14px; font-weight: 600; color: var(--text); line-height: 1.35; }
.cond-row__cat  { font-size: 11.5px; color: var(--text-muted); line-height: 1.45; }
.cond-row__chev { color: var(--text-muted); font-size: 15px; flex-shrink: 0; }
.cond-row--t1 { border-left-color: var(--tier1-color); }
.cond-row__t1, .cond-row__t2 {
  font-size: 9.5px; font-weight: 800; flex-shrink: 0;
  color: #fff; border-radius: 5px; padding: 2px 6px;
  background: var(--tier1-color);
  align-self: center;
}
.cond-row__t2 { background: #d97706; }
.cond-row--masq { cursor: default; }
.cond-row--masq-t1 { border-left-color: var(--tier1-color); background: #FFF8F8; }
.cond-row--masq-t2 { border-left-color: #d97706; }
.cond-row--masq .pres-badge { margin-left: 6px; vertical-align: 1px; }

/* Subgroups (referral / masqueraders) as ledger sections */
.cond-ledger .cond-subgroup {
  border-bottom: 1px solid var(--border);
  background: var(--surface-sunken);
  margin: 0; border-left: none; border-right: none; border-top: none;
  border-radius: 0; box-shadow: none;
}
.cond-ledger .cond-subgroup:last-child { border-bottom: none; }
.cond-ledger .cond-subgroup-header {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 12px; min-height: 42px;
  cursor: pointer; list-style: none; -webkit-appearance: none;
  font-size: 12px; font-weight: 700; color: var(--text-secondary);
}
.cond-ledger .cond-subgroup-header::-webkit-details-marker { display: none; }
.cond-ledger .cond-subgroup[open] .cond-subgroup-header { color: var(--primary); }
.cond-ledger .cond-subgroup-count {
  margin-left: auto;
  font-size: 11px; font-weight: 700; color: var(--text-muted);
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 99px; padding: 1px 8px;
}
.cond-ledger .cond-subgroup-note {
  font-size: 11.5px; color: var(--text-muted);
  padding: 0 12px 8px; margin: 0; line-height: 1.5;
}
.cond-ledger--sub {
  border: none; border-radius: 0; box-shadow: none;
  border-top: 1px solid var(--border);
  background: var(--surface);
}
.cond-ledger--sub .cond-row:last-child { border-bottom: none; }


/* Ledger context: flatten the legacy boxed subgroup headers */
.cond-ledger .cond-subgroup-header,
.cond-ledger .cond-subgroup-referral > .cond-subgroup-header,
.cond-ledger .cond-subgroup-masquerader > .cond-subgroup-header {
  background: transparent; border: none; border-radius: 0; margin-bottom: 0;
}
.cond-ledger .cond-subgroup[open] > .cond-subgroup-header {
  margin-bottom: 0; border-radius: 0;
}


/* Mobile: group header wraps below the name, never mid-name */
@media (max-width: 480px) {
  .cond-group-header { flex-wrap: wrap; row-gap: 3px; }
  .cond-group-name { white-space: nowrap; flex: 1 1 auto; }
}

/* ── STRUCTURED MANAGEMENT PLAN ────────────────────────────────────────────── */
.cond-mgmt-plan {
  border-left-color: #0f766e; /* Teal-700 */
  background: #f0fdfa; /* Teal-50 */
}
.cond-mgmt-plan .cond-section-title {
  color: #0f766e;
}
.cond-mgmt-plan .cond-section-title::before {
  background: #0f766e;
}

.mgmt-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 12px;
}

@media (max-width: 767px) {
  .mgmt-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }
}

.mgmt-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.mgmt-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md, 0 4px 6px -1px rgba(0,0,0,0.1));
}

.mgmt-card-title {
  font-size: 11.5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border);
  padding-bottom: 6px;
  margin: 0;
}

.mgmt-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.mgmt-list li {
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--text-secondary);
  padding-left: 14px;
  position: relative;
}

.mgmt-list li::before {
  content: '–';
  position: absolute;
  left: 0;
  color: var(--text-muted);
}

.mgmt-text {
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--text-secondary);
  margin: 0;
}

/* Accent top borders for cards */
.mgmt-card--short { border-top: 3px solid #16a34a; }     /* Green */
.mgmt-card--long { border-top: 3px solid #0284c7; }      /* Sky Blue */
.mgmt-card--sessions { border-top: 3px solid #7c3aed; }  /* Purple */
.mgmt-card--self { border-top: 3px solid #ea580c; }      /* Orange */
.mgmt-card--milestones { border-top: 3px solid #0891b2; }/* Cyan */
.mgmt-card--escalation { border-top: 3px solid #dc2626; }/* Red */

.mgmt-sessions-badge {
  background: var(--bg);
  border-radius: 4px;
  padding: 8px;
  border: 1px dashed var(--border);
}

