/* Rolvina — one stylesheet, no build step. Tokens at :root; dark via the device
   (prefers-color-scheme) unless the person chose a theme (data-theme on <html>). */
:root {
  --bg: #f4f6f5;
  --surface: #ffffff;
  --sunken: #eceff0;
  --hover: #e6ebe9;
  --text: #1b2120;
  --muted: #5d6865;
  --faint: #7a8582;
  --line: #d8dedb;
  --line-strong: #c2cac7;
  --accent: #1f6f5c;
  --accent-text: #ffffff;
  --accent-soft: #e2f0ea;
  --danger: #b03a2e;
  --warn: #a8620b;
  --warn-soft: #fcf0dc;
  --crit-soft: #fbe6e3;
  --notice-bg: #e4f2ec;
  --error-bg: #fbe7e5;
  --demo: #8a5a00;
  --radius: 8px;
  --radius-sm: 5px;
  --shadow: 0 1px 2px rgba(20, 30, 28, .06), 0 2px 8px rgba(20, 30, 28, .06);
  --shadow-lg: 0 12px 32px rgba(20, 30, 28, .18);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121615; --surface: #1a201f; --sunken: #0e1211; --hover: #242b2a; --text: #e4ebe8; --muted: #9aa6a2; --faint: #84908c;
    --line: #2b3432; --line-strong: #3a4542; --accent: #4fb89b; --accent-text: #0b1210; --accent-soft: #19302a;
    --danger: #f07a70; --warn: #e0a63a; --warn-soft: #2e2413; --crit-soft: #331b19; --notice-bg: #183129; --error-bg: #3a1c1a;
    --demo: #f0b44c; --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 2px 8px rgba(0, 0, 0, .3); --shadow-lg: 0 12px 32px rgba(0, 0, 0, .55);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #121615; --surface: #1a201f; --sunken: #0e1211; --hover: #242b2a; --text: #e4ebe8; --muted: #9aa6a2; --faint: #84908c;
  --line: #2b3432; --line-strong: #3a4542; --accent: #4fb89b; --accent-text: #0b1210; --accent-soft: #19302a;
  --danger: #f07a70; --warn: #e0a63a; --warn-soft: #2e2413; --crit-soft: #331b19; --notice-bg: #183129; --error-bg: #3a1c1a;
  --demo: #f0b44c; --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 2px 8px rgba(0, 0, 0, .3); --shadow-lg: 0 12px 32px rgba(0, 0, 0, .55);
  color-scheme: dark;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.45 var(--font); }
a { color: var(--accent); }
h1 { font-size: 1.4rem; margin: 0 0 .9rem; letter-spacing: -.01em; }
h2 { font-size: 1.02rem; margin: 0 0 .7rem; }
h3 { font-size: .95rem; margin: .2rem 0 .5rem; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .9em; }

/* ---- title bar ---- */
.titlebar {
  position: sticky; top: 0; z-index: 30; height: 48px;
  display: grid; grid-template-columns: minmax(220px, auto) minmax(160px, 1fr) auto; align-items: center; gap: 12px;
  padding: 0 12px; background: var(--surface); border-bottom: 1px solid var(--line);
}
.titlebar-left, .titlebar-right { display: flex; align-items: center; gap: 6px; }
.titlebar-right { justify-content: flex-end; }
.titlebar-center { display: flex; justify-content: center; }
.brand { display: flex; align-items: center; gap: .45rem; font-weight: 700; color: var(--text); text-decoration: none; }
.brand-name { letter-spacing: .2px; }
.clinic-chip { margin-left: .4rem; padding: .15rem .6rem; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); font-size: .85rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 22rem; }
.titlebar form.search { margin: 0; width: min(460px, 100%); }
.titlebar form.search input { width: 100%; padding: .38rem .8rem; border-radius: 999px; background: var(--bg); border-color: var(--line-strong); }
.titlebar form.search input:focus { box-shadow: 0 0 0 3px var(--accent-soft); outline: none; border-color: var(--accent); }
.icon-btn { width: 32px; height: 32px; padding: 0; display: grid; place-items: center; border: 1px solid transparent; background: transparent;
  border-radius: var(--radius-sm); color: var(--muted); font-size: 16px; }
.icon-btn:hover { background: var(--hover); color: var(--text); }
.btn-ghost { padding: .35rem .65rem; border-radius: var(--radius-sm); color: var(--muted); text-decoration: none; font-size: .9rem; white-space: nowrap; }
.btn-ghost:hover { background: var(--hover); color: var(--text); }
.tag { font-size: .68rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em;
  padding: .1rem .4rem; border: 1px solid var(--line); border-radius: 4px; color: var(--muted); }
.tag.demo { color: var(--demo); border-color: var(--demo); }
.tag.operator { color: var(--warn); border-color: var(--warn); }

/* ---- the round avatar and its menu ---- */
.avatar { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; overflow: hidden;
  background: var(--accent); color: var(--accent-text); font-size: 12px; font-weight: 700; border: 1px solid var(--line-strong); }
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar.large { width: 72px; height: 72px; font-size: 24px; }
.user-menu { position: relative; }
.user-menu > summary { list-style: none; cursor: pointer; margin: 0; }
.user-menu > summary::-webkit-details-marker { display: none; }
.user-menu[open] > summary { box-shadow: 0 0 0 3px var(--accent-soft); }
.dropdown { position: absolute; right: 0; top: 42px; min-width: 240px; padding: 6px; z-index: 50;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-lg); }
.dropdown-head { display: flex; gap: .7rem; align-items: center; padding: 8px 10px 10px; border-bottom: 1px solid var(--line); margin-bottom: 5px; }
.dropdown-avatar { width: 40px; height: 40px; font-size: 14px; flex: 0 0 40px; }
.dropdown-name { font-weight: 600; }
.dropdown-sub { font-size: .78rem; color: var(--muted); }
.dropdown form { margin: 0; }
.dropdown-item { display: block; width: 100%; text-align: left; padding: 7px 10px; border: 0; border-radius: var(--radius-sm);
  background: transparent; color: var(--text); text-decoration: none; font-size: .92rem; cursor: pointer; }
.dropdown-item:hover { background: var(--hover); }
.dropdown-item.danger { color: var(--danger); }
.dropdown-sep { height: 1px; background: var(--line); margin: 5px 0; }

/* ---- shell: navigator + work area ---- */
.shell { display: flex; align-items: flex-start; min-height: calc(100vh - 48px); }
.sidebar { position: sticky; top: 48px; flex: 0 0 272px; height: calc(100vh - 48px); overflow-y: auto;
  background: var(--surface); border-right: 1px solid var(--line); padding: 6px 6px 24px; }
.sidebar-head { display: flex; justify-content: space-between; align-items: baseline; padding-right: 8px; }
.sidebar-head .hint { font-size: .72rem; }
.sidebar-section { display: block; padding: 10px 8px 4px; font-size: .68rem; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; color: var(--faint); }
.goto { display: flex; flex-direction: column; }
.goto a { padding: 5px 10px; border-radius: var(--radius-sm); color: var(--text); text-decoration: none; }
.goto a:hover { background: var(--hover); }
.goto-more > summary { list-style: none; cursor: pointer; margin: 0; }
.goto-more > summary::-webkit-details-marker { display: none; }
.goto-more > summary::after { content: " ▸"; }
.goto-more[open] > summary::after { content: " ▾"; }
.work { flex: 1; min-width: 0; max-width: 1180px; margin: 0 auto; padding: 1.25rem 20px 3rem; }
main { display: block; }

.tree { padding: 2px 0 6px; }
.tfolder > summary { list-style: none; }
.tfolder > summary::-webkit-details-marker { display: none; }
.trow { display: flex; align-items: center; gap: 6px; min-height: 30px; padding: 0 8px 0 10px; border-radius: var(--radius-sm);
  color: var(--text); text-decoration: none; cursor: pointer; }
