/* Palette from "Silent Killers No More" */
:root {
  --ink: #131110; --bone: #EFE9DD; --surface: #FBF8F2; --surface-2: #F7F3EB;
  --line: #D8CFBF; --line-2: #BFB4A1; --ember: #B0452A; --ember-text: #9E3C21;
  --soft: #F4E1D8; --muted: #5A534A; --ok: #2F6B45; --ok-soft: #E1EEE4; --warn: #8A5A00; --warn-soft: #F6EBD2;
  --serif: 'Fraunces', Georgia, serif; --sans: 'Work Sans', system-ui, sans-serif; --mono: 'IBM Plex Mono', ui-monospace, monospace;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body { background: var(--bone); color: var(--ink); font: 15px/1.5 var(--sans); }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; margin: 0; letter-spacing: -0.01em; }
h1 { font-size: 26px; } h2 { font-size: 20px; } h3 { font-size: 16px; }
a { color: var(--ember-text); }
.mono { font-family: var(--mono); font-size: 13px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.boot { padding: 48px; color: var(--muted); }

/* ---------- Sign-in screens ---------- */
.gate { min-height: 100%; display: grid; place-items: center; padding: 24px 16px; }
.gate-card { width: 100%; max-width: 420px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 28px; }
.gate-card h1 { margin-bottom: 4px; }
.gate-card .brand { font-family: var(--mono); font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: var(--ember-text); margin-bottom: 18px; }
.gate-card form > * + * { margin-top: 14px; }
.secret { font-family: var(--mono); font-size: 17px; letter-spacing: .06em; background: var(--surface-2); border: 1px dashed var(--line-2); border-radius: 6px; padding: 12px; text-align: center; word-break: break-all; user-select: all; }
ol.steps { padding-left: 20px; margin: 8px 0; } ol.steps li + li { margin-top: 6px; }

/* ---------- Form controls ---------- */
label.f { display: block; }
label.f > span { display: block; font-size: 13px; font-weight: 500; color: var(--muted); margin-bottom: 4px; }
input[type=text], input[type=password], input[type=date], input[type=email], input[type=tel], input[type=search], select, textarea {
  width: 100%; background: #fff; border: 1px solid var(--line-2); border-radius: 6px; padding: 8px 10px; min-height: 38px;
}
textarea { min-height: 96px; resize: vertical; line-height: 1.45; }
textarea.tall { min-height: 160px; }
input:focus, select:focus, textarea:focus, button:focus-visible { outline: 2px solid var(--ember); outline-offset: 1px; }
input.code { font-family: var(--mono); font-size: 22px; letter-spacing: .3em; text-align: center; }
.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line-2); background: var(--surface); border-radius: 6px; padding: 7px 14px; min-height: 36px; cursor: pointer; font-weight: 500; white-space: nowrap; }
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--ember); border-color: var(--ember); color: #fff; }
.btn.primary:hover { background: var(--ember-text); }
.btn.danger { color: var(--ember-text); border-color: var(--ember); }
.btn.link { border: none; background: none; padding: 4px 6px; color: var(--ember-text); min-height: 0; }
.btn[disabled] { opacity: .5; cursor: default; }
.btn.block { width: 100%; justify-content: center; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.row.between { justify-content: space-between; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 16px; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px 16px; }
.span2 { grid-column: span 2; } .span3 { grid-column: 1 / -1; }
.msg { border-radius: 6px; padding: 10px 12px; font-size: 14px; }
.msg.err { background: var(--soft); color: var(--ember-text); border: 1px solid #E5BFB0; }
.msg.ok { background: var(--ok-soft); color: var(--ok); border: 1px solid #BCD8C4; }
.msg.warn { background: var(--warn-soft); color: var(--warn); border: 1px solid #E6D2A6; }

/* ---------- App shell ---------- */
.shell { display: grid; grid-template-columns: 220px minmax(0, 1fr); min-height: 100%; }
.side { background: var(--ink); color: var(--bone); padding: 16px 14px; display: flex; flex-direction: column; gap: 2px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.side .clinic { font-family: var(--serif); font-size: 19px; padding: 0 8px 4px; }
.side .tag { font-family: var(--mono); font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: #C9A898; padding: 0 8px 16px; }
.side button { text-align: left; background: none; border: none; color: var(--bone); padding: 6px 10px; border-radius: 6px; cursor: pointer; flex: 0 0 auto; }
.side button:hover { background: #2A2522; }
.side button.on { background: var(--ember); color: #fff; }
.side .spacer { flex: 1; }
.side .who { font-size: 13px; color: #CFC6B8; padding: 8px 10px; border-top: 1px solid #2E2926; margin-top: 8px; }
.main { padding: 24px 28px 48px; min-width: 0; }
.idle { position: fixed; left: 50%; top: 12px; transform: translateX(-50%); z-index: 50; box-shadow: 0 6px 24px rgba(0,0,0,.15); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 18px; }
.card + .card { margin-top: 16px; }
.card h2 { margin-bottom: 12px; }
.head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.head .sub { color: var(--muted); margin-top: 2px; }

table.t { width: 100%; border-collapse: collapse; }
table.t th { text-align: left; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); border-bottom: 1px solid var(--line-2); padding: 8px; }
table.t td { border-bottom: 1px solid var(--line); padding: 9px 8px; vertical-align: top; }
table.t tr.click { cursor: pointer; } table.t tr.click:hover td { background: var(--surface-2); }
table.t tr.dim td { color: var(--muted); }
.tablewrap { overflow-x: auto; }
.pill { display: inline-block; font-size: 12px; padding: 1px 8px; border-radius: 99px; background: var(--surface-2); border: 1px solid var(--line); white-space: nowrap; }
.pill.ember { background: var(--soft); border-color: #E5BFB0; color: var(--ember-text); }
.pill.ok { background: var(--ok-soft); border-color: #BCD8C4; color: var(--ok); }
.pill.warn { background: var(--warn-soft); border-color: #E6D2A6; color: var(--warn); }

/* ---------- Chart ---------- */
.banner { background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--ember); border-radius: 10px; padding: 14px 18px; margin-bottom: 16px; display: flex; gap: 18px; align-items: center; flex-wrap: wrap; }
.banner .name { font-family: var(--serif); font-size: 22px; font-weight: 600; }
.banner .facts { display: flex; gap: 14px; flex-wrap: wrap; color: var(--muted); font-size: 14px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line-2); margin-bottom: 16px; flex-wrap: wrap; }
.tabs button { background: none; border: none; border-bottom: 2px solid transparent; padding: 8px 12px; cursor: pointer; color: var(--muted); font-weight: 500; }
.tabs button.on { color: var(--ink); border-bottom-color: var(--ember); }
.cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.list li:last-child { border-bottom: none; }
.list li.off { color: var(--muted); text-decoration: line-through; }
.addform { margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--line-2); }
dl.kv { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 6px 12px; margin: 0; }
dl.kv dt { color: var(--muted); font-size: 13px; } dl.kv dd { margin: 0; }

/* ---------- Note ---------- */
.note-sec + .note-sec { margin-top: 14px; }
.note-sec h3 { font-size: 13px; font-family: var(--sans); text-transform: uppercase; letter-spacing: .06em; color: var(--ember-text); margin-bottom: 4px; }
.note-body { white-space: pre-wrap; }
.addendum { border-left: 3px solid var(--line-2); padding: 6px 12px; margin-top: 10px; background: var(--surface-2); }
.savestate { font-size: 13px; color: var(--muted); }

@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; padding: 10px 12px; }
  .side .tag, .side .spacer { display: none; }
  .side .who { border: none; margin: 0; }
  .main { padding: 16px; }
  .cols, .grid2, .grid3 { grid-template-columns: 1fr; }
  .span2 { grid-column: auto; }
  dl.kv { grid-template-columns: 1fr; }
}

/* ---------- Print: only the note ---------- */
.print-only { display: none; }
@media print {
  body { background: #fff; }
  .side, .tabs, .banner, .no-print, .idle { display: none !important; }
  .shell { display: block; } .main { padding: 0; }
  .card { border: none; padding: 0; background: #fff; }
  .print-only { display: block; }
}

/* Inputs laid out side by side in a row */
.row > input, .row > select { width: auto; flex: 1 1 170px; }
.row > input[type=checkbox] { flex: 0 0 auto; }
.row > input[type=file] { flex: 1 1 240px; }

/* ---------- Templates ---------- */
.tgrid { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 16px; align-items: start; }
.tlist { display: flex; flex-direction: column; gap: 2px; }
.tlist button { text-align: left; background: none; border: none; padding: 8px 10px; border-radius: 6px; cursor: pointer; }
.tlist button:hover { background: var(--surface-2); }
.tlist button.on { background: var(--soft); color: var(--ember-text); font-weight: 600; }
.tlist button.add { color: var(--ember-text); margin-top: 6px; border-top: 1px dashed var(--line-2); border-radius: 0; }
.chips { display: flex; flex-wrap: wrap; gap: 4px; margin: 8px 0; }
.chip { font-family: var(--mono); font-size: 12px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 99px; padding: 2px 8px; cursor: pointer; color: var(--ink); }
.chip:hover { border-color: var(--ember); color: var(--ember-text); }
.chip.faded { opacity: .55; }
.preview { background: var(--surface-2); border: 1px dashed var(--line-2); border-radius: 6px; padding: 10px 12px; margin-top: 8px; white-space: pre-wrap; }
.notetools { margin: 0 0 12px; }
.notetools select { flex: 0 1 230px; }
@media (max-width: 860px) { .tgrid { grid-template-columns: 1fr; } }

/* ---------- Vitals, labs, diagnoses ---------- */
.vgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px 10px; }
.vin { font-family: var(--mono); }
td.hi, td .hi { color: var(--ember-text); font-weight: 600; }
td.lo { color: #1f5f8b; font-weight: 600; }
tr.strike td { text-decoration: line-through; }
.labrow { margin-top: 6px; }
.labrow select { flex: 2 1 240px; } .labrow input.vin { flex: 0 1 110px; }
.linkish { background: none; border: none; padding: 0; font: inherit; color: inherit; cursor: pointer; }
.linkish:hover { text-decoration: underline; }
.dxlist { margin: 6px 0 0; padding-left: 22px; }
.dxlist li { display: list-item; padding: 4px 0; }
.dxlist li > span:first-child { margin-right: 8px; }
.dxlist .row { display: inline-flex; gap: 2px; }
.dxresults { display: flex; flex-direction: column; max-height: 260px; overflow-y: auto; margin-top: 4px; }
.dxhit { text-align: left; background: none; border: none; border-bottom: 1px solid var(--line); padding: 6px 4px; cursor: pointer; }
.dxhit:hover { background: var(--soft); }
.dxhit .mono { color: var(--ember-text); margin-right: 6px; }
.rxname { font-family: var(--serif); font-size: 17px; margin: 10px 0 4px; }
.rxgrid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); margin-top: 8px; }
.reghead, .regrow { display: grid; grid-template-columns: 1.2fr .6fr .8fr .8fr 1fr .5fr 1.6fr auto; gap: 6px; margin-bottom: 6px; align-items: center; }
@media (max-width: 860px) { .regrow { grid-template-columns: 1fr 1fr; } .reghead { display: none; } }

/* ---------- Front office ---------- */
.stats { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; margin: 14px 0; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; }
.stat .n { font-family: var(--serif); font-size: 24px; font-weight: 600; }
.slot { border-bottom: 1px solid var(--line); padding: 4px 0; }
.slot:last-child { border-bottom: none; }
.openslot { display: flex; gap: 12px; align-items: center; padding: 4px 0 4px 6px; }
.appt { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 10px; padding: 8px 6px; border-left: 3px solid var(--line-2); margin: 4px 0; background: var(--surface-2); border-radius: 6px; }
.appt.arrived { border-left-color: var(--warn); } .appt.roomed { border-left-color: var(--ember); } .appt.checked_out { border-left-color: var(--ok); }
.appt.cancelled, .appt.no_show { opacity: .6; }
.appttime { font-weight: 600; }
.apptact { margin-top: 6px; gap: 6px; }
.btn.small { min-height: 30px; padding: 4px 10px; font-size: 13px; }
select.small, input.small { min-height: 30px; padding: 3px 6px; font-size: 13px; width: auto; flex: 0 0 auto; }
.checkin { width: 100%; background: var(--surface); border: 1px dashed var(--line-2); border-radius: 6px; padding: 8px 10px; display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.bookcard { border-color: var(--ember); }
.remrow { flex-wrap: wrap; }
.remrow > div:first-child { flex: 1 1 380px; }
@media (max-width: 860px) { .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* ---------- Billing ---------- */
.chip.on { background: var(--ember); color: #fff; border-color: var(--ember); }
.feecat { font-size: 14px; margin: 16px 0 6px; color: var(--ember-text); font-family: var(--sans); text-transform: uppercase; letter-spacing: .05em; }
input.money { text-align: right; max-width: 110px; }
.payergrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 10px; }
.payer { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; background: var(--surface-2); display: flex; flex-direction: column; gap: 4px; }
.claimlines input { min-height: 32px; padding: 4px 6px; }
.cptin { width: 84px; } .modin { width: 44px; flex: 0 0 auto !important; } .ptrin { width: 64px; } .unitin { width: 52px; }
.modrow { gap: 3px; flex-wrap: nowrap; }
.claimtot { display: flex; gap: 24px; justify-content: flex-end; flex-wrap: wrap; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line-2); }
.dxlist.letters { list-style: none; padding-left: 0; }
.dxletter { display: inline-block; width: 22px; height: 22px; line-height: 22px; text-align: center; background: var(--soft); color: var(--ember-text); border-radius: 4px; font-weight: 600; }
/* CMS-1500 review layout */
.cms { background: #fff; color: #111; border: 2px solid #b33; padding: 10px; font-size: 12px; max-width: 980px; }
.cmshead { display: flex; justify-content: space-between; gap: 16px; border-bottom: 2px solid #b33; padding-bottom: 6px; margin-bottom: 6px; }
.cmscarrier { white-space: pre-wrap; text-align: right; font-family: var(--mono); }
.crow { display: flex; border-bottom: 1px solid #d99; }
.cbox { flex: 1 1 0; border-right: 1px solid #d99; padding: 3px 6px; min-height: 40px; }
.cbox:last-child { border-right: none; }
.cbox.w3 { flex: 3 1 0; } .cbox.w4 { flex: 4 1 0; }
.cnum { font-size: 9.5px; color: #b33; text-transform: uppercase; }
.cval { font-family: var(--mono); white-space: pre-wrap; font-size: 12px; }
.dxgrid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 2px 12px; }
.cmslines { width: 100%; border-collapse: collapse; margin: 4px 0; }
.cmslines th { font-size: 9.5px; color: #b33; font-weight: 500; text-align: left; border-bottom: 1px solid #d99; padding: 2px 4px; }
.cmslines td { border-bottom: 1px solid #eee; padding: 3px 4px; font-family: var(--mono); font-size: 12px; }
@media print { .cms { border-color: #000; max-width: none; } }
.modrow > input.modin { width: 46px; flex: 0 0 46px; }
.row > input.small, .row > select.small { flex: 0 0 auto; width: auto; }
.row > input[maxlength="2"].small { width: 48px; }
.claimlines td { vertical-align: top; }

/* ---------- Lab orders ---------- */
.laborder > * + * { margin-top: 10px; }
.labsub { margin-top: 14px !important; }
.labpicked .list li { padding: 4px 0; }
.dxhit.picked { background: var(--ok-soft); }
.dxhit strong { margin-right: 6px; }
.fastrow { align-self: end; min-height: 38px; }
.dxchecks { display: flex; flex-direction: column; gap: 2px; }
.dxchecks .mono { color: var(--ember-text); }
.pre { white-space: pre-line; }
.req { max-width: 900px; }
.rq-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; border-bottom: 2px solid var(--ink); padding-bottom: 10px; margin-bottom: 12px; }
.rq-title { font-family: var(--serif); font-size: 22px; font-weight: 600; }
.rq-flags { display: flex; gap: 6px; }
.rq-flag { font-family: var(--mono); font-weight: 700; font-size: 14px; border: 2px solid var(--ember); color: var(--ember-text); padding: 2px 8px; border-radius: 4px; }
.rq-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 12px; }
.rq-box { border: 1px solid var(--line); border-radius: 6px; padding: 10px 12px; font-size: 14px; }
.rq-box h3 { font-family: var(--sans); font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin-bottom: 4px; }
.rq-line { display: flex; gap: 8px; font-size: 13.5px; }
.rq-k { color: var(--muted); min-width: 84px; }
.rq-tests { margin: 4px 0 12px; }
.rq-sign { text-align: right; font-size: 13px; display: flex; flex-direction: column; justify-content: flex-end; gap: 18px; }
.resblock { border-top: 1px solid var(--line); padding: 10px 0; }
.resgrid { display: flex; flex-direction: column; gap: 6px; margin: 8px 0; }
.resrow { display: grid; grid-template-columns: minmax(140px, 220px) 120px 1fr; gap: 8px; align-items: center; font-size: 14px; }
.resrow.other { grid-template-columns: minmax(140px, 1fr) 110px 90px 90px 90px; }
@media (max-width: 700px) { .rq-grid { grid-template-columns: 1fr; } .resrow, .resrow.other { grid-template-columns: 1fr 1fr; } }
@media print {
  .req { border: none; padding: 0; max-width: none; }
  .rq-box { border-color: #000; }
  .rq-flag { border-color: #000; color: #000; }
}

/* ---------- AI ---------- */
.consent { align-items: flex-start; max-width: 720px; }
.consent input { margin-top: 3px; }
.draftsec { border-top: 1px solid var(--line); padding: 8px 0; }
.draftsec .note-body { margin-top: 4px; }
.chat { display: flex; flex-direction: column; gap: 8px; margin: 12px 0; }
.bubble { max-width: 85%; padding: 9px 12px; border-radius: 10px; white-space: pre-wrap; font-size: 14.5px; line-height: 1.5; }
.bubble.q { align-self: flex-end; background: var(--ink); color: var(--bone); }
.bubble.a { align-self: flex-start; background: #fff; border: 1px solid var(--line); }
.msglist li { display: block; }
.msglist summary { cursor: pointer; }
.msglist .note-body { margin-top: 8px; }
code { font-family: var(--mono); font-size: 13px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 4px; padding: 1px 5px; }

/* Complete drug list */
.druglist .reg { margin-bottom: 2px; }
.druglist td { vertical-align: top; }
@media print { .druglist table { font-size: 10px; } .druglist tr { break-inside: avoid; } }

/* ---------- Video visit window (provider) ---------- */
.vd-dock { position: fixed; right: 16px; bottom: 16px; z-index: 50; width: 380px; max-width: calc(100vw - 32px); max-height: calc(100vh - 32px);
  display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line-2); border-radius: 12px; box-shadow: 0 12px 40px rgba(19,17,16,.25); overflow: hidden; }
.vd-dock.big { width: 760px; }
.vd-head { display: flex; align-items: center; gap: 8px; padding: 8px 10px; background: var(--ink); color: var(--bone); cursor: default; user-select: none; }
.vd-head strong { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vd-head .btn.link { color: var(--bone); }
.vd-head .spacer, .vd-bar .spacer { flex: 1; }
.vd-body { padding: 10px; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; }
.vd-dock.min .vd-body { display: none; }
.vd-dock.min { width: 320px; }
.vd-stage { position: relative; background: #1d1a17; border-radius: 8px; aspect-ratio: 16 / 10; overflow: hidden; }
.vd-remote { width: 100%; height: 100%; object-fit: contain; background: #1d1a17; }
.vd-self { position: absolute; right: 8px; bottom: 8px; width: 28%; border-radius: 6px; border: 2px solid rgba(255,255,255,.7); background: #000; transform: scaleX(-1); }
.vd-panel:empty { display: none; }
.vd-wait { display: grid; gap: 6px; padding: 10px; border: 1px solid #E5BFB0; background: var(--soft); border-radius: 8px; }
.vd-invite { display: grid; gap: 6px; }
.vd-invite input { font-family: var(--mono); font-size: 12px; }
.vd-details summary { cursor: pointer; font-weight: 500; font-size: 14px; }
.vd-details > * + * { margin-top: 8px; }
.vd-details .row input[type=text] { flex: 1 1 140px; min-height: 30px; padding: 4px 8px; }
.vd-summary { white-space: pre-wrap; background: var(--surface-2); border: 1px dashed var(--line-2); border-radius: 6px; padding: 8px; margin: 0; font-family: var(--sans); }
@media print { .vd-dock { display: none !important; } }
@media (max-width: 700px) { .vd-dock, .vd-dock.big { right: 8px; left: 8px; bottom: 8px; width: auto; } }

/* ---------- Patient video visit page ---------- */
.pt-visit .gate-card { max-width: 460px; }
.pt-visit .gate-card > * + * { margin-top: 14px; }
.pt-visit label.consent { align-items: flex-start; flex-wrap: nowrap; }
.pt-visit label.consent input { margin-top: 4px; flex: 0 0 auto; width: 20px; height: 20px; }
.pt-visit .btn { min-height: 44px; font-size: 16px; }
.pt-visit input, .pt-visit select { font-size: 16px; min-height: 44px; }
.pv-preview { width: 100%; border-radius: 10px; background: #1d1a17; aspect-ratio: 4 / 3; object-fit: cover; transform: scaleX(-1); }
.pv-preview.small { width: 45%; margin: 0 auto; display: block; }
.pv-meter { height: 8px; border-radius: 4px; background: var(--surface-2); border: 1px solid var(--line); overflow: hidden; }
.pv-meter > div { height: 100%; width: 0; background: var(--ok); transition: width .08s; }
.pv-dots { display: flex; gap: 6px; justify-content: center; }
.pv-dots span { width: 9px; height: 9px; border-radius: 50%; background: var(--ember); animation: pvdot 1.2s infinite ease-in-out; }
.pv-dots span:nth-child(2) { animation-delay: .2s; } .pv-dots span:nth-child(3) { animation-delay: .4s; }
@keyframes pvdot { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }
.pv-call { position: fixed; inset: 0; background: #12100e; }
.pv-remote { width: 100%; height: 100%; object-fit: contain; }
.pv-self { position: absolute; top: max(12px, env(safe-area-inset-top)); right: 12px; width: 26vw; max-width: 180px; border-radius: 8px; border: 2px solid rgba(255,255,255,.75); background: #000; transform: scaleX(-1); }
.pv-status { position: absolute; top: 40%; left: 0; right: 0; text-align: center; color: #fff; font-size: 18px; text-shadow: 0 1px 3px #000; padding: 0 20px; }
.pv-status:empty { display: none; }
.pv-bar { position: absolute; left: 0; right: 0; bottom: 0; display: flex; gap: 8px; justify-content: center; flex-wrap: wrap;
  padding: 14px 12px max(14px, env(safe-area-inset-bottom)); background: linear-gradient(transparent, rgba(0,0,0,.7)); }
.pv-btn { min-height: 48px; padding: 0 16px; border-radius: 24px; border: none; background: rgba(255,255,255,.92); color: var(--ink); font-weight: 600; font-size: 15px; }
.pv-btn.off { background: #fff3c4; }
.pv-btn.end { background: var(--ember); color: #fff; }
@media (prefers-reduced-motion: reduce) { .pv-dots span { animation: none; opacity: .7; } }

/* ---------- Forms & documents (staff) ---------- */
.formview th.fv-q { width: 38%; font-weight: 500; color: var(--muted); text-align: left; vertical-align: top; text-transform: none; letter-spacing: 0; font-size: 13px; font-family: var(--sans); }
.docimg { max-width: 100%; max-height: 80vh; display: block; margin-top: 10px; border: 1px solid var(--line); border-radius: 6px; }
details.card > summary { cursor: pointer; display: flex; gap: 10px; align-items: center; }
details.card > summary + * { margin-top: 10px; }

/* ---------- Patient portal ---------- */
.pt-portal .gate { place-items: start center; grid-template-columns: minmax(0, 560px); justify-content: center; }
.pt-portal .gate-card, .pp-upload > *, .pp-form > * { min-width: 0; }
.pp-upload input[type=file] { max-width: 100%; }
.pt-portal .gate-card.wide { max-width: 560px; }
.pt-portal .gate-card > * + * { margin-top: 14px; }
.pt-portal .gate-card h2 { margin-top: 22px; }
.pt-portal .btn { min-height: 44px; font-size: 16px; }
.pt-portal input, .pt-portal select, .pt-portal textarea { font-size: 16px; }
.pt-portal input[type=text], .pt-portal input[type=email], .pt-portal input[type=password], .pt-portal input[type=date], .pt-portal select { min-height: 44px; }
.pt-portal label.f small { display: block; margin-top: 4px; }
.pp-list { display: grid; gap: 8px; }
.pp-item { display: flex; justify-content: space-between; align-items: center; gap: 10px; text-align: left; width: 100%; padding: 14px; border: 1px solid var(--line-2); border-radius: 10px; background: #fff; cursor: pointer; }
.pp-item:hover { background: var(--surface-2); }
.pp-done { padding: 6px 0; border-bottom: 1px solid var(--line); }
.pp-form > * + * { margin-top: 16px; }
.pp-choice { border: none; padding: 0; margin: 0; }
.pp-choice legend { font-size: 14px; font-weight: 500; color: var(--muted); margin-bottom: 6px; padding: 0; }
.pp-choice label.row { padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; margin-bottom: 6px; background: #fff; flex-wrap: nowrap; }
.pp-choice input[type=radio], .pp-choice input[type=checkbox], .pt-portal label.consent input { width: 20px; height: 20px; flex: 0 0 auto; }
.pt-portal label.consent { align-items: flex-start; flex-wrap: nowrap; }
.pp-row { display: grid; grid-template-columns: 1fr 1fr auto; gap: 6px; margin-bottom: 6px; align-items: center; }
@media (max-width: 480px) { .pp-row { grid-template-columns: 1fr; } }
.pp-text { white-space: pre-wrap; background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 12px; line-height: 1.55; max-height: 50vh; overflow-y: auto; }
.pp-notice summary { cursor: pointer; color: var(--ember-text); }
.pp-upload { display: grid; gap: 10px; padding: 12px; border: 1px dashed var(--line-2); border-radius: 10px; }

/* ---------- Photo ID ---------- */
.idpair { display: grid; grid-template-columns: repeat(2, minmax(0, 260px)); gap: 14px; margin: 10px 0; }
.idshot img { width: 100%; max-height: 220px; object-fit: contain; background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; display: block; }
.idempty { height: 140px; display: grid; place-items: center; color: var(--muted); font-size: 13px; background: var(--surface-2); border: 1px dashed var(--line-2); border-radius: 8px; }
.bannerphoto:empty { display: none; }
.bannerphoto img { width: 56px; height: 56px; object-fit: cover; border-radius: 50%; border: 2px solid var(--ok); display: block; }
.bannerphoto img.unverified { border-color: var(--warn); }
.idbadge { font-size: 11px; vertical-align: middle; }
.vd-photo img { width: 30px; height: 30px; object-fit: cover; border-radius: 50%; border: 2px solid rgba(255,255,255,.8); display: block; }
.vd-photo:empty { display: none; }
@media (max-width: 600px) { .idpair { grid-template-columns: 1fr 1fr; } }

/* ---------- Money in: daily close, deposits, reports, receipts ---------- */
.row > .spacer { flex: 1; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin: 14px 0 16px; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; min-width: 0; }
.tile .tl { font-size: 12px; font-weight: 500; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.tile .tv { font-size: 22px; font-weight: 500; margin-top: 2px; }
.tile .ts { font-size: 12px; color: var(--muted); margin-top: 2px; }
.tile.hi { border-color: var(--ember); box-shadow: inset 3px 0 0 var(--ember); }
.good { color: var(--ok); } .bad { color: var(--ember-text); }
.closecheck { margin: 10px 0; display: grid; gap: 4px; font-size: 14px; max-width: 560px; }
.closecheck:empty { display: none; }
.closecheck .total { border-top: 1px solid var(--line); padding-top: 6px; margin-top: 2px; }
table.t td.r, table.t th.r, .r { text-align: right; }
table.report tfoot td { border-top: 2px solid var(--line-2); }
.reportpick { margin-bottom: 12px; }
.dochead { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; border-bottom: 2px solid var(--ink); padding-bottom: 12px; margin-bottom: 16px; }
.docclinic { font-family: var(--serif); font-size: 20px; font-weight: 600; }
.doctitle { text-align: right; }
.receipt, .slip { max-width: 760px; }
.recmeta { margin-bottom: 16px; }
.recamt { font-size: 28px; font-weight: 500; }
.duebox { border: 2px solid var(--ink); border-radius: 8px; padding: 10px 14px; }
.receipt h3 { margin: 12px 0 6px; font-size: 16px; }
.receipt tfoot td, .slipt tfoot td { border-top: 1px solid var(--line); }
tr.grand td { font-weight: 600; border-top: 2px solid var(--ink) !important; }
tr.vhead td { padding-top: 12px; border-top: 1px solid var(--line-2); }
tr.vbal td { font-weight: 600; }
.slipt { max-width: 520px; }
.sigline { margin-top: 36px; }
@media (max-width: 700px) { .doctitle { text-align: left; } .tile .tv { font-size: 19px; } }
@media print {
  .receipt, .slip { max-width: none; }
  .tiles { grid-template-columns: repeat(4, 1fr); }
  .tile { border-color: #999; }
  .dochead { border-color: #000; }
}

/* ---------- Downtime packet ---------- */
.dt-page { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 18px; margin-top: 16px; }
.dt-conf { font-family: var(--mono); font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--ember-text); margin-bottom: 8px; }
.dt-day { margin: 14px 0 6px; font-size: 16px; }
.dt-sched td { vertical-align: top; }
.dt-box { white-space: nowrap; font-size: 16px; }
.dt-tele { font-size: 11px; color: var(--ember-text); font-weight: 600; }
.dt-steps { margin-top: 18px; border: 1px dashed var(--line-2); border-radius: 8px; padding: 10px 14px; font-size: 13px; }
.dt-steps h3 { font-size: 15px; } .dt-steps ol { margin: 6px 0 0; padding-left: 20px; }
.dt-pthead { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; border-bottom: 2px solid var(--ink); padding-bottom: 8px; margin-bottom: 10px; }
.dt-name { font-family: var(--serif); font-size: 22px; font-weight: 600; }
.dt-grid { gap: 8px 20px; }
.dt-sec { margin-bottom: 8px; min-width: 0; }
.dt-sec h4 { margin: 0 0 3px; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.dt-list { margin: 0; padding-left: 16px; font-size: 13px; }
.dt-allergy li { color: var(--ember-text); }
.dt-flag { color: var(--ember-text); font-weight: 700; }
.dt-paper { margin-top: 12px; border-top: 2px solid var(--ink); padding-top: 8px; }
.dt-paper h4 { margin: 0 0 6px; font-size: 13px; }
.dt-vbox { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 13px; margin-bottom: 6px; }
.dt-lines { height: 88px; border-bottom: 1px solid var(--line-2); background: repeating-linear-gradient(to bottom, transparent 0 21px, var(--line) 21px 22px); font-size: 12px; font-weight: 600; margin-bottom: 4px; }
.dt-lines span { background: var(--surface); padding-right: 6px; }
.dt-sign { font-size: 13px; margin-top: 10px; }
@media print {
  .dt-page { border: none; border-radius: 0; padding: 0; margin: 0; break-after: page; }
  .dt-page:last-child { break-after: auto; }
  .dt-lines span { background: #fff; }
  .dt-sched tr, .dt-sec { break-inside: avoid; }
  .dt-packet .grid2 { grid-template-columns: 1fr 1fr; }
}

/* ---------- HMM log charts ---------- */
.chartgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 460px), 1fr)); gap: 12px; margin: 12px 0 16px; }
.chartbox { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; min-width: 0; }
.charttitle { font-weight: 600; font-size: 14px; margin-bottom: 4px; }
.tschart { width: 100%; height: auto; display: block; }
.tschart .cgrid { stroke: var(--line); stroke-width: 1; }
.tschart .ctick { font: 11px var(--sans); fill: var(--muted); }
.tschart .cgoal { stroke-width: 1.5; stroke-dasharray: 5 4; stroke: var(--muted); }
.tschart .cgoaltxt { font-size: 10px; }
.tschart .cband { fill: #2F6B45; opacity: .09; }
.clegend { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12px; color: var(--muted); margin-top: 4px; }
.clegend i { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 5px; vertical-align: -1px; }
.clegend i.bandkey { border-radius: 2px; background: #2F6B45; opacity: .25; }
.alertrow { padding: 6px 0; border-bottom: 1px solid var(--line); gap: 8px; }
.alertrow:last-child { border-bottom: none; }
.alertcard { border-color: var(--ember); margin-bottom: 16px; }
.meter { position: relative; height: 10px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 99px; margin: 8px 0 22px; }
.meter > div { height: 100%; background: var(--ok); border-radius: 99px; }
.meter > span { position: absolute; top: 12px; transform: translateX(-50%); font-size: 11px; color: var(--muted); }
.meter > span::before { content: ''; position: absolute; top: -14px; left: 50%; height: 10px; border-left: 1px solid var(--ink); }
details.card > summary { cursor: pointer; }

/* ---------- Patient portal: HMM log ---------- */
.pp-drnote { background: var(--ok-soft); border: 1px solid #BCD8C4; border-radius: 8px; padding: 10px 12px; font-size: 15px; }
.pp-quick { display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); gap: 8px; }
.pp-qbtn { display: flex; flex-direction: column; align-items: center; gap: 4px; min-height: 76px; justify-content: center; border: 1px solid var(--line-2); background: #fff; border-radius: 10px; font: 500 14px var(--sans); color: var(--ink); cursor: pointer; padding: 8px 4px; }
.pp-qbtn:active { background: var(--soft); }
.pp-qi { font-size: 22px; line-height: 1; color: var(--ember); }
.pp-scale { display: grid; grid-template-columns: repeat(10, minmax(0, 1fr)); gap: 4px; }
.pp-sn { min-height: 44px; border: 1px solid var(--line-2); border-radius: 8px; background: #fff; font: 600 16px var(--sans); cursor: pointer; padding: 0; color: var(--ink); }
.pp-sn.s1, .pp-sn.s2 { background: #F4E1D8; } .pp-sn.s3, .pp-sn.s4 { background: #F7EEDC; } .pp-sn.s5, .pp-sn.s6, .pp-sn.s7 { background: #E1EEE4; } .pp-sn.s8, .pp-sn.s9, .pp-sn.s10 { background: #DCE7F0; }
.pp-sn.on { outline: 3px solid var(--ink); outline-offset: 1px; }
.pp-scaleends { display: flex; justify-content: space-between; margin-bottom: 4px; }
.pp-scalelbl { margin-top: 6px; font-weight: 500; min-height: 22px; }
.pp-seg { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; }
.pp-seg button { min-height: 44px; border: 1px solid var(--line-2); background: #fff; border-radius: 8px; font: 500 14px var(--sans); padding: 0 2px; min-width: 0; cursor: pointer; color: var(--ink); }
.pp-seg button.on { background: var(--ember); border-color: var(--ember); color: #fff; }
.pp-row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.pp-facts { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; margin: 0; }
.pp-facts dt { color: var(--muted); font-size: 14px; } .pp-facts dd { margin: 0; font-weight: 500; }
.pp-entry { display: flex; justify-content: space-between; gap: 8px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.pp-advice { font-size: 17px; line-height: 1.5; }
.pt-portal input[type=number], .pt-portal input[type=datetime-local] { min-height: 44px; }
a.btn { text-decoration: none; }

/* ---------- Registry ---------- */
button.tile.regtile { text-align: left; cursor: pointer; font: inherit; color: inherit; }
button.tile.regtile.on { border-color: var(--ember); box-shadow: inset 3px 0 0 var(--ember); }
.regt td { vertical-align: top; }
.regt .pill { margin: 0 3px 3px 0; }
.duetag { font-size: 12px; color: var(--warn); white-space: nowrap; }
.duetag::before { content: '• '; }
.regchart { max-width: 780px; }

/* ---------- Groups ---------- */
.groster td { vertical-align: top; }
.msg.click { cursor: pointer; margin-bottom: 10px; }
.print-only-cell { display: none; }
@media print { .print-only-cell { display: table-cell; } .groster a { color: #000; text-decoration: none; } }
@media print {
  .groster .sigcell { min-width: 220px; border-bottom: 1px solid #000; }
  .groster tr { break-inside: avoid; }
  .groster td { padding-top: 14px; }
}

/* ---------- Two clocks ---------- */
.clocks { display: grid; gap: 2px; padding: 0 10px 12px; }
.clock { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; color: #CFC6B8; }
.clock strong { color: var(--bone); font-weight: 500; }
.alttime { font-size: 11px; line-height: 1.3; margin-top: 2px; }

/* ---------- Today page and phone layout ---------- */
.phonebar { display: contents; }
.phonebar .phonecur, .phonebar .menubtn { display: none; }
.tclocks { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin-bottom: 14px; }
.tclocks > div { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; }
.tbig { font-size: 26px; font-weight: 500; }
.trow { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); min-height: 48px; }
.trow:last-child { border-bottom: none; }
.trow > span:first-child, .trow .tmain { flex: 1; min-width: 0; }
.trow .ttime { width: 84px; flex: 0 0 auto; font-size: 14px; }
.today .card { padding: 12px 16px; }
@media (max-width: 860px) {
  .side { position: sticky; top: 0; z-index: 30; display: grid; grid-template-columns: 1fr; gap: 2px; padding: 8px 12px; }
  .phonebar { display: flex; align-items: center; gap: 10px; }
  .phonebar .clinic { padding: 0; font-size: 17px; flex: 1; }
  .phonebar .phonecur { display: inline; font-size: 13px; color: #CFC6B8; }
  .phonebar .menubtn { display: inline-block; background: #2A2522; border: 1px solid #3A3431; color: var(--bone); border-radius: 6px; padding: 8px 12px; min-height: 40px; cursor: pointer; }
  .side .navbtn, .side .who, .side .clocks { display: none; }
  .side.open .navbtn { display: block; padding: 12px 10px; }
  .side.open .clocks { display: grid; padding: 6px 10px; }
  .side.open .who { display: block; }
  .main { padding: 14px 12px 40px; }
  .head h1 { font-size: 24px; }
  .tabs { overflow-x: auto; flex-wrap: nowrap; white-space: nowrap; }
}

/* ---------- Portal messages ---------- */
.navcount { display: inline-block; margin-left: 6px; min-width: 20px; padding: 0 6px; border-radius: 99px; background: var(--ember); color: #fff; font-size: 12px; text-align: center; }
.side button.on .navcount { background: #fff; color: var(--ember-text); }
.trow.unread strong { color: var(--ember-text); }
.thread { display: grid; gap: 10px; }
.bubble { max-width: 760px; border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; background: var(--surface-2); }
.bubble.in { border-left: 4px solid var(--ember); }
.bubble.out { margin-left: auto; background: var(--ok-soft); border-color: #BCD8C4; }
.bubble .pill { margin-left: 6px; }
.composer { display: grid; gap: 8px; }
.pp-quick.three { grid-template-columns: repeat(3, minmax(0, 1fr)); margin-top: 8px; }
.pp-seg.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.pp-preview { color: var(--muted); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.pp-item > div { min-width: 0; text-align: left; }
.pp-thread { display: grid; gap: 10px; }
.pp-bubble { border-radius: 12px; padding: 10px 12px; border: 1px solid var(--line); }
.pp-bubble.them { background: #fff; border-left: 4px solid var(--ok); }
.pp-bubble.me { background: var(--surface-2); margin-left: 24px; }

/* ---------- Imaging orders & preventive care ---------- */
.pvacts { white-space: nowrap; }
.pvacts .btn.link { margin-left: 6px; }
.factorgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 6px 18px; margin: 10px 0; }
.factorgrid label { align-items: flex-start; }
.factorgrid input { margin-top: 3px; }
.pvform { border-left: 4px solid var(--ember); }
tr.dim td { opacity: .6; }
@media (max-width: 700px) { .pvacts { white-space: normal; } }

/* Keep Sign out reachable on short screens */
@media (max-height: 760px) and (min-width: 701px) { .side .tag { padding-bottom: 8px; } .side button { padding: 5px 10px; } .clocks { padding-bottom: 6px; } }
@media (min-width: 861px) {
  .side .sidefoot { position: sticky; bottom: -16px; margin: 0 -14px -16px; padding: 6px 14px 12px; background: rgba(19, 17, 16, .96); z-index: 1; }
  .side button.signout:hover { background: #2A2522; }
}

/* ---------- Background painting (Hawaiian sunset) ---------- */
/* The painting fills the window behind everything; working areas sit on
   frosted panels so text stays easy to read. */
body { background: #2B2440 url(/bg-sunset.jpg) center center / cover no-repeat fixed; }
.boot { color: #F4EDE2; }
.side { background: rgba(19, 17, 16, .82); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
/* Work area is clear so the painting shows on every page; cards are solid,
   and text that isn't on a card gets a frosted backing. */
.main { background: transparent; }
.card, .banner { box-shadow: 0 6px 22px rgba(0, 0, 0, .22); }
.card { background: rgba(251, 248, 242, .97); }
.main .head, .main .tabs, .main .tclocks > div,
.main p:not(.card p):not(.banner p):not(.head p):not(.msg p):not(.gate-card p),
.main div.row:not(.card .row):not(.head .row):not(.banner .row):not(.tabs .row):not(.row .row),
.main button.link:not(.card button):not(.head button):not(.tabs button):not(.row button):not(.banner button),
.main .labsub:not(.card .labsub), .main > div > div > h2 {
  background: rgba(247, 243, 235, .9); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  border-radius: 10px; box-shadow: 0 4px 16px rgba(0, 0, 0, .18); }
.main .head { padding: 12px 16px; }
.main .tabs { padding: 4px 8px 0; border-bottom: none; }
.main p:not(.card p):not(.banner p):not(.head p):not(.msg p):not(.gate-card p), .main .labsub:not(.card .labsub), .main > div > div > h2 { padding: 8px 12px; width: fit-content; max-width: 100%; }
.main div.row:not(.card .row):not(.head .row):not(.banner .row):not(.tabs .row):not(.row .row) { padding: 8px 10px; width: fit-content; max-width: 100%; }
.main button.link:not(.card button):not(.head button):not(.tabs button):not(.row button):not(.banner button) { padding: 6px 12px; margin-bottom: 8px; }
.gate-card { box-shadow: 0 12px 40px rgba(0, 0, 0, .35); }

@media (max-width: 860px) {
  /* Phones: fixed backgrounds are unreliable on iOS; use the smaller image. */
  body { background: #2B2440; }
  body::before { content: ''; position: fixed; inset: 0; z-index: -1; background: url(/bg-sunset-sm.jpg) 40% center / cover no-repeat; }

}
@media print {
  body { background: #fff !important; } body::before { display: none; }
  .main { background: #fff; }
  .card, .banner, .main .head, .main .tabs, .main p, .main div.row { box-shadow: none !important; background: #fff !important; -webkit-backdrop-filter: none !important; backdrop-filter: none !important; }
}
.linkish { text-align: left; }

/* Link out to Google Gemini (general questions only) */
.side a.navext { display: block; text-decoration: none; color: var(--bone); padding: 6px 10px; border-radius: 6px; margin-top: 4px; border: 1px dashed #5A534A; }
.side a.navext:hover { background: #2A2522; }
.side a.navext .navnote { display: block; font-size: 11px; color: #E7A58F; margin-top: 1px; }
@media (max-width: 860px) { .side a.navext { display: none; margin-top: 0; } .side.open a.navext { display: block; padding: 12px 10px; } }

/* ---------- Prescriptions ---------- */
.pill.sched { background: #3B2A5C; border-color: #3B2A5C; color: #fff; font-weight: 600; letter-spacing: .02em; }
.rxctrl label { margin-top: 6px; font-weight: 600; }
.rxopts { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; margin: 10px 0; }
.phpick { display: flex; flex-direction: column; gap: 6px; }
.rxoverlay { position: fixed; inset: 0; z-index: 60; background: rgba(20, 20, 20, .55); overflow: auto; padding: 24px 12px; }
.rxbar { max-width: 720px; margin: 0 auto 10px; background: var(--surface); border-radius: 10px; padding: 10px 14px; }
.rxpad { max-width: 720px; margin: 0 auto; background: #fff; color: #111; border: 2px solid #111; border-radius: 6px; padding: 22px 26px; font-size: 14px; line-height: 1.45; }
.rxhead { display: flex; justify-content: space-between; gap: 16px; border-bottom: 2px solid #111; padding-bottom: 10px; }
.rxdoc { font-size: 19px; font-weight: 700; }
.rxids { min-width: 230px; }
.rxf { display: flex; gap: 6px; align-items: baseline; margin: 3px 0; }
.rxl { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: #555; min-width: 64px; }
.rxv { flex: 1; border-bottom: 1px solid #999; min-height: 18px; }
.rxblank { min-width: 150px; }
.rxpt { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 4px 16px; padding: 10px 0; border-bottom: 1px solid #bbb; }
.rxpt .span3 { grid-column: span 2; }
.rxbody { display: flex; gap: 14px; padding: 14px 0 8px; min-height: 170px; }
.rxsym { font-size: 44px; line-height: 1; font-family: Georgia, serif; }
.rxdrug { font-size: 18px; font-weight: 700; margin-bottom: 6px; }
.rxsched { border: 2px solid #111; border-radius: 4px; padding: 0 6px; font-size: 14px; margin-left: 6px; }
.rxline { margin: 3px 0; }
.rxbox { margin-right: 18px; }
.rxph { border-top: 1px solid #bbb; padding: 8px 0; }
.rxsign { margin-top: 26px; width: 60%; margin-left: auto; text-align: center; }
.rxsigline { border-bottom: 1px solid #111; height: 34px; }
.rxfoot { margin-top: 14px; border-top: 1px dashed #999; padding-top: 6px; color: #444; }
.rxfoot > div { margin-top: 2px; }
@media (max-width: 640px) { .rxhead { flex-direction: column; } .rxpt { grid-template-columns: 1fr; } .rxpt .span3 { grid-column: auto; } .rxpad { padding: 14px; } }
@media print {
  body.printing-rx > *:not(.rxoverlay) { display: none !important; }
  body.printing-rx { background: #fff !important; }
  body.printing-rx::before { display: none !important; }
  .rxoverlay { position: static; background: none; padding: 0; overflow: visible; }
  .rxpad { max-width: none; border-width: 2px; }
}
.nowrap { white-space: nowrap; }

/* ---------- AI rewrite review ---------- */
.polishrow { border-top: 1px solid var(--line); padding: 10px 0; }
.polishcols { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 6px; }
.polishold { background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; white-space: pre-wrap; max-height: 420px; overflow: auto; font-size: 14px; }
.polishcols textarea.tall { min-height: 240px; }
@media (max-width: 760px) { .polishcols { grid-template-columns: 1fr; } }

/* ---------- Form 1500 (02-12) ---------- */
.c15wrap { overflow-x: auto; }
.c15page { position: relative; width: 8.5in; height: 11in; background: #fff; color: #000; margin: 0 auto 18px; box-shadow: 0 1px 6px rgba(0,0,0,.25); overflow: hidden; font-family: Arial, Helvetica, sans-serif; }
.c15page > div { position: absolute; }
.c15box { border: 0.6pt solid #d0262f; box-sizing: border-box; }
.c15box.thick { border-width: 1.2pt; }
.c15lbl { color: #d0262f; font-size: 5.4pt; line-height: 1.12; white-space: pre-wrap; letter-spacing: .01em; }
.c15lbl b { font-weight: 700; }
.c15lbl.c15small { font-size: 5.2pt; }
.c15lbl.c15hd { font-size: 5.2pt; line-height: 1.1; }
.c15lbl.pica { font-weight: 700; font-size: 6pt; }
.c15cb { border: 0.7pt solid #d0262f; background: #fff; }
.c15shade { background: repeating-linear-gradient(0deg, rgba(208,38,47,.10) 0 2px, rgba(208,38,47,.04) 2px 4px); }
.c15rowno { color: #d0262f; font-size: 9pt; font-weight: 700; }
.c15txt { font-family: 'Courier New', Courier, monospace; font-size: 12pt; line-height: 1; letter-spacing: 0; white-space: pre; color: #000; }
.c15title { color: #d0262f; font-size: 15pt; font-weight: 800; letter-spacing: .02em; }
.c15sub { color: #d0262f; font-size: 6.5pt; }
.c15carrier { color: #d0262f; font-size: 6pt; font-weight: 700; writing-mode: vertical-rl; transform: rotate(180deg); text-align: center; border-left: 0.6pt solid #d0262f; }
.c15qr { border: 0.6pt dashed rgba(208,38,47,.35); }
.c15foot { color: #d0262f; font-size: 6.5pt; }
.c15foot.b { font-weight: 700; }
.c15data { box-shadow: 0 0 0 1px #ccc; }
@media print {
  @page c15 { size: letter; margin: 0; }
  .c15page { page: c15; margin: 0; height: 10.9in; box-shadow: none !important; break-after: page; }
  body:has(.c15page) .main, body:has(.c15page) .shell { padding: 0 !important; margin: 0 !important; }
  .c15page:last-child { break-after: auto; }
  .c15wrap { overflow: visible; }
  .c15data { box-shadow: none !important; }
}
.c15div { border-left: 0.8pt dotted #d0262f; }
.c15lbl.c15hd { font-size: 4.8pt; }

/* ---------- Printed visit note letterhead (Oct 2026) ---------- */
.kl-print { margin: 0 0 14px; }
.kl-ph { position: relative; display: grid; grid-template-columns: auto 1fr; column-gap: 28px; align-items: end; padding: 4px 2px 96px; color: #131110; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.kl-ph::after { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 84px; border-radius: 4px; background: url('bg-sunset.jpg') center 58% / cover no-repeat; box-shadow: inset 0 0 0 1px rgba(19,17,16,.15); -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.kl-ph-name { grid-column: 1; font-family: 'Fraunces', Georgia, serif; font-size: 26pt; font-weight: 600; letter-spacing: -0.01em; line-height: 1; white-space: nowrap; }
.kl-ph-tag { grid-column: 1; font-family: 'Work Sans', system-ui, sans-serif; font-size: 7.5pt; text-transform: uppercase; letter-spacing: .22em; color: #131110; margin-top: 6px; padding-bottom: 10px; }
.kl-ph-info { grid-column: 2; grid-row: 1 / span 2; text-align: right; font-family: 'Work Sans', system-ui, sans-serif; font-size: 8.5pt; line-height: 1.5; color: #131110; padding-bottom: 10px; }
.kl-ph-web { color: #131110; font-weight: 600; }
.kl-pt { display: grid; grid-template-columns: 1.4fr 1fr 0.9fr 1.5fr 1.3fr; gap: 10px; padding: 10px 2px 12px; border-bottom: 2px solid #B0452A;
  margin-bottom: 6px; font-family: 'Work Sans', system-ui, sans-serif; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.kl-pt span { display: block; font-size: 7pt; text-transform: uppercase; letter-spacing: .1em; color: #5A534A; }
.kl-pt strong { font-size: 9.5pt; color: #131110; }
@media print {
  .note-sec h3 { color: #9E3C21; border-bottom: 1px solid #D8CFBF; padding-bottom: 2px; margin-top: 14px; font-family: 'Fraunces', Georgia, serif; break-after: avoid;
    -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .note-body { font-size: 10pt; line-height: 1.45; }
  .note-body strong { color: #131110; }
}

/* Printed note: hide the on-screen title bar; signer info is in the page footer. */
@media print { body:has(.kl-ph) .main .head { display: none !important; } }

/* Clinical AI menu (Oct 2026) */
.kl-ai { position: relative; }
.kl-ai > summary { list-style: none; cursor: pointer; }
.kl-ai > summary::-webkit-details-marker { display: none; }
.kl-ai-note { display: inline-block; }
.kl-ai-list { display: flex; flex-direction: column; gap: 2px; padding: 6px; margin-top: 4px; background: #FBF8F2; border: 1px solid #D8CFBF; border-radius: 6px; box-shadow: 0 6px 18px rgba(19,17,16,.14); }
.kl-ai-note .kl-ai-list { position: absolute; left: 0; top: 100%; z-index: 30; min-width: 210px; }
.kl-ai-list a { color: #131110; text-decoration: none; padding: 7px 10px; border-radius: 4px; font-size: 14px; }
.kl-ai-list a:hover, .kl-ai-list a:focus { background: #EFE9DD; color: #9E3C21; }
@media print { .kl-ai { display: none !important; } }
