/* =========================================================
   Brian Johnson · The Chart
   Plain CSS, no build step. Colors live in :root tokens.
   ========================================================= */

/* ---------- Self-hosted fonts (SIL Open Font License, see assets/fonts) ---------- */
@font-face { font-family: "Figtree"; font-style: normal; font-weight: 400; font-display: swap; src: url("/assets/fonts/figtree-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Figtree"; font-style: italic; font-weight: 400; font-display: swap; src: url("/assets/fonts/figtree-latin-400-italic.woff2") format("woff2"); }
@font-face { font-family: "Figtree"; font-style: normal; font-weight: 700; font-display: swap; src: url("/assets/fonts/figtree-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "Bricolage Grotesque"; font-style: normal; font-weight: 600; font-display: swap; src: url("/assets/fonts/bricolage-grotesque-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Bricolage Grotesque"; font-style: normal; font-weight: 800; font-display: swap; src: url("/assets/fonts/bricolage-grotesque-latin-800-normal.woff2") format("woff2"); }
@font-face { font-family: "JetBrains Mono"; font-style: normal; font-weight: 500; font-display: swap; src: url("/assets/fonts/jetbrains-mono-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "JetBrains Mono"; font-style: normal; font-weight: 700; font-display: swap; src: url("/assets/fonts/jetbrains-mono-latin-700-normal.woff2") format("woff2"); }

:root {
  --paper: #fbfaf6;
  --card: #ffffff;
  --tint: #f2f6f5;
  --ink: #17212b;
  --muted: #56626f;
  --line: #e2ded3;
  --rule: #c9e3ec;            /* chart-paper ruling */
  --banner: #0e2a3d;
  --banner-2: #143a53;
  --banner-ink: #e9f3f7;
  --teal: #0b7a7e;
  --teal-ink: #ffffff;
  --joy: #ff5a5f;
  --sun: #ffd84d;
  --mark: #fff0a6;
  --alert: #c8202f;
  --alert-bg: #fdebed;
  --ok: #1d8a52;
  --ok-bg: #e5f5ec;
  --lab: #6a4bd1;
  --lab-bg: #efeafd;
  --monitor: #061018;
  --hr: #3dff8a;
  --spo2: #39d5ff;
  --bp: #ff6b6b;
  --temp: #ffd23f;
  --joyv: #ff6ad5;
  --shadow: 0 1px 2px rgb(16 24 32 / .06), 0 8px 24px rgb(16 24 32 / .07);
  --radius: 14px;
  --font-body: "Figtree", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-display: "Bricolage Grotesque", "Figtree", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --banner-h: 104px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #0f151b;
    --card: #161e26;
    --tint: #121b22;
    --ink: #e7edf2;
    --muted: #9fb0bf;
    --line: #26323d;
    --rule: #1d3340;
    --banner: #08141d;
    --banner-2: #0e2231;
    --teal: #2bb3b8;
    --teal-ink: #04181a;
    --mark: #5c4f12;
    --alert: #ff6b78;
    --alert-bg: #3a1419;
    --ok: #4fd18b;
    --ok-bg: #12301f;
    --lab: #a996ff;
    --lab-bg: #231c45;
    --shadow: 0 1px 2px rgb(0 0 0 / .4), 0 8px 24px rgb(0 0 0 / .35);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #0f151b; --card: #161e26; --tint: #121b22; --ink: #e7edf2; --muted: #9fb0bf;
  --line: #26323d; --rule: #1d3340; --banner: #08141d; --banner-2: #0e2231; --teal: #2bb3b8;
  --teal-ink: #04181a; --mark: #5c4f12; --alert: #ff6b78; --alert-bg: #3a1419; --ok: #4fd18b;
  --ok-bg: #12301f; --lab: #a996ff; --lab-bg: #231c45; color-scheme: dark;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--banner-h) + 12px); -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 1.0625rem/1.6 var(--font-body);
  overflow-x: hidden;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--teal); text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--sun); outline-offset: 2px; border-radius: 6px; }
mark { background: linear-gradient(transparent 35%, var(--mark) 35%, var(--mark) 90%, transparent 90%); color: inherit; padding: 0 .1em; }
h1, h2, h3 { font-family: var(--font-display); line-height: 1.1; margin: 0; letter-spacing: -.01em; }
h2 { font-size: clamp(1.75rem, 1.2rem + 2.2vw, 2.6rem); font-weight: 800; }
h3 { font-size: 1.25rem; font-weight: 600; }
p { margin: 0 0 1em; }
.wrap { width: min(1120px, 100% - 32px); margin-inline: auto; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--sun); color: #111; padding: 8px 12px; z-index: 100; border-radius: 8px; }
.skip:focus { left: 8px; }

.eyebrow {
  font: 700 .75rem/1.2 var(--font-mono);
  letter-spacing: .12em; text-transform: uppercase;
  color: var(--teal); margin: 0 0 .5rem;
}
.eyebrow--alert { color: var(--alert); }

/* ---------- Patient banner ---------- */
.banner {
  position: sticky; top: 0; z-index: 50;
  background: var(--banner);
  color: var(--banner-ink);
  box-shadow: 0 2px 12px rgb(0 0 0 / .18);
  padding-top: env(safe-area-inset-top);
}
.banner__row {
  display: flex; align-items: center; gap: 12px;
  width: min(1120px, 100% - 32px); margin-inline: auto;
  padding: 10px 0;
}
.banner__id { display: flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; min-width: 0; }
.banner__avatar { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; object-position: 50% 20%; border: 2px solid var(--sun); flex: none; }
.banner__name { display: block; font: 700 .95rem/1.1 var(--font-mono); letter-spacing: .04em; white-space: nowrap; }
.banner__creds { display: block; font: 500 .72rem/1.2 var(--font-mono); opacity: .75; white-space: nowrap; }
.banner__chips { display: flex; gap: 8px; list-style: none; margin: 0 0 0 auto; padding: 0; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.banner__chips::-webkit-scrollbar { display: none; }
.chip {
  font: 700 .68rem/1 var(--font-mono); letter-spacing: .06em;
  padding: 6px 9px; border-radius: 999px; white-space: nowrap;
  background: rgb(255 255 255 / .08); border: 1px solid rgb(255 255 255 / .16);
}
.chip--ok { background: rgb(61 255 138 / .12); border-color: rgb(61 255 138 / .35); color: #b9ffd6; }
.chip--alert { background: #c8202f; border-color: #ff8a94; color: #fff; }

.call-light {
  display: inline-flex; align-items: center; gap: 8px; flex: none;
  background: var(--sun); color: #1b1600; text-decoration: none;
  font: 700 .82rem/1 var(--font-mono); letter-spacing: .04em; text-transform: uppercase;
  padding: 10px 12px; border-radius: 999px;
}
.call-light__bulb { width: 10px; height: 10px; border-radius: 50%; background: var(--joy); box-shadow: 0 0 0 0 rgb(255 90 95 / .7); animation: blink 1.6s infinite; }
@keyframes blink { 0%, 100% { box-shadow: 0 0 0 0 rgb(255 90 95 / .7); } 50% { box-shadow: 0 0 0 7px rgb(255 90 95 / 0); } }

.tabs { background: var(--banner-2); border-top: 1px solid rgb(255 255 255 / .06); }
.tabs ul {
  display: flex; gap: 2px; list-style: none; margin: 0 auto; padding: 0 0;
  width: min(1120px, 100% - 16px);
  overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch;
}
.tabs ul::-webkit-scrollbar { display: none; }
.tabs a {
  display: block; padding: 10px 12px; white-space: nowrap;
  color: rgb(233 243 247 / .78); text-decoration: none;
  font: 700 .78rem/1 var(--font-mono); letter-spacing: .06em; text-transform: uppercase;
  border-bottom: 3px solid transparent;
}
.tabs a:hover { color: #fff; }
.tabs a[aria-current="true"] { color: #fff; border-bottom-color: var(--sun); }

@media (max-width: 760px) {
  :root { --banner-h: 96px; }
  .banner__chips .chip--mono, .banner__chips .chip--ok { display: none; }
  .banner__creds { display: none; }
  .call-light { padding: 9px 11px; font-size: .74rem; }
}
@media (max-width: 400px) {
  .banner__chips { display: none; }
  .call-light { margin-left: auto; }
}

/* ---------- Sections ---------- */
.section { padding: clamp(48px, 7vw, 88px) 0; }
.section__head { margin-bottom: 24px; }
.section__sub { color: var(--muted); margin: .5rem 0 0; }
.section--tint { background: var(--tint); }
.section--dark { background: #0b1117; color: #e8eef3; }
.section--dark .eyebrow { color: var(--hr); }
.section--dark .section__sub { color: #9fb0bf; }

.paper {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: clamp(20px, 3vw, 36px);
}
.paper--flush { padding: 0; overflow: hidden; }

/* ---------- Triage / hero ---------- */
.triage { padding-top: clamp(28px, 5vw, 56px); }
.triage__grid {
  display: grid; gap: clamp(24px, 4vw, 56px);
  grid-template-columns: minmax(0, 340px) minmax(0, 1fr);
  align-items: center;
}
.idcard { margin: 0; transform: rotate(-2deg); }
.idcard__photo {
  border-radius: 18px 18px 0 0; overflow: hidden;
  border: 6px solid var(--card); border-bottom: 0;
  box-shadow: var(--shadow);
}
.idcard__photo img { aspect-ratio: 4 / 5; object-fit: cover; object-position: 50% 30%; width: 100%; }
.wristband {
  display: flex; align-items: center; gap: 12px;
  background: #fff; color: #17212b;
  border: 1px solid #d7d2c4; border-radius: 0 0 14px 14px;
  padding: 10px 14px; box-shadow: var(--shadow);
  font-family: var(--font-mono);
}
.wristband__barcode {
  width: 54px; height: 30px; flex: none;
  background: repeating-linear-gradient(90deg, #17212b 0 2px, transparent 2px 4px, #17212b 4px 5px, transparent 5px 8px, #17212b 8px 11px, transparent 11px 12px);
}
.wristband__text { display: grid; line-height: 1.25; }
.wristband__text strong { font-size: .85rem; letter-spacing: .06em; }
.wristband__text span { font-size: .66rem; letter-spacing: .04em; color: #c8202f; font-weight: 700; white-space: nowrap; }
@media (max-width: 760px) {
  .triage__grid { grid-template-columns: 1fr; gap: 20px; }
  .idcard { width: min(250px, 72%); margin: 0 auto; }
  .idcard__photo img { aspect-ratio: 1 / 1; object-position: 50% 18%; }
  .wristband { padding: 8px 10px; gap: 8px; }
  .wristband__barcode { width: 36px; height: 26px; }
  .wristband__text strong { font-size: .75rem; }
  .wristband__text span { font-size: .56rem; }
  .note { text-align: left; }
}

.display { font-size: clamp(2.6rem, 1.6rem + 5vw, 4.75rem); font-weight: 800; letter-spacing: -.025em; margin-bottom: .6rem; }
.lede { font-size: clamp(1.1rem, 1rem + .5vw, 1.35rem); color: var(--ink); max-width: 36ch; }

.cc { margin: 1.5rem 0; padding: 18px 20px; border-left: 4px solid var(--teal); background: var(--card); border-radius: 0 12px 12px 0; box-shadow: var(--shadow); }
.cc dt { font: 700 .7rem/1 var(--font-mono); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; }
.cc dd { margin: 0 0 12px; }
.cc__quote { font-family: var(--font-display); font-weight: 600; font-size: 1.3rem; line-height: 1.3; }
.cc__pair { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 8px 20px; }
.cc__pair dd { margin-bottom: 0; }
.esi { display: inline-block; font: 700 .72rem/1 var(--font-mono); background: var(--alert); color: #fff; padding: 4px 7px; border-radius: 6px; margin-right: 6px; vertical-align: 2px; }

.cta-row { display: flex; flex-wrap: wrap; gap: 12px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 12px 20px; border-radius: 999px;
  font: 700 1rem/1 var(--font-body); text-decoration: none; cursor: pointer;
  border: 2px solid transparent; transition: transform .15s ease, box-shadow .15s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(1px); }
.btn--primary { background: var(--teal); color: var(--teal-ink); box-shadow: 0 6px 18px rgb(11 122 126 / .3); }
.btn--ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn--big { min-height: 56px; padding-inline: 28px; font-size: 1.1rem; }

/* ---------- Monitor ---------- */
.monitor {
  margin-top: clamp(28px, 4vw, 48px);
  background: var(--monitor); color: #dfe8ee;
  border-radius: 18px; padding: 16px clamp(14px, 2vw, 22px) 18px;
  border: 1px solid #12212c;
  box-shadow: inset 0 0 40px rgb(57 213 255 / .06), var(--shadow);
}
.monitor__head { display: flex; justify-content: space-between; font: 700 .72rem/1 var(--font-mono); letter-spacing: .12em; color: #7f95a6; }
.monitor__live { display: inline-flex; gap: 6px; align-items: center; color: var(--hr); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--hr); animation: blink-dot 1s infinite; }
@keyframes blink-dot { 50% { opacity: .2; } }
.ecg { width: 100%; height: 64px; margin: 10px 0 6px; overflow: visible; }
.ecg__line {
  fill: none; stroke: var(--hr); stroke-width: 2.2; stroke-linejoin: round; stroke-linecap: round;
  filter: drop-shadow(0 0 4px rgb(61 255 138 / .7));
  stroke-dasharray: 1400; stroke-dashoffset: 1400;
  animation: trace 3.2s linear infinite;
}
@keyframes trace { to { stroke-dashoffset: 0; } }
.vitals { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; }
@media (max-width: 760px) { .vitals { grid-template-columns: repeat(2, 1fr); } .vital--joy { grid-column: 1 / -1; } }
.vital, .vital__btn {
  display: grid; gap: 2px; text-align: left;
  border-top: 1px solid #1a2a36; padding-top: 10px;
}
.vital__btn { width: 100%; background: none; border: 0; border-top: 1px solid #1a2a36; color: inherit; font: inherit; cursor: pointer; padding: 10px 0 0; }
.vital__k { font: 700 .72rem/1 var(--font-mono); letter-spacing: .1em; }
.vital__v { font: 700 clamp(1.9rem, 1.4rem + 1.6vw, 2.6rem)/1 var(--font-mono); letter-spacing: -.02em; }
.vital__v small { font-size: .5em; }
.vital__u { font: 500 .72rem/1.3 var(--font-mono); color: #8ea3b3; }
.vital--hr { color: var(--hr); }
.vital--spo2 { color: var(--spo2); }
.vital--bp { color: var(--bp); }
.vital--temp { color: var(--temp); }
.vital--joy .vital__btn { color: var(--joyv); background: rgb(255 106 213 / .08); border: 1px solid rgb(255 106 213 / .35); border-radius: 10px; padding: 10px 12px; }
.vital--joy .vital__v { font-size: clamp(2.2rem, 1.7rem + 1.8vw, 3rem); }
.vital--joy { border-top: 0; padding-top: 0; }
.vital--joy .vital__v { animation: joy 2.4s ease-in-out infinite; display: inline-block; transform-origin: left center; }
@keyframes joy { 50% { text-shadow: 0 0 18px rgb(255 106 213 / .8); } }
.vital__btn:hover .vital__v { transform: scale(1.06); }
.vital--hr .vital__v.beat { animation: beat .35s ease-out; }
@keyframes beat { 30% { transform: scale(1.08); } }

/* ---------- HPI ---------- */
.hpi-grid { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: clamp(24px, 4vw, 48px); align-items: start; }
@media (max-width: 860px) { .hpi-grid { grid-template-columns: 1fr; } }
.hpi { font-size: 1.1rem; padding-left: clamp(36px, 5vw, 56px); position: relative; }
.hpi::before { content: ""; position: absolute; top: 0; bottom: 0; left: clamp(20px, 3vw, 32px); width: 2px; background: rgb(200 32 47 / .28); }
.hpi p { line-height: 1.8; margin-bottom: 1.1rem; }
.sticky {
  position: sticky; top: calc(var(--banner-h) + 24px);
  background: #fff3a8; color: #2b2400; padding: 22px 20px 24px; transform: rotate(2deg);
  box-shadow: 0 12px 24px rgb(0 0 0 / .12), 0 2px 4px rgb(0 0 0 / .08);
  font-family: var(--font-display); font-weight: 600; font-size: 1.2rem; line-height: 1.35;
}
.sticky::before { content: ""; position: absolute; top: -10px; left: 50%; width: 90px; height: 22px; transform: translateX(-50%) rotate(-3deg); background: rgb(255 255 255 / .55); box-shadow: 0 1px 2px rgb(0 0 0 / .08); }
.sticky small { display: block; margin-top: 12px; font: 700 .72rem/1.3 var(--font-mono); letter-spacing: .08em; text-transform: uppercase; color: #6b5a00; }
@media (max-width: 860px) { .sticky { position: relative; top: 0; max-width: 340px; margin: 8px auto 0; } }
.abbr { font: 700 .82rem/1 var(--font-mono); letter-spacing: .06em; text-transform: uppercase; color: var(--teal); margin-right: 4px; }
.hpi__ap { border-top: 2px dashed var(--line); padding-top: 1rem; margin: 1.25rem 0 0 !important; }

/* ---------- Labs ---------- */
.labs { width: 100%; border-collapse: collapse; font-size: 1rem; }
.labs th, .labs td { padding: 14px 16px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
.labs thead th { font: 700 .72rem/1 var(--font-mono); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); background: var(--tint); }
.labs tbody th { font-weight: 700; }
.labs .num { font: 700 1.35rem/1 var(--font-mono); white-space: nowrap; }
.labs td:nth-child(3) { color: var(--muted); font-size: .92rem; }
.labs tbody tr:hover { background: var(--tint); }
.flag { display: inline-block; font: 700 .72rem/1 var(--font-mono); letter-spacing: .06em; padding: 5px 8px; border-radius: 6px; background: var(--tint); color: var(--muted); white-space: nowrap; }
.flag--hi { background: var(--alert-bg); color: var(--alert); }
.flag--ok { background: var(--ok-bg); color: var(--ok); }
.flag--new { background: var(--lab-bg); color: var(--lab); }
.footnote { font-size: .9rem; color: var(--muted); padding: 14px 16px 18px; margin: 0; }

@media (max-width: 640px) {
  .labs thead { display: none; }
  .labs, .labs tbody, .labs tr { display: block; }
  .labs tr { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
  .labs th, .labs td { padding: 0; border: 0; }
  .labs tbody th { grid-column: 1 / -1; }
  .labs td:nth-child(3) { grid-column: 1; }
  .labs td:nth-child(4) { grid-column: 2; grid-row: 2; justify-self: end; }
  .labs .num { grid-column: 1; grid-row: 2; }
  .labs td:nth-child(3) { grid-row: 3; }
}

/* ---------- Imaging ---------- */
.films { list-style: none; padding: 0; margin: 0; display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(min(46%, 220px), 1fr)); }
.film {
  position: relative; display: block; width: 100%; padding: 0; cursor: zoom-in;
  background: #000; border: 1px solid #22303c; border-radius: 10px; overflow: hidden;
}
.film img { aspect-ratio: 4 / 5; object-fit: cover; width: 100%; filter: grayscale(1) contrast(1.15) brightness(.92); transition: filter .35s ease, transform .35s ease; }
.film:hover img, .film:focus-visible img { filter: none; transform: scale(1.03); }
.film__tag {
  position: absolute; left: 8px; top: 8px;
  font: 700 .66rem/1 var(--font-mono); letter-spacing: .08em; color: #d8f6ff;
  background: rgb(0 0 0 / .55); padding: 5px 7px; border-radius: 4px;
}
.film::after { content: "R"; position: absolute; right: 10px; bottom: 8px; font: 700 1rem/1 var(--font-mono); color: rgb(255 255 255 / .7); }

.viewer { border: 0; padding: 0; background: #05090d; color: #e8eef3; border-radius: 16px; width: min(920px, 100% - 24px); max-height: 92vh; overflow: auto; }
.viewer::backdrop { background: rgb(2 6 10 / .82); backdrop-filter: blur(4px); }
.viewer img { width: 100%; max-height: 66vh; object-fit: contain; background: #000; }
.viewer__report { padding: 18px 22px 22px; font-family: var(--font-mono); }
.viewer__label { font-size: .7rem; letter-spacing: .14em; color: var(--hr); margin: 0 0 4px; }
.viewer__study { font-weight: 700; margin-bottom: 14px; }
.viewer__close { position: sticky; top: 10px; float: right; margin: 10px 10px -50px 0; z-index: 2; width: 40px; height: 40px; border-radius: 50%; border: 0; background: rgb(255 255 255 / .9); color: #000; font-size: 1.1rem; cursor: pointer; }

/* ---------- Orders / projects ---------- */
.order { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px; }
.order h3 { margin-bottom: .5rem; }
.order p:last-child { margin-bottom: 0; }
.order__meta { margin-bottom: .75rem; }
.order--feature { display: grid; grid-template-columns: 1.1fr 1fr; gap: 0; padding: 0; overflow: hidden; margin-bottom: 16px; }
.order--feature .order__body { padding: clamp(20px, 3vw, 32px); align-self: center; }
.order--feature .order__media img { width: 100%; height: 100%; object-fit: cover; }
.order--feature h3 { font-size: clamp(1.5rem, 1.2rem + 1vw, 2rem); font-weight: 800; }
@media (max-width: 760px) { .order--feature { grid-template-columns: 1fr; } }
.order__links { display: flex; flex-wrap: wrap; gap: 8px 18px; font-weight: 700; }
.orders { list-style: none; padding: 0; margin: 0; display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); }
.status { display: inline-flex; align-items: center; gap: 6px; font: 700 .7rem/1 var(--font-mono); letter-spacing: .08em; text-transform: uppercase; padding: 6px 9px; border-radius: 999px; }
.status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.status--open { background: var(--alert-bg); color: var(--alert); }
.status--done { background: var(--ok-bg); color: var(--ok); }
.status--lab { background: var(--lab-bg); color: var(--lab); }
.status--wait { background: rgb(255 216 77 / .3); color: #7a5b00; }
.order--yours { border: 2px dashed var(--teal); background: color-mix(in srgb, var(--teal) 5%, var(--card)); box-shadow: none; }
.order--yours a { font-weight: 700; }

/* ---------- MAR & allergies ---------- */
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(32px, 5vw, 64px); }
@media (max-width: 860px) { .two-col { grid-template-columns: 1fr; } }
.mar { list-style: none; padding: 0; margin: 0; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.mar li { display: grid; gap: 2px; padding: 14px 18px; border-bottom: 1px solid var(--line); position: relative; padding-left: 52px; }
.mar li:last-child { border-bottom: 0; }
.mar li::before {
  content: "✓"; position: absolute; left: 16px; top: 15px;
  width: 22px; height: 22px; border-radius: 6px; display: grid; place-items: center;
  font: 700 .8rem/1 var(--font-mono); color: var(--ok); background: var(--ok-bg);
}
.mar__drug { font-weight: 700; }
.mar__sig { font: 500 .82rem/1.4 var(--font-mono); color: var(--muted); }

.allergies { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.allergies li {
  display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; align-items: start;
  background: var(--card); border: 1px solid var(--line); border-left: 5px solid var(--alert);
  border-radius: 10px; padding: 12px 14px; box-shadow: var(--shadow);
}
.allergies strong { grid-column: 1; }
.allergies span { grid-column: 1; font: 500 .82rem/1.4 var(--font-mono); color: var(--muted); }
.sev { grid-column: 2; grid-row: 1 / span 2; align-self: center; font: 700 .66rem/1 var(--font-mono); font-style: normal; letter-spacing: .08em; padding: 5px 7px; border-radius: 6px; background: var(--tint); color: var(--muted); }
.sev--high { background: var(--alert); color: #fff; }

/* ---------- History ---------- */
.timeline { list-style: none; margin: 0 0 32px; padding: 0; position: relative; }
.timeline::before { content: ""; position: absolute; left: 92px; top: 6px; bottom: 6px; width: 2px; background: var(--line); }
.timeline li { display: grid; grid-template-columns: 80px 1fr; gap: 26px; padding: 10px 0; position: relative; }
.timeline li::before { content: ""; position: absolute; left: 87px; top: 18px; width: 12px; height: 12px; border-radius: 50%; background: var(--card); border: 3px solid var(--teal); }
.timeline__when { font: 700 .8rem/1.6 var(--font-mono); color: var(--teal); text-align: right; }
@media (max-width: 560px) {
  .timeline::before { left: 6px; }
  .timeline li { grid-template-columns: 1fr; gap: 2px; padding-left: 28px; }
  .timeline li::before { left: 1px; top: 15px; }
  .timeline__when { text-align: left; }
}
.details-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); align-items: start; }
details { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 0 18px; box-shadow: var(--shadow); }
summary { cursor: pointer; padding: 14px 0; font-weight: 700; list-style: none; display: flex; justify-content: space-between; gap: 12px; }
summary::-webkit-details-marker { display: none; }
summary::after { content: "+"; font: 700 1.2rem/1 var(--font-mono); color: var(--teal); }
details[open] summary::after { content: "–"; }
details ul { margin: 0 0 16px; padding-left: 1.1rem; }
details li { margin-bottom: .4rem; }

/* ---------- Plan / order set ---------- */
.section--plan { background:
  radial-gradient(1200px 400px at 10% 0%, rgb(255 216 77 / .18), transparent 60%),
  radial-gradient(900px 400px at 90% 100%, rgb(11 122 126 / .14), transparent 60%),
  var(--paper); }
.orderset fieldset { border: 0; margin: 0 0 18px; padding: 0; display: grid; gap: 10px; }
.orderset legend { font: 700 .72rem/1 var(--font-mono); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin-bottom: 10px; }
.check {
  display: flex; gap: 14px; align-items: center; cursor: pointer;
  padding: 14px 16px; border: 2px solid var(--line); border-radius: 12px; background: var(--paper);
  transition: border-color .15s ease, background .15s ease;
}
.check:hover { border-color: var(--teal); }
.check input { appearance: none; flex: none; width: 26px; height: 26px; border: 2px solid var(--muted); border-radius: 7px; display: grid; place-items: center; margin: 0; cursor: pointer; background: var(--card); }
.check input::after { content: "✓"; font: 700 1rem/1 var(--font-mono); color: var(--teal-ink); transform: scale(0); transition: transform .12s ease; }
.check input:checked { background: var(--teal); border-color: var(--teal); }
.check input:checked::after { transform: scale(1); }
.check:has(input:checked) { border-color: var(--teal); background: color-mix(in srgb, var(--teal) 8%, var(--card)); }
.orderset__fields { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 20px; }
@media (max-width: 640px) { .orderset__fields { grid-template-columns: 1fr; } }
.field { display: grid; gap: 6px; }
.field--wide { grid-column: 1 / -1; }
.field span { font: 700 .72rem/1 var(--font-mono); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.field input, .field textarea {
  font: inherit; color: var(--ink); background: var(--paper);
  border: 2px solid var(--line); border-radius: 10px; padding: 12px 14px; width: 100%;
}
.field input:focus, .field textarea:focus { border-color: var(--teal); outline: none; }
.orderset__actions { display: grid; gap: 12px; justify-items: start; }
.orderset__alt { color: var(--muted); margin: 0; }
.orderset__status { margin: 0; font-weight: 700; color: var(--ok); min-height: 1.4em; }
.linkish { background: none; border: 0; padding: 0; font: inherit; color: var(--teal); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.disposition { margin: 28px 0 0; font-size: 1.1rem; }
.disposition .eyebrow { display: inline; margin-right: 8px; }

/* ---------- Footer ---------- */
.footer { background: var(--banner); color: var(--banner-ink); padding: 36px 0 calc(36px + env(safe-area-inset-bottom)); font-size: .95rem; }
.footer a, .footer .linkish { color: var(--sun); }
.footer__grid { display: grid; gap: 8px; }
.footer__small { opacity: .7; font-size: .85rem; margin: 0; }

/* ---------- Overhead page toast ---------- */
.overhead {
  position: fixed; left: 50%; bottom: calc(18px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  z-index: 80; display: flex; align-items: center; gap: 10px;
  width: max-content; max-width: calc(100% - 24px);
  background: #111; color: #fff; padding: 12px 16px; border-radius: 12px;
  font: 700 .9rem/1.3 var(--font-mono); box-shadow: 0 10px 30px rgb(0 0 0 / .35);
  animation: rise .3s ease-out;
}
.overhead[hidden] { display: none; }
.overhead__tag { background: var(--joyv); color: #2a0020; padding: 4px 7px; border-radius: 6px; font-size: .7rem; letter-spacing: .1em; }
@keyframes rise { from { opacity: 0; transform: translate(-50%, 12px); } }

/* ---------- Reveal on scroll ---------- */
.reveal { opacity: 0; transform: translateY(14px); transition: opacity .6s ease, transform .6s ease; }
.reveal.is-in { opacity: 1; transform: none; }

/* ---------- Motion preferences ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .ecg__line { stroke-dashoffset: 0; }
  .reveal { opacity: 1; transform: none; }
}

/* ---------- Print: the boring version ---------- */
@media print {
  :root { --paper: #fff; --card: #fff; --tint: #fff; --ink: #000; --muted: #333; --line: #ccc; }
  body { font-size: 11pt; background: #fff; }
  .banner, .monitor, #imaging, .call-light, .cta-row, .footer__actions, .overhead, .viewer, .orderset, .idcard, .skip, .order__media, .sticky, .order--yours { display: none !important; }
  .section { padding: 12pt 0; }
  .paper, .order, .mar, details, .allergies li, .cc { box-shadow: none; }
  .hpi, .cc { background-image: none; }
  details { border: 0; padding: 0; }
  details > ul { display: block !important; }
  summary::after { content: ""; }
  .triage__grid { display: block; }
  .reveal { opacity: 1 !important; transform: none !important; }
  a { color: #000; }
  .films, .orders { break-inside: avoid; }
}
