/* =========================================================
   Kalinga — styles
   Light by default: elders read best on a bright, warm page
   with dark text. Dark is a setting. Colors come only from the
   tokens below. Elder screens (.elder, .dose, .sheet--elder)
   use big type (>= 24 design px) and big targets (>= 64px).
   Every font-size is calc(N * var(--u)) so the phone's text-size
   setting scales it (Alaga's rule; capped at 2x).
   ========================================================= */
:root { --u: min(calc(1rem / 16), 2px); }

:root {
  --bg: #fbf7f0; --bg-2: #f3ece1; --card: #ffffff; --card-2: #f7f2ea;
  --line: #e4dccf; --line-strong: #cdbfaa;
  --text: #1d2422; --text-dim: #4b5551; --text-faint: #6b746f;
  --brand: #0f5d55; --brand-2: #0c4c45; --on-brand: #ffffff; --brand-soft: #e1efec;
  --due: #b45f06; --due-bg: #fff1dc; --due-line: #f0c27f;
  --ok: #1f6f43; --ok-bg: #e6f4ea; --ok-line: #a8d5b6;
  --bad: #a92a1f; --bad-bg: #fdeaea; --bad-line: #eeb1ab;
  --info-bg: #eaf1fb; --info-line: #b9cdeb;
  --focus: #1a73e8;
  --shadow: 0 10px 30px -18px rgba(40, 30, 10, 0.35);
  --radius: 18px; --radius-sm: 12px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", Arial, sans-serif;
  --tabbar-h: 66px;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #111816; --bg-2: #17201d; --card: #1b2623; --card-2: #22302c;
  --line: #2c3b37; --line-strong: #3d504b;
  --text: #eef3f1; --text-dim: #b9c6c2; --text-faint: #93a39e;
  --brand: #5fc4b5; --brand-2: #7fd4c7; --on-brand: #06201c; --brand-soft: #1d3a35;
  --due: #f3b257; --due-bg: #3a2a12; --due-line: #7a5a26;
  --ok: #7fd49f; --ok-bg: #173126; --ok-line: #2f6146;
  --bad: #ff8f84; --bad-bg: #3a1916; --bad-line: #7a332c;
  --info-bg: #1a2638; --info-line: #2f4566;
  --focus: #8ab4f8;
  --shadow: 0 10px 30px -18px rgba(0, 0, 0, 0.8);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--font); font-size: calc(16 * var(--u)); line-height: 1.45;
  color: var(--text); background: var(--bg);
  -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent;
  min-height: 100dvh;
}
[hidden] { display: none !important; }
img { max-width: 100%; }
a { color: var(--brand); }
h1, h2, h3 { margin: 0; line-height: 1.2; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.faint { color: var(--text-faint); }
.dim { color: var(--text-dim); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 10px 18px; border-radius: 999px;
  border: 1.5px solid var(--line-strong); background: var(--card); color: var(--text);
  font-weight: 650; font-size: calc(15 * var(--u)); cursor: pointer; text-align: center;
  transition: transform .12s ease, background .2s; text-decoration: none;
}
.btn:active { transform: scale(0.97); }
.btn[disabled] { opacity: .5; cursor: default; }
.btn--primary { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.btn--danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn--soft { background: var(--brand-soft); border-color: transparent; color: var(--brand-2); }
.btn--ghost { background: transparent; border-color: transparent; }
.btn--link { background: none; border: none; color: var(--brand); text-decoration: underline; min-height: 44px; padding: 8px; }
.btn--lg { min-height: 56px; font-size: calc(17 * var(--u)); padding: 12px 22px; }
.btn--sm { min-height: 40px; padding: 6px 14px; font-size: calc(14 * var(--u)); }
.btn--block { width: 100%; }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; }
.btn-row > .btn { flex: 1 1 140px; }
.iconbtn {
  width: 44px; height: 44px; border-radius: 50%; border: 1.5px solid var(--line); background: var(--card);
  display: inline-grid; place-items: center; cursor: pointer; font-size: calc(18 * var(--u)); flex: none;
}

/* ---------- Forms ---------- */
.form { display: grid; gap: 16px; }
.form__title { font-size: calc(20 * var(--u)); font-weight: 800; }
.field { display: grid; gap: 6px; }
.field__label { font-weight: 700; font-size: calc(15 * var(--u)); }
.field__hint { font-size: calc(13.5 * var(--u)); color: var(--text-faint); }
.field__error { color: var(--bad); font-weight: 650; font-size: calc(14 * var(--u)); margin: -6px 0 0; }
.input {
  width: 100%; min-height: 50px; padding: 10px 14px; border-radius: var(--radius-sm);
  border: 1.5px solid var(--line-strong); background: var(--card); font-size: max(16px, calc(16 * var(--u)));
}
.input--lg { min-height: 58px; font-size: max(16px, calc(20 * var(--u))); }
.input[aria-invalid="true"] { border-color: var(--bad); }
textarea.input { min-height: 84px; resize: vertical; }
.check { display: flex; gap: 12px; align-items: flex-start; font-weight: 600; cursor: pointer; }
.check input { width: 24px; height: 24px; flex: none; margin-top: 2px; accent-color: var(--brand); }
.seg { display: flex; flex-wrap: wrap; gap: 8px; }
.seg label { flex: 1 1 auto; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span {
  display: flex; align-items: center; justify-content: center; min-height: 46px; padding: 8px 14px;
  border: 1.5px solid var(--line-strong); border-radius: 999px; background: var(--card); font-weight: 650; cursor: pointer; text-align: center;
}
.seg input:checked + span { background: var(--brand); color: var(--on-brand); border-color: var(--brand); }
.seg input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: 2px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  min-height: 42px; padding: 6px 14px; border-radius: 999px; border: 1.5px solid var(--line-strong);
  background: var(--card); font-weight: 650; cursor: pointer; display: inline-flex; align-items: center; gap: 6px;
}
.chip--on { background: var(--brand); color: var(--on-brand); border-color: var(--brand); }
.chip__x { border: none; background: none; cursor: pointer; font-size: calc(16 * var(--u)); padding: 0 0 0 4px; color: inherit; min-width: 28px; min-height: 28px; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 12px; align-items: end; }
.fineprint { font-size: calc(13 * var(--u)); color: var(--text-faint); margin: 0; }
fieldset { border: none; padding: 0; margin: 0; }
legend { padding: 0; }
.box { border: 1.5px solid var(--line); border-radius: var(--radius); padding: 14px; display: grid; gap: 12px; background: var(--card-2); }
.box__head { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-weight: 750; }

/* ---------- Cards, lists, notes ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.section-title { font-size: calc(13 * var(--u)); font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--text-faint); margin: 22px 4px 8px; }
.list { display: grid; gap: 10px; }
.row {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px; min-height: 64px;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); text-align: left; width: 100%;
}
button.row { cursor: pointer; }
.row__main { flex: 1; min-width: 0; }
.row__title { font-weight: 750; overflow-wrap: anywhere; }
.row__sub { font-size: calc(14 * var(--u)); color: var(--text-dim); overflow-wrap: anywhere; }
.row__end { flex: none; text-align: right; }
.thumb { width: 52px; height: 52px; border-radius: 12px; object-fit: cover; flex: none; background: var(--bg-2); }
.pillicon { width: 52px; height: 52px; border-radius: 12px; display: grid; place-items: center; flex: none; background: var(--brand-soft); font-size: calc(26 * var(--u)); }
.note { border-radius: var(--radius-sm); padding: 12px 14px; border: 1px solid var(--info-line); background: var(--info-bg); font-size: calc(14.5 * var(--u)); }
.note--due { border-color: var(--due-line); background: var(--due-bg); }
.note--bad { border-color: var(--bad-line); background: var(--bad-bg); }
.note--ok { border-color: var(--ok-line); background: var(--ok-bg); }
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 999px; font-size: calc(13 * var(--u)); font-weight: 750; white-space: nowrap; }
.row .badge, .slot .badge { white-space: normal; text-align: center; }
.badge--taken, .badge--ok, .badge--done { background: var(--ok-bg); color: var(--ok); }
.badge--skipped { background: var(--card-2); color: var(--text-dim); }
.badge--unconfirmed, .badge--bad, .badge--danger, .badge--high, .badge--low { background: var(--bad-bg); color: var(--bad); }
.badge--due, .badge--above-target, .badge--below-target { background: var(--due-bg); color: var(--due); }
.badge--upcoming { background: var(--card-2); color: var(--text-dim); }
.empty { text-align: center; padding: 26px 16px; color: var(--text-dim); }
.empty .btn { margin-top: 12px; }

/* ---------- Welcome ---------- */
.welcome { min-height: 100dvh; display: grid; place-items: center; padding: max(28px, env(safe-area-inset-top)) 16px 40px; }
.welcome__inner { width: min(460px, 100%); display: grid; gap: 16px; text-align: center; }
.welcome__mark img { width: 84px; height: 84px; }
.welcome__title { font-size: calc(40 * var(--u)); font-weight: 850; letter-spacing: -0.02em; color: var(--brand); }
.welcome__sub { margin: 0; color: var(--text-dim); font-size: calc(17 * var(--u)); }
.welcome .card { text-align: left; }
.welcome__links { display: flex; justify-content: center; flex-wrap: wrap; gap: 4px 16px; }

/* ---------- Caregiver app ---------- */
.app { min-height: 100dvh; padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 16px); }
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 10px;
  padding: max(10px, env(safe-area-inset-top)) 16px 10px; background: var(--bg); border-bottom: 1px solid var(--line);
}
.elderchip {
  display: inline-flex; align-items: center; gap: 10px; min-height: 48px; padding: 4px 14px 4px 4px; border-radius: 999px;
  border: 1.5px solid var(--line); background: var(--card); font-weight: 800; font-size: calc(17 * var(--u)); cursor: pointer; min-width: 0;
}
.elderchip__face { width: 40px; height: 40px; border-radius: 50%; background: var(--brand-soft); display: grid; place-items: center; overflow: hidden; flex: none; font-size: calc(20 * var(--u)); }
.elderchip__face img { width: 100%; height: 100%; object-fit: cover; }
.elderchip__name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar__hand { margin-left: auto; }
.view { max-width: 720px; margin: 0 auto; padding: 8px 16px 24px; outline: none; }
.view h1 { font-size: calc(24 * var(--u)); font-weight: 850; margin: 14px 4px 4px; }
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: grid; grid-template-columns: repeat(4, 1fr);
  min-height: var(--tabbar-h); padding-bottom: env(safe-area-inset-bottom); background: var(--card); border-top: 1px solid var(--line);
}
.tab { border: none; background: none; display: grid; justify-items: center; align-content: center; gap: 2px; cursor: pointer; color: var(--text-faint); font-size: calc(20 * var(--u)); min-height: 56px; }
.tab b { font-size: calc(12.5 * var(--u)); font-weight: 750; }
.tab[aria-current="page"] { color: var(--brand); }
.tab[aria-current="page"] b { text-decoration: underline; text-underline-offset: 4px; }
.banner { margin: 10px 16px 0; padding: 12px 14px; border-radius: var(--radius-sm); font-weight: 650; }
.banner--top { position: fixed; left: 0; right: 0; top: max(8px, env(safe-area-inset-top)); z-index: 95; font-size: calc(18 * var(--u)); box-shadow: var(--shadow); }
.banner--bad { background: var(--bad-bg); border: 1px solid var(--bad-line); color: var(--bad); }

