/* ==========================================================================
   PaedsCalc — Direction A design system
   Brand navy band, white layered cards on a cool paper background, ℞ ticket
   for the dose, Outfit for text and DM Mono for numbers.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. TOKENS
   -------------------------------------------------------------------------- */
:root {
  --navy: #011B48;
  --azure: #0181FC;
  --accent: #0167D0;          /* button fill with white text (5.45:1), links */
  --accent-soft: #E6F2FF;
  --sky: #9FD0FF;

  --paper: #F3F5F8;
  --surface: #FFFFFF;
  --card: #FFFFFF;
  --surface-subtle: #F0F3F8;
  --ink: #0D1A33;
  --muted: #5B6678;
  --faint: #9AA3B2;
  --line: #E1E6EE;

  --gold: #C9A24A;
  --gold-ink: #6E5A24;
  --gold-soft: #FBF7EC;
  --ok: #17724A;
  --ok-soft: #E3F4EA;
  --warn: #8A5A00;
  --warn-soft: #FBF1DC;
  --bad: #B3261E;
  --bad-soft: #FBE6E3;

  --f-body: -apple-system, BlinkMacSystemFont, "Inter", "Roboto", "Segoe UI", sans-serif;
  --f-mono: "DM Mono", "SF Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  --f-display: -apple-system, BlinkMacSystemFont, "Inter", "Roboto", "Segoe UI", sans-serif;
  --f-rx: "Spectral", Georgia, serif;

  --r-card: 18px;
  --r-ctl: 14px;
  --shadow-sm: 0 1px 0 var(--line);
  --shadow-md: 0 1px 0 var(--line), 0 6px 18px rgba(13, 26, 51, .06);
  --shadow-lg: 0 1px 0 var(--line), 0 14px 34px rgba(13, 26, 51, .10);
  --shadow-btn: 0 8px 18px rgba(1, 103, 208, .28);
  --band-ink: #93ACD6;
}

body.dark-mode {
  --accent: #4AA8FF;
  --accent-soft: #14284A;
  --paper: #0A1428;
  --surface: #111C33;
  --card: #111C33;
  --surface-subtle: #17243F;
  --ink: #E8EEF8;
  --muted: #9AA8C0;
  --faint: #6B7A94;
  --line: #22304D;
  --gold-ink: #E6C87A;
  --gold-soft: #2A2414;
  --ok: #7DD8A6;
  --ok-soft: #12301F;
  --warn: #F2C46B;
  --warn-soft: #33280F;
  --bad: #FF8A80;
  --bad-soft: #3A1A1F;
  --shadow-md: 0 1px 0 rgba(255, 255, 255, .03), 0 8px 22px rgba(0, 0, 0, .35);
  --shadow-lg: 0 1px 0 rgba(255, 255, 255, .03), 0 16px 36px rgba(0, 0, 0, .45);
  --shadow-btn: 0 8px 20px rgba(1, 129, 252, .30);
}

/* --------------------------------------------------------------------------
   2. BASE
   -------------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 14px/1.45 var(--f-body);
  -webkit-font-smoothing: antialiased;
}
button { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; font-family: var(--f-display); letter-spacing: -.01em; }
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
:focus-visible { outline: 2.5px solid var(--azure); outline-offset: 2px; }
[hidden] { display: none !important; }

.wrap.app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  background: var(--paper);
  position: relative;
}

/* --------------------------------------------------------------------------
   3. HEADER BAND
   -------------------------------------------------------------------------- */