.trow:hover { background: var(--hover); }
.trow.selected { background: var(--accent-soft); font-weight: 600; }
.trow.folder { font-weight: 700; }
.trow.folder::before { content: "▸"; font-size: 11px; color: var(--faint); width: 12px; }
.tfolder[open] > .trow.folder::before { content: "▾"; }
.tfolder > a.trow { padding-left: 26px; }
.tlabel { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tcount { flex: 0 0 auto; min-width: 22px; height: 18px; padding: 0 6px; border-radius: 9px; font-size: 11px; line-height: 18px;
  text-align: center; font-variant-numeric: tabular-nums; color: var(--muted); background: var(--sunken); }
.tcount.badge { background: var(--accent); color: var(--accent-text); font-weight: 600; }
.tcount.warn { background: var(--warn-soft); color: var(--warn); font-weight: 600; }
.tcount.crit { background: var(--crit-soft); color: var(--danger); font-weight: 700; }
.tcount.zero { background: transparent; color: var(--faint); }
.tcount.err { background: var(--crit-soft); color: var(--danger); }

@media (max-width: 860px) {
  .titlebar { grid-template-columns: auto 1fr auto; height: auto; padding: 6px 10px; }
  .titlebar-center { grid-column: 1 / -1; order: 3; padding-bottom: 6px; }
  .clinic-chip, .btn-ghost { display: none; }
  .shell { display: block; }
  .sidebar { position: static; height: auto; width: auto; border-right: 0; border-bottom: 1px solid var(--line); }
}

/* ---- the scoreboard ---- */
.score-group { margin: 0 0 1.4rem; }
.score-group h2 { font-size: .75rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 0 0 .5rem; }
.score-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: .75rem; }
.score-tile { display: flex; flex-direction: column; gap: .15rem; padding: .9rem 1rem; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow); color: var(--text); text-decoration: none; border-top: 4px solid var(--line); }
.score-tile:hover { border-color: var(--accent); }
.score-num { font-size: 2rem; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }
.score-label { color: var(--muted); font-size: .9rem; }
.score-tile.badge { border-top-color: var(--accent); }
.score-tile.badge .score-num { color: var(--accent); }
.score-tile.warn { border-top-color: var(--warn); }
.score-tile.warn .score-num { color: var(--warn); }
.score-tile.crit { border-top-color: var(--danger); background: var(--crit-soft); }
.score-tile.crit .score-num { color: var(--danger); }
.score-tile.zero .score-num { color: var(--faint); }
.scoreboard-foot { margin-top: 1rem; }
.count-pill { font-size: .8rem; vertical-align: middle; padding: .1rem .55rem; border-radius: 999px; background: var(--sunken); color: var(--muted); }
.me-avatar { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.navtpl { border-top: 1px solid var(--line); padding: .8rem 0; }
.navtpl-folders { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: .5rem 1rem; font-size: .88rem; }
.navtpl-folders ul { margin: .2rem 0 0; padding-left: 1.1rem; color: var(--muted); }
.navpick { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: .5rem 1rem; margin-top: .6rem; }
.navpick fieldset { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: .4rem .7rem; }
.navpick legend { font-size: .75rem; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.grid-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: .8rem; align-items: end; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 1.1rem 1.2rem; margin: 1rem 0; }
.card.narrow { max-width: 440px; margin: 2rem auto; }
.hint { color: var(--muted); font-size: .88rem; }
.notice, .error { padding: .6rem .9rem; border-radius: var(--radius); }
.notice { background: var(--notice-bg); }
.error { background: var(--error-bg); color: var(--danger); }
.credential { border-color: var(--accent); }
.secret code { font-size: 1.25rem; letter-spacing: .05em; user-select: all; }

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 1rem; }
.tile { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 1rem; color: var(--muted); text-decoration: none; }
.tile .num { font-size: 2rem; font-weight: 700; color: var(--text); }
.tile .num.small { font-size: 1.1rem; padding: .6rem 0; }

table { width: 100%; border-collapse: collapse; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; display: block; overflow-x: auto; }
thead, tbody { display: table; width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: .55rem .75rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); background: var(--sunken); }
tbody tr:hover td { background: var(--hover); }
table.dense td { padding: .35rem .6rem; font-size: .88rem; }
tr.muted td { color: var(--muted); }

form.stack { display: flex; flex-direction: column; gap: .9rem; }
form.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: .9rem; align-items: end; }
form.inline { display: inline-flex; flex-wrap: wrap; gap: .4rem; align-items: center; margin: 0; }
label { display: flex; flex-direction: column; gap: .3rem; font-weight: 500; }
input, select { font: inherit; padding: .42rem .6rem; border: 1px solid var(--line-strong); border-radius: 6px;
  background: var(--bg); color: var(--text); min-width: 0; }
input:focus, select:focus, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.with-suffix { display: flex; align-items: center; gap: .3rem; }
.with-suffix input { flex: 1; }
.with-suffix span { color: var(--muted); font-weight: 400; }
button { font: inherit; padding: .4rem .85rem; border-radius: 6px; border: 1px solid var(--line-strong);
  background: var(--surface); color: var(--text); cursor: pointer; }
