/* HxNote. Design 1a "step by step": Atkinson Hyperlegible, large targets, teal accent. */
:root {
  --ink: #13212b; --soft: #4b5a64; --mute: #9aa7ae; --line: #d5dde1; --line2: #e3e8eb;
  --teal: #0f6e78; --tint: #e3f1f2; --chip: #edf2f4; --bg: #fbfcfc; --page: #f4f6f7;
  --danger: #8a2b1d; --amber: #b45309; --zone: #dfe7ea;
}
* { box-sizing: border-box; }
html { font-size: clamp(16px, 5vw, 22px); }
html, body { margin: 0; height: 100%; }
body {
  background: var(--page); color: var(--ink); -webkit-font-smoothing: antialiased;
  font: 1rem/1.4 'Atkinson Hyperlegible', 'IBM Plex Sans Arabic', system-ui, sans-serif;
  -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent;
}
html[dir=rtl] body, [lang=ar] { font-family: 'IBM Plex Sans Arabic', 'Atkinson Hyperlegible', system-ui, sans-serif; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
h1 { font-size: 1.5rem; line-height: 1.2; margin: 0; font-weight: 700; }
h2 { font-size: 1.25rem; line-height: 1.2; margin: 0.625rem 0 0; font-weight: 700; }
p { margin: 0; }

#app {
  max-width: 20rem; margin: 0 auto; height: 100dvh; display: flex; flex-direction: column;
  background: var(--bg); position: relative; overflow: hidden;
}
.top { padding: calc(0.875rem + env(safe-area-inset-top)) 1.125rem 0; display: flex; flex-direction: column; gap: 0.625rem; flex: none; }
.progress { display: flex; gap: 0.25rem; }
.progress i { flex: 1; height: 0.3125rem; border-radius: 0.1875rem; background: var(--line); }
.progress i.on { background: var(--teal); }
.body { flex: 1; overflow-y: auto; padding: 0.875rem 1.125rem 1.125rem; display: flex; flex-direction: column; gap: 0.875rem; }
.bottom { flex: none; padding: 0.75rem 1.125rem calc(1.125rem + env(safe-area-inset-bottom)); background: var(--bg); }

