/* Cheatsheet library + sheet rendering. House print palette (navy/burgundy/gold/
   parchment) extended with one bright accent per sheet family. */

:root {
  --sh-navy: #17273f; --sh-burg: #7a1e2b; --sh-gold: #b4913e; --sh-parch: #f8f4ea;
  --sh-core: #0e7c86; --sh-ngn: #6d4fc3; --sh-quick: #c8860a; --sh-mnem: #b23a6f;
  --sh-case: #17507a; --sh-algo: #1e7a3d; --sh-vals: #2563a8; --sh-drug: #7a1e2b;
}
.sh-fam-CORE  { --fam: var(--sh-core); }
.sh-fam-NGN   { --fam: var(--sh-ngn); }
.sh-fam-QUICK { --fam: var(--sh-quick); }
.sh-fam-MNEM  { --fam: var(--sh-mnem); }
.sh-fam-CASE  { --fam: var(--sh-case); }
.sh-fam-ALGO  { --fam: var(--sh-algo); }
.sh-fam-VALS  { --fam: var(--sh-vals); }
.sh-fam-DRUG  { --fam: var(--sh-drug); }
.sh-fam-PREP  { --fam: var(--product-accent); }

/* ---------- library ---------- */
.sh-progress { position: relative; background: var(--product-accent-soft); border-radius: 999px;
  height: 26px; margin: 0.8rem 0 1.2rem; overflow: hidden; }
.sh-progress div { background: linear-gradient(90deg, var(--product-accent), var(--sh-gold));
  height: 100%; border-radius: 999px; transition: width 0.4s; }
.sh-progress span { position: absolute; inset: 0; display: flex; align-items: center;
  justify-content: center; font-size: var(--text-sm); font-weight: 700; color: var(--heading); }
.sh-module { margin: 0.6rem 0; }
.sh-module summary { cursor: pointer; font-size: var(--text-base); padding: 0.2rem 0; }
.sh-module-code { color: var(--muted); font-size: var(--text-sm); font-weight: 400; margin-left: .35rem; }
.sh-modscope { margin: 0.6rem 0 0.4rem; }
.sh-lessonrow { display: flex; flex-wrap: wrap; gap: 0.4rem; align-items: baseline;
  padding: 0.35rem 0; border-top: 1px dashed var(--line); }
.sh-lessontitle { font-size: var(--text-sm); min-width: 46%; flex: 1; }
.sh-chip { display: inline-block; font-size: var(--text-xs); font-weight: 700; padding: 0.18rem 0.55rem;
  border-radius: 999px; margin: 0.12rem 0.15rem; background: color-mix(in srgb, var(--fam) 12%, white);
  color: var(--fam); border: 1.5px solid var(--fam); }
