@font-face { font-family: "Noto Naskh Arabic"; src: url("/fonts/NotoNaskhArabic-Regular.ttf") format("truetype"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Noto Naskh Arabic"; src: url("/fonts/NotoNaskhArabic-Bold.ttf") format("truetype"); font-weight: 700; font-display: swap; }

:root {
  --navy: #123a57;
  --navy-2: #1d4f73;
  --teal: #0f9693;
  --teal-soft: #e3f3f2;
  --red: #c62a2f;
  --bg: #f7f6f2;
  --surface: #ffffff;
  --surface-2: #f1f4f6;
  --ink: #17232d;
  --muted: #55636f;
  --line: #dbe1e6;
  --high: #b42318;
  --high-bg: #fde8e6;
  --low: #1f5fae;
  --low-bg: #e4eefb;
  --focus: #0f9693;
  --shadow: 0 1px 2px rgba(18, 58, 87, .06), 0 8px 28px rgba(18, 58, 87, .08);
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --sans: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  --arabic: "Noto Naskh Arabic", "Segoe UI", Tahoma, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --navy: #8cc4e8; --navy-2: #a9d4f0; --teal: #4cc7c2; --teal-soft: #12302f; --red: #f0777a;
    --bg: #0e151b; --surface: #151f27; --surface-2: #1b2832; --ink: #e5ecf1; --muted: #9fb0bd; --line: #2a3a46;
    --high: #ff9b91; --high-bg: #3a1a18; --low: #8cb8f2; --low-bg: #162a44; --focus: #4cc7c2;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 28px rgba(0,0,0,.35);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --navy: #8cc4e8; --navy-2: #a9d4f0; --teal: #4cc7c2; --teal-soft: #12302f; --red: #f0777a;
  --bg: #0e151b; --surface: #151f27; --surface-2: #1b2832; --ink: #e5ecf1; --muted: #9fb0bd; --line: #2a3a46;
  --high: #ff9b91; --high-bg: #3a1a18; --low: #8cb8f2; --low-bg: #162a44; --focus: #4cc7c2;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.6 var(--sans); }
html[dir="rtl"] body { font-family: var(--arabic); }
img { max-width: 100%; display: block; }
a { color: var(--teal); }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .5em; }
h1, .section-title, .brand-name { font-family: var(--serif); font-weight: 700; color: var(--navy); }
html[dir="rtl"] h1, html[dir="rtl"] .section-title, html[dir="rtl"] .brand-name { font-family: var(--arabic); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
[hidden] { display: none !important; }

.wrap { max-width: 1120px; margin: 0 auto; padding: 0 16px; }
.skip { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip:focus { width: auto; height: auto; clip-path: none; inset-inline-start: 16px; top: 8px; z-index: 10; background: var(--surface); padding: 8px 12px; border-radius: 6px; }

/* ---------- top bar ---------- */
.topbar { background: var(--surface); border-bottom: 1px solid var(--line); border-top: 5px solid var(--teal); position: relative; }
.topbar::before { content: ""; position: absolute; inset: 0 0 auto; height: 6px; background: var(--navy); opacity: .9; }
.topbar-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-top: 18px; padding-bottom: 12px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: inherit; min-width: 0; }
.brand img { width: 52px; height: 52px; border-radius: 50%; background: #fff; }
.brand-text { display: flex; flex-direction: column; min-width: 0; }
.brand-name { font-size: 1.2rem; line-height: 1.2; }
.brand-sub { font-size: .8rem; color: var(--teal); letter-spacing: .02em; }
.lang { display: flex; gap: 4px; background: var(--surface-2); padding: 4px; border-radius: 999px; }
.lang button { border: 0; background: transparent; color: var(--muted); font: inherit; font-size: .88rem; padding: 6px 12px; border-radius: 999px; cursor: pointer; }
.lang button[lang="ku"], .lang button[lang="ar"] { font-family: var(--arabic); }
.lang button[aria-pressed="true"] { background: var(--navy); color: #fff; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .lang button[aria-pressed="true"] { color: #0e151b; } }

/* ---------- hero ---------- */
.hero {
  background:
    radial-gradient(1200px 400px at 85% -10%, var(--teal-soft), transparent 70%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='104' viewBox='0 0 120 104'%3E%3Cg fill='none' stroke='%230f9693' stroke-opacity='.10' stroke-width='1.2'%3E%3Cpath d='M30 2l26 15v30L30 62 4 47V17z'/%3E%3Cpath d='M90 44l26 15v30L90 104 64 89V59z'/%3E%3Cpath d='M56 32h8M56 17l8-4'/%3E%3C/g%3E%3C/svg%3E");
  border-bottom: 1px solid var(--line);
  padding: 56px 0 64px;
}
.hero-grid { display: grid; grid-template-columns: 1.15fr .85fr; gap: 48px; align-items: center; }
.eyebrow { text-transform: uppercase; letter-spacing: .14em; font-size: .78rem; font-weight: 600; color: var(--teal); margin: 0 0 12px; }
html[dir="rtl"] .eyebrow { letter-spacing: 0; text-transform: none; font-size: .9rem; }
h1 { font-size: clamp(2rem, 4.2vw, 3rem); }
.lead { font-size: 1.12rem; color: var(--muted); max-width: 36em; }
.hero-points { list-style: none; padding: 0; margin: 24px 0 0; display: grid; gap: 10px; }
.hero-points li { position: relative; padding-inline-start: 30px; }
.hero-points li::before { content: ""; position: absolute; inset-inline-start: 0; top: .35em; width: 18px; height: 18px; border-radius: 50%; background: var(--teal-soft); border: 1.5px solid var(--teal); }
.hero-points li::after { content: ""; position: absolute; inset-inline-start: 6px; top: calc(.35em + 4px); width: 5px; height: 8px; border: solid var(--teal); border-width: 0 2px 2px 0; transform: rotate(45deg); }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); }
.form-card { padding: 28px; border-top: 4px solid var(--navy); }
.form-card h2 { font-family: var(--serif); color: var(--navy); font-size: 1.4rem; }
html[dir="rtl"] .form-card h2 { font-family: var(--arabic); }
label { display: block; font-weight: 600; margin: 8px 0 6px; }
input[type="text"] {
  width: 100%; font: 600 1.4rem/1.2 ui-monospace, "Cascadia Mono", Consolas, monospace; letter-spacing: .18em; text-transform: uppercase;
  padding: 14px 16px; border: 1.5px solid var(--line); border-radius: 10px; background: var(--surface-2); color: var(--ink); text-align: center;
}
input[type="text"]::placeholder { color: var(--muted); opacity: .45; }
input[type="text"]:focus { border-color: var(--teal); background: var(--surface); outline: none; box-shadow: 0 0 0 4px var(--teal-soft); }
input[aria-invalid="true"] { border-color: var(--high); }
.hint { font-size: .86rem; color: var(--muted); margin: 8px 0 16px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; font: inherit; font-weight: 600; border-radius: 10px; padding: 12px 20px; cursor: pointer; border: 1.5px solid transparent; text-decoration: none; }
.btn-primary { background: var(--navy); color: #fff; }
.btn-primary:hover { background: var(--navy-2); }
.btn-primary[disabled] { opacity: .65; cursor: progress; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .btn-primary { color: #0e151b; } }
.btn-ghost { background: transparent; color: var(--navy); border-color: var(--line); }
.btn-ghost:hover { background: var(--surface-2); }
#lookup .btn { width: 100%; font-size: 1.05rem; }
.form-msg { min-height: 1.4em; margin: 12px 0 0; color: var(--high); font-weight: 500; }
.secure { display: flex; gap: 8px; align-items: flex-start; font-size: .85rem; color: var(--muted); margin: 16px 0 0; padding-top: 14px; border-top: 1px dashed var(--line); }
.lock { flex: none; width: 14px; height: 11px; margin-top: 6px; border-radius: 2px; background: var(--teal); position: relative; }
.lock::before { content: ""; position: absolute; left: 3px; top: -6px; width: 8px; height: 8px; border: 2px solid var(--teal); border-bottom: 0; border-radius: 5px 5px 0 0; box-sizing: border-box; }

/* ---------- sections ---------- */
.how, .about, .contact { padding: 64px 0; }
.section-title { font-size: clamp(1.5rem, 2.6vw, 2rem); }
.steps { list-style: none; padding: 0; margin: 28px 0 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; counter-reset: s; }
.steps li { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 24px; }
.steps h3 { font-size: 1.08rem; color: var(--navy); }
.steps p { margin: 0; color: var(--muted); }
.step-no { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; background: var(--teal-soft); color: var(--teal); font: 700 1.05rem var(--serif); margin-bottom: 14px; border: 1.5px solid var(--teal); }

.about { background: var(--surface); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.about-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 48px; }
.about p { color: var(--muted); max-width: 40em; }
.sub-title { font-size: 1rem; text-transform: uppercase; letter-spacing: .1em; color: var(--navy); margin-top: 28px; }
html[dir="rtl"] .sub-title { letter-spacing: 0; text-transform: none; font-size: 1.1rem; }
.depts { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.depts li { border: 1px solid var(--line); background: var(--surface-2); border-radius: 999px; padding: 6px 14px; font-size: .92rem; }
.team .sub-title { margin-top: 0; }
.person { padding: 18px 20px; margin-bottom: 12px; border-inline-start: 4px solid var(--teal); box-shadow: none; }
.person-name { font-family: var(--serif); font-weight: 700; font-size: 1.08rem; color: var(--navy) !important; margin: 0; text-transform: uppercase; letter-spacing: .03em; }
.person-role { margin: 2px 0 0; font-size: .9rem; }

.contact-grid { display: grid; gap: 20px; }
.contact-items { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.contact-item { display: flex; flex-direction: column; gap: 4px; padding: 20px 24px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; text-decoration: none; color: var(--ink); }
.contact-item:hover { border-color: var(--teal); }
.contact-label { color: var(--muted); font-size: .9rem; }
.contact-value { font: 700 1.25rem var(--serif); color: var(--navy); }
html[dir="rtl"] .contact-value { font-family: var(--arabic); }
.contact-value[dir="ltr"] { font-family: var(--serif); }
html[dir="rtl"] .contact-value[dir="ltr"] { text-align: right; }

.footer { background: var(--navy); color: #dfe9f0; padding: 28px 0; font-size: .9rem; }
.footer p { margin: 0 0 6px; }
.footer .copy { opacity: .75; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .footer { background: #0a1015; color: var(--muted); border-top: 1px solid var(--line); } }

/* ---------- report ---------- */
#results { padding: 28px 0 56px; }
.report-actions { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.report { min-width: 0; }
#report:focus { outline: none; }
.report-card { background: #fff; color: #17232d; border: 1px solid var(--line); border-radius: 6px; box-shadow: var(--shadow); overflow: hidden; }
.report-card > img { width: 100%; height: auto; }
.report-hint { font-size: .85rem; color: var(--muted); margin: 0 0 10px; }

/* ---------- A4 pages: the same sheets as the printed report (PrintReport.tsx) ---------- */
/* The sheets are always real A4 size; on small screens they are scaled down as a whole (app.js: fitPages). */
.pages { direction: ltr; }
.page-slot { margin: 0 auto 18px; overflow: hidden; background: #fff; box-shadow: 0 6px 22px rgba(15, 23, 42, .22); }
.a4 {
  box-sizing: border-box; width: 210mm; min-height: 297mm; display: flex; flex-direction: column;
  padding: 12mm 15mm 6mm; background: #fff; color: #0f172a; transform-origin: 0 0;
  font-family: "Noto Naskh Arabic", Calibri, Carlito, "Segoe UI", Arial, sans-serif; line-height: 1.5; text-align: left;
  -webkit-print-color-adjust: exact; print-color-adjust: exact;
}
.a4.fixed { height: 296mm; min-height: 0; overflow: hidden; }
.a4 * { box-sizing: border-box; }
.a4 p { margin: 0; }
.a4 img { max-width: none; }
.a4 .hdr { display: block; width: calc(100% + 30mm); margin: -12mm -15mm 4px; }
.a4 .body { flex: 1 1 0%; min-height: 0; }
.a4 .body.grow { flex: 1 1 auto; }

/* patient bar */
.pbar { margin-top: 4px; display: grid; grid-template-columns: 1fr 1fr; column-gap: 32px; border-bottom: 2px solid #1e293b; padding-bottom: 8px; }
.pbar-col > div + div { margin-top: 4px; }
.pbar-row { display: flex; font-size: 11pt; font-weight: 700; color: #0f172a; }
.pbar-row.small { font-size: 10pt; }
.pbar-row .l { width: 42mm; flex-shrink: 0; }
.pbar-row .c { margin-right: 8px; }

/* department bands and result rows */
.cat { margin-top: 12px; }
.band { display: flex; align-items: baseline; border-radius: 2px; background: #c9d3e6; padding: 6px 0; font-weight: 700; letter-spacing: .025em; color: #0f172a; }
.band p:nth-child(1) { width: 38%; padding: 0 12px; font-size: 12pt; }
.band p:nth-child(2) { width: 24%; font-size: 11pt; }
.band p:nth-child(3) { font-size: 11pt; }
.band + .band { margin-top: 4px; }
.bigband { border-radius: 2px; background: #c9d3e6; padding: 8px 12px; text-align: center; font-size: 15pt; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: #0f172a; }
.bigband + .band { margin-top: 4px; }
table.rows { margin-top: 4px; width: 100%; border-collapse: collapse; text-align: left; }
.rows tr { border-bottom: 1px solid #e2e8f0; }
.rows td { padding: 8px 0; vertical-align: top; font-size: 11pt; font-weight: 700; color: #0f172a; }
.rows td.n { width: 38%; padding-left: 12px; padding-right: 12px; }
.rows td.r { width: 24%; padding-right: 12px; }
.rows td.v { white-space: pre-line; color: #334155; }
.rows tr.inpart td { padding-top: 4px; padding-bottom: 4px; }
.rows tr.inpart td.n { width: 1px; white-space: nowrap; padding-left: 24px; padding-right: 3ch; }
.rows tr.part { border-bottom: 2px solid #123a57; }
.rows tr.part td { padding-top: 10px; padding-bottom: 4px; }
.rows tr.part td.n { width: 1px; white-space: nowrap; padding-left: 0; padding-right: 3ch; }
.rows tr.part td.lbl { vertical-align: bottom; color: #123a57; }
.rows .chip { display: inline-block; border-radius: 2px; padding: 4px 16px; font-size: 12pt; font-weight: 700; letter-spacing: .025em; color: #fff; background: #123a57; }

/* footer of every sheet */
.ft { margin-top: auto; flex-shrink: 0; }
.ft-line { border-top: 1px solid #cbd5e1; }
.ft-row { margin-top: .6mm; display: flex; flex-direction: row-reverse; align-items: center; justify-content: space-between; gap: 12px; }
.ft-right { display: flex; align-items: center; gap: 3mm; }
.qr { display: flex; flex-direction: column; align-items: center; }
.qr svg { display: block; width: 16mm; height: 16mm; flex-shrink: 0; }
.qr .ql { margin-top: .3mm; white-space: nowrap; font: 700 7pt/1 Arial, sans-serif; color: #334155; }
.qr .qs { margin-top: .4mm; white-space: nowrap; font: 700 7pt/1 Consolas, "Courier New", monospace; color: #123a57; }
.qr .qlink { margin-top: .4mm; white-space: nowrap; font: 700 5.5pt/1 Arial, sans-serif; color: #123a57; }
.ft-social { display: flex; flex-direction: column; align-items: flex-start; gap: .25mm; }
.ft-pill { display: flex; align-items: center; gap: 1.5mm; white-space: nowrap; border-radius: 999px; border: 1px solid #e2e8f0; background: #f8fafc; padding: .2mm 2.5mm .2mm .3mm; }
.ft-pill img { display: block; width: 3.9mm; height: 3.9mm; flex-shrink: 0; }
.ft-pill span { font: 600 8pt/1 Arial, sans-serif; letter-spacing: .025em; color: #334155; }
.ft-addr { margin-top: .15mm; display: flex; align-items: center; gap: 1mm; white-space: nowrap; }
.ft-addr svg { display: block; width: 3.6mm; height: 3.6mm; flex-shrink: 0; }
.ft-addr span { font: 700 8pt/1 "Noto Naskh Arabic", Tahoma, "Segoe UI", sans-serif; color: #123a57; }
.ft-card { display: flex; flex-shrink: 0; flex-direction: column; align-items: center; width: 70mm; }
.ft-card img { display: block; width: 68mm; max-height: 28mm; object-fit: fill; }
.ft-card p { margin-top: .3mm; white-space: nowrap; font-size: 6.5pt; font-weight: 700; line-height: 1; color: #123a57; }

/* special pages: General Urine Examination, Seminal Fluid Analysis, stool, cross match, Widal */
.sp-title { margin-top: 24px; text-align: center; font-size: 20px; font-weight: 700; color: #0f172a; }
.sp-sec { margin-top: 20px; }
.sp-head { margin-bottom: 8px; font-size: 16px; font-weight: 700; font-style: italic; text-decoration: underline; }
.sp-grid { display: grid; grid-template-columns: 1fr 1fr; column-gap: 32px; padding-left: 12px; }
.sp-list { padding-left: 12px; }
.sp-row { display: flex; padding: 5px 0; font-size: 11pt; font-weight: 700; color: #0f172a; }
.sp-row .l { flex-shrink: 0; }
.sp-row .c { margin-right: 12px; }
.sp-row .u { margin-left: 24px; }
.sp-row .nr { margin-left: 12px; font-size: 12px; color: #475569; }
.sfa-title { margin-top: 12px; text-align: center; font-size: 18px; font-weight: 700; color: #0f172a; }
.sfa-sec { margin-top: 10px; }
.sfa-sec.first { margin-top: 12px; }
.sfa-head { display: flex; align-items: flex-end; justify-content: space-between; border-bottom: 1px solid #cbd5e1; padding-bottom: 2px; }
.sfa-head p:first-child { font-size: 14px; font-weight: 700; font-style: italic; text-decoration: underline; }
.sfa-head p + p { margin-right: 8px; font-size: 12px; font-weight: 700; font-style: italic; }
.sfa-rows { margin-top: 4px; padding-left: 24px; }
.sfa-row { display: grid; grid-template-columns: 46mm 6mm 52mm 1fr; padding: 1.5px 0; font-size: 11pt; font-weight: 700; color: #0f172a; }
.sfa-row .u { margin-left: 20px; }
.gen-title { margin-top: 24px; border-bottom: 2px solid #0f766e; padding-bottom: 4px; font-size: 15px; font-weight: 700; text-transform: uppercase; letter-spacing: .025em; color: #0f766e; }
.gen-sec { margin-top: 16px; }
.gen-head { margin-bottom: 6px; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .025em; color: #64748b; }
.gen-grid { display: grid; grid-template-columns: 1fr 1fr; column-gap: 32px; row-gap: 4px; font-size: 11pt; font-weight: 700; }
.gen-grid > div { display: flex; justify-content: space-between; border-bottom: 1px dotted #e2e8f0; padding: 4px 0; }
.gen-grid .k { color: #475569; }
.gen-grid .val { font-weight: 500; color: #0f172a; }

/* hidden copy of a sheet, used to measure how many rows fit on one page */
.probe { position: fixed; left: -10000px; top: 0; visibility: hidden; pointer-events: none; direction: ltr; }
.probe-body { position: relative; }
.probe-holder { position: absolute; left: 0; right: 0; top: 0; }
table.rows.flush { margin-top: 0; }
.pending { padding: 36px 32px; text-align: center; }
.pending h2 { font-family: var(--serif); color: #123a57; }
html[dir="rtl"] .pending h2 { font-family: var(--arabic); }
.progress { height: 10px; background: #e6ecf0; border-radius: 999px; overflow: hidden; max-width: 360px; margin: 18px auto; }
.progress span { display: block; height: 100%; background: #0f9693; }

/* ---------- visits + trends ---------- */
.results-grid { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 20px; align-items: start; }
.results-grid.single { grid-template-columns: minmax(0, 1fr); }

/* "Your personal code" box and the note about which visit is on screen */
.mycode { display: flex; align-items: center; justify-content: space-between; gap: 16px 24px; flex-wrap: wrap; padding: 16px 20px; margin-bottom: 18px; border-inline-start: 4px solid var(--teal); }
.mycode h2 { font: 700 1.1rem var(--serif); color: var(--navy); margin: 0 0 2px; }
html[dir="rtl"] .mycode h2 { font-family: var(--arabic); }
.mycode p { margin: 0; color: var(--muted); font-size: .92rem; max-width: 60ch; }
.mycode-box { display: flex; align-items: center; gap: 10px; }
.mycode-value { font: 700 1.5rem/1 Consolas, "Courier New", monospace; letter-spacing: .16em; padding: 10px 14px; border: 2px solid var(--navy); border-radius: 8px; color: var(--navy); background: var(--surface-2); }
.btn-small { padding: 8px 14px; font-size: .9rem; }
.visits-hint { margin: -4px 6px 10px; font-size: .85rem; color: var(--muted); }
.viewing { display: flex; align-items: center; justify-content: space-between; gap: 10px 16px; flex-wrap: wrap; margin-bottom: 14px; padding: 12px 16px; border-radius: 10px; background: var(--teal-soft); border: 1px solid var(--teal); color: var(--ink); }
.viewing p { margin: 0; font-weight: 600; }
.viewing.viewing-old { background: #fff7e6; border-color: #e0a400; color: #3d2c00; }
/* older visits open after the year of birth */
.unlock-form { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.unlock-form label { margin: 0; }
.unlock-form input[type="text"] { width: 6.5em; padding: 8px 10px; font-size: 1.1rem; letter-spacing: .08em; }
.viewing .unlock-msg { flex-basis: 100%; color: var(--high); }
.visits { padding: 18px 14px; position: sticky; top: 16px; }
.visits h2 { font: 700 1.05rem var(--serif); color: var(--navy); margin: 0 6px 10px; }
html[dir="rtl"] .visits h2 { font-family: var(--arabic); }
.visits ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.visit { width: 100%; text-align: start; font: inherit; color: var(--ink); background: transparent; border: 1px solid transparent; border-radius: 10px; padding: 10px 12px; cursor: pointer; display: grid; gap: 2px; }
.visit:hover { background: var(--surface-2); }
.visit[aria-current="true"] { background: var(--teal-soft); border-color: var(--teal); }
.visit-date { font-weight: 700; font-variant-numeric: tabular-nums; }
.visit-sub { font-size: .82rem; color: var(--muted); }
.badge { justify-self: start; display: inline-block; white-space: nowrap; font-size: .74rem; font-weight: 600; padding: 1px 8px; border-radius: 999px; margin-top: 4px; }
.badge-ready { background: var(--teal-soft); color: var(--teal); border: 1px solid var(--teal); }
.badge-pending { background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); }
.badge-code { background: var(--navy); color: #fff; margin-inline-start: 4px; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .badge-code { color: #0e151b; } }

.trends { margin-top: 28px; }
.trends h2 { font: 700 1.4rem var(--serif); color: var(--navy); margin-bottom: 4px; }
html[dir="rtl"] .trends h2 { font-family: var(--arabic); }
.trends > p { color: var(--muted); margin: 0 0 16px; }
.trend-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.trend { padding: 16px 18px; }
.trend h3 { font-size: 1rem; margin: 0; color: var(--navy); direction: ltr; text-align: left; }
.trend .trend-range { font-size: .8rem; color: var(--muted); margin: 2px 0 10px; white-space: pre-line; direction: ltr; text-align: left; }
.trend table { width: 100%; border-collapse: collapse; font-size: .92rem; font-variant-numeric: tabular-nums; direction: ltr; }
.trend td { padding: 5px 0; border-top: 1px solid var(--line); }
.trend td:first-child { color: var(--muted); }
.trend td:last-child { text-align: right; font-weight: 700; white-space: nowrap; }
.trend tr:last-child td { color: var(--ink); }
.trend .move { display: inline-block; width: 1.1em; color: var(--muted); font-weight: 400; }
.trend .is-H { color: var(--high); }
.trend .is-L { color: var(--low); }

/* ---------- small screens ---------- */
@media (max-width: 880px) {
  .results-grid { grid-template-columns: minmax(0, 1fr); }
  .visits { position: static; min-width: 0; }
  .visits ol { grid-auto-flow: column; grid-auto-columns: minmax(170px, 1fr); overflow-x: auto; padding-bottom: 4px; }
}
@media (max-width: 880px) {
  .hero { padding: 36px 0 44px; }
  .hero-grid, .about-grid { grid-template-columns: 1fr; gap: 28px; }
  .steps { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .topbar-inner { justify-content: center; }
  .brand-name { font-size: 1.05rem; }
  .form-card { padding: 22px 18px; }
  .contact-items { grid-template-columns: 1fr; }
  .how, .about, .contact { padding: 44px 0; }
  .report-actions .btn { flex: 1; }
}

/* ---------- printing: exactly the A4 sheets, like the lab's printed report ---------- */
@media print {
  @page { size: A4; margin: 0; }
  html, body { margin: 0 !important; padding: 0 !important; background: #fff !important; }
  .topbar, .footer, #home, .report-actions, .skip, .visits, .trends, .report-hint, .probe, .mycode, .viewing { display: none !important; }
  .results-grid { display: block; }
  #results { padding: 0; }
  .wrap { max-width: none; padding: 0; margin: 0; }
  .page-slot { width: auto !important; height: auto !important; margin: 0 !important; box-shadow: none !important; overflow: visible !important; }
  .page-slot + .page-slot { break-before: page; page-break-before: always; }
  .a4 { transform: none !important; width: 210mm !important; }
  .a4:not(.fixed) { min-height: 296mm !important; }
}
