:root {
  --ink: #172628; --muted: #5f7273; --line: #dfe7e4; --soft: #edf2f0; --paper: #fff; --canvas: #f4f7f5;
  --teal: #0b746c; --teal-dark: #075b55; --teal-soft: #e6f3f0; --red: #b93b49; --red-soft: #fdeced;
  --amber: #8a5f0e; --amber-soft: #fff6dc; --radius: 16px; --shadow: 0 10px 30px rgba(26,55,52,.08);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--canvas); color: var(--ink); font: 16px/1.5 "DM Sans", system-ui, sans-serif; }
h1, h2, h3 { font-family: "Manrope", "DM Sans", sans-serif; letter-spacing: -.02em; margin: 0 0 8px; }
h1 { font-size: 28px; line-height: 1.15; }
h2 { font-size: 19px; }
h3 { font-size: 16px; }
p { margin: 0 0 10px; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.eyebrow { margin: 0 0 4px; color: var(--teal); font-size: 11px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }
.stack { display: grid; gap: 14px; }
.stack-sm { display: grid; gap: 14px; }

.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark { width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; background: #f2b56b; color: #123d3b; }
.brand-mark svg { width: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.brand strong { display: block; font: 800 17px/1 "Manrope"; }
.brand small { display: block; margin-top: 3px; font-size: 10px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }

.login-view { min-height: 100vh; display: grid; place-items: center; padding: 20px 16px; background: linear-gradient(160deg, #123d3b, #0b5e59); }
.login-card { width: min(420px, 100%); background: var(--paper); border-radius: 22px; padding: 28px 22px; box-shadow: 0 24px 60px rgba(0,0,0,.25); }
.login-card .brand { margin-bottom: 22px; }
.fine-print { margin-top: 16px; font-size: 12px; color: var(--muted); }

.field { display: grid; gap: 6px; }
.field > span, legend { font-size: 13px; font-weight: 700; }
.field.inline { grid-template-columns: auto 1fr; align-items: center; gap: 10px; }
input, select, textarea { width: 100%; min-height: 46px; padding: 11px 12px; border: 1px solid #cad7d3; border-radius: 12px; background: #fff; color: var(--ink); outline: none; font-size: 16px; }
textarea { resize: vertical; min-height: 100px; }
input:focus, select:focus, textarea:focus { border-color: #4e9f96; box-shadow: 0 0 0 3px rgba(78,159,150,.16); }
.button { min-height: 50px; padding: 0 20px; border-radius: 13px; border: 1px solid transparent; font-weight: 700; font-size: 15px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none; }
.button.primary { background: var(--teal); color: #fff; }
.button.primary:disabled { opacity: .6; }
.button.secondary { background: #fff; border-color: #cad7d3; color: var(--ink); }
.button.full { width: 100%; }
.link-button { border: 0; background: none; color: var(--teal); font-weight: 700; padding: 8px; }
.form-error { margin: 0; padding: 10px 12px; border-radius: 10px; background: var(--red-soft); color: var(--red); font-size: 14px; }
#loginForm { display: grid; gap: 14px; margin-top: 18px; }

.app { min-height: 100vh; padding-bottom: calc(76px + env(safe-area-inset-bottom)); }
.top { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 12px; padding: 12px 16px; background: rgba(255,255,255,.95); border-bottom: 1px solid var(--line); backdrop-filter: blur(8px); }
.top .who { margin-left: auto; text-align: right; line-height: 1.2; }
.top .who strong { display: block; font-size: 14px; }
.top .who small { color: var(--muted); font-size: 11px; }
.tabs { position: fixed; z-index: 10; left: 0; right: 0; bottom: 0; display: grid; grid-template-columns: repeat(4, 1fr); padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); background: #fff; border-top: 1px solid var(--line); }
.tabs a { display: grid; justify-items: center; gap: 2px; padding: 6px 2px; border-radius: 12px; color: var(--muted); font-size: 12px; font-weight: 700; text-decoration: none; }
.tabs a span { font-size: 19px; line-height: 1; }
.tabs a.active { background: var(--teal-soft); color: var(--teal-dark); }
.content { max-width: 760px; margin: 0 auto; padding: 22px 16px 30px; }
.view { display: none; }
.view.active { display: block; }
.view > .muted { margin-bottom: 16px; }

.card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 16px; box-shadow: 0 3px 12px rgba(24,58,54,.04); }
.card h2 { margin-bottom: 4px; }
.hero { background: linear-gradient(120deg, #0a5e59, #103f3d); color: #fff; border: 0; }
.hero .eyebrow { color: #f2c98d; }
.hero p { color: #cfe3e0; }
.hero .big { font: 800 26px/1.2 "Manrope"; color: #fff; margin: 4px 0 8px; }
.pill { display: inline-flex; align-items: center; min-height: 26px; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; background: var(--soft); color: #3e5452; }
.pill.ok { background: #e6f3ea; color: #2f6a47; } .pill.warn { background: var(--amber-soft); color: var(--amber); } .pill.alert { background: var(--red-soft); color: var(--red); } .pill.teal { background: var(--teal-soft); color: var(--teal-dark); }
.pills { display: flex; flex-wrap: wrap; gap: 6px; }
.cta { display: flex; justify-content: space-between; align-items: center; gap: 14px; }
.progress { height: 8px; border-radius: 99px; background: rgba(255,255,255,.18); overflow: hidden; margin: 10px 0 4px; }
.progress span { display: block; height: 100%; background: #f2b56b; }

.timeline { list-style: none; margin: 8px 0 0; padding: 0; }
.timeline li { display: grid; grid-template-columns: 46px 1fr auto; gap: 12px; align-items: center; padding: 12px 0; border-top: 1px solid var(--soft); }
.timeline li:first-child { border-top: 0; }
.cnum { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; font: 800 14px "Manrope"; background: var(--soft); color: var(--muted); }
.done .cnum { background: var(--teal-soft); color: var(--teal-dark); }
.next .cnum { background: #f2b56b; color: #123d3b; }
.timeline small { display: block; color: var(--muted); font-size: 12px; }
.drug-list { display: grid; gap: 8px; margin: 10px 0; }
.drug-list div { display: flex; justify-content: space-between; gap: 10px; padding: 10px 12px; border-radius: 11px; background: #f5f8f7; font-size: 14px; }

.report { padding: 0; overflow: hidden; }
.report summary { list-style: none; cursor: pointer; padding: 16px; display: flex; align-items: center; gap: 12px; }
.report summary::-webkit-details-marker { display: none; }
.report summary .date { font: 800 16px "Manrope"; }
.report summary small { display: block; color: var(--muted); font-size: 12px; }
.report summary .pill { margin-left: auto; }
.report .values { padding: 0 16px 14px; }
.value-row { display: grid; grid-template-columns: 1fr auto auto; gap: 10px; align-items: center; padding: 10px 0; border-top: 1px solid var(--soft); font-size: 14px; }
.value-row .v { font-weight: 800; text-align: right; }
.value-row small { display: block; color: var(--muted); font-size: 11px; }
.value-row .tag { font-size: 11px; font-weight: 800; padding: 3px 8px; border-radius: 8px; min-width: 52px; text-align: center; }
.tag.high, .tag.low { background: var(--amber-soft); color: var(--amber); }
.tag.normal { background: #eef3f1; color: #5b706d; }
.panel-title { margin: 12px 0 0; font-size: 11px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--teal); }
.doc-links { display: flex; flex-wrap: wrap; gap: 8px; padding: 4px 16px 16px; }
.doc-links a { font-size: 13px; font-weight: 700; color: var(--teal); }
.trend-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.trend-tile { padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.trend-tile strong { display: block; font-size: 13px; }
.trend-tile small { color: var(--muted); font-size: 11px; }
.trend-tile svg { display: block; width: 100%; height: 34px; margin-top: 6px; }
.trend-tile polyline { fill: none; stroke: var(--teal); stroke-width: 2; }
.trend-tile circle { fill: var(--teal); }
.trend-tile circle.out { fill: var(--amber); }

.emergency-note { margin: 10px 0 16px; padding: 12px 14px; border-radius: 12px; background: var(--red-soft); color: #7a2330; font-size: 14px; }
.emergency-note a { color: inherit; font-weight: 800; }
.mode-switch { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 4px; background: var(--soft); border-radius: 13px; }
.mode { min-height: 44px; border: 0; border-radius: 10px; background: transparent; font-weight: 700; color: var(--muted); }
.mode.active { background: #fff; color: var(--ink); box-shadow: 0 2px 8px rgba(0,0,0,.06); }
.voice-panel { display: grid; gap: 12px; }
.mic { display: flex; align-items: center; justify-content: center; gap: 12px; min-height: 64px; border-radius: 16px; border: 2px dashed #9cc7c1; background: #f4faf8; font-weight: 800; color: var(--teal-dark); }
.mic-dot { width: 18px; height: 18px; border-radius: 50%; background: var(--teal); }
.mic.recording { border-style: solid; border-color: var(--red); background: var(--red-soft); color: var(--red); }
.mic.recording .mic-dot { background: var(--red); animation: pulse 1s infinite; }
@keyframes pulse { 50% { transform: scale(1.35); opacity: .6; } }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; color: var(--muted); }
.check input { width: 20px; min-height: 20px; margin-top: 2px; accent-color: var(--teal); }
fieldset { border: 0; padding: 0; margin: 0; display: grid; gap: 8px; }
.chips > div { display: flex; flex-wrap: wrap; gap: 8px; }
.chip-toggle { position: relative; }
.chip-toggle input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.chip-toggle span { display: inline-flex; min-height: 40px; align-items: center; padding: 6px 13px; border: 1px solid #cad7d3; border-radius: 999px; font-size: 14px; background: #fff; }
.chip-toggle input:checked + span { background: var(--teal); border-color: var(--teal); color: #fff; font-weight: 700; }
.chip-toggle input:focus-visible + span { box-shadow: 0 0 0 3px rgba(78,159,150,.3); }
.impact label { display: flex; gap: 10px; align-items: flex-start; padding: 12px; border: 1px solid var(--line); border-radius: 12px; font-size: 14px; }
.impact label:has(input:checked) { border-color: var(--teal); background: var(--teal-soft); }
.impact input { width: 20px; min-height: 20px; margin-top: 1px; accent-color: var(--teal); }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.section-title { margin-top: 26px; }

.alert-card { border: 2px solid var(--red); background: #fff7f7; }
.alert-card h2 { color: var(--red); }
.alert-card .button { background: var(--red); color: #fff; }
.ok-card { border-color: #b9dcca; background: #f3fbf6; }
.msg { padding: 14px 16px; }
.msg .meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 6px; font-size: 12px; color: var(--muted); }
.msg .quote { white-space: pre-wrap; }
.reply { margin-top: 10px; padding: 10px 12px; border-left: 3px solid var(--teal); background: var(--teal-soft); border-radius: 0 10px 10px 0; font-size: 14px; }
.reply strong { display: block; font-size: 12px; color: var(--teal-dark); }
audio { width: 100%; }
.empty { padding: 22px; text-align: center; color: var(--muted); background: #f7f9f8; border-radius: 14px; }
.toast { position: fixed; z-index: 30; left: 16px; right: 16px; bottom: calc(86px + env(safe-area-inset-bottom)); max-width: 460px; margin: 0 auto; padding: 13px 16px; border-radius: 12px; background: #183f3c; color: #fff; font-size: 14px; opacity: 0; transform: translateY(12px); pointer-events: none; transition: .2s; }
.toast.show { opacity: 1; transform: none; }

@media (min-width: 820px) {
  .app { padding-bottom: 0; }
  .tabs { position: sticky; top: 61px; bottom: auto; max-width: 760px; margin: 0 auto; border: 0; background: transparent; grid-template-columns: repeat(4, auto); justify-content: start; gap: 6px; padding: 14px 16px 0; }
  .tabs a { grid-auto-flow: column; gap: 8px; padding: 9px 14px; font-size: 14px; background: #fff; border: 1px solid var(--line); }
  .tabs a span { font-size: 16px; }
  .toast { bottom: 24px; }
}
@media (max-width: 420px) { .row-2 { grid-template-columns: 1fr; } h1 { font-size: 25px; } }

/* v0.7 symptom check-in */
.lang-switch { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin: 4px 0 12px; font-size: 13px; font-weight: 700; color: var(--muted); }
.lang-switch button { min-height: 36px; padding: 0 14px; border-radius: 999px; border: 1px solid #cad7d3; background: #fff; color: var(--ink); font-weight: 700; font-size: 14px; }
.lang-switch button.active { background: var(--teal); border-color: var(--teal); color: #fff; }
.step-count { margin: 0; color: var(--teal); font-size: 12px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.step-title { margin: 2px 0 6px; font-size: 20px; line-height: 1.25; }
.link-button.center { display: block; width: 100%; text-align: center; }
.link-button.small { font-size: 13px; padding: 4px; }
#wizard .q { border: 0; margin: 14px 0 0; padding: 0; min-width: 0; }
#wizard .q legend { font-size: 15px; font-weight: 700; padding: 0; margin-bottom: 10px; line-height: 1.35; }
#wizard .q.missing legend, #wizard .q.missing > span { color: var(--red); }
#wizard .q.missing .opt span { border-color: #f0b9c0; }
.opts { display: grid; gap: 8px; }
.opts.row { grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); }
.opt { position: relative; }
.opt input { position: absolute; opacity: 0; inset: 0; }
.opt span { display: flex; align-items: center; min-height: 48px; padding: 10px 14px; border-radius: 12px; border: 1.5px solid #cad7d3; background: #fff; font-size: 15px; line-height: 1.3; cursor: pointer; }
.opt input:checked + span { border-color: var(--teal); background: var(--teal-soft); color: var(--teal-dark); font-weight: 700; box-shadow: inset 0 0 0 1px var(--teal); }
.opt input:focus-visible + span { outline: 3px solid #f2b76b; outline-offset: 2px; }
.sym-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; margin-top: 8px; }
.sym { position: relative; }
.sym input { position: absolute; opacity: 0; inset: 0; }
.sym span { display: flex; flex-direction: column; justify-content: center; min-height: 56px; padding: 8px 12px; border-radius: 12px; border: 1.5px solid #cad7d3; background: #fff; font-size: 14px; font-weight: 600; cursor: pointer; }
.sym span small { color: var(--muted); font-weight: 500; font-size: 11px; margin-top: 2px; }
.sym.found span { border-style: dashed; border-color: var(--teal); }
.sym input:checked + span { border-style: solid; border-color: var(--teal); background: var(--teal-soft); color: var(--teal-dark); box-shadow: inset 0 0 0 1px var(--teal); }
.sym input:checked + span::before { content: "✓ "; }
.sym input:focus-visible + span { outline: 3px solid #f2b76b; outline-offset: 2px; }
.wz-nav { display: grid; grid-template-columns: 1fr 2fr; gap: 10px; margin-top: 16px; }
.rv-block { padding: 12px 0; border-top: 1px solid #edf2f0; }
.rv-block:first-of-type { border-top: 0; }
.rv-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.rv-block dl { margin: 8px 0 0; display: grid; gap: 2px; }
.rv-block dt { color: var(--muted); font-size: 13px; margin-top: 6px; }
.rv-block dd { margin: 0; font-weight: 700; font-size: 14px; }
#wizard, #wizard .q, #sentPanel { scroll-margin-top: 150px; }

/* v0.8 spoken follow-up questions */
.vc-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding: 10px 12px; margin-bottom: 10px; border-radius: 12px; background: #eef6f4; }
.vc-toggle { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 14px; }
.vc-toggle input { width: 20px; height: 20px; accent-color: var(--teal); }
.vc-status { font-size: 13px; font-weight: 700; color: var(--teal-dark); }
.vc-status[data-state="listening"] { color: #b93b49; animation: vcpulse 1.2s ease-in-out infinite; }
@keyframes vcpulse { 50% { opacity: .45; } }
.vc-note { margin: 0 0 10px; padding: 8px 10px; border-radius: 10px; background: var(--amber-soft); color: var(--amber); font-size: 13px; }
#wizard .q.asking { background: #f3faf8; box-shadow: 0 0 0 2px var(--teal); border-radius: 12px; padding: 10px; margin-left: -10px; margin-right: -10px; }
.q-mic { margin-left: 6px; border: 1px solid #cad7d3; background: #fff; border-radius: 999px; width: 32px; height: 32px; font-size: 15px; vertical-align: middle; cursor: pointer; }
.vc-heard { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: baseline; margin-top: 8px; font-size: 14px; color: var(--muted); }
.vc-heard strong { color: var(--teal-dark); }
.vc-heard.unclear strong { color: var(--amber); }
@media (prefers-reduced-motion: reduce) { .vc-status[data-state="listening"] { animation: none; } }