/* timeline */
.slot { display: grid; grid-template-columns: 76px 1fr; gap: 12px; padding: 12px 14px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
.slot--due { border-color: var(--due-line); background: var(--due-bg); }
.slot--unconfirmed { border-color: var(--bad-line); }
.slot__time { font-weight: 850; font-size: calc(17 * var(--u)); }
.slot__part { font-size: calc(12.5 * var(--u)); color: var(--text-faint); }
.slot__items { display: grid; gap: 6px; }
.slot__item { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.slot__name { font-weight: 650; overflow-wrap: anywhere; }
.stat { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.stat__big { font-size: calc(30 * var(--u)); font-weight: 850; }
.vtile { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; align-items: center; }
.vtile__val { font-size: calc(22 * var(--u)); font-weight: 850; }
.spark { width: 120px; height: 36px; color: var(--brand); }
.spark--wide { width: 100%; height: 80px; }

/* ---------- Sheet ---------- */
.sheet { position: fixed; inset: 0; z-index: 85; display: flex; align-items: flex-end; justify-content: center; }
.sheet__backdrop { position: absolute; inset: 0; background: rgba(15, 20, 18, 0.45); }
.sheet__panel {
  position: relative; width: min(680px, 100%); max-height: 94dvh; display: flex; flex-direction: column;
  background: var(--bg); border-radius: 22px 22px 0 0; box-shadow: 0 -10px 40px rgba(0,0,0,.25);
}
.sheet__head { display: flex; align-items: center; gap: 12px; padding: 16px 16px 8px; }
.sheet__title { flex: 1; font-size: calc(20 * var(--u)); font-weight: 850; }
.sheet__body { overflow-y: auto; padding: 8px 16px calc(24px + env(safe-area-inset-bottom)); overscroll-behavior: contain; }
.sheet-save { position: sticky; bottom: calc(-24px - env(safe-area-inset-bottom)); background: var(--bg); padding: 12px 0 calc(16px + env(safe-area-inset-bottom)); margin-top: 8px; border-top: 1px solid var(--line); }
@media (min-width: 760px) { .sheet { align-items: center; } .sheet__panel { border-radius: 22px; max-height: 88dvh; } }
body.sheet-open { overflow: hidden; }

/* ---------- Confirm / toasts ---------- */
.confirm { border: none; border-radius: 22px; padding: 22px; width: min(420px, calc(100% - 32px)); background: var(--bg); color: var(--text); box-shadow: var(--shadow); }
.confirm::backdrop { background: rgba(15, 20, 18, 0.5); }
.confirm__title { font-size: calc(20 * var(--u)); font-weight: 850; margin-bottom: 8px; }
.confirm__text { margin: 0 0 18px; color: var(--text-dim); }
.toasts { position: fixed; left: 0; right: 0; bottom: calc(var(--tabbar-h) + 16px + env(safe-area-inset-bottom)); z-index: 90; display: grid; justify-items: center; padding: 0 16px; pointer-events: none; }
.toast { pointer-events: auto; display: flex; align-items: center; gap: 12px; max-width: 560px; padding: 12px 16px; border-radius: 16px; background: #1d2422; color: #fff; box-shadow: var(--shadow); font-weight: 600; }
.toast button { background: none; border: none; color: #9fe3d6; font-weight: 800; cursor: pointer; min-height: 40px; }
body.mode-elder .toasts { bottom: calc(24px + env(safe-area-inset-bottom)); }
body.mode-elder .toast { font-size: calc(19 * var(--u)); }

/* =========================================================
   ELDER MODE — big, calm, photo-first
   ========================================================= */
.elder { min-height: 100dvh; background: var(--bg); }
.elder__view { max-width: 640px; margin: 0 auto; padding: max(14px, env(safe-area-inset-top)) 16px 40px; outline: none; display: grid; gap: 16px; font-size: calc(24 * var(--u)); }
.el-top { display: flex; align-items: flex-start; gap: 12px; }
.el-hello { flex: 1; min-width: 0; }
.el-hello h1 { overflow-wrap: anywhere; }
.el-hello h1 { font-size: calc(30 * var(--u)); font-weight: 850; letter-spacing: -0.01em; }
.el-date { font-size: calc(20 * var(--u)); color: var(--text-dim); margin-top: 4px; }
.speakbtn { width: 64px; height: 64px; border-radius: 50%; border: 2px solid var(--line-strong); background: var(--card); font-size: calc(28 * var(--u)); cursor: pointer; flex: none; display: grid; place-items: center; }
.el-tile {
  display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 16px; width: 100%; min-height: 120px; padding: 18px;
  border-radius: 26px; border: 2px solid var(--line); background: var(--card); text-align: left; cursor: pointer; box-shadow: var(--shadow);
}
.el-tile__icon { width: 76px; height: 76px; border-radius: 22px; display: grid; place-items: center; font-size: calc(40 * var(--u)); background: var(--brand-soft); }
.el-tile > span:last-child { min-width: 0; }
.el-tile__label { display: block; font-size: calc(26 * var(--u)); font-weight: 850; line-height: 1.15; overflow-wrap: anywhere; }
.el-tile__sub { display: block; font-size: calc(24 * var(--u)); color: var(--text-dim); margin-top: 4px; overflow-wrap: anywhere; }
.el-tile--due { background: var(--due-bg); border-color: var(--due); }
.el-tile--due .el-tile__icon { background: var(--due); color: #fff; }
.el-tile--done .el-tile__icon { background: var(--ok-bg); }
.el-pics { display: flex; gap: 6px; margin-top: 10px; flex-wrap: wrap; }
.el-pics img, .el-pics .pillicon { width: 54px; height: 54px; border-radius: 14px; object-fit: cover; }
.el-list { display: grid; gap: 10px; }
.el-row { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-radius: 20px; background: var(--card); border: 1.5px solid var(--line); font-size: calc(24 * var(--u)); }
.el-row__time { font-weight: 850; flex: none; }
.el-row__what { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.el-row__mark { font-size: calc(28 * var(--u)); flex: none; }
.el-row--taken { opacity: .75; }
.el-caregiver { justify-self: center; font-size: calc(15 * var(--u)); color: var(--text-faint); min-height: 48px; }
.el-h2 { font-size: calc(22 * var(--u)); font-weight: 850; margin: 6px 4px 0; }

/* Elder sheet: the reading flow and as-needed medicine */
.sheet--elder .sheet__panel { max-height: 100dvh; height: 100dvh; border-radius: 0; width: 100%; max-width: 100%; }
.sheet--elder .sheet__title { font-size: calc(26 * var(--u)); }
.sheet--elder .sheet__body { font-size: calc(24 * var(--u)); }
.sheet--elder .chip { min-height: 64px; font-size: calc(22 * var(--u)); padding: 8px 18px; }
.sheet--elder .iconbtn { width: 60px; height: 60px; font-size: calc(24 * var(--u)); }
.el-choices { display: grid; gap: 12px; }
.el-choice { display: flex; align-items: center; gap: 16px; min-height: 92px; padding: 14px 18px; border-radius: 24px; border: 2px solid var(--line); background: var(--card); font-size: calc(24 * var(--u)); font-weight: 800; cursor: pointer; text-align: left; width: 100%; }
.el-choice__icon { font-size: calc(38 * var(--u)); width: 64px; text-align: center; flex: none; }
.el-btn { min-height: 76px; font-size: calc(24 * var(--u)); font-weight: 850; border-radius: 22px; padding: 14px 20px; }
.el-btn--huge { min-height: 104px; font-size: calc(30 * var(--u)); border-radius: 28px; }
.mic { display: grid; justify-items: center; gap: 14px; text-align: center; padding: 6px 0; }
.mic__orb { width: 168px; height: 168px; border-radius: 50%; border: none; background: var(--brand); color: var(--on-brand); font-size: calc(64 * var(--u)); cursor: pointer; box-shadow: 0 16px 40px -18px var(--brand); display: grid; place-items: center; }
.mic__orb--on { animation: pulse 1.2s ease-in-out infinite; background: var(--bad); }
@keyframes pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.06); } }
@media (prefers-reduced-motion: reduce) { .mic__orb--on { animation: none; } }
.mic__hint { font-size: calc(24 * var(--u)); color: var(--text-dim); margin: 0; }
.mic__heard { font-size: calc(19 * var(--u)); color: var(--text-faint); margin: 0; font-style: italic; }
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; width: 100%; max-width: 420px; margin: 0 auto; }
.keypad button { min-height: 72px; border-radius: 18px; border: 2px solid var(--line); background: var(--card); font-size: calc(32 * var(--u)); font-weight: 800; cursor: pointer; }
.keypad__display { grid-column: 1 / -1; min-height: 84px; display: grid; place-items: center; border-radius: 18px; background: var(--card-2); border: 2px solid var(--line-strong); font-size: calc(44 * var(--u)); font-weight: 850; font-variant-numeric: tabular-nums; }
.keypad__label { grid-column: 1 / -1; font-weight: 800; font-size: calc(24 * var(--u)); text-align: center; }
.readback { text-align: center; display: grid; gap: 16px; }
.readback__num { font-size: calc(64 * var(--u)); font-weight: 900; line-height: 1; font-variant-numeric: tabular-nums; }
.readback__unit { font-size: calc(22 * var(--u)); color: var(--text-dim); }
.faces { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.face { display: grid; justify-items: center; gap: 6px; padding: 10px 4px; border-radius: 20px; border: 2px solid var(--line); background: var(--card); cursor: pointer; font-size: calc(15 * var(--u)); font-weight: 700; min-height: 120px; align-content: center; }
.face span { font-size: calc(46 * var(--u)); line-height: 1; }
.face--on { border-color: var(--brand); background: var(--brand-soft); }
.verdict { border-radius: 26px; padding: 22px; text-align: center; display: grid; gap: 10px; border: 2px solid var(--line); }
.verdict__val { font-size: calc(52 * var(--u)); font-weight: 900; line-height: 1.05; }
.verdict__word { font-size: calc(28 * var(--u)); font-weight: 850; }
.verdict--ok { background: var(--ok-bg); border-color: var(--ok-line); color: var(--ok); }
.verdict--above-target, .verdict--below-target { background: var(--due-bg); border-color: var(--due-line); color: var(--due); }
.verdict--high, .verdict--low, .verdict--danger { background: var(--bad-bg); border-color: var(--bad-line); color: var(--bad); }
.danger-card { border-radius: 26px; padding: 22px; background: var(--bad); color: #fff; font-size: calc(23 * var(--u)); font-weight: 750; line-height: 1.35; }
.danger-card h3 { font-size: calc(30 * var(--u)); margin-bottom: 8px; }

/* =========================================================
   DOSE CARD — full screen, the alarm
   ========================================================= */
.dose { position: fixed; inset: 0; z-index: 80; background: var(--bg); overflow-y: auto; font-size: calc(24 * var(--u)); }
.dose__inner { max-width: 640px; margin: 0 auto; min-height: 100dvh; display: flex; flex-direction: column; gap: 14px; padding: max(18px, env(safe-area-inset-top)) 16px calc(20px + env(safe-area-inset-bottom)); }
.dose__head { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-radius: 24px; background: var(--due); color: #fff; }
.dose__head h2 { flex: 1; font-size: calc(30 * var(--u)); font-weight: 900; }
.dose__head .speakbtn { border-color: rgba(255,255,255,.6); background: rgba(255,255,255,.15); color: #fff; }
.dose__hint { margin: 0 4px; color: var(--text-dim); font-size: calc(24 * var(--u)); }
.dose__meds { display: grid; gap: 12px; }
.dmed {
  display: grid; grid-template-columns: 104px 1fr; gap: 14px; align-items: center; width: 100%; padding: 12px; text-align: left;
  border-radius: 24px; border: 3px solid var(--ok-line); background: var(--card); cursor: pointer; position: relative;
}
.dmed > span:nth-child(2) { padding-right: 46px; min-width: 0; }
.dmed__pic { width: 104px; height: 104px; border-radius: 18px; object-fit: cover; background: var(--brand-soft); display: grid; place-items: center; font-size: calc(48 * var(--u)); }
.dmed__amount { font-size: calc(28 * var(--u)); font-weight: 900; line-height: 1.1; }
.dmed__name { font-size: calc(24 * var(--u)); font-weight: 700; margin-top: 2px; overflow-wrap: anywhere; }
.dmed__purpose { font-size: calc(24 * var(--u)); color: var(--text-dim); margin-top: 2px; }
.dmed__tick { position: absolute; top: 10px; right: 12px; width: 40px; height: 40px; border-radius: 50%; background: var(--ok); color: #fff; display: grid; place-items: center; font-size: calc(22 * var(--u)); font-weight: 900; }
.dmed--off { border-color: var(--line); opacity: .55; }
.dmed--off .dmed__tick { background: var(--text-faint); }
.dmed--off .dmed__amount { text-decoration: line-through; }
.dmed--earlier { border-color: var(--line); }
.dmed__note { font-size: calc(24 * var(--u)); font-weight: 750; color: var(--ok); margin-top: 6px; }
.dmed__scale { grid-column: 1 / -1; display: grid; gap: 10px; padding: 12px; border-radius: 18px; background: var(--card-2); cursor: default; }
.dmed__scale .btn { min-height: 64px; font-size: calc(21 * var(--u)); }
.scale-row { font-size: calc(24 * var(--u)); font-weight: 850; }
.scale-row b { font-size: calc(40 * var(--u)); color: var(--brand); }
.dose__actions { display: grid; gap: 12px; margin-top: auto; padding: 12px 0 calc(8px + env(safe-area-inset-bottom)); position: sticky; bottom: 0; background: var(--bg); box-shadow: 0 -14px 18px -14px rgba(0,0,0,.25); }
.dose__done { text-align: center; display: grid; gap: 18px; padding: 40px 10px; font-size: calc(28 * var(--u)); font-weight: 850; }
.dose__done span { font-size: calc(80 * var(--u)); }

@media (min-width: 900px) { .view { padding-top: 16px; } }
