:root {
  --bg: #f3f8fb;
  --panel: #ffffff;
  --ink: #173146;
  --muted: #65798c;
  --blue: #1d72a7;
  --blue-dark: #0f527d;
  --blue-soft: #e8f5fb;
  --green-soft: #edf8f1;
  --gold: #d8ac40;
  --gold-soft: #fff8e6;
  --urgent: #a31818;
  --urgent-soft: #fff1f1;
  --warning: #8a5700;
  --border: #d9e8f0;
  --shadow: 0 16px 45px rgba(22, 73, 106, .10);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 18% 0%, rgba(29, 114, 167, .16), transparent 28%),
    linear-gradient(180deg, #eef8fc 0%, var(--bg) 48%, #ffffff 100%);
  line-height: 1.55;
}

a { color: var(--blue-dark); font-weight: bold; }
button, input, select { font: inherit; }
button { cursor: pointer; }

.eh-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 30px 0 56px;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 420px);
  gap: 24px;
  align-items: stretch;
  margin-bottom: 18px;
}
.hero-copy {
  background: rgba(255,255,255,.68);
  border: 1px solid rgba(217,232,240,.9);
  border-radius: 26px;
  padding: clamp(24px, 4vw, 42px);
  box-shadow: var(--shadow);
}
.eyebrow, .step {
  margin: 0 0 8px;
  text-transform: uppercase;
  letter-spacing: .12em;
  font-weight: 800;
  color: var(--blue-dark);
  font-size: .78rem;
}
h1, h2, h3 { line-height: 1.14; color: var(--ink); }
h1 {
  margin: 0;
  font-size: clamp(2.25rem, 5vw, 4.15rem);
  letter-spacing: -.04em;
}
h2 { margin: 0 0 12px; font-size: clamp(1.35rem, 2vw, 1.75rem); }
h3 { margin: 18px 0 10px; }
.lead {
  max-width: 740px;
  color: var(--muted);
  font-size: 1.12rem;
  margin: 14px 0 0;
}
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 24px; }
.soft-link {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  background: var(--blue);
  color: #fff;
  padding: 11px 16px;
  border-radius: 999px;
}
.secondary-link { background: var(--blue-soft); color: var(--blue-dark); border: 1px solid #b9d7e7; }

.safety-card, .panel, .footer-note, .trust-row article {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 22px;
  box-shadow: var(--shadow);
}
.safety-card {
  padding: 22px;
  border-left: 6px solid var(--gold);
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.safety-card p { margin: 8px 0 0; color: #4f5e6a; }

.trust-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin: 18px 0 24px;
}
.trust-row article { padding: 16px; }
.trust-row strong { display: block; font-size: 1.25rem; color: var(--blue-dark); }
.trust-row span { color: var(--muted); font-size: .92rem; }

.layout-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 22px;
  align-items: start;
}
.panel, .footer-note {
  padding: 22px;
  margin-bottom: 22px;
}
.panel-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
}
.grid.fields {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin: 12px 0 8px;
}
label {
  display: block;
  font-weight: 800;
  margin-bottom: 16px;
}
.optional { font-weight: normal; color: var(--muted); font-size: .85rem; }
select, input[type="search"] {
  width: 100%;
  margin-top: 7px;
  border: 1px solid #b8ccd9;
  border-radius: 14px;
  padding: 12px 13px;
  font-size: 1rem;
  color: var(--ink);
  background: #fff;
}
select:focus, input:focus, button:focus-visible {
  outline: 3px solid rgba(29,114,167,.22);
  outline-offset: 2px;
}
.search-label { margin-top: 16px; }
.helper-row {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin: 8px 0 16px;
}
.primary, .secondary, .text-button, .az-btn, .chip, .result-item, .area-btn {
  border-radius: 999px;
}
.primary {
  border: none;
  background: var(--blue);
  color: #fff;
  padding: 13px 20px;
  font-weight: 800;
  width: 100%;
  margin-top: 16px;
}
.primary:hover { background: var(--blue-dark); }
.secondary {
  border: 1px solid #a8cfe3;
  color: var(--blue-dark);
  background: var(--blue-soft);
  padding: 9px 14px;
  font-weight: 800;
}
.text-button {
  border: 1px solid var(--border);
  background: #fff;
  color: var(--blue-dark);
  padding: 8px 12px;
  font-weight: 800;
}
.text-button:hover, .secondary:hover, .az-btn:hover, .area-btn:hover { background: #dff0f8; }
.muted { color: var(--muted); }
.small-note { color: var(--muted); font-size: .92rem; margin-bottom: 0; }

.browse-panel {
  background: #f8fcfe;
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 14px;
  margin: 12px 0 18px;
}
.browse-panel h3 { margin-top: 0; }
.body-areas {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 9px;
}
.area-btn {
  border: 1px solid var(--border);
  background: #fff;
  color: var(--ink);
  text-align: left;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.area-btn small { color: var(--muted); }
.az {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-bottom: 18px;
}
.az-btn {
  border: 1px solid var(--border);
  background: #fff;
  color: var(--blue-dark);
  padding: 7px 10px;
  font-weight: 800;
  min-width: 35px;
}
.search-results {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 10px;
  margin-top: 12px;
}
.result-item {
  border: 1px solid var(--border);
  padding: 13px;
  background: #fbfdff;
  color: var(--ink);
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 7px;
  min-height: 78px;
}
.result-item:hover, .result-item.is-selected {
  background: var(--green-soft);
  border-color: #9bcfae;
}
.result-meta { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.result-item small { color: var(--muted); font-size: .82rem; }
.result-item em {
  color: #277444;
  background: #e6f5eb;
  border-radius: 999px;
  padding: 2px 7px;
  font-size: .78rem;
  font-style: normal;
  font-weight: 800;
}
.empty-state { padding: 12px; background: #f8fbfd; border-radius: 14px; }

.selected-panel { position: sticky; top: 14px; }
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 36px;
}
.chip {
  border: 1px solid #b9d9ea;
  background: var(--blue-soft);
  color: var(--blue-dark);
  padding: 8px 12px;
  font-weight: 800;
}
.chip span { padding-left: 4px; }

.warning, .disclaimer, .urgent-box {
  border-radius: 16px;
  padding: 13px 14px;
}
.warning {
  color: var(--warning);
  background: #fff7e6;
  border: 1px solid #efcf8c;
}
.disclaimer {
  background: var(--gold-soft);
  border: 1px solid var(--gold);
  color: #5f4300;
}
.urgent-box {
  background: var(--urgent-soft);
  border: 1px solid #eba0a0;
  color: #6b0f0f;
  margin-bottom: 12px;
}
.urgent-box p { margin: 6px 0; }
.summary-bar {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
  flex-wrap: wrap;
  background: #f7fbfd;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 12px 14px;
  margin-bottom: 14px;
}
.summary-bar span { color: var(--muted); }
.result-list { display: grid; gap: 13px; }
.condition-card {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 14px;
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 16px;
  background: #fff;
}
.condition-card.critical {
  border-color: #e8a6a6;
  background: #fffafa;
}
.rank {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--blue-soft);
  color: var(--blue-dark);
  display: grid;
  place-items: center;
  font-weight: 900;
}
.condition-title-row {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
}
.condition-card h3 { margin: 0 0 5px; font-size: 1.22rem; }
.condition-card p { margin: 5px 0; color: var(--muted); }
.score {
  background: var(--blue-soft);
  color: var(--blue-dark);
  border-radius: 999px;
  padding: 8px 12px;
  min-width: 72px;
  text-align: center;
  flex: 0 0 auto;
}
.strength { color: var(--blue-dark) !important; font-weight: 800; }
.matched {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  margin-top: 10px;
}
.matched strong { margin-right: 4px; }
.matched span {
  background: #eef7fb;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 8px;
  font-size: .88rem;
}
.urgent {
  display: inline-block;
  margin-top: 10px;
  color: var(--urgent);
}
.card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 12px;
  color: var(--muted);
  font-size: .92rem;
}
.footer-note { background: rgba(255,255,255,.78); }
.footer-note p { margin-bottom: 0; color: var(--muted); }

@media print {
  body { background: #fff; }
  .hero-actions, .layout-grid, .text-button, .footer-note { display: none !important; }
  .eh-shell { width: 100%; padding: 0; }
  .panel, .safety-card, .hero-copy, .condition-card { box-shadow: none; }
  .hero { grid-template-columns: 1fr; }
}

@media (max-width: 920px) {
  .hero, .layout-grid, .grid.fields { grid-template-columns: 1fr; }
  .selected-panel { position: static; }
  .trust-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
  .eh-shell { width: min(100% - 20px, 1180px); padding-top: 16px; }
  .panel, .footer-note, .hero-copy, .safety-card { padding: 16px; border-radius: 18px; }
  .trust-row { grid-template-columns: 1fr; }
  .search-results { grid-template-columns: 1fr; }
  .condition-card { grid-template-columns: 1fr; }
  .condition-title-row { flex-direction: column; }
  .score { align-self: flex-start; }
}


/* Diagnosis V3.1 library browser */
.trust-row a.stat-card {
  display: block;
  text-decoration: none;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 18px;
  box-shadow: 0 10px 26px rgba(22,73,106,.06);
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}
.trust-row a.stat-card:hover,
.trust-row a.stat-card:focus {
  transform: translateY(-2px);
  border-color: #9dcbdf;
  box-shadow: 0 16px 32px rgba(22,73,106,.11);
}
.library-shell .hero { margin-bottom: 16px; }
.library-tabs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin: 18px 0;
}
.library-tabs a {
  display: block;
  text-decoration: none;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 17px;
  box-shadow: 0 10px 24px rgba(22,73,106,.06);
}
.library-tabs a strong {
  display: block;
  font-size: 1.55rem;
  color: var(--blue-dark);
  letter-spacing: -.03em;
}
.library-tabs a span {
  display: block;
  color: var(--muted);
  font-weight: 700;
}
.library-tabs a.active {
  background: var(--blue-soft);
  border-color: #9bc9df;
}
.library-panel-head { align-items: center; }
.library-count {
  background: var(--gold-soft);
  border: 1px solid var(--gold);
  color: #604200;
  border-radius: 999px;
  padding: 8px 12px;
  font-weight: 900;
  white-space: nowrap;
}
.library-results {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}
.library-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: start;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 15px 16px;
}
.library-item h3 {
  margin: 0 0 5px;
  font-size: 1.08rem;
}
.library-secondary,
.library-desc {
  margin: 4px 0 0;
  color: var(--muted);
}
.library-desc { font-size: .94rem; }
.library-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 5px;
  color: var(--muted);
  font-size: .9rem;
  text-align: right;
}
.library-meta span {
  background: #eef7fb;
  border: 1px solid var(--border);
  color: var(--blue-dark);
  border-radius: 999px;
  padding: 5px 9px;
  font-weight: 800;
}
.pager {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}
.pager button {
  border: 0;
  background: var(--blue-dark);
  color: #fff;
  border-radius: 999px;
  padding: 10px 15px;
  font-weight: 900;
}
.pager span { color: var(--muted); font-weight: 700; }
.az button.active {
  background: var(--blue-dark);
  color: #fff;
  border-color: var(--blue-dark);
}
@media (max-width: 920px) {
  .library-tabs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
  .library-tabs { grid-template-columns: 1fr; }
  .library-item { grid-template-columns: 1fr; }
  .library-meta { align-items: flex-start; text-align: left; }
  .library-count { white-space: normal; }
}

