/* BedsideMed styles. Sections: tokens, base, layout, components, pages, practice tools, print. */

/* ---------- Tokens ---------- */
:root {
  --bg: #f6f7f5;
  --surface: #ffffff;
  --surface-2: #eef2f1;
  --border: #d9e0de;
  --text: #1c2524;
  --text-muted: #56625f;
  --accent: #0b6e75;
  --accent-strong: #08545a;
  --accent-soft: #dcefee;
  --focus: #f0a400;
  --danger: #b3261e;
  --danger-soft: #fbe9e7;
  --danger-solid: #b3261e;
  --warn: #8a5a00;
  --warn-soft: #fff4dc;
  --ok: #1d6b3a;
  --ok-soft: #e3f3e8;
  --info-soft: #e7eef9;
  --info: #24527f;
  --shadow: 0 1px 2px rgba(16, 24, 22, .06), 0 2px 8px rgba(16, 24, 22, .05);
  --radius: 10px;
  --radius-sm: 6px;
  --sidebar-w: 268px;
  --topbar-h: 60px;
  --read-w: 46rem;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --fs: 1rem;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111716; --surface: #182120; --surface-2: #1f2a29; --border: #2f3c3a; --text: #e6ecea; --text-muted: #a3b1ae;
    --accent: #4fb8be; --accent-strong: #7fd0d4; --accent-soft: #173638; --danger: #ff8a80; --danger-soft: #3a1c1a;
    --warn: #f3c66b; --warn-soft: #3a2f16; --ok: #7fd49a; --ok-soft: #17301f; --info-soft: #1b2a3a; --info: #9cc2ea;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #111716; --surface: #182120; --surface-2: #1f2a29; --border: #2f3c3a; --text: #e6ecea; --text-muted: #a3b1ae;
  --accent: #4fb8be; --accent-strong: #7fd0d4; --accent-soft: #173638; --danger: #ff8a80; --danger-soft: #3a1c1a;
  --warn: #f3c66b; --warn-soft: #3a2f16; --ok: #7fd49a; --ok-soft: #17301f; --info-soft: #1b2a3a; --info: #9cc2ea;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4); color-scheme: dark;
}
:root[data-text="large"] { --fs: 1.125rem; }

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { font-size: 100%; -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text); font-family: var(--font); font-size: var(--fs); line-height: 1.6;
  min-height: 100vh; display: flex; flex-direction: column;
}
h1, h2, h3, h4 { line-height: 1.25; margin: 1.6em 0 .5em; }
h1 { font-size: 1.85rem; margin-top: 0; }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.1rem; }
p { margin: 0 0 1em; }
a { color: var(--accent); text-underline-offset: 2px; }
a:hover { color: var(--accent-strong); }
button, input, select, textarea { font: inherit; color: inherit; }
img, svg { max-width: 100%; }
svg { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 3px; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; left: 1rem; top: -3rem; z-index: 100; background: var(--surface); padding: .5rem 1rem; border-radius: var(--radius-sm); }
.skip-link:focus { top: .5rem; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
:root[data-motion="reduce"] * { transition: none !important; animation: none !important; }

/* ---------- Layout ---------- */
.topbar {
  position: sticky; top: 0; z-index: 30; height: var(--topbar-h); display: flex; align-items: center; gap: 1rem;
  padding: 0 1rem; background: var(--surface); border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: .55rem; text-decoration: none; color: var(--text); font-weight: 700; font-size: 1.15rem; white-space: nowrap; }
.brand-mark { width: 28px; height: 28px; border-radius: 7px; background: var(--accent); position: relative; flex: none; }
.brand-mark::before, .brand-mark::after { content: ""; position: absolute; background: #fff; border-radius: 1px; }
.brand-mark::before { left: 11px; top: 6px; width: 6px; height: 16px; }
.brand-mark::after { left: 6px; top: 11px; width: 16px; height: 6px; }
.top-search { flex: 1; max-width: 32rem; }
.top-search input { width: 100%; padding: .5rem .8rem; border: 1px solid var(--border); border-radius: 999px; background: var(--surface-2); }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: .5rem; }
.shell { flex: 1; display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); }
.sidebar {
  position: sticky; top: var(--topbar-h); height: calc(100vh - var(--topbar-h)); overflow-y: auto; padding: 1rem .75rem 2rem;
  border-right: 1px solid var(--border); background: var(--surface);
}
.sidebar[hidden] { display: none; }
.shell:has(.sidebar[hidden]) { grid-template-columns: minmax(0, 1fr); }
.nav-group { margin-bottom: 1.25rem; }
.nav-group h2 { font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); margin: 0 .6rem .35rem; }
.nav-group ul { list-style: none; margin: 0; padding: 0; }
.nav-group a {
  display: flex; align-items: center; gap: .6rem; padding: .45rem .6rem; border-radius: var(--radius-sm); color: var(--text); text-decoration: none; font-size: .95rem;
}
.nav-group a:hover { background: var(--surface-2); }
.nav-group a[aria-current="page"] { background: var(--accent-soft); color: var(--accent-strong); font-weight: 600; }
.nav-group svg { width: 18px; height: 18px; flex: none; }
.nav-badge { margin-left: auto; font-size: .75rem; background: var(--accent); color: #fff; border-radius: 999px; padding: 0 .5rem; }
main { padding: 2rem clamp(1rem, 3vw, 3rem) 4rem; min-width: 0; outline: none; }
.page { max-width: 72rem; margin: 0 auto; }
.page-narrow { max-width: var(--read-w); margin: 0 auto; }
.site-footer { border-top: 1px solid var(--border); background: var(--surface); padding: .9rem 1.25rem; font-size: .85rem; color: var(--text-muted); }
.site-footer p { margin: 0; max-width: 72rem; }
.scrim { position: fixed; inset: var(--topbar-h) 0 0 0; background: rgba(0, 0, 0, .35); z-index: 25; }
.scrim[hidden] { display: none; }

@media (max-width: 960px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .menu-btn { display: inline-flex; }
  .sidebar { position: fixed; z-index: 26; left: 0; top: var(--topbar-h); width: min(86vw, 320px); transform: translateX(-105%); transition: transform .2s ease; }
  .sidebar.open { transform: none; box-shadow: var(--shadow); }
  .top-search { display: none; }
  .brand-name { display: none; }
}
@media (max-width: 600px) {
  .account-btn .small { display: none; }
  .topbar { gap: .5rem; padding: 0 .6rem; }
  .btn-emergency { padding: .5rem .7rem; }
}
@media (min-width: 961px) { .menu-btn { display: none !important; } }

/* ---------- Components ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem; padding: .55rem 1rem; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer; text-decoration: none; font-weight: 600; line-height: 1.2;
}
.btn:hover { background: var(--surface-2); color: var(--text); }
.btn svg { width: 18px; height: 18px; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-strong); border-color: var(--accent-strong); color: #fff; }
:root[data-theme="dark"] .btn-primary, :root[data-theme="dark"] .btn-primary:hover { color: #0b1514; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .btn-primary { color: #0b1514; } }
.btn-danger { color: var(--danger); border-color: var(--danger); }
.btn-emergency { white-space: nowrap; flex: none; background: var(--danger-solid); border-color: var(--danger-solid); color: #fff; }
.btn-emergency:hover { background: #8f1d17; color: #fff; }
.btn-small { padding: .3rem .65rem; font-size: .875rem; }
.btn-link { background: none; border: 0; color: var(--accent); padding: 0; font-weight: 600; cursor: pointer; text-decoration: underline; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .55; cursor: not-allowed; }
.btn-row { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; margin: 1rem 0; }
.icon-btn { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 50%; border: 1px solid transparent; background: none; cursor: pointer; color: var(--text); }
.icon-btn:hover { background: var(--surface-2); }
.icon-btn svg { width: 22px; height: 22px; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem; box-shadow: var(--shadow); }
.card > :first-child { margin-top: 0; }
.card > :last-child { margin-bottom: 0; }
.card h2, .card h3 { margin-top: 0; }
.grid { display: grid; gap: 1rem; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 22rem), 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 16rem), 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 12rem), 1fr)); }
.stack > * + * { margin-top: 1rem; }
.muted { color: var(--text-muted); }
.small { font-size: .875rem; }
.eyebrow { font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); font-weight: 600; margin: 0 0 .25rem; }
.tag { display: inline-block; font-size: .75rem; font-weight: 600; padding: .1rem .5rem; border-radius: 999px; background: var(--surface-2); color: var(--text-muted); border: 1px solid var(--border); }
.tag-accent { background: var(--accent-soft); color: var(--accent-strong); border-color: transparent; }
.tag-red { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.tag-ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.tag-warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }

.notice { border-radius: var(--radius); padding: 1rem 1.15rem; border: 1px solid var(--border); background: var(--surface); margin: 1rem 0; }
.notice > :last-child { margin-bottom: 0; }
.notice h2, .notice h3 { margin: 0 0 .4rem; font-size: 1.05rem; }
.notice ul { margin: .3rem 0 0; padding-left: 1.2rem; }
.notice-now { background: var(--danger-soft); border-color: color-mix(in srgb, var(--danger) 40%, transparent); }
.notice-now h3 { color: var(--danger); }
.notice-soon { background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn) 40%, transparent); }
.notice-soon h3 { color: var(--warn); }
.notice-region { background: var(--info-soft); border-color: color-mix(in srgb, var(--info) 30%, transparent); }
.notice-info { background: var(--accent-soft); border-color: transparent; }
.notice-ok { background: var(--ok-soft); border-color: transparent; }

.progress { height: 8px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--accent); border-radius: 999px; }
.stat { display: flex; flex-direction: column; gap: .15rem; }
.stat-value { font-size: 1.8rem; font-weight: 700; line-height: 1.1; }
.stat-label { color: var(--text-muted); font-size: .875rem; }

table { border-collapse: collapse; width: 100%; }
th, td { text-align: left; padding: .5rem .6rem; border-bottom: 1px solid var(--border); vertical-align: top; }
th { font-size: .85rem; color: var(--text-muted); font-weight: 600; }
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.table-wrap table th:first-child, .table-wrap table td:first-child { padding-left: 1rem; }

label { font-weight: 600; }
.field { display: flex; flex-direction: column; gap: .3rem; margin-bottom: 1rem; }
.field small { color: var(--text-muted); font-weight: 400; }
input[type="text"], input[type="password"], input[type="search"], input[type="url"], input[type="tel"], select, textarea {
  padding: .55rem .7rem; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); width: 100%;
}
textarea { min-height: 7rem; resize: vertical; line-height: 1.5; }
.form-error { color: var(--danger); font-weight: 600; }
.choice { display: flex; gap: .65rem; align-items: flex-start; padding: .7rem .85rem; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); cursor: pointer; font-weight: 400; }
.choice:hover { border-color: var(--accent); }
.choice input { margin-top: .3rem; flex: none; }
.choice.is-correct { border-color: var(--ok); background: var(--ok-soft); }
.choice.is-wrong { border-color: var(--danger); background: var(--danger-soft); }
.choice.is-missed { border-color: var(--ok); border-style: dashed; }
.choices { display: grid; gap: .5rem; margin: .75rem 0; }

.loading { display: flex; align-items: center; gap: .75rem; color: var(--text-muted); padding: 3rem 0; justify-content: center; }
.spinner { width: 22px; height: 22px; border-radius: 50%; border: 3px solid var(--border); border-top-color: var(--accent); animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.breadcrumbs { font-size: .875rem; color: var(--text-muted); margin-bottom: .75rem; }
.breadcrumbs a { color: var(--text-muted); }
.page-head { display: flex; flex-wrap: wrap; gap: 1rem; align-items: flex-end; justify-content: space-between; margin-bottom: 1.5rem; }
.page-head h1 { margin: 0; }
.page-head p { margin: .35rem 0 0; color: var(--text-muted); max-width: 46rem; }

.toolbar { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; margin-bottom: 1rem; }
.toolbar input[type="search"] { max-width: 24rem; }
.toolbar select { width: auto; }
.empty { text-align: center; color: var(--text-muted); padding: 2rem 1rem; }

.account-menu { position: relative; }
.account-btn { display: flex; align-items: center; gap: .5rem; padding: .3rem .6rem .3rem .3rem; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); cursor: pointer; }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-strong); display: grid; place-items: center; font-weight: 700; font-size: .85rem; }
.menu-pop { position: absolute; right: 0; top: calc(100% + .4rem); min-width: 14rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: .35rem; z-index: 40; }
.menu-pop a, .menu-pop button { display: block; width: 100%; text-align: left; padding: .5rem .7rem; border-radius: var(--radius-sm); background: none; border: 0; color: var(--text); text-decoration: none; cursor: pointer; }
.menu-pop a:hover, .menu-pop button:hover { background: var(--surface-2); }
.menu-pop hr { border: 0; border-top: 1px solid var(--border); margin: .3rem 0; }

/* ---------- Pages ---------- */
.auth-wrap { max-width: 64rem; margin: 0 auto; display: grid; gap: 2rem; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); align-items: start; }
@media (max-width: 860px) { .auth-wrap { grid-template-columns: minmax(0, 1fr); } }
.auth-intro h1 { font-size: 2.2rem; }
.auth-intro .lede { font-size: 1.15rem; color: var(--text-muted); }
.profile-list { list-style: none; padding: 0; margin: 0 0 1rem; display: grid; gap: .5rem; }
.profile-list button { width: 100%; display: flex; align-items: center; gap: .75rem; padding: .6rem .75rem; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); cursor: pointer; text-align: left; }
.profile-list button[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); }
.tabs { display: flex; gap: .25rem; border-bottom: 1px solid var(--border); margin-bottom: 1rem; flex-wrap: wrap; }
.tabs button { background: none; border: 0; border-bottom: 3px solid transparent; padding: .55rem .9rem; cursor: pointer; font-weight: 600; color: var(--text-muted); }
.tabs button[aria-selected="true"] { color: var(--accent-strong); border-bottom-color: var(--accent); }

