:root {
  color-scheme: light;
  --ink: #211a18;
  --muted: #6f625d;
  --line: #ddd5cd;
  --panel: #ffffff;
  --paper: #f8f8f4;
  --phased-blue: #0b5637;
  --phased-orange: #d7893b;
  --phased-amber: #9a501d;
  --phased-red: #4a2117;
  --phased-red-bright: #74412d;
  --blue: var(--phased-blue);
  --sun: var(--phased-orange);
  --amber: var(--phased-amber);
  --red: var(--phased-red);
  --green: #267353;
  --soft-aqua: #eaf4ee;
  --soft-sun: #fbefdf;
  --soft-rose: #f7ece7;
  --soft-blue: #e7f1eb;
  --shadow: 0 18px 48px rgba(77, 32, 0, 0.14);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: linear-gradient(135deg, #f5f8f5 0%, #fffaf4 54%, #f4ece7 100%);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

a {
  color: inherit;
}

.app-shell {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  background:
    linear-gradient(160deg, rgba(215, 137, 59, 0.2), transparent 36%),
    linear-gradient(180deg, #113c2a 0%, #204d36 42%, #4a2117 76%, #9a501d 100%);
  color: #fff;
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.brand {
  display: grid;
  gap: 12px;
}

.brand-logo {
  display: grid;
  width: 160px;
  aspect-ratio: 1;
  place-items: center;
  margin: 0 auto;
  overflow: hidden;
  border-radius: 50%;
  background: #fff;
  border: 1px solid #fff;
  filter: drop-shadow(0 10px 20px rgba(0, 0, 0, 0.24));
}

.brand-logo img {
  display: block;
  width: 82%;
  height: 82%;
  object-fit: contain;
  transform: translateY(-5%);
}

.brand-copy {
  padding: 0 3px;
}

.brand h1,
.topbar h2,
.fit-hero h3,
.panel h3,
.summary-band h3 {
  margin: 0;
  letter-spacing: 0;
}

.brand h1 {
  font-size: 25px;
}

.brand-subtitle {
  max-width: 100%;
  margin: 4px 0 0;
  color: rgba(255, 255, 255, 0.72);
  font-size: 12px;
  line-height: 1.25;
}

.eyebrow {
  margin: 0 0 6px;
  color: inherit;
  opacity: 0.68;
  font-size: 11px;
  font-weight: 850;
  letter-spacing: 0;
  text-transform: uppercase;
}

.nav-tabs {
  display: grid;
  gap: 8px;
}

.hub-back-link {
  display: block;
  min-height: 38px;
  padding: 9px 12px;
  border: 1px solid rgba(255, 255, 255, 0.34);
  border-radius: 8px;
  background: transparent;
  color: #fff;
  font-size: 12px;
  font-weight: 850;
  text-align: center;
  text-decoration: none;
}

.hub-back-link:hover {
  background: #fff;
  color: #211a18;
}

.nav-tab,
.icon-button {
  min-height: 42px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.1);
  color: inherit;
  text-align: left;
  padding: 10px 12px;
  font-weight: 800;
}

.nav-tab.active,
.nav-tab:hover,
.icon-button:hover {
  background: #fff;
  color: #211a18;
}

.lens-card,
.status-card {
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.1);
}

.lens-list {
  display: grid;
  gap: 8px;
}

.lens-item {
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: 9px;
  align-items: center;
}

.lens-item strong {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.22);
}

.lens-item:nth-child(1) strong { background: var(--phased-blue); color: #fff; }
.lens-item:nth-child(2) strong { background: var(--phased-orange); color: #261304; }
.lens-item:nth-child(3) strong { background: var(--phased-amber); color: #fff; }
.lens-item:nth-child(4) strong { background: var(--phased-red-bright); color: #fff; }
.lens-item:nth-child(5) strong { background: #72a489; color: #143327; }
.lens-item:nth-child(6) strong { background: #f2b35b; color: #251300; }
.lens-item:nth-child(7) strong { background: #7c0b0b; color: #fff; }

.lens-item span {
  font-size: 13px;
  line-height: 1.25;
}

.status-card {
  margin-top: auto;
  display: grid;
  gap: 8px;
}

.status-card span {
  color: rgba(255, 255, 255, 0.74);
  font-size: 13px;
}

.main {
  min-width: 0;
  padding: 22px;
}

.topbar {
  min-height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
}

.topbar h2 {
  font-size: clamp(28px, 4vw, 44px);
}

.toolbar {
  display: flex;
  gap: 8px;
}

.toolbar .icon-button {
  background: #fff;
  color: var(--ink);
  border-color: var(--line);
  text-align: center;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.practice-reminder,
.r-primer-panel {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
  margin-bottom: 16px;
  border: 1px solid #cfe2d7;
  border-radius: 8px;
  padding: 15px;
  background: linear-gradient(135deg, #ffffff, #f1f8f3);
  box-shadow: 0 12px 28px rgba(0, 94, 150, 0.1);
}

.practice-reminder h3,
.r-primer-panel h3 {
  margin: 0 0 6px;
  font-size: 18px;
}

.practice-reminder p,
.r-primer-panel p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.reminder-icon,
.r-primer-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: var(--phased-blue);
  color: #fff;
  font-weight: 950;
  box-shadow: 0 8px 18px rgba(0, 148, 240, 0.18);
}

.r-primer-panel {
  border-color: #f0c284;
  background: linear-gradient(135deg, #fffdf8, #fff3df);
  box-shadow: 0 12px 28px rgba(180, 92, 0, 0.1);
}

.r-primer-mark {
  background: var(--phased-red-bright);
}

.fit-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(210px, 240px);
  gap: 18px;
  align-items: stretch;
  margin-bottom: 16px;
  border: 1px solid rgba(8, 124, 128, 0.24);
  border-radius: 8px;
  padding: 20px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.97), rgba(233, 246, 255, 0.92)),
    linear-gradient(90deg, rgba(0, 148, 240, 0.2), rgba(232, 150, 47, 0.22), rgba(101, 0, 0, 0.08));
  box-shadow: var(--shadow);
}

.fit-hero h3 {
  font-size: clamp(22px, 3vw, 34px);
}

.fit-hero p,
.ingredient-card p,
.source-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.score-tile {
  border-radius: 8px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 8px;
  background: linear-gradient(135deg, var(--phased-blue), var(--phased-orange), var(--phased-red));
  color: #fff;
  min-height: 112px;
  padding: 12px;
}

.score-tile span {
  font-size: 44px;
  line-height: 1;
  font-weight: 950;
}

.score-tile small {
  font-size: 11px;
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: 0;
}

.score-rubric {
  width: 100%;
  display: grid;
  gap: 7px;
  margin-top: 6px;
}

.score-rubric div {
  display: grid;
  grid-template-columns: 72px 1fr;
  align-items: center;
  gap: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.24);
  padding-top: 7px;
  font-size: 14px;
  line-height: 1.2;
}

.score-rubric strong,
.score-rubric span {
  color: rgba(255, 255, 255, 0.92);
}

.score-rubric strong {
  font-size: 14px;
}

.score-rubric span {
  font-size: 14px;
  font-weight: 850;
}

.workspace-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(300px, 0.85fr);
  gap: 16px;
  margin-bottom: 16px;
}

.intake-panel,
.checks-panel,
.prerequisite-panel,
.safety-panel {
  margin-bottom: 16px;
}

.panel,
.summary-band {
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.panel {
  padding: 18px;
}

.panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.panel h3 {
  font-size: 21px;
}

.pill,
.rail-state,
.evidence-badge,
.role-badge,
.source-chip,
.source-note {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 850;
  white-space: nowrap;
}

.pill {
  background: var(--soft-aqua);
  color: #0b5637;
}

.rail-state.clear {
  background: #eaf8ee;
  color: var(--green);
}

.rail-state.alert {
  background: #ffe8ec;
  color: var(--red);
}

.rail-state.adjust {
  background: #fff1d7;
  color: var(--amber);
}

.source-note {
  background: var(--soft-sun);
  color: #794804;
  white-space: normal;
}

.prerequisite-panel {
  border-color: #f0c284;
  border-top: 6px solid var(--phased-orange);
}

.prerequisite-copy {
  margin: 0 0 16px;
  color: var(--muted);
  line-height: 1.5;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
}

.concern-field {
  display: grid;
  gap: 7px;
}

.field-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
}

.concern-picker {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  max-height: 212px;
  overflow: auto;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcff;
}

.concern-choice {
  display: grid;
  grid-template-columns: 18px 1fr;
  gap: 8px;
  align-items: start;
  min-height: 38px;
  padding: 8px;
  border: 1px solid #ece3dc;
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.25;
  text-transform: none;
}

.concern-choice input {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--phased-blue);
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcff;
  color: var(--ink);
  padding: 10px 11px;
  font-size: 14px;
  font-weight: 550;
  text-transform: none;
}

input:focus,
select:focus,
textarea:focus {
  outline: 3px solid rgba(0, 148, 240, 0.24);
  border-color: var(--phased-blue);
}

textarea {
  resize: vertical;
}

.concern-field {
  grid-column: span 2;
}

.meter {
  height: 13px;
  border-radius: 999px;
  background: #e6ebf3;
  overflow: hidden;
}

.meter span {
  display: block;
  height: 100%;
  width: 8%;
  background: linear-gradient(90deg, var(--phased-red), var(--phased-amber), var(--phased-orange), var(--phased-blue));
}

.fit-check-grid {
  position: relative;
  display: grid;
  gap: 22px;
  padding-left: 0;
}

.fit-check-grid::before {
  content: "";
  position: absolute;
  top: 20px;
  bottom: 20px;
  left: 34px;
  width: 4px;
  border-radius: 999px;
  background: linear-gradient(180deg, var(--phased-blue), var(--phased-orange), var(--phased-amber), var(--phased-red));
}

.fit-check {
  position: relative;
  display: grid;
  grid-template-columns: 68px minmax(0, 1fr);
  gap: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(248, 251, 255, 0.98)),
    linear-gradient(90deg, rgba(0, 148, 240, 0.08), rgba(232, 150, 47, 0.08));
  border-left: 5px solid var(--phased-blue);
}

.fit-check:nth-child(2) { border-left-color: var(--phased-orange); }
.fit-check:nth-child(3) { border-left-color: var(--phased-amber); }
.fit-check:nth-child(4) { border-left-color: var(--phased-red-bright); }
.fit-check:nth-child(5) { border-left-color: #72a489; }
.fit-check:nth-child(6) { border-left-color: #f2b35b; }
.fit-check:nth-child(7) { border-left-color: #7c0b0b; }

.tree-marker {
  position: relative;
  display: grid;
  justify-items: center;
  align-content: start;
  z-index: 1;
}

.fit-check h4 {
  margin: 2px 0 8px;
  font-size: 22px;
}

.letter-badge {
  width: 48px;
  height: 48px;
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 999px;
  background: var(--phased-blue);
  color: #fff;
  font-size: 20px;
  font-weight: 950;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.16);
}

.fit-check:nth-child(2) .letter-badge { background: var(--phased-orange); color: #251300; }
.fit-check:nth-child(3) .letter-badge { background: var(--phased-amber); color: #fff; }
.fit-check:nth-child(4) .letter-badge { background: var(--phased-red-bright); color: #fff; }
.fit-check:nth-child(5) .letter-badge { background: #72a489; color: #143327; }
.fit-check:nth-child(6) .letter-badge { background: #f2b35b; color: #251300; }
.fit-check:nth-child(7) .letter-badge { background: #7c0b0b; color: #fff; }

.fit-check p {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.tree-step-label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.tree-meaning {
  color: var(--ink);
}

.tree-purpose {
  max-width: 900px;
}

.tree-domain-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 12px 0;
}

.category-pathways,
.claim-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 12px 0;
}

.category-pathways div,
.claim-grid div,
.framework-note {
  border: 1px solid #d5e3da;
  border-radius: 8px;
  background: #f6faf7;
  padding: 11px;
}

.category-pathways div.active {
  border-color: var(--phased-blue);
  background: #e8f3ec;
  box-shadow: 0 8px 22px rgba(0, 148, 240, 0.14);
}

.category-pathways strong,
.claim-grid strong,
.framework-note strong {
  display: block;
  margin-bottom: 6px;
  color: var(--ink);
  font-size: 13px;
}

.category-pathways span,
.claim-grid span,
.framework-note span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.evidence-teaching {
  display: grid;
  grid-template-columns: minmax(220px, 0.75fr) minmax(0, 1.25fr);
  gap: 12px;
  margin: 12px 0;
}

.evidence-pyramid {
  display: grid;
  gap: 5px;
  align-content: center;
  padding: 12px;
  border: 1px solid #d5e3da;
  border-radius: 8px;
  background: #f6faf7;
}

.evidence-pyramid div {
  min-height: 30px;
  display: grid;
  place-items: center;
  margin-inline: auto;
  border-radius: 7px;
  background: linear-gradient(135deg, var(--phased-blue), #72a489);
  color: #fff;
  padding: 6px 10px;
  font-size: 11px;
  font-weight: 850;
  text-align: center;
}

.evidence-pyramid div:nth-child(1) { width: 52%; background: var(--phased-blue); }
.evidence-pyramid div:nth-child(2) { width: 62%; background: #39795c; }
.evidence-pyramid div:nth-child(3) { width: 72%; background: var(--phased-orange); color: #251300; }
.evidence-pyramid div:nth-child(4) { width: 82%; background: var(--phased-amber); }
.evidence-pyramid div:nth-child(5) { width: 92%; background: var(--phased-red-bright); }
.evidence-pyramid div:nth-child(6) { width: 100%; background: var(--phased-red); }

.claim-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 0;
}

.framework-note {
  margin: 12px 0;
  border-left: 5px solid var(--phased-orange);
}

.framework-note.r-pathway {
  border-left-color: var(--phased-red-bright);
  background: #fff7f7;
}

.tree-domain {
  border: 1px solid #eadbd0;
  border-left: 5px solid var(--phased-orange);
  border-radius: 8px;
  background: #fffaf5;
  padding: 10px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.fit-check:nth-child(2) .tree-domain { border-left-color: var(--phased-orange); }
.fit-check:nth-child(3) .tree-domain { border-left-color: var(--phased-amber); }
.fit-check:nth-child(4) .tree-domain { border-left-color: var(--phased-red-bright); }
.fit-check:nth-child(5) .tree-domain { border-left-color: #72a489; }
.fit-check:nth-child(6) .tree-domain { border-left-color: #f2b35b; }
.fit-check:nth-child(7) .tree-domain { border-left-color: #7c0b0b; }

.tree-check,
.tree-branches {
  border: 1px solid #eadbd0;
  border-radius: 8px;
  background: #fffaf5;
  padding: 10px;
}

.tree-branches {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 10px;
  background: #f7faf8;
}

.tree-branches div {
  min-height: 82px;
  display: grid;
  align-content: start;
  gap: 6px;
  border-radius: 7px;
  background: #fff;
  border: 1px solid #dfe9e2;
  padding: 10px;
}

.tree-branches strong {
  color: var(--ink);
  font-size: 13px;
}

.tree-branches span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.choice-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.choice-row label {
  min-height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
  font-size: 12px;
  text-transform: none;
}

.choice-row input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: 0;
  opacity: 0;
  pointer-events: none;
}

.choice-row label:has(input:checked) {
  background: #17212f;
  border-color: #17212f;
  color: #fff;
}

.decision-inputs {
  display: grid;
  grid-template-columns: minmax(220px, 0.7fr) minmax(0, 1.3fr);
  gap: 12px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.check-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.safety-block + .safety-block {
  margin-top: 18px;
}

.check-item {
  display: grid;
  grid-template-columns: 22px 1fr;
  gap: 10px;
  align-items: start;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcff;
  color: var(--ink);
  font-size: 13px;
  font-weight: 650;
  line-height: 1.4;
  text-transform: none;
}

.check-item input {
  width: 19px;
  height: 19px;
  margin: 0;
  accent-color: var(--red);
}

.adjustment-item {
  background: #fffaf2;
  border-color: #f0c284;
  border-left: 5px solid var(--phased-orange);
}

.adjustment-item input {
  accent-color: var(--phased-orange);
}

.check-item small {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-weight: 600;
}

.empty-state,
.evidence-note {
  border: 1px solid #eadbd0;
  border-radius: 8px;
  background: #fff8ef;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.empty-state {
  grid-column: 1 / -1;
  padding: 12px;
}

.evidence-note {
  margin: 10px 0;
  padding: 10px;
}

.summary-band {
  margin-top: 16px;
  padding: 16px;
  box-shadow: 0 12px 30px rgba(77, 32, 0, 0.1);
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.summary-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #fbfcff;
  border-top: 4px solid var(--phased-blue);
}

.summary-item:nth-child(2n) { border-top-color: var(--phased-orange); }
.summary-item:nth-child(3n) { border-top-color: var(--phased-amber); }
.summary-item:nth-child(4n) { border-top-color: var(--blue); }

.summary-item strong {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
}

.summary-item span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.library-header {
  align-items: end;
}

.library-note {
  max-width: 680px;
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.search-label {
  min-width: min(420px, 100%);
}

.formulation-boundary {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  gap: 13px;
  margin-bottom: 18px;
  padding: 16px;
  border: 1px solid #d7b590;
  border-left: 6px solid var(--phased-orange);
  border-radius: 8px;
  background: #fff8ed;
}

.formulation-boundary-mark {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 50%;
  background: var(--phased-green);
  color: #fff;
  font-size: 18px;
  font-weight: 900;
}

.formulation-boundary h4 {
  margin: 2px 0 7px;
  font-size: 18px;
}

.formulation-boundary p:not(.eyebrow) {
  max-width: 1050px;
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.formulation-boundary .boundary-otc-note {
  margin-top: 11px;
  padding-top: 10px;
  border-top: 1px solid #ead3b8;
  color: var(--ink);
}

.boundary-source-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  margin-top: 11px;
}

.boundary-source-links a {
  color: var(--phased-green);
  font-size: 12px;
  font-weight: 850;
}

.boundary-source-links a:hover {
  color: var(--phased-orange);
}

.library-layout {
  display: grid;
  grid-template-columns: 285px minmax(0, 1fr);
  gap: 16px;
}

.category-list {
  display: grid;
  gap: 8px;
  align-content: start;
}

.category-button {
  min-height: 50px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 10px 12px;
  text-align: left;
  font-weight: 850;
}

.category-button.active {
  background: linear-gradient(135deg, var(--soft-aqua), #fff);
  border-color: var(--phased-blue);
  color: #0b5637;
}

.ingredient-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.ingredient-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fff;
  border-top: 5px solid var(--phased-blue);
}

.ingredient-card.drug { border-top-color: var(--blue); }
.ingredient-card.cosmetic { border-top-color: var(--phased-red-bright); }
.ingredient-card.support { border-top-color: var(--green); }
.ingredient-card.watch { border-top-color: var(--amber); }

.ingredient-card header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.ingredient-card h4 {
  margin: 0;
  font-size: 18px;
}

.badge-row,
.source-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 10px 0;
}

.evidence-badge.high {
  background: #eaf8ee;
  color: var(--green);
}

.evidence-badge.moderate {
  background: var(--soft-blue);
  color: var(--blue);
}

.evidence-badge.limited,
.evidence-badge.variable {
  background: #fff1d7;
  color: var(--amber);
}

.evidence-badge.very-limited {
  background: #ffe8ec;
  color: var(--red);
}

.role-badge {
  background: var(--soft-aqua);
  color: #0b5637;
}

.source-chip {
  text-decoration: none;
  background: #f4f6fb;
  color: #39485b;
  border: 1px solid #e0e5ef;
}

.source-chip.best-anchor {
  background: #eaf8ee;
  color: var(--green);
  border-color: #b9e4c9;
}

.source-chip.pubmed-search {
  background: var(--soft-blue);
  color: #0b5637;
  border-color: #b9d5c5;
}

.source-chip.supporting-anchor {
  background: #fff1d7;
  color: var(--amber);
  border-color: #f0c284;
}

.source-chip.regulatory-source {
  background: #f4f6fb;
  color: #39485b;
  border-color: #e0e5ef;
}

.source-chip:hover {
  background: #17212f;
  color: #fff;
}

.examples {
  color: var(--ink);
  font-size: 13px;
}

.source-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.source-warning {
  display: grid;
  gap: 4px;
  margin-bottom: 14px;
  padding: 13px 14px;
  border: 1px solid #f0c284;
  border-left: 5px solid var(--phased-orange);
  border-radius: 8px;
  background: #fff8ed;
}

.source-warning strong {
  font-size: 14px;
}

.source-warning span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.source-card {
  display: block;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: inherit;
  text-decoration: none;
  padding: 14px;
  border-top: 5px solid var(--sun);
  cursor: pointer;
  transition: background 160ms ease, border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.source-card:nth-child(2n) { border-top-color: var(--phased-blue); }
.source-card:nth-child(3n) { border-top-color: var(--phased-amber); }
.source-card:nth-child(4n) { border-top-color: var(--blue); }

.source-card:hover,
.source-card:focus-visible {
  background: linear-gradient(180deg, #ffffff 0%, #fff4e4 100%);
  border-color: var(--phased-orange);
  box-shadow: 0 14px 34px rgba(180, 92, 0, 0.18);
  transform: translateY(-2px);
  outline: 0;
}

.source-card:active {
  transform: translateY(0);
  box-shadow: 0 8px 20px rgba(180, 92, 0, 0.16);
}

.source-card h4 {
  margin: 0 0 8px;
}

@media (max-width: 1180px) {
  .summary-grid,
  .source-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .ingredient-list {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
  }

  .lens-card,
  .status-card {
    display: none;
  }

  .nav-tabs {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .nav-tab {
    text-align: center;
  }

  .workspace-grid,
  .library-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 700px) {
  .main,
  .sidebar {
    padding: 14px;
  }

  .brand-logo {
    width: min(150px, 100%);
  }

  .brand h1 {
    font-size: 22px;
  }

  .nav-tabs {
    gap: 6px;
  }

  .nav-tab {
    min-height: 40px;
    padding: 8px;
    font-size: 13px;
  }

  .topbar,
  .panel-header,
  .ingredient-card header {
    flex-direction: column;
    align-items: stretch;
  }

  .fit-hero,
  .practice-reminder,
  .r-primer-panel,
  .form-grid,
  .concern-picker,
  .tree-domain-list,
  .category-pathways,
  .evidence-teaching,
  .claim-grid,
  .tree-branches,
  .decision-inputs,
  .check-list,
  .summary-grid,
  .source-grid {
    grid-template-columns: 1fr;
  }

  .formulation-boundary {
    grid-template-columns: 1fr;
  }

  .fit-check {
    grid-template-columns: 48px minmax(0, 1fr);
    gap: 10px;
  }

  .fit-check-grid::before {
    left: 24px;
  }

  .letter-badge {
    width: 40px;
    height: 40px;
    font-size: 17px;
  }

  .concern-field {
    grid-column: span 1;
  }

  .reminder-icon,
  .r-primer-mark {
    width: 38px;
    height: 38px;
  }
}

/* Society of Dermatology Pharmacists / PhASEd site family */
:root {
  --ink: #17181a;
  --muted: #62636a;
  --line: #dddcd5;
  --panel: #ffffff;
  --paper: #f8f5ef;
  --phased-blue: #0b5637;
  --phased-green: #0b5637;
  --phased-orange: #d7893b;
  --phased-amber: #9a501d;
  --phased-red: #4a2117;
  --phased-red-bright: #64261f;
  --shadow: none;
}

body {
  background: var(--paper);
  color: var(--ink);
}

.app-shell { display: block; }

.sidebar {
  position: sticky;
  z-index: 30;
  top: 0;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(220px, .8fr) minmax(170px, .58fr) minmax(360px, 1.5fr) auto;
  align-items: center;
  gap: 12px;
  padding: 14px max(24px, calc((100vw - 1240px) / 2));
  border-bottom: 1px solid var(--line);
  background: rgba(248, 245, 239, .97);
  color: var(--ink);
  backdrop-filter: blur(14px);
}

.brand {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  color: inherit;
  text-decoration: none;
}

.brand-logo {
  width: 76px;
  aspect-ratio: auto;
  margin: 0;
  overflow: visible;
  border: 0;
  border-radius: 0;
  background: transparent;
  filter: none;
}

.brand-logo img {
  width: 100%;
  height: auto;
  object-fit: contain;
  transform: none;
}

.brand-copy { padding: 0; }
.brand h1 { font-family: Georgia, "Times New Roman", serif; font-size: 24px; font-weight: 500; }
.brand .eyebrow { margin-bottom: 2px; font-size: 8px; }
.brand-subtitle { margin-top: 2px; color: var(--muted); font-size: 9px; text-transform: uppercase; }

.society-link {
  display: grid;
  gap: 2px;
  width: fit-content;
  max-width: 205px;
  align-self: center;
  justify-self: start;
  padding-left: 20px;
  border-left: 1px solid var(--line);
  color: var(--ink);
  text-decoration: none;
}
.society-link span { color: var(--muted); font-size: 9px; font-weight: 800; text-transform: uppercase; }
.society-link strong { font-family: Georgia, "Times New Roman", serif; font-size: 13px; font-weight: 500; line-height: 1.2; }
.society-link:hover strong { color: var(--phased-blue); }

.nav-tabs {
  display: flex;
  justify-content: flex-start;
  gap: 2px;
}

.nav-tab {
  min-height: 42px;
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  padding: 8px 10px;
  background: transparent;
  color: var(--ink);
  font-size: 11px;
  font-weight: 650;
  text-align: center;
  white-space: nowrap;
}

.nav-tab.active,
.nav-tab:hover {
  border-bottom-color: var(--phased-orange);
  background: transparent;
  color: var(--phased-blue);
}

.nav-status {
  margin-left: 4px;
  color: var(--phased-red);
  font-size: 7px;
  font-weight: 850;
  text-transform: uppercase;
}

.hub-back-link {
  width: fit-content;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  justify-self: end;
  min-height: 36px;
  padding: 8px 10px;
  border: 1px solid var(--phased-blue);
  border-radius: 2px;
  background: transparent;
  color: var(--phased-blue);
  font-size: 10px;
  white-space: nowrap;
}
.hub-back-link:hover { background: var(--phased-blue); color: #fff; }

.header-utility {
  display: grid;
  gap: 5px;
  justify-items: end;
}

.legal-mini-links {
  display: flex;
  gap: 10px;
  padding-right: 2px;
}

.legal-mini-links a {
  color: var(--muted);
  font-size: 9px;
  font-weight: 750;
  text-decoration: none;
}

.legal-mini-links a:hover { color: var(--phased-red); text-decoration: underline; }

.main {
  width: min(1240px, calc(100% - 48px));
  margin: 0 auto;
  padding: 0 0 72px;
}

.topbar {
  min-height: 100px;
  margin: 0;
  padding: 22px 0 18px;
  border-bottom: 1px solid var(--line);
}
.topbar h2,
.fit-hero h3,
.panel h3,
.summary-band h3,
.practice-reminder h3,
.r-primer-panel h3,
.formulation-boundary h4,
.source-card h4 {
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 500;
}
.topbar h2 { font-size: 34px; }
.eyebrow { color: var(--phased-red); opacity: 1; font-size: 9px; letter-spacing: .14em; }

.toolbar .icon-button {
  min-height: 38px;
  border-color: var(--phased-blue);
  border-radius: 2px;
  background: transparent;
  color: var(--phased-blue);
  font-size: 11px;
}
.toolbar .icon-button:hover { background: var(--phased-blue); color: #fff; }

.framework-rail {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 230px;
  gap: 16px;
  align-items: stretch;
  padding: 18px 0;
}

.lens-card,
.status-card {
  border: 1px solid var(--line);
  border-radius: 2px;
  padding: 13px 15px;
  background: #fff;
  color: var(--ink);
}

.lens-list {
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 4px;
}
.lens-item { grid-template-columns: 28px minmax(0, 1fr); gap: 6px; }
.lens-item strong { width: 28px; height: 28px; border: 0; font-family: Georgia, "Times New Roman", serif; }
.lens-item span { color: var(--muted); font-size: 10px; }

.status-card { margin: 0; align-content: center; border-top: 3px solid var(--phased-orange); }
.status-card strong { color: var(--phased-blue); font-family: Georgia, "Times New Roman", serif; font-size: 19px; font-weight: 500; }
.status-card span { color: var(--muted); font-size: 11px; }

.public-library-gate {
  min-height: 430px;
  display: grid;
  align-content: center;
  justify-items: start;
  gap: 12px;
  border: 1px solid var(--line);
  border-top: 4px solid var(--phased-orange);
  padding: clamp(30px, 7vw, 86px);
  background: #fff;
}
.public-library-gate h3 {
  max-width: 720px;
  margin: 0;
  color: var(--phased-blue);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(30px, 5vw, 54px);
  font-weight: 500;
  line-height: 1.04;
}
.public-library-gate p:not(.eyebrow) { max-width: 760px; margin: 0; color: var(--muted); line-height: 1.65; }
.public-library-gate > span {
  border: 1px solid var(--phased-orange);
  padding: 7px 10px;
  color: var(--phased-red);
  font-size: 10px;
  font-weight: 850;
  text-transform: uppercase;
}
.public-library-gate + .library-panel { display: none; }

.score-status {
  margin: 8px 0 0;
  color: var(--phased-red);
  font-size: 13px;
  font-weight: 850;
  line-height: 1.25;
  text-align: center;
}

.skip-link {
  position: fixed;
  top: 10px;
  left: 10px;
  z-index: 1000;
  padding: 10px 14px;
  background: #fff;
  color: var(--green);
  font-weight: 850;
  text-decoration: none;
  transform: translateY(-150%);
}

.skip-link:focus { transform: translateY(0); }

.panel,
.summary-band,
.practice-reminder,
.r-primer-panel,
.fit-hero,
.score-tile,
.formulation-boundary,
.source-warning,
.source-card,
.summary-item {
  border-radius: 3px;
  box-shadow: none;
}

.practice-reminder { border-color: #cdded4; background: #f2f7f3; }
.r-primer-panel { border-color: #e6c79e; background: #fff8ee; }
.fit-hero { border-color: var(--line); background: #fff; }
.score-tile { background: var(--phased-blue); }
.panel,
.summary-band { background: #fff; }
.summary-item { background: #faf9f6; }

@media (max-width: 1050px) {
  .sidebar { grid-template-columns: minmax(210px, 1fr) minmax(160px, .75fr) auto; }
  .nav-tabs { grid-row: 2; grid-column: 1 / 4; overflow-x: auto; }
  .header-utility { grid-column: 3; grid-row: 1; }
}

@media (max-width: 760px) {
  .sidebar { grid-template-columns: 1fr auto; padding: 10px 14px 0; }
  .brand { grid-template-columns: 58px minmax(0, 1fr); max-width: 250px; }
  .brand-logo { width: 58px; }
  .brand h1 { font-size: 20px; }
  .society-link { display: none; }
  .header-utility { grid-column: 2; grid-row: 1; }
  .hub-back-link .return-label { display: none; }
  .hub-back-link::after { content: "Resources Hub"; }
  .legal-mini-links { display: none; }
  .nav-tabs { grid-column: 1 / -1; grid-row: 2; }
  .nav-tab { flex: 0 0 auto; }
  .main { width: min(100% - 28px, 1240px); padding-bottom: 44px; }
  .topbar { min-height: 82px; }
  .topbar h2 { font-size: 25px; }
  .topbar .eyebrow { display: none; }
  .framework-rail { grid-template-columns: 1fr; }
  .lens-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .status-card { display: grid; }
}

@media print {
  body {
    background: #fff;
  }

  .sidebar,
  .topbar,
  .practice-reminder,
  .r-primer-panel,
  .fit-hero,
  .intake-panel,
  .checks-panel,
  .safety-panel,
  #libraryView,
  #sourcesView {
    display: none !important;
  }

  .app-shell,
  .main {
    display: block;
    padding: 0;
  }

  .summary-band {
    box-shadow: none;
    border: 0;
  }
}