.sh-chip.clickable:hover { background: var(--fam); color: #fff; }
.sh-pending { opacity: 0.45; border-style: dashed; }
.sh-freetag { background: var(--good); color: #fff; border-radius: 4px; padding: 0 0.3rem; font-size: var(--text-xs); }

/* ---------- sheet chrome ---------- */
.sh-toolbar { display: flex; justify-content: space-between; margin-bottom: 0.8rem; gap: 0.5rem; }
.sheet { background: var(--card); border: 1px solid var(--line); border-top: 8px solid var(--fam);
  border-radius: 12px; padding: 1.6rem 1.9rem; max-width: 880px; margin: 0 auto;
  box-shadow: 0 2px 14px rgba(23, 39, 63, 0.08); }
.sh-head { display: flex; justify-content: space-between; gap: 1rem; align-items: flex-start;
  border-bottom: 3px solid var(--sh-navy); padding-bottom: 0.7rem; margin-bottom: 1rem; }
.sh-head h1 { margin: 0.15rem 0 0; font-size: var(--text-2xl); color: var(--sh-navy); }
.sh-eyebrow { font-size: var(--text-xs); font-weight: 800; letter-spacing: 0.09em; text-transform: uppercase;
  color: var(--fam); }
.sh-sub { margin: 0.2rem 0 0; color: var(--muted); }
.sh-badge { background: var(--sh-navy); color: var(--sh-parch); font-weight: 800;
  padding: 0.35rem 0.8rem; border-radius: 8px; letter-spacing: 0.06em; }
.sh-objectives { background: var(--sh-parch); color: #12303f;
  border-left: 5px solid var(--sh-gold);
  border-radius: 0 8px 8px 0; padding: 0.6rem 1rem; margin-bottom: 1rem; font-size: var(--text-base); }
.sh-objectives ul { margin: 0.3rem 0 0; padding-left: 1.2rem; }
.sh-h { color: var(--fam); margin: 1.3rem 0 0.4rem; }
.sh-p { line-height: 1.62; }
.sh-blocktitle { font-weight: 800; color: var(--fam); font-size: var(--text-base); margin-bottom: 0.5rem; }
.sh-cite { color: var(--sh-gold); font-weight: 700; margin-left: 2px; }
.sh-foot { margin-top: 1.4rem; padding-top: 0.6rem; border-top: 1px solid var(--line);
  font-size: var(--text-xs); color: var(--muted); display: flex; justify-content: space-between; flex-wrap: wrap; }

/* ---------- content blocks ---------- */
.sh-bullets { margin: 0.7rem 0; }
.sh-bullets ul, .sh-bullets ol { margin: 0.2rem 0; padding-left: 1.3rem; }
.sh-bullets li { margin: 0.22rem 0; }
.sh-selftest { background: color-mix(in srgb, var(--sh-ngn) 8%, white);
  border: 2px dashed var(--sh-ngn); border-radius: 10px; padding: 0.7rem 1rem; }
.sh-selftest .sh-blocktitle { color: var(--sh-ngn); }
.sh-tablewrap { overflow-x: auto; margin: 0.8rem 0; }
.sh-table { border-collapse: collapse; width: 100%; font-size: var(--text-sm); }
.sh-table caption { caption-side: top; text-align: left; font-weight: 800; color: var(--fam);
  padding-bottom: 0.35rem; }
.sh-table th { background: var(--sh-navy); color: var(--sh-parch); padding: 0.4rem 0.55rem;
  text-align: left; }
.sh-table td { border: 1px solid var(--line); padding: 0.38rem 0.55rem; vertical-align: top; }
.sh-table tbody tr:nth-child(even) { background: var(--surface-2); }
.sh-vals .sh-normal { background: var(--good-bg); font-weight: 700; }
.sh-vals .sh-critlow { background: #fdeed6; color: #8a5a0d; font-weight: 700; }
.sh-vals .sh-crithigh { background: var(--bad-bg); color: var(--bad); font-weight: 700; }
.sh-footnote { font-size: var(--text-xs); color: var(--muted); margin-top: 0.25rem; }

.sh-callout { border-radius: 10px; padding: 0.65rem 0.95rem; margin: 0.8rem 0; font-size: var(--text-base);
  border-left: 6px solid; color: #12303f; }
.sh-co-exam_tip { background: #eef7f8; border-color: var(--sh-core); }
.sh-co-safety { background: var(--bad-bg); border-color: var(--bad); }
.sh-co-evidence_update { background: #eef1fb; border-color: var(--sh-ngn); }
.sh-co-delegation { background: #f0f7ef; border-color: var(--sh-algo); }
.sh-co-equity { background: #f7f0fa; border-color: #8244a8; }
.sh-co-monitoring { background: #eef4fb; border-color: var(--sh-vals); }
.sh-co-trap { background: #fdf3e3; border-color: var(--sh-quick); }

/* mnemonic */
.sh-mnem { display: flex; gap: 1rem; align-items: flex-start; background: var(--card);
  border: 2px solid var(--sh-mnem); border-radius: 12px; padding: 0.8rem 1rem; margin: 0.8rem 0; }
.sh-mnemword { display: flex; flex-direction: column; gap: 3px; }
.sh-mnemword span { background: var(--sh-mnem); color: #fff; font-weight: 900; font-size: var(--text-lg);
  width: 2rem; height: 2rem; display: flex; align-items: center; justify-content: center;
  border-radius: 7px; }
.sh-mnembody ul { margin: 0; padding-left: 1.1rem; }
.sh-mnemuse { font-size: var(--text-sm); color: var(--muted); margin: 0.3rem 0; }
.sh-evbadge { font-size: var(--text-xs); font-weight: 800; border-radius: 999px; padding: 0.15rem 0.6rem; }
.sh-ev-good { background: var(--good-bg); color: var(--good); }
.sh-ev-warn { background: #fdf3e3; color: #8a5a0d; }
.sh-ev-bad { background: var(--bad-bg); color: var(--bad); }
.sh-evnote { font-size: var(--text-sm); color: var(--muted); margin-top: 0.25rem; }

/* red flags */
.sh-redflags { margin: 0.9rem 0; }
.sh-pri { white-space: nowrap; font-weight: 800; font-size: var(--text-xs); }

/* algorithm */
.sh-algo { background: color-mix(in srgb, var(--sh-algo) 5%, white); border: 1px solid var(--line);
  border-radius: 12px; padding: 1rem; margin: 0.9rem 0; }
.sh-node { border-radius: 10px; padding: 0.5rem 0.85rem; margin: 0 auto; max-width: 480px;
  text-align: center; font-size: var(--text-sm); font-weight: 600; box-shadow: 0 1px 3px rgba(0,0,0,0.12); }
.sh-node-start, .sh-node-end { background: var(--sh-navy); color: var(--sh-parch); border-radius: 999px; }
.sh-node-assess { background: #eef4fb; color: #12303f; border: 2px solid var(--sh-vals); }
.sh-node-decision { background: #fdf3e3; color: #12303f; border: 2px solid var(--sh-quick); border-radius: 4px;
  transform: none; font-style: italic; }
.sh-node-action { background: #f0f7ef; color: #12303f; border: 2px solid var(--sh-algo); }
.sh-arrow { text-align: center; color: var(--sh-navy); font-weight: 800; margin: 0.15rem 0; }
.sh-arrow span { display: inline-block; background: var(--sh-navy); color: #fff; font-size: var(--text-xs);
  border-radius: 999px; padding: 0.05rem 0.5rem; margin-right: 0.3rem; vertical-align: 2px; }
.sh-branches { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 0.6rem; align-items: start; margin-top: 0.2rem; }
.sh-branch { border-left: 2px dashed var(--line); padding: 0 0.3rem; }
.sh-algo-back { text-align: center; font-size: var(--text-xs); color: var(--muted); }

/* drug card */
.sh-drug { border: 2px solid var(--sh-drug); border-radius: 12px; margin: 0.9rem 0; overflow: hidden; }
.sh-drughead { background: var(--sh-drug); color: #fff; padding: 0.5rem 0.9rem; display: flex;
  gap: 0.6rem; align-items: center; flex-wrap: wrap; }
.sh-drugname { font-weight: 900; font-size: var(--text-lg); }
.sh-drugclass { opacity: 0.9; font-size: var(--text-sm); }
.sh-tag { font-size: var(--text-xs); font-weight: 800; background: rgba(255,255,255,0.2); color: inherit;
  border-radius: 999px; padding: 0.12rem 0.5rem; }
.sh-highalert { background: #ffd34d; color: #5a4300; }
.sh-sched { background: #fff; color: var(--sh-drug); }
.sh-proto { background: var(--sh-parch); color: var(--sh-navy); }
.sh-brands { padding: 0.3rem 0.9rem 0; font-size: var(--text-sm); color: var(--muted); }
.sh-drug > p { padding: 0 0.9rem; }
.sh-druggrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 0.4rem 1rem; padding: 0 0.9rem 0.7rem; font-size: var(--text-sm); }
.sh-druggrid ul { margin: 0.15rem 0 0; padding-left: 1.1rem; }
.sh-blackbox { background: #111; color: #ffd34d; font-weight: 700; padding: 0.5rem 0.9rem; font-size: var(--text-sm); }
.sh-antidote { background: var(--good-bg); padding: 0.4rem 0.9rem; font-size: var(--text-sm); }

/* practice items / drills */
.sh-drill, .sh-case { border: 1px solid var(--line); border-radius: 12px; padding: 0.9rem 1.1rem;
  margin: 1rem 0; background: color-mix(in srgb, var(--fam) 3%, white); }
.sh-item { background: var(--card); border: 1px solid var(--line); border-radius: 10px;
  padding: 0.7rem 0.95rem; margin: 0.7rem 0; break-inside: avoid; }
.sh-itemhead { display: flex; gap: 0.45rem; align-items: center; flex-wrap: wrap; margin-bottom: 0.4rem; }
.sh-qnum { background: var(--fam); color: #fff; font-weight: 900; border-radius: 7px; padding: 0.1rem 0.5rem; }
.sh-item .sh-tag { background: var(--product-accent-soft); color: var(--navy); }
.sh-cjmm { background: #eef1fb !important; color: var(--sh-ngn) !important; }
.sh-diff { margin-left: auto; color: var(--sh-gold); letter-spacing: 2px; }
.sh-scenario { background: var(--sh-parch); color: #12303f;
  border-radius: 8px; padding: 0.45rem 0.7rem; font-size: var(--text-sm); }
.sh-stem { margin: 0.45rem 0 0.3rem; }
.sh-opts { margin: 0.2rem 0 0.2rem; padding-left: 1.6rem; }
.sh-opts li { margin: 0.18rem 0; }
.sh-hlt { background: #fffdf4; color: #12303f; border: 1px dashed var(--sh-gold); border-radius: 8px;
  padding: 0.5rem 0.7rem; line-height: 1.9; }
.sh-span { border-bottom: 2px solid var(--sh-ngn); padding: 0.05rem 0.15rem; border-radius: 3px;
  background: #f3effc; }
.sh-clozerow { margin: 0.3rem 0; }
.sh-chipopt { display: inline-block; border: 1px solid var(--line); border-radius: 999px;
  padding: 0.08rem 0.55rem; margin: 0.1rem 0.15rem; font-size: var(--text-sm); background: var(--card); }
.sh-bowtie { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0.5rem; font-size: var(--text-sm); }
.sh-bowtie > div { border: 2px solid var(--sh-case); border-radius: 10px; padding: 0.5rem 0.6rem; background: var(--card); }
.sh-bowtie > div:nth-child(2) { border-color: var(--sh-burg); background: #fdf6f7; }
.sh-bowtie ul { margin: 0.2rem 0 0; padding-left: 1.1rem; }
.sh-ehr { display: grid; gap: 0.5rem; margin: 0.5rem 0; }
.sh-ehrpanel { border: 1px solid var(--sh-vals); border-radius: 8px; overflow: hidden;
  font-size: var(--text-sm); background: var(--card); }
.sh-ehrpanel > div:last-child { padding: 0.4rem 0.7rem; }
.sh-ehrtab { background: var(--sh-vals); color: #fff; font-weight: 700; font-size: var(--text-xs);
  text-transform: uppercase; letter-spacing: 0.05em; padding: 0.22rem 0.7rem;
  display: flex; justify-content: space-between; }
.sh-casestep { margin: 0.8rem 0; }
.sh-cjmmchip { display: inline-block; background: var(--sh-case); color: #fff; font-weight: 800;
  font-size: var(--text-xs); letter-spacing: 0.06em; border-radius: 999px; padding: 0.2rem 0.75rem;
  margin-bottom: 0.3rem; }
.sh-cjmmchip.sh-cap { background: var(--sh-burg); }
.sh-debrief { background: var(--sh-parch); color: #12303f;
  border-left: 5px solid var(--sh-gold);
  border-radius: 0 8px 8px 0; padding: 0.6rem 0.9rem; margin-top: 0.7rem; font-size: var(--text-base); }

/* answer key */
.sh-anskey { margin-top: 0.8rem; border-top: 2px dashed var(--fam); padding-top: 0.5rem; }
.sh-anskey summary { cursor: pointer; font-weight: 800; color: var(--fam); padding: 0.3rem 0; }
.sh-ans { border-left: 4px solid var(--fam); padding: 0.35rem 0.8rem; margin: 0.5rem 0;
  background: var(--card); border-radius: 0 8px 8px 0; font-size: var(--text-sm); break-inside: avoid; }
.sh-anskeytext { color: var(--good); font-weight: 800; }
.sh-rationale { margin-top: 0.2rem; }
.sh-distractor { margin-top: 0.25rem; color: #8a5a0d; font-size: var(--text-sm); }

/* references */
.sh-refs { margin-top: 1.3rem; font-size: var(--text-sm); }
.sh-refs ol { padding-left: 1.3rem; }
.sh-tier { font-size: var(--text-xs); font-weight: 800; text-transform: uppercase; letter-spacing: 0.05em;
  border-radius: 4px; padding: 0.06rem 0.35rem; margin-right: 0.35rem; background: var(--product-accent-soft);
  color: var(--navy); }
.sh-tier-regulator_or_test_plan { background: var(--sh-navy); color: var(--sh-parch); }
.sh-tier-clinical_guideline { background: var(--good-bg); color: var(--good); }

/* figures */
.sh-figure { text-align: center; margin: 0.9rem 0; }
.sh-figure img { max-width: 100%; border-radius: 8px; }
.sh-figure figcaption { font-size: var(--text-sm); color: var(--muted); }

/* ---------- editorial study library ---------- */
.sh-library { max-width: 1040px; margin: 0 auto; }
.sh-libraryhead { max-width: 720px; margin: 0 0 1.75rem; }
.sh-libraryhead h1 {
  margin: 0.2rem 0 0.55rem; color: var(--heading); font-size: var(--text-4xl);
  line-height: 1.12; letter-spacing: -0.035em;
}
.sh-libraryhead p { margin: 0; color: var(--muted); font-size: var(--text-base); line-height: 1.65; }
.sh-tracktitle {
  display: flex; align-items: center; gap: 0.65rem; margin: 2.25rem 0 0.85rem;
  padding-bottom: 0.65rem; border-bottom: 1px solid var(--line);
  color: var(--heading); font-size: var(--text-lg); letter-spacing: -0.01em;
}
.sh-library .sh-module {
  border: 1px solid var(--line); border-radius: 10px; box-shadow: none;
  margin: 0 0 0.65rem; padding: 0;
}
.sh-library .sh-module summary { padding: 0.85rem 1rem; font-size: var(--text-base); }
.sh-library .sh-modscope,
.sh-library .sh-lessonrow { margin: 0; padding: 0.7rem 1rem; border-top: 1px solid var(--line); }
.sh-library .sh-lessontitle { font-size: var(--text-sm); color: var(--ink); }
.sh-library .sh-chip {
  border: 1px solid color-mix(in srgb, var(--fam) 35%, var(--line));
  border-radius: 5px; background: transparent; color: var(--heading);
  font-size: var(--text-xs); font-weight: 650; letter-spacing: 0.01em;
}
.sh-library .sh-chip.clickable:hover { border-color: var(--fam); background: var(--product-accent-soft); color: var(--heading); }

/* PREP sheets use a restrained clinical-editorial hierarchy. */
.sheet.sh-fam-PREP {
  font-family: var(--font); font-size: var(--text-base); line-height: 1.62; color: var(--ink);
  max-width: 900px; padding: clamp(1.25rem, 4vw, 2.5rem);
  border: 1px solid var(--line); border-top: 4px solid var(--product-accent);
  border-radius: 8px; box-shadow: 0 12px 36px rgba(18, 48, 63, 0.08);
}
.sh-fam-PREP .sh-head {
  align-items: flex-start; padding-bottom: 1.15rem; margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--line);
}
.sh-fam-PREP .sh-head h1 {
  max-width: 25ch; margin: 0.35rem 0 0; color: var(--heading);
  font-size: var(--text-4xl); line-height: 1.12; letter-spacing: -0.035em;
}
.sh-fam-PREP .sh-eyebrow {
  color: var(--product-accent); font-size: var(--text-xs); font-weight: 700; letter-spacing: 0.12em;
}
.sh-fam-PREP .sh-badge {
  border: 1px solid var(--line); border-radius: 4px; background: transparent;
  color: var(--muted); font-size: var(--text-xs); font-weight: 700; letter-spacing: 0.08em;
}
.sh-fam-PREP .sh-sub { margin-top: 0.45rem; font-size: var(--text-base); line-height: 1.5; }
.sh-fam-PREP .sh-h,
.sh-fam-PREP .sh-blocktitle {
  margin: 1.6rem 0 0.55rem; color: var(--heading);
  font-size: var(--text-lg); line-height: 1.3; font-weight: 750; letter-spacing: -0.012em;
}
.sh-fam-PREP .sh-p,
.sh-fam-PREP .sh-bullets,
.sh-fam-PREP .sh-table { font-size: var(--text-base); }
.sh-fam-PREP .sh-p { margin: 0.55rem 0; line-height: 1.68; }
.sh-fam-PREP .sh-bullets { margin: 0.65rem 0 1rem; }
.sh-fam-PREP .sh-bullets li { margin: 0.34rem 0; padding-left: 0.15rem; }
.sh-fam-PREP .sh-tablewrap {
  margin: 0.9rem 0 1.25rem; border: 1px solid var(--line); border-radius: 7px;
}
.sh-fam-PREP .sh-table { font-size: var(--text-sm); line-height: 1.48; }
.sh-fam-PREP .sh-table th {
  padding: 0.65rem 0.75rem; background: var(--navy); color: #fff;
  border: 0; font-size: var(--text-xs); font-weight: 700; letter-spacing: 0.035em;
}
.sh-fam-PREP .sh-table td { padding: 0.65rem 0.75rem; border: 0; border-top: 1px solid var(--line); }
.sh-fam-PREP .sh-table tbody tr:nth-child(even) { background: color-mix(in srgb, var(--product-accent-soft) 40%, transparent); }
.sh-fam-PREP .sh-callout {
  margin: 1rem 0; padding: 0.8rem 1rem; border: 0; border-left: 3px solid var(--product-accent);
  border-radius: 0 6px 6px 0; background: var(--surface-2); color: var(--ink); font-size: var(--text-base);
}
.sh-fam-PREP .sh-callout .sh-blocktitle { margin: 0 0 0.3rem; font-size: var(--text-sm); }
.sh-fam-PREP .sh-foot { font-size: var(--text-xs); }

/* ---------- print ---------- */
@media print {
  body { background: #fff; }
  header.topbar, footer.site, .noprint, nav, .footer-disclaimer { display: none !important; }
  main { padding: 0 !important; max-width: none !important; }
  .sheet { border: none; box-shadow: none; border-radius: 0; max-width: none; padding: 0;
    border-top: 10px solid var(--fam); padding-top: 0.4in; }
  .sh-anskey { page-break-before: always; }
  .sh-anskey summary { list-style: none; }
  .sh-item, .sh-drug, .sh-mnem, .sh-callout, .sh-algo { break-inside: avoid; }
  @page { size: letter portrait; margin: 0.5in; }
}
@media (max-width: 640px) {
  .sheet { padding: 1rem; }
  .sh-bowtie { grid-template-columns: 1fr; }
}

/* ---------- Synapsis AI (MyoMed coach) ---------- */
.tutor-page { max-width: 820px; }
.tutor-lead { color: var(--ink); max-width: 62ch; margin: 0 0 1rem; }
.tutor-modes { display: grid; grid-template-columns: 1fr; gap: 0.5rem; margin: 0.9rem 0 0.4rem; }
@media (min-width: 721px) {
  .tutor-modes { display: flex; flex-wrap: wrap; gap: 0.4rem; }
}
.tutor-mode {
  border: 1px solid var(--line); background: var(--card); color: var(--heading);
  border-radius: 999px; padding: 0.45rem 0.9rem; font-size: var(--text-sm); font-weight: 600;
  cursor: pointer; min-height: 44px; min-width: 44px; width: 100%;
}
@media (min-width: 721px) {
  .tutor-mode { width: auto; }
}
.tutor-mode:hover { border-color: var(--product-accent); background: var(--product-accent-soft); color: var(--heading); }
.tutor-mode.on { background: var(--product-accent); color: var(--product-accent-ink); border-color: var(--product-accent); }
.tutor-mode.on:hover { color: var(--product-accent-ink); }
.tutor-bar {
  display: flex; gap: 0.7rem; align-items: flex-end; flex-wrap: wrap;
  margin: 0.85rem 0 0.75rem;
}
.tutor-bar label { margin: 0; }
.tutor-bar select { padding: 0.3rem 0.5rem; border: 1px solid var(--line); border-radius: 8px;
  max-width: 300px; }
.tutor-turns { color: var(--muted); font-size: var(--text-sm); font-weight: 600; padding-bottom: 0.35rem; }
.tutor-status { margin-top: 1.1rem; color: var(--muted); font-size: var(--text-sm); max-width: 62ch; }
.tutor-status summary { cursor: pointer; font-weight: 600; color: var(--muted); }
.tutor-status p { margin: 0.4rem 0 0; }
.tutor-status-chips { display: flex; flex-wrap: wrap; gap: 0.35rem; margin: 0.45rem 0 0.2rem; }
.tutor-status-chip {
  display: inline-block; font-size: var(--text-xs); font-weight: 600;
  padding: 0.14rem 0.55rem; border-radius: 999px;
  background: var(--surface-2); color: var(--muted); border: 1px solid var(--line);
}
.tutor-status-chip.ready { color: var(--heading); border-color: var(--product-accent); }
/* On-device (WebGPU) opt-in, shown only where the browser could run it. */
.tutor-device { margin-top: 0.7rem; padding-top: 0.6rem; border-top: 1px solid var(--line); }
.tutor-device-toggle { display: flex; gap: 0.5rem; align-items: flex-start; color: var(--heading); font-weight: 600; cursor: pointer; }
.tutor-device-toggle input { margin-top: 0.2rem; accent-color: var(--product-accent); }
.tutor-device-note { margin: 0.35rem 0 0; }
.tutor-device-state { display: block; margin-top: 0.35rem; color: var(--product-accent); font-weight: 600; min-height: 1em; }
.tutor-device-loading { display: flex; flex-direction: column; gap: 0.4rem; }
.tutor-device-progress { width: 100%; max-width: 20rem; height: 0.4rem; accent-color: var(--product-accent); }
.tutor-log { background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  padding: 1rem; min-height: 320px; max-height: 60vh; overflow-y: auto; display: flex;
  flex-direction: column; gap: 0.7rem; }
.tutor-turn { display: flex; }
.tutor-user { justify-content: flex-end; }
.tutor-bubble { max-width: 82%; border-radius: 14px; padding: 0.65rem 0.95rem; line-height: 1.55;
  font-size: var(--text-base); }
.tutor-user .tutor-bubble { background: var(--product-accent); color: var(--product-accent-ink); border-bottom-right-radius: 4px; }
.tutor-assistant .tutor-bubble { background: var(--bg); border: 1px solid var(--line);
  border-bottom-left-radius: 4px; }
.tutor-thinking span { animation: tutorblink 1.2s infinite; }
.tutor-thinking span:nth-child(2) { animation-delay: 0.2s; }
.tutor-thinking span:nth-child(3) { animation-delay: 0.4s; }
@keyframes tutorblink { 0%,100% { opacity: 0.2; } 50% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .tutor-thinking span { animation: none; } }
/* Elapsed clock — a silent spinner reads as frozen once a reply takes a while. */
.tutor-elapsed { display: block; margin-top: 0.35rem; font-size: var(--text-xs); font-style: normal;
  color: var(--muted, #5b6472); }
.tutor-type { display: inline-block; font-size: var(--text-xs); font-weight: 800; text-transform: uppercase;
  letter-spacing: 0.06em; background: var(--product-accent-soft); color: var(--pill-ink); border-radius: 999px;
  padding: 0.1rem 0.5rem; margin: 0 0.3rem 0.35rem 0; }
.tutor-cjmm { background: #eef1fb; color: #6d4fc3; }
.tutor-q { border: 1.5px solid var(--product-accent); border-radius: 10px; padding: 0.6rem 0.8rem;
  margin-top: 0.5rem; background: var(--card); }
.tutor-ehr { background: var(--surface-2); color: var(--ink); border-left: 4px solid #2563a8;
  border-radius: 0 6px 6px 0;
  padding: 0.4rem 0.7rem; font-size: var(--text-sm); margin-bottom: 0.4rem; }
.tutor-opts { display: flex; flex-direction: column; gap: 0.35rem; margin-top: 0.5rem; }
.tutor-opt { text-align: left; border: 1px solid var(--line); border-radius: 8px; background: var(--card);
  padding: 0.45rem 0.7rem; cursor: pointer; font-size: var(--text-sm); }
.tutor-opt:hover:not(:disabled) { border-color: var(--product-accent); background: var(--product-accent-soft); }
.tutor-opt.picked { border-color: var(--product-accent); background: var(--product-accent-soft); font-weight: 700; }
.tutor-fb { border-radius: 10px; padding: 0.55rem 0.8rem; margin-top: 0.5rem; }
.tutor-fb.good { background: var(--good-bg); }
.tutor-fb.bad { background: var(--bad-bg); }
.tutor-strategy { margin-top: 0.3rem; font-size: var(--text-sm); }
.tutor-mnem { background: #fbf2f6; color: #3d0f24; border: 1.5px solid #b23a6f; border-radius: 10px;
  padding: 0.5rem 0.8rem; margin-top: 0.5rem; }
.tutor-evbadge { font-size: var(--text-xs); font-weight: 800; border-radius: 999px; padding: 0.12rem 0.55rem; }
.tutor-ev-good { background: var(--good-bg); color: var(--good); }
.tutor-ev-warn { background: var(--warn-bg); color: var(--warn); }
.tutor-ev-bad { background: var(--bad-bg); color: var(--bad); }
.tutor-evnote { font-size: var(--text-sm); color: var(--muted); }
.tutor-lowconf { background: var(--warn-bg); color: var(--ink); border-radius: 8px;
  padding: 0.35rem 0.6rem; margin-top: 0.45rem; font-size: var(--text-sm); }
.tutor-cites { margin-top: 0.5rem; font-size: var(--text-xs); color: var(--muted); }
/* Warmer than the citation line and cooler than the refusal box: the answer
   stands, one of its references did not. Tokens, not hardcoded light values —
   see the 1.09:1 note above. */
.tutor-dropped { margin-top: 0.4rem; padding: 0.35rem 0.6rem; border-radius: 8px;
  background: var(--warn-bg); color: var(--ink); font-size: var(--text-sm); }
.tutor-cites span { text-decoration: underline dotted; }
.tutor-suggest { display: block; margin-top: 0.5rem; border: 1.5px dashed var(--product-accent);
  background: var(--card); color: var(--product-accent); border-radius: 999px; padding: 0.3rem 0.8rem;
  font-size: var(--text-sm); cursor: pointer; font-weight: 700; }
.tutor-suggest:hover { background: var(--product-accent-soft); }
.tutor-input { display: flex; flex-direction: column; gap: 0.5rem; margin-top: 0.7rem; align-items: stretch; }
.tutor-input textarea { flex: 1; border: 1.5px solid var(--line); border-radius: 10px;
  padding: 0.55rem 0.8rem; font: inherit; resize: vertical; }
.tutor-input textarea:focus { outline: 2px solid var(--product-accent); border-color: var(--product-accent); }
.tutor-input .btn { min-height: 44px; min-width: 44px; width: 100%; }
.tutor-opt { min-height: 44px; }
.tutor-bar { flex-direction: column; align-items: stretch; }
.tutor-bar .btn { min-height: 44px; min-width: 44px; width: 100%; }
.tutor-bar select { max-width: none; min-height: 44px; }
@media (min-width: 721px) {
  .tutor-input { flex-direction: row; }
  .tutor-input .btn { width: auto; }
  .tutor-bar { flex-direction: row; align-items: flex-end; }
  .tutor-bar .btn { width: auto; }
  .tutor-bar select { max-width: 300px; }
}
.tutor-disclaimer { font-size: var(--text-xs); color: var(--muted); margin-top: 0.5rem; }
.tutor-memory-chips { display: flex; flex-wrap: wrap; gap: 0.4rem 0.5rem; margin-top: 0.25rem; }
.tutor-memory-chips .tutor-suggest { display: inline-block; margin-top: 0.25rem; text-align: left; }
.tutor-memory-misses { margin-top: 0.6rem; font-size: var(--text-sm); }
.tutor-memory-misses summary { cursor: pointer; color: var(--product-accent); font-weight: 600; }
.tutor-memory-misses ul { margin: 0.4rem 0 0; padding-left: 1.1rem; }
.tutor-memory-misses li { margin: 0.3rem 0; }
.tutor-memory-when { color: var(--muted); }
.tutor-memory-stem { display: block; color: var(--muted); font-size: var(--text-sm); margin-top: 0.1rem; }
.tutor-memory-source { margin-top: 0.6rem; font-size: var(--text-xs); color: var(--muted); }
.tutor-keypoints { margin: 0.5rem 0 0; padding-left: 1.2rem; font-size: var(--text-sm); }
.tutor-keypoints li { margin: 0.2rem 0; }
.tutor-followup { margin-top: 0.5rem; font-weight: 600; color: var(--heading); }
.tutor-refusal { border: 2px solid var(--bad); background: var(--bad-bg) !important; }
/* Deliberately not the refusal treatment. A red-bordered bubble is the platform
   saying "we would not answer that"; this bubble means "we produced nothing",
   which is our failure and should not look like a verdict on the question. */
.tutor-unavailable { border: 1.5px dashed var(--line); background: var(--surface-2) !important; }
.tutor-type-unavailable { background: var(--line); color: var(--muted); }
.tutor-conf-high { background: var(--good-bg); color: var(--good); }
.tutor-conf-moderate { background: var(--warn-bg); color: var(--warn); }
.tutor-conf-low { background: var(--bad-bg); color: var(--bad); }
.tutor-unverified { background: var(--warn-bg); color: var(--warn); }
/* A7 three-state evidence chrome. Sentence case (not .tutor-type uppercase).
   Tokens so dark mode keeps contrast — do not hardcode parchment amber. */
.tutor-evidence {
  display: inline-block; font-size: var(--text-xs); font-weight: 700;
  letter-spacing: 0.01em; border-radius: 999px; padding: 0.14rem 0.55rem;
  margin: 0 0.3rem 0.35rem 0; border: 1px solid transparent;
}
.tutor-evidence-green { background: var(--good-bg); color: var(--good); border-color: var(--good); }
.tutor-evidence-amber { background: var(--warn-bg); color: var(--warn); border-color: var(--warn); }
.tutor-evidence-gray { background: var(--surface-2); color: var(--muted); border-color: var(--line); }
/* A8: tokens in flight. Neutral — never green/amber/gray or unverified. */
.tutor-evidence-typing { background: var(--surface-2); color: var(--muted); border-color: var(--line); }
.tutor-streaming .tutor-stream-text { margin-top: 0.15rem; }
.tutor-stream-caret::after {
  content: "▍";
  display: inline;
  color: var(--muted);
  animation: tutor-caret 1s step-end infinite;
}
@keyframes tutor-caret { 50% { opacity: 0; } }
.tutor-med { background: #fff8e6; color: #3f2d00; border: 2px solid var(--sh-gold); border-radius: 10px;
  padding: 0.5rem 0.8rem; margin-top: 0.55rem; font-size: var(--text-sm); }
.tutor-cites a { color: var(--product-accent); }

/* ---------- Clinical decision support ---------- */
/* The query translation is the teaching, so it is styled as the primary
   panel rather than as a footnote under the results. */
.cdss-search { display: flex; gap: 0.5rem; margin: 0.8rem 0; }
.cdss-search input { flex: 1; padding: 0.6rem 0.8rem; font-size: var(--text-base);
  border: 1.5px solid var(--product-accent); border-radius: 8px; }
.cdss-pico { margin: 0.6rem 0 1rem; border: 1px solid #d8e2e6; border-radius: 8px;
  padding: 0.6rem 0.8rem; background: #ffffff; color: #12303f; }
.cdss-pico summary { cursor: pointer; font-weight: 700; color: #12303f; }
.cdss-pico-grid { display: grid; gap: 0.6rem; margin: 0.6rem 0;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.cdss-pico-grid label { display: block; font-size: var(--text-sm); font-weight: 600; color: #12303f; }
.cdss-pico-grid input { width: 100%; padding: 0.45rem 0.6rem; margin-top: 0.25rem;
  border: 1px solid #cfd8e3; border-radius: 6px; font-weight: 400;
  background: #ffffff; color: #12303f; }
.cdss-translation { background: var(--product-accent-soft); border-left: 4px solid var(--product-accent);
  border-radius: 0 8px 8px 0; padding: 0.7rem 0.9rem; margin: 1rem 0; }
.cdss-translation h3 { margin: 0 0 0.4rem; font-size: var(--text-base); color: var(--heading); }
.cdss-translation p { margin: 0.25rem 0; font-size: var(--text-sm); }
.cdss-term { display: inline-block; border-radius: 999px; padding: 0.1rem 0.55rem;
  margin: 0.15rem 0.25rem 0.15rem 0; font-size: var(--text-sm); font-weight: 700; }
.cdss-term.kept { background: var(--card); color: var(--heading); border: 1px solid var(--product-accent); }
.cdss-term.drop { background: #eef1f5; color: #6b7684; text-decoration: line-through; }
.cdss-term.exp { background: #fff5e6; color: #8a5a00; border: 1px solid #e8c07a; }
.cdss-tips { margin: 0.5rem 0 0; padding-left: 1.1rem; font-size: var(--text-sm); }
.cdss-filters { display: flex; flex-wrap: wrap; gap: 0.4rem; align-items: center;
  margin: 0.8rem 0; font-size: var(--text-sm); }
.cdss-filters .btn { padding: 0.25rem 0.7rem; font-size: var(--text-sm); }
.cdss-hits { display: grid; gap: 0.7rem; }
.cdss-hit { border: 1px solid var(--line); border-radius: 10px; padding: 0.7rem 0.9rem;
  background: var(--card); color: var(--ink); }
.cdss-hit.locked { background: var(--surface-2); }
.cdss-hit-head { display: flex; gap: 0.5rem; align-items: baseline; flex-wrap: wrap; }
.cdss-type { display: inline-block; font-size: var(--text-xs); font-weight: 800;
  text-transform: uppercase; letter-spacing: 0.05em; border-radius: 999px;
  padding: 0.12rem 0.55rem; background: var(--product-accent-soft); color: var(--heading); }
.cdss-type-drug { background: #ffe9e9; color: #9b2226; }
.cdss-type-values { background: #e8f4ff; color: #1b4965; }
.cdss-type-algorithm { background: #eef1fb; color: #4b3fa0; }
.cdss-type-guideline { background: #e7f6ec; color: #1b5e35; }
.cdss-context { font-size: var(--text-sm); color: var(--muted); margin-top: 0.15rem; }
.cdss-snippet { margin: 0.45rem 0 0.3rem; font-size: var(--text-base); }
.cdss-locked { margin: 0.45rem 0 0.3rem; font-size: var(--text-sm); color: var(--muted); }
.cdss-refs { font-size: var(--text-sm); color: var(--ink); margin-top: 0.3rem; }
.cdss-matched { font-size: var(--text-xs); color: var(--muted); margin-top: 0.25rem; }
@media (max-width: 560px) {
  .cdss-search { flex-direction: column; }
}

/* Companion volumes list */
.sh-comp-list { list-style: none; margin: 0 0 1.5rem; padding: 0; }
.sh-comp-row { display: flex; gap: 1rem; align-items: flex-start; justify-content: space-between;
  padding: 0.8rem 1rem; border-top: 1px solid var(--line); }
.sh-comp-row:first-child { border-top: 0; }
.sh-comp-main { min-width: 0; }
.sh-comp-meta { color: var(--muted); font-size: var(--text-sm); margin-top: 0.15rem; }
.sh-comp-sum { color: var(--muted); font-size: var(--text-sm); margin-top: 0.25rem; line-height: 1.45;
  display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.sh-comp-dl { flex: 0 0 auto; white-space: nowrap; }
@media (max-width: 560px) { .sh-comp-row { flex-direction: column; } }