/* Diagnosis V3.2 clickable library/detail pages */
a.library-item-link {
  text-decoration: none;
  color: var(--ink);
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}
a.library-item-link:hover,
a.library-item-link:focus {
  transform: translateY(-2px);
  border-color: #93c8df;
  box-shadow: 0 14px 30px rgba(22,73,106,.10);
  outline: none;
}
.open-detail {
  display: inline-block;
  margin-top: 8px;
  color: var(--blue-dark);
  font-weight: 900;
}
.detail-shell {
  max-width: 1120px;
}
.detail-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 20px;
  box-shadow: 0 14px 36px rgba(22,73,106,.07);
  margin: 16px 0;
}
.main-info-card {
  overflow: hidden;
}
.legacy-info {
  line-height: 1.7;
  color: var(--ink);
}
.legacy-info h1,
.legacy-info h2,
.legacy-info h3,
.legacy-info h4 {
  color: var(--blue-dark);
}
.legacy-info table {
  max-width: 100%;
  width: 100% !important;
  border-collapse: collapse;
}
.legacy-info img,
.legacy-info iframe {
  max-width: 100%;
}
.legacy-info a {
  color: var(--blue-dark);
  font-weight: 800;
}
.fact-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.fact-grid div {
  background: #f6fbfd;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 12px;
}
.fact-grid strong,
.fact-grid span {
  display: block;
}
.fact-grid strong {
  color: var(--blue-dark);
  margin-bottom: 4px;
}
.related-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.related-pill {
  display: block;
  text-decoration: none;
  color: var(--ink);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 11px 12px;
  background: #f8fcfe;
  transition: transform .15s ease, border-color .15s ease, background .15s ease;
}
.related-pill:hover,
.related-pill:focus {
  transform: translateY(-1px);
  border-color: #93c8df;
  background: #eef8fc;
  outline: none;
}
.related-pill span,
.related-pill small {
  display: block;
}
.related-pill span {
  font-weight: 900;
  color: var(--blue-dark);
}
.related-pill small {
  color: var(--muted);
  margin-top: 2px;
}
@media (max-width: 720px) {
  .fact-grid,
  .related-grid {
    grid-template-columns: 1fr;
  }
}

