/* Okavia — shared tokens and components. Every page is laid out as a phone screen. */
:root {
  --teal: #1f5e5a;
  --teal-deep: #174845;
  --teal-soft: #d6e7e5;
  --ink: #17302e;
  --ink-2: #3a5351;
  --muted: #5d7270;
  --line: #d2dfdd;
  --line-soft: #e3ebea;
  --mist: #e6efee;
  --cloud: #f5f8f8;
  --paper: #ffffff;
  --orange: #f28c28;
  --orange-soft: #fdecd9;
  --good: #2b7a4b;
  --good-soft: #e1f1e7;
  --watch: #8a5700;
  --watch-soft: #fbf0d4;
  --concern: #b3261e;
  --concern-soft: #fbe5e3;
  --display: "Nunito", "Atkinson Hyperlegible", system-ui, sans-serif;
  --sans: "Atkinson Hyperlegible", system-ui, -apple-system, "Segoe UI", sans-serif;
  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 20px;
  --shell: 430px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--sans); font-size: 1rem; line-height: 1.55; color: var(--ink); background: var(--cloud); }
img { max-width: 100%; display: block; }
a { color: var(--teal); text-underline-offset: 3px; }
a:hover { color: var(--teal-deep); }
h1, h2, h3, h4 { font-family: var(--display); font-weight: 800; line-height: 1.18; margin: 0 0 0.5em; color: var(--ink); letter-spacing: -0.01em; }
h1 { font-size: 1.95rem; }
h2 { font-size: 1.45rem; }
h3 { font-size: 1.12rem; }
p { margin: 0 0 1em; }
.muted { color: var(--muted); }
.small { font-size: 0.9rem; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 3px solid var(--orange); outline-offset: 2px; border-radius: 6px; }

/* ---------- Phone shell (all pages) ---------- */
.m-shell { position: relative; max-width: var(--shell); min-height: 100vh; margin: 0 auto; background: var(--cloud); display: flex; flex-direction: column; }
@media (min-width: 600px) {
  body { background: var(--ink); padding: 24px 0; }
  .m-shell { min-height: calc(100vh - 48px); border-radius: 30px; overflow: clip; box-shadow: 0 30px 80px rgba(0, 0, 0, 0.35); }
}
.m-pad { padding-inline: 18px; }

/* ---------- Brand ---------- */
.brand { display: inline-flex; align-items: center; gap: 8px; text-decoration: none; color: var(--teal); font-family: var(--display); font-weight: 800; font-size: 1.35rem; letter-spacing: -0.02em; }
.brand svg { width: 30px; height: 30px; flex: none; }
.brand:hover { color: var(--teal); }

