/* C Lab screens. One stylesheet; fits phones, tablets and desktops. */
:root {
  --brand: #0b6e79;
  --brand-dark: #08525a;
  --brand-soft: #e6f2f3;
  --bg: #f3f6f8;
  --card: #fff;
  --text: #1c2830;
  --muted: #5f6f79;
  --line: #dde4e8;
  --danger: #b42318;
  --danger-soft: #fef3f2;
  --due: #b54708;
  --good: #067647;
  --radius: 10px;
  --gap: 16px;
  font: 15px/1.45 "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  color: var(--text);
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
}
* { box-sizing: border-box; }
body { margin: 0; }
/* a sideways swipe on a laptop touchpad (often while scrolling a long list) is the browser's
   Back: it left the booking for the page before. Swipes no longer go back or forward. */
html, body { overscroll-behavior-x: none; }
[hidden] { display: none !important; }
h2 { font-size: 16px; margin: 0 0 12px; display: flex; align-items: center; gap: 8px; }
h3 { font-size: 14px; margin: 16px 0 8px; }
a { color: var(--brand); }
.muted { color: var(--muted); }
.small { font-size: 12px; color: var(--muted); }
.nowrap { white-space: nowrap; }
.grow { width: 100%; }
.error { color: var(--danger); background: var(--danger-soft); border: 1px solid #fecdca; padding: 8px 10px; border-radius: 8px; margin: 8px 0; }
.warn { color: var(--due); background: #fffaeb; border: 1px solid #fedf89; padding: 8px 10px; border-radius: 8px; margin: 8px 0; }
.hint { color: var(--muted); font-size: 13px; margin: 6px 0; }
.due { color: var(--due); font-weight: 600; }
kbd { font: 11px ui-monospace, monospace; border: 1px solid currentColor; border-radius: 4px; padding: 0 4px; opacity: .55; margin-left: 6px; }

/* ---- controls ---- */
input, select, textarea, button { font: inherit; }
input, select, textarea {
  width: 100%; min-width: 0; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--text);
  min-height: 40px;
}
input[type="checkbox"] { width: 20px; height: 20px; min-height: 0; accent-color: var(--brand); }
input[readonly] { background: #f6f8f9; color: var(--muted); }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand); outline-offset: -1px; border-color: transparent; }
input.bad { border-color: var(--danger); background: var(--danger-soft); }
label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); min-width: 0; }
label > span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
label.check { flex-direction: row; align-items: center; gap: 8px; color: var(--text); align-self: flex-end; min-height: 40px; }
label.inline { flex-direction: row; align-items: center; gap: 8px; }
label.inline select { width: auto; }
button {
  padding: 8px 14px; min-height: 40px; border-radius: 8px; border: 1px solid var(--line); background: #fff; cursor: pointer; color: var(--text);
  white-space: nowrap;
}
button:hover { border-color: var(--brand); }
button:disabled { opacity: .45; cursor: not-allowed; }
button.primary { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 600; }
button.primary:hover:not(:disabled) { background: var(--brand-dark); }
button.danger-btn { color: var(--danger); border-color: #fecdca; }
button.danger-btn:hover:not(:disabled) { background: var(--danger-soft); }
button.big { width: 100%; padding: 12px; font-size: 16px; margin-top: 8px; }
a.btn { display: inline-flex; align-items: center; padding: 8px 14px; min-height: 40px; border-radius: 8px; border: 1px solid var(--line); background: #fff; color: var(--text); text-decoration: none; white-space: nowrap; }
a.btn:hover { border-color: var(--brand); }
button.link { border: 0; background: none; color: var(--brand); padding: 4px 6px; min-height: 0; font-size: 13px; }
button.link.danger { color: var(--danger); }

/* fields that wrap to fit any width */
.form-grid { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 12px; align-items: flex-end; }
.form-grid > * { min-width: 0; }
.w-s { flex: 1 1 110px; }
.w-m { flex: 1 1 170px; }
.w-l { flex: 2 1 220px; }
.w-xl { flex: 3 1 320px; }
.full { flex: 1 1 100%; }
.actions { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; align-items: center; }
.row { display: flex; gap: 8px; align-items: center; }
.row > input { flex: 1; }
.wrap { flex-wrap: wrap; }

.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 18px; color: var(--text); text-decoration: none; }
.logo { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; background: var(--brand); color: #fff; flex: none; }

/* ---- sign in ---- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-card { background: var(--card); padding: 32px; border-radius: 14px; width: min(360px, 100%); display: grid; gap: 14px; box-shadow: 0 8px 30px rgb(0 0 0 / .08); }
.login-card .brand { font-size: 22px; }
.login-card p { margin: 0; }

/* ---- top bar ---- */
.topbar { display: flex; align-items: center; gap: 20px; padding: 8px 20px; background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; }
#nav { display: flex; gap: 4px; flex: 1; overflow-x: auto; scrollbar-width: none; }
.tab { padding: 8px 12px; border-radius: 8px; color: var(--muted); text-decoration: none; white-space: nowrap; }
.tab:hover { background: var(--bg); }
.tab.active { background: var(--brand-soft); color: var(--brand-dark); font-weight: 600; }
.who { font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 4px; white-space: nowrap; }
.menu-btn { display: none; border: 0; font-size: 20px; padding: 4px 10px; }

/* ---- layout ---- */
#main { padding: var(--gap) 20px; max-width: 1920px; margin: 0 auto; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; min-width: 0; }
.card + .card { margin-top: var(--gap); }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.card-head h2 { margin: 0; }
.step { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--brand); color: #fff; font-size: 12px; flex: none; }
.back { display: inline-block; margin-bottom: 10px; text-decoration: none; }

/* booking: patient | tests | payment */
.booking { display: grid; grid-template-columns: minmax(300px, 1fr) minmax(0, 1.5fr) minmax(300px, 360px); gap: var(--gap); align-items: start; }
.booking .card + .card { margin-top: 0; }
.booking.form-open .patient-card { grid-column: 1 / -1; }
.booking.form-open > .card:nth-child(2) { grid-column: 1 / 3; }
.pay { position: sticky; top: 72px; }

/* visit: details | payment */
.visit-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(300px, 360px); gap: var(--gap); align-items: start; }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; min-width: 0; }
.facts .row { max-width: 460px; }
.changes { list-style: none; padding: 0; margin: 0; font-size: 13px; }
.changes li { padding: 6px 0; border-bottom: 1px solid var(--line); }
.add-tests { margin-top: 12px; border-top: 1px solid var(--line); padding-top: 12px; }
.add-tests summary { cursor: pointer; color: var(--brand); font-weight: 600; }
.chips { list-style: none; padding: 0; display: flex; gap: 6px; flex-wrap: wrap; margin: 8px 0; }
.chips li { background: var(--brand-soft); border-radius: 16px; padding: 2px 4px 2px 10px; font-size: 13px; }
.dues { border-top: 1px solid var(--line); margin-top: 12px; }

