/* AFIYA web client layout (thin UI over the local API). SYNTHETIC data only. No inline styles anywhere: the page runs under a strict CSP. */
html, body { min-height: 100%; }
body { padding: env(safe-area-inset-top, 0) 0 0 0; }
.app { max-width: 480px; margin: 0 auto; min-height: calc(100dvh - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px)); display: flex; flex-direction: column; background: var(--bg); position: relative; }
.app > div { flex: 1; display: flex; flex-direction: column; }
.page { flex: 1; padding: 0 var(--gutter) var(--s8); }
.noscript { padding: var(--s6); }
.devbar { background: #E9B52E; color: #4a3300; font: 700 11px var(--font-body); letter-spacing: .08em; text-transform: uppercase; text-align: center; padding: 4px 8px; }
.page.center { display: flex; flex-direction: column; justify-content: center; text-align: center; }
.page .top-gap { margin-top: var(--s8); }
.mt2 { margin-top: var(--s2); } .mt3 { margin-top: var(--s3); } .mt4 { margin-top: var(--s4); } .mt5 { margin-top: var(--s5); }
.mt6 { margin-top: var(--s6); } .mt8 { margin-top: var(--s8); } .mb4 { margin-bottom: var(--s4); } .mb5 { margin-bottom: var(--s5); }
.block { display: flex; width: 100%; }
.btn.ghost { background: transparent; color: var(--brand-ink); }
.btn.danger { background: var(--danger); color: #fff; }
.btn.tonal { background: var(--brand-soft); color: var(--brand-ink); }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn.sm { min-height: 40px; padding: 0 var(--s4); font-size: var(--fs-sm); }
.link { color: var(--brand-ink); text-decoration: underline; font: inherit; min-height: 44px; padding: 0 4px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.art-mark { display: grid; place-items: center; }
.slide-art { margin: var(--s6) 0; }
.otp-wrap { position: relative; }
.otp-wrap input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; font-size: 16px; }
.otp-wrap:focus-within .otp i:nth-child(1) { outline: 3px solid var(--brand-soft); }
.errline { color: var(--danger); display: flex; gap: 6px; justify-content: center; margin-top: var(--s3); font-size: var(--fs-sm); }
.check { cursor: pointer; }
.check svg { width: 16px; height: 16px; stroke: #fff; fill: none; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.check:not(.on) svg { display: none; }
.checkrow { display: flex; gap: var(--s3); align-items: flex-start; text-align: left; cursor: pointer; min-height: var(--tap); width: 100%; }
.li .grow { text-align: left; }
.li.static:active { background: var(--surface); }
.li .t, .li .s { display: block; }
.scrim { position: fixed; z-index: 40; }
.sheet { max-width: 480px; margin: 0 auto; max-height: 90dvh; }
.toast { position: fixed; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); max-width: 448px; margin: 0 auto; }
.nav { position: sticky; bottom: 0; z-index: 10; }
.nav.two { grid-template-columns: repeat(2, 1fr); }
.nav .ico { margin: 0 auto; }
/* The top bar belongs to the page and scrolls with it: nothing floats over the content, so nothing is cut off beneath a panel. */
.appbar { position: relative; z-index: 1; }
.chips.wrapchips { flex-wrap: wrap; overflow: visible; }
.field + .field { margin-top: var(--s5); }
.stack-lg > .field + .field { margin-top: 0; }
.list .li { background: transparent; }
button.li { cursor: pointer; }
.pill-note { display: inline-block; font-size: var(--fs-xs); background: var(--surface-3); border-radius: var(--r-pill); padding: 2px 10px; color: var(--ink-2); }
.spinner { width: 20px; height: 20px; border: 3px solid var(--brand-soft); border-top-color: var(--brand); border-radius: 50%; animation: spin .8s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
.row.top { align-items: flex-start; }
.kv-card .kv span:last-child { max-width: 60%; overflow-wrap: anywhere; }
@media (min-width: 520px) { .app { box-shadow: var(--shadow-2); } body { background: var(--surface-3); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation: none; } }
.tc { text-align: center; }
/* Target size: every control is at least 44 px high (the design asks for 48; chips and small buttons are raised to 44). */
.btn.sm { min-height: 44px; }
.seg button { min-height: 44px; }
.chip { min-height: 44px; }
.tog { box-sizing: content-box; height: 32px; border: solid transparent; border-width: 6px 0; background-clip: padding-box; }
.li .t, .li .s, .li .grow { overflow-wrap: anywhere; min-width: 0; }
.li { flex-wrap: nowrap; }
body { overflow-wrap: break-word; }
h1, h2, .h-display, .h-title, .lede, .btn { overflow-wrap: anywhere; }
h1[tabindex="-1"]:focus { outline: none; }          /* the heading takes focus on navigation for screen readers; it is not a control */
@media (max-width: 240px) { .h-display { font-size: 26px; } .h-title { font-size: 22px; } .app { font-size: 15px; } }
.nav.three { grid-template-columns: repeat(3, 1fr); }
.receipt { white-space: pre-wrap; overflow-wrap: anywhere; font-family: var(--font-body); margin: 0; }
#share-link { overflow-wrap: anywhere; user-select: all; }
.chip { white-space: normal; text-align: left; max-width: 100%; padding-top: 8px; padding-bottom: 8px; line-height: 1.25; }
.nav.four { grid-template-columns: repeat(4, 1fr); }
.input.tall { padding: var(--s3) var(--s4); min-height: 96px; resize: vertical; }
select.input { appearance: auto; }
.prog { width: 100%; height: 12px; }
.viewer { display: flex; flex-direction: column; gap: var(--s3); }
.viewimg { max-width: 100%; height: auto; border-radius: var(--r-md); }
.viewpdf { width: 100%; height: 70vh; min-height: 320px; border: 1px solid var(--line-2); border-radius: var(--r-md); background: var(--surface); }
.li .chips { margin-top: var(--s2); }
.sheet ul { padding-left: var(--s5); margin: var(--s2) 0; }
.sheet li + li { margin-top: var(--s1); }
/* Very narrow screens (zoom 200% on a phone): lists drop the icon and chevron and let a row wrap, so text and chips keep a readable width. */
@media (max-width: 240px) {
  button.li .cat, button.li > svg { display: none; }
  .li { flex-wrap: wrap; }
  .li .grow { flex: 1 1 100%; }
}
.stack-lg.recform > * + * { margin-top: var(--s5); }
.stack-lg.recform > .field + .field { margin-top: var(--s5); }
/* My Health timeline */
.nav button { min-width: 0; padding-left: 0; padding-right: 0; }
.nav button span { text-align: center; line-height: 1.15; overflow-wrap: anywhere; }
.tl-year { margin-top: var(--s5); }
.tl-item .datelabel { font-weight: 650; color: var(--ink); }
.tl-note { display: block; margin-top: var(--s2); white-space: pre-wrap; overflow-wrap: anywhere; }
.tl-actions { display: flex; flex-wrap: wrap; gap: var(--s2); margin-top: var(--s3); }
.tl-legend summary, .tl-filters summary { cursor: pointer; font-weight: 600; min-height: var(--tap); display: flex; align-items: center; }
.tl-dl { margin: var(--s3) 0 0; }
.tl-dl dt { font-weight: 650; margin-top: var(--s3); }
.tl-dl dd { margin: var(--s1) 0 0; color: var(--ink-2); font-size: 14px; }
@media (max-width: 240px) { .nav { grid-template-columns: repeat(3, 1fr); } }
/* Ask My Records */
.ask-title { display: block; overflow-wrap: anywhere; }
.ask-ev { margin-top: var(--s3); padding-top: var(--s3); border-top: 1px solid var(--line); }
.ask-ev:first-of-type { border-top: 0; padding-top: 0; }
.ask-snip { margin: var(--s1) 0 0; overflow-wrap: anywhere; }
.ask-snip mark { background: var(--brand-soft); color: var(--ink); font-weight: 650; padding: 0 2px; border-radius: 3px; }
.ask-sides { display: grid; grid-template-columns: 1fr; gap: var(--s3); }
@media (min-width: 560px) { .ask-sides { grid-template-columns: 1fr 1fr; } }
.ask-side { border: 1px solid var(--line-2); border-radius: var(--r-md); padding: var(--s3); background: var(--surface); }
.ask-value { font-weight: 650; overflow-wrap: anywhere; }
.ask-list { padding-left: var(--s5); margin: var(--s2) 0; }
.ask-partial { font-weight: 600; }
.ask-head { font-size: var(--fs-lg); line-height: 1.3; margin: var(--s5) 0 0; overflow-wrap: anywhere; }
/* System navigation bar (Android 15 edge-to-edge): the page leaves room for it; the floating bottom bar (theme.css) sits above it. */
body { padding-bottom: env(safe-area-inset-bottom, 0px); }

/* In-app PDF viewer */
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.pdfview { display: flex; flex-direction: column; gap: var(--s3); }
.pdfbar { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2); }
.pdfstate { font-weight: 650; padding: 0 var(--s2); }
.pdfscroll { overflow: auto; max-height: 72vh; border: 1px solid var(--line-2); border-radius: var(--r-md); background: var(--surface-2, #eee); }
.pdfpage { position: relative; margin: 0 auto; background: #fff; }
.pdfcanvas { display: block; }
.pdfhits { position: absolute; inset: 0; pointer-events: none; }
.pdf-hit { position: absolute; background: rgba(255, 205, 40, .42); outline: 2px solid rgba(200, 140, 0, .75); border-radius: 3px; }
.pdfnote { margin: 0; }

/* QR code for a share link */
.qrbox { display: grid; place-items: center; }
.qrimg { width: min(264px, 100%); height: auto; aspect-ratio: 1; background: #fff; padding: 8px; border-radius: var(--r-md); image-rendering: pixelated; }

/* QR sharing with approval */
.qr-name { overflow-wrap: anywhere; }
.qr-org { overflow-wrap: anywhere; }
.center { text-align: center; }

/* Photographed pages */
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: var(--s3); margin-top: var(--s2); }
.photo-cell { background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--r-md); padding: var(--s2); display: flex; flex-direction: column; gap: var(--s2); min-width: 0; }
.photo-thumb { width: 100%; height: 140px; object-fit: cover; border-radius: var(--r-sm, 8px); background: #eee; }
.photo-actions { display: flex; flex-wrap: wrap; gap: var(--s1); }

/* App lock screen: covers everything, shows nothing of the records behind it */
.lock-screen { position: fixed; inset: 0; z-index: 1000; display: grid; place-items: center; padding: var(--s5); background: var(--bg); background-image: var(--backdrop, none); background-size: cover; }
.lock-box { max-width: 420px; width: 100%; text-align: center; background: var(--surface); border-radius: var(--r-lg); padding: var(--s6) var(--s5); box-shadow: var(--shadow-1); }

/* What Afiya read */
.read-item { align-items: center; }
.read-page { margin-top: var(--s2); background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--r-md); padding: var(--s2) var(--s3); }
.read-page summary { cursor: pointer; font-weight: 600; min-height: var(--tap); display: flex; align-items: center; }
.readtext { white-space: pre-wrap; overflow-wrap: anywhere; font-family: var(--font-body); font-size: var(--fs-sm); margin: var(--s2) 0; }
.h-sub { font-size: var(--fs-md); font-weight: 650; }