/* Diagnosis V3.3 richer library relationship sections */
.detail-section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}
.detail-section-head h2 {
  margin: 0;
}
.detail-section-head span {
  background: #eaf6fb;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--blue-dark);
  font-weight: 900;
  padding: 5px 10px;
  white-space: nowrap;
}
.related-pill em {
  display: inline-block;
  font-style: normal;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .02em;
  text-transform: uppercase;
  color: #386779;
  background: #eef8fc;
  border: 1px solid #cfe8f2;
  border-radius: 999px;
  padding: 3px 8px;
  margin-bottom: 7px;
}
.library-tabs {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
@media (max-width: 900px) {
  .library-tabs {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 560px) {
  .library-tabs {
    grid-template-columns: 1fr;
  }
}

/* Diagnosis V3.4 clearer condition-detail layout */
.relationship-map-card {
  margin-top: 24px;
  margin-bottom: 28px;
  background: linear-gradient(135deg, #ffffff 0%, #f4fbfe 100%);
}
.relationship-map-card h2 {
  margin-top: 4px;
}
.relationship-map {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
}
.relationship-map span {
  display: block;
  border: 1px solid #cfe8f2;
  background: #ffffff;
  border-radius: 16px;
  padding: 12px 14px;
  color: var(--blue-dark);
  font-weight: 900;
  box-shadow: 0 8px 18px rgba(22,73,106,.05);
}
.relationship-section {
  margin: 28px 0;
  padding: 26px;
  border-radius: 24px;
  border-left: 7px solid #65abc4;
}
.relationship-section .detail-section-head {
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 14px;
}
.relationship-section .detail-section-head h2 {
  font-size: 24px;
  line-height: 1.22;
}
.relationship-intro,
.relationship-empty {
  margin: 0 0 18px;
  max-width: 850px;
  line-height: 1.6;
}
.spacious-related-grid {
  grid-template-columns: repeat(2, minmax(320px, 1fr));
  gap: 14px;
  align-items: stretch;
}
.relationship-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 62px;
  padding: 14px 16px;
  border-radius: 18px;
  background: #ffffff;
  box-shadow: 0 8px 22px rgba(22,73,106,.055);
}
.relationship-link:hover,
.relationship-link:focus {
  transform: translateY(-2px);
  box-shadow: 0 13px 28px rgba(22,73,106,.10);
}
.relationship-main {
  min-width: 0;
}
.relationship-main strong {
  display: block;
  color: var(--blue-dark);
  font-weight: 900;
  line-height: 1.3;
}
.relationship-main small {
  display: block;
  margin-top: 4px;
  line-height: 1.35;
}
.relationship-arrow {
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: #eef8fc;
  color: var(--blue-dark);
  font-size: 25px;
  font-weight: 900;
}
.relationship-symptoms { border-left-color: #2f9ec4; }
.relationship-tests { border-left-color: #5c89d8; }
.relationship-drugs { border-left-color: #7a77d9; }
.relationship-treatments { border-left-color: #4fa97b; }
.relationship-biochemicals { border-left-color: #c99a36; }
.detail-card + .relationship-section {
  margin-top: 30px;
}
.fact-grid {
  margin-top: 14px;
}
@media (max-width: 980px) {
  .relationship-map {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .spacious-related-grid {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 620px) {
  .relationship-map {
    grid-template-columns: 1fr;
  }
  .relationship-section {
    padding: 20px;
    margin: 22px 0;
  }
  .relationship-section .detail-section-head {
    align-items: flex-start;
  }
}

/* Diagnosis V3.5 readable relationship layout */
.top-relationship-map {
  margin-top: 18px;
  margin-bottom: 22px;
}
.relationship-list {
  list-style: none;
  margin: 18px 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
.relationship-list-item {
  margin: 0;
  padding: 0;
}
.relationship-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 74px;
  padding: 16px 18px;
  border: 1px solid #cfe8f2;
  border-radius: 18px;
  background: #ffffff;
  color: var(--ink);
  text-decoration: none;
  box-shadow: 0 8px 20px rgba(22,73,106,.055);
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease, background .15s ease;
}
.relationship-row:hover,
.relationship-row:focus {
  transform: translateY(-2px);
  border-color: #84bdd2;
  background: #f7fcfe;
  box-shadow: 0 14px 30px rgba(22,73,106,.10);
  outline: none;
}
.relationship-text,
.relationship-category,
.relationship-title,
.relationship-meta {
  display: block;
}
.relationship-text {
  min-width: 0;
  flex: 1 1 auto;
}
.relationship-category {
  width: fit-content;
  max-width: 100%;
  margin-bottom: 8px;
  padding: 4px 9px;
  border-radius: 999px;
  border: 1px solid #cfe8f2;
  background: #eef8fc;
  color: #386779;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .02em;
  text-transform: uppercase;
  line-height: 1.25;
}
.relationship-title {
  color: var(--blue-dark);
  font-size: 16px;
  font-weight: 900;
  line-height: 1.35;
  overflow-wrap: anywhere;
}
.relationship-meta {
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
  overflow-wrap: anywhere;
}
.relationship-open {
  flex: 0 0 auto;
  min-width: 76px;
  text-align: center;
  border-radius: 999px;
  padding: 8px 11px;
  background: #eef8fc;
  color: var(--blue-dark);
  font-weight: 900;
  font-size: 13px;
  white-space: nowrap;
}
.relationship-section {
  scroll-margin-top: 20px;
}
.relationship-section .count-badge {
  min-width: 48px;
  text-align: center;
}
@media (max-width: 900px) {
  .relationship-list {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 560px) {
  .relationship-row {
    align-items: flex-start;
    flex-direction: column;
  }
  .relationship-open {
    align-self: flex-start;
  }
}

/* Diagnosis V3.7 treatment grouping and evidence badges */
.treatment-section {
  margin-top: 30px;
  border-left-color: #4fa97b;
}
.treatment-groups {
  display: grid;
  grid-template-columns: 1fr;
  gap: 22px;
  margin-top: 22px;
}
.treatment-group-card {
  border: 1px solid #d8ece2;
  border-radius: 22px;
  background: linear-gradient(180deg, #ffffff 0%, #fbfffd 100%);
  box-shadow: 0 10px 24px rgba(32, 112, 78, .06);
  padding: 18px;
}
.treatment-group-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid #e5f3ec;
}
.treatment-group-head h3 {
  margin: 0;
  color: #17623e;
  font-size: 20px;
  line-height: 1.25;
}
.treatment-group-head span {
  min-width: 42px;
  text-align: center;
  padding: 6px 10px;
  border-radius: 999px;
  background: #eaf7ef;
  color: #17623e;
  font-weight: 900;
}
.treatment-item-list {
  list-style: none;
  margin: 14px 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}
.treatment-item {
  margin: 0;
  padding: 0;
}
.treatment-link {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border: 1px solid #dcefe6;
  border-radius: 18px;
  background: #fff;
  color: var(--ink);
  text-decoration: none;
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease, background .15s ease;
}
.treatment-link:hover,
.treatment-link:focus {
  transform: translateY(-2px);
  border-color: #9ed2b8;
  background: #fbfffd;
  box-shadow: 0 12px 26px rgba(32, 112, 78, .10);
  outline: none;
}
.treatment-title-wrap,
.treatment-title,
.treatment-source {
  display: block;
  min-width: 0;
}
.treatment-title {
  color: #164a31;
  font-size: 16px;
  font-weight: 900;
  line-height: 1.35;
  overflow-wrap: anywhere;
}
.treatment-source {
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .02em;
  text-transform: uppercase;
}
.evidence-badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
  max-width: 320px;
}
.evidence-chip {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 5px 9px;
  border-radius: 999px;
  border: 1px solid #d8e6ee;
  background: #f6fafc;
  color: #456371;
  font-size: 12px;
  font-weight: 900;
  line-height: 1.2;
  white-space: nowrap;
}
.evidence-recommendation {
  border-color: #cae7d6;
  background: #eef9f2;
  color: #17623e;
}
.evidence-quality {
  border-color: #f0dfb8;
  background: #fff9e8;
  color: #7b5b14;
}
.evidence-raw {
  border-color: #d9e5ef;
  background: #f3f8fc;
  color: #4e6676;
}
.evidence-missing .evidence-chip {
  border-color: #e1e8ed;
  background: #f7f9fa;
  color: #7a8b95;
}
@media (max-width: 820px) {
  .treatment-link {
    grid-template-columns: 1fr;
    align-items: flex-start;
  }
  .evidence-badges {
    justify-content: flex-start;
    max-width: 100%;
  }
}


/* Diagnosis V3.9 readability tidy-up */
.relationship-row {
  align-items: flex-start;
  gap: 18px;
}
.relationship-open {
  min-width: 34px;
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  font-size: 22px;
  line-height: 1;
  margin-top: 4px;
}
.relationship-meta:empty,
.treatment-source:empty,
.evidence-badges:empty {
  display: none !important;
}
.treatment-link {
  grid-template-columns: minmax(0, 1fr) minmax(180px, auto) 34px;
  align-items: flex-start;
  gap: 18px;
}
.treatment-link .relationship-open {
  margin-top: 0;
}
.treatment-title-wrap {
  padding-right: 8px;
}
.evidence-badges {
  align-self: flex-start;
  padding-top: 1px;
  gap: 8px;
}
.evidence-chip + .evidence-chip {
  margin-left: 0;
}
.treatment-group-card {
  margin-bottom: 6px;
}
.treatment-group-head {
  margin-bottom: 4px;
}
.treatment-item-list {
  gap: 14px;
}
@media (max-width: 820px) {
  .treatment-link {
    grid-template-columns: 1fr 34px;
  }
  .treatment-link .evidence-badges {
    grid-column: 1 / -1;
  }
}


/* Diagnosis V4.0 treatment evidence spacing tidy-up */
.treatment-link {
  grid-template-columns: minmax(0, 1fr) 34px;
  align-items: flex-start;
  gap: 18px;
}
.treatment-title-wrap {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  padding-right: 12px;
}
.treatment-title-wrap .evidence-badges {
  margin-top: 2px;
}
.evidence-badges {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-start;
  gap: 8px 10px;
  max-width: 100%;
}
.evidence-chip {
  margin: 0;
  letter-spacing: .01em;
  word-spacing: .08em;
}
.evidence-quality {
  white-space: nowrap;
}
.treatment-link .relationship-open {
  grid-column: 2;
  grid-row: 1;
  margin-top: 2px;
}
.relationship-meta {
  margin-top: 7px;
  display: inline-block;
  word-spacing: .08em;
}
@media (max-width: 820px) {
  .treatment-link {
    grid-template-columns: minmax(0, 1fr) 34px;
  }
  .treatment-title-wrap {
    grid-column: 1;
  }
}


/* Diagnosis V4.1: force treatment recommendation and evidence onto separated readable lines */
.treatment-group-card {
  overflow: visible;
}
.treatment-group-head h3 {
  margin-bottom: 0;
}
.treatment-title-wrap {
  display: block !important;
  line-height: 1.45;
}
.treatment-title {
  display: block !important;
  margin-bottom: 12px !important;
}
.treatment-title-wrap .evidence-badges.evidence-stacked,
.evidence-badges.evidence-stacked {
  display: block !important;
  width: 100% !important;
  max-width: 100% !important;
  margin-top: 8px !important;
  padding-top: 0 !important;
  line-height: 1.5 !important;
}
.evidence-stacked .evidence-line {
  display: block !important;
  margin: 0 0 8px 0 !important;
  padding: 0 !important;
  clear: both !important;
}
.evidence-stacked .evidence-line:last-child {
  margin-bottom: 0 !important;
}
.evidence-stacked .evidence-chip {
  display: inline-flex !important;
  margin: 0 !important;
  white-space: normal !important;
  overflow-wrap: anywhere !important;
}
.evidence-stacked .evidence-recommendation-line {
  margin-top: 2px !important;
}
.evidence-stacked .evidence-quality-line {
  margin-top: 4px !important;
}
.treatment-link {
  align-items: flex-start !important;
}
@media (max-width: 820px) {
  .treatment-title {
    margin-bottom: 10px !important;
  }
  .evidence-stacked .evidence-line {
    margin-bottom: 7px !important;
  }
}
