/* Ovamha: mobile-first, offline (system fonts, no external assets). */
:root {
  --blue: #0072C6;          /* Sierra Leone flag blue */
  --blue-600: #005EA3;
  --blue-700: #004A80;
  --blue-50: #EAF4FC;
  --blue-100: #D3E8F8;
  --sky: #CFE6F8;
  --ink: #0E2235;
  --ink-2: #4A6075;
  --ink-3: #8397A9;
  --line: #E3ECF4;
  --card: #FFFFFF;
  --bg: #FFFFFF;
  --green: #12805C;
  --green-50: #E7F6F0;
  --amber: #B45F06;
  --amber-50: #FFF4E5;
  --red: #C62828;
  --red-50: #FDECEC;
  --radius: 22px;
  --radius-sm: 14px;
  --shadow: 0 10px 30px rgba(14, 60, 110, 0.08), 0 2px 6px rgba(14, 60, 110, 0.05);
  --tap: 56px;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: #FFFFFF;
  color: var(--ink);
  font: 17px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; -webkit-tap-highlight-color: transparent; }
svg.i { width: 24px; height: 24px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* Phone-width app shell, centred on larger screens */
.shell { max-width: 480px; min-height: 100%; margin: 0 auto; background: var(--bg); position: relative; display: flex; flex-direction: column; }
@media (min-width: 560px) {
  body { padding: 24px 0; }
  .shell { min-height: calc(100% - 48px); border-radius: 36px; box-shadow: 0 30px 80px rgba(0, 60, 120, 0.18); overflow: hidden; }
}
.screen { flex: 1; padding: 20px 20px 120px; }
.enter .screen, .enter .welcome { animation: in .22s ease-out; }
@keyframes in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* Top bar */
.top { display: flex; align-items: center; gap: 12px; margin: 4px 0 18px; }
.top h1 { font-size: 1.35rem; margin: 0; flex: 1; letter-spacing: -0.01em; }
.icon-btn { width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center; background: var(--card); box-shadow: var(--shadow); color: var(--ink); }
.icon-btn.ghost { box-shadow: none; background: transparent; }
.icon-btn.blue { background: var(--blue); color: #fff; }
.icon-btn.soft { background: var(--blue-50); color: var(--blue); box-shadow: none; }

.badge { display: inline-flex; align-items: center; gap: 6px; font-size: .8rem; font-weight: 600; padding: 5px 10px; border-radius: 999px; background: var(--blue-50); color: var(--blue-700); }
.badge.green { background: var(--green-50); color: var(--green); }
.badge.amber { background: var(--amber-50); color: var(--amber); }
.badge.red { background: var(--red-50); color: var(--red); }
.badge svg.i { width: 15px; height: 15px; }

/* Buttons */
.btn { min-height: var(--tap); border-radius: 18px; padding: 0 22px; display: inline-flex; align-items: center; justify-content: center; gap: 10px; font-weight: 650; font-size: 1.05rem; width: 100%; transition: transform .08s, background .15s; }
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--blue); color: #fff; box-shadow: 0 8px 20px rgba(0, 114, 198, 0.28); }
.btn.primary:hover { background: var(--blue-600); }
.btn.outline { border: 2px solid var(--blue); color: var(--blue); background: #fff; }
.btn.soft { background: var(--blue-50); color: var(--blue-700); }
.btn.danger { background: var(--red); color: #fff; }
.btn[disabled] { opacity: .45; pointer-events: none; }
.row { display: flex; gap: 12px; }
.row > * { flex: 1; }
.stack > * + * { margin-top: 12px; }

/* Cards */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; border: 1px solid var(--line); }
.card + .card { margin-top: 14px; }
.card h3 { margin: 0 0 4px; font-size: 1.05rem; }
.muted { color: var(--ink-2); }
.small { font-size: .88rem; }
.tiny { font-size: .78rem; color: var(--ink-3); }
.section-title { font-size: 1.1rem; font-weight: 700; margin: 26px 2px 12px; display: flex; align-items: center; justify-content: space-between; }

/* Welcome */
.welcome { display: flex; flex-direction: column; min-height: 100vh; min-height: 100dvh; text-align: center; background: #fff; }
@media (min-width: 560px) { .welcome { min-height: calc(100vh - 48px); } }
.welcome .art { flex: 1; display: grid; place-items: center; min-height: 330px; padding: 36px 20px 8px;
  background: #fff; }
.welcome .art svg { max-width: 360px !important; }
.welcome .art svg { animation: in .35s ease-out; }
.welcome-text { padding: 8px 26px 34px; }
.welcome h2 { font-size: 1.9rem; line-height: 1.18; margin: 6px 0 10px; letter-spacing: -0.02em; }
.welcome p { color: var(--ink-2); margin: 0 auto 20px; max-width: 330px; }
.brand { display: flex; align-items: center; justify-content: center; gap: 8px; font-weight: 800; color: var(--blue); font-size: 1.15rem; }
.dots { display: flex; justify-content: center; gap: 6px; margin: 4px 0 22px; }
.dots i { width: 8px; height: 8px; border-radius: 99px; background: var(--blue-100); }
.dots i.on { width: 26px; background: var(--blue); }
.brand { display: flex; align-items: center; justify-content: center; gap: 8px; font-weight: 800; color: var(--blue); font-size: 1.15rem; }

/* Login */
.people { display: grid; gap: 10px; }
.person { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-radius: 18px; background: var(--card); box-shadow: var(--shadow); text-align: left; border: 2px solid transparent; }
.person.on { border-color: var(--blue); background: var(--blue-50); }
.avatar { width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; color: var(--blue-700); background: linear-gradient(135deg, #D6EAFA, #EEF6FD); flex: none; }
.pin-dots { display: flex; justify-content: center; gap: 14px; margin: 18px 0 8px; }
.pin-dots i { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--blue); }
.pin-dots i.on { background: var(--blue); }
.pinpad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 14px; }
.pinpad button { height: 64px; border-radius: 18px; background: var(--card); box-shadow: var(--shadow); font-size: 1.5rem; font-weight: 650; }
.pinpad button.fn { background: transparent; box-shadow: none; display: grid; place-items: center; color: var(--ink-2); font-size: 1rem; }
.err { color: var(--red); font-weight: 600; text-align: center; min-height: 1.5em; margin-top: 8px; }

/* Home */
.hello { display: flex; align-items: center; gap: 12px; }
.hello .who { flex: 1; }
.hello .who small { color: var(--ink-3); display: block; font-size: .85rem; }
.hello .who b { font-size: 1.25rem; }
.hero { background: linear-gradient(135deg, var(--blue) 0%, #2E95E0 100%); color: #fff; border-radius: 26px; padding: 22px; margin-top: 20px; position: relative; overflow: hidden; box-shadow: 0 16px 30px rgba(0, 114, 198, 0.28); }
.hero h2 { margin: 0 0 6px; font-size: 1.4rem; }
.hero p { margin: 0 0 18px; opacity: .92; max-width: 75%; }
.hero .btn { background: #fff; color: var(--blue-700); width: auto; }
.hero .plus { position: absolute; right: -28px; bottom: -34px; opacity: .14; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { padding: 10px 16px; border-radius: 999px; background: var(--card); box-shadow: var(--shadow); font-weight: 600; min-height: 44px; }
.chip.on { background: var(--blue); color: #fff; }
.lang-switch { display: flex; gap: 8px; margin-top: 12px; }
.lang-switch .chip { min-height: 36px; padding: 6px 14px; box-shadow: none; border: 1px solid var(--line); }
.lang-switch .chip.on { border-color: var(--blue); }
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.tile { background: var(--card); border-radius: 20px; padding: 16px; box-shadow: var(--shadow); }
.tile .k { display: flex; justify-content: space-between; color: var(--ink-2); font-size: .9rem; }
.tile .v { font-size: 1.9rem; font-weight: 750; margin-top: 6px; }
.tile .v small { font-size: .85rem; color: var(--ink-3); font-weight: 600; margin-left: 4px; }

/* Bottom nav */
.nav { position: fixed; bottom: 0; left: 0; right: 0; max-width: 480px; margin: 0 auto; background: rgba(255,255,255,.96); backdrop-filter: blur(8px); border-top: 1px solid var(--line); display: flex; justify-content: space-around; padding: 10px 8px calc(10px + env(safe-area-inset-bottom)); z-index: 10; }
@media (min-width: 560px) { .nav { position: absolute; border-radius: 0 0 36px 36px; } }
.nav button { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: .75rem; color: var(--ink-3); min-width: 64px; padding: 4px; }
.nav button.on { color: var(--blue); }
.nav button.on::after { content: ""; width: 5px; height: 5px; border-radius: 50%; background: var(--blue); margin-top: 2px; }

/* Steps progress */
.steps { display: flex; gap: 6px; margin: -6px 0 18px; }
.steps i { flex: 1; height: 6px; border-radius: 99px; background: var(--blue-100); }
.steps i.on { background: var(--blue); }

/* Recorder */
.rec { text-align: center; padding: 26px 18px 22px; }
.mic { width: 132px; height: 132px; border-radius: 50%; margin: 10px auto 16px; display: grid; place-items: center; background: var(--blue); color: #fff; box-shadow: 0 0 0 14px var(--blue-50), 0 16px 30px rgba(0,114,198,.35); transition: transform .1s; }
.mic svg.i { width: 54px; height: 54px; }
.mic:active { transform: scale(.97); }
.mic.live { background: var(--red); box-shadow: 0 0 0 14px var(--red-50), 0 16px 30px rgba(198,40,40,.3); animation: pulse 1.4s infinite; }
@keyframes pulse { 0%,100% { box-shadow: 0 0 0 10px var(--red-50), 0 16px 30px rgba(198,40,40,.3); } 50% { box-shadow: 0 0 0 22px rgba(253,236,236,.6), 0 16px 30px rgba(198,40,40,.3); } }
.timer { font-variant-numeric: tabular-nums; font-size: 1.5rem; font-weight: 700; }
.wave { display: flex; justify-content: center; align-items: center; gap: 4px; height: 36px; margin: 6px 0; }
.wave i { width: 5px; border-radius: 4px; background: var(--blue-100); height: 10px; }
.live-wave i { background: var(--red); animation: bar 1s infinite ease-in-out; }
.live-wave i:nth-child(2n) { animation-delay: .15s; } .live-wave i:nth-child(3n) { animation-delay: .3s; }
@keyframes bar { 0%,100% { height: 8px; } 50% { height: 32px; } }
.link { color: var(--blue); font-weight: 650; text-decoration: underline; text-underline-offset: 3px; padding: 10px; }
textarea.input, input.input { width: 100%; border: 2px solid var(--line); border-radius: 16px; padding: 14px 16px; background: #fff; font-size: 1.05rem; outline: none; }
textarea.input:focus, input.input:focus { border-color: var(--blue); }
textarea.input { min-height: 120px; resize: vertical; }

/* Read-back items */
.item { background: var(--card); border-radius: 20px; box-shadow: var(--shadow); padding: 16px; border: 2px solid transparent; }
.item + .item { margin-top: 12px; }
.item.ok { border-color: #BFE6D6; background: #FBFEFD; }
.item.warn { border-color: #F6D9AE; }
.item .head { display: flex; align-items: center; gap: 12px; }
.item .ico { width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; background: var(--blue-50); color: var(--blue); flex: none; }
.item.warn .ico { background: var(--amber-50); color: var(--amber); }
.item.ok .ico { background: var(--green-50); color: var(--green); }
.item .t { flex: 1; min-width: 0; }
.item .t b { display: block; font-size: 1.05rem; }
.item .val { font-size: 1.25rem; font-weight: 750; color: var(--blue-700); }
.item.ok .val { color: var(--green); }
.item .quote { margin: 10px 0 0; padding: 10px 12px; border-radius: 12px; background: var(--blue-50); color: var(--ink-2); font-size: .92rem; font-style: italic; }
.item .acts { display: flex; gap: 10px; margin-top: 12px; }
.item .acts .btn { min-height: 50px; font-size: 1rem; padding: 0 12px; }

/* Measurements */
.measure .num-row { display: flex; align-items: center; gap: 10px; margin-top: 10px; }
.measure .num { flex: 1; min-width: 0; height: 64px; border: 2px solid var(--line); border-radius: 16px; font-size: 1.7rem; font-weight: 700; text-align: center; background: #fff; outline: none; }
.measure .num:focus { border-color: var(--blue); }
.measure .sep { font-size: 1.8rem; color: var(--ink-3); font-weight: 300; }
.measure .unit { color: var(--ink-3); font-weight: 600; font-size: .9rem; margin-top: 4px; }
.mic-sm { width: 56px; height: 56px; border-radius: 16px; background: var(--blue-50); color: var(--blue); display: grid; place-items: center; flex: none; }
.mic-sm.live { background: var(--red); color: #fff; animation: pulse 1.4s infinite; }
.seg { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.seg button { flex: 1 0 auto; min-height: 50px; padding: 0 14px; border-radius: 14px; background: #F2F6FA; font-weight: 650; border: 2px solid transparent; }
.seg button.on { background: var(--blue-50); border-color: var(--blue); color: var(--blue-700); }
.done-line { display: flex; align-items: center; gap: 8px; color: var(--green); font-weight: 650; margin-top: 10px; }
.measure.compact { padding: 14px; margin-top: 12px; }
.measure .m-head { display: flex; align-items: center; gap: 10px; }
.measure .m-head h3 { flex: 1; margin: 0; font-size: 1.05rem; }
.measure .m-ico { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--blue-50); color: var(--blue); flex: none; }
.measure .m-ico svg.i { width: 18px; height: 18px; }
.icon-btn.sm { width: 40px; height: 40px; }
.measure.compact .num { height: 52px; font-size: 1.4rem; border-radius: 14px; }
.measure.compact .mic-sm { width: 52px; height: 52px; border-radius: 14px; }
.measure .num.bad { border-color: var(--red); background: var(--red-50); }
.measure .unit.warn { color: var(--amber); }
.measure .m-err { color: var(--red); font-size: .88rem; font-weight: 600; margin-top: 4px; min-height: 0; }
.measure .m-err:empty { display: none; }
.measure .m-acts { display: flex; gap: 10px; margin-top: 10px; align-items: center; }
.measure .m-acts .btn.sm { flex: 1; min-height: 48px; font-size: 1rem; }
details.more { margin-top: 14px; }
details.more > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 8px; padding: 14px 16px; border-radius: 16px; background: var(--card); border: 1px dashed var(--blue-100); color: var(--blue-700); font-weight: 650; }
details.more > summary::-webkit-details-marker { display: none; }
details.more[open] > summary { margin-bottom: 2px; }

/* Status banner (sticky above nav) */
.sticky { position: fixed; left: 0; right: 0; bottom: 0; max-width: 480px; margin: 0 auto; padding: 12px 16px calc(14px + env(safe-area-inset-bottom)); background: linear-gradient(180deg, rgba(243,248,252,0), var(--bg) 30%); z-index: 9; }
@media (min-width: 560px) { .sticky { position: absolute; border-radius: 0 0 36px 36px; } }
.banner { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 16px; font-weight: 650; margin-bottom: 10px; }
.banner.red { background: var(--red-50); color: var(--red); }
.banner.amber { background: var(--amber-50); color: var(--amber); }
.banner.green { background: var(--green-50); color: var(--green); }
.banner.blue { background: var(--blue-50); color: var(--blue-700); }

/* Result */
.alert { border-radius: 26px; padding: 22px; color: #fff; background: linear-gradient(135deg, #C62828, #E5533D); box-shadow: 0 16px 30px rgba(198,40,40,.28); }
.alert.ok { background: linear-gradient(135deg, var(--green), #26A57A); box-shadow: 0 16px 30px rgba(18,128,92,.25); }
.alert h2 { margin: 8px 0 6px; font-size: 1.5rem; }
.alert ul { margin: 10px 0 0; padding-left: 20px; }
.alert li { margin: 4px 0; font-weight: 600; }
.sms { background: var(--blue-50); border-radius: 18px 18px 18px 6px; padding: 14px 16px; font-family: ui-monospace, Menlo, monospace; font-size: .9rem; margin-top: 10px; word-break: break-word; }
.status-pill { display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 999px; font-weight: 700; }
.status-pill.wait { background: var(--amber-50); color: var(--amber); }
.status-pill.ok { background: var(--green-50); color: var(--green); }
.status-pill.no { background: var(--red-50); color: var(--red); }
details.card summary { list-style: none; display: flex; align-items: center; justify-content: space-between; font-weight: 700; cursor: pointer; min-height: 32px; }
details.card summary::-webkit-details-marker { display: none; }
pre.mono { white-space: pre-wrap; font: .82rem/1.5 ui-monospace, Menlo, monospace; background: #F2F6FA; border-radius: 14px; padding: 14px; overflow: auto; max-height: 420px; margin: 12px 0 0; }

/* Toast + loading */
.toast { position: fixed; left: 50%; bottom: 110px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 14px; font-weight: 600; z-index: 50; max-width: 90%; box-shadow: var(--shadow); animation: in .2s; }
.busy { position: fixed; inset: 0; background: rgba(243,248,252,.75); display: grid; place-items: center; z-index: 40; backdrop-filter: blur(2px); }
.busy .box { background: #fff; border-radius: 22px; padding: 22px 26px; box-shadow: var(--shadow); text-align: center; font-weight: 650; }
.spinner { width: 42px; height: 42px; border-radius: 50%; border: 4px solid var(--blue-100); border-top-color: var(--blue); animation: spin .9s linear infinite; margin: 0 auto 12px; }
@keyframes spin { to { transform: rotate(360deg); } }
.offline-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); display: inline-block; }
.measure .num::placeholder { font-size: 1rem; font-weight: 600; color: var(--ink-3); }
.screen:has(+ .sticky) { padding-bottom: 200px; }

/* Option cards with read-aloud, steppers (registration) */
.opt { display: flex; align-items: center; gap: 10px; border: 2px solid var(--line); border-radius: 18px; padding: 8px 8px 8px 10px; background: #fff; }
.opt + .opt { margin-top: 10px; }
.opt.on { border-color: var(--blue); background: var(--blue-50); }
.opt-main { flex: 1; display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 4px; }
.opt-main b { font-size: 1.08rem; }
.screen > .opt { box-shadow: var(--shadow); padding: 12px; }
.screen > .opt + .opt { margin-top: 14px; }
.qhead { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.qhead h3 { flex: 1; margin: 0; font-size: 1.12rem; }
.consent { display: flex; gap: 12px; align-items: center; margin-top: 14px; font-weight: 600; padding: 12px; border-radius: 14px; background: var(--blue-50); }
.consent input { width: 26px; height: 26px; flex: none; }
.consent span { flex: 1; }
.stepper { display: flex; align-items: center; gap: 12px; margin-top: 6px; }
.stepper .icon-btn { width: 56px; height: 56px; font-size: 1.8rem; font-weight: 700; color: var(--blue-700); }
.stepper .icon-btn[disabled] { opacity: .35; }
.stepper .num-big { min-width: 56px; text-align: center; font-size: 2rem; font-weight: 800; color: var(--blue-700); }
.stepper .chip { margin-left: auto; box-shadow: none; border: 2px solid var(--line); }
.stepper .chip.on { border-color: var(--blue); }
.card-code { font-size: 2.6rem; font-weight: 800; letter-spacing: .12em; color: var(--blue-700); margin: 10px 0 6px; font-family: ui-monospace, Menlo, monospace; }
.card-input { font-size: 1.6rem; text-align: center; letter-spacing: .15em; font-weight: 700; font-family: ui-monospace, Menlo, monospace; }

/* DAK question cards */
.qcard .q + .q { margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--line); }
.section-kicker { font-size: .8rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--blue); margin-bottom: 10px; }
.tick { width: 30px; height: 30px; flex: none; border: 2px solid var(--ink-3); display: grid; place-items: center; color: #fff; }
.tick.single { border-radius: 50%; }
.tick.multi { border-radius: 8px; }
.opt.on .tick { background: var(--blue); border-color: var(--blue); }
.tick svg.i { width: 18px; height: 18px; stroke-width: 3; }
.q .opt { padding: 4px 6px 4px 8px; }
.q .opt-main { min-height: 50px; }
.q .opt + .opt { margin-top: 8px; }

/* Guideline advice, decision, referral pathway */
.advice { border-left: 6px solid var(--amber); }
.advice.red { border-left-color: var(--red); }
.advice.red .tiny:first-child { color: var(--red); }
.advice.amber .tiny:first-child { color: var(--amber); }
.check-row { display: flex; gap: 12px; align-items: flex-start; padding: 10px 0; border-bottom: 1px solid var(--line); font-weight: 600; }
.check-row input { width: 24px; height: 24px; flex: none; margin-top: 2px; }
.isbar > div { display: flex; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.isbar-k { width: 32px; height: 32px; border-radius: 10px; background: var(--blue); color: #fff; display: grid; place-items: center; font-weight: 800; flex: none; }

/* Clean list rows (confirm screen) */
.said { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border: 1px solid var(--line); border-radius: 18px; font-size: 1.02rem; }
.note-line { display: flex; gap: 10px; align-items: center; margin-top: 10px; padding: 10px 14px; border-radius: 14px; background: var(--blue-50); color: var(--blue-700); font-size: .92rem; font-weight: 600; }
.note-line.warn { background: var(--amber-50); color: var(--amber); }
.note-line svg.i { width: 18px; height: 18px; }
.list-head { display: flex; justify-content: space-between; align-items: baseline; margin: 22px 2px 10px; font-weight: 700; font-size: 1.02rem; }
.list-head span { font-size: .78rem; font-weight: 600; color: var(--ink-3); }
.row-list { display: flex; flex-direction: column; gap: 10px; }
.row-item { border: 1.5px solid var(--line); border-radius: 18px; padding: 12px 12px 12px 12px; background: #fff; transition: border-color .15s, background .15s; }
.row-item.on { border-color: #8CC6EE; background: #EEF7FD; }
.row-item.warn { border-color: #F3D3A6; }
.row-main { display: flex; align-items: center; gap: 12px; }
.row-ico { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; background: var(--blue-50); color: var(--blue); flex: none; }
.row-item.on .row-ico { background: #D6ECFB; }
.row-item.warn .row-ico { background: var(--amber-50); color: var(--amber); }
.row-text { flex: 1; min-width: 0; }
.row-title { font-weight: 700; font-size: 1.02rem; }
.row-val { color: var(--blue-700); }
.row-sub { color: var(--ink-3); font-size: .85rem; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-say { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; color: var(--blue); flex: none; }
.row-say:hover { background: var(--blue-50); }
.row-say svg.i { width: 20px; height: 20px; }
.row-acts { display: flex; gap: 8px; align-items: center; margin: 10px 0 0 58px; flex-wrap: wrap; }
.row-q { font-size: .85rem; color: var(--ink-2); font-weight: 600; }
.pill { min-height: 38px; padding: 0 14px; border-radius: 999px; font-weight: 650; font-size: .92rem; display: inline-flex; align-items: center; gap: 6px; background: var(--blue-50); color: var(--blue-700); }
.pill svg.i { width: 16px; height: 16px; }
.pill.primary { background: var(--blue); color: #fff; }
.pill.ghost { background: transparent; color: var(--ink-2); border: 1.5px solid var(--line); }
.row-link { margin: 6px 0 0 58px; font-size: .85rem; font-weight: 650; color: var(--blue); }
.status-line { display: flex; gap: 10px; align-items: center; padding: 10px 14px; margin-bottom: 10px; border-radius: 14px; background: #fff; border: 1px solid var(--line); font-size: .9rem; font-weight: 600; color: var(--ink-2); }
.status-line svg.i { width: 18px; height: 18px; color: var(--blue); }
.status-line.warn { border-color: #F3D3A6; background: var(--amber-50); color: var(--amber); }
.status-line.warn svg.i { color: var(--amber); }
.status-line.ok svg.i { color: var(--green); }

/* Advice / decision / referral rows */
button.row-item, label.row-item { width: 100%; text-align: left; display: block; cursor: pointer; }
.row-item.choice.on, .row-item.check.on { border-color: #8CC6EE; background: #EEF7FD; }
.row-item.choice.on .row-ico { background: var(--blue); color: #fff; }
.row-item.check .row-main { gap: 14px; }
.row-item.check input { width: 22px; height: 22px; flex: none; accent-color: var(--blue); }
details.row-item summary { list-style: none; cursor: pointer; }
details.row-item summary::-webkit-details-marker { display: none; }
details.row-item[open] .row-sub { white-space: normal; }
.row-item.adv.red .row-ico { background: var(--red-50); color: var(--red); }
.row-item.adv.amber .row-ico { background: var(--amber-50); color: var(--amber); }
.row-more { margin: 10px 4px 2px 58px; font-size: .95rem; line-height: 1.45; }
.list-head .row-say { width: 34px; height: 34px; }
.reason-box { display: flex; gap: 10px; align-items: flex-start; border: 1.5px solid var(--line); border-radius: 18px; padding: 10px 10px 10px 14px; }
.reason-box:focus-within { border-color: var(--blue); }
.reason-box textarea { flex: 1; border: 0; outline: none; resize: none; min-height: 72px; font-size: 1rem; background: transparent; }
.reason-box .mic-sm { width: 48px; height: 48px; border-radius: 14px; }
.isbar-list { border: 1.5px solid var(--line); border-radius: 18px; padding: 4px 14px; }
.isbar-row { display: flex; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: .95rem; }
.isbar-row:last-child { border-bottom: 0; }
.isbar-k { width: 28px; height: 28px; border-radius: 9px; background: var(--blue-50); color: var(--blue-700); display: grid; place-items: center; font-weight: 800; flex: none; font-size: .85rem; }
.time-box { display: flex; flex-direction: column; gap: 4px; border: 1.5px solid var(--line); border-radius: 14px; padding: 8px 12px; }
.time-box input { border: 0; outline: none; font-size: 1.1rem; font-weight: 700; background: transparent; }

/* Referral letter: on screen as a preview, and the only thing printed */
#printArea { display: none; }
.letter { background: #fff; color: #111; font: 12.5pt/1.45 Georgia, "Times New Roman", serif; padding: 18mm 16mm; max-width: 210mm; margin: 0 auto; }
.letter .lh { display: flex; align-items: center; justify-content: space-between; gap: 12px; border-bottom: 2px solid #0072C6; padding-bottom: 10px; }
.letter .lh .logo { width: 64px; height: 64px; display: grid; place-items: center; }
.letter .lh .logo img, .letter .lh .logo svg { max-width: 64px; max-height: 64px; }
.letter .lh .ph { width: 64px; height: 64px; border: 1.5px dashed #9AA9B8; border-radius: 8px; font: 8pt/1.2 system-ui, sans-serif; color: #6B7C8F; text-align: center; padding: 6px; }
.letter .lh .mid { text-align: center; flex: 1; }
.letter .lh .mid b { font-size: 14pt; display: block; }
.letter h1 { font-size: 15pt; letter-spacing: .08em; text-align: center; margin: 14px 0 4px; }
.letter .urgent { color: #B42318; font-weight: 700; text-align: center; font-family: system-ui, sans-serif; font-size: 10pt; letter-spacing: .08em; }
.letter .meta { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 18px; margin: 12px 0; font-size: 11pt; }
.letter h2 { font: 700 10.5pt system-ui, sans-serif; letter-spacing: .06em; text-transform: uppercase; color: #0072C6; margin: 14px 0 4px; }
.letter ul { margin: 2px 0 0 18px; padding: 0; }
.letter table { width: 100%; border-collapse: collapse; font-size: 11pt; }
.letter td { padding: 3px 6px 3px 0; vertical-align: top; }
.letter td:first-child { width: 34%; color: #444; }
.letter .sign { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-top: 16px; }
.letter .line { border-bottom: 1px solid #333; height: 22px; margin-bottom: 2px; }
.letter .slip { margin-top: 18px; border-top: 2px dashed #555; padding-top: 10px; }
.letter .small { font-size: 9.5pt; color: #444; }
@media print {
  body { background: #fff; padding: 0; }
  #app, .toast, .busy { display: none !important; }
  #printArea { display: block !important; }
  .letter { padding: 0; }
  @page { size: A4; margin: 14mm; }
}
.letter-preview { margin-top: 12px; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; box-shadow: var(--shadow); }
.letter-preview .letter { padding: 18px 16px; font-size: 10.5pt; }
.list-head { gap: 12px; white-space: nowrap; }
.list-head span { white-space: normal; text-align: right; }


/* Hosted-demo pop-up */
.modal-back { position: fixed; inset: 0; background: rgba(14, 34, 53, .45); display: grid; place-items: center; z-index: 60; padding: 20px; animation: in .2s ease-out; }
.modal { position: relative; background: #fff; border-radius: 24px; padding: 26px 22px 20px; max-width: 380px; width: 100%; box-shadow: 0 30px 80px rgba(0, 40, 80, .3); }
.modal h3 { margin: 0 0 8px; font-size: 1.3rem; }
.modal p { margin: 0 0 12px; color: var(--ink-2); line-height: 1.5; }
.modal-x { position: absolute; top: 14px; right: 14px; width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; color: var(--ink-2); }
.modal-x:hover { background: var(--blue-50); }
.modal .btn { margin-top: 6px; }

/* Sign-in (clean form) */
.auth { padding: 28px 24px 32px; }
.auth .brand span { font-size: 1.2rem; }
.auth-title { font-size: 2rem; margin: 0 0 6px; letter-spacing: -0.02em; }
.auth-sub { color: var(--ink-2); margin: 0 0 28px; }
.field-label { display: block; font-weight: 650; font-size: .95rem; margin: 0 0 8px; }
.field-row { display: flex; justify-content: space-between; align-items: baseline; margin-top: 20px; }
.field-link { color: var(--blue); font-weight: 650; font-size: .88rem; }
.field { width: 100%; height: 54px; border: 1.5px solid var(--line); border-radius: 14px; padding: 0 16px; font-size: 1.05rem; outline: none; background: #fff; }
.field:focus { border-color: var(--blue); box-shadow: 0 0 0 4px var(--blue-50); }
.field-wrap { position: relative; }
.field-wrap .field { padding-right: 52px; letter-spacing: .08em; }
.field-eye { position: absolute; right: 6px; top: 7px; width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; color: var(--ink-3); }
.keep { display: flex; gap: 12px; align-items: center; margin: 20px 0 6px; font-weight: 500; }
.keep input { width: 22px; height: 22px; accent-color: var(--blue); }
.auth .btn { margin-top: 10px; border-radius: 999px; }
.auth-foot { text-align: center; color: var(--ink-2); margin-top: 28px; font-size: .95rem; }

/* Guideline management and routine care */
.row-item.mgmt .row-ico { background: var(--green-50); color: var(--green); }
.steps-list { margin: 10px 4px 2px 58px; padding-left: 18px; font-size: .95rem; line-height: 1.45; }
.steps-list li { margin: 6px 0; }
.routine { border: 1.5px solid var(--line); border-radius: 18px; padding: 10px 14px; }
.routine > div:not(.tiny):not(.routine-sub) { display: flex; gap: 10px; align-items: flex-start; padding: 7px 0; border-bottom: 1px solid var(--line); font-size: .95rem; }
.routine svg.i { width: 18px; height: 18px; color: var(--green); flex: none; margin-top: 2px; }
.routine-sub { font-weight: 700; font-size: .85rem; color: var(--ink-2); margin-top: 10px; }