.band {
  background: var(--navy);
  color: #FFFFFF;
  padding: calc(14px + env(safe-area-inset-top, 0px)) 18px 18px;
  border-radius: 0 0 24px 24px;
}
.band-bar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.wm { height: 26px; width: auto; display: block; }
.plan {
  font: 600 10.5px var(--f-body); letter-spacing: .12em; text-transform: uppercase;
  color: var(--gold); background: transparent; border: 1px solid rgba(201, 162, 74, .6);
  padding: 5px 10px; border-radius: 999px; cursor: pointer; min-height: 30px;
}
.pt {
  display: grid; grid-template-columns: repeat(3, 1fr);
  background: rgba(255, 255, 255, .07); border: 1px solid rgba(255, 255, 255, .12); border-radius: 14px;
}
.pt > button {
  background: none; border: 0; text-align: left; padding: 9px 12px; cursor: pointer; color: #FFFFFF; min-height: 52px;
}
.pt > button + button { border-left: 1px solid rgba(255, 255, 255, .12); }
.pt span { display: block; font-size: 9.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--band-ink); font-weight: 600; }
.pt b { font: 500 17px var(--f-mono); color: #FFFFFF; white-space: nowrap; }
.pt b small { font-size: 11px; color: var(--band-ink); margin-left: 2px; }
.pt b.pt-ok { color: var(--sky); font-family: var(--f-body); font-weight: 600; font-size: 15px; }
.pt b.pt-warn { color: var(--gold); font-family: var(--f-body); font-weight: 600; font-size: 13.5px; }
.pt b.pt-bad { color: #FF9C94; font-family: var(--f-body); font-weight: 600; font-size: 15px; }
body.est-on #ptWt { color: var(--gold); }

/* --------------------------------------------------------------------------
   4. LAYOUT, VIEWS & STEPS
   -------------------------------------------------------------------------- */
.body { padding: 18px 16px 120px; }

.clinical-view { display: none; flex-direction: column; gap: 14px; }
body[data-active-view="calc"] #viewCalc { display: flex; }
body[data-active-view="rx"] #viewRx { display: flex; }
body[data-active-view="slip"] #viewSlip { display: flex; }
body[data-active-view="settings"] #viewSettings { display: flex; }

.step { display: none; flex-direction: column; gap: 14px; }
body[data-step="find"] .step-find,
body[data-step="setup"] .step-setup,
body[data-step="dose"] .step-dose { display: flex; }
body[data-step="dose"] .cta-bar { display: none; }

.page-h { display: flex; align-items: flex-end; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding: 2px 2px 0; }
.page-h h2 { font-size: 24px; font-weight: 600; }
.page-h small { color: var(--muted); font-size: 12.5px; width: 100%; }

.lbl {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  font: 600 10.5px var(--f-body); letter-spacing: .12em; text-transform: uppercase; color: var(--muted);
  margin: 4px 2px -6px;
}
.lbl label { font: inherit; letter-spacing: inherit; color: inherit; }
.lbl-link {
  background: none; border: 0; padding: 0 2px; cursor: pointer;
  font: 600 12px var(--f-body); letter-spacing: .02em; text-transform: none; color: var(--accent);
}
.sub { font-size: 12.5px; font-weight: 600; color: var(--muted); }
.sub em { font-style: normal; font-weight: 400; color: var(--faint); margin-left: 4px; }
.hint { font-size: 12px; color: var(--muted); line-height: 1.45; margin: 0; }
.panel {
  background: var(--card); border-radius: var(--r-card); box-shadow: var(--shadow-md);
  padding: 14px; display: flex; flex-direction: column; gap: 12px;
}
.disclaimer { font-size: 12px; color: var(--muted); line-height: 1.5; margin: 6px 4px 0; }

/* --------------------------------------------------------------------------
   5. FORM CONTROLS
   -------------------------------------------------------------------------- */
input, select {
  font-family: var(--f-body);
  font-size: 16px;
  color: var(--ink);
  background: var(--surface-subtle);
  border: 1.5px solid transparent;
  border-radius: 12px;
  padding: 11px 12px;
  min-height: 48px;
  width: 100%;
  outline: none;
  transition: border-color .15s, background .15s;
}
input:focus, select:focus { border-color: var(--accent); background: var(--surface); }
input::placeholder { color: var(--faint); }
select { appearance: none; -webkit-appearance: none; padding-right: 34px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%235B6678' stroke-width='3' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field label, #ageLabel { font-size: 12px; font-weight: 600; color: var(--muted); }

#wt {
  min-height: 60px;
  font-size: 28px;
  font-family: var(--f-mono);
  font-weight: 500;
  letter-spacing: -.02em;
  text-align: center;
}
body.est-on #wt { border: 1.5px dashed var(--gold); background: var(--gold-soft); }

.pair-in { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; align-items: start; }
.pair-in.pair-cards { background: var(--card); border-radius: var(--r-card); box-shadow: var(--shadow-md); padding: 12px; }

.steppers { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; }
.step-btn {
  min-height: 36px; border: 0; border-radius: 9px; background: var(--surface-subtle);
  font: 500 12px var(--f-mono); color: var(--muted); cursor: pointer;
}
.step-btn:active { background: var(--accent-soft); color: var(--accent); }

.age-inputs { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.age-cell { position: relative; }
.age-cell input { font: 500 20px var(--f-mono); text-align: center; padding-right: 30px; min-height: 60px; }
.age-cell span { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); font-size: 11px; color: var(--faint); pointer-events: none; }

.input-need { font-size: 13px; font-weight: 600; color: var(--accent); background: var(--accent-soft); border-radius: 10px; padding: 8px 11px; }
.input-links { display: flex; flex-wrap: wrap; gap: 4px 16px; }
.link-btn {
  background: none; border: 0; padding: 4px 0; min-height: 32px; cursor: pointer;
  color: var(--accent); font: 600 13px var(--f-body); text-align: left;
}

.allergy { display: flex; flex-direction: column; gap: 8px; border-top: 1px solid var(--line); padding-top: 12px; }
.allergy-pills { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; }
.allergy-pills button {
  min-height: 44px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--surface);
  font-weight: 600; font-size: 13.5px; color: var(--muted); cursor: pointer;
}
.allergy-pills button[aria-checked="true"][data-a="nkda"] { border-color: var(--ok); background: var(--ok-soft); color: var(--ok); }
.allergy-pills button[aria-checked="true"][data-a="known"] { border-color: var(--bad); background: var(--bad-soft); color: var(--bad); }
.allergy-pills button[aria-checked="true"][data-a="incomplete"],
.allergy-pills button[aria-checked="true"][data-a="unassessed"] { border-color: var(--warn); background: var(--warn-soft); color: var(--warn); }
#allergyDetailsRow { flex-direction: column; gap: 8px; }

/* --------------------------------------------------------------------------
   6. BUTTONS, CHIPS & SEGMENTS
   -------------------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px;
  padding: 12px 14px; border-radius: var(--r-ctl); border: 0; cursor: pointer;
  font: 600 14px var(--f-body); background: var(--card); color: var(--ink); box-shadow: var(--shadow-md);
  text-decoration: none; transition: transform .08s, filter .15s;
}
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--accent); color: #FFFFFF; box-shadow: var(--shadow-btn); }
.btn.secondary { background: var(--card); color: var(--ink); }
.btn.ghost { background: transparent; box-shadow: none; color: var(--accent); }
.btn.success { background: var(--ok); color: #FFFFFF; box-shadow: none; }
.btn.danger { background: var(--bad-soft); color: var(--bad); box-shadow: none; }
.btn:disabled, .btn.is-locked { opacity: .5; cursor: not-allowed; box-shadow: none; }

.chipbtn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 44px;
  padding: 8px 14px; border-radius: 999px; border: 0; cursor: pointer;
  background: var(--card); color: var(--ink); box-shadow: var(--shadow-sm);
  font: 600 13.5px var(--f-body); white-space: nowrap;
}
.chipbtn[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); }
.chipbtn.mono { font-family: var(--f-mono); font-weight: 500; font-size: 13px; }

.seg { display: flex; flex-wrap: wrap; gap: 4px; background: var(--surface-subtle); border-radius: 12px; padding: 4px; }
.seg button {
  flex: 1 1 auto; min-height: 44px; border: 0; border-radius: 9px; background: transparent; cursor: pointer;
  font: 600 13px var(--f-body); color: var(--muted); padding: 6px 10px;
}
.seg button.sel, .seg button[aria-pressed="true"] { background: var(--card); color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, .10); }
.lang-seg { flex-wrap: nowrap; }
.lang-seg button { min-width: 48px; }

/* Formulation: segmented control built from engine chips */
.segs { display: flex; flex-wrap: wrap; gap: 4px; background: var(--surface-subtle); border-radius: 12px; padding: 4px; }
.segs .chipbtn {
  flex: 1 1 40%; border-radius: 9px; background: transparent; box-shadow: none; color: var(--muted);
  white-space: normal; text-align: center; line-height: 1.25; padding: 8px 10px;
}
.segs .chipbtn[aria-pressed="true"] { background: var(--card); color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, .10); }