/* patient */
.results { list-style: none; padding: 0; margin: 8px 0 0; max-height: 340px; overflow: auto; }
.results li button { width: 100%; text-align: left; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; padding: 10px 6px; white-space: normal; }
.results li button:hover { background: #f0f7f8; }
.results li.muted, .results li.error { padding: 8px 6px; }
.picked { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; background: var(--brand-soft); border-radius: 8px; padding: 12px; }
.picked-name { font-weight: 700; font-size: 16px; }
.picked-actions { display: flex; flex-direction: column; align-items: flex-end; }
.history { margin-top: 12px; }
.history ul { list-style: none; padding: 0; margin: 4px 0 0; font-size: 13px; }
.history li { padding: 4px 0; border-bottom: 1px solid var(--line); }

/* test search */
.test-search { position: relative; margin-top: 12px; }
.suggest { position: absolute; left: 0; right: 0; top: 100%; z-index: 4; list-style: none; margin: 2px 0 0; padding: 4px; background: #fff; border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 8px 24px rgb(0 0 0 / .1); }
.suggest li { padding: 10px 8px; border-radius: 6px; cursor: pointer; display: flex; gap: 8px; }
.suggest li.active, .suggest li:hover { background: var(--brand-soft); }
/* a type-to-find box (client, referred by): our own list, not the browser's */
.combo { position: relative; }
.doctor-pick .row > .combo { flex: 1; }
.combo .suggest { max-height: 320px; overflow-y: auto; min-width: 280px; }
.combo .suggest li { padding: 7px 8px; }
.combo .suggest li.group { cursor: default; padding: 6px 8px 2px; font-size: 12px; font-weight: 600; color: var(--muted, #667); background: none; text-transform: uppercase; letter-spacing: .03em; }
.combo .suggest .note { margin-left: auto; font-size: 12px; color: var(--muted, #667); text-align: right; }

/* tables */
table.lines { width: 100%; border-collapse: collapse; margin-top: 12px; }
.lines th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 600; border-bottom: 1px solid var(--line); padding: 6px 8px; white-space: nowrap; }
.lines td { border-bottom: 1px solid var(--line); padding: 8px; vertical-align: middle; }
.lines td.grow { width: auto; }
.lines td.act { width: 1%; white-space: nowrap; }
.lines tr.clickable { cursor: pointer; }
.lines tr.clickable:hover { background: #f7fafb; }
.lines tr.struck td { color: var(--muted); text-decoration: line-through; }
.lines tr.struck td .chip { text-decoration: none; }
.num { text-align: right; white-space: nowrap; }
.price-input { width: 100px; text-align: right; padding: 4px 6px; min-height: 32px; }

.chip { display: inline-block; padding: 2px 8px; border-radius: 12px; font-size: 12px; background: #eef1f3; color: var(--text); white-space: nowrap; }
.s-booked, .s-to_follow { background: #fffaeb; color: #93370d; }
.s-collected, .s-in_transit, .s-arrived { background: #eff8ff; color: #175cd3; }
.s-received, .s-sent_out, .s-results_entered, .s-forwarded, .s-partially_verified { background: #f4f3ff; color: #5925dc; }
.s-verified { background: #ecfdf3; color: var(--good); }
.s-on_hold, .s-sent_back { background: #fef3f2; color: var(--danger); }
.s-cancelled, .s-refunded { background: #f2f4f7; color: var(--muted); }
.dot { display: inline-block; width: 12px; height: 12px; border-radius: 50%; border: 1px solid #0003; vertical-align: -1px; }
.c-lavender { background: #b39ddb; } .c-yellow { background: #fdd835; } .c-grey { background: #9e9e9e; }
.c-white { background: #fff; } .c-red { background: #e53935; } .c-none { background: transparent; border-style: dashed; }
.scan input { font-size: 18px; min-height: 48px; }

/* payment totals */
.totals { display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; margin: 0; }
.totals dt { color: var(--muted); }
.totals dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }
.totals .big { font-size: 20px; font-weight: 700; color: var(--text); border-top: 1px solid var(--line); padding-top: 6px; }
.balance { margin: 12px 0 0; }

/* modal */
.modal { position: fixed; inset: 0; background: rgb(15 25 30 / .45); display: grid; place-items: center; z-index: 20; padding: 12px; }
.modal-box { background: #fff; border-radius: 14px; padding: 20px; max-height: calc(100vh - 24px); overflow: auto; width: min(520px, 100%); }
.modal-box.wide { width: min(1000px, 100%); }
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.modal-head h2 { margin: 0; }
.modal .actions { margin-top: 14px; }

.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--text); color: #fff; padding: 10px 16px; border-radius: 8px; z-index: 30; max-width: calc(100% - 24px); }
.toast.good { background: var(--good); color: #fff; }
.toast.bad { background: var(--danger); color: #fff; }

/* ---- slip, labels, batch list ---- */
#print-area { display: none; }
.slip-preview { display: flex; justify-content: center; padding: 8px; background: #f6f8f9; border-radius: 8px; overflow: auto; }
.receipt { width: 72mm; font-size: 12px; color: #000; background: #fff; padding: 2mm; }
.slip-preview[data-paper="a5"] .receipt, .slip-preview[data-paper="a4"] .receipt { width: 100%; max-width: 180mm; font-size: 13px; padding: 6mm; }
.receipt svg.barcode { display: block; margin: 6px auto; max-width: 100%; }
.r-head { text-align: center; border-bottom: 1px dashed #000; padding-bottom: 6px; }
.r-title { font-size: 16px; font-weight: 700; }
.receipt table { width: 100%; border-collapse: collapse; margin: 6px 0; }
.receipt th, .receipt td { padding: 2px 0; vertical-align: top; text-align: left; }
.r-info th { width: 32%; font-weight: 600; }
.r-items { border-top: 1px dashed #000; border-bottom: 1px dashed #000; }
.r-items thead th { border-bottom: 1px solid #000; }
.r-items .num, .r-totals td { text-align: right; }
.r-when { display: none; }
[data-paper="a5"] .r-when, [data-paper="a4"] .r-when { display: table-cell; }
[data-paper="a5"] .r-when-inline, [data-paper="a4"] .r-when-inline { display: none; }
.r-totals tr.due td, .r-totals tr.due th { font-weight: 700; }
.pin { border: 1px solid #000; padding: 4px; text-align: center; margin: 6px 0; }
.batch-preview { overflow: auto; }
.batch-sheet svg.barcode { display: block; margin: 8px auto; }
.signs { display: flex; gap: 24px; margin-top: 40px; }
.signs div { flex: 1; border-top: 1px solid #000; padding-top: 4px; font-size: 12px; }

/* ---- smaller screens ---- */
@media (max-width: 1250px) {
  .booking { grid-template-columns: minmax(0, 1fr) minmax(280px, 340px); }
  .booking > .patient-card, .booking > .card:nth-child(2) { grid-column: 1; }
  .booking > .pay { grid-column: 2; grid-row: 1 / span 2; }
  .booking.form-open > .patient-card { grid-column: 1 / -1; }
  .booking.form-open > .card:nth-child(2) { grid-column: 1; }
  .booking.form-open > .pay { grid-row: 2; }
}
@media (max-width: 960px) {
  .menu-btn { display: block; }
  .topbar { gap: 8px; padding: 8px 12px; }
  #nav { display: none; position: absolute; left: 0; right: 0; top: 100%; background: #fff; border-bottom: 1px solid var(--line); flex-direction: column; padding: 8px; box-shadow: 0 8px 20px rgb(0 0 0 / .08); }
  #nav.open { display: flex; }
  #nav .tab { padding: 12px; }
  .brand { flex: 1; }
  .visit-grid { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  #main { padding: 12px; }
  .booking { grid-template-columns: 1fr; }
  .booking > *, .booking.form-open > * { grid-column: 1 !important; grid-row: auto !important; }
  .pay { position: static; }
  .who-text, kbd { display: none; }
  .facts { grid-template-columns: 1fr; gap: 2px; }
  .facts dd { margin-bottom: 8px; }
  .card { padding: 12px; }
  /* tables become stacked cards */
  table.responsive thead { display: none; }
  table.responsive, table.responsive tbody, table.responsive tr, table.responsive td { display: block; width: 100%; }
  table.responsive tr { border: 1px solid var(--line); border-radius: 8px; margin-bottom: 8px; padding: 6px 10px; position: relative; }
  table.responsive td { border: 0; padding: 4px 0; display: flex; justify-content: space-between; gap: 12px; text-align: right; }
  table.responsive td[data-label]::before { content: attr(data-label); color: var(--muted); font-size: 12px; text-align: left; flex: none; }
  table.responsive td.act { width: auto; justify-content: flex-end; }
  table.responsive td.act .row { flex-wrap: wrap; justify-content: flex-end; }
  .modal-box { padding: 14px; }
}

/* ---- printing ---- */
@media print {
  body { background: #fff; }
  #app, #login, .toast, .modal { display: none !important; }
  #print-area { display: block; }
  #print-area > * { display: none; }
  body[data-print="slip"] #print-area .print-slip,
  body[data-print="labels"] #print-area .print-labels,
  body[data-print="batch"] #print-area .print-batch,
  body[data-print="any"] #print-area .print-any { display: block; }
  body[data-paper="receipt"] .receipt { width: 72mm; padding: 0; }
  body[data-paper="a5"] .receipt { width: 100%; max-width: none; font-size: 13px; padding: 0; }
  body[data-paper="a4"] .receipt { width: 100%; max-width: none; font-size: 15px; padding: 0; }
  body[data-paper="a4"] .r-title { font-size: 22px; }
  body[data-paper="a5"] .r-when, body[data-paper="a4"] .r-when { display: table-cell; }
  body[data-paper="a5"] .r-when-inline, body[data-paper="a4"] .r-when-inline { display: none; }
  .label { width: 50mm; height: 25mm; padding: 1mm 2mm; overflow: hidden; font-size: 9px; text-align: center; page-break-after: always; break-after: page; }
  .label svg { display: block; margin: 0 auto; height: 15mm; max-width: 100%; }
  .l-name { font-weight: 700; white-space: nowrap; overflow: hidden; }
  /* labels on plain A4: all on one sheet, cut along the lines */
  body[data-print="labels"][data-paper="sheet"] #print-area .print-labels { display: grid; grid-template-columns: repeat(3, 50mm); gap: 4mm; }
  body[data-paper="sheet"] .label { page-break-after: auto; break-after: auto; break-inside: avoid; border: 1px dashed #999; }
  .batch-sheet .lines th, .batch-sheet .lines td { border-bottom: 1px solid #999; font-size: 12px; }
}

/* ---- lab report (screen, print, online) ---- */
.lab-report { background: #fff; color: #000; font-size: 13px; padding: 8mm; max-width: 210mm; margin: 0 auto; }
.rep-head { display: flex; justify-content: space-between; align-items: flex-end; border-bottom: 2px solid var(--brand); padding-bottom: 6px; margin-bottom: 8px; gap: 12px; }
.rep-lab { font-size: 22px; font-weight: 700; color: var(--brand-dark); }
.rep-title { font-weight: 700; letter-spacing: .08em; }
.rep-patient { width: 100%; border-collapse: collapse; margin-bottom: 10px; }
.rep-patient th { text-align: left; font-weight: 600; color: #444; width: 15%; padding: 2px 6px 2px 0; }
.rep-patient td { padding: 2px 6px 2px 0; }
.rep-dept h3 { break-after: avoid; page-break-after: avoid; background: #eef5f6; padding: 4px 8px; margin: 14px 0 6px; font-size: 14px; text-transform: uppercase; letter-spacing: .04em; }
.rep-test { break-inside: avoid; margin-bottom: 10px; }
.rep-test h4 { margin: 6px 0 4px; font-size: 14px; break-after: avoid; }
.rep-values { width: 100%; border-collapse: collapse; }
.rep-values th { text-align: left; font-size: 12px; border-bottom: 1px solid #000; padding: 3px 4px; }
.rep-values td { padding: 3px 4px; border-bottom: 1px solid #ddd; }
.rep-values .res { font-weight: 600; }
.rep-values .graph { width: 140px; padding-top: 2px; padding-bottom: 0; }
.range-bar { display: block; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.rep-values tr.abn .res { font-weight: 800; }
.flag { color: #b42318; font-weight: 800; }
.rep-text { padding: 2px 0; line-height: 1.5; }
.rep-impression { border-left: 3px solid var(--brand); background: #f3f8f9; padding: 6px 10px; margin: 8px 0; break-inside: avoid; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.rt-h { font-weight: 700; margin: 10px 0 2px; text-transform: uppercase; font-size: 12px; letter-spacing: .03em; }
.rt-p { margin: 2px 0 6px; }
.rt-list { margin: 2px 0 6px; padding-left: 20px; }
.rep-test.narrative { break-inside: auto; }
.rep-specimen { margin: 0 0 4px; }
.rep-remark { margin: 4px 0; }
.rep-pending { color: #93370d; margin-top: 12px; }
.rep-foot { margin-top: 24px; border-top: 1px solid #999; padding-top: 6px; }
.rep-sign { display: flex; gap: 40px; justify-content: flex-end; margin-bottom: 8px; }
.sign-line { width: 160px; border-bottom: 1px solid #000; height: 28px; }
.report-preview { background: #f6f8f9; padding: 8px; border-radius: 8px; overflow: auto; }

/* results entry and verification */
.work-grid { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(320px, 1fr); gap: var(--gap); align-items: start; }
.work-grid > .card + .card { margin-top: 0; }
.panel { position: sticky; top: 72px; }
.params { width: 100%; border-collapse: collapse; }
.params td { padding: 6px 4px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.params td.val { width: 140px; }
.params input.high, .params input.low { border-color: var(--danger); background: var(--danger-soft); font-weight: 700; }
.params .rng { color: var(--muted); font-size: 12px; white-space: nowrap; }
.history-list { list-style: none; padding: 0; margin: 0; font-size: 12px; color: var(--muted); }
.history-list li { padding: 3px 0; }
.tabs-row { display: flex; gap: 4px; flex-wrap: wrap; }
.tabs-row button.on { background: var(--brand-soft); border-color: var(--brand); color: var(--brand-dark); font-weight: 600; }
tr.selected td { background: var(--brand-soft); }
.stat { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
.stat div { background: var(--bg); border-radius: 8px; padding: 10px; }
.stat strong { display: block; font-size: 20px; }
@media (max-width: 960px) { .work-grid { grid-template-columns: 1fr; } .panel { position: static; } }
@media (max-width: 600px) {
  .lab-report { padding: 4mm; }
  .rep-head { flex-wrap: wrap; }
  .rep-sign { flex-wrap: wrap; gap: 16px; justify-content: flex-start; }
  .sign-line { width: 130px; }
  .rep-patient th { width: auto; }
  /* on a phone: label and value side by side, one pair per line (no "Referr ed by") */
  .rep-patient tr { display: grid; grid-template-columns: 34% 1fr; }
  .rep-patient th, .rep-patient td { display: block; white-space: normal; overflow-wrap: anywhere; }
  .rep-patient th { white-space: nowrap; }
  .rep-values th { white-space: nowrap; }
  .rep-values td { word-break: normal; overflow-wrap: normal; padding-left: 2px; padding-right: 2px; }
  .rep-values td:first-child { min-width: 92px; }
  .rep-values .graph { width: 56px; }
  .range-bar { width: 56px; }
}
@media print {
  .lab-report { padding: 0; font-size: 12px; max-width: none; }
  .rep-dept h3 { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* online report page */
.online-bar { justify-content: space-between; padding: 12px; max-width: 210mm; margin: 0 auto; }
.online-msg { max-width: 520px; margin: 40px auto; }
#result .lab-report { box-shadow: 0 4px 20px rgb(0 0 0 / .06); margin-bottom: 24px; }
@media print {
  body[data-print="online"] #result { display: block !important; }
  body[data-print="online"] .online-bar { display: none; }
  body[data-print="online"] #result .lab-report { box-shadow: none; }
}

/* report editor */
.editor { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; }
.editor textarea.findings { min-height: 46vh; font: 14px/1.5 ui-monospace, Consolas, monospace; resize: vertical; }
.editor textarea.impression { min-height: 70px; }
.editor .preview { background: #f6f8f9; border-radius: 8px; padding: 8px; max-height: 70vh; overflow: auto; }
.editor .preview .lab-report { padding: 6mm; font-size: 12px; }
.toolbar { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin: 8px 0; }
.toolbar button { min-height: 32px; padding: 4px 10px; }
.modal-box.full { width: min(1400px, 100%); }
.narrative-peek { max-height: 220px; overflow: auto; border: 1px solid var(--line); border-radius: 8px; padding: 8px; font-size: 13px; }
@media (max-width: 900px) { .editor { grid-template-columns: 1fr; } .editor textarea.findings { min-height: 40vh; } }

/* admin */
.perm-group { border: 1px solid var(--line); border-radius: 8px; padding: 6px 12px 10px; margin: 0 0 10px; }
.perm-group legend { font-weight: 600; font-size: 13px; padding: 0 4px; }
label.perm { align-items: flex-start; min-height: 0; padding: 4px 0; font-size: 14px; }
label.perm input { margin-top: 2px; flex: none; }
.edit-link { margin-left: 6px; }

/* graph cards for short tests (thyroid, vitamin D, HbA1c, sugar…) */
.gcards { display: grid; gap: 8px; }
.gcard { display: grid; grid-template-columns: minmax(140px, 1.3fr) 76px minmax(110px, 1fr) minmax(150px, 1.2fr); align-items: center; gap: 12px;
  border: 1px solid #dde4e8; border-radius: 6px; padding: 6px 12px; break-inside: avoid; }
.gcard.abn { border-color: #f1b8b3; }
.g-title { font-weight: 700; }
.g-big { font-size: 26px; font-weight: 800; letter-spacing: -.01em; }
.g-unit { font-size: 12px; color: #444; }
.g-status { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--good); }
.g-status.high, .g-status.low { color: #b42318; }
.gcard.abn .g-big { color: #b42318; }
.v-gauge, .sparkline { display: block; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.rep-values .prev { color: #444; white-space: nowrap; }
.rep-values .arrow { color: #5f6f79; font-weight: 700; }
@media (max-width: 600px) {
  .gcard { grid-template-columns: 1fr 76px; }
  .g-value { grid-column: 1; grid-row: 2; }
  .g-gauge { grid-row: 1 / span 2; grid-column: 2; }
  .g-trend { grid-column: 1 / -1; }
}

.params td.prev-cell { white-space: nowrap; font-size: 12px; color: var(--muted); }
.delta { font-weight: 700; margin-left: 4px; color: var(--muted); }
.delta.big { color: var(--danger); }

/* catalogue */
.param-edit td { padding: 4px; }
.param-edit input { min-height: 34px; }
td.pct input { width: 110px; }
.history-block { margin-top: 12px; }

/* many screens (admin): compact menu, folds into ☰ below 1500px */
body.many-tabs .tab { padding: 8px 9px; font-size: 14px; }
body.many-tabs .tab kbd { display: none; }
body.many-tabs .topbar { gap: 12px; }
@media (max-width: 1600px) { body.many-tabs .who-text { display: none; } }
@media (max-width: 1500px) {
  body.many-tabs .menu-btn { display: block; }
  body.many-tabs #nav { display: none; position: absolute; left: 0; right: 0; top: 100%; background: #fff; border-bottom: 1px solid var(--line);
    flex-direction: row; flex-wrap: wrap; padding: 8px; box-shadow: 0 8px 20px rgb(0 0 0 / .08); }
  body.many-tabs #nav.open { display: flex; }
  body.many-tabs .brand { flex: 1; }
}

/* culture */
.culture-grid { overflow: auto; max-height: 52vh; border: 1px solid var(--line); border-radius: 8px; }
table.culture { margin: 0; }
table.culture th.iso { min-width: 210px; vertical-align: top; }
table.culture th.iso input { margin-bottom: 4px; min-height: 34px; font-weight: 400; }
table.culture thead th { position: sticky; top: 0; background: #fff; z-index: 1; }
table.culture tr.ab-class td { background: var(--bg); font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: 3px 8px; }
td.sir { white-space: nowrap; }
.sir-btn { min-height: 30px; padding: 2px 10px; margin-right: 2px; font-weight: 700; }
.sir-btn.on.S { background: #ecfdf3; border-color: var(--good); color: var(--good); }
.sir-btn.on.I { background: #fffaeb; border-color: #b54708; color: #b54708; }
.sir-btn.on.R { background: var(--danger-soft); border-color: var(--danger); color: var(--danger); }
input.mic { width: 64px; min-height: 30px; padding: 2px 6px; margin-left: 4px; }
.rep-culture p { margin: 3px 0; }
.rep-values.sens { max-width: 520px; }
.sir-cell { font-weight: 700; }
.sir-cell.R { color: #b42318; }
.sir-cell.I { color: #b54708; }

.statement tfoot th { text-align: right; border-top: 1px solid #000; padding: 4px; }
.statement .num { text-align: right; }

/* management reports */
.quick-dates { display: flex; gap: 12px; align-items: flex-end; padding-bottom: 8px; }
.table-scroll { overflow-x: auto; }
.mr-table td.num, .mr-table th.num { text-align: right; white-space: nowrap; }
.mr-table tfoot th { border-top: 2px solid var(--line); padding: 8px; color: var(--ink, inherit); font-size: 13px; }
.mr-print { font-size: 11px; color: #000; }
.mr-print .mr-head { display: flex; justify-content: space-between; align-items: flex-start; border-bottom: 1px solid #000; padding-bottom: 6px; margin-bottom: 6px; }
.mr-print .mr-title { text-align: right; }
.mr-print h2 { margin: 0 0 2px; font-size: 15px; }
.mr-print table.lines { margin-top: 4px; }
.mr-print .lines th { color: #000; font-size: 10px; padding: 3px 4px; border-bottom: 1px solid #000; white-space: normal; }
.mr-print .lines td { padding: 3px 4px; font-size: 10.5px; border-bottom: 1px solid #ccc; }
.mr-print .lines tfoot th { border-top: 1px solid #000; font-size: 10.5px; }
.mr-print .lines thead { display: table-header-group; }
.mr-print tr { break-inside: avoid; }
.mr-print .mr-foot { margin-top: 8px; color: #555; font-size: 9px; }

/* report layouts: letterhead, per-test text, certificate */
.rep-title.solo { text-align: center; font-weight: 700; letter-spacing: .12em; margin-bottom: 8px; }
.rep-intro { font-size: 11px; color: #444; font-style: italic; margin: 2px 0 6px; }
.rep-note { font-size: 11px; color: #333; border-top: 1px dashed #bbb; margin-top: 6px; padding-top: 4px; }
.rep-intro .rt-p, .rep-note .rt-p { margin: 2px 0; }
.certificate .cert-title { text-align: center; font-size: 18px; font-weight: 700; letter-spacing: .15em; margin: 10px 0 2px; }
.certificate .cert-meta { display: flex; justify-content: space-between; font-size: 12px; margin-bottom: 8px; }
.certificate .cert-person { display: grid; grid-template-columns: 1fr 32mm; gap: 10px; align-items: start; }
.certificate .cert-photo { border: 1px dashed #999; height: 38mm; display: flex; align-items: center; justify-content: center; color: #999; font-size: 11px; }
.certificate .cert-text { margin: 12px 0 6px; line-height: 1.5; }
.certificate .cert-verdict { margin: 14px 0 6px; padding: 8px 12px; border: 2px solid #000; display: inline-block; font-size: 15px; }
.certificate .cert-verdict.v-unfit { border-color: #b42318; color: #b42318; }
.certificate .cert-remarks { margin: 6px 0; }
.check-list { display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 6px 0 10px; }

/* finance */
table.coa tr.heading td { font-weight: 700; background: var(--bg); }
table.coa td.depth-1, table.mr-table td.depth-1 { padding-left: 22px; }
table.coa td.depth-2 { padding-left: 36px; }
table.coa td.depth-3 { padding-left: 50px; }
table.coa td.depth-4, table.coa td.depth-5 { padding-left: 64px; }
table.coa .chip { margin-left: 6px; font-size: 11px; }
table.mr-table tr.heading td { font-weight: 700; padding-top: 12px; }
table.mr-table tr.subtotal td { font-weight: 600; border-top: 1px solid var(--line); }
table.voucher-lines td select, table.voucher-lines td input { width: 100%; min-width: 120px; }
.fin-print .rep-patient th { width: 28%; text-align: left; }
.fin-signs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-top: 40px; }
.fin-signs > div { border-top: 1px solid #000; padding-top: 4px; font-size: 10px; }

/* report charts */
.chart-box { margin: 8px 0 14px; }
.mr-chart { width: 100%; max-width: 900px; height: auto; display: block; }
.mr-chart .c-label { font-size: 11px; fill: #475467; }
.mr-chart .c-val { font-size: 10px; fill: #667085; }
.mr-chart .c-grid { stroke: #eaecf0; stroke-width: 1; }
.chart-legend { display: flex; gap: 14px; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.chart-legend .sw { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }
.chart-legend .sw.s0 { background: #0f766e; } .chart-legend .sw.s1 { background: #d97706; }
.chart-legend .sw.s2 { background: #6366f1; } .chart-legend .sw.s3 { background: #be123c; }
.mr-print .chart-box { break-inside: avoid; }
.mr-print .mr-chart { max-width: 100%; }

/* test formats: sections, calculated values */
table.params tr.sec td { font-weight: 700; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--brand-dark, #134e4a); padding-top: 10px; }
table.params input.calc { background: var(--bg); font-weight: 600; }
table.rep-values tr.rep-sec td { font-weight: 700; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; padding-top: 8px; border-bottom: 1px solid #ddd; }
.modal table.param-edit { display: block; overflow-x: auto; }
.modal table.param-edit input { min-width: 90px; }

/* --- Phase 9: priority, pending, locks ---------------------------------------- */
.stack { display: flex; flex-direction: column; gap: 10px; }
.chip.p-urgent { background: #fff4e5; color: #b54708; font-weight: 600; }
.chip.p-stat { background: var(--danger); color: #fff; font-weight: 700; }
tr.row-stat td:first-child { box-shadow: inset 4px 0 0 var(--danger); }
tr.row-urgent td:first-child { box-shadow: inset 4px 0 0 #f79009; }
.warn { color: #b54708; }
.tabs-row button .count { display: inline-block; min-width: 18px; padding: 0 5px; border-radius: 9px; background: #eef1f3; font-size: 12px; }
.tabs-row button.warn .count { background: var(--danger); color: #fff; }
.lock-open { color: var(--muted, #667085); }
.lock-approval { color: #b54708; font-weight: 600; }
.lock-locked { color: var(--danger); font-weight: 700; }
.perm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 4px 16px; }
.perm-grid label { display: flex; gap: 6px; align-items: center; font-size: 13px; }
.slip-priority { border: 2px solid #000; padding: 2px 6px; font-weight: 700; display: inline-block; margin: 2px 0; }
.late-text { color: var(--danger); font-weight: 600; }
.perm-grid label.access-item { display: grid; grid-template-columns: 1fr 150px; gap: 8px; align-items: center; text-align: left; margin: 0; }
.perm-grid label.access-item span { white-space: normal; }
.perm-grid label.access-item select { width: 150px; }

/* --- Phase 10: HR ------------------------------------------------------------------ */
.scroll-x { overflow-x: auto; }
table.att-sheet { font-size: 12px; }
table.att-sheet th.c, table.att-sheet td.c { text-align: center; padding: 3px 2px; min-width: 22px; }
table.att-sheet td.att-A, table.att-sheet td.att-U, table.att-sheet td.att-X { color: var(--danger); font-weight: 700; }
table.att-sheet td.att-H { color: #b54708; font-weight: 600; }
table.att-sheet td.att-PL { color: #b54708; }
table.att-sheet td.att-O, table.att-sheet td.att-G { color: var(--muted); }
tr.unmarked td { background: #fffaeb; }
.chip.run-draft { background: #fff4e5; color: #b54708; }
.chip.run-posted { background: #eef4ff; color: #3538cd; }
.chip.run-paid { background: #ecfdf3; color: #027a48; }
.payslip { break-after: page; }
.payslip:last-child { break-after: auto; }
.payslip .big { font-size: 15px; }
table.small-print { font-size: 10px; }

/* --- Phase 10b: phone check-in, field ---------------------------------------------- */
.cam { position: relative; width: 100%; max-width: 420px; margin: 8px auto; border-radius: 12px; overflow: hidden; background: #111; aspect-ratio: 3 / 4; }
.cam-video, .cam-shot { width: 100%; height: 100%; object-fit: cover; display: block; }
.cam-video { transform: scaleX(-1); }
.me-card { text-align: center; }
.me-card .big { width: 100%; max-width: 420px; padding: 16px; font-size: 20px; }
.punch-out { background: var(--danger); border-color: var(--danger); }
ul.plain { list-style: none; padding: 0; margin: 0; }
ul.plain li { padding: 6px 0; border-bottom: 1px solid var(--line, #eaecf0); }
.route-box { margin: 8px 0; }
.route-svg { width: 100%; max-height: 320px; background: #f8fafc; border: 1px solid #eaecf0; border-radius: 8px; }
img.thumb { width: 56px; height: 56px; object-fit: cover; border-radius: 6px; }
.punch-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
.punch-grid figure { margin: 0; border: 1px solid #eaecf0; border-radius: 8px; padding: 6px; font-size: 12px; }
.punch-grid figure.away { border-color: #f79009; background: #fffaeb; }
.punch-grid img { width: 100%; aspect-ratio: 3 / 4; object-fit: cover; border-radius: 6px; }

/* --- Phase 11: inventory ------------------------------------------------------------ */
.chip.req-requested { background: #fff4e5; color: #b54708; font-weight: 600; }
.chip.req-approved, .chip.req-partly_issued { background: #eef4ff; color: #3538cd; }
.chip.req-issued, .chip.po-received { background: #ecfdf3; color: #027a48; }
.chip.req-refused, .chip.req-cancelled, .chip.po-cancelled { background: #fef3f2; color: var(--danger); }
.chip.po-open { background: #fff4e5; color: #b54708; }
/* branch / store picker next to the tabs: as wide as its text */
.card-head > .row > select, .card-head > .row > .chip { width: auto; flex: 0 0 auto; min-width: 170px; }
.card-head > .row > .chip { min-width: 0; }

/* Phase 12: home collection */
.chip.home-requested { background: #fff4e5; color: #b54708; }
.chip.home-assigned { background: var(--brand-soft); color: var(--brand-dark); }
.chip.home-on_the_way { background: #e8f1ff; color: #1d4ed8; font-weight: 600; }
.chip.home-collected { background: #e7f6ec; color: #067647; }
.chip.home-at_lab { background: #e7f6ec; color: #067647; font-weight: 600; }
.chip.home-not_home { background: #fdecea; color: var(--danger); }
.chip.home-cancelled { background: #eef1f3; color: #667085; text-decoration: line-through; }
.home-card .row { gap: 8px; align-items: center; }
.home-card a.button { display: inline-block; padding: 10px 16px; border: 1px solid var(--line, #d0d5dd); border-radius: 8px; text-decoration: none; color: var(--text); background: #fff; }
tr.late td:first-child { border-left: 3px solid var(--danger); }

/* Phase 13: online payments */
.pay-card { max-width: 420px; }
.pay-amount { font-size: 32px; font-weight: 700; margin: 8px 0 16px; }
.pay-btn { display: block; width: 100%; margin: 8px 0; }
.big-msg { font-size: 20px; font-weight: 600; }
p.good, .good { color: #067647; }
.test-gateway { border: 3px dashed #b54708; }
a.button { display: inline-block; text-decoration: none; text-align: center; padding: 10px 16px; border-radius: 8px; border: 1px solid var(--line); background: #fff; color: var(--text); }
a.button.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.qr-box { display: flex; gap: 16px; flex-wrap: wrap; align-items: flex-start; }
.qr-box img { width: 180px; height: 180px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.link-url { word-break: break-all; font-family: monospace; font-size: 13px; background: #f6f8f9; padding: 6px 8px; border-radius: 6px; }

/* Menu bar laid out like the old system (Administrator, Order Booking, Pathology…) */
#nav { overflow: visible; gap: 0; align-items: stretch; }
.menu-bar { position: relative; }
.menu-top { border: 0; background: none; padding: 8px 10px; border-radius: 8px; color: var(--text); font-size: 14px; white-space: nowrap; cursor: pointer; }
.menu-top:hover, .menu-bar.open .menu-top { background: var(--bg); }
.menu-bar.active .menu-top { color: var(--brand-dark); font-weight: 600; box-shadow: inset 0 -2px 0 var(--brand); border-radius: 8px 8px 0 0; }
.menu-drop { display: none; position: absolute; top: 100%; left: 0; min-width: 260px; max-height: calc(100vh - 70px); overflow-y: auto; background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 12px 28px rgb(0 0 0 / .14); padding: 6px; z-index: 30; }
.menu-bar.open .menu-drop { display: block; }
.menu-item { display: flex; align-items: center; gap: 8px; width: 100%; text-align: left; padding: 7px 12px; border: 0; background: none; border-radius: 6px; color: var(--text); text-decoration: none; font-size: 14px; white-space: nowrap; cursor: pointer; }
.menu-item:hover, .menu-item:focus-visible { background: var(--brand-soft); color: var(--brand-dark); outline: none; }
.menu-item.indent { padding-left: 26px; }
.menu-item.soon { color: var(--muted); }
.menu-sub { padding: 8px 12px 2px; font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.menu-drop hr { border: 0; border-top: 1px solid var(--line); margin: 4px 6px; }
.menu-new, .menu-soon { font-size: 10px; font-weight: 700; text-transform: uppercase; padding: 1px 6px; border-radius: 10px; margin-left: auto; }
.menu-new { background: var(--brand-soft); color: var(--brand-dark); }
.menu-soon { background: #eef1f3; color: #667085; }
/* the last bars open to the left so they stay on screen */
.menu-bar:nth-last-child(-n+4) .menu-drop { left: auto; right: 0; }

@media (max-width: 1400px) {
  .menu-btn { display: block; }
  .topbar { gap: 8px; }
  #nav { display: none; position: absolute; left: 0; right: 0; top: 100%; background: #fff; border-bottom: 1px solid var(--line); flex-direction: column; padding: 8px; box-shadow: 0 8px 20px rgb(0 0 0 / .08); max-height: calc(100vh - 60px); overflow-y: auto; }
  #nav.open { display: flex; }
  .menu-top { width: 100%; text-align: left; padding: 12px; font-size: 15px; }
  .menu-drop, .menu-bar:nth-last-child(-n+4) .menu-drop { position: static; box-shadow: none; border: 0; border-left: 3px solid var(--brand-soft); border-radius: 0; margin-left: 12px; max-height: none; }
  .menu-item { padding: 10px 12px; }
}
/* paper data entry sheet */
.entry-sheet h2 { margin: 0 0 4px; }
.sheet-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.sheet-table th, .sheet-table td { border: 1px solid #999; padding: 4px 6px; text-align: left; }
.sheet-table .sheet-test td { background: #f2f4f7; }
.sheet-table .sheet-box { width: 30%; height: 22px; }
.sheet-sign { margin-top: 24px; font-size: 12px; }
/* the slip's QR for the online report */
.slip-qr-row { display: flex; gap: 8px; align-items: center; margin-top: 6px; }
.slip-qr { width: 26mm; height: 26mm; flex: none; }
/* camera scanning */
.scan { display: flex; gap: 8px; align-items: center; }
.scan input { flex: 1; }
.cam-scan { white-space: nowrap; }
.scan-video { width: 100%; max-height: 60vh; background: #000; border-radius: 8px; }
.dept-slip { break-after: page; page-break-after: always; }
.picker-row { display: flex; gap: 8px; align-items: flex-start; }
.picker-row > :first-child { flex: 1; }
.sign-line { margin-top: 14px; }
.bad-row td { background: #fff4f2; }
textarea.mono { font-family: ui-monospace, Consolas, monospace; font-size: 13px; width: 100%; }
.rep-logos { display: flex; gap: 6px; justify-content: flex-end; margin-top: 4px; }
.rep-logos img { height: 34px; width: auto; }
.rep-signature { display: block; height: 42px; width: auto; margin: 0 auto -6px; }
.logo-tile { text-align: center; } .logo-tile img { height: 48px; display: block; margin: 0 auto 4px; }
.draft-mark { text-align: center; font-weight: 700; color: #b42318; letter-spacing: .1em; margin-bottom: 6px; }

/* client portal */
.portal-main { max-width: 1100px; margin: 16px auto; padding: 0 12px; }
.tabs-row button { white-space: nowrap; }
.card-head .row.wrap > :not(.tabs-row) { flex-shrink: 0; white-space: nowrap; }
/* a radiology section (X-Ray, Ultrasound…) starts its own page */
@media print { .rep-dept.own-page { break-before: page; } }

/* the pending pop-up button in the top bar */
.alert-btn { min-height: 32px; padding: 4px 10px; border-radius: 999px; background: var(--bg); border: 1px solid var(--line); white-space: nowrap; }
.alert-btn.hot { background: #fff4e5; border-color: #f0a03c; color: #8a4b00; }
.alert-btn.stat { background: var(--danger-soft); border-color: var(--danger); color: var(--danger); animation: alert-pulse 1.6s ease-in-out 3; }
@keyframes alert-pulse { 50% { box-shadow: 0 0 0 4px rgb(220 38 38 / .25); } }
@media print { #alerts { display: none; } }
/* urgent per department on the bench screens */
.dept-urgent { display: flex; gap: 6px; flex-wrap: wrap; margin: 6px 0; }
.dept-urgent button { min-height: 28px; padding: 2px 10px; border-radius: 999px; border: 1px solid #f0a03c; background: #fff4e5; color: #8a4b00; font-size: 13px; }
.dept-urgent button.stat { border-color: var(--danger); background: var(--danger-soft); color: var(--danger); }
.doctor-pick { display: flex; flex-direction: column; gap: 2px; }
.doctor-pick .row input { flex: 1; min-width: 0; }
.find-box { min-width: 220px; }
.brand { white-space: nowrap; }
.patient-form .late-text { display: block; white-space: normal; }
#alerts { flex-shrink: 0; }
.alert-btn { display: inline-flex; align-items: center; gap: 4px; line-height: 1; max-height: 34px; }
.alert-btn > * { white-space: nowrap; }

/* Phase 16: the home dashboard */
.dash-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin: 8px 0; }
.dash-tile { display: flex; flex-direction: column; gap: 2px; background: var(--bg); border: 1px solid var(--line, #e4e7ec); border-radius: 10px; padding: 10px 12px; color: inherit; text-decoration: none; font-size: 13px; }
a.dash-tile:hover { border-color: var(--brand); }
.dash-tile .dash-num { font-size: 22px; font-weight: 700; }
.dash-tile.bad { border-color: var(--danger); background: var(--danger-soft); }
.dash-tile.bad .dash-num { color: var(--danger); }
.dash-tile.warn .dash-num { color: #b54708; }
.dash-tile.good .dash-num { color: var(--brand); }
.dash-quick { display: flex; flex-wrap: wrap; gap: 8px; }
.dash-btn { display: inline-flex; align-items: center; padding: 10px 14px; border-radius: 10px; background: var(--brand-soft); color: inherit; text-decoration: none; font-weight: 600; }
.dash-btn:hover { background: var(--brand); color: #fff; }
.dash-pick { padding-left: 20px; }
.dash-pick li { display: flex; align-items: center; gap: 6px; padding: 3px 0; }

/* long words or lines without spaces wrap instead of running off the report */
.lab-report, .rep-test, .narrative-peek { overflow-wrap: anywhere; }
.tpl-find { min-width: 180px; flex: 0 1 220px; }
.test-chips button { border-color: var(--line, #d0d5dd); background: #fff; color: inherit; }
.test-chips button.on { border-color: var(--brand); background: var(--brand-soft); }

/* OPD */
.error:empty { display: none; }
.opd-see { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 16px; align-items: start; }
.opd-see > aside { position: sticky; top: 70px; max-height: calc(100vh - 90px); overflow: auto; }
@media (max-width: 900px) { .opd-see { grid-template-columns: 1fr; } .opd-see > aside { position: static; } }
.vitals { display: flex; flex-wrap: wrap; gap: 8px; }
.vitals label { width: 110px; }
.vitals input { width: 100%; }
.token-big { font-size: 32px; font-weight: 700; text-align: center; margin: 8px 0; }
.rx { font-size: 13px; }
.rx h3 { margin: 10px 0 4px; font-size: 14px; }
.rx-block { margin: 6px 0; }
.rx .rx-sign { margin-top: 20mm; text-align: right; }
.vitals input { height: auto; }

/* blood bank bag label (50 x 25 mm) */
.bb-label { width: 48mm; font-size: 9px; line-height: 1.2; }
.bb-label .bb-group { font-size: 18px; font-weight: 700; float: right; }
.bb-label svg { max-width: 34mm; height: 9mm; }

/* raw machine messages, tokens and commands */
pre.raw { white-space: pre-wrap; word-break: break-all; background: var(--soft, #f3f6f8); padding: 8px 10px; border-radius: 8px; font-size: 12px; max-height: 60vh; overflow: auto; }
.card.sub { box-shadow: none; margin: 10px 0; }

/* finance summary */
.sum-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; margin: 8px 0 14px; }
.sum-tile { border: 1px solid var(--line, #dde3e8); border-radius: 10px; padding: 10px 12px; }
.sum-tile .sum-value { font-size: 20px; font-weight: 600; margin-top: 2px; }
.sum-tile.strong { border-color: var(--brand, #0f6b6b); }
.sum-tile.due .sum-value { color: var(--bad, #b42318); }
.branch-note { display: flex; flex-direction: column; gap: 4px; justify-content: flex-end; }
.fin-summary h3 { margin: 14px 0 6px; }

/* report headings centred (lab, 15 Nov 2026) */
.rep-head.centred { display: block; text-align: center; }
.rep-head.centred .rep-lab { font-size: 22px; }
.rep-head.centred .rep-title { margin-top: 4px; }
.rep-head.centred .rep-logos { justify-content: center; }
.rep-dept h3, .rep-test h4 { text-align: center; }
.report-preview .lab-report { margin: 0 auto; }

/* tubes: a coloured cap the phlebotomist sees at a glance */
.tube-chip { display: inline-flex; align-items: center; gap: 7px; padding: 5px 12px 5px 8px; border-radius: 999px; font-weight: 700; font-size: 14px; border-width: 2px; border: 1px solid #0002; background: #f4f4f5; color: #222; white-space: nowrap; }
.tube-chip .tube-sub { font-weight: 400; color: #555; }
.tube-ic { position: relative; width: 11px; height: 24px; border: 1px solid #0005; border-radius: 0 0 5px 5px; background: linear-gradient(#fff 0 35%, #e8e8ea 35%); box-sizing: border-box; margin-top: 4px; }
.tube-ic::before { content: ""; position: absolute; left: -3px; right: -3px; top: -7px; height: 9px; border-radius: 2px; background: var(--cap, #bbb); border: 1px solid #0004; }
.t-purple { background: #f3e5f5; border-color: #8e24aa; } .t-purple .tube-ic { --cap: #7b1fa2; }
.t-red { background: #ffebee; border-color: #d32f2f; } .t-red .tube-ic { --cap: #d32f2f; }
.t-yellow { background: #fff8e1; border-color: #f9a825; } .t-yellow .tube-ic { --cap: #fbc02d; }
.t-green { background: #e8f5e9; border-color: #2e7d32; } .t-green .tube-ic { --cap: #2e7d32; }
.t-blue { background: #e3f2fd; border-color: #1e88e5; } .t-blue .tube-ic { --cap: #42a5f5; }
.t-grey { background: #f0f0f0; border-color: #757575; } .t-grey .tube-ic { --cap: #9e9e9e; }
.t-black { background: #eceff1; border-color: #212121; } .t-black .tube-ic { --cap: #212121; }
.t-none { background: #fff; border: 1px dashed #c62828; color: #c62828; } .t-none .tube-ic { opacity: .4; }
/* a swab: a thin stick with a cotton tip */
.t-swab { background: #fafafa; border-color: #8d6e63; }
.t-swab .tube-ic { width: 3px; height: 22px; border: 0; border-radius: 2px; background: #a1887f; margin-top: 2px; }
.t-swab .tube-ic::before { left: -3px; right: -3px; top: -4px; height: 8px; border-radius: 50%; background: #fff; }
/* containers (urine, stool, sputum, fluid, culture bottle): a cup */
.t-urine .tube-ic, .t-stool .tube-ic, .t-cup .tube-ic { width: 14px; height: 14px; border-radius: 2px 2px 4px 4px; margin-top: 4px; }
.t-urine { background: #fffde7; border-color: #f9a825; } .t-urine .tube-ic { background: linear-gradient(#fff 0 40%, #ffe082 40%); --cap: #fff; }
.t-stool { background: #efebe9; border-color: #6d4c41; } .t-stool .tube-ic { --cap: #6d4c41; }
.t-cup .tube-ic { --cap: #fff; }

.tube-set select { width: auto; max-width: 220px; margin-top: 4px; }
/* one test's sheet: a row per patient, a box per value */
.sheet-grid .sheet-box { width: auto; min-width: 48px; height: 30px; }
.sheet-grid th { font-size: 11px; vertical-align: bottom; }
.sheet-grid tr { break-inside: avoid; }
.sheet-grid { font-size: 10px; table-layout: auto; }
.sheet-grid th, .sheet-grid td { padding: 3px 4px; }
.sheet-grid th.range { font-weight: 400; color: #444; }

/* printing on the counter's paper: header and footer space repeat on every page */
.page-frame { width: 100%; border-collapse: collapse; border: 0; }
.page-frame > thead > tr > td, .page-frame > tfoot > tr > td, .page-frame > tbody > tr > td { padding: 0; border: 0; }
.print-probe { position: absolute; left: -10000px; top: 0; visibility: hidden; }
/* a certificate is one page: tighter than a report */
.certificate .cert-photo { height: 32mm; }
.certificate .cert-tests td, .certificate .cert-tests th { padding: 3px 6px; }
.certificate .rep-foot .rep-sign { margin-top: 18px; }

/* the name strip repeated at the top of every printed page */
.pf-strip { font-size: 10px; color: #444; border-bottom: 1px solid #bbb !important; }
/* no stray line alone on a page: rows, the signatures and the opinion stay together */
.lab-report { orphans: 3; widows: 3; }
.rep-values tr, .cert-tests tr { break-inside: avoid; }
.rep-foot, .certificate .cert-verdict, .certificate .cert-remarks { break-inside: avoid; break-before: avoid; }
.certificate .cert-tests td:first-child, .certificate .cert-tests th:first-child { width: 32%; }
@media print { html, body { background: #fff !important; } }
tr.row-low td { background: #fef3f2; }
.dash-sub { font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted, #667); margin: 14px 0 6px; }

/* ---- client portal: making slips ---- */
.portal-book .form-grid { margin-bottom: 10px; }
.portal-book .picked { display: flex; flex-wrap: wrap; justify-content: flex-start; gap: 6px; margin: 8px 0; padding: 8px; background: none; }
.portal-book .picked .chip { display: inline-flex; gap: 6px; align-items: center; padding: 4px 8px; }
.portal-book .picked .chip button { border: 0; background: none; cursor: pointer; font-size: 14px; padding: 0 2px; }
.portal-book .bill-line { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; padding: 2px 0; }
.portal-book .bill-line.total { font-weight: 700; border-top: 1px solid var(--line); margin-top: 4px; padding-top: 6px; }
.portal-book .actions { margin-top: 10px; }
.portal-main .row-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
@media print {
  body[data-print="slip"] #home, body[data-print="slip"] #result, body[data-print="slip"] #ask,
  body[data-print="labels"] #home, body[data-print="labels"] #result, body[data-print="labels"] #ask { display: none !important; }
}