.tag { font-size: 0.875rem; color: var(--teal); font-weight: 700; }
.hint { font-size: 0.875rem; color: var(--soft); }
.hint.center, .center { text-align: center; justify-content: center; }
.sub { font-size: 0.875rem; color: var(--soft); margin-top: 0.25rem; }
.note { font-size: 0.875rem; line-height: 1.45; color: var(--ink); background: var(--tint); border-radius: 0.75rem; padding: 0.75rem 0.875rem; }
.error { color: var(--danger); font-weight: 700; font-size: 0.9375rem; }
.eyebrow { font-size: 0.8125rem; letter-spacing: .06em; text-transform: uppercase; color: var(--soft); }
.big { font-size: 1.875rem; line-height: 1.15; }
.lead { font-size: 1rem; line-height: 1.45; color: #3c4a54; }
.welcome { padding-top: calc(2.5rem + env(safe-area-inset-top)); gap: 1.125rem; }
.bigtick { width: 4rem; height: 4rem; border-radius: 50%; background: var(--teal); color: #fff; font-size: 2.125rem; display: flex; align-items: center; justify-content: center; }

.link { background: none; border: 0; padding: 0.375rem 0; color: var(--teal); font-weight: 700; font-size: 0.9375rem; text-align: start; align-self: flex-start; }
.btn { width: 100%; min-height: 3.5rem; border-radius: 0.875rem; border: 0; font-size: 1.125rem; font-weight: 700; padding: 0.5rem 1rem; }
.btn.primary, .btn.dark { background: var(--teal); color: #fff; }
.btn.outline { background: none; border: 2px solid var(--teal); color: var(--teal); min-height: 3.25rem; font-size: 1rem; }
.btn.danger { background: none; border: 1.5px solid #b9c5cb; color: var(--danger); }
.btn:disabled { opacity: .4; cursor: default; }

.langs { margin-top: auto; display: flex; flex-direction: column; gap: 0.625rem; }
.lang { height: 3.75rem; border-radius: 0.875rem; background: #fff; border: 2px solid var(--line); display: flex; align-items: center; justify-content: space-between; padding: 0 1.25rem; font-size: 1.1875rem; font-weight: 700; }
.lang.first { background: var(--teal); border-color: var(--teal); color: #fff; }
.lang.ar { font-size: 1.25rem; }

.stack { display: flex; flex-direction: column; gap: 0.5rem; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 0.375rem; }
.three { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0.375rem; }
.opt { min-height: 3rem; border-radius: 0.75rem; border: 2px solid var(--line); background: #fff; font-weight: 700; font-size: 0.9375rem; padding: 0.5rem 0.875rem; text-align: start; }
.two .opt, .three .opt { text-align: center; }
.opt.on { background: var(--teal); border-color: var(--teal); color: #fff; }

.chips { display: flex; flex-wrap: wrap; gap: 0.375rem; }
.chip { padding: 0.5625rem 0.8125rem; border-radius: 62.4375rem; border: 1.5px solid var(--line); background: #fff; font-weight: 700; font-size: 0.875rem; text-align: start; }
.chip.on { background: var(--teal); border-color: var(--teal); color: #fff; }

.field { display: flex; flex-direction: column; gap: 0.375rem; font-size: 0.875rem; color: var(--soft); }
input[type=text], input[type=password], input[type=search], select, textarea {
  min-height: 3rem; border-radius: 0.75rem; border: 2px solid var(--line); background: #fff; padding: 0.5rem 0.75rem; font-size: 1.0625rem; color: var(--ink); width: 100%;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--teal); outline-offset: 1px; border-color: var(--teal); }
button:focus-visible { outline: 0.1875rem solid var(--teal); outline-offset: 2px; }
.dob { display: grid; grid-template-columns: 1fr 1.6fr 1.2fr; gap: 0.375rem; }

.rows { display: flex; flex-direction: column; gap: 0.375rem; }
.row { border-radius: 0.75rem; background: #fff; border: 1.5px solid var(--line2); }
.row.on { background: var(--tint); border-color: var(--teal); }
.rowbtn { width: 100%; min-height: 2.75rem; display: flex; align-items: center; gap: 0.75rem; padding: 0.5rem 0.75rem; background: none; border: 0; text-align: start; }
.box { width: 1.375rem; height: 1.375rem; border-radius: 0.375rem; flex: none; background: #fff; border: 2px solid #b9c5cb; color: #fff; font-size: 0.875rem; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.row.on .box { background: var(--teal); border-color: var(--teal); }
.rowlabel { font-size: 0.9375rem; font-weight: 700; }
.rowextra { padding: 0 0.75rem 0.75rem 2.875rem; }
html[dir=rtl] .rowextra { padding: 0 2.875rem 0.75rem 0.75rem; }

.said { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 0.375rem; }
.said li { background: var(--tint); border-radius: 0.75rem; padding: 0.625rem 0.875rem; font-weight: 700; }

/* Body map */
.bodymap { position: relative; width: 15.875rem; height: 24rem; margin: 0.25rem auto 0; flex: none; direction: ltr; }
.zone { position: absolute; border: 0; padding: 0; background: var(--zone); }
.zone.on { background: var(--teal); box-shadow: 0 0 0 0.375rem rgba(15, 110, 120, .22); }
.zone.head { left: 6rem; top: 0; width: 3.875rem; height: 4.5rem; border-radius: 50%; }
.zone.chest { left: 4.125rem; top: 4.9375rem; width: 7.625rem; height: 5.25rem; border-radius: 1.875rem 1.875rem 0.625rem 0.625rem; }
.zone.belly { left: 4.375rem; top: 10.5rem; width: 7.125rem; height: 2.25rem; border-radius: 0.625rem; }
.zone.pelvis { left: 4.375rem; top: 13rem; width: 7.125rem; height: 2.25rem; border-radius: 0.625rem 0.625rem 1.125rem 1.125rem; }
.zone.arm { top: 5.25rem; width: 1.9375rem; height: 9.5rem; border-radius: 0.9375rem; }
.zone.arm.l { left: 1.875rem; } .zone.arm.r { left: 12.0625rem; }
.zone.leg { top: 15.625rem; width: 3rem; height: 8.25rem; border-radius: 1.125rem; }
.zone.leg.l { left: 4.625rem; } .zone.leg.r { left: 8.25rem; }
.alt { margin-top: auto; display: flex; flex-direction: column; gap: 0.5rem; padding-top: 0.5rem; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0.375rem; }
.sys { min-height: 3rem; border-radius: 0.625rem; background: #fff; border: 1.5px solid var(--line); padding: 0.375rem 0.625rem; font-size: 0.875rem; font-weight: 700; line-height: 1.15; text-align: start; }

.scrim { position: absolute; inset: 0; background: rgba(19, 33, 43, .25); z-index: 5; }
.sheet { position: absolute; left: 0; right: 0; bottom: 0; z-index: 6; background: #fff; border-radius: 1.5rem 1.5rem 0 0; box-shadow: 0 -0.375rem 1.5rem rgba(19, 33, 43, .12); padding: 0.875rem 1.125rem calc(1.375rem + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 0.625rem; max-height: 75%; overflow-y: auto; }
.grab { width: 2.5rem; height: 0.25rem; border-radius: 2px; background: var(--line); margin: 0 auto; flex: none; }
.sheethead { display: flex; justify-content: space-between; align-items: center; gap: 0.75rem; }
.sheethead h2 { margin: 0; font-size: 1.125rem; }
.close { width: 2.5rem; height: 2.5rem; border-radius: 50%; background: var(--chip); border: 0; font-size: 1.25rem; flex: none; }

/* Scroll wheels */
.wheels { position: relative; display: grid; grid-template-columns: 1fr 1.4fr; gap: 0.5rem; background: #fff; border: 2px solid var(--line); border-radius: 0.875rem; padding: 0.375rem; height: 9.25rem; direction: ltr; }
.band { position: absolute; left: 0.375rem; right: 0.375rem; top: 3.125rem; height: 2.75rem; border-radius: 0.5rem; background: var(--tint); pointer-events: none; }
.wheel { position: relative; height: 8.25rem; overflow-y: scroll; scroll-snap-type: y mandatory; scrollbar-width: none; text-align: center; outline: none; }
.wheel::-webkit-scrollbar { display: none; }
.pad { height: 2.75rem; }
.wi { height: 2.75rem; line-height: 2.75rem; scroll-snap-align: center; font-size: 1rem; color: var(--mute); cursor: pointer; }
.wi.sel { font-size: 1.5rem; font-weight: 700; color: var(--ink); }
.wheels.untouched .band { background: var(--chip); }
.wheels.untouched .wi.sel { color: var(--mute); }
.search { margin-bottom: 2px; }

/* ---------- Doctor ---------- */
body.d #app { max-width: none; background: var(--page); }
.split { flex: 1; min-height: 0; display: flex; }
.pane { flex: 1; min-width: 0; overflow-y: auto; background: var(--bg); display: flex; flex-direction: column; gap: 0.75rem; padding: calc(1.5rem + env(safe-area-inset-top)) 1rem calc(1.125rem + env(safe-area-inset-bottom)); }
.split.has-detail .pane.list, .split:not(.has-detail) .pane.detail { display: none; }
.panehead h1 { font-size: 1.625rem; }
.cards { display: flex; flex-direction: column; gap: 0.5rem; }
.card { display: grid; grid-template-columns: 1fr auto; gap: 2px 0.625rem; padding: 0.75rem 0.875rem; border-radius: 0.75rem; background: #fff; border: 1.5px solid var(--line2); text-align: start; }
.card.on { background: var(--tint); border-color: var(--teal); }
.card .name { font-size: 1rem; font-weight: 700; }
.card .ago { font-size: 0.8125rem; font-weight: 700; color: var(--soft); }
.card .ago.old, .card .oldnote { color: var(--amber); }
.card .what { font-size: 0.875rem; color: var(--soft); }
.card .oldnote { font-size: 0.75rem; }
.empty { color: var(--soft); padding: 1.5rem 0; text-align: center; }
.foot { margin-top: auto; }
.menu { display: flex; flex-wrap: wrap; gap: 0.25rem 1.125rem; border-top: 1px solid var(--line2); padding-top: 0.5rem; }
.detailhead { display: flex; flex-direction: column; gap: 0.25rem; padding-bottom: 0.75rem; border-bottom: 1px solid var(--line2); }
.sheet-print { display: flex; flex-direction: column; gap: 0.875rem; font-size: 0.9375rem; line-height: 1.45; }
.sheet-print .sheethead { display: none; align-items: flex-end; border-bottom: 2px solid var(--ink); padding-bottom: 0.75rem; }
.sheet-print .who { font-size: 1.75rem; font-weight: 700; }
.sheet-print .meta { font-size: 0.8125rem; color: var(--soft); text-align: right; }
.sheet-print dl { margin: 0; display: flex; flex-direction: column; gap: 2px; }
.sheet-print dt { font-size: 0.75rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--soft); margin-top: 0.625rem; }
.sheet-print dd { margin: 0; }
.actions { margin-top: auto; display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; padding-top: 0.75rem; position: sticky; bottom: 0; background: var(--bg); }
.actions .btn { min-height: 3.125rem; font-size: 1rem; border-radius: 0.75rem; }
main.subview { max-width: 32.5rem; width: 100%; margin: 0 auto; padding-top: calc(1.5rem + env(safe-area-inset-top)); }
.qrcard { background: #fff; border: 1px solid var(--line); border-radius: 1rem; padding: 1.5rem; display: flex; flex-direction: column; gap: 0.625rem; align-items: center; text-align: center; }
.qrcard h2 { margin: 0; font-size: 1.5rem; }
.qrcard .small { font-size: 0.75rem; color: var(--soft); }
.qr { width: 100%; max-width: 17.5rem; height: auto; fill: #000; background: #fff; }
.code { display: block; word-break: break-all; font: 0.8125rem/1.5 ui-monospace, Menlo, monospace; background: var(--chip); border-radius: 0.625rem; padding: 0.75rem; user-select: all; }
body.d .welcome { max-width: 30rem; width: 100%; margin: 0 auto; }

/* Screen only: the printed sheet must never carry the waiting list, whatever the paper width. */
@media screen and (min-width: 900px) {
  .split { gap: 1.5rem; padding: 1.5rem; }
  .split .pane { border-radius: 1.25rem; border: 1px solid #dde3e6; padding: 1.75rem; }
  .split .pane.list, .split .pane.detail { display: flex !important; }
  .split .pane.list { flex: none; width: 27.5rem; }
  .backlist { display: none; }
  .actions { grid-template-columns: auto auto; justify-content: end; }
  .actions .btn { padding: 0 1.375rem; width: auto; }
  .sheet-print { background: #fff; border: 1px solid var(--line); box-shadow: 0 2px 0.875rem rgba(19, 33, 43, .08); padding: 2.25rem 2.75rem; }
  .sheet-print .sheethead { display: flex; justify-content: space-between; }
  .sheet-print dl { display: grid; grid-template-columns: 9.375rem 1fr; gap: 0.75rem 1.25rem; }
  .sheet-print dt { font-size: 0.9375rem; letter-spacing: 0; text-transform: none; color: var(--ink); margin: 0; }
}

/* The printed sheet never shows the patient's name. */
@media print {
  html, body, #app { height: auto; background: #fff; overflow: visible; }
  .split, .pane { display: block !important; padding: 0; border: 0; border-radius: 0; gap: 0; overflow: visible; background: #fff; }
  .split .pane.list, .pane.list, .detailhead, .actions, .link, .btn, .hint, .note, main.subview > h1, .code { display: none !important; }
  .sheet-print { border: 0; box-shadow: none; padding: 0; }
  .sheet-print .sheethead { display: flex; justify-content: space-between; }
  .sheet-print dl { display: grid; grid-template-columns: 9.375rem 1fr; gap: 0.75rem 1.25rem; }
  .sheet-print dt { font-size: 0.9375rem; letter-spacing: 0; text-transform: none; color: #000; margin: 0; }
  .qrcard { border: 1px solid #000; max-width: 105mm; margin: 0 auto; }
}

/* Reassurance card on the last screen */
.safe { background: var(--tint); border-radius: 1rem; padding: 1rem 1.125rem; display: flex; flex-direction: column; gap: 0.75rem; }
.safe h2 { margin: 0; font-size: 1.125rem; display: flex; align-items: center; gap: 0.625rem; }
.lock { position: relative; width: 1.125rem; height: 0.875rem; border-radius: 0.1875rem; background: var(--teal); margin-top: 0.5rem; flex: none; }
.lock::before { content: ''; position: absolute; left: 0.1875rem; top: -0.5625rem; width: 0.5rem; height: 0.5625rem; border: 0.1562rem solid var(--teal); border-bottom: 0; border-radius: 0.375rem 0.375rem 0 0; }
.safe ul { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 0.5625rem; }
.safe li { position: relative; padding-inline-start: 1.75rem; font-size: 0.9375rem; line-height: 1.4; }
.safe li::before { content: '✓'; position: absolute; inset-inline-start: 0; top: 1px; width: 1.1875rem; height: 1.1875rem; border-radius: 50%; background: var(--teal); color: #fff; font-size: 0.75rem; font-weight: 700; display: flex; align-items: center; justify-content: center; }

/* ---------- Layout pass: same proportions as the design, on any screen ---------- */
.logo { height: 2.25rem; border-radius: 0.6875rem; background: var(--teal); color: #fff; display: inline-flex; align-items: center; gap: 0.375rem; padding: 0 0.8125rem 0 0.6875rem; font-size: 1.125rem; line-height: 1; flex: none; align-self: flex-start; }
.logo b { font-weight: 700; letter-spacing: -0.03em; }
.logo i { width: 1.5px; height: 1rem; background: #9fd6db; }
.logo.sm { height: 1.875rem; border-radius: 0.5625rem; font-size: 0.9375rem; padding: 0 0.6875rem 0 0.5625rem; gap: 0.3125rem; }
.logo.sm i { height: 0.8125rem; }
.notice { background: var(--chip); border-radius: 0.75rem; padding: 0.75rem 0.875rem; font-size: 0.8125rem; line-height: 1.45; }
.body.welcome { padding: calc(2.5rem + env(safe-area-inset-top)) 1.375rem calc(1.5rem + env(safe-area-inset-bottom)); gap: 1.25rem; }
.top { padding: calc(1.25rem + env(safe-area-inset-top)) 1.125rem 0; }
.chips.soft .chip { background: var(--chip); border-color: var(--chip); }
.chips.soft .chip.on { background: var(--teal); border-color: var(--teal); }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 0.375rem; }
.pair .field { font-size: 0.8125rem; gap: 0.25rem; }
.pair select { min-height: 2.5rem; border-radius: 0.625rem; font-size: 1rem; padding: 0.25rem 0.5rem; }
.wheels { height: auto; }
.wheel { height: 8.25rem; }

/* On a wide screen the patient form sits in a phone-sized card instead of a stretched column. */
@media (min-width: 500px) {
  body.f, body:not(.d) { display: flex; align-items: center; justify-content: center; }
  body.f #app, body:not(.d) #app { width: 20rem; height: min(100dvh - 2rem, 43rem); border-radius: 1.75rem; box-shadow: 0 0.5rem 2.5rem rgba(19, 33, 43, .14); }
}
/* The doctor's desk view keeps normal desktop sizes. */
@media (min-width: 900px) { html:has(body.d) { font-size: 16px; } }
/* Body map a little smaller so the whole screen fits without scrolling on a real phone. */
.bodymap { zoom: 0.82; }
.alt { padding-top: 0.25rem; }
.two.uneven { grid-template-columns: 1fr 1.35fr; }
.two.uneven .opt { padding: 0.5rem; }
/* Dropdowns: our own chevron and a single clean focus ring, instead of the browser's default look. */
select {
  appearance: none; -webkit-appearance: none; font-weight: 700; cursor: pointer;
  padding-inline: 0.875rem 2.125rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1.5 1.5 6 6l4.5-4.5' fill='none' stroke='%230f6e78' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-size: 0.75rem 0.5rem; background-position: right 0.75rem center;
}
html[dir=rtl] select { background-position: left 0.75rem center; }
select:invalid, select.empty { color: var(--mute); font-weight: 400; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--teal); box-shadow: 0 0 0 0.1875rem rgba(15, 110, 120, .18); }
.dob { grid-template-columns: 0.9fr 1.5fr 1.15fr; gap: 0.375rem; }
.dob select { padding-inline: 0.75rem 1.75rem; background-position: right 0.5625rem center; }
html[dir=rtl] .dob select { background-position: left 0.5625rem center; }
.pair select { padding-inline: 0.625rem 1.75rem; }
/* Date of birth: the month needs the room ("September"), the day needs very little. */
.dob { grid-template-columns: 0.86fr 1.6fr 1.04fr; }
.dob select { font-size: 1rem; padding-inline: 0.625rem 1.5rem; background-position: right 0.5rem center; background-size: 0.6875rem 0.4375rem; text-overflow: ellipsis; }
html[dir=rtl] .dob select { background-position: left 0.5rem center; }

/* A message the patient must not miss */
.important { display: flex; gap: 0.75rem; align-items: flex-start; background: #fdf3e2; border: 1.5px solid #f0c987; border-radius: 0.875rem; padding: 0.875rem 1rem; }
.important p { font-size: 0.9375rem; line-height: 1.4; font-weight: 700; color: var(--ink); }
.bang { flex: none; width: 1.5rem; height: 1.5rem; border-radius: 50%; background: var(--amber); color: #fff; font-weight: 700; font-size: 1rem; line-height: 1; display: flex; align-items: center; justify-content: center; margin-top: 0.0625rem; }

/* First screen: everything above the language buttons stays compact so nothing needs scrolling. */
.body.welcome { padding: calc(1.5rem + env(safe-area-inset-top)) 1.375rem 0.75rem; gap: 0.75rem; }
.welcome .big { font-size: 1.625rem; }
.welcome .lead { font-size: 0.9375rem; line-height: 1.4; }
.important { padding: 0.625rem 0.75rem; gap: 0.625rem; }
.important p { font-size: 0.875rem; line-height: 1.35; }
.bang { width: 1.375rem; height: 1.375rem; font-size: 0.9375rem; }
.bottom.langs { margin-top: 0; gap: 0.4375rem; padding: 0.5rem 1.375rem calc(1.125rem + env(safe-area-inset-bottom)); }
.bottom.langs .lang { height: 3.125rem; width: 100%; }
/* Scale by height too, so a short phone shrinks the layout a little instead of pushing content off screen. */
html { font-size: clamp(16px, min(5vw, 2.6svh), 22px); }
@media (max-width: 499px) { #app { max-width: none; } }

/* First screen, as designed: warning under the intro, languages, then the data line as small print. */
.body.welcome { padding: calc(1.875rem + env(safe-area-inset-top)) 1.25rem 0.75rem; gap: 0.75rem; }
.welcome .big { font-size: 1.75rem; line-height: 1.15; }
.welcome .lead { font-size: 1rem; line-height: 1.4; }
.important { padding: 0.75rem 0.8125rem; }
.bottom.langs { gap: 0.5rem; padding: 0.5rem 1.25rem calc(1rem + env(safe-area-inset-bottom)); }
.bottom.langs .lang { height: 3.25rem; }
.fineprint { margin-top: 0.4375rem; padding-top: 0.625rem; border-top: 1px solid var(--line); font-size: 0.75rem; line-height: 1.45; color: var(--soft); }
.fineprint b { color: var(--ink); }
/* The design is 320 x 660: scale to whichever of width or height is the tighter fit. */
html { font-size: clamp(14px, min(5vw, 2.4svh), 22px); }
/* Never below 16px in a field, or iOS zooms the page when it gets focus. */
input[type=text], input[type=password], input[type=search], textarea { font-size: max(16px, 1.0625rem); }
select, .dob select, .pair select { font-size: max(16px, 1rem); }

/* Language picker: three buttons in a row, the current one highlighted, then the Start button. */
.langrow { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0.375rem; }
.bottom.langs .lang { height: 3rem; padding: 0 0.25rem; justify-content: center; font-size: 1rem; border-radius: 0.75rem; }
.bottom.langs .lang.ar { font-size: 1.0625rem; }
.lang.on { background: var(--tint); border-color: var(--teal); color: var(--teal); }
.bottom.langs .btn { margin-top: 0.25rem; }

/* Six languages: two rows of three. */
.langrow { grid-template-columns: 1fr 1fr 1fr; }
.bottom.langs .lang { height: 2.75rem; font-size: 0.9375rem; }

/* Demo mode banner (doctor app) */
button.logo { border: 0; cursor: default; font-family: inherit; -webkit-user-select: none; user-select: none; touch-action: manipulation; }
.demobar { display: flex; justify-content: space-between; align-items: center; gap: 0.75rem; background: #fdf3e2; border: 1.5px solid #f0c987; border-radius: 0.75rem; padding: 0.375rem 0.75rem; font-size: 0.8125rem; font-weight: 700; }
.demobar .link { padding: 0.25rem 0; font-size: 0.8125rem; color: var(--amber); align-self: center; }
@media print { .demobar, button.logo { display: none !important; } }
.demobar .link { white-space: nowrap; }
/* Phone: the Print / Delete bar reaches the bottom edge, so no text shows underneath it. */
@media (max-width: 899px) {
  .pane.detail { padding-bottom: 0; }
  .pane.detail .actions { padding-bottom: calc(1.125rem + env(safe-area-inset-bottom)); }
}
/* The doctor name on the QR card reads as a name, not as a shouted label. */
.qrcard .eyebrow { text-transform: none; letter-spacing: 0; font-size: 1rem; font-weight: 700; color: var(--ink); }
/* Draft preview banner (patient form opened from the administration) and the link to the administration */
.previewbar { flex: none; background: #fdf3e2; border-bottom: 1.5px solid #f0c987; color: var(--amber); font-size: 0.75rem; font-weight: 700; text-align: center; padding: 0.375rem 0.75rem; }
a.aslink { display: flex; align-items: center; justify-content: center; text-decoration: none; }

.previewbar { display: flex; align-items: center; justify-content: center; gap: 0.75rem; flex-wrap: wrap; }
.previewbar button { border: 1.5px solid var(--amber); background: #fff; color: var(--amber); border-radius: 999px; padding: 0.1875rem 0.75rem; font: inherit; font-weight: 700; }
.sheet-print .who { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 0.875rem; }
.sheet-print .who .sexage { font-size: 1.25rem; font-weight: 600; color: var(--soft); }

/* Public card: the summary shown on the patient's own phone, and printed as one sheet. */
.body.mine { gap: 0.75rem; }
.body.mine h1 { font-size: 1.5rem; margin: 0; }
.body.mine .sheet-print { background: #fff; border: 1px solid var(--line); border-radius: 0.875rem; padding: 1rem; }
.body.mine .sheet-print .sheethead { display: flex; flex-direction: column; align-items: flex-start; gap: 0.25rem; }
.body.mine .sheet-print .who { font-size: 1.375rem; }
.body.mine .sheet-print .meta { text-align: start; }
.bottom .btn.outline { margin-top: 0.5rem; }
@media print {
  .noprint { display: none !important; }
  body.f { display: block !important; }
  body.f #app { width: auto !important; height: auto !important; max-width: none; box-shadow: none; border-radius: 0; overflow: visible; display: block; }
  .body.mine { padding: 0; overflow: visible; display: block; }
  .body.mine .sheet-print { border: 0; border-radius: 0; padding: 0; }
  .body.mine .sheet-print .sheethead { flex-direction: row; justify-content: space-between; align-items: flex-end; }
  .body.mine .sheet-print .who { font-size: 1.75rem; }
  .body.mine .sheet-print .meta { text-align: right; }
}
/* Invitation under the QR code: six languages, so smaller text. */
.qrcard .invite { display: flex; flex-direction: column; gap: 0.3125rem; font-size: 0.8125rem; line-height: 1.35; }
.qrcard .invite p { margin: 0; }
/* Home page: patient or doctor */
.bottom.home { display: flex; flex-direction: column; }
.qrcard .small.url { font-size: 0.875rem; font-weight: 700; color: var(--ink); margin: 0; }