/* Dose-adjust chips */
.adjust { background: var(--card); border-radius: var(--r-card); box-shadow: var(--shadow-md); padding: 0 14px; }
.adjust summary { min-height: 48px; display: flex; align-items: center; gap: 8px; cursor: pointer; font-weight: 600; font-size: 13.5px; color: var(--accent); list-style: none; }
.adjust summary::-webkit-details-marker { display: none; }
.adjust summary::after { content: "+"; margin-left: auto; font: 500 18px var(--f-mono); color: var(--faint); }
.adjust[open] summary::after { content: "–"; }
#adjSum { font: 500 11.5px var(--f-mono); color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.adjust[open] { padding-bottom: 14px; }
.regimen-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
.regimen-chips .chipbtn { background: var(--surface-subtle); box-shadow: none; }
.regimen-chips .chipbtn[aria-pressed="true"] { background: var(--accent); color: #FFFFFF; }
.regimen-box { display: flex; flex-direction: column; gap: 14px; }
#regSelectWrap { display: flex; flex-direction: column; gap: 14px; }

/* --------------------------------------------------------------------------
   7. STEP 1 · FIND
   -------------------------------------------------------------------------- */
.search {
  display: flex; align-items: center; gap: 10px; background: var(--card); color: var(--muted);
  border-radius: var(--r-ctl); padding: 4px 14px; box-shadow: var(--shadow-md);
}
.search input { background: transparent; border: 0; padding: 10px 0; min-height: 50px; font-size: 16px; }
.search input:focus { background: transparent; }
.search:focus-within { box-shadow: 0 0 0 2px var(--accent), var(--shadow-md); }
.search kbd { font: 500 11px var(--f-mono); color: var(--faint); white-space: nowrap; }

.results {
  list-style: none; margin: 0; padding: 0; background: var(--card); border-radius: var(--r-card);
  box-shadow: var(--shadow-md); overflow: hidden;
}
.results li + li:not(.qres-group-hdr) { border-top: 1px solid var(--line); }
.results li button {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: 60px; padding: 10px 14px;
  border: 0; background: transparent; text-align: left; cursor: pointer; color: var(--ink);
}
.results li button:hover, .results li button[aria-selected="true"] { background: var(--accent-soft); }
.res-ic, .tile .ic {
  width: 36px; height: 36px; border-radius: 10px; flex: none; display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent);
}
.res-n { flex: 1; min-width: 0; }
.res-n b { display: block; font: 600 15.5px/1.25 var(--f-body); letter-spacing: -.01em; }
.res-n small { display: block; color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.badge {
  font: 600 10px var(--f-body); letter-spacing: .06em; padding: 3px 8px; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent); white-space: nowrap; flex: none;
}
.results li.locked b, .results li.locked small { color: var(--faint); }
.results li.locked .res-ic { background: var(--surface-subtle); color: var(--faint); }
.badge.lock { background: var(--surface-subtle); color: var(--faint); }
.qres-group-hdr {
  font: 600 10.5px var(--f-body); letter-spacing: .12em; text-transform: uppercase; color: var(--muted);
  padding: 12px 14px 6px; background: var(--surface-subtle);
}
.qnone { padding: 16px 14px; color: var(--ink); font-size: 13.5px; }
.step-find:has(#qres:not([hidden])) .browse { display: none; }

.browse { display: flex; flex-direction: column; gap: 14px; }
.quick { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 4px; scrollbar-width: none; }
.quick::-webkit-scrollbar { display: none; }
.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.tile {
  background: var(--card); border: 0; border-radius: 14px; padding: 12px 10px; min-height: 84px;
  display: flex; flex-direction: column; align-items: flex-start; justify-content: space-between; gap: 8px;
  box-shadow: var(--shadow-sm); cursor: pointer; text-align: left;
}
.tile .ic { width: 30px; height: 30px; border-radius: 9px; }
.tile span:last-child { font-size: 12.5px; font-weight: 600; line-height: 1.2; color: var(--ink); }
.tile:active { background: var(--accent-soft); }

/* --------------------------------------------------------------------------
   8. STEP 2 · SET UP
   -------------------------------------------------------------------------- */
.rxhead { display: flex; align-items: center; gap: 12px; }
.rx-mark {
  width: 44px; height: 44px; border-radius: 13px; flex: none; display: grid; place-items: center;
  background: var(--azure); color: #FFFFFF; font: italic 700 24px/1 var(--f-rx);
}
.rxhead-t { flex: 1; min-width: 0; }
.rxhead h3 { font-size: 21px; font-weight: 600; line-height: 1.15; }
.rxhead small { display: block; font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.chg {
  background: var(--card); border: 0; border-radius: 999px; padding: 8px 14px; min-height: 40px; cursor: pointer;
  font-weight: 600; font-size: 12.5px; color: var(--accent); box-shadow: var(--shadow-sm);
}
.tag {
  font: 600 10px var(--f-body); letter-spacing: .08em; text-transform: uppercase;
  padding: 3px 8px; border-radius: 999px; background: var(--warn-soft); color: var(--warn);
}

/* Indication radio list (engine: .reg-radio > .rr-dot .rr-t .rr-v) */
.opts { background: var(--card); border-radius: var(--r-card); box-shadow: var(--shadow-md); overflow: hidden; display: flex; flex-direction: column; }
.reg-radio {
  display: flex; align-items: center; gap: 12px; width: 100%; padding: 13px 14px; min-height: 56px;
  background: transparent; border: 0; text-align: left; cursor: pointer; color: var(--ink);
}
.reg-radio + .reg-radio { border-top: 1px solid var(--line); }
.rr-dot { width: 20px; height: 20px; border-radius: 50%; border: 2px solid #CFD6DF; flex: none; transition: border-width .12s; }
.reg-radio[aria-checked="true"] .rr-dot { border: 6px solid var(--accent); }
.rr-t { flex: 1; min-width: 0; font-size: 14px; font-weight: 500; line-height: 1.3; }
.rr-t small { display: block; color: var(--muted); font-size: 12px; font-weight: 400; margin-top: 1px; }
.rr-v { font: 500 12.5px var(--f-mono); color: var(--muted); white-space: nowrap; }
.reg-radio[aria-checked="true"] .rr-v { color: var(--accent); }

/* --------------------------------------------------------------------------
   9. CTA & NAVIGATION
   -------------------------------------------------------------------------- */
.cta-bar { position: sticky; bottom: 86px; z-index: 20; padding-top: 4px; }
.cta {
  width: 100%; min-height: 54px; border: 0; border-radius: 16px; cursor: pointer;
  background: var(--accent); color: #FFFFFF; font: 700 15px var(--f-body); box-shadow: var(--shadow-btn);
}
.cta:disabled { background: #DDE2EA; color: #7D8798; box-shadow: none; cursor: default; }
body.dark-mode .cta:disabled { background: #1C2944; color: #6B7A94; }

.clinical-nav-dock {
  position: fixed; z-index: 50; left: 50%; transform: translateX(-50%);
  bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  width: min(452px, calc(100% - 24px));
  display: flex; padding: 6px; gap: 2px;
  background: var(--card); border-radius: 22px; box-shadow: 0 8px 28px rgba(13, 26, 51, .16);
}
body.dark-mode .clinical-nav-dock { box-shadow: 0 8px 28px rgba(0, 0, 0, .5); border: 1px solid var(--line); }
.dock-tab {
  flex: 1; position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  min-height: 52px; border: 0; border-radius: 16px; background: transparent; cursor: pointer;
  font: 600 10.5px var(--f-body); color: var(--faint);
}
.dock-tab.active { background: var(--accent-soft); color: var(--accent); }
.dock-badge {
  position: absolute; top: 5px; right: calc(50% - 20px); width: 16px; height: 16px; border-radius: 50%;
  background: var(--ok); color: #FFFFFF; font: 700 9px/16px var(--f-body); font-style: normal; text-align: center;
}

.sticky-action-bar {
  display: flex; gap: 8px; align-items: center;
  position: sticky; bottom: 86px; z-index: 20;
  background: transparent;
  padding: 4px 0 0;
}
.sticky-action-bar .btn { flex: 1; min-height: 52px; }

/* --------------------------------------------------------------------------
   10. STEP 3 · DOSE TICKET (engine-rendered into #resBody)
   -------------------------------------------------------------------------- */
.back {
  align-self: flex-start; display: inline-flex; align-items: center; gap: 4px; min-height: 40px;
  background: none; border: 0; padding: 0 4px; cursor: pointer; color: var(--accent); font-weight: 600; font-size: 13px;
}
.new-drug { align-self: center; }
#resBody { display: flex; flex-direction: column; gap: 12px; }
.empty { color: var(--muted); font-size: 14px; padding: 26px 16px; text-align: center; background: var(--card); border-radius: var(--r-card); box-shadow: var(--shadow-md); }

.ticket { background: var(--card); border-radius: 20px; box-shadow: var(--shadow-lg); position: relative; overflow: hidden; }
.ticket .tp {
  position: relative; display: flex; gap: 12px; align-items: flex-start;
  padding: 16px 16px 14px 18px; border-bottom: 1.5px dashed var(--line);
}
.ticket .tp::before, .ticket .tp::after {
  content: ""; position: absolute; bottom: -10px; width: 18px; height: 18px; border-radius: 50%; background: var(--paper);
}
.ticket .tp::before { left: -9px; }
.ticket .tp::after { right: -9px; }
.ticket .rx-mark { width: 40px; height: 40px; border-radius: 12px; font-size: 22px; }
.tp-t { flex: 1; min-width: 0; }
.tp-t h3 { font-size: 18px; font-weight: 600; line-height: 1.2; }
.tp-t small { display: block; font: 400 12px/1.4 var(--f-body); color: var(--muted); margin-top: 3px; }
.who { font-size: 12px; color: var(--muted); margin-top: 3px; }
.est-tag { font: 600 9.5px var(--f-body); letter-spacing: .08em; color: var(--warn); background: var(--warn-soft); padding: 2px 6px; border-radius: 999px; }
.fav-btn {
  width: 40px; height: 40px; flex: none; border-radius: 12px; border: 0; cursor: pointer;
  background: var(--surface-subtle); color: var(--faint); font-size: 18px; line-height: 1;
}
.fav-btn[aria-pressed="true"] { color: var(--gold); background: var(--gold-soft); }

.ticket .dose { display: flex; align-items: flex-end; gap: 6px; padding: 18px 18px 6px; }
.ticket .v { font: 500 64px/.9 var(--f-mono); letter-spacing: -.05em; color: var(--navy); }
.ticket .v.v-unit { font-size: 30px; line-height: 1.1; letter-spacing: -.02em; }
.ticket .u { font: 500 22px var(--f-mono); color: var(--navy); padding-bottom: 6px; }
body.dark-mode .ticket .v, body.dark-mode .ticket .u { color: #FFFFFF; }
.ticket .mg {
  margin-left: auto; text-align: right; padding-bottom: 6px;
  font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted);
}
.ticket .mg b { display: block; font: 500 19px var(--f-mono); letter-spacing: 0; text-transform: none; color: var(--ink); }
.ticket .sig { margin: 0; padding: 6px 18px 18px; font-size: 15.5px; line-height: 1.45; }
.ticket .sig b { font-weight: 700; }

.verdict { display: flex; align-items: center; gap: 8px; border-radius: var(--r-ctl); padding: 11px 14px; font-weight: 600; font-size: 13.5px; }
.v-ok { background: var(--ok-soft); color: var(--ok); }
.v-warn { background: var(--warn-soft); color: var(--warn); }
.v-bad { background: var(--bad-soft); color: var(--bad); }

.checks { list-style: none; margin: 0; padding: 0 2px; display: flex; flex-direction: column; gap: 9px; font-size: 13.5px; line-height: 1.45; }
.checks li { display: flex; align-items: flex-start; gap: 10px; }
.checks li .ic {
  width: 20px; height: 20px; flex: none; border-radius: 50%; display: grid; place-items: center; margin-top: 1px;
  background: var(--accent-soft); color: var(--accent); font-size: 11px; font-weight: 700;
}
.checks li .ic svg { width: 12px; height: 12px; }
.checks li.l-warn .ic { background: var(--warn-soft); color: var(--warn); }
.checks li.l-bad .ic { background: var(--bad-soft); color: var(--bad); }
.checks li.l-bad { color: var(--bad); font-weight: 500; }

.syringe-guide .syringe-visualizer-card {
  margin-top: 0 !important; border-radius: var(--r-card) !important; border: 0 !important;
  background: var(--card) !important; box-shadow: var(--shadow-md) !important; padding: 14px !important;
}
.syringe-guide svg { max-width: 100%; height: auto; }

.equipment-chip {
  display: flex; flex-wrap: wrap; gap: 2px 6px; align-items: baseline;
  border-radius: 8px;
  background: var(--accent-soft); color: var(--accent); font-size: 13px; padding: 10px 12px;
}
.equipment-chip span { font-weight: 500; opacity: .85; }

.res-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.upsell {
  display: flex; align-items: center; gap: 10px; border-radius: 14px; padding: 11px 13px;
  border: 1px dashed #CDBF98; background: var(--gold-soft); font-size: 12.5px; color: var(--gold-ink);
}
.upsell b { font-weight: 700; letter-spacing: .06em; text-transform: uppercase; font-size: 10.5px; color: var(--gold-ink); border: 1px solid currentColor; border-radius: 999px; padding: 2px 7px; flex: none; }
.tier-hint { font-size: 12px; color: var(--gold-ink); }

.calc-details, .oks { background: var(--card); border-radius: var(--r-card); box-shadow: var(--shadow-md); padding: 0 14px; }
.calc-details summary { min-height: 48px; display: flex; align-items: center; cursor: pointer; font-weight: 600; font-size: 13.5px; color: var(--muted); list-style: none; }
.calc-details summary::-webkit-details-marker { display: none; }
.calc-details summary::after { content: "+"; margin-left: auto; font: 500 18px var(--f-mono); color: var(--faint); }
.calc-details[open] summary::after { content: "–"; }
.calc-details[open] { padding-bottom: 14px; }
.calc-details .checks { margin-top: 12px; }
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); gap: 8px; }
.stat { background: var(--surface-subtle); border-radius: 12px; padding: 10px 12px; }
.stat .v { font: 500 15px var(--f-mono); color: var(--ink); white-space: nowrap; }
.stat .k { font-size: 10px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin-top: 2px; }

/* --------------------------------------------------------------------------
   11. CALLOUTS & MISC
   -------------------------------------------------------------------------- */
.callout { font-size: 13px; line-height: 1.45; border-radius: 12px; padding: 10px 12px; background: var(--surface-subtle); color: var(--ink); }
.callout.c-caution, .callout.c-warn { background: var(--warn-soft); color: var(--warn); }
.callout.c-danger, .callout.c-bad { background: var(--bad-soft); color: var(--bad); }
.callout.c-ok, .callout.c-success { background: var(--ok-soft); color: var(--ok); }
.callout.c-info { background: var(--accent-soft); color: var(--accent); }
.est-note { border: 1px dashed var(--gold); }
.mono { font-family: var(--f-mono); }
.tierinfo { font-size: 12.5px; color: var(--muted); line-height: 1.5; }
.workflow-track { display: none; }
.rows { padding: 4px 14px; gap: 0; }
.row-btn {
  display: flex; align-items: center; min-height: 52px; width: 100%; background: none; border: 0; cursor: pointer;
  font-weight: 600; font-size: 14px; color: var(--ink); text-align: left; padding: 0;
}
.row-btn + .row-btn { border-top: 1px solid var(--line); }
.row-btn::after { content: "›"; margin-left: auto; color: var(--faint); font-size: 20px; }
.row-btn[aria-pressed="true"] { color: var(--accent); }

.toast {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: 96px; z-index: 200;
  background: var(--navy); color: #FFFFFF; padding: 10px 18px; border-radius: 999px;
  font-size: 13px; font-weight: 600; box-shadow: var(--shadow-lg); pointer-events: none; max-width: calc(100% - 32px);
}

/* --------------------------------------------------------------------------
   12. PRESCRIPTION, SLIP & DISPENSING
   -------------------------------------------------------------------------- */
.rx-status { font-size: 13.5px; color: var(--accent); }
.rx {
  font-family: var(--f-mono); font-size: 12.5px; line-height: 1.6; padding: 12px 14px; border-radius: 12px;
  background: var(--surface-subtle); border: 0; color: var(--ink); white-space: pre-wrap;
}
textarea.rx { width: 100%; min-height: 170px; resize: vertical; outline: none; }
.action-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 8px; }

.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; margin: 0; font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 600; text-align: right; font-family: var(--f-mono); font-size: 12.5px; }
#dispBody { display: flex; flex-direction: column; gap: 12px; }

.slip {
  background: var(--card); border-radius: var(--r-card); box-shadow: var(--shadow-lg);
  padding: 16px; display: flex; flex-direction: column; gap: 12px;
}
#slipBody { display: flex; flex-direction: column; gap: 12px; }
.slip .top2 {
  display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap;
  border-bottom: 1.5px dashed var(--line); padding-bottom: 10px;
  font: 600 10.5px var(--f-body); letter-spacing: .1em; text-transform: uppercase; color: var(--muted);
}
.slip .drug { font-size: 20px; font-weight: 600; color: var(--ink); letter-spacing: -.01em; }
.slip ul { margin: 0; padding-left: 18px; font-size: 13.5px; line-height: 1.55; }
.slip-draft { background: var(--warn-soft); color: var(--warn); border-radius: 10px; padding: 8px 10px; font-size: 12.5px; font-weight: 600; }
.cg-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.cg-card { background: var(--surface-subtle); border-radius: 14px; padding: 12px; display: flex; flex-direction: column; gap: 4px; }
.cg-card-dose { background: var(--accent-soft); }
.cg-label { font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.cg-val-liquid, .cg-val-unit { font: 500 24px var(--f-mono); color: var(--accent); letter-spacing: -.02em; }
.cg-freq-text { font-size: 14px; font-weight: 600; color: var(--ink); }
.cg-dur-pill { font-size: 12px; color: var(--muted); }
.dose-split-info { font-size: 12px; color: var(--muted); }

#standaloneSlipView { padding: 16px; flex-direction: column; gap: 12px; }

/* --------------------------------------------------------------------------
   13. DIALOGS
   -------------------------------------------------------------------------- */
dialog.clinical-dialog {
  border: 0; padding: 0; border-radius: 22px; background: var(--card); color: var(--ink);
  width: min(440px, calc(100% - 28px)); max-height: calc(100vh - 40px); box-shadow: 0 24px 60px rgba(1, 27, 72, .35);
}
dialog.clinical-dialog::backdrop { background: rgba(1, 27, 72, .45); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); }
.modal-box { padding: 18px; display: flex; flex-direction: column; gap: 14px; }
.modal-center { text-align: center; }
.modal-header { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.modal-header h3 { font-size: 18px; font-weight: 600; }
.icon-btn { border: 0; border-radius: 12px; background: var(--surface-subtle); color: var(--muted); cursor: pointer; font-size: 16px; }
.modal-body { display: flex; flex-direction: column; gap: 12px; font-size: 13.5px; }
.modal-summary { background: var(--surface-subtle); border-radius: 12px; padding: 12px; line-height: 1.5; }
.confirm-check { display: flex; align-items: flex-start; gap: 10px; font-size: 13px; font-weight: 500; cursor: pointer; }
.confirm-check input { width: 20px; height: 20px; min-height: 0; margin-top: 1px; flex: none; accent-color: var(--accent); }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.modal-center .modal-actions { justify-content: center; }
.qr-name { font-weight: 600; font-size: 16px; }
.qr-dose { font-size: 13px; color: var(--muted); }
.qr-hold { display: inline-block; align-self: center; padding: 12px; background: #FFFFFF; border-radius: 14px; box-shadow: var(--shadow-md); }

/* --------------------------------------------------------------------------
   14. DESKTOP: the app as a centred phone-width column
   -------------------------------------------------------------------------- */
@media (min-width: 720px) {
  body { background: #DDE3EB; }
  body.dark-mode { background: #050B18; }
  .wrap.app { margin: 24px auto; min-height: calc(100vh - 48px); border-radius: 28px; overflow: clip; box-shadow: 0 30px 70px rgba(1, 27, 72, .18); }
  .band { border-radius: 0 0 24px 24px; }
  .clinical-nav-dock { bottom: 36px; width: 452px; }
  .cta-bar, .sticky-action-bar { bottom: 110px; }
  .toast { bottom: 120px; }
}

/* --------------------------------------------------------------------------
   15. SMALL PHONES
   -------------------------------------------------------------------------- */
@media (max-width: 440px) {
  .body { padding: 16px 14px 120px; }
  .ticket .v { font-size: 58px; }
  .seg#tierSeg button { flex: 1 1 30%; font-size: 12.5px; }
  .sticky-action-bar .btn { min-height: 50px; }
}

@media (max-width: 380px) {
  .grid { grid-template-columns: repeat(2, 1fr); }
  .pair-in { grid-template-columns: 1fr; }
  .ticket .v { font-size: 50px; }
  .pt b { font-size: 15px; }
}

/* --------------------------------------------------------------------------
   16. PRINT (prescription A4/A5 vs 80×50 mm thermal label)
   -------------------------------------------------------------------------- */
.print-header { display: none; }
#stickerPrintArea { display: none; }
.pr-top { display: flex; justify-content: space-between; align-items: flex-start; border-bottom: 2px solid #000; padding-bottom: 6px; margin-bottom: 8px; }
.pr-top h2 { font-size: 16px; font-weight: 800; }
#prPrescriber { font-size: 11px; margin-top: 2px; }
.pr-warn { font-size: 10.5px; color: #C00; font-weight: 700; }
.pr-meta { text-align: right; font-size: 10px; }
#prPatientBanner { margin-top: 6px; padding: 6px; background: #F3F3F3; font-size: 10.5px; border-radius: 4px; }

@media print {
  body:not(.print-mode-sticker) {
    background: #FFFFFF !important;
    color: #000000 !important;
    font-size: 10pt !important;
  }
  body:not(.print-mode-sticker) .wrap.app { box-shadow: none !important; margin: 0 !important; max-width: none !important; }
  body:not(.print-mode-sticker) .band,
  body:not(.print-mode-sticker) .clinical-nav-dock,
  body:not(.print-mode-sticker) .cta-bar,
  body:not(.print-mode-sticker) .sticky-action-bar,
  body:not(.print-mode-sticker) .steppers,
  body:not(.print-mode-sticker) .btn,
  body:not(.print-mode-sticker) .chipbtn,
  body:not(.print-mode-sticker) #viewCalc,
  body:not(.print-mode-sticker) #viewSettings,
  body:not(.print-mode-sticker) .page-h,
  body:not(.print-mode-sticker) #stickerPrintArea {
    display: none !important;
  }
  body:not(.print-mode-sticker) .print-header { display: block !important; margin-bottom: 12px; }
  body:not(.print-mode-sticker) .clinical-view:not(#viewCalc):not(#viewSettings) { display: block !important; }
  body:not(.print-mode-sticker) .panel, body:not(.print-mode-sticker) .slip { box-shadow: none !important; border: 1px solid #999; }

  /* Thermal sticker mode: 80 × 50 mm label printer */
  body.print-mode-sticker {
    margin: 0 !important;
    padding: 0 !important;
    background: #FFFFFF !important;
    width: 80mm !important;
    height: 50mm !important;
    overflow: hidden !important;
  }
  body.print-mode-sticker > * { display: none !important; }
  body.print-mode-sticker #stickerPrintArea {
    display: block !important;
    position: absolute; top: 0; left: 0; width: 80mm; height: 50mm;
    padding: 2.5mm 3.5mm; box-sizing: border-box;
    font-family: var(--f-body); color: #000000 !important; background: #FFFFFF !important;
  }
  .thermal-clinic-hdr { border-bottom: 1px solid #000; padding-bottom: 1mm; margin-bottom: 1mm; }
  .lbl-clinic-title { font-size: 8pt; font-weight: 800; }
  .lbl-clinic-sub { font-size: 6pt; font-weight: 700; }
  .thermal-date-row, .thermal-footer { display: flex; justify-content: space-between; font-size: 6.5pt; font-weight: 700; }
  .thermal-patient-row { font-size: 7pt; font-weight: 700; margin: .5mm 0 1mm; }
  .thermal-drug-name { font-size: 10pt; font-weight: 800; text-transform: uppercase; }
  .thermal-drug-conc { font-size: 7.5pt; font-weight: 700; margin-bottom: 1mm; }
  .thermal-dose-highlight { display: flex; justify-content: space-between; align-items: center; border: 1.5px solid #000; padding: 1mm 2mm; margin-bottom: 1mm; border-radius: 1mm; }
  .thermal-vol { font-size: 13pt; font-weight: 800; }
  .thermal-freq { font-size: 7.5pt; font-weight: 800; text-align: right; }
  .thermal-instructions { font-size: 7pt; line-height: 1.25; margin-bottom: 1mm; }
  .thermal-footer { border-top: .5px solid #000; padding-top: .8mm; }
}
body:not(.print-mode-sticker) #stickerPrintArea { display: none; }

/* Patient row: one column when the drug needs only weight or only age */
#wrow { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }

/* Owner feedback 2026-11-05: the floating CTA stacked on the dock covered the list.
   Step 1 has no button (picking a drug moves on); step 2 ends with a normal in-flow button. */
body[data-step="find"] .cta-bar { display: none; }
.cta-bar, .sticky-action-bar { position: static; padding-top: 0; }
.body { padding-bottom: calc(100px + env(safe-area-inset-bottom, 0px)); }
@media (min-width: 720px) { .body { padding-bottom: 130px; } }

/* Search: the outer box carries the focus ring, so the input itself shows none (no double ring) */
.search input:focus, .search input:focus-visible { outline: none; box-shadow: none; border-color: transparent; }

/* Indication review (Reviewer mode) */
.reviewer-only { display: none; }
body.reviewer-on .reviewer-only { display: flex; }
dialog.review-dialog { width: min(560px, calc(100% - 20px)); }
.review-dialog .modal-body { max-height: 62vh; overflow-y: auto; gap: 10px; }
.rv-drug { font: 600 10.5px var(--f-body); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin-top: 6px; }
.rv-item { border-radius: 14px; background: var(--surface-subtle); padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.rv-label { font-weight: 600; font-size: 13.5px; line-height: 1.35; }
.rv-ref { font: 500 11.5px var(--f-mono); color: var(--muted); }
.rv-claude { font-size: 12.5px; line-height: 1.4; border-radius: 10px; padding: 8px 10px; background: var(--accent-soft); color: var(--accent); }
.rv-claude b { display: block; margin-bottom: 2px; }
.rv-claude.rv-change { background: var(--warn-soft); color: var(--warn); }
.rv-claude.rv-reject { background: var(--bad-soft); color: var(--bad); }
.rv-actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.rv-actions button { min-height: 40px; border-radius: 10px; border: 1.5px solid var(--line); background: var(--surface); font-weight: 600; font-size: 13px; color: var(--muted); cursor: pointer; }
.rv-actions button[data-v="approve"][aria-checked="true"] { border-color: var(--ok); background: var(--ok-soft); color: var(--ok); }
.rv-actions button[data-v="change"][aria-checked="true"] { border-color: var(--warn); background: var(--warn-soft); color: var(--warn); }
.rv-actions button[data-v="reject"][aria-checked="true"] { border-color: var(--bad); background: var(--bad-soft); color: var(--bad); }
.rv-comment { min-height: 40px; font-size: 14px; padding: 8px 10px; }

/* A5 rebuild: header (weight · allergy), New patient, flat fixed nav, continue banner, undo toast */
.pt { grid-template-columns: 1.3fr 1fr; }
.band-bar .plan { margin-left: auto; }
.np-btn { display: inline-flex; align-items: center; justify-content: center; gap: 5px; min-height: 32px; min-width: 32px; padding: 0 8px; margin-left: 8px; border-radius: 10px; border: 1px solid rgba(255, 255, 255, .2); background: transparent; color: #FFFFFF; font: 600 11px var(--f-body); cursor: pointer; }
.np-btn span:empty { display: none; }
.clinical-nav-dock { left: 0; right: 0; transform: none; bottom: 0; width: 100%; max-width: 480px; margin: 0 auto; border-radius: 0; box-shadow: none; border-top: 1px solid var(--line); padding: 6px 6px calc(6px + env(safe-area-inset-bottom, 0px)); }
body.dark-mode .clinical-nav-dock { border: 0; border-top: 1px solid var(--line); box-shadow: none; }
.dock-tab.active { background: transparent; }
.dock-tab.active svg { background: var(--accent-soft); border-radius: 999px; padding: 3px 16px; width: 54px; height: 28px; box-sizing: border-box; }
.body { padding-bottom: calc(96px + env(safe-area-inset-bottom, 0px)); }
.cont-banner { background: var(--card); border: 1.5px solid var(--accent); border-radius: var(--r-card); padding: 14px; margin-bottom: 14px; box-shadow: var(--shadow-lg); }
.cont-banner b { display: block; font-size: 15px; }
.cont-acts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
.np-toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(84px + env(safe-area-inset-bottom, 0px)); width: min(452px, calc(100% - 24px)); z-index: 210; background: var(--navy); color: #FFFFFF; border-radius: 16px; padding: 12px 14px; display: flex; gap: 12px; align-items: center; box-shadow: 0 12px 30px rgba(1, 27, 72, .35); }
.np-toast b { display: block; font-size: 14px; }
.np-toast small { display: block; color: #B9C8E4; font-size: 11.5px; line-height: 1.35; margin-top: 2px; }
.np-toast small:empty { display: none; }
.np-toast button { margin-left: auto; flex: none; background: none; border: 0; color: var(--sky); font: 700 14px var(--f-body); min-height: 44px; padding: 0 6px; cursor: pointer; }
@media (min-width: 720px) {
  .clinical-nav-dock { bottom: 24px; width: 480px; border-radius: 0 0 28px 28px; }
  .body { padding-bottom: 120px; }
  .np-toast { bottom: 110px; }
}

/* A5 rebuild: search hint, By condition tiles, condition card, result rows with class label and dose preview */
.eg { font-size: 12px; color: var(--faint); margin: -8px 4px 0; }
.step-find:has(#qres:not([hidden])) .eg { display: none; }
.lbl-note { font-size: 11px; letter-spacing: .04em; text-transform: none; font-weight: 600; color: var(--faint); }
.conds { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.cond { background: var(--card); border: 0; border-radius: 14px; padding: 11px 12px; display: flex; gap: 10px; align-items: center; text-align: left; box-shadow: var(--shadow-sm); cursor: pointer; min-height: 60px; color: var(--ink); }
.cond .ic { width: 32px; height: 32px; border-radius: 9px; flex: none; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.cond b { display: block; font-size: 13px; font-weight: 600; line-height: 1.2; }
.cond small { display: block; font-size: 11px; color: var(--muted); margin-top: 2px; }
.cls { display: table; font: 600 10px var(--f-body); letter-spacing: .04em; color: var(--accent); background: var(--accent-soft); border-radius: 6px; padding: 2px 6px; margin: 2px 0 1px; }
.cls.pen { color: #8A3B00; background: #FDEBDD; }
body.dark-mode .cls.pen { color: #FFB27A; background: #3A2412; }
.res-n small { display: block; }
.pv { flex: none; text-align: right; }
.pv b { display: block; font: 500 16px var(--f-mono); color: var(--navy); white-space: nowrap; }
body.dark-mode .pv b { color: #FFFFFF; }
.pv small { font-size: 10px; color: var(--faint); }
.pv-open b { font: 600 13px var(--f-body); color: var(--accent); }
body[data-step="card"] .step-card { display: flex; }
body[data-step="card"] .cta-bar { display: none; }
.card-draft { align-self: flex-start; font: 600 10px var(--f-body); letter-spacing: .06em; text-transform: uppercase; color: var(--warn); background: var(--warn-soft); border-radius: 6px; padding: 3px 8px; }
#cardBody { display: flex; flex-direction: column; gap: 12px; }
.cc { gap: 6px; }
.cc-h { font: 600 10.5px var(--f-body); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.tx { display: flex; gap: 10px; align-items: flex-start; padding: 8px 0; }
.tx + .tx { border-top: 1px dashed var(--line); }
.tx .r { font: 600 10px var(--f-body); letter-spacing: .04em; text-transform: uppercase; color: var(--accent); background: var(--accent-soft); border-radius: 6px; padding: 3px 6px; flex: none; margin-top: 2px; max-width: 80px; }
.tx .b { flex: 1; font-size: 13px; line-height: 1.4; }
.tx .b .cls { display: inline-block; }
.tx .calc { flex: none; min-height: 36px; border: 0; border-radius: 999px; padding: 6px 12px; background: var(--accent); color: #FFFFFF; font: 600 12px var(--f-body); cursor: pointer; }
.pts { margin: 0; padding-left: 18px; font-size: 13px; line-height: 1.5; }
.rf { background: var(--bad-soft); color: var(--bad); border-radius: 14px; padding: 11px 13px; font-size: 12.5px; line-height: 1.45; }
.rf b { display: block; font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; margin-bottom: 4px; }

/* A5 rebuild: regimen summary row, regimen box collapsed until Edit, CTA hint */
.reg-sum { flex-direction: row; align-items: center; gap: 10px; width: 100%; border: 0; text-align: left; cursor: pointer; color: var(--ink); padding: 13px 14px; }
.reg-sum-t { flex: 1; min-width: 0; }
.reg-sum-t span { display: block; font: 600 10.5px var(--f-body); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.reg-sum-t b { display: block; font: 500 13.5px var(--f-mono); color: var(--ink); margin-top: 2px; overflow-wrap: anywhere; }
.reg-sum-e { flex: none; color: var(--accent); font-weight: 600; font-size: 13px; }
.step-setup .regimen-box { display: none; }
body.reg-open .step-setup .regimen-box { display: flex; }
.cta-hint { text-align: center; font-size: 12.5px; font-weight: 600; color: var(--warn); margin-bottom: 8px; }
.cta.is-waiting { background: #DDE2EA; color: #7D8798; box-shadow: none; }
body.dark-mode .cta.is-waiting { background: #1C2944; color: #6B7A94; }
.flash { animation: flash 1.2s ease 1; }
@keyframes flash { 0%, 100% { box-shadow: var(--shadow-md); } 30% { box-shadow: 0 0 0 3px var(--gold); } }

/* A5 rebuild: frequency and duration chips in the regimen editor */
.chips-seg { flex-wrap: wrap; }
.chips-seg button { flex: 1 1 auto; min-height: 44px; border: 0; border-radius: 9px; background: transparent; cursor: pointer; font: 500 13px var(--f-mono); color: var(--muted); padding: 6px 10px; }
.chips-seg button[aria-checked="true"] { background: var(--card); color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, .10); }
.chips-seg button.other { font-family: var(--f-body); font-weight: 600; }
.setby { font: 600 9.5px var(--f-body); letter-spacing: .06em; text-transform: none; color: var(--accent); background: var(--accent-soft); border-radius: 6px; padding: 2px 6px; }
.dur-other { max-width: 160px; }

/* A5 rebuild: dose ticket */
.res-nav { display: flex; justify-content: space-between; gap: 8px; }
.tp-t .cls { margin-top: 3px; }
.tp-t small.ind { color: var(--muted); }
.tp-t small.ind b { color: var(--ink); font-weight: 600; }
.dose2 { padding: 14px 18px 4px; display: flex; flex-direction: column; gap: 6px; }
.drow { display: flex; align-items: baseline; gap: 6px; }
.drow + .drow { border-top: 1px dashed var(--line); padding-top: 6px; }
.dl { width: 74px; font: 600 11px var(--f-body); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.v2 { font: 500 40px/1 var(--f-mono); letter-spacing: -.04em; color: var(--navy); }
.u2 { font: 500 16px var(--f-mono); color: var(--navy); }
body.dark-mode .v2, body.dark-mode .u2 { color: #FFFFFF; }
.mg2 { margin-left: auto; font: 500 16px var(--f-mono); color: var(--ink); }
.ticket .equipment-chip.syr { margin: 0 18px 10px; padding: 7px 10px; font-size: 12.5px; }
.course { margin: 0 18px 16px; font-size: 12.5px; color: var(--muted); }
.course b { font-family: var(--f-mono); color: var(--ink); }
.inote { background: var(--accent-soft); color: var(--accent); border-radius: 14px; padding: 11px 13px; font-size: 13px; line-height: 1.4; }
.calc-details summary .verdict-s { font-weight: 600; }
.verdict-s.v-ok { color: var(--ok); } .verdict-s.v-warn { color: var(--warn); } .verdict-s.v-bad { color: var(--bad); }
.calc-details summary .n-ok { color: var(--faint); font-weight: 500; margin-left: 4px; }
.res-actions.one { grid-template-columns: 1fr; }
.stock-chips { margin-top: 4px; }
/* The ticket has its own Edit patient / Change indication links */
#btnEditDose { display: none; }

/* A5 rebuild: influenza calculator */
body[data-step="flu"] .step-flu { display: flex; }
body[data-step="flu"] .cta-bar { display: none; }
.flu-mark { font: 700 12px var(--f-body); font-style: normal; }
.fixc { font-size: 12px; color: var(--muted); background: var(--surface-subtle); border-radius: 10px; padding: 8px 10px; }
.stats2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 0 18px 12px; }
.stats2 > div { background: var(--surface-subtle); border-radius: 12px; padding: 8px 10px; }
.stats2 span { display: block; font: 600 9.5px var(--f-body); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.stats2 b { font: 500 14px var(--f-mono); }
.bands { padding: 0; gap: 0; overflow: hidden; }
.bands > div { display: flex; justify-content: space-between; gap: 8px; padding: 9px 14px; font-size: 13px; }
.bands > div + div { border-top: 1px solid var(--line); }
.bands b { font: 500 12.5px var(--f-mono); white-space: nowrap; }
.bands .on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.caut { background: var(--warn-soft); color: var(--warn); border-radius: 14px; padding: 11px 13px; font-size: 12.5px; line-height: 1.4; }
.caut b { display: block; }

/* Plans modal */
.plans { display: flex; flex-direction: column; gap: 10px; }
.plan-opt { border: 1.5px solid var(--line); border-radius: 14px; padding: 12px 14px; }
.plan-opt b { font-size: 16px; }
.plan-opt .pr { float: right; font: 600 16px var(--f-mono); color: var(--accent); }
.plan-opt .pr small { font: 500 11px var(--f-body); color: var(--muted); }
.plan-opt ul { margin: 8px 0 0; padding-left: 18px; font-size: 13px; line-height: 1.5; }

/* Settings */
.plan-card .plan-now { display: flex; justify-content: space-between; align-items: baseline; }
.plan-card .plan-now span { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.plan-card .plan-now b { font: 600 20px var(--f-display); color: var(--accent); }
.pro-only { display: none; }
body.tier-pro .pro-only { display: flex; }
body.tier-pro .lbl.pro-only { display: flex; }
.stock-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; }
.stock-row + .stock-row { border-top: 1px solid var(--line); }
.stock-row span:first-child { flex: 1; min-width: 0; }
.stock-row b { display: block; font-size: 14px; font-weight: 600; }
.stock-row small { display: block; font-size: 11.5px; color: var(--muted); }
.stock-row .sz { font: 500 14px var(--f-mono); }
.stock-row button { border: 0; background: var(--surface-subtle); color: var(--muted); border-radius: 10px; min-width: 36px; min-height: 36px; cursor: pointer; }
.refs { margin: 0; padding-left: 18px; font-size: 12.5px; line-height: 1.5; color: var(--ink); }
.ver { align-self: flex-start; background: none; border: 0; padding: 4px 0; color: var(--faint); font: 500 12px var(--f-mono); cursor: default; }

/* Prescription list */
.rx-list { padding: 4px 14px; gap: 0; }
.rx-row { display: flex; align-items: center; gap: 10px; padding: 11px 0; }
.rx-row + .rx-row { border-top: 1px solid var(--line); }
.rx-row .n { flex: 1; min-width: 0; }
.rx-row .n b { display: block; font-size: 14.5px; font-weight: 600; }
.rx-row .n small { display: block; font-size: 12px; color: var(--muted); }
.rx-row .n .cls { margin: 2px 0; }
.rx-row button { border: 0; background: none; cursor: pointer; min-height: 40px; padding: 0 6px; font-weight: 600; font-size: 12.5px; color: var(--accent); }
.rx-row button.x { color: var(--faint); font-size: 15px; }
.emr-note { margin: 0; white-space: pre-wrap; font: 500 12px/1.6 var(--f-mono); background: var(--card); color: var(--ink); border-radius: var(--r-card); padding: 12px 14px; box-shadow: var(--shadow-md); }
.rx-confirm { align-items: flex-start; }
.pro-lock { background: var(--gold-soft); color: var(--gold-ink); border: 1px dashed #CDBF98; border-radius: 14px; padding: 11px 13px; font-size: 12.5px; line-height: 1.45; }
.pro-lock b { display: block; }

/* Caregiver slip (parents) and simple dispensing */
.slip .syrgen { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; background: var(--accent-soft); color: var(--ink); border-radius: 12px; padding: 10px 12px; font-size: 13px; line-height: 1.4; }
.slip .syrgen b { color: var(--accent); }
.slip .ret { background: var(--bad-soft); color: var(--bad); border-radius: 12px; padding: 10px 12px; font-size: 12.5px; line-height: 1.45; }
.slip .ret b { display: block; margin-bottom: 2px; }
.slip .tips { margin: 0; padding-left: 18px; font-size: 13.5px; line-height: 1.5; }
.disp-line { display: flex; align-items: center; gap: 10px; }
.disp-line .n { flex: 1; min-width: 0; }
.disp-line .n b { display: block; font-size: 15px; font-weight: 600; }
.disp-line .n small { display: block; font-size: 12px; color: var(--muted); }
.disp-line .q { text-align: right; }
.disp-line .q b { display: block; font: 600 18px var(--f-body); }
.disp-line .q small { font-size: 12px; color: var(--accent); font-weight: 600; }
.warn-t { color: var(--warn); }

/* Caregiver: full-screen slip for the parent to photograph */
body.slip-full #slipBox { position: fixed; inset: 0; z-index: 300; overflow-y: auto; border-radius: 0; padding: 18px 16px 40px; background: var(--card); cursor: zoom-out; }
body.slip-full .clinical-nav-dock, body.slip-full .band { visibility: hidden; }

/* Prescription lines calculated for different patient details */
.rx-row.stale .n { opacity: .55; text-decoration: line-through; }
.rx-row.stale [data-edit] { color: var(--bad); }
.rx-stale { background: var(--bad-soft); color: var(--bad); border-radius: 12px; padding: 10px 12px; font-size: 12.5px; line-height: 1.45; font-weight: 600; }

/* Full-screen slip: show how to close it (tap anywhere) */
body.slip-full #slipBox::after { content: "Tap anywhere to close ✕"; position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%); background: var(--ink); color: var(--card); font: 600 13px var(--f-body); padding: 10px 18px; border-radius: 999px; box-shadow: var(--shadow-md); }

/* Caregiver slip: one numbered card per prescription medicine */
.slip-multi .slip-track { display: flex; gap: 12px; overflow-x: auto; scroll-snap-type: x mandatory; margin: 0 -4px; padding: 2px 4px 6px; }
.slip-multi .slip-card { flex: 0 0 100%; scroll-snap-align: start; display: flex; flex-direction: column; gap: 10px; }
.slip-no { align-self: flex-start; background: var(--accent); color: #fff; border-radius: 999px; padding: 6px 14px; font: 600 15px var(--f-body); }
.slip-no b { font-size: 20px; }
.slip-sum { display: flex; flex-wrap: wrap; gap: 6px; font-size: 12.5px; }
.slip-sum span { background: var(--accent-soft); border-radius: 999px; padding: 4px 10px 4px 4px; display: inline-flex; align-items: center; gap: 6px; }
.slip-sum b { background: var(--accent); color: #fff; border-radius: 50%; width: 20px; height: 20px; display: inline-grid; place-items: center; font-size: 12px; }
.slip-swipe { text-align: center; font-size: 12px; color: var(--muted); }
.staff-no { margin: 0 0 8px; background: var(--warn-soft); color: var(--ink); border-radius: 12px; padding: 9px 12px; font-size: 13px; }

/* Field fixes (Nov 2026): checkboxes, Rx spacing, slip hierarchy, photo fit, tablet layout */
input[type="checkbox"] {
  -webkit-appearance: none; appearance: none; width: 22px; height: 22px; min-height: 0; padding: 0; margin: 0;
  flex: none; border: 2px solid var(--faint); border-radius: 6px; background: var(--card); cursor: pointer;
  display: inline-grid; place-content: center; transition: background .15s, border-color .15s;
}
input[type="checkbox"]::after { content: ""; width: 6px; height: 11px; border: solid #FFFFFF; border-width: 0 2.5px 2.5px 0; transform: rotate(45deg) translate(-1px, -1px); opacity: 0; }
input[type="checkbox"]:checked { background: var(--accent); border-color: var(--accent); }
input[type="checkbox"]:checked::after { opacity: 1; }
input[type="checkbox"]:focus-visible { outline: 2.5px solid var(--azure); outline-offset: 2px; }
.confirm-check { align-items: center; line-height: 1.45; }
.confirm-check:has(input:checked) { color: var(--accent); }

.rx-row { padding: 14px 0; align-items: flex-start; }
.rx-row .n b { line-height: 1.35; margin-bottom: 4px; }
.rx-row .n .cls { display: inline-block; margin: 0 0 6px; }
.rx-row .n small { line-height: 1.55; }
.rx-row button { align-self: center; }
#rxEmr, .rx-emr { line-height: 1.6; }

.slip .drug { line-height: 1.2; }
.slip .drug .dn { display: block; font: 700 26px var(--f-body); color: var(--accent); letter-spacing: -.015em; }
.slip .drug .db { display: block; font-size: 13px; font-weight: 500; color: var(--muted); margin-top: 3px; }
.cg-label { font-size: 11.5px; }
.cg-val-liquid, .cg-val-unit { font-size: 34px; font-weight: 700; line-height: 1.1; color: var(--ink); }
.cg-freq-text { font-size: 15px; line-height: 1.4; }

/* Full-screen slip: fit one medicine on one phone screen for a photo */
body.slip-full #slipBox { height: 100vh; height: 100dvh; padding: calc(10px + env(safe-area-inset-top, 0px)) 14px calc(12px + env(safe-area-inset-bottom, 0px)); }
body.slip-full #slipBox::after { content: "✕"; left: auto; right: 12px; bottom: auto; top: calc(10px + env(safe-area-inset-top, 0px)); transform: none; width: 36px; height: 36px; padding: 0; display: grid; place-items: center; font-size: 16px; opacity: .75; }
body.slip-full .slip-card, body.slip-full #slipBody { gap: 8px; }
body.slip-full .slip .top2 { padding-bottom: 6px; padding-right: 40px; }
body.slip-full .syrgen { flex-direction: row; align-items: center; text-align: left; gap: 10px; padding: 8px 10px; font-size: 12.5px; }
body.slip-full .syrgen img { width: 110px; height: auto; flex: none; }
body.slip-full .ret { font-size: 12.5px; line-height: 1.4; padding: 8px 10px; }
body.slip-full .slip-swipe, body.slip-full .staff-no { display: none; }

/* Tablets, landscape phones and desktop: wider column, nav attached to the bottom edge */
@media (min-width: 720px) {
  .wrap.app { max-width: 640px; margin: 0 auto; min-height: 100vh; border-radius: 0; }
  .clinical-nav-dock { bottom: 0; width: 100%; max-width: 640px; border-radius: 0; }
  .body { padding-bottom: calc(96px + env(safe-area-inset-bottom, 0px)); }
  .np-toast { bottom: calc(84px + env(safe-area-inset-bottom, 0px)); }
  .cta-bar, .sticky-action-bar { bottom: calc(80px + env(safe-area-inset-bottom, 0px)); }
  .toast { bottom: calc(90px + env(safe-area-inset-bottom, 0px)); }
}

/* Prescription: breathing room between list, EMR note, confirm and copy */
#rxNew { display: flex; flex-direction: column; gap: 12px; }
#rxNew .lbl { margin: 14px 2px 0; }
#rxNew .lbl:first-child { margin-top: 6px; }
.emr-note { font-size: 13px; line-height: 1.75; padding: 14px 16px; }
#rxNew .rx-confirm { margin-top: 6px; line-height: 1.5; }
#rxNew #rxCopyAll { margin-top: 2px; }

/* iOS: keep the nav glued to the bottom (no rubber-band drift; hide while the keyboard is open) */
html, body { overscroll-behavior-y: none; }
.clinical-nav-dock { -webkit-transform: translateZ(0); transform: translateZ(0); }
body.kbd-open .clinical-nav-dock { display: none; }

/* Dose result: "New medication" sits beside "Add to prescription"; hide the duplicate link below */
#resBody:has(#resNewDrug) ~ #btnNewDrug { display: none; }

/* Settings: link rows (Help & support) */
a.row-btn { text-decoration: none; }