/* ---------- Top bar ---------- */
.m-top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 60px; padding: 10px 18px; background: rgba(255, 255, 255, 0.96); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line-soft); }
.m-top nav { display: flex; align-items: center; gap: 12px; font-size: 0.95rem; }
.m-top nav a:not(.btn) { font-weight: 700; text-decoration: none; }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 22px; border-radius: 999px; border: 2px solid var(--teal); background: var(--teal); color: #fff; font: 800 1rem/1 var(--display); text-decoration: none; cursor: pointer; transition: background .15s, border-color .15s, color .15s; text-align: center; }
.btn:hover { background: var(--teal-deep); border-color: var(--teal-deep); color: #fff; }
.btn-ghost { background: #fff; color: var(--teal); border-color: var(--teal); }
.btn-ghost:hover { background: var(--mist); color: var(--teal-deep); }
.btn-danger { background: var(--concern); border-color: var(--concern); }
.btn-danger:hover { background: #8f1d17; border-color: #8f1d17; }
.btn-sm { min-height: 38px; padding: 0 16px; font-size: 0.92rem; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: 0.45; cursor: not-allowed; }
.link-btn { background: none; border: 0; padding: 0; font: inherit; color: var(--teal); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }

/* ---------- Status pills (always text + color) ---------- */
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 0.82rem; font-weight: 700; white-space: nowrap; }
.pill::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.pill-good { background: var(--good-soft); color: var(--good); }
.pill-watch { background: var(--watch-soft); color: var(--watch); }
.pill-concern, .pill-urgent { background: var(--concern-soft); color: var(--concern); }
.pill-neutral { background: var(--mist); color: var(--ink-2); }
.pill-plain::before { display: none; }

/* ---------- Cards ---------- */
.card { background: #fff; border: 1px solid var(--line); border-radius: var(--r-lg); padding: 16px; }
.card + .card { margin-top: 10px; }
.card h3 { margin-bottom: 6px; }
.card p:last-child { margin-bottom: 0; }

/* ---------- Forms ---------- */
.field { display: grid; gap: 6px; margin-bottom: 16px; }
.field label, .field .label { font-weight: 700; font-size: 0.97rem; }
.field .hint { color: var(--muted); font-size: 0.88rem; margin: 0; }
.input, .select, .textarea { width: 100%; min-height: 50px; padding: 10px 14px; border: 2px solid var(--line); border-radius: var(--r-sm); background: #fff; font: 1rem/1.4 var(--sans); color: var(--ink); }
.textarea { min-height: 110px; resize: vertical; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--teal); outline: none; box-shadow: 0 0 0 3px var(--teal-soft); }
.input.invalid, .select.invalid, .textarea.invalid { border-color: var(--concern); }
.error-text { color: var(--concern); font-size: 0.88rem; font-weight: 700; margin: 0; }
.choice-grid { display: grid; gap: 10px; }
.choice { position: relative; display: flex; gap: 12px; align-items: flex-start; padding: 14px; border: 2px solid var(--line); border-radius: var(--r-md); cursor: pointer; background: #fff; }
.choice input { margin-top: 3px; accent-color: var(--teal); width: 18px; height: 18px; flex: none; }
.choice strong { display: block; }
.choice span { color: var(--muted); font-size: 0.92rem; }
.choice:has(input:checked) { border-color: var(--teal); background: var(--mist); }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 0.96rem; }
.check input { width: 18px; height: 18px; margin-top: 3px; accent-color: var(--teal); flex: none; }

/* ---------- Toast ---------- */
.toast { position: fixed; left: 50%; bottom: 96px; transform: translate(-50%, 20px); opacity: 0; background: var(--ink); color: #fff; padding: 12px 20px; border-radius: 999px; font-weight: 700; transition: opacity .2s, transform .2s; z-index: 100; pointer-events: none; width: max-content; max-width: min(400px, calc(100% - 32px)); text-align: center; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Prototype bar ---------- */
.demo-bar { background: var(--ink); color: #d6e3e1; font-size: 0.82rem; padding: 8px 18px; line-height: 1.45; }
.demo-bar button { background: none; border: 0; font: inherit; color: #fff; font-weight: 700; text-decoration: underline; cursor: pointer; padding: 0; }

/* ---------- Footer ---------- */
.m-footer { margin-top: auto; padding: 28px 18px 36px; color: var(--muted); font-size: 0.9rem; border-top: 1px solid var(--line-soft); background: #fff; }
.m-footer nav { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-bottom: 12px; }

/* ---------- Avatars ---------- */
.avatar { display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; background: var(--mist); color: var(--teal); font-family: var(--display); font-weight: 800; flex: none; border: 2px solid var(--teal-soft); }
.avatar-lg { width: 60px; height: 60px; font-size: 1.25rem; }

/* ---------- Text-message bubbles ---------- */
.sms { display: grid; gap: 8px; }
.sms-meta { text-align: center; font-size: 0.76rem; color: var(--muted); }
.bubble { max-width: 88%; padding: 10px 14px; border-radius: 18px 18px 18px 6px; background: #e8eded; color: #182b2a; font-size: 0.94rem; line-height: 1.4; }
.bubble.me { justify-self: end; background: var(--teal); color: #fff; border-radius: 18px 18px 6px 18px; }
.bubble a { color: inherit; font-weight: 700; }
.bubble-photo { width: 100%; aspect-ratio: 4/3; border-radius: 12px; overflow: hidden; margin-bottom: 8px; }

/* ---------- Report ---------- */
.report { background: #fff; border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; }
.report-head { padding: 16px; background: var(--mist); display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; align-items: flex-start; }
.report-head h3 { margin: 0 0 2px; }
.report-body { padding: 16px; }
.report-note { font-size: 1.05rem; line-height: 1.6; border-left: 4px solid var(--teal); padding: 2px 0 2px 14px; margin: 0 0 18px; }
.report-note small { display: block; font-size: 0.85rem; color: var(--muted); margin-top: 6px; }
.obs-list { list-style: none; padding: 0; margin: 0 0 16px; border-top: 1px solid var(--line-soft); }
.obs-list li { display: grid; gap: 4px; padding: 12px 0; border-bottom: 1px solid var(--line-soft); }
.obs-list .obs-label { font-weight: 700; }
.obs-list .obs-detail { display: grid; gap: 4px; }
.obs-list .obs-detail p { margin: 0; color: var(--ink-2); }
.followups { background: var(--mist); border-radius: var(--r-md); padding: 12px 16px; }
.followups h4 { font-size: 0.98rem; margin: 0 0 6px; }
.followups ul { margin: 0; padding-left: 20px; }
.emergency-box { background: var(--concern-soft); color: #5e130e; border: 2px solid var(--concern); border-radius: var(--r-md); padding: 12px 16px; margin-bottom: 16px; }
.emergency-box h4 { margin: 0 0 6px; color: var(--concern); }
.report-photo { border-radius: var(--r-md); overflow: hidden; margin-bottom: 16px; }

/* ---------- Bottom tabs (apps) ---------- */
.m-tabs { position: sticky; bottom: 0; z-index: 10; display: grid; grid-template-columns: repeat(4, 1fr); background: #fff; border-top: 1px solid var(--line); padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); margin-top: auto; }
.m-tabs a { position: relative; display: grid; justify-items: center; gap: 2px; padding: 6px 0; text-decoration: none; color: var(--muted); font-size: 0.76rem; font-weight: 700; border-radius: 10px; }
.m-tabs a svg { width: 24px; height: 24px; }
.m-tabs a[aria-current="page"] { color: var(--teal); }
.m-tabs a[aria-current="page"]::after { content: ""; position: absolute; top: 0; width: 6px; height: 6px; border-radius: 50%; background: var(--orange); }

/* ---------- Dialog ---------- */
dialog { border: 0; border-radius: var(--r-lg); padding: 0; width: min(400px, calc(100% - 24px)); max-height: calc(100vh - 40px); box-shadow: 0 30px 80px rgba(23, 48, 46, .4); color: var(--ink); }
dialog::backdrop { background: rgba(23, 48, 46, 0.6); }
.dialog-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line-soft); }
.dialog-head h2 { margin: 0; font-size: 1.15rem; }
.dialog-body { padding: 18px; }
.close-x { background: none; border: 0; font-size: 1.6rem; line-height: 1; cursor: pointer; color: var(--ink); padding: 4px 8px; border-radius: 8px; }
.close-x:hover { background: var(--mist); }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; } }

/* ---------- Logo ---------- */
.brand img { height: 30px; width: auto; display: block; }
.m-footer-dark { background: var(--ink); border-top: 0; color: #c3d6d3; }
.m-footer-dark a { color: #fff; }
.m-footer-dark .brand { display: inline-block; }
.m-footer-dark .brand img { height: 34px; }
.auth-logo { display: flex; justify-content: center; margin: 8px 0 22px; }
.auth-logo img { width: 150px; height: auto; }

/* ---------- App store buttons (footer) ---------- */
.store-badges { margin: 4px 0 22px; }
.store-title { margin: 0 0 10px; color: #fff; font-family: var(--display); font-weight: 800; }
.store-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.store-btn { display: flex; align-items: center; gap: 10px; min-height: 54px; padding: 8px 12px; border: 1.5px solid rgba(255, 255, 255, 0.55); border-radius: 12px; color: #fff; background: rgba(255, 255, 255, 0.06); }
.store-btn svg { width: 24px; height: 24px; flex: none; }
.store-btn span { display: grid; line-height: 1.15; font-family: var(--display); font-weight: 800; font-size: 1rem; }
.store-btn small { font-family: var(--sans); font-weight: 400; font-size: 0.7rem; color: #c3d6d3; }