button:hover { background: var(--hover); }
button.primary:hover { filter: brightness(1.08); background: var(--accent); }
button.primary { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
button.danger { color: var(--danger); border-color: var(--danger); background: transparent; }
button.link { border: 0; padding: 0; background: none; color: var(--accent); text-decoration: underline; }
details summary { cursor: pointer; color: var(--muted); margin-top: .4rem; }

/* ---- Phase 2 pieces ---- */
.head-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.head-row h1, .head-row h2 { margin-bottom: .5rem; }
a.button { display: inline-block; padding: .45rem .9rem; border-radius: 6px; border: 1px solid var(--line);
  background: var(--surface); color: var(--text); text-decoration: none; }
a.button.primary { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
.searchbar { display: flex; gap: .5rem; margin: 0 0 1.25rem; }
.searchbar input { flex: 1; font-size: 1.05rem; }
.alert { background: var(--error-bg); color: var(--danger); padding: .5rem .8rem; border-radius: var(--radius);
  border-left: 4px solid var(--danger); margin: .5rem 0; }
.alert.soft { background: transparent; }
.flag { display: inline-block; min-width: 1.2em; text-align: center; border-radius: 50%; background: var(--danger);
  color: #fff; font-weight: 700; font-size: .8rem; cursor: help; }
.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 0 1.25rem; }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: .3rem 1rem; margin: 0; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; }
.list { list-style: none; padding: 0; margin: 0 0 .75rem; }
.list li { padding: .4rem 0; border-bottom: 1px solid var(--line); }
.list li.muted { color: var(--muted); }
.signalment { font-size: 1.05rem; margin: -.5rem 0 .75rem; }
.notes { white-space: pre-wrap; color: var(--muted); }
form.grid .wide, .wide { grid-column: 1 / -1; }
label.check { flex-direction: row; align-items: center; gap: .5rem; font-weight: 400; }
.actions { display: flex; gap: 1rem; align-items: center; }
details.row-actions { display: inline-block; margin-left: .5rem; }
details.row-actions summary { font-size: .85rem; }
textarea { font: inherit; padding: .5rem .6rem; border: 1px solid var(--line); border-radius: 6px;
  background: var(--bg); color: var(--text); width: 100%; }

/* ---- appointment book ---- */
.grid-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
table.book { display: table; border: 0; border-radius: 0; table-layout: fixed; min-width: 100%; }
table.book thead, table.book tbody { display: table-header-group; }
table.book tbody { display: table-row-group; }
table.book th { position: sticky; top: 0; background: var(--surface); z-index: 1; min-width: 160px; }
table.book th.time { width: 76px; min-width: 76px; font-weight: 400; font-size: .75rem; text-transform: none;
  letter-spacing: 0; vertical-align: top; color: var(--muted); position: static; }
table.book td.slot { height: 1.6rem; padding: 0 .25rem; border-left: 1px solid var(--line); border-bottom: 1px dashed var(--line); }
table.book td.filled { padding: 2px; vertical-align: top; }
a.book-here { display: block; height: 100%; color: transparent; text-decoration: none; }
a.book-here:hover, a.book-here:focus { color: var(--accent); background: var(--notice-bg); text-align: center; }
a.appt { display: flex; flex-direction: column; gap: .05rem; height: 100%; min-height: 1.5rem; padding: .25rem .4rem;
  border-radius: 6px; border-left: 5px solid; text-decoration: none; color: var(--text); font-size: .8rem;
  background: var(--notice-bg); overflow: hidden; }
a.appt + a.appt { margin-top: 2px; }
a.appt .who { color: var(--muted); }
a.appt .state { font-weight: 600; }
a.appt.over { outline: 2px dashed var(--danger); }
a.appt.s-completed { opacity: .55; }
a.appt.s-checked_in, a.appt.s-in_room, a.appt.s-ready { box-shadow: inset 0 0 0 2px var(--accent); }
.c-teal { border-color: #14857a; } .c-blue { border-color: #2f6fd6; } .c-green { border-color: #3c9a3c; }
.c-orange { border-color: #d9822b; } .c-red { border-color: #c63a3a; } .c-pink { border-color: #cc4f9a; }
.c-purple { border-color: #7a52c7; } .c-gray { border-color: #8a8f8d; } .c-slate { border-color: #4a5a70; }
.dot { display: inline-block; width: .8rem; height: .8rem; border-radius: 50%; border: 5px solid; vertical-align: middle; }
.stack-actions { display: flex; flex-direction: column; gap: .6rem; align-items: flex-start; }

/* ---- visit record ---- */
.banner { margin-bottom: 1rem; }
.banner h1 { margin-bottom: .25rem; }
.visit-head { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .5rem 1rem; }
.visit-head p { margin: 0; }
.note { border: 1px solid var(--line); border-radius: var(--radius); padding: .75rem 1rem; margin: .75rem 0; }
.note-head { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: .5rem; color: var(--muted); }
.tag.signed { color: var(--accent); border-color: var(--accent); }
.tag.draft { color: var(--demo); border-color: var(--demo); }
.tag.failed { color: var(--danger); border-color: var(--danger); }
textarea.mono { font: .8rem ui-monospace, Menlo, monospace; word-break: break-all; }
.soap-view { display: grid; grid-template-columns: max-content 1fr; gap: .4rem 1rem; margin: 0 0 .5rem; }
.soap-view dt { font-weight: 600; color: var(--muted); }
.soap-view dd { margin: 0; }
.addendum { border-left: 3px solid var(--line); padding-left: .75rem; margin: .5rem 0; }
.addendum p { margin: .2rem 0; }
form.vitals-form { grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); }

/* ---- billing ---- */
th.num, td.num { text-align: right; white-space: nowrap; }
tfoot td { border-bottom: 0; }
tfoot tr.total td { font-weight: 700; border-top: 2px solid var(--line); }
.inv-head { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.owes { color: var(--danger); }
.charge-form select { max-width: 28rem; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
details.card > summary { font-weight: 600; }
/* ---- board ---- */
.board { display: grid; grid-template-columns: repeat(5, minmax(200px, 1fr)); gap: .75rem; overflow-x: auto; }
.board-col { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .5rem; min-height: 8rem; }
.board-col h2 { font-size: .95rem; margin: .25rem .25rem .5rem; }
.board-card { border: 1px solid var(--line); border-left: 5px solid; border-radius: 6px; padding: .4rem .5rem; margin-bottom: .5rem; background: var(--bg); font-size: .88rem; }
.board-card header { display: flex; gap: .4rem; align-items: baseline; flex-wrap: wrap; }
.board-card p { margin: .2rem 0; }
.board-card .waited { color: var(--demo); font-weight: 600; }
.card-actions { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; margin-top: .3rem; }
.card-actions button { padding: .2rem .5rem; font-size: .85rem; }
.col-completed .board-card { opacity: .6; }
.live { font-size: .8rem; color: var(--accent); vertical-align: middle; }

/* ---- demo tour ---- */
.tour { border-color: var(--accent); }
.tour-steps { margin: 0 0 1rem; padding-left: 1.4rem; display: grid; gap: .45rem; }
.tour-steps li.done a { color: var(--muted); text-decoration: line-through; }

/* ---- public pages ---- */
.apex h1 { display: flex; align-items: center; gap: .5rem; font-size: 2rem; }
.big { font-size: 1.15rem; }
.center { text-align: center; }
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.spinner { width: 2.5rem; height: 2.5rem; margin: 1rem auto; border-radius: 50%;
  border: 4px solid var(--line); border-top-color: var(--accent); animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation: none; } }

@media print {
  .titlebar, .sidebar, form, details, .button, .notice, .error { display: none !important; }
  .work { max-width: none; padding: 0; }
  body { background: #fff; color: #000; }
  .card { border: 0; padding: 0; }
  .card:not(.printable) { display: none; }
}


/* Pharmacy */
fieldset.witness { border: 1px solid var(--line); border-radius: 6px; padding: .5rem .75rem; display: flex; gap: .75rem; flex-wrap: wrap; }
.rx-label { width: 2.25in; height: 1.25in; box-sizing: border-box; padding: .06in .08in; border: 1px dashed var(--line); background: #fff; color: #000;
  font: 7pt/1.2 -apple-system, "Helvetica Neue", Arial, sans-serif; overflow: hidden; }
.rx-label p { margin: 0 0 .02in; }
.rx-label .rx-dir { font-weight: 600; }
/* Label stock (clinic.Label): one named page per size, since @page cannot be set per element otherwise. */
.rx-label.l-zebra-2_25x1_25 { width: 2.25in; height: 1.25in; font-size: 7.0pt; }
@page l-zebra-2_25x1_25 { size: 2.25in 1.25in; margin: 0; }
@media print { .rx-label.l-zebra-2_25x1_25 { page: l-zebra-2_25x1_25; } }
.rx-label.l-zebra-3x2 { width: 3in; height: 2in; font-size: 11.2pt; }
@page l-zebra-3x2 { size: 3in 2in; margin: 0; }
@media print { .rx-label.l-zebra-3x2 { page: l-zebra-3x2; } }
.rx-label.l-zebra-3x1 { width: 3in; height: 1in; font-size: 5.6pt; }
@page l-zebra-3x1 { size: 3in 1in; margin: 0; }
@media print { .rx-label.l-zebra-3x1 { page: l-zebra-3x1; } }
.rx-label.l-zebra-2x1 { width: 2in; height: 1in; font-size: 5.6pt; }
@page l-zebra-2x1 { size: 2in 1in; margin: 0; }
@media print { .rx-label.l-zebra-2x1 { page: l-zebra-2x1; } }
.rx-label.l-zebra-4x2 { width: 4in; height: 2in; font-size: 11.2pt; }
@page l-zebra-4x2 { size: 4in 2in; margin: 0; }
@media print { .rx-label.l-zebra-4x2 { page: l-zebra-4x2; } }
.rx-label.l-dymo-30252 { width: 3.5in; height: 1.125in; font-size: 6.3pt; }
@page l-dymo-30252 { size: 3.5in 1.125in; margin: 0; }
@media print { .rx-label.l-dymo-30252 { page: l-dymo-30252; } }
.rx-label.l-brother-dk1202 { width: 3.9in; height: 2.4in; font-size: 12.6pt; }
@page l-brother-dk1202 { size: 3.9in 2.4in; margin: 0; }
@media print { .rx-label.l-brother-dk1202 { page: l-brother-dk1202; } }
.rx-label .rx-drug, .rx-label .rx-dir { font-size: 1.15em; }
.rx-label .rx-foot { font-size: .8em; }
@media print {
  .no-print { display: none !important; }
  .rx-label { border: 0; }
}
.certificate .signature { margin-top: 2rem; }

/* Hospital */
.ward { display: grid; grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); gap: .75rem; }
.ward-card { display: flex; flex-direction: column; gap: .2rem; padding: .75rem; border: 1px solid var(--line); border-radius: 8px; color: inherit; text-decoration: none; background: var(--card, transparent); }
.ward-card.late { border-color: #c0392b; box-shadow: inset 4px 0 0 #c0392b; }
.ward-run { font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; opacity: .7; }
.alert-text { color: #b03a2e; }
.sheet-wrap { overflow-x: auto; }
.sheet { border-collapse: collapse; font-size: .8rem; }
.sheet th, .sheet td { border: 1px solid var(--line); padding: .15rem .25rem; text-align: center; min-width: 1.4rem; }
.sheet th[scope=row] { text-align: left; min-width: 14rem; font-weight: normal; }
.cell { display: inline-block; min-width: 1rem; border-radius: 3px; }
.cell.done { color: #1e7d45; font-weight: bold; }
.cell.overdue { background: #c0392b; color: #fff; }
.cell.due { background: #f1c40f; color: #000; }
.cell.skipped { color: #888; }
tr.overdue td:first-child { color: #c0392b; font-weight: bold; }
.order { border-top: 1px solid var(--line); padding: .5rem 0; }
.trend { width: 100%; max-width: 44rem; height: auto; margin-top: .75rem; }
.vitals-row input { width: 5rem; }
.protocol-row { border-top: 1px dashed var(--line); padding-top: .4rem; }
.walkins { margin-bottom: 1rem; }
.walkin-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr)); gap: .5rem; }
.triage-1 { box-shadow: inset 5px 0 0 #7b241c; }
.triage-2 { box-shadow: inset 5px 0 0 #c0392b; }
.triage-3 { box-shadow: inset 5px 0 0 #e67e22; }
.triage-4 { box-shadow: inset 5px 0 0 #f1c40f; }
.triage-5 { box-shadow: inset 5px 0 0 #27ae60; }
.address-check { margin-top: .35rem; display: flex; flex-direction: column; gap: .2rem; align-items: flex-start; }
