/* ==========================================================
   LabCare - styles (RTL-first, medical blue/white palette)
   ========================================================== */
:root {
    --primary: #1f6fd6;
    --primary-dark: #0d3b7a;
    --primary-soft: #e8f1fd;
    --accent: #1aa37a;
    --warn: #f0a13a;
    --danger: #e0534f;
    --purple: #7b5cd6;
    --info: #3b8fd9;
    --ink: #1c2b3a;
    --muted: #6b7a8c;
    --line: #e3e9f2;
    --bg: #f4f7fb;
    --card: #ffffff;
    --radius: 14px;
    --shadow: 0 6px 22px rgba(13, 59, 122, .07);
    --sidebar-w: 260px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
    font-family: "Tajawal", "Segoe UI", Tahoma, Arial, sans-serif;
    color: var(--ink);
    background: var(--bg);
    font-size: 15px;
    line-height: 1.6;
}
h1, h2, h3, h4 { margin: 0 0 .5rem; line-height: 1.35; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.1rem; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }
code { background: #f1f4f9; padding: 2px 6px; border-radius: 6px; }
hr { border: 0; border-top: 1px solid var(--line); margin: .5rem 0; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.block { display: block; }
.center { text-align: center; }
.mt { margin-top: 1rem; }
.text-danger { color: var(--danger); }
.text-ok { color: var(--accent); }
.inline { display: inline-block; margin: 0 2px; }
.inline-form { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 12px; }
.inline-form .input { max-width: 180px; }
.wrap { flex-wrap: wrap; }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    padding: 9px 16px; border-radius: 10px; border: 1px solid transparent;
    font: inherit; font-weight: 600; cursor: pointer; transition: .15s;
    background: var(--primary-soft); color: var(--primary-dark);
}
.btn:hover { filter: brightness(.96); text-decoration: none; }
.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 4px 12px rgba(31,111,214,.25); }
.btn-ghost { background: #fff; border-color: var(--line); color: var(--primary-dark); }
.btn-danger { background: #fdecec; color: var(--danger); border-color: #f8c9c7; }
.btn-wa { background: #25d366; color: #fff; }
.btn-light { background: #fff; color: var(--primary-dark); }
.btn-ghost-light { background: rgba(255,255,255,.12); color: #fff; border-color: rgba(255,255,255,.4); }
.btn-link { background: none; color: var(--primary); }
.btn-sm { padding: 6px 11px; font-size: .85rem; border-radius: 8px; }
.btn-lg { padding: 12px 22px; font-size: 1.05rem; }
.btn-block { width: 100%; }
.icon-btn { background: none; border: 0; font-size: 1.4rem; cursor: pointer; color: var(--primary-dark); display: none; }

/* ---------- Forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; font-size: .9rem; color: var(--muted); }
.field span { font-weight: 600; color: var(--ink); }
.input {
    width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px;
    font: inherit; color: var(--ink); background: #fff; min-width: 0;
}
.input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(31,111,214,.15); }
textarea.input { resize: vertical; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.form-grid .span-2 { grid-column: 1 / -1; }
.form-stack { display: flex; flex-direction: column; gap: 14px; }
.check { display: flex; align-items: center; gap: 8px; font-size: .95rem; color: var(--ink); }
.seg { display: flex; gap: 10px; flex-wrap: wrap; }
.seg label { border: 1px solid var(--line); padding: 8px 14px; border-radius: 10px; cursor: pointer; background: #fff; }
.search-inline { display: flex; gap: 8px; flex-wrap: wrap; align-items: flex-end; }
.search-inline .input { width: auto; min-width: 220px; }
.inline-field { margin: 0; }
.inline-field .input { min-width: 150px; }
.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.actions-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 12px; }
.actions-cell { white-space: nowrap; }
.checklist fieldset, fieldset.checklist { border: 1px dashed var(--line); border-radius: 10px; padding: 10px 14px; display: grid; grid-template-columns: repeat(auto-fill, minmax(200px,1fr)); gap: 8px; }
fieldset.checklist legend { padding: 0 6px; color: var(--muted); font-size: .9rem; }

/* ---------- Cards, stats, tables ---------- */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; border: 1px solid #eef2f8; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.card-head h3 { margin: 0; }
.card-head a { font-size: .9rem; }
.grid-2, .grid-3, .grid-split { display: grid; gap: 18px; margin-bottom: 18px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0,1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0,1fr)); }
.grid-split { grid-template-columns: 1.1fr .9fr; align-items: start; }
.stack { display: flex; flex-direction: column; gap: 18px; }

.stats { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 14px; margin-bottom: 16px; }
.stat {
    background: #fff; border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow);
    border: 1px solid #eef2f8; border-inline-start: 5px solid var(--primary-soft);
    display: flex; flex-direction: column; gap: 4px;
}
.stat span { color: var(--muted); font-size: .88rem; }
.stat strong { font-size: 1.45rem; color: var(--primary-dark); }
.stat strong.small-list { font-size: .95rem; display: flex; flex-direction: column; gap: 2px; font-weight: 600; }
.stat strong.quick a { margin-inline-end: 12px; font-size: .95rem; }
.s-blue { border-inline-start-color: var(--primary); }
.s-green { border-inline-start-color: var(--accent); }
.s-orange { border-inline-start-color: var(--warn); }
.s-purple { border-inline-start-color: var(--purple); }
.s-danger { border-inline-start-color: var(--danger); }

.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 11px 10px; border-bottom: 1px solid var(--line); text-align: start; vertical-align: middle; }
.table th { background: #f7f9fc; color: var(--muted); font-weight: 600; font-size: .88rem; white-space: nowrap; }
.table tbody tr:hover { background: #fafcff; }
.table.compact th, .table.compact td { padding: 8px 8px; }
.table .value { font-weight: 700; }
.empty { text-align: center; color: var(--muted); padding: 22px !important; }
.card.empty, .empty.card { padding: 24px; }
.price { font-weight: 700; color: var(--primary-dark); white-space: nowrap; }
.price.big { font-size: 1.4rem; }

.kv { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 10px 18px; }
.kv > div { display: flex; flex-direction: column; border-bottom: 1px dashed var(--line); padding-bottom: 8px; }
.kv span { color: var(--muted); font-size: .85rem; }
.kv strong { font-weight: 600; }
.list { list-style: none; padding: 0; margin: 0; }
.list li { padding: 10px 0; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 2px; }
.list.small li { font-size: .9rem; }
.chips-list { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-block; background: var(--primary-soft); color: var(--primary-dark); padding: 6px 12px; border-radius: 999px; font-size: .88rem; }
.tags { color: var(--muted); font-size: .85rem; margin: 6px 0 0; }
.legend { display: flex; gap: 12px; align-items: center; color: var(--muted); font-size: .85rem; margin-top: 10px; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-inline-end: 4px; }
.dot.bar-labs { background: var(--primary); }
.dot.bar-orders { background: var(--accent); }

/* ---------- Badges ---------- */
.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: .8rem; font-weight: 700; white-space: nowrap; }
.b-new { background: #eef1f5; color: #4d5b6b; }
.b-info { background: #e3f0ff; color: #1d64b5; }
.b-warn { background: #fff1dc; color: #a86a0c; }
.b-purple { background: #efeafe; color: #5a3fb8; }
.b-ok { background: #dff6ee; color: #137a57; }
.b-done { background: #d9f3e6; color: #0d6e4d; }
.b-danger { background: #fde4e3; color: #b43330; }

/* ---------- Alerts ---------- */
.alert { padding: 12px 16px; border-radius: 12px; margin-bottom: 14px; border: 1px solid transparent; }
.alert-success { background: #e4f7ef; color: #106b4a; border-color: #bfe9d6; }
.alert-danger { background: #fde9e8; color: #a52f2c; border-color: #f7c5c2; }
.alert-warning { background: #fff5e4; color: #8a5a06; border-color: #f7dfae; }
.alert-info { background: #e8f3ff; color: #1b5fa6; border-color: #bcd9f7; }
.credentials { font-size: .95rem; display: flex; flex-direction: column; gap: 6px; }

/* ---------- App shell ---------- */
.app-shell { display: flex; min-height: 100vh; }
.sidebar {
    width: var(--sidebar-w); flex: 0 0 var(--sidebar-w);
    background: linear-gradient(180deg, var(--primary-dark), #0a2f63);
    color: #dbe7f7; display: flex; flex-direction: column; padding: 22px 14px;
    position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 4px 8px 22px; border-bottom: 1px solid rgba(255,255,255,.12); margin-bottom: 14px; }
.brand strong { display: block; color: #fff; font-size: 1.15rem; }
.brand small { color: #9fbbe0; font-size: .8rem; }
.brand-mark {
    width: 42px; height: 42px; border-radius: 12px; display: inline-grid; place-items: center;
    background: #fff; color: var(--primary); font-size: 1.6rem; font-weight: 800; flex: 0 0 42px;
}
.brand-mark.big { width: 64px; height: 64px; font-size: 2.4rem; flex-basis: 64px; margin: 0 auto 8px; }
.side-nav { display: flex; flex-direction: column; gap: 4px; }
.side-nav a { color: #dbe7f7; padding: 11px 14px; border-radius: 10px; font-weight: 600; }
.side-nav a:hover { background: rgba(255,255,255,.08); text-decoration: none; }
.side-nav a.active { background: #fff; color: var(--primary-dark); }
.side-public { margin-top: auto; color: #9fd0ff; font-size: .9rem; padding: 12px 14px; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
    display: flex; align-items: center; gap: 14px; padding: 14px 26px; background: #fff;
    border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5;
}
.page-title { font-size: 1.2rem; margin: 0; flex: 1; }
.user-box { display: flex; align-items: center; gap: 12px; }
.user-meta { display: flex; flex-direction: column; text-align: end; line-height: 1.25; }
.user-meta small { color: var(--muted); }
.content { padding: 24px 26px 40px; }

/* ---------- Public site ---------- */
.public-body { background: #f6f9fd; }
.container { width: min(1180px, 100% - 32px); margin-inline: auto; }
.pub-header { background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; }
.pub-header-inner { display: flex; align-items: center; justify-content: space-between; padding: 14px 0; gap: 12px; flex-wrap: wrap; }
.pub-brand { display: flex; align-items: center; gap: 10px; color: var(--primary-dark); font-weight: 800; font-size: 1.15rem; }
.pub-brand .brand-mark { background: var(--primary); color: #fff; width: 38px; height: 38px; flex-basis: 38px; font-size: 1.4rem; }
.pub-nav { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.pub-nav a { color: var(--ink); font-weight: 600; }
.pub-main { padding: 26px 0 40px; min-height: 70vh; }
.pub-footer { background: var(--primary-dark); color: #cfe0f7; padding: 22px 0; font-size: .9rem; }
.pub-footer .container { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.pub-footer .muted { color: #9fbbe0; }

.hero {
    display: grid; grid-template-columns: 1.3fr .9fr; gap: 22px; align-items: center;
    background: linear-gradient(120deg, #e9f3ff 0%, #ffffff 70%);
    border-radius: 22px; padding: 38px; margin-bottom: 30px; border: 1px solid #e2edfb;
}
.hero .eyebrow { display: inline-block; background: #fff; color: var(--primary); padding: 5px 12px; border-radius: 999px; font-size: .85rem; font-weight: 700; margin-bottom: 12px; }
.hero h1 { font-size: 2.3rem; color: var(--primary-dark); }
.hero h1 span { color: var(--primary); }
.hero p { color: var(--muted); font-size: 1.05rem; }
.search-bar { display: grid; grid-template-columns: 1fr 180px auto; gap: 10px; margin-top: 18px; }
.portal-card { display: flex; flex-direction: column; gap: 12px; }
.portal-card h3 { color: var(--primary-dark); }
.section { margin-bottom: 28px; }
.section-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; gap: 12px; flex-wrap: wrap; }
.lab-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.lab-tile { display: flex; gap: 14px; align-items: flex-start; color: var(--ink); transition: .15s; }
.lab-tile:hover { transform: translateY(-2px); text-decoration: none; box-shadow: 0 10px 30px rgba(13,59,122,.12); }
.lab-tile h3 { margin: 0 0 4px; color: var(--primary-dark); }
.lab-tile p { margin: 0; font-size: .9rem; }
.lab-logo {
    width: 56px; height: 56px; flex: 0 0 56px; border-radius: 14px; background: var(--primary-soft);
    display: grid; place-items: center; overflow: hidden; color: var(--primary); font-weight: 800; font-size: 1.4rem;
}
.lab-logo img { width: 100%; height: 100%; object-fit: cover; }
.lab-logo.lg { width: 96px; height: 96px; flex-basis: 96px; border: 4px solid #fff; box-shadow: var(--shadow); }
.features { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.feature { display: flex; flex-direction: column; gap: 6px; }
.feature strong { color: var(--primary-dark); }
.feature span { color: var(--muted); font-size: .92rem; }

.lab-cover {
    position: relative; height: 240px; border-radius: 22px; overflow: hidden;
    background: linear-gradient(120deg, #1b5fb8, #3e9cd8) center/cover no-repeat;
    margin-bottom: 70px;
}
.lab-cover-shade { position: absolute; inset: 0; background: linear-gradient(180deg, rgba(10,47,99,.1), rgba(10,47,99,.75)); }
.lab-head { position: absolute; inset-inline: 0; bottom: -60px; display: flex; gap: 18px; align-items: flex-end; color: #fff; z-index: 2; }
.lab-head h1 { color: #fff; font-size: 2rem; margin: 0; }
.lab-head p { margin: 4px 0 12px; opacity: .92; }
.cta-row { display: flex; gap: 10px; flex-wrap: wrap; }
.lab-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin: 0 auto 18px; background: #fff; padding: 8px; border-radius: 14px; box-shadow: var(--shadow); position: sticky; top: 70px; z-index: 4; }
.lab-tabs a { padding: 8px 14px; border-radius: 10px; color: var(--primary-dark); font-weight: 600; }
.lab-tabs a:hover { background: var(--primary-soft); text-decoration: none; }
.info-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 14px; margin-top: 10px; }
.info-grid > div { display: flex; flex-direction: column; gap: 2px; }
.info-grid strong { color: var(--muted); font-size: .85rem; }
.cat-chips { display: flex; gap: 8px; flex-wrap: wrap; }
.cat-chips .chip { text-decoration: none; }
.search-input { max-width: 300px; }
.price-group { margin-bottom: 16px; }
.price-group h3 { color: var(--primary-dark); }
.price-table td small { font-size: .8rem; }
.offer-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px,1fr)); gap: 16px; }
.offer.accent { border-top: 4px solid var(--accent); }
.offer h3 { color: var(--primary-dark); }
.contact { margin-bottom: 20px; }

/* Patient portal */
.portal-wrap { max-width: 560px; margin: 0 auto; }
.portal-card-lg { padding: 28px; }
.portal-head { display: flex; gap: 14px; align-items: flex-start; margin-bottom: 18px; }
.portal-head h1 { font-size: 1.4rem; color: var(--primary-dark); margin-bottom: 4px; }
.portal-icon { width: 52px; height: 52px; flex: 0 0 52px; border-radius: 16px; background: var(--primary-soft); display: grid; place-items: center; font-size: 1.5rem; }
.otp { font-size: 1.6rem; letter-spacing: .5em; text-align: center; direction: ltr; font-weight: 700; }
.patient-app { max-width: 880px; margin: 0 auto; display: flex; flex-direction: column; gap: 16px; }
.patient-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.patient-head h2 { margin: 0; color: var(--primary-dark); }
.result-card { padding: 0; overflow: hidden; }
.result-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; background: #f7fbff; border-bottom: 1px solid var(--line); gap: 10px; flex-wrap: wrap; }
.result-card .table th:first-child, .result-card .table td:first-child { padding-inline-start: 20px; }
.seg { margin-bottom: 4px; }
.disclaimer { font-size: .88rem; color: var(--muted); background: #fff9ed; border-color: #f7e3b8; }
tr.flag-high td, tr.flag-positive td { background: #fff3f2; }
tr.flag-low td { background: #fff8ec; }

/* Lab order / results */
.order-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.order-no { font-size: 1.4rem; font-weight: 800; color: var(--primary-dark); display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.results-table .input { min-width: 140px; }
.results-table td.result-input { min-width: 160px; }
.approve-box { margin-top: 18px; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; background: #f0f8f4; border: 1px solid #cdebdc; padding: 14px; border-radius: 12px; }
.approve-box .input { flex: 1; min-width: 200px; }
.order-total { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 16px; background: #f7fbff; border-radius: 12px; padding: 14px; }
.order-total > div { display: flex; flex-direction: column; gap: 2px; }
.order-total span { color: var(--muted); font-size: .85rem; }
.order-total .grand { color: var(--primary); font-size: 1.3rem; }
.order-form .card + .card { margin-top: 18px; }
.sub { margin: 18px 0 8px; color: var(--primary-dark); font-size: 1rem; }
.checklist-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px,1fr)); gap: 10px; }
.pick { display: flex; gap: 10px; align-items: flex-start; border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; cursor: pointer; background: #fff; }
.pick:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); }
.pick input { margin-top: 5px; }
.pick span { display: flex; flex-direction: column; font-size: .92rem; }
.pick small { color: var(--muted); }
.pick.pkg { border-style: dashed; }

.quick a { color: var(--primary); }
.grid-split .card { min-width: 0; }
.error-box { max-width: 520px; margin: 40px auto; text-align: center; }
.error-box h1 { font-size: 3rem; color: var(--primary); }

/* Auth */
.auth-body { background: linear-gradient(160deg, #e9f3ff, #f7fbff 60%); min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.auth-wrap { width: min(420px, 100%); }
.auth-brand { text-align: center; margin-bottom: 18px; color: var(--primary-dark); }
.auth-brand h1 { margin: 0; }
.auth-brand p { color: var(--muted); margin: 0; }
.auth-card { padding: 26px; }
.auth-title { color: var(--primary-dark); }
.auth-back { text-align: center; margin-top: 16px; }

/* ---------- Print / reports ---------- */
.print-body { background: #e8edf4; }
.print-toolbar { display: flex; gap: 10px; justify-content: center; padding: 16px; }
.report-page, .receipt {
    background: #fff; width: 210mm; min-height: 297mm; margin: 0 auto 24px; padding: 16mm 14mm;
    box-shadow: 0 8px 30px rgba(0,0,0,.12); position: relative; font-size: 13px;
}
.receipt { width: 80mm; min-height: auto; padding: 8mm; font-size: 12px; }
.report-header { display: flex; justify-content: space-between; align-items: center; border-bottom: 3px solid var(--primary); padding-bottom: 12px; margin-bottom: 14px; gap: 12px; }
.report-lab { display: flex; gap: 12px; align-items: center; }
.report-lab h1 { font-size: 1.35rem; color: var(--primary-dark); margin: 0; }
.report-logo { width: 64px; height: 64px; object-fit: contain; }
.report-logo-fallback { width: 64px; height: 64px; border-radius: 14px; background: var(--primary); color: #fff; display: grid; place-items: center; font-size: 2rem; font-weight: 800; }
.report-title { text-align: end; }
.report-title h2 { font-size: 1.1rem; color: var(--primary); margin-bottom: 4px; }
.report-meta { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px 14px; background: #f5f9ff; border: 1px solid #dce9f8; border-radius: 10px; padding: 12px; margin-bottom: 14px; }
.report-meta > div { display: flex; flex-direction: column; }
.report-meta span { color: var(--muted); font-size: 11px; }
.report-meta strong { font-size: 13px; }
.report-table { width: 100%; border-collapse: collapse; }
.report-table th { background: var(--primary-dark); color: #fff; padding: 8px; font-size: 12px; text-align: start; }
.report-table td { padding: 8px; border-bottom: 1px solid #e5ebf3; }
.report-table td.value { font-weight: 700; }
.report-table tr.flag-high td { color: #b43330; }
.report-table tr.flag-low td { color: #a86a0c; }
.report-notes { margin-top: 12px; }
.report-sign { display: flex; justify-content: space-between; margin-top: 36px; gap: 20px; }
.report-sign > div { display: flex; flex-direction: column; gap: 4px; min-width: 40%; }
.report-sign span { color: var(--muted); font-size: 11px; }
.stamp { margin-top: 10px; width: 110px; height: 110px; border: 2px dashed #b8c7db; border-radius: 50%; display: grid; place-items: center; color: #9aaabe; font-size: 11px; }
.report-disclaimer { position: absolute; bottom: 12mm; inset-inline: 14mm; font-size: 10.5px; color: var(--muted); border-top: 1px solid var(--line); padding-top: 8px; }
.receipt-head { text-align: center; border-bottom: 1px dashed #aaa; padding-bottom: 6px; }
.receipt-head h1 { font-size: 15px; margin: 0; }
.receipt-head h2 { font-size: 13px; margin: 6px 0 0; }
.receipt-meta, .receipt-totals { margin: 8px 0; }
.receipt-meta div, .receipt-totals div { display: flex; justify-content: space-between; gap: 8px; padding: 2px 0; }
.receipt-meta dt, .receipt-meta dd, .receipt-totals dt, .receipt-totals dd { margin: 0; }
.receipt-table { width: 100%; border-collapse: collapse; margin-top: 6px; }
.receipt-table th, .receipt-table td { border-bottom: 1px dashed #ccc; padding: 4px 0; text-align: start; }
.receipt-totals .grand { font-weight: 800; }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
    .stats { grid-template-columns: repeat(2, minmax(0,1fr)); }
    .grid-3 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 900px) {
    .sidebar {
        position: fixed; inset-inline-start: 0; top: 0; z-index: 30; transform: translateX(100%);
        transition: transform .2s; box-shadow: 0 0 30px rgba(0,0,0,.2);
    }
    .sidebar.open { transform: translateX(0); }
    .icon-btn { display: inline-block; }
    .grid-2, .grid-split, .hero { grid-template-columns: 1fr; }
    .content { padding: 18px 14px 40px; }
    .topbar { padding: 12px 14px; }
    .user-meta { display: none; }
    .features, .info-grid { grid-template-columns: 1fr; }
    .search-bar { grid-template-columns: 1fr; }
    .order-total { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
    .stats { grid-template-columns: 1fr 1fr; gap: 10px; }
    .stat strong { font-size: 1.15rem; }
    .form-grid { grid-template-columns: 1fr; }
    .kv { grid-template-columns: 1fr; }
    .hero { padding: 22px; }
    .hero h1 { font-size: 1.7rem; }
    .lab-cover { height: 200px; margin-bottom: 84px; }
    .lab-head { flex-direction: column; align-items: flex-start; }
    .lab-head h1 { font-size: 1.5rem; }
    .report-page { width: 100%; padding: 8mm; }
    .search-inline .input { min-width: 0; width: 100%; }
    .checklist-grid { grid-template-columns: 1fr; }
    .report-meta { grid-template-columns: 1fr 1fr; }
}

/* ---------- Print ---------- */
@media print {
    @page { size: A4; margin: 10mm; }
    .no-print, .sidebar, .topbar, .pub-header, .pub-footer, .alert, .print-toolbar { display: none !important; }
    body, .print-body { background: #fff !important; }
    .report-page { box-shadow: none; margin: 0; width: 100%; min-height: auto; padding: 0; }
    .receipt { box-shadow: none; margin: 0; }
    .report-page, .receipt, .report-table tr { break-inside: avoid; }
    .report-disclaimer { position: static; margin-top: 18px; }
}
