/* LabLoop
   A working tool for lab staff, nurses, phlebotomists and couriers: quiet surfaces,
   one typeface, structure carried by type and spacing rather than boxes. Navy is the
   action color (from the logo); teal is kept for the logo and live timing only. */

@font-face {
  font-family: 'Plex';
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src: url(/static/vendor/fonts/ibm-plex-sans-latin-wght-normal.woff2) format('woff2-variations');
}

:root {
  --ink: #16213a;
  --ink-2: #4b5666;
  --ink-3: #78818f;
  --line: #e2e6ec;
  --line-2: #eef1f5;
  --bg: #f4f6f8;
  --card: #ffffff;
  --navy: #0d2a5c;
  --navy-deep: #082045;
  --accent: #0d2a5c;
  --accent-ink: #ffffff;
  --accent-soft: #e9eef7;
  --brand-navy: #0d2a5c;
  --brand-teal: #0a8f8f;
  --teal: #0a8f8f;
  --ok: #1d7a4c;
  --ok-soft: #e6f4ec;
  --warn: #8a5200;
  --warn-soft: #fbf1df;
  --bad: #b3261e;
  --bad-soft: #fbe9e7;
  --info: #2a5db0;
  --info-soft: #e9eff9;
  --radius: 8px;
  --radius-sm: 6px;
  --shadow: none;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font: 400 15px/1.5 'Plex', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  font-feature-settings: 'tnum' 1, 'cv11' 1;
  color: var(--ink);
  background: var(--bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
a { color: var(--navy); text-decoration-thickness: 1px; text-underline-offset: 2px; }
h1 { font-size: 24px; font-weight: 600; line-height: 1.2; margin: 0 0 4px; letter-spacing: -0.02em; color: var(--ink); }
h2 { font-size: 15px; font-weight: 600; margin: 0 0 12px; letter-spacing: -0.005em; }
h3 { font-size: 13px; font-weight: 600; margin: 0 0 10px; color: var(--ink-2); }
p { margin: 0 0 12px; }
.muted { color: var(--ink-3); }
.small { font-size: 13px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; word-break: break-all; }
:focus-visible { outline: 2px solid var(--navy); outline-offset: 2px; }

/* Header: one row. Logo, section links with an underline marker, account. */
.top {
  display: flex; align-items: stretch; gap: 28px;
  padding: 0 24px; background: var(--card); border-bottom: 1px solid var(--line);
  min-height: 56px;
}
.brand { display: flex; align-items: center; color: var(--ink); text-decoration: none; flex: none; }
.brand .logo { height: 28px; width: auto; display: block; }
.nav { display: flex; gap: 2px; flex: 1; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav a {
  display: flex; align-items: center; padding: 0 10px; white-space: nowrap;
  text-decoration: none; color: var(--ink-2); font-weight: 500; font-size: 14px;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.nav a:hover { color: var(--ink); }
.nav a.on { color: var(--navy); border-bottom-color: var(--navy); font-weight: 600; }
.who { display: flex; align-items: center; gap: 14px; margin-left: auto; font-size: 13.5px; flex: none; }
.who a { color: var(--ink-2); text-decoration: none; }
.who a:hover { color: var(--ink); }
.who form { margin: 0; }
.themebtn { background: none; border: 0; padding: 0; font: inherit; font-size: 13px; color: var(--ink-3); cursor: pointer; white-space: nowrap; }
.themebtn:hover { color: var(--ink); }
@media (max-width: 760px) {
  .top { flex-wrap: wrap; gap: 0 16px; padding: 0 16px; }
  .brand { height: 52px; }
  .who { height: 52px; }
  .nav { order: 3; flex-basis: 100%; border-top: 1px solid var(--line-2); margin: 0 -16px; padding: 0 12px; }
  .nav a { padding: 10px 8px; }
}

main { width: 100%; max-width: 1120px; margin: 0 auto; padding: 28px 24px 48px; flex: 1; }
main.narrow { max-width: 420px; padding-top: 64px; }
main.narrow .card { padding: 28px; }
main.narrow h1 { font-size: 26px; }
.foot { text-align: center; color: var(--ink-3); font-size: 12px; padding: 20px 16px 24px; }
@media (max-width: 760px) { main { padding: 20px 16px 40px; } }

/* Page head */
.pagehead { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 20px; }
.pagehead .sub { color: var(--ink-3); font-size: 14px; }

/* Cards: a hairline and white, nothing else. Grouping comes from space. */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin-bottom: 16px; }
.card.tight { padding: 0; overflow: hidden; }
.grid { display: grid; gap: 16px; }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.grid.three { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.stats { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); margin-bottom: 18px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.stat .n { font-size: 28px; font-weight: 500; line-height: 1.1; letter-spacing: -0.02em; }
.stat .l { color: var(--ink-3); font-size: 13px; }
.stat.warn .n { color: var(--warn); }
.stat.bad .n { color: var(--bad); }

dl.kv { display: grid; grid-template-columns: max-content 1fr; gap: 7px 18px; margin: 0; }
dl.kv dt { color: var(--ink-3); font-size: 13.5px; padding-top: 1px; }
dl.kv dd { margin: 0; }

/* Tables (become stacked cards on phones) */
table.list { width: 100%; border-collapse: collapse; }
table.list th { text-align: left; font-size: 13px; color: var(--ink-3); font-weight: 500; padding: 10px 16px; border-bottom: 1px solid var(--line); }
table.list td { padding: 12px 16px; border-bottom: 1px solid var(--line-2); vertical-align: top; }
table.list tr:last-child td { border-bottom: 0; }
table.list tr.rowlink { cursor: pointer; }
table.list tr.rowlink:hover td { background: #f8f9fb; }
table.list .num { font-variant-numeric: tabular-nums; }
table.list td a { text-decoration: none; font-weight: 500; }
table.list td a:hover { text-decoration: underline; }
.empty { padding: 32px; text-align: center; color: var(--ink-3); }
@media (max-width: 720px) {
  table.list thead { display: none; }
  table.list, table.list tbody, table.list tr, table.list td { display: block; width: 100%; }
  table.list tr { border-bottom: 1px solid var(--line); padding: 10px 0; }
  table.list td { border: 0; padding: 3px 16px; }
  table.list td[data-label]::before { content: attr(data-label); display: block; font-size: 12px; color: var(--ink-3); }
}

/* Pills: tinted text on a soft field; status reads at a glance, never shouts. */
.pill { display: inline-block; padding: 2px 8px; border-radius: var(--radius-sm); font-size: 12.5px; font-weight: 500; white-space: nowrap; line-height: 1.5; }
.s-pending_signature { background: var(--warn-soft); color: var(--warn); }
.s-signed { background: var(--ok-soft); color: var(--ok); }
.s-received { background: var(--info-soft); color: var(--info); }
.s-declined { background: var(--bad-soft); color: var(--bad); }
.s-cancelled { background: var(--line-2); color: var(--ink-2); }
.pill.stat { background: var(--bad); color: #fff; margin-left: 6px; font-weight: 600; letter-spacing: 0.02em; }
.pill.neutral { background: var(--line-2); color: var(--ink-2); }
.wait { font-size: 12.5px; color: var(--ink-3); margin-left: 6px; white-space: nowrap; }
.wait.warn { color: var(--warn); font-weight: 500; }
.wait.late { color: var(--bad); font-weight: 500; }

/* Forms */
form { margin: 0; }
label { display: block; font-weight: 500; font-size: 13.5px; margin: 0 0 5px; color: var(--ink-2); }
.field { margin-bottom: 14px; }
.field .hint { font-size: 12.5px; color: var(--ink-3); margin-top: 4px; font-weight: 400; }
input:not([type]), input[type=text], input[type=email], input[type=password], input[type=tel], input[type=date], input[type=datetime-local],
input[type=number], input[type=url], select, textarea {
  width: 100%; padding: 9px 12px; font: inherit; color: var(--ink);
  border: 1px solid #cfd6df; border-radius: var(--radius-sm); background: #fff;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--navy); outline-offset: -1px; border-color: var(--navy); }
textarea { min-height: 80px; resize: vertical; }
.row { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; color: var(--ink); font-size: 14px; margin-bottom: 8px; }
.check input { margin-top: 3px; width: 17px; height: 17px; flex: none; accent-color: var(--navy); }
.checks { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 2px 16px; }
.checkgroup { margin-bottom: 10px; }
.checkgroup .gl { font-size: 13px; color: var(--ink-3); margin: 6px 0; }
fieldset { border: 0; padding: 0; margin: 0; }
legend { font-weight: 600; font-size: 15px; margin-bottom: 12px; padding: 0; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 16px; font: inherit; font-weight: 500; border-radius: var(--radius-sm); border: 1px solid var(--navy);
  background: var(--navy); color: var(--accent-ink); cursor: pointer; text-decoration: none; line-height: 1.4;
}
.btn:hover { background: var(--navy-deep); border-color: var(--navy-deep); }
.btn.secondary { background: #fff; color: var(--navy); border-color: #cfd6df; }
.btn.secondary:hover { background: var(--accent-soft); border-color: #cfd6df; }
.btn.danger { background: var(--bad); border-color: var(--bad); }
.btn.danger:hover { background: #961f18; border-color: #961f18; }
.btn.big { width: 100%; padding: 13px 16px; font-size: 16px; }
.btn.sm { padding: 5px 10px; font-size: 13px; }
.linkish { background: none; border: 0; padding: 0; font: inherit; color: var(--ink-2); cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

/* Flash */
.flash { padding: 12px 14px; border-radius: var(--radius); margin-bottom: 16px; font-size: 14px; border: 1px solid transparent; }
.flash ul { margin: 6px 0 0; padding-left: 18px; }
.flash.ok { background: var(--ok-soft); color: #14532d; border-color: #c3e4d0; }
.flash.err { background: var(--bad-soft); color: #7f1d1d; border-color: #f0c7c3; }
.flash.warn { background: var(--warn-soft); color: #6b3f00; border-color: #efd9ab; }

/* Order header + signing */
.orderhead { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.orderhead .meta { color: var(--ink-3); font-size: 14px; }
.signbox { border: 1.5px solid var(--navy); }
.signbox .attest { background: var(--accent-soft); border-radius: var(--radius-sm); padding: 12px; margin: 12px 0; }
.tests li { margin-bottom: 4px; }
.tests { padding-left: 18px; margin: 0; }
details.more { margin-top: 12px; }
details.more summary { cursor: pointer; font-weight: 500; color: var(--ink-2); padding: 6px 0; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: grid; grid-template-columns: 150px 1fr; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line-2); font-size: 14px; }
.timeline li:last-child { border-bottom: 0; }
.timeline .t { color: var(--ink-3); font-size: 13px; }
@media (max-width: 560px) { .timeline li { grid-template-columns: 1fr; gap: 0; } }

.secret { background: #141b26; color: #e6eef3; padding: 12px 14px; border-radius: var(--radius-sm); font-family: ui-monospace, Menlo, monospace; font-size: 13px; word-break: break-all; }
.qr { display: block; width: 200px; height: 200px; margin: 8px auto 12px; image-rendering: pixelated; }
.code-input { font-size: 22px !important; letter-spacing: 0.3em; text-align: center; font-variant-numeric: tabular-nums; }
.age-ok { color: var(--teal); }
.age-warn { color: var(--warn); font-weight: 500; }
.age-bad { color: var(--bad); font-weight: 500; }
.seg { display: inline-flex; background: var(--line-2); padding: 3px; border-radius: var(--radius-sm); gap: 2px; margin-bottom: 4px; }
.seg label { margin: 0; cursor: pointer; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span { display: inline-block; padding: 7px 18px; border-radius: 4px; font-weight: 500; color: var(--ink-2); font-size: 15px; }
.seg input:checked + span { background: var(--card); color: var(--ink); box-shadow: 0 1px 2px rgba(22, 33, 58, 0.12); }
.seg input:focus-visible + span { outline: 2px solid var(--navy); outline-offset: 2px; }
.who-box { display: grid; gap: 10px 16px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px 14px; margin: 12px 0; }
.who-box strong { display: block; font-size: 14px; }
.who-box .small { color: var(--ink-2); }
.lbl-a { font-size: 13px; font-weight: 600; color: var(--navy); }
[hidden] { display: none !important; }
.pill.type { background: var(--line-2); color: var(--ink-2); margin-right: 6px; }
.track-tiles { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); margin-bottom: 18px; }
.track-tile { display: flex; gap: 14px; align-items: flex-start; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; text-decoration: none; color: var(--ink); }
.track-tile:hover { border-color: var(--ink-3); }
.track-tile .ico { display: grid; place-items: center; width: 40px; height: 40px; border-radius: var(--radius-sm); background: var(--accent-soft); color: var(--navy); flex: none; }
.track-tile.warn .ico { background: var(--warn-soft); color: var(--warn); }
.track-tile.bad .ico { background: var(--bad-soft); color: var(--bad); }
.track-tile .n { display: block; font-size: 28px; font-weight: 500; line-height: 1.1; letter-spacing: -0.02em; }
.track-tile.warn .n { color: var(--warn); }
.track-tile .l { display: block; font-weight: 600; }
.track-tile .s { display: block; font-size: 13px; color: var(--ink-3); }
.pill.missing { background: var(--bad-soft); color: var(--bad); text-decoration: none; margin-left: 4px; }
tr.late-row td:first-child { box-shadow: inset 3px 0 0 var(--bad); }
table.mini { margin-top: 6px; border-collapse: collapse; font-size: 12.5px; }
table.mini td { padding: 2px 10px 2px 0; border: 0; }
.filters { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 14px; }
.filters a { padding: 5px 10px; border-radius: var(--radius-sm); text-decoration: none; color: var(--ink-2); font-size: 13.5px; background: transparent; border: 1px solid transparent; }
.filters a:hover { background: var(--line-2); }
.filters a.on { background: var(--card); color: var(--ink); border-color: var(--line); font-weight: 500; }
.inline-form { display: inline; }
hr.sep { border: 0; border-top: 1px solid var(--line); margin: 16px 0; }

/* The pipeline: the order's journey as one connected strip. Each stage is a
   step the specimen takes; the hairline between them says so, so no numbering. */
.steps-tiles { display: grid; gap: 0; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); margin-bottom: 20px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.step-tile { display: flex; flex-direction: column; gap: 2px; padding: 16px 18px 14px; color: inherit; text-decoration: none; border-right: 1px solid var(--line-2); position: relative; min-height: 132px; }
.step-tile:last-child { border-right: 0; }
.step-tile:hover, .step-tile:focus-visible { background: #f8f9fb; outline: none; }
.step-tile .top { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 0; margin-bottom: 10px; background: none; border: 0; min-height: 0; }
.step-tile .ico, .step-ico { display: grid; place-items: center; width: 30px; height: 30px; border-radius: var(--radius-sm); background: var(--accent-soft); color: var(--navy); flex: none; }
.step-tile .num { display: none; }
.step-tile .n { font-size: 30px; font-weight: 500; line-height: 1.05; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.step-tile .l { font-weight: 600; font-size: 14px; margin-top: 4px; }
.step-tile .s { font-size: 12.5px; color: var(--ink-3); line-height: 1.4; }
.step-tile.warn .ico { background: var(--warn-soft); color: var(--warn); }
.step-tile.warn .n { color: var(--warn); }
.step-tile.bad .ico { background: var(--bad-soft); color: var(--bad); }
.step-tile.bad .n { color: var(--bad); }
.step-head { display: flex; gap: 12px; align-items: center; }
@media (max-width: 760px) {
  .steps-tiles { grid-template-columns: 1fr 1fr; }
  .step-tile { border-bottom: 1px solid var(--line-2); min-height: 0; }
  .step-tile:nth-child(2n) { border-right: 0; }
  .step-tile:last-child, .step-tile:nth-last-child(2):nth-child(odd) { border-bottom: 0; }
}

/* Route sketch + field app */
.routemap { width: 100%; height: auto; background: #f6f8fa; border-radius: var(--radius); border: 1px solid var(--line); }
.routemap .leg { fill: none; stroke: var(--navy); stroke-width: 3; stroke-dasharray: 6 6; stroke-linecap: round; opacity: .7; }
.routemap .start { fill: var(--ink); }
.routemap .pin circle { fill: var(--teal); stroke: #fff; stroke-width: 3; }
.routemap .pin.stat circle, .routemap .pin.late circle { fill: var(--bad); }
.routemap .pin.issue circle { fill: var(--warn); }
.routemap .pin text { fill: #fff; font-size: 13px; font-weight: 700; }
.route-sum { display: flex; flex-wrap: wrap; gap: 8px 18px; align-items: center; }
.route-sum .big { font-size: 22px; font-weight: 700; }
.stop { display: grid; grid-template-columns: 40px 1fr; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--line-2); }
.stop:last-child { border-bottom: 0; }
.stop .badge { width: 32px; height: 32px; border-radius: 50%; background: var(--navy); color: #fff; display: grid; place-items: center; font-weight: 700; }
.stop.stat .badge, .stop.late .badge { background: var(--bad); }
.stop.issue .badge { background: var(--warn); }
.stop .place { font-weight: 600; }
.stop .addr { color: var(--ink-2); font-size: 14px; }
.stop .meta { font-size: 13px; color: var(--ink-3); margin-top: 2px; }
.stop .orders { margin: 8px 0 0; padding: 0; list-style: none; display: grid; gap: 6px; }
.stop .orders a { display: flex; justify-content: space-between; gap: 8px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); text-decoration: none; color: var(--ink); background: var(--card); }
.stop .acts { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.photos { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.photos img { width: 92px; height: 92px; object-fit: cover; border-radius: var(--radius-sm); border: 1px solid var(--line); }
.camera input[type=file] { padding: 14px; border: 1.5px dashed var(--navy); border-radius: var(--radius-sm); width: 100%; background: var(--accent-soft); }
.geo-note { font-size: 12.5px; color: var(--ink-3); }
a.back { display: inline-block; margin-bottom: 12px; text-decoration: none; font-weight: 500; font-size: 14px; color: var(--ink-2); }
a.back:hover { color: var(--navy); }
.stop .orders a span:last-child { color: var(--ink-3); align-self: center; }

/* In-app navigation */
.nav-app { display: grid; gap: 10px; }
.nav-banner { display: flex; gap: 14px; align-items: center; background: var(--navy); color: #fff; border-radius: var(--radius); padding: 14px 16px; position: sticky; top: 0; z-index: 5; }
.nav-dist { font-size: 26px; font-weight: 700; min-width: 72px; }
.nav-text { font-size: 17px; font-weight: 600; line-height: 1.3; }
.nav-map { height: 52vh; min-height: 300px; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); background: #eef5f6; }
.nav-nomap { padding: 24px; color: var(--ink-3); text-align: center; }
.nav-pin { width: 30px; height: 30px; border-radius: 50%; background: var(--navy); color: #fff; font-weight: 700; display: grid; place-items: center; border: 3px solid #fff; box-shadow: 0 2px 6px rgba(0,0,0,.25); }
.nav-pin.stat { background: var(--bad); }
.nav-stop { display: grid; grid-template-columns: 40px 1fr; gap: 12px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.nav-stop .badge { width: 32px; height: 32px; border-radius: 50%; background: var(--navy); color: #fff; display: grid; place-items: center; font-weight: 700; }
.nav-stop.stat .badge { background: var(--bad); }
.nav-stop .place { font-weight: 600; } .nav-stop .addr { color: var(--ink-2); font-size: 14px; } .nav-stop .meta { color: var(--ink-3); font-size: 13px; }
.nav-pat { display: flex; justify-content: space-between; gap: 8px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); margin-top: 8px; text-decoration: none; color: var(--ink); }
.nav-stop .acts { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.nav-tools { display: flex; gap: 8px; flex-wrap: wrap; }
.nav-steps { margin: 0; padding: 0; list-style: none; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
.nav-steps li { display: flex; justify-content: space-between; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--line-2); font-size: 14px; }
.nav-steps li.on { background: var(--accent-soft); font-weight: 600; }
.nav-pat2 { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 12px; margin-top: 8px; }
.nav-pat-h { display: flex; justify-content: space-between; gap: 8px; align-items: flex-start; }
.nav-pat-acts { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.nav-pat-acts .btn { flex: 1 1 auto; }
.nav-panel { display: grid; gap: 8px; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line-2); }
.nav-panel .camera { display: block; border: 1.5px dashed var(--navy); background: var(--accent-soft); color: var(--accent); border-radius: var(--radius-sm); padding: 12px; text-align: center; font-weight: 600; }
.nav-panel .camera input { display: block; width: 100%; margin-top: 6px; }
.nav-toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--navy); color: #fff; padding: 10px 16px; border-radius: var(--radius-sm); z-index: 50; max-width: calc(100% - 32px); }
.nav-notes { background: var(--warn-soft); border-radius: var(--radius-sm); padding: 8px 10px; display: grid; gap: 4px; font-size: 14px; }
.nav-order dl.kv { font-size: 14px; }
.checklist { list-style: none; margin: 0 0 10px; padding: 0; display: grid; gap: 8px; }
.checklist li { display: grid; grid-template-columns: 24px 1fr; gap: 8px; align-items: start; font-size: 14px; }
.checklist .ic { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: 13px; font-weight: 700; color: #fff; background: var(--ink-3); }
.checklist li.ok .ic { background: var(--ok); }
.checklist li.missing .ic { background: var(--bad); }
.checklist li.check .ic { background: var(--warn); }
.checklist li.na .ic { background: #b8c3ce; }
.medicare form.row { align-items: end; }
.later-row { display: flex; justify-content: space-between; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line-2); }
.later-row:last-child { border-bottom: 0; }
.label-links a { white-space: nowrap; }

/* Patients: companies, filters, bulk move */
.pill.tag { background: var(--accent-soft); color: var(--navy); font-weight: 500; margin: 0 4px 4px 0; }
.ptfilters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.ptfilters > * { margin: 0; }
.ptfilters input[name="q"] { flex: 2 1 220px; }
.ptfilters select { flex: 1 1 160px; }
.bulkbar { align-items: center; margin: 0 0 8px; flex-wrap: wrap; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }
.tagform { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.tagform select, .tagform input { flex: 1 1 150px; }
.inline-btn { display: inline; }
.inline-btn button { background: none; border: 0; color: var(--ink-3); cursor: pointer; padding: 0 2px; font-size: 13px; }
.movehist li { margin-bottom: 6px; }

/* Settings */
.setgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
a.setcard { display: flex; flex-direction: column; gap: 6px; text-decoration: none; color: var(--ink); margin: 0; }
a.setcard:hover { border-color: var(--ink-3); }
a.setcard h2 { margin: 0; }
.setstat { font-size: 13px; margin-top: 6px; color: var(--ink-2); }
.setcta { margin-top: auto; padding-top: 12px; color: var(--navy); font-weight: 500; font-size: 14px; }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.warn { background: #fff4e0; color: #8a5a00; }
.checklist2 { padding-left: 18px; margin: 6px 0 10px; }
.checklist2 li { margin-bottom: 6px; }

/* County routes */
.routegrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; margin-bottom: 14px; }
a.routecard { display: flex; flex-direction: column; gap: 8px; text-decoration: none; color: var(--ink); margin: 0; }
a.routecard:hover { border-color: var(--ink-3); }
a.routecard.warnbox { border-color: #f0c36d; background: #fffaf0; }
.rc-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.rc-stats { display: flex; gap: 14px; font-size: 13px; color: var(--ink-2); }
.pill.county { background: var(--line-2); color: var(--ink-2); }
.pill.c-weber { background: #e6f0fb; color: #1d4f91; }
.pill.c-davis { background: #e8f6ee; color: #1f6b3a; }
.pill.c-salt_lake { background: #fdeee6; color: #8a3b12; }
.pill.c-utah { background: #f1eafb; color: #5b2d91; }
.stopctl { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; align-items: center; }
.stopctl select { max-width: 220px; }
pre.hl7 { white-space: pre-wrap; word-break: break-all; font: 12px/1.5 ui-monospace, Menlo, monospace; background: #f6f8fa; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px; max-height: 360px; overflow: auto; }
.stop.ups { background: #fffbf2; }
.stop.ups .badge { background: #6b4a1f; color: #fff; font-size: 11px; }
.pill.ups-pill { background: #6b4a1f; color: #fff; }
.dropform { margin-top: 10px; display: grid; gap: 8px; max-width: 460px; }




/* ---------- Dark theme ----------
   Follows the device (prefers-color-scheme) unless the person picks Light or Dark
   with the header toggle (stored in the "theme" cookie -> <html data-theme>).
   Same structure, inverted ink: no glow, no tinted blacks. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ink: #e8ecf2; --ink-2: #b4bcc8; --ink-3: #8a93a1; --line: #2b3240; --line-2: #222835; --bg: #12161d; --card: #191e27;
    --navy: #8fb0e8; --navy-deep: #a9c3f0; --accent: #8fb0e8; --accent-ink: #0d1a33; --accent-soft: #1e2a3f; --brand-navy: #8fb0e8; --brand-teal: #4fbdbb; --teal: #4fbdbb;
    --ok: #62c48d; --ok-soft: #16301f; --warn: #e3ac55; --warn-soft: #33270f; --bad: #f0857d; --bad-soft: #3a1b19;
    --info: #86adf0; --info-soft: #182640; color-scheme: dark;
  }
  :root:not([data-theme="light"]) .brand .logo { filter: invert(1) hue-rotate(180deg) brightness(1.15); }
  :root:not([data-theme="light"]) input:not([type=checkbox]):not([type=radio]), :root:not([data-theme="light"]) select, :root:not([data-theme="light"]) textarea { background: #12161d; border-color: #3a4352; color: var(--ink); }
  :root:not([data-theme="light"]) .btn.secondary { background: var(--card); color: var(--ink); border-color: var(--line); }
  :root:not([data-theme="light"]) .btn.secondary:hover { background: var(--accent-soft); }
  :root:not([data-theme="light"]) .filters a.on { background: var(--card); color: var(--ink); border-color: var(--line); }
  :root:not([data-theme="light"]) table.list tr.rowlink:hover td, :root:not([data-theme="light"]) .step-tile:hover { background: #1f2531; }
  :root:not([data-theme="light"]) .seg input:checked + span { background: #2a3140; box-shadow: none; }
  :root:not([data-theme="light"]) .flash.ok { color: #b9ebcd; border-color: #24563a; }
  :root:not([data-theme="light"]) .flash.err { color: #ffc7c2; border-color: #6a2b27; }
  :root:not([data-theme="light"]) .flash.warn { color: #f5d49a; border-color: #5e4518; }
  :root:not([data-theme="light"]) .routemap, :root:not([data-theme="light"]) .nav-map, :root:not([data-theme="light"]) pre.hl7 { background: #12161d; }
  :root:not([data-theme="light"]) .pill.warn { background: var(--warn-soft); color: var(--warn); }
  :root:not([data-theme="light"]) a.routecard.warnbox { border-color: #5e4518; background: #2a2210; }
  :root:not([data-theme="light"]) .pill.c-weber { background: #1b2b44; color: #9cc0f2; }
  :root:not([data-theme="light"]) .pill.c-davis { background: #16301f; color: #8fd4a8; }
  :root:not([data-theme="light"]) .pill.c-salt_lake { background: #3a2116; color: #f0b08f; }
  :root:not([data-theme="light"]) .pill.c-utah { background: #2a1f3d; color: #c9aef0; }
  :root:not([data-theme="light"]) .stop.ups { background: #2c2312; }
  :root:not([data-theme="light"]) .stop.ups .badge, :root:not([data-theme="light"]) .pill.ups-pill { background: #e0b26a; color: #1a1408; }
  :root:not([data-theme="light"]) .checklist li.na .ic { background: #4a5860; }
  :root:not([data-theme="light"]) .secret { background: #0c0f14; }
}
:root[data-theme="dark"] {
  --ink: #e8ecf2; --ink-2: #b4bcc8; --ink-3: #8a93a1; --line: #2b3240; --line-2: #222835; --bg: #12161d; --card: #191e27;
  --navy: #8fb0e8; --navy-deep: #a9c3f0; --accent: #8fb0e8; --accent-ink: #0d1a33; --accent-soft: #1e2a3f; --brand-navy: #8fb0e8; --brand-teal: #4fbdbb; --teal: #4fbdbb;
  --ok: #62c48d; --ok-soft: #16301f; --warn: #e3ac55; --warn-soft: #33270f; --bad: #f0857d; --bad-soft: #3a1b19;
  --info: #86adf0; --info-soft: #182640; color-scheme: dark;
}
:root[data-theme="dark"] .brand .logo { filter: invert(1) hue-rotate(180deg) brightness(1.15); }
:root[data-theme="dark"] input:not([type=checkbox]):not([type=radio]), :root[data-theme="dark"] select, :root[data-theme="dark"] textarea { background: #12161d; border-color: #3a4352; color: var(--ink); }
:root[data-theme="dark"] .btn.secondary { background: var(--card); color: var(--ink); border-color: var(--line); }
:root[data-theme="dark"] .btn.secondary:hover { background: var(--accent-soft); }
:root[data-theme="dark"] .filters a.on { background: var(--card); color: var(--ink); border-color: var(--line); }
:root[data-theme="dark"] table.list tr.rowlink:hover td, :root[data-theme="dark"] .step-tile:hover { background: #1f2531; }
:root[data-theme="dark"] .seg input:checked + span { background: #2a3140; box-shadow: none; }
:root[data-theme="dark"] .flash.ok { color: #b9ebcd; border-color: #24563a; }
:root[data-theme="dark"] .flash.err { color: #ffc7c2; border-color: #6a2b27; }
:root[data-theme="dark"] .flash.warn { color: #f5d49a; border-color: #5e4518; }
:root[data-theme="dark"] .routemap, :root[data-theme="dark"] .nav-map, :root[data-theme="dark"] pre.hl7 { background: #12161d; }
:root[data-theme="dark"] .pill.warn { background: var(--warn-soft); color: var(--warn); }
:root[data-theme="dark"] a.routecard.warnbox { border-color: #5e4518; background: #2a2210; }
:root[data-theme="dark"] .pill.c-weber { background: #1b2b44; color: #9cc0f2; }
:root[data-theme="dark"] .pill.c-davis { background: #16301f; color: #8fd4a8; }
:root[data-theme="dark"] .pill.c-salt_lake { background: #3a2116; color: #f0b08f; }
:root[data-theme="dark"] .pill.c-utah { background: #2a1f3d; color: #c9aef0; }
:root[data-theme="dark"] .stop.ups { background: #2c2312; }
:root[data-theme="dark"] .stop.ups .badge, :root[data-theme="dark"] .pill.ups-pill { background: #e0b26a; color: #1a1408; }
:root[data-theme="dark"] .checklist li.na .ic { background: #4a5860; }
:root[data-theme="dark"] .secret { background: #0c0f14; }

/* The primary button keeps dark ink on its light-blue fill in dark mode. */
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .btn:not(.secondary):not(.danger) { color: var(--accent-ink); } }
:root[data-theme="dark"] .btn:not(.secondary):not(.danger) { color: var(--accent-ink); }


/* NIIMBOT label printing */
.linkbtn { background: none; border: 0; padding: 0; font: inherit; color: var(--navy); text-decoration: underline; cursor: pointer; }
dialog.niim { border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; max-width: 560px; width: calc(100% - 32px); background: var(--card, #fff); color: var(--ink); }
dialog.niim::backdrop { background: rgba(0, 0, 0, 0.45); }
dialog.niim h3 { margin: 0 0 10px; }
.niim-row { display: flex; flex-wrap: wrap; gap: 12px; }
.niim-row label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.niim-preview { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }
.niim-preview canvas { width: 160px; height: auto; border: 1px solid var(--line); border-radius: 4px; background: #fff; image-rendering: pixelated; }
.niim-status.bad { color: var(--bad); }
.niim-actions { display: flex; flex-wrap: wrap; gap: 8px; }