.dash-hero { display: grid; gap: 1rem; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); margin-bottom: 1rem; }
@media (max-width: 1100px) { .dash-hero { grid-template-columns: minmax(0, 1fr); } }
.plan-list { list-style: none; padding: 0; margin: .75rem 0 1rem; display: grid; gap: .4rem; }
.plan-list li { display: flex; gap: .75rem; align-items: baseline; }
.plan-list .mins { flex: none; width: 4.5rem; font-weight: 700; color: var(--accent-strong); }
.unit-bars { display: grid; gap: .55rem; }
.unit-bar { display: grid; grid-template-columns: 5.2rem minmax(0, 1fr) 3rem; gap: .6rem; align-items: center; font-size: .875rem; text-decoration: none; color: var(--text); }
.unit-bar:hover .progress { outline: 2px solid var(--accent-soft); }
.unit-bar .pct { text-align: right; color: var(--text-muted); }

.level-block { margin-bottom: 2.5rem; }
.unit-list { display: grid; gap: .75rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 20rem), 1fr)); }
.unit-card { display: flex; flex-direction: column; gap: .5rem; text-decoration: none; color: var(--text); }
.unit-card:hover { border-color: var(--accent); }
.unit-card h3 { margin: 0; font-size: 1.02rem; }
.unit-card .meta { display: flex; justify-content: space-between; font-size: .85rem; color: var(--text-muted); }
.lesson-list { list-style: none; padding: 0; margin: 0; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.lesson-list li + li { border-top: 1px solid var(--border); }
.lesson-list a { display: grid; grid-template-columns: 2rem minmax(0, 1fr) auto; gap: .75rem; align-items: center; padding: .8rem 1rem; text-decoration: none; color: var(--text); }
.lesson-list a:hover { background: var(--surface-2); }
.check { width: 1.5rem; height: 1.5rem; border-radius: 50%; border: 2px solid var(--border); display: grid; place-items: center; }
.check.done { background: var(--ok); border-color: var(--ok); color: #fff; }
.check svg { width: 14px; height: 14px; stroke-width: 3; }

.lesson-layout { display: grid; gap: 2.5rem; grid-template-columns: minmax(0, 1fr) 17rem; max-width: 72rem; margin: 0 auto; }
@media (max-width: 1200px) { .lesson-layout { grid-template-columns: minmax(0, 1fr); } .lesson-aside { display: none; } }
.lesson-main { max-width: var(--read-w); }
.lesson-aside { position: sticky; top: calc(var(--topbar-h) + 1.5rem); align-self: start; font-size: .9rem; }
.lesson-aside ol { padding-left: 1.1rem; margin: .5rem 0 0; }
.lesson-aside a { color: var(--text-muted); text-decoration: none; }
.lesson-aside a:hover { color: var(--accent); }
.lesson-meta { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin: .5rem 0 1.25rem; }
.objectives { padding-left: 1.2rem; }
.summary p { font-size: 1.05em; }
.keypoints { padding-left: 1.2rem; }
.keypoints li { margin-bottom: .3rem; }
.link-list { list-style: none; padding: 0; margin: 0; display: grid; gap: .65rem; }
.link-item { display: grid; grid-template-columns: 2.5rem minmax(0, 1fr); gap: .75rem; padding: .85rem 1rem; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.link-icon { width: 2.5rem; height: 2.5rem; border-radius: var(--radius-sm); display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-strong); }
.link-icon svg { width: 20px; height: 20px; }
.link-item a { font-weight: 600; }
.link-item p { margin: .2rem 0 0; font-size: .92rem; color: var(--text-muted); }
.embed { margin-top: .6rem; aspect-ratio: 16 / 9; width: 100%; border: 0; border-radius: var(--radius-sm); }
.dose-box { border: 2px solid var(--accent); border-radius: var(--radius); padding: 1rem 1.15rem; background: var(--surface); margin: 1rem 0; }
.dose-box h3 { margin: 0 0 .35rem; display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.dose-box table { font-size: .9rem; margin: .6rem 0; }
.dose-box .sources { font-size: .85rem; color: var(--text-muted); }
.dose-withheld { border-color: var(--warn); }
.terms td:first-child { font-weight: 600; white-space: nowrap; }
.lesson-nav { display: flex; justify-content: space-between; gap: 1rem; margin-top: 2.5rem; padding-top: 1.25rem; border-top: 1px solid var(--border); }
.complete-bar { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; justify-content: space-between; padding: 1rem 1.15rem; margin: 2rem 0 1rem; border-radius: var(--radius); background: var(--accent-soft); }
.complete-bar p { margin: 0; }
.opening-overlay { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; background: rgba(5, 15, 15, .65); padding: 1.5rem; }
.opening-overlay .card { max-width: 36rem; font-size: 1.1rem; }

/* ---------- Quiz ---------- */
.quiz { margin-top: 1rem; }
.quiz-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: .75rem; }
.q-card { padding: 1.25rem; }
.q-case { background: var(--surface-2); border-left: 4px solid var(--accent); padding: .7rem .9rem; border-radius: var(--radius-sm); margin-bottom: .75rem; }
.q-stem { font-weight: 600; font-size: 1.05rem; }
.feedback { margin-top: .8rem; padding: .8rem 1rem; border-radius: var(--radius-sm); }
.feedback.ok { background: var(--ok-soft); }
.feedback.bad { background: var(--danger-soft); }
.feedback.neutral { background: var(--surface-2); }
.score-big { font-size: 2.6rem; font-weight: 800; line-height: 1; }
.result-list { list-style: none; padding: 0; margin: 0; display: grid; gap: .5rem; }
.result-list li { padding: .6rem .8rem; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--surface); }
.q-dots { display: flex; flex-wrap: wrap; gap: .3rem; }
.q-dots button { width: 2rem; height: 2rem; border-radius: 50%; border: 1px solid var(--border); background: var(--surface); cursor: pointer; font-size: .8rem; }
.q-dots button.answered { background: var(--accent-soft); border-color: var(--accent); }
.q-dots button[aria-current="step"] { outline: 2px solid var(--accent); }
.tier { font-weight: 800; font-size: 1.4rem; }
.tier-excellent { color: var(--ok); } .tier-safe { color: var(--accent-strong); } .tier-needs { color: var(--danger); }

/* ---------- Practice tools ---------- */
.level-choices { display: grid; gap: .5rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 9rem), 1fr)); margin: 1rem 0; }
.level-choices button { padding: .8rem .6rem; border-radius: var(--radius-sm); border: 2px solid var(--border); background: var(--surface); cursor: pointer; font-weight: 700; }
.level-choices button:hover { border-color: var(--accent); }
.level-choices button.is-correct { border-color: var(--ok); background: var(--ok-soft); }
.level-choices button.is-wrong { border-color: var(--danger); background: var(--danger-soft); }
.lv-emergency { color: var(--danger); } .lv-urgent { color: var(--warn); }
.chat { display: grid; gap: .6rem; margin: 1rem 0; }
.bubble { max-width: 85%; padding: .7rem .95rem; border-radius: 14px; line-height: 1.5; }
.bubble.them { background: var(--surface-2); border-top-left-radius: 4px; }
.bubble.me { background: var(--accent-soft); margin-left: auto; border-top-right-radius: 4px; }
.bubble.sys { max-width: 100%; background: none; border: 1px dashed var(--border); color: var(--text-muted); font-size: .92rem; }
.bubble .who { display: block; font-size: .75rem; font-weight: 700; color: var(--text-muted); margin-bottom: .15rem; }
.scen-layout { display: grid; gap: 2rem; grid-template-columns: minmax(0, 1fr) 20rem; }
@media (max-width: 1100px) { .scen-layout { grid-template-columns: minmax(0, 1fr); } }
.scen-side { align-self: start; position: sticky; top: calc(var(--topbar-h) + 1.5rem); }
.element-list { list-style: none; padding: 0; margin: .5rem 0; display: grid; gap: .3rem; font-size: .92rem; }
.element-list li { display: flex; gap: .5rem; }
.timer { font-variant-numeric: tabular-nums; font-weight: 800; font-size: 1.4rem; }
.timer.low { color: var(--danger); }
.timer-bar { height: 6px; background: var(--surface-2); border-radius: 999px; overflow: hidden; margin: .4rem 0 1rem; }
.timer-bar > span { display: block; height: 100%; background: var(--accent); transition: width 1s linear; }
.doc { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.5rem; font-family: Georgia, "Times New Roman", serif; }
.doc-head { border-bottom: 2px solid var(--text); padding-bottom: .6rem; margin-bottom: 1rem; font-family: var(--font); font-size: .9rem; }
.doc-head dl { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: .15rem .9rem; margin: 0; }
.doc-head dt { font-weight: 700; text-transform: capitalize; }
.doc-head dd { margin: 0; }
.doc table { font-family: var(--mono); font-size: .88rem; }
.doc .flag-H, .doc .flag-L { font-weight: 800; color: var(--danger); }
.fictional { display: inline-block; font-family: var(--font); font-size: .75rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--warn); border: 1px solid var(--warn); padding: .05rem .45rem; border-radius: 4px; }
.glossary-table td:first-child { font-weight: 700; white-space: nowrap; }
.az { display: flex; flex-wrap: wrap; gap: .25rem; margin-bottom: 1rem; }
.az a { min-width: 1.9rem; text-align: center; padding: .15rem .3rem; border-radius: 4px; text-decoration: none; background: var(--surface); border: 1px solid var(--border); font-size: .85rem; }
.drug-card h2.drug-name { margin: 0 0 .2rem; font-size: 1.1rem; }
.drug-card dl { margin: .6rem 0 0; }
.drug-card dt { font-weight: 700; margin-top: .55rem; font-size: .9rem; }
.drug-card dd { margin: .1rem 0 0; }
.drug-card ul { margin: .1rem 0 0; padding-left: 1.1rem; }
.em-hero { display: grid; gap: 1rem; grid-template-columns: minmax(0, 1fr) auto; align-items: center; background: var(--danger-solid); color: #fff; border-radius: var(--radius); padding: 1.5rem 1.75rem; margin-bottom: 1.5rem; }
.em-hero h1 { margin: 0 0 .3rem; color: #fff; }
.em-hero p { margin: 0; font-size: 1.1rem; }
.em-hero a { color: #fff; }
.em-call { font-size: clamp(2.5rem, 7vw, 4rem); font-weight: 900; text-decoration: none; letter-spacing: .02em; }
.em-lines { display: flex; flex-wrap: wrap; gap: 1rem; margin-top: .75rem; font-size: .95rem; }
.checklist-card ol, .checklist-card ul { padding-left: 1.2rem; }
.search-results { list-style: none; padding: 0; margin: 0; display: grid; gap: .5rem; }
.search-results a { display: block; padding: .7rem .9rem; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); text-decoration: none; color: var(--text); }
.search-results a:hover { border-color: var(--accent); }

/* ---------- Print ---------- */
@media print {
  :root { --bg: #fff; --surface: #fff; --text: #000; --text-muted: #333; --border: #bbb; }
  .topbar, .sidebar, .site-footer, .scrim, .no-print, .quiz, .lesson-aside, .lesson-nav, .complete-bar, .btn, .skip-link, .embed { display: none !important; }
  .shell { display: block; }
  main { padding: 0; }
  .lesson-layout { display: block; }
  a[href^="http"]::after { content: " (" attr(href) ")"; font-size: .8em; color: #333; word-break: break-all; }
  .card, .notice, .dose-box, .link-item { box-shadow: none; break-inside: avoid; }
  .print-only { display: block !important; }
}
.print-only { display: none; }
