@font-face { font-family: Poppins; font-weight: 400; font-display: swap; src: url(/fonts/poppins-400.woff2) format("woff2"); }
@font-face { font-family: Poppins; font-weight: 500; font-display: swap; src: url(/fonts/poppins-500.woff2) format("woff2"); }
@font-face { font-family: Poppins; font-weight: 600; font-display: swap; src: url(/fonts/poppins-600.woff2) format("woff2"); }
@font-face { font-family: Poppins; font-weight: 700; font-display: swap; src: url(/fonts/poppins-700.woff2) format("woff2"); }

:root {
  color-scheme: light;
  --bg: #f5f7fb;
  --surface: #ffffff;
  --surface-2: #f1f4f9;
  --surface-3: #e9eef5;
  --line: #e5e9f0;
  --text: #1e232b;
  --text-2: #3d4553;
  --muted: #6b7280;
  --brand: #007be1;
  --primary: #0065b3;
  --primary-hover: #00589c;
  --brand-soft: #e8f3fd;
  --brand-softer: #f2f8fe;
  --accent: #f7c552;
  --accent-soft: #fdf3dc;
  --accent-ink: #8a5a00;
  --ok: #129a52;
  --ok-soft: #e5f6ec;
  --danger: #d93f44;
  --danger-soft: #fdecec;
  --radius: 20px;
  --radius-sm: 14px;
  --shadow-sm: 0 1px 2px rgb(16 24 40 / .05);
  --shadow: 0 1px 2px rgb(16 24 40 / .04), 0 8px 24px rgb(16 24 40 / .06);
  --shadow-lg: 0 24px 64px rgb(16 24 40 / .18);
  --ease: cubic-bezier(.2, .8, .2, 1);
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 400 15px/1.5 Poppins, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  min-height: 100dvh;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3, p { margin: 0; }
[hidden] { display: none !important; }
.i { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.mono { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; letter-spacing: .04em; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.center { text-align: center; }
.grow { flex: 1; min-width: 0; }
:focus-visible { outline: 2.5px solid color-mix(in srgb, var(--brand) 55%, transparent); outline-offset: 2px; }

/* ---------- Boot ---------- */
.boot { position: fixed; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 28px; background: var(--bg); z-index: 50; }
.boot-help { font-size: 13.5px; color: var(--muted); opacity: 0; animation: reveal .3s ease 6s forwards; }
.boot-help.show { animation: none; opacity: 1; }
.boot-help a { color: var(--primary); font-weight: 600; }
@keyframes reveal { to { opacity: 1; } }
.boot img { border-radius: 18px; box-shadow: var(--shadow); animation: pulse 1.4s var(--ease) infinite; }
@keyframes pulse { 50% { transform: scale(.94); } }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px; padding: 0 18px; border-radius: var(--radius-sm);
  border: 1px solid var(--line); background: var(--surface); color: var(--text);
  font-weight: 600; font-size: 14.5px; transition: background .15s, transform .1s, box-shadow .15s;
}
.btn:active { transform: scale(.98); }
.btn .i { width: 19px; height: 19px; }
.btn.primary { background: var(--primary); color: #fff; border-color: transparent; box-shadow: 0 6px 16px rgb(0 101 179 / .22); }
.btn.primary:hover { background: var(--primary-hover); }
.btn.outline { background: transparent; }
.btn.dashed { background: transparent; border-style: dashed; color: var(--primary); border-color: color-mix(in srgb, var(--brand) 40%, var(--line)); }
.btn.danger-soft { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.btn.sm { min-height: 38px; padding: 0 14px; font-size: 13.5px; border-radius: 12px; }
.btn.lg { min-height: 54px; font-size: 16px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .5; cursor: default; box-shadow: none; }
.btn.loading { color: transparent !important; position: relative; pointer-events: none; }
.btn.loading::after { content: ""; position: absolute; width: 20px; height: 20px; border-radius: 50%; border: 2.5px solid rgb(255 255 255 / .35); border-top-color: #fff; animation: spin .7s linear infinite; }
.btn:not(.primary).loading::after { border-color: var(--line); border-top-color: var(--primary); }
@keyframes spin { to { transform: rotate(360deg); } }
.btn-row { display: flex; gap: 10px; margin-top: 14px; flex-wrap: wrap; }
.btn-row.two > * { flex: 1; }
.link { background: none; border: 0; color: var(--primary); font-weight: 600; font-size: 14px; padding: 10px; display: block; margin: 6px auto 0; }
.danger-link { color: var(--danger); font-weight: 500; }
.icon-btn { width: 40px; height: 40px; border-radius: 12px; border: 0; background: var(--surface-2); display: grid; place-items: center; color: var(--text-2); flex: none; }
.icon-btn .i { width: 20px; height: 20px; }

/* ---------- Form ---------- */
.field { display: flex; flex-direction: column; gap: 6px; margin-top: 14px; font-size: 13px; font-weight: 500; color: var(--text-2); }
.field input {
  min-height: 48px; padding: 0 14px; border-radius: var(--radius-sm); border: 1.5px solid var(--line);
  background: var(--surface); color: var(--text); font-size: 16px; font-weight: 400; width: 100%;
  transition: border-color .15s, box-shadow .15s;
}
.field input::placeholder { color: #a3aab6; }
.field input:focus { outline: 0; border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-soft); }
.field .hint { font-weight: 400; color: var(--muted); font-size: 12px; }
.pw { position: relative; display: block; }
.pw input { padding-right: 48px; }
.pw-toggle { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); width: 40px; height: 40px; border: 0; background: none; color: var(--muted); display: grid; place-items: center; border-radius: 10px; }
.pw-toggle.on { color: var(--primary); }
.form-error { color: var(--danger); font-size: 13.5px; font-weight: 500; margin-top: 12px; min-height: 0; }
.form-error:empty { display: none; }
.fine { font-size: 12px; color: var(--muted); margin-top: 14px; line-height: 1.55; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.check-row { display: flex; gap: 10px; align-items: center; font-size: 14px; margin: 16px 0 14px; color: var(--text-2); }
.check-row input { width: 20px; height: 20px; accent-color: var(--primary); }

/* ---------- Auth ---------- */
.auth { min-height: 100dvh; display: grid; grid-template-rows: auto 1fr auto; }
.auth-hero {
  position: relative; overflow: hidden; color: #fff;
  background: radial-gradient(120% 90% at 100% 0%, #2a98f7 0%, transparent 60%), linear-gradient(160deg, #0a84e6 0%, #0065b3 70%, #00508f 100%);
  padding: calc(28px + env(safe-area-inset-top)) 24px 88px;
}
.auth-hero h1 { font-size: clamp(24px, 6.4vw, 34px); line-height: 1.22; font-weight: 700; letter-spacing: -.015em; margin: 26px 0 18px; max-width: 15em; }
.brand { display: flex; align-items: center; gap: 12px; }
.brand img { border-radius: 13px; box-shadow: 0 6px 18px rgb(0 0 0 / .18); }
.brand b { display: block; font-size: 17px; font-weight: 700; line-height: 1.2; }
.brand span { font-size: 12.5px; opacity: .8; }
.features { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.features li { display: flex; align-items: center; gap: 12px; font-size: 14px; color: rgb(255 255 255 / .92); }
.features span { width: 34px; height: 34px; border-radius: 10px; background: rgb(255 255 255 / .14); display: grid; place-items: center; flex: none; }
.features .i { width: 18px; height: 18px; }
.pixels { position: absolute; right: 22px; top: calc(26px + env(safe-area-inset-top)); width: 64px; height: 64px; }
.pixels i { position: absolute; width: 18px; height: 18px; border-radius: 5px; background: rgb(255 255 255 / .9); }
.pixels i:nth-child(1) { right: 0; top: 0; background: var(--accent); }
.pixels i:nth-child(2) { right: 21px; top: 21px; }
.pixels i:nth-child(3) { right: 0; top: 21px; }
.auth-side { display: flex; flex-direction: column; }
.auth-card { margin: -60px 16px 0; padding: 22px 20px 20px; position: relative; z-index: 1; }
.auth-form h2 { font-size: 21px; font-weight: 700; margin-top: 18px; letter-spacing: -.01em; }
.auth-form > .muted { font-size: 14px; margin-top: 2px; }
.auth-form .btn.block { margin-top: 18px; }
.seg { display: grid; grid-template-columns: 1fr 1fr; background: var(--surface-2); border-radius: 14px; padding: 4px; }
.seg button { border: 0; background: none; min-height: 40px; border-radius: 11px; font-weight: 600; font-size: 14px; color: var(--muted); transition: background .2s, color .2s, box-shadow .2s; }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm), 0 2px 8px rgb(16 24 40 / .06); }
.made-by { display: flex; align-items: center; justify-content: center; gap: 8px; color: var(--muted); font-size: 12.5px; padding: 26px 16px calc(22px + env(safe-area-inset-bottom)); }
.made-by img { height: 22px; width: auto; }
.made-by.in-app { padding: 24px 0 4px; }

@media (min-width: 900px) {
  .auth { grid-template-columns: 1.1fr 1fr; grid-template-rows: none; }
  .auth-hero { padding: 56px 64px; display: flex; flex-direction: column; justify-content: center; }
  .auth-side { min-height: 100dvh; align-items: center; justify-content: center; padding: 48px 32px 0; }
  .auth-side .made-by { padding-top: 28px; }
  .auth-hero h1 { font-size: 40px; }
  .pixels { right: 56px; top: 56px; }
  .auth-card { margin: auto 0 0; width: min(420px, 100%); }
  .auth-side .made-by { margin-bottom: auto; }
}

/* ---------- Card ---------- */
.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; margin-bottom: 14px; }
.card h2 { font-size: 16px; font-weight: 600; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 6px; }

/* ---------- App shell ---------- */
#appView { padding-bottom: calc(96px + env(safe-area-inset-bottom)); }
.top {
  display: flex; align-items: center; gap: 12px;
  padding: calc(18px + env(safe-area-inset-top)) 20px 6px;
  max-width: 680px; margin: 0 auto;
}
.top-text { flex: 1; min-width: 0; }
.greet { color: var(--muted); font-size: 13px; }
.top h1 { font-size: 22px; font-weight: 700; letter-spacing: -.015em; line-height: 1.25; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.avatar {
  width: 44px; height: 44px; border-radius: 14px; border: 0; flex: none;
  background: linear-gradient(145deg, #2a98f7, #0065b3); color: #fff; font-weight: 600; font-size: 16px;
  display: grid; place-items: center; box-shadow: 0 4px 12px rgb(0 101 179 / .25);
}
.avatar.lg { width: 56px; height: 56px; font-size: 21px; border-radius: 18px; }
.offline-pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; color: var(--accent-ink); background: var(--accent-soft); padding: 6px 10px; border-radius: 99px; }
.offline-pill .i { width: 15px; height: 15px; }

main { max-width: 680px; margin: 0 auto; padding: 8px 16px 24px; }
main, .tab, .card { min-width: 0; }
.dose .name, .med .name, .profile h2 { overflow-wrap: anywhere; }

.banner {
  display: flex; align-items: center; gap: 12px;
  max-width: 648px; margin: 8px auto 4px; padding: 12px 12px 12px 14px;
  background: var(--surface); border: 1px solid color-mix(in srgb, var(--brand) 22%, var(--line));
  border-radius: var(--radius-sm); box-shadow: var(--shadow-sm);
}
@media (max-width: 680px) { .banner { margin-inline: 16px; } }
.banner strong { font-size: 14px; font-weight: 600; }
.banner p { font-size: 12.5px; color: var(--muted); line-height: 1.4; }
.banner-ic { width: 38px; height: 38px; border-radius: 12px; background: var(--brand-soft); color: var(--primary); display: grid; place-items: center; flex: none; }
.banner-ic .i { width: 20px; height: 20px; }

.section-label { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .07em; margin: 22px 4px 10px; display: flex; align-items: center; gap: 8px; }
.section-label .count { font-weight: 500; letter-spacing: 0; text-transform: none; color: #9aa1ad; }

/* ---------- Week strip ---------- */
.week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; margin: 6px 0 16px; }
.day-btn {
  border: 0; background: transparent; border-radius: 16px; padding: 8px 0 9px;
  display: flex; flex-direction: column; align-items: center; gap: 2px; color: var(--muted);
  transition: background .15s, color .15s;
}
.day-btn small { font-size: 11.5px; font-weight: 500; }
.day-btn b { font-size: 17px; font-weight: 600; color: var(--text); line-height: 1.35; }
.day-btn .dot { width: 6px; height: 6px; border-radius: 50%; background: transparent; margin-top: 2px; }
.day-btn .dot.full { background: var(--ok); }
.day-btn .dot.part { background: var(--accent); }
.day-btn .dot.miss { background: var(--danger); }
.day-btn .dot.plan { background: var(--surface-3); }
.day-btn.today b { color: var(--primary); }
.day-btn.sel { background: var(--primary); color: rgb(255 255 255 / .8); box-shadow: 0 8px 18px rgb(0 101 179 / .25); }
.day-btn.sel b { color: #fff; }
.day-btn.sel .dot.plan { background: rgb(255 255 255 / .35); }

/* ---------- Summary ---------- */
.summary {
  position: relative; overflow: hidden; color: #fff; border-radius: 24px; padding: 20px;
  background: radial-gradient(120% 120% at 100% 0%, #2a98f7 0%, transparent 55%), linear-gradient(150deg, #0a84e6, #0065b3 75%);
  box-shadow: 0 14px 30px rgb(0 101 179 / .25);
  display: flex; align-items: center; gap: 18px;
}
.summary::before, .summary::after { content: ""; position: absolute; border-radius: 6px; width: 16px; height: 16px; }
.summary::before { right: 18px; top: 16px; background: var(--accent); }
.summary::after { right: 37px; top: 35px; background: rgb(255 255 255 / .22); box-shadow: 19px 0 0 rgb(255 255 255 / .22); }
.ring { position: relative; width: 84px; height: 84px; flex: none; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 7; }
.ring .bg { stroke: rgb(255 255 255 / .2); }
.ring .fg { stroke: #fff; stroke-linecap: round; transition: stroke-dashoffset .6s var(--ease); }
.ring span { position: absolute; inset: 0; display: grid; place-items: center; font-weight: 700; font-size: 21px; letter-spacing: -.02em; }
.ring span div { display: flex; align-items: baseline; gap: 1px; }
.ring span small { font-size: 12px; font-weight: 600; opacity: .8; }
.sum-text { min-width: 0; padding-right: 30px; }
.sum-text .eyebrow { font-size: 12px; color: rgb(255 255 255 / .78); font-weight: 500; text-transform: none; letter-spacing: 0; }
.sum-text h2 { font-size: 18px; font-weight: 600; line-height: 1.3; margin: 2px 0 8px; }
.next { display: inline-flex; align-items: center; gap: 8px; background: rgb(255 255 255 / .15); border-radius: 12px; padding: 7px 11px; font-size: 13px; max-width: 100%; }
.next .i { width: 16px; height: 16px; }
.next span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Timeline ---------- */
.slot { display: grid; grid-template-columns: 54px minmax(0, 1fr); gap: 10px; margin-bottom: 10px; }
.slot > div { min-width: 0; }
.slot-time { padding-top: 17px; font-size: 14px; font-weight: 600; color: var(--text-2); font-variant-numeric: tabular-nums; text-align: right; }
.slot.past .slot-time { color: #9aa1ad; }
.dose {
  display: flex; align-items: center; gap: 12px;
  background: var(--surface); border-radius: 18px; box-shadow: var(--shadow);
  padding: 12px 12px 12px 12px; position: relative; transition: opacity .2s;
}
.dose + .dose { margin-top: 8px; }
.med-ic { width: 44px; height: 44px; border-radius: 14px; flex: none; display: grid; place-items: center; background: color-mix(in srgb, var(--c) 13%, white); color: var(--c); }
.med-ic .i { width: 22px; height: 22px; }
.dose .info { flex: 1; min-width: 0; }
.dose .name { font-weight: 600; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dose .sub { font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 1px; }
.dose.taken .name { color: var(--muted); }
.dose.skipped { opacity: .65; }
.tag { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 99px; margin-right: 6px; vertical-align: 1px; white-space: nowrap; }
.tag.due { background: var(--brand-soft); color: var(--primary); }
.tag.missed { background: var(--danger-soft); color: var(--danger); }
.tag.taken { background: var(--ok-soft); color: var(--ok); }
.tag.low { background: var(--accent-soft); color: var(--accent-ink); }
.tag.off { background: var(--surface-2); color: var(--muted); }
.check {
  width: 44px; height: 44px; flex: none; border-radius: 14px;
  border: 1.5px solid var(--line); background: var(--surface); color: transparent;
  display: grid; place-items: center; transition: background .2s, border-color .2s, color .2s, transform .1s;
}
.check .i { width: 22px; height: 22px; stroke-width: 2.6; }
.check:active { transform: scale(.9); }
.check:hover:not(:disabled) { border-color: var(--brand); color: color-mix(in srgb, var(--brand) 35%, transparent); }
.dose.due .check { border-color: var(--brand); background: var(--brand-softer); }
.dose.missed .check { border-color: color-mix(in srgb, var(--danger) 45%, var(--line)); }
.dose.taken .check { background: var(--ok); border-color: var(--ok); color: #fff; }
.dose.skipped .check { border-style: dashed; }
.check:disabled { opacity: .45; cursor: default; }
.dose.due::before { content: ""; position: absolute; left: -1px; top: 14px; bottom: 14px; width: 3.5px; border-radius: 0 4px 4px 0; background: var(--brand); }
.pop { animation: pop .35s var(--ease); }
@keyframes pop { 40% { transform: scale(1.18); } }

/* ---------- Empty ---------- */
.empty { text-align: center; padding: 40px 20px 32px; }
.empty-ill { width: 88px; height: 88px; margin: 0 auto 16px; border-radius: 28px; background: var(--brand-soft); color: var(--primary); display: grid; place-items: center; position: relative; }
.empty-ill .i { width: 40px; height: 40px; stroke-width: 1.6; }
.empty-ill::after { content: ""; position: absolute; right: -6px; top: -6px; width: 16px; height: 16px; border-radius: 5px; background: var(--accent); }
.empty h3 { font-size: 17px; font-weight: 600; margin-bottom: 4px; }
.empty p { color: var(--muted); font-size: 14px; max-width: 290px; margin: 0 auto; }
.empty .btn { margin-top: 18px; }

/* ---------- Med list ---------- */
.med {
  display: flex; gap: 14px; width: 100%; text-align: left; align-items: flex-start;
  background: var(--surface); border: 0; border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 16px; margin-bottom: 12px; transition: transform .1s;
}
.med:active { transform: scale(.99); }
.med.inactive { opacity: .6; }
.med .med-ic { width: 48px; height: 48px; }
.med .info { flex: 1; min-width: 0; }
.med .name { font-weight: 600; font-size: 15.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.med .sub { font-size: 13px; color: var(--muted); margin-top: 1px; }
.time-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.time-chips span { font-size: 12px; font-weight: 600; background: var(--surface-2); color: var(--text-2); border-radius: 8px; padding: 3px 8px; font-variant-numeric: tabular-nums; }
.stock { margin-top: 12px; }
.stock-row { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin-bottom: 5px; }
.stock-row b { color: var(--text-2); font-weight: 600; }
.stock.low .stock-row b { color: var(--accent-ink); }
.meter { height: 6px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.meter i { display: block; height: 100%; border-radius: 99px; background: var(--brand); }
.stock.low .meter i { background: var(--accent); }
.med .chev { color: #b4bac4; width: 20px; height: 20px; margin-top: 14px; }

/* ---------- History ---------- */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 14px; }
.stat { background: var(--surface); border-radius: 18px; box-shadow: var(--shadow); padding: 14px 12px; }
.stat b { display: block; font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -.02em; line-height: 1.2; }
.stat span { display: block; font-size: 12px; line-height: 1.35; color: var(--muted); margin-top: 2px; }
.stat.hl { background: linear-gradient(150deg, #0a84e6, #0065b3); color: #fff; }
.stat.hl span { color: rgb(255 255 255 / .8); }
.legend { display: flex; gap: 14px; font-size: 11.5px; color: var(--muted); margin-top: 14px; justify-content: center; }
.legend span { display: inline-flex; align-items: center; gap: 4px; }
.legend i { width: 9px; height: 9px; border-radius: 3px; }
.lv-full { background: var(--ok); }
.lv-part { background: var(--accent); }
.lv-miss { background: #f3a5a7; }
.heat-days, .heat { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.heat-days { margin: 12px 0 6px; }
.heat-days span { font-size: 11px; color: var(--muted); text-align: center; }
.heat button {
  aspect-ratio: 1; border-radius: 10px; border: 0; background: var(--surface-2);
  font-size: 12px; font-weight: 500; color: var(--muted); padding: 0; display: grid; place-items: center;
}
.heat .full { background: var(--ok); color: #fff; }
.heat .part { background: var(--accent); color: #5c3c00; }
.heat .miss { background: #f3a5a7; color: #7d1d20; }
.heat .none { background: var(--surface-2); }
.heat .future { background: transparent; border: 1.5px dashed var(--line); color: #b4bac4; }
.heat .pad { visibility: hidden; }
.heat .today { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--primary); }
.pm { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); }
.pm:first-child { border-top: 0; }
.pm .n { font-size: 14px; font-weight: 500; display: flex; align-items: center; gap: 8px; min-width: 0; }
.pm .n i { width: 10px; height: 10px; border-radius: 4px; background: var(--c); flex: none; }
.pm .n span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pm b { font-size: 14px; font-variant-numeric: tabular-nums; }
.pm .meter { grid-column: 1 / -1; }
.pm .meter i { background: var(--c); }
.dayrec { background: var(--surface); border-radius: 18px; box-shadow: var(--shadow); padding: 14px 16px; margin-bottom: 10px; }
.dayrec-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-bottom: 6px; }
.dayrec-head b { font-size: 14.5px; font-weight: 600; }
.dayrec-head span { font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.dayrec ul { list-style: none; padding: 0; margin: 0; }
.dayrec li { display: flex; align-items: center; gap: 10px; padding: 5px 0; font-size: 13.5px; }
.dayrec li .t { font-variant-numeric: tabular-nums; color: var(--muted); width: 42px; flex: none; }
.dayrec li .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Account ---------- */
.profile { display: flex; align-items: center; gap: 14px; }
.profile h2 { font-size: 17px; }
.profile .muted { font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; }
.status-dot { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; padding: 4px 10px; border-radius: 99px; background: var(--surface-2); color: var(--muted); }
.status-dot::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.status-dot.on { background: var(--ok-soft); color: var(--ok); }
.status-dot.warn { background: var(--accent-soft); color: var(--accent-ink); }
.list-card { padding: 8px; }
.list-title { padding: 10px 10px 6px; }
.row-btn { display: flex; align-items: center; gap: 12px; width: 100%; border: 0; background: none; padding: 10px; border-radius: 14px; text-align: left; font-weight: 500; font-size: 14.5px; }
.row-btn:hover { background: var(--surface-2); }
.row-ic { width: 38px; height: 38px; border-radius: 12px; background: var(--surface-2); color: var(--text-2); display: grid; place-items: center; flex: none; }
.row-ic .i { width: 19px; height: 19px; }
.row-btn .chev { color: #b4bac4; width: 18px; height: 18px; }
#logoutBtn { margin-top: 4px; }

/* ---------- FAB & Nav ---------- */
.fab {
  position: fixed; z-index: 6; right: max(18px, calc(50vw - 322px)); bottom: calc(86px + env(safe-area-inset-bottom));
  width: 58px; height: 58px; padding: 0; border-radius: 19px; border: 0; justify-content: center;
  background: var(--primary); color: #fff; box-shadow: 0 10px 24px rgb(0 101 179 / .35);
  display: inline-flex; align-items: center; gap: 8px; font-weight: 600; font-size: 14.5px;
  transition: transform .15s;
}
.fab:active { transform: scale(.96); }
.fab .i { width: 24px; height: 24px; stroke-width: 2.3; }
nav.bottom {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 5;
  display: flex; justify-content: center;
  background: rgb(255 255 255 / .9);
  backdrop-filter: saturate(1.6) blur(16px); -webkit-backdrop-filter: saturate(1.6) blur(16px);
  border-top: 1px solid var(--line);
  padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
}
nav.bottom button {
  flex: 1; max-width: 150px; border: 0; background: none;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 6px 0 4px; color: #8a919c; font-size: 11.5px; font-weight: 500;
}
nav.bottom .i { width: 24px; height: 24px; padding: 0; transition: transform .2s var(--ease); }
nav.bottom button.active { color: var(--primary); font-weight: 600; }
nav.bottom button.active .i { transform: translateY(-1px); stroke-width: 2.1; }

/* ---------- Dialogs ---------- */
dialog { border: 0; padding: 0; background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg); }
dialog::backdrop { background: rgb(16 24 40 / .45); backdrop-filter: blur(2px); }
dialog.sheet {
  width: 100%; max-width: 560px; max-height: 94dvh;
  margin: auto auto 0; border-radius: 26px 26px 0 0; overflow: hidden;
}
dialog.sheet[open] { display: flex; flex-direction: column; animation: up .28s var(--ease); }
dialog.modal { width: calc(100% - 32px); max-width: 400px; border-radius: 26px; }
dialog.modal[open] { animation: zoom .22s var(--ease); }
@keyframes up { from { transform: translateY(40px); opacity: 0; } }
@keyframes zoom { from { transform: scale(.95); opacity: 0; } }
@media (min-width: 600px) { dialog.sheet { margin: auto; border-radius: 26px; } }
#medForm { display: flex; flex-direction: column; min-height: 0; flex: 1; }
.sheet-head { display: flex; justify-content: space-between; align-items: center; padding: 18px 20px 6px; }
.sheet-head h2 { font-size: 19px; font-weight: 700; }
.sheet-body { padding: 0 20px 8px; overflow-y: auto; overscroll-behavior: contain; }
.sheet-actions { display: flex; gap: 10px; padding: 14px 20px calc(16px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: var(--surface); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  min-height: 38px; min-width: 46px; padding: 0 14px; border-radius: 12px;
  border: 1.5px solid var(--line); background: var(--surface); font-weight: 500; font-size: 13.5px; color: var(--text-2);
  transition: background .15s, border-color .15s, color .15s;
}
.chip.on { background: var(--brand-soft); color: var(--primary); border-color: var(--brand); font-weight: 600; }
.chip.color { width: 36px; min-width: 36px; height: 36px; min-height: 36px; padding: 0; background: var(--c); border: 0; border-radius: 12px; position: relative; }
.chip.color.on { box-shadow: 0 0 0 3px var(--surface), 0 0 0 5px var(--c); }
#colorChips { padding: 6px; margin: -6px; }
.times { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }
.times:empty { display: none; }
.time-item { display: flex; align-items: center; background: var(--surface-2); border-radius: 12px; padding-right: 4px; }
.time-item input { border: 0; background: transparent; min-height: 44px; width: 118px; padding: 0 10px; font-size: 16px; font-weight: 600; font-variant-numeric: tabular-nums; }
.time-item input:focus { outline: 0; }
.time-item button { border: 0; background: none; color: var(--muted); width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; }
.time-item button .i { width: 16px; height: 16px; }
.switch-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 18px; padding: 14px; border-radius: var(--radius-sm); background: var(--surface-2); }
.switch-row b { display: block; font-size: 14px; font-weight: 600; }
.switch-row small { color: var(--muted); font-size: 12px; }
.switch { appearance: none; -webkit-appearance: none; width: 50px; height: 30px; border-radius: 99px; background: #cfd5de; position: relative; flex: none; margin: 0; transition: background .2s; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; transition: transform .2s var(--ease); box-shadow: 0 1px 3px rgb(0 0 0 / .2); }
.switch:checked { background: var(--primary); }
.switch:checked::after { transform: translateX(20px); }

.dose-pop, .code-pop, .ask { padding: 26px 22px 22px; }
.dose-pop, .code-pop { text-align: center; }
.pop-ic { width: 72px; height: 72px; border-radius: 24px; margin: 0 auto 14px; display: grid; place-items: center; background: color-mix(in srgb, var(--c, var(--brand)) 13%, white); color: var(--c, var(--brand)); }
.pop-ic .i { width: 36px; height: 36px; }
#dosePill { animation: wiggle 1.4s ease-in-out infinite; }
@keyframes wiggle { 0%, 100% { transform: rotate(0); } 20% { transform: rotate(-9deg); } 40% { transform: rotate(9deg); } 60% { transform: rotate(0); } }
.eyebrow { font-size: 12.5px; font-weight: 600; color: var(--primary); text-transform: uppercase; letter-spacing: .06em; }
.dose-pop h2, .code-pop h2, .ask h2 { font-size: 20px; font-weight: 700; margin: 4px 0 4px; letter-spacing: -.01em; }
.dose-pop .btn.block { margin-top: 20px; }
.dose-pop .btn-row { margin-top: 10px; }
.code-box { margin: 18px 0 4px; padding: 16px; border-radius: 16px; background: var(--brand-softer); border: 1.5px dashed color-mix(in srgb, var(--brand) 45%, transparent); font-size: 19px; font-weight: 700; color: var(--primary); user-select: all; word-break: break-all; }
.pop-ic.shield { background: var(--ok-soft); color: var(--ok); }
.ask .muted { font-size: 14px; }
.ask .field:first-child { margin-top: 16px; }
.ask .btn-row { margin-top: 20px; }
.btn.danger { background: var(--danger); color: #fff; border-color: transparent; box-shadow: 0 6px 16px rgb(217 63 68 / .25); }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(160px + env(safe-area-inset-bottom)); z-index: 100;
  transform: translate(-50%, 16px); opacity: 0; pointer-events: none;
  background: #1e232b; color: #fff; padding: 11px 16px; border-radius: 14px;
  font-size: 13.5px; font-weight: 500; transition: opacity .2s, transform .25s var(--ease);
  max-width: calc(100% - 32px); width: max-content; text-align: center; box-shadow: var(--shadow-lg);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
body[data-view="auth"] .toast { bottom: calc(24px + env(safe-area-inset-bottom)); }

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