/* Plain CSS only (no nesting, no newest features) so it also works in older Chrome/Edge builds. */
:root {
    --bg: #eef2f7;
    --surface: #ffffff;
    --text: #1d2433;
    --muted: #5d6779;
    --line: #d9e0ea;
    --primary: #1f63c6;
    --primary-hover: #1853a8;
    --side-1: #1b55ad;
    --side-2: #2a7ad8;
    --side-text: #eaf2ff;
    --side-hover: rgba(255, 255, 255, 0.14);
    --strip: #232833;
    --ok: #1b8a4b;
    --bad: #c9302c;
    --bar-reg: #e5484d;
    --bar-res: #2f6fde;
    --bar-prn: #f0932b;
    --radius: 8px;
    --shadow: 0 1px 2px rgba(16, 24, 40, 0.06), 0 1px 3px rgba(16, 24, 40, 0.08);
}

* { box-sizing: border-box; }

html, body { margin: 0; height: 100%; }

body {
    background: var(--bg);
    color: var(--text);
    font: 14px/1.45 "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
}

a { color: var(--primary); }

.ico {
    width: 18px; height: 18px; flex: none;
    fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round;
}

.muted { color: var(--muted); }

/* ---------- Shell ---------- */
.shell { display: flex; min-height: 100vh; }

.sidebar {
    position: sticky; top: 0; height: 100vh;
    width: 220px; flex: none;
    display: flex; flex-direction: column;
    background: linear-gradient(180deg, var(--side-1), var(--side-2));
    color: var(--side-text);
    z-index: 20;
}

.brand {
    display: flex; align-items: center; gap: 10px;
    padding: 18px 18px 14px;
    color: #fff; text-decoration: none;
    font-size: 20px; font-weight: 600; letter-spacing: 0.04em;
}
.brand .ico { width: 30px; height: 30px; padding: 4px; border-radius: 50%; background: #fff; color: var(--bar-reg); }

.nav { flex: 1; padding: 4px 0; }
.nav-section { list-style: none; margin: 0; padding: 6px 0; border-bottom: 1px solid rgba(255, 255, 255, 0.18); }
.nav-section:last-child { border-bottom: 0; }

.nav-group { position: relative; }

.nav-link {
    display: flex; align-items: center; gap: 10px; width: 100%;
    padding: 7px 18px;
    border: 0; background: none; color: inherit; font: inherit;
    text-align: left; text-decoration: none; text-transform: uppercase; letter-spacing: 0.03em;
    cursor: pointer;
}
.nav-link .chev { margin-left: auto; opacity: 0.7; }
.nav-group:hover > .nav-link,
.nav-group:focus-within > .nav-link { background: var(--side-hover); }
.nav-group.active > .nav-link { background: rgba(0, 0, 0, 0.22); box-shadow: inset 3px 0 0 #fff; }

.flyout {
    display: none;
    position: absolute; left: 100%; top: 0;
    min-width: 210px; margin: 0; padding: 6px 0;
    list-style: none;
    background: var(--surface); color: var(--text);
    border: 1px solid var(--line); border-radius: var(--radius);
    box-shadow: 0 8px 24px rgba(16, 24, 40, 0.18);
}
/* Groups near the bottom open upwards so the flyout stays on screen. */
.nav-section:last-child .flyout { top: auto; bottom: 0; }
.nav-group:hover > .flyout,
.nav-group:focus-within > .flyout { display: block; }

.flyout-link { display: block; padding: 6px 16px; color: inherit; text-decoration: none; white-space: nowrap; }
.flyout-link:hover, .flyout-link:focus { background: #e9f1fd; color: var(--primary); outline: none; }
.flyout-link.disabled { color: #a3abb8; cursor: default; }

.sidebar-foot {
    display: flex; justify-content: space-between;
    padding: 10px 18px; font-size: 12px; opacity: 0.8;
}

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
    display: flex; align-items: center; justify-content: space-between; gap: 16px;
    padding: 10px 20px;
    background: var(--surface); border-bottom: 1px solid var(--line);
}
.lab { display: flex; align-items: center; gap: 12px; }
.lab-logo { width: 44px; height: 44px; object-fit: contain; }
.lab-name { font-size: 17px; font-weight: 600; text-transform: uppercase; }
.lab-year { color: var(--muted); font-size: 13px; }
.user { display: flex; align-items: center; gap: 12px; }
.user form { margin: 0; }

.page-title { background: var(--strip); color: #fff; padding: 8px 20px; }
.page-title h1 { margin: 0; font-size: 16px; font-weight: 500; }

.content { padding: 16px 20px 28px; }

/* ---------- Controls ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    padding: 7px 16px; border: 1px solid transparent; border-radius: 6px;
    font: inherit; font-weight: 600; text-decoration: none; cursor: pointer;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-primary:disabled { opacity: 0.6; cursor: progress; }
.btn-ghost { background: none; color: var(--text); border-color: var(--line); padding: 5px 10px; }
.btn-ghost:hover { background: #f2f5f9; }
.btn-block { width: 100%; }

input[type="text"], input[type="password"], input[type="date"], input[type="number"], input[type="email"],
input[type="search"], input:not([type]), select {
    padding: 7px 10px; border: 1px solid #b9c3d1; border-radius: 6px;
    font: inherit; color: inherit; background: #fff; min-width: 0;
}
input:focus, select:focus { outline: 2px solid rgba(31, 99, 198, 0.35); border-color: var(--primary); }
input:disabled, select:disabled { background: #f2f4f7; color: #8a94a3; }
input[readonly] { background: #f5f7fa; }
.input-validation-error { border-color: var(--bad) !important; background: #fff6f6; }

.alert { padding: 10px 14px; border-radius: 6px; margin-bottom: 14px; }
.alert-ok { background: #e6f5ec; color: #135c33; border: 1px solid #b8e2c8; }
.alert-error { background: #fdecec; color: #8f1f1c; border: 1px solid #f3c1bf; }
.alert-error ul { margin: 0; padding-left: 18px; }
.validation-summary-valid { display: none; }
.field-error { color: var(--bad); font-size: 13px; }

/* ---------- Cards & dashboard ---------- */
.card {
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
    box-shadow: var(--shadow); padding: 14px 16px;
}
.card h2 { margin: 0; font-size: 16px; }
.card h3 { margin: 0 0 10px; font-size: 13px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }

.card-head { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 8px; }
.month-nav { display: flex; align-items: center; gap: 8px; }
.month-nav strong { min-width: 120px; text-align: center; }

.legend { display: flex; gap: 14px; margin: 0 0 0 auto; padding: 0; list-style: none; font-size: 13px; color: var(--muted); }
.sw { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; }
.sw-reg { background: var(--bar-reg); }
.sw-res { background: var(--bar-res); }
.sw-prn { background: var(--bar-prn); }

.chart { display: block; width: 100%; height: auto; }
.chart .grid { stroke: #e7ecf2; }
.chart .baseline { stroke: #9aa5b5; }
.chart .axis { fill: var(--muted); font-size: 11px; }
.chart .bar-reg { fill: var(--bar-reg); }
.chart .bar-res { fill: var(--bar-res); }
.chart .bar-prn { fill: var(--bar-prn); }
.chart g:hover rect { opacity: 0.8; }

.filter { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 14px 0; }
.radio { display: inline-flex; align-items: center; gap: 4px; cursor: pointer; }

.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.tile-split { display: flex; align-items: center; gap: 18px; }
.big { font-size: 40px; font-weight: 600; min-width: 60px; text-align: center; }
.kv { display: grid; grid-template-columns: auto auto; gap: 4px 16px; margin: 0; flex: 1; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.kv-wide { grid-template-columns: 1fr auto; }
.pair { display: flex; justify-content: space-around; text-align: center; }
.num { font-size: 28px; font-weight: 600; }
.ok { color: var(--ok); }
.bad { color: var(--bad); }
.links { display: flex; flex-direction: column; gap: 6px; }
.tile form { margin: 0; }

.empty { max-width: 560px; }
.empty h2 { margin-bottom: 6px; }

/* ---------- Login ---------- */
.login-page {
    display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 16px;
    background: linear-gradient(160deg, var(--side-1), var(--side-2));
}
.login-card {
    width: 100%; max-width: 380px; padding: 28px;
    background: var(--surface); border-radius: 12px; box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
}
.login-card h1 { margin-top: 0; font-size: 20px; }
.login-head { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.form { display: flex; flex-direction: column; gap: 6px; }
.form label { font-weight: 600; margin-top: 8px; }
.form .btn { margin-top: 16px; }

/* ---------- Shared bits ---------- */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.req { color: var(--bad); }
.upper { text-transform: uppercase; }
.link-btn { border: 0; background: none; padding: 0; color: var(--primary); font: inherit; text-decoration: underline; cursor: pointer; }
.icon-btn {
    width: 26px; height: 26px; border: 1px solid var(--line); border-radius: 6px;
    background: #fff; color: var(--bad); font-size: 16px; line-height: 1; cursor: pointer;
}
.icon-btn:hover { background: #fdecec; }

.grid-table { width: 100%; border-collapse: collapse; }
.grid-table th, .grid-table td { padding: 6px 8px; border-bottom: 1px solid var(--line); text-align: left; }
.grid-table th { font-size: 12px; text-transform: uppercase; letter-spacing: 0.03em; color: var(--muted); background: #f5f7fa; }
.num-col { text-align: right !important; font-variant-numeric: tabular-nums; white-space: nowrap; }
.act-col { width: 40px; text-align: center !important; }
.sr-col { width: 36px; color: var(--muted); }
.tag { font-style: normal; font-size: 11px; padding: 1px 6px; border-radius: 10px; background: #e9f1fd; color: var(--primary); }

/* ---------- New Registration ---------- */
.reg-section { margin-bottom: 14px; }
.reg-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px 14px; }
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field > label { font-size: 13px; font-weight: 600; color: var(--muted); }
.field-wide { grid-column: span 2; }
.input-row { display: flex; gap: 6px; }
.input-row > input, .input-row > select { flex: 1; }
.input-row > .w-title { flex: 0 0 88px; }
.input-row > .w-age { flex: 0 0 80px; }
.input-row > .w-ref { flex: 0 0 110px; }
.input-row > select[hidden] { display: none; }
.field input.strong { font-weight: 700; }

.matches { margin-top: 12px; padding: 10px 12px; border: 1px solid #c9dbf6; border-radius: 6px; background: #f3f8ff; }
.matches p { margin: 0 0 6px; }
.matches ul { list-style: none; margin: 0 0 8px; padding: 0; }
.matches li { display: flex; align-items: center; gap: 10px; padding: 4px 0; flex-wrap: wrap; }
.linked { margin: 10px 0 0; padding: 8px 12px; border-radius: 6px; background: #e6f5ec; color: #135c33; }

.tests { display: grid; grid-template-columns: minmax(240px, 2fr) 3fr; gap: 14px; }
.test-picker { display: flex; flex-direction: column; gap: 6px; }
.test-list {
    list-style: none; margin: 0; padding: 0; height: 300px; overflow-y: auto;
    border: 1px solid var(--line); border-radius: 6px;
}
.test-list li {
    display: flex; justify-content: space-between; gap: 10px;
    padding: 5px 10px; border-bottom: 1px solid #eef1f5; cursor: pointer;
}
.test-list li em { font-style: normal; font-size: 11px; color: var(--primary); }
.test-list li.active { background: var(--primary); color: #fff; }
.test-list li.active em { color: #dbe8ff; }
.test-list li.added { color: #9aa5b5; }
.test-list li.active.added { color: #dbe8ff; }
.test-list li.none { color: var(--muted); cursor: default; }
.test-list .price { font-variant-numeric: tabular-nums; }
.test-selected { display: flex; flex-direction: column; min-width: 0; }
.empty-row { margin: 10px 0; }
.empty-row.warn { color: var(--bad); font-weight: 600; }
.test-summary { display: flex; justify-content: flex-end; gap: 24px; padding: 8px; border-top: 2px solid var(--line); margin-top: auto; }

.actions { display: flex; justify-content: flex-end; align-items: center; gap: 10px; margin-top: 14px; flex-wrap: wrap; }
.actions .muted { margin-right: auto; font-size: 12px; }
.actions .btn-primary { min-width: 120px; }

/* ---------- Receipt ---------- */
.receipt-actions { display: flex; gap: 10px; margin-bottom: 14px; }
.receipt { max-width: 820px; padding: 22px 26px; }
.receipt-head { display: flex; align-items: flex-start; gap: 14px; padding-bottom: 12px; border-bottom: 2px solid var(--text); }
.receipt-head .lab-logo { width: 56px; height: 56px; }
.receipt-title { margin-left: auto; text-align: right; display: flex; flex-direction: column; gap: 6px; }
.stamp { color: var(--bad); border: 2px solid var(--bad); padding: 2px 8px; font-weight: 700; }
.receipt-info { display: grid; grid-template-columns: 110px 1fr 110px 1fr; gap: 4px 12px; margin: 14px 0; }
.receipt-info dt { color: var(--muted); }
.receipt-info dd { margin: 0; }
.receipt-lines { margin-bottom: 12px; }
.receipt-foot { display: flex; justify-content: space-between; gap: 20px; align-items: flex-start; }
.receipt-totals { flex: 0 0 280px; }

.stamp-muted { color: var(--muted); border-color: var(--muted); }

/* ---------- Result entry ---------- */
.result-table td { vertical-align: middle; }
.result-table .report-row td { background: #e9f1fd; color: var(--primary); font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em; }
.result-table .group-row td { font-weight: 600; background: #f5f7fa; }
.result-col { width: 260px; }
.result-input { width: 100%; padding: 5px 8px; border: 1px solid #b9c3d1; border-radius: 5px; font: inherit; }
.result-input:focus { outline: 2px solid rgba(31, 99, 198, 0.35); border-color: var(--primary); }
.result-input.result-abnormal { color: var(--bad); font-weight: 700; border-color: var(--bad); }
.flag-col { width: 28px; text-align: center; color: var(--bad); font-weight: 700; }

/* ---------- Printed test report ---------- */
.report-toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.report-toolbar select { padding: 5px 8px; margin-left: 6px; }
.report-groups { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-bottom: 12px; font-size: 13px; }
.report {
    background: #fff; color: #000; max-width: 210mm; margin: 0 auto; padding: 10mm 12mm;
    box-shadow: var(--shadow); border: 1px solid var(--line); font: 10.5pt/1.4 "Segoe UI", Arial, sans-serif;
}
.report [data-letterhead] { display: none; }
.report[data-mode="image"] [data-letterhead="image"] { display: block; }
.report[data-mode="text"] [data-letterhead="text"] { display: flex; }
.report[data-mode="blank"] [data-letterhead="blank"] { display: block; }
.report-letterhead img { display: block; width: 100%; height: auto; }
.report-lab { align-items: center; gap: 12px; padding-bottom: 8px; border-bottom: 2px solid #000; }
.report-lab .lab-name { font-size: 18pt; }
.report-blank { height: var(--report-top, 1.4in); }
.report-patient { width: 100%; border-collapse: collapse; margin: 8px 0; border-top: 1px solid #000; border-bottom: 1px solid #000; }
.report-patient th { text-align: left; font-weight: 600; width: 16%; padding: 2px 6px; white-space: nowrap; vertical-align: top; }
.report-patient td { padding: 2px 6px; vertical-align: top; }
.report-results { width: 100%; border-collapse: collapse; }
.report-results thead th { text-align: left; border-bottom: 1.5px solid #000; padding: 4px 6px; }
.report-results td { padding: 3px 6px; vertical-align: top; }
.report-results td:first-child { width: 38%; }
.report-section td { text-align: center; font-weight: 700; text-decoration: underline; padding-top: 10px; text-transform: uppercase; }
.report-group td { font-weight: 700; padding-top: 8px; }
.report-results td.indent { padding-left: 18px; }
.report-results td.abnormal { font-weight: 700; color: var(--report-highlight, #c00); }
.report-results .hl { font-size: 0.85em; margin-left: 6px; }
.report-note td { font-size: 9.5pt; padding: 4px 6px 8px; }
.report-note p { margin: 0 0 2px; }
.report-end { text-align: center; margin: 18px 0 8px; font-size: 9.5pt; }
.report-signatures { display: flex; justify-content: space-between; gap: 18px; margin-top: 48px; font-size: 9.5pt; text-align: center; }
.report-footer img { display: block; width: 100%; height: auto; margin-top: 12px; }

.report-title { text-align: center; font-size: 13pt; text-decoration: underline; margin: 12px 0 8px; }
.report-text p, .editor p { margin: 0 0 4px; }
.template-pick { max-width: 480px; margin-bottom: 10px; }
.field-full { grid-column: 1 / -1; }
.link-owner { min-width: 280px; }
.link-list { margin: 0 0 10px; padding-left: 28px; max-width: 640px; }
.link-list li { padding: 4px 0; border-bottom: 1px solid #eef1f5; }
.link-list li > * { vertical-align: middle; }
.link-name { display: inline-block; min-width: 360px; }
.icon-plain { color: var(--text); }
.link-add { max-width: 520px; }
.ranges-table input, .ranges-table select { padding: 5px 7px; }
.incentive-all { align-items: center; margin-bottom: 10px; max-width: 420px; }
.settings-form { max-width: 720px; }
.lab-year a { font-size: 12px; }
.switch-years { flex-wrap: wrap; }
.new-year { margin-top: 10px; }
.new-year summary { cursor: pointer; color: var(--primary); }
.new-year form { margin-top: 8px; align-items: end; }
.access-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.access-group { border: 1px solid var(--line); border-radius: 6px; padding: 6px 12px 10px; display: flex; flex-direction: column; gap: 3px; }
.access-group legend { font-weight: 600; padding: 0 4px; }
.settings-form .field { margin-bottom: 12px; }
.letterhead-preview { max-width: 100%; max-height: 90px; border: 1px solid var(--line); border-radius: 4px; background: #fff; }
.incentive-all label { white-space: nowrap; }
.editor-small { min-height: 160px; }
.editor-toolbar { display: flex; gap: 6px; margin-bottom: 6px; }
.editor {
    min-height: 320px; padding: 12px 14px; border: 1px solid #b9c3d1; border-radius: 6px; background: #fff;
    font: 11pt/1.5 "Segoe UI", Arial, sans-serif; overflow-wrap: anywhere;
}
.editor:focus { outline: 2px solid rgba(31, 99, 198, 0.35); border-color: var(--primary); }

.report .footer-space { display: none; }

@media print {
    .report { box-shadow: none; border: 0; padding: 0; max-width: none; }
    .report[data-mode="image"] .footer-space { display: table-footer-group; }
    .report-footer-fixed { position: fixed; left: 0; right: 0; bottom: 0; margin: 0; }
    .report-results thead { display: table-header-group; }
    .report-results tr { page-break-inside: avoid; }
}

/* ---------- Master lists and forms ---------- */
.master-search { flex: 1 1 360px; max-width: 520px; }
.row-actions { display: flex; gap: 6px; align-items: center; }
.row-actions form { margin: 0; }
.inline-form { display: inline-flex; gap: 4px; align-items: center; }
.btn-danger-ghost { color: var(--bad); }
.btn-danger-ghost:hover { background: #fdecec; }
.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 4px 12px; padding: 6px 0; }
textarea { padding: 7px 10px; border: 1px solid #b9c3d1; border-radius: 6px; font: inherit; color: inherit; resize: vertical; }
textarea:focus { outline: 2px solid rgba(31, 99, 198, 0.35); border-color: var(--primary); }

/* ---------- Registration lists and invoice screens ---------- */
.btn-sm { padding: 3px 9px; font-size: 12px; font-weight: 600; }
.btn-danger { background: var(--bad); color: #fff; }
.btn-danger:hover { background: #a72724; }
.alert-warn { background: #fff7e6; color: #7a4b00; border: 1px solid #f3d9a4; }
.alert-warn a { color: inherit; font-weight: 600; }
.spacer { flex: 1; }
.nowrap { white-space: nowrap; }
.small { font-size: 12px; }
.warn-text { color: #b26a00; }
.print-only { display: none; }
.filter select { padding: 7px 10px; }

.table-wrap { overflow-x: auto; }
.list-table { font-size: 13px; }
.list-table td { vertical-align: top; }
.list-table tfoot td, .grid-table tfoot td { font-weight: 600; background: #f5f7fa; border-top: 2px solid var(--line); }
.tests-col { min-width: 160px; max-width: 280px; color: var(--muted); font-size: 12px; }
.tag-bad { background: #fdecec; color: var(--bad); }
tr.cancelled td { color: #a35a58; }
tr.cancelled td a { color: var(--bad); }
.refund-row td { color: var(--bad); }

.pick-forms { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.pick-forms .input-row { flex: 1 1 280px; max-width: 420px; }
.pick .alert { margin: 12px 0 0; }
.pick p.muted { margin: 10px 0 0; }
.plain-list { list-style: none; margin: 0; padding: 0; }
.plain-list li { display: flex; align-items: center; gap: 10px; padding: 6px 0; border-bottom: 1px solid #eef1f5; }

.summary-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 4px; }
.summary-head h3 { margin: 0; }
.receipt-info .span-3 { grid-column: span 3; }
.amounts { display: flex; flex-wrap: wrap; gap: 10px; margin: 10px 0; }
.amounts > div {
    display: flex; flex-direction: column; gap: 2px; min-width: 130px;
    padding: 8px 12px; border: 1px solid var(--line); border-radius: 6px; background: #fafbfd;
}
.amounts span { font-size: 12px; color: var(--muted); }
.amounts strong { font-size: 18px; font-variant-numeric: tabular-nums; }
.card.amounts { padding: 10px; }
.sub-head { margin: 14px 0 6px; font-size: 13px; text-transform: uppercase; letter-spacing: 0.03em; color: var(--muted); }
.field-check { justify-content: flex-end; }
.w-num { width: 110px; text-align: right; }
.voucher-table select { padding: 5px 8px; }
.voucher-table input { padding: 5px 8px; }

.receipt-wide { max-width: 1000px; }
.receipt-slip { max-width: 560px; }
.slip-totals { margin: 6px 0 0 auto; max-width: 320px; }
.statement-invoice { margin-top: 16px; }
.statement-head { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding: 8px 0; border-bottom: 1px solid var(--line); }
.statement-amounts { display: flex; gap: 14px; flex-wrap: wrap; font-size: 13px; color: var(--muted); }
.statement-amounts strong { color: var(--text); font-variant-numeric: tabular-nums; }
.statement-total { margin: 18px 0 0 auto; max-width: 300px; }

@media print {
    @page { margin: 12mm; }
    .print-only { display: block; margin: 0 0 10px; font-size: 16px; }
    .table-wrap { overflow: visible; }
    .list-table { font-size: 11px; }
    .tests-col { max-width: none; }
    body { background: #fff; }
    .sidebar, .topbar, .page-title, .no-print, .alert { display: none !important; }
    .shell, .main { display: block; }
    .content { padding: 0; }
    .card.receipt { border: 0; box-shadow: none; padding: 0; max-width: none; }
    .grid-table th { background: none; }
}

/* ---------- Narrow screens (web on phones/tablets) ---------- */
@media (max-width: 800px) {
    .shell { flex-direction: column; }
    .sidebar { position: static; height: auto; width: auto; }
    .sidebar-foot { display: none; }
    .nav { display: flex; flex-wrap: wrap; }
    .nav-section { border: 0; padding: 0; display: flex; flex-wrap: wrap; }
    .nav-link { padding: 8px 12px; }
    .nav-link .chev { display: none; }
    .flyout, .nav-section:last-child .flyout { left: 0; top: 100%; bottom: auto; z-index: 30; }
    .topbar { flex-wrap: wrap; padding: 10px 16px; }
    .content { padding: 14px 16px 24px; }
    .legend { margin-left: 0; }
    .field-wide { grid-column: auto; }
    .tests { grid-template-columns: 1fr; }
    .test-list { height: 220px; }
    .receipt-info { grid-template-columns: 100px 1fr; }
    .receipt-info .span-3 { grid-column: auto; }
    .pick-forms .input-row { max-width: none; }
    .receipt-foot { flex-direction: column; }
    .receipt-totals { flex: none; width: 100%; }
}
