/* SPDX-License-Identifier: AGPL-3.0-or-later
   Copyright (C) 2026 M Hansford. See LICENSE. */
/* ============ iOS 26 (Liquid Glass) design tokens ============ */
:root {
  --bg: #F2F2F7;
  --card: #FFFFFF;
  --elevated: #FFFFFF;
  --label: #000000;
  --label-2: rgba(60, 60, 67, 0.6);
  --label-3: rgba(60, 60, 67, 0.3);
  --separator: rgba(60, 60, 67, 0.2);
  --fill: rgba(120, 120, 128, 0.12);
  --fill-2: rgba(120, 120, 128, 0.2);
  --glass: rgba(255, 255, 255, 0.62);
  --glass-strong: rgba(250, 250, 252, 0.8);
  --glass-edge: rgba(255, 255, 255, 0.9);
  --glass-shadow: 0 8px 28px rgba(0, 0, 0, 0.1), 0 1px 3px rgba(0, 0, 0, 0.06);
  --blue: #007AFF;
  --red: #FF3B30;
  --orange: #FF9500;
  --yellow: #FFCC00;
  --yellow-ink: #B38600;
  --green: #34C759;
  --teal: #30B0C7;
  --indigo: #5856D6;
  --purple: #AF52DE;
  --pink: #FF2D55;
  --gray: #8E8E93;
  --r-group: 26px;
  --r-card: 28px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --tabbar-h: 62px;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000;
    --card: #1C1C1E;
    --elevated: #2C2C2E;
    --label: #FFFFFF;
    --label-2: rgba(235, 235, 245, 0.6);
    --label-3: rgba(235, 235, 245, 0.3);
    --separator: rgba(84, 84, 88, 0.6);
    --fill: rgba(118, 118, 128, 0.24);
    --fill-2: rgba(118, 118, 128, 0.36);
    --glass: rgba(40, 40, 44, 0.55);
    --glass-strong: rgba(30, 30, 32, 0.82);
    --glass-edge: rgba(255, 255, 255, 0.14);
    --glass-shadow: 0 8px 28px rgba(0, 0, 0, 0.5);
    --blue: #0A84FF;
    --red: #FF453A;
    --orange: #FF9F0A;
    --yellow: #FFD60A;
    --yellow-ink: #FFD60A;
    --green: #30D158;
    --teal: #40C8E0;
    --indigo: #5E5CE6;
    --purple: #BF5AF2;
    --pink: #FF375F;
    --gray: #98989D;
  }
}

/* ============ Base ============ */
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; background: var(--bg); }
body {
  margin: 0; min-height: 100vh; min-height: 100dvh;
  background: var(--bg); color: var(--label);
  font: 17px/1.3 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", system-ui, sans-serif;
  letter-spacing: -0.43px;
  -webkit-font-smoothing: antialiased;
}
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; letter-spacing: inherit; }
button, .tappable { -webkit-user-select: none; user-select: none; touch-action: manipulation; }
input, textarea, select { font: inherit; color: inherit; letter-spacing: inherit; }
svg.i { width: 22px; height: 22px; flex: none; }
button:focus { outline: none; }
button:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.hidden { display: none !important; }
body.sheet-open { overflow: hidden; }

/* Liquid Glass material */
.glass {
  background: var(--glass);
  -webkit-backdrop-filter: blur(16px) saturate(190%);
  backdrop-filter: blur(16px) saturate(190%);
  box-shadow: inset 0 0.5px 0 var(--glass-edge), inset 0 0 0 0.5px color-mix(in srgb, var(--glass-edge) 50%, transparent), var(--glass-shadow);
}

/* ============ Navigation bar ============ */
.nav { position: sticky; top: 0; z-index: 20; padding-top: var(--safe-top); }
/* scroll-edge effect: soft blur that fades out under the bar */
.nav::before {
  content: ""; position: absolute; inset: 0 0 -24px 0; pointer-events: none;
  background: linear-gradient(to bottom, var(--bg) 0%, color-mix(in srgb, var(--bg) 88%, transparent) 60%, transparent 100%);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  -webkit-mask-image: linear-gradient(to bottom, #000 72%, transparent);
  mask-image: linear-gradient(to bottom, #000 72%, transparent);
  opacity: 0; transition: opacity .2s;
}
.nav.compact::before { opacity: 1; }
.nav-inner { position: relative; height: 54px; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; padding: 0 16px; gap: 8px; }
.nav-title { font-weight: 600; opacity: 0; transition: opacity .15s; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 52vw; }
.nav.compact .nav-title { opacity: 1; }
.nav-left { justify-self: start; display: flex; gap: 8px; }
.nav-right { justify-self: end; display: flex; gap: 8px; }
.gbtn {
  height: 44px; min-width: 44px; border-radius: 22px; padding: 0 16px;
  display: inline-flex; align-items: center; justify-content: center; gap: 4px;
  color: var(--label); font-size: 17px; font-weight: 500;
  transition: transform .2s cubic-bezier(.3, 1.4, .5, 1);
}
.gbtn.icon { padding: 0; width: 44px; }
.gbtn:active { transform: scale(1.12); }
.gbtn svg.i { width: 21px; height: 21px; stroke-width: 2.1; }
.gbtn.back svg.i { stroke-width: 2.5; width: 20px; height: 20px; margin-left: -2px; }
.gbtn.tint { background: var(--blue); color: #fff; box-shadow: inset 0 0.5px 0 rgba(255,255,255,.5), 0 6px 18px color-mix(in srgb, var(--blue) 35%, transparent); }
.gbtn.tint:disabled { background: var(--fill-2); color: var(--label-3); box-shadow: none; }

.large-title { font-size: 34px; font-weight: 700; letter-spacing: 0.4px; margin: 0; padding: 0 20px 12px; line-height: 41px; }

/* ============ Page ============ */
.page { padding-bottom: calc(var(--tabbar-h) + 40px + var(--safe-bottom)); max-width: 680px; margin: 0 auto; }
.page.push { animation: push-in .38s cubic-bezier(.2, .85, .25, 1); }
.page.pop { animation: pop-in .38s cubic-bezier(.2, .85, .25, 1); }
.page.fade { animation: fade-in .25s ease; }
@keyframes push-in { from { transform: translateX(45%); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes pop-in { from { transform: translateX(-25%); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

/* ============ Floating tab bar ============ */
.tabbar {
  position: fixed; z-index: 30; left: 50%; transform: translateX(-50%);
  bottom: max(10px, calc(var(--safe-bottom) - 8px));
  width: min(calc(100% - 48px), 420px); height: var(--tabbar-h); border-radius: 31px;
  display: grid; grid-template-columns: repeat(3, 1fr); padding: 4px;
}
.tab {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  border-radius: 27px; color: var(--label); font-size: 10.5px; font-weight: 600; letter-spacing: 0;
  transition: background .25s, color .25s;
}
.tab svg.i { width: 25px; height: 25px; stroke-width: 1.9; }
.tab.on { color: var(--blue); background: var(--fill); }
.tab:active { transform: scale(0.96); }
body.sheet-open .tabbar { opacity: 0; pointer-events: none; }

/* ============ Grouped lists ============ */
.section { margin: 0 16px 32px; }
.section-header { font-size: 15px; font-weight: 600; color: var(--label-2); padding: 0 20px 8px; letter-spacing: -0.2px; display: flex; justify-content: space-between; align-items: baseline; }
.section-header.big { font-size: 22px; font-weight: 700; color: var(--label); padding: 0 4px 10px; letter-spacing: 0.35px; }
.section-footer { font-size: 13px; color: var(--label-2); padding: 8px 20px 0; letter-spacing: -0.08px; line-height: 1.38; }
.group { background: var(--card); border-radius: var(--r-group); overflow: hidden; }
.row {
  display: flex; align-items: center; gap: 12px;
  min-height: 52px; padding: 11px 20px;
  position: relative; width: 100%; text-align: left; background: var(--card);
}
.row + .row::before {
  content: ""; position: absolute; top: 0; right: 0; left: var(--sep-inset, 20px);
  border-top: 0.5px solid var(--separator);
}
.row.has-icon { --sep-inset: 62px; }
.row.has-avatar { --sep-inset: 76px; }
button.row:active, a.row:active { background: var(--fill-2); }
a.row { color: inherit; text-decoration: none; }
.row-main { flex: 1; min-width: 0; }
.row-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-sub { font-size: 15px; color: var(--label-2); margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; letter-spacing: -0.24px; }
.row-sub.wrap { white-space: normal; }
.row-value { color: var(--label-2); white-space: nowrap; font-variant-numeric: tabular-nums; }
.row .chev { color: var(--label-3); width: 14px; height: 14px; stroke-width: 3; margin-right: -4px; }
.row.action { color: var(--blue); }
.row.destructive { color: var(--red); justify-content: center; }
.row .check { color: var(--blue); width: 20px; height: 20px; stroke-width: 2.6; }
.icon-tile { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; color: #fff; flex: none; }
.icon-tile svg.i { width: 18px; height: 18px; stroke-width: 2.2; }

/* ============ Avatars ============ */
.avatar {
  width: 44px; height: 44px; border-radius: 50%; flex: none; overflow: hidden; position: relative;
  display: grid; place-items: center; color: #fff; font-weight: 600; font-size: 19px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--c) 72%, #fff) 0%, var(--c) 100%);
}
.avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.avatar.emoji { font-size: 24px; }
.avatar.sm { width: 28px; height: 28px; font-size: 13px; }
.avatar.sm.emoji { font-size: 16px; }
.avatar.lg { width: 96px; height: 96px; font-size: 40px; }
.avatar.lg.emoji { font-size: 52px; }
.photo-actions { display: flex; justify-content: center; gap: 8px; margin-top: 10px; }
.pill-btn { height: 34px; padding: 0 14px; border-radius: 17px; background: var(--fill); color: var(--blue); font-size: 15px; font-weight: 600; display: inline-flex; align-items: center; gap: 6px; }
.pill-btn:active { background: var(--fill-2); }
.pill-btn svg.i { width: 16px; height: 16px; }
.pill-btn.danger { color: var(--red); }

/* ============ Home person cards ============ */
.person-card { background: var(--card); border-radius: var(--r-card); margin: 0 16px 14px; overflow: hidden; }
.person-card-top { display: flex; gap: 14px; align-items: center; padding: 16px 18px 12px; width: 100%; text-align: left; }
.person-card-top:active { background: var(--fill); }
.person-name { font-size: 20px; font-weight: 600; letter-spacing: 0.38px; }
.person-meta { font-size: 15px; color: var(--label-2); letter-spacing: -0.24px; }
.temp-big { display: flex; align-items: baseline; gap: 4px; justify-content: flex-end; }
.temp-big .v { font-size: 30px; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: -0.5px; }
.temp-big .u { font-size: 15px; color: var(--label-2); font-weight: 500; }
.temp-when { font-size: 13px; color: var(--label-2); text-align: right; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 18px 12px; }
.chip {
  display: inline-flex; align-items: center; gap: 5px; font-size: 13px; font-weight: 600; padding: 5px 10px; border-radius: 999px;
  background: color-mix(in srgb, var(--c, var(--gray)) 15%, transparent);
  color: color-mix(in srgb, var(--c, var(--gray)) 82%, var(--label)); letter-spacing: -0.08px;
}
.chip svg.i { width: 13px; height: 13px; stroke-width: 2.5; }
.card-actions { display: flex; gap: 8px; padding: 4px 14px 14px; }
.card-actions button {
  flex: 1; height: 44px; border-radius: 22px; background: var(--fill);
  display: flex; align-items: center; justify-content: center; gap: 6px; color: var(--blue); font-weight: 600; font-size: 15px;
  transition: transform .2s cubic-bezier(.3, 1.4, .5, 1);
}
.card-actions button:active { transform: scale(0.97); background: var(--fill-2); }
.card-actions svg.i { width: 18px; height: 18px; }

/* ============ Person detail ============ */
.profile { text-align: center; padding: 0 16px 20px; }
.profile .avatar { margin: 0 auto 10px; }
.profile h1 { margin: 0; font-size: 28px; font-weight: 700; letter-spacing: 0.36px; }
.quick-actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 0 16px 28px; }
.qa {
  background: var(--card); border-radius: 22px; padding: 14px 6px 11px;
  display: flex; flex-direction: column; align-items: center; gap: 7px; font-size: 13px; font-weight: 600;
  transition: transform .2s cubic-bezier(.3, 1.4, .5, 1);
}
.qa:active { transform: scale(0.96); }
.qa .qa-ic { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; background: color-mix(in srgb, var(--c) 16%, transparent); color: var(--c); }
.qa .qa-ic svg.i { width: 23px; height: 23px; stroke-width: 2.2; }

.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 0 16px 14px; }
.stat { background: var(--card); border-radius: 22px; padding: 14px 16px; min-width: 0; }
.stat-label { font-size: 13px; color: var(--label-2); font-weight: 600; display: flex; align-items: center; gap: 5px; }
.stat-label svg.i { width: 14px; height: 14px; }
.stat-value { font-size: 28px; font-weight: 600; font-variant-numeric: tabular-nums; margin-top: 4px; letter-spacing: -0.4px; }
.stat-value small { font-size: 15px; font-weight: 500; color: var(--label-2); }
.stat-sub { font-size: 13px; color: var(--label-2); margin-top: 1px; }

.chart-card { background: var(--card); border-radius: var(--r-card); margin: 0 16px 32px; padding: 14px 14px 10px; }
.chart-card .segmented { margin-bottom: 12px; }
.chart svg { display: block; width: 100%; overflow: visible; }
.chart .grid-line { stroke: var(--separator); stroke-width: 0.5; }
.chart .axis-label { fill: var(--label-2); font-size: 11px; letter-spacing: 0; }
.chart .fever-band { fill: var(--red); opacity: .07; }
.chart .fever-line { stroke: var(--red); stroke-width: 1; stroke-dasharray: 3 3; opacity: .5; }
.chart .line { fill: none; stroke: var(--c, var(--blue)); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.chart .area { fill: var(--c, var(--blue)); opacity: .08; }
.chart .med-mark { stroke: var(--indigo); stroke-width: 1; stroke-dasharray: 2 3; opacity: .55; }
.chart .med-dot { fill: var(--indigo); }
.chart-empty { color: var(--label-2); text-align: center; padding: 50px 0; font-size: 15px; }
.chart-legend { display: flex; gap: 14px; justify-content: center; font-size: 12px; color: var(--label-2); padding: 8px 0 2px; }
.chart-legend i { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 4px; }

/* Quick dose */
.dose-row { display: flex; align-items: center; gap: 12px; padding: 12px 14px 12px 20px; position: relative; background: var(--card); }
.dose-row + .dose-row::before { content: ""; position: absolute; top: 0; right: 0; left: 62px; border-top: 0.5px solid var(--separator); }
.dose-amt { font-size: 22px; font-weight: 700; letter-spacing: -0.3px; font-variant-numeric: tabular-nums; }
.give-btn {
  height: 36px; padding: 0 16px; border-radius: 18px; background: var(--blue); color: #fff; font-size: 15px; font-weight: 600; flex: none;
  transition: transform .2s cubic-bezier(.3, 1.4, .5, 1);
}
.give-btn:active { transform: scale(1.08); }
.give-btn.wait { background: var(--fill); color: var(--orange); }
.guide-card { margin: 0 16px 24px; padding: 14px 18px; border-radius: 22px; background: color-mix(in srgb, var(--blue) 10%, var(--card)); font-size: 15px; line-height: 1.4; }
.guide-card.warn { background: color-mix(in srgb, var(--orange) 14%, var(--card)); }
.guide-card b { font-weight: 600; }
.guide-card .big { font-size: 28px; font-weight: 700; letter-spacing: -0.4px; display: block; margin: 2px 0; }
.guide-card .small { font-size: 13px; color: var(--label-2); margin-top: 6px; }

/* ============ Segmented control (capsule) ============ */
.segmented { display: flex; background: var(--fill); border-radius: 999px; padding: 3px; }
.segmented button { flex: 1; font-size: 14px; font-weight: 500; padding: 7px 4px; border-radius: 999px; letter-spacing: -0.1px; transition: background .2s; }
.segmented button.on { background: var(--card); box-shadow: 0 2px 8px rgba(0,0,0,.12); font-weight: 600; }
@media (prefers-color-scheme: dark) { .segmented button.on { background: #5A5A5E; } }

/* ============ Switch (iOS 26: wider track) ============ */
.switch { position: relative; width: 64px; height: 28px; flex: none; }
.switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; z-index: 1; }
.switch span { position: absolute; inset: 0; border-radius: 14px; background: var(--fill-2); transition: background .25s; }
.switch span::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 38px; height: 24px; border-radius: 12px; background: #fff;
  box-shadow: 0 2px 6px rgba(0,0,0,.18); transition: transform .3s cubic-bezier(.3, 1.3, .5, 1);
}
.switch input:checked + span { background: var(--green); }
.switch input:checked + span::after { transform: translateX(22px); }

.lvl { display: inline-block; font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 999px; color: var(--fg, #fff); background: var(--c); letter-spacing: 0; vertical-align: 2px; }

/* ============ Buttons ============ */
.btn-primary { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; height: 52px; border-radius: 26px; background: var(--blue); color: #fff; font-weight: 600; }
.btn-primary:active { opacity: .85; }
.btn-plain { color: var(--blue); padding: 12px; font-size: 15px; font-weight: 500; }

.empty { text-align: center; padding: 50px 32px; color: var(--label-2); }
.empty .big-ic { width: 76px; height: 76px; border-radius: 22px; margin: 0 auto 16px; display: grid; place-items: center; background: var(--fill); color: var(--label-2); }
.empty .big-ic svg.i { width: 38px; height: 38px; }
.empty h2 { color: var(--label); font-size: 22px; margin: 0 0 6px; }
.empty p { margin: 0 0 24px; font-size: 15px; }

/* ============ Sheets (floating, inset) ============ */
.backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.28); opacity: 0; transition: opacity .35s; z-index: 100; }
.backdrop.show { opacity: 1; }
.sheet {
  position: fixed; z-index: 101; left: 8px; right: 8px; bottom: max(8px, var(--safe-bottom));
  max-width: 664px; margin: 0 auto; max-height: calc(100% - var(--safe-top) - 16px - max(8px, var(--safe-bottom)));
  background: var(--bg); border-radius: 36px;
  display: flex; flex-direction: column;
  transform: translateY(calc(100% + 40px)); transition: transform .45s cubic-bezier(.2, .95, .25, 1);
  box-shadow: 0 10px 50px rgba(0,0,0,.22);
}
.sheet.full { height: calc(100% - var(--safe-top) - 16px - max(8px, var(--safe-bottom))); }
@media (prefers-color-scheme: dark) { .sheet { background: #1C1C1E; } .sheet .group, .sheet .row, .sheet .dose-row, .sheet .guide-card:not(.warn) { background: #2C2C2E; } }
.sheet.show { transform: translateY(0); }
.sheet.dragging { transition: none; }
.sheet-bar { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; padding: 14px 14px 6px; flex: none; touch-action: none; }
.sheet-bar .gbtn { background: var(--fill); box-shadow: none; }
.sheet-bar .gbtn.tint { background: var(--blue); }
.sheet-bar .gbtn.tint:disabled { background: var(--fill); color: var(--label-3); }
.sheet-bar .done { justify-self: end; }
.sheet-title { font-weight: 600; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 50vw; }
.sheet-body { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 12px 0 18px; overscroll-behavior: contain; }
.sheet .section { margin-bottom: 22px; }

/* ============ Form controls ============ */
.field { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; padding: 0; font-size: 17px; }
.field.right { text-align: right; }
.field::placeholder { color: var(--label-3); }
textarea.field { resize: none; min-height: 72px; line-height: 1.35; padding: 2px 0; }
select.field { -webkit-appearance: none; appearance: none; text-align: right; text-align-last: right; color: var(--label-2); }
input[type="datetime-local"].field, input[type="date"].field {
  -webkit-appearance: none; appearance: none; flex: none; min-width: 0;
  background: var(--fill); border-radius: 999px; padding: 6px 12px; font-size: 17px; text-align: center; color: var(--label);
}
input[type="datetime-local"]::-webkit-date-and-time-value, input[type="date"]::-webkit-date-and-time-value { text-align: center; }
.stepper { display: inline-flex; background: var(--fill); border-radius: 999px; overflow: hidden; flex: none; }
.stepper button { width: 48px; height: 34px; display: grid; place-items: center; font-size: 22px; }
.stepper button:active { background: var(--fill-2); }
.stepper button + button { border-left: 0.5px solid var(--separator); }
.stepper-val { min-width: 34px; text-align: right; font-variant-numeric: tabular-nums; color: var(--label-2); }
.swatches { display: flex; flex-wrap: wrap; gap: 12px; padding: 16px 20px; justify-content: space-between; }
.swatch { width: 34px; height: 34px; border-radius: 50%; background: var(--c); position: relative; }
.swatch.on::after { content: ""; position: absolute; inset: -5px; border-radius: 50%; border: 2.5px solid var(--c); }

/* Temperature entry */
.temp-dial { display: flex; align-items: center; justify-content: space-between; padding: 18px 18px 6px; gap: 10px; }
.round-btn { width: 60px; height: 60px; border-radius: 50%; flex: none; display: grid; place-items: center; background: var(--fill); color: var(--blue); transition: transform .2s cubic-bezier(.3, 1.4, .5, 1); }
.round-btn:active { transform: scale(1.12); background: var(--fill-2); }
.round-btn svg.i { width: 26px; height: 26px; stroke-width: 2.6; }
.temp-readout { text-align: center; flex: 1; min-width: 0; }
.temp-readout .num-wrap { display: inline-flex; align-items: baseline; justify-content: center; }
.temp-input {
  width: 3.4ch; border: 0; outline: 0; background: transparent; text-align: center; padding: 0;
  font-size: 62px; font-weight: 700; letter-spacing: -1.5px; font-variant-numeric: tabular-nums; color: var(--c, var(--label));
  caret-color: var(--blue); transition: color .2s;
}
.temp-readout .unit { font-size: 26px; font-weight: 500; color: var(--label-2); margin-left: 2px; }
.slider-wrap { padding: 10px 22px 18px; }
input[type="range"].slider { -webkit-appearance: none; appearance: none; width: 100%; height: 30px; background: transparent; margin: 0; }
input[type="range"].slider::-webkit-slider-runnable-track {
  height: 6px; border-radius: 3px;
  background: linear-gradient(90deg, var(--teal) 0%, var(--green) 14%, var(--green) 30%, var(--yellow) 38%, var(--orange) 46%, var(--orange) 55%, var(--red) 62%);
}
input[type="range"].slider::-moz-range-track { height: 6px; border-radius: 3px; background: linear-gradient(90deg, var(--teal), var(--green), var(--yellow), var(--orange), var(--red)); }
input[type="range"].slider::-webkit-slider-thumb {
  -webkit-appearance: none; width: 38px; height: 24px; border-radius: 12px; background: #fff; margin-top: -9px;
  box-shadow: 0 0.5px 4px rgba(0,0,0,.12), 0 6px 13px rgba(0,0,0,.14);
}
input[type="range"].slider::-moz-range-thumb { width: 38px; height: 24px; border-radius: 12px; background: #fff; border: 0; box-shadow: 0 2px 8px rgba(0,0,0,.2); }
.slider-scale { display: flex; justify-content: space-between; font-size: 11px; color: var(--label-2); padding: 2px 4px 0; font-variant-numeric: tabular-nums; }
.status-ok { color: var(--green); }
.status-wait { color: var(--orange); }

/* ============ Alert (iOS 26) ============ */
.alert-backdrop { position: fixed; inset: 0; z-index: 200; background: rgba(0,0,0,.3); display: grid; place-items: center; opacity: 0; transition: opacity .2s; padding: 24px; }
.alert-backdrop.show { opacity: 1; }
.alert {
  width: min(300px, 100%); border-radius: 34px; padding: 22px 16px 16px; background: var(--glass-strong);
  -webkit-backdrop-filter: blur(30px) saturate(180%); backdrop-filter: blur(30px) saturate(180%);
  box-shadow: 0 20px 60px rgba(0,0,0,.25), inset 0 0.5px 0 var(--glass-edge);
  transform: scale(1.1); transition: transform .3s cubic-bezier(.2, 1.2, .3, 1);
}
.alert-backdrop.show .alert { transform: scale(1); }
.alert-body { padding: 0 8px 18px; }
.alert-title { font-weight: 600; font-size: 17px; }
.alert-msg { font-size: 15px; margin-top: 6px; line-height: 1.38; letter-spacing: -0.2px; color: var(--label); opacity: .85; }
.alert-btns { display: flex; gap: 8px; }
.alert-btns.stack { flex-direction: column; }
.alert-btns button { flex: 1; height: 48px; border-radius: 24px; background: var(--fill); font-size: 17px; font-weight: 600; }
.alert-btns button.primary { background: var(--blue); color: #fff; }
.alert-btns button.destructive { color: var(--red); }
.alert-btns button:active { opacity: .7; }

/* ============ Toast ============ */
.toast {
  position: fixed; left: 50%; top: calc(var(--safe-top) + 10px); z-index: 300;
  transform: translate(-50%, -20px) scale(.9); opacity: 0; transition: all .35s cubic-bezier(.2, 1.1, .3, 1);
  color: var(--label); padding: 12px 20px; border-radius: 999px; font-size: 15px; font-weight: 600; display: flex; align-items: center; gap: 8px; white-space: nowrap; max-width: calc(100% - 32px);
}
.toast.show { transform: translate(-50%, 0) scale(1); opacity: 1; }
.toast svg.i { width: 18px; height: 18px; color: var(--green); stroke-width: 2.8; }
.toast.error svg.i { color: var(--red); }

/* ============ Passcode ============ */
.passcode { display: flex; flex-direction: column; align-items: center; padding: 8px 0 12px; }
.passcode h2 { font-size: 20px; font-weight: 600; margin: 4px 0 18px; }
.pin-dots { display: flex; gap: 18px; margin-bottom: 26px; }
.pin-dots i { width: 13px; height: 13px; border-radius: 50%; border: 1.5px solid var(--label); }
.pin-dots i.on { background: var(--label); }
.pin-dots.shake { animation: shake .4s; }
@keyframes shake { 20%, 60% { transform: translateX(-10px); } 40%, 80% { transform: translateX(10px); } }
.keypad { display: grid; grid-template-columns: repeat(3, 76px); gap: 16px 24px; }
.keypad button { width: 76px; height: 76px; border-radius: 50%; background: var(--fill); font-size: 32px; font-weight: 400; letter-spacing: 0; }
.keypad button:active { background: var(--fill-2); }
.keypad button.blank { background: none; }
.keypad button.txt { background: none; font-size: 17px; }

.disclaimer { font-size: 12px; color: var(--label-2); text-align: center; padding: 0 32px; line-height: 1.4; }
.inline-note { font-size: 13px; color: var(--label-2); padding: 0 20px 12px; line-height: 1.35; }

/* ============ Sign in ============ */
body.signed-out .tabbar { display: none; }
.auth-page { max-width: 460px; padding-top: calc(var(--safe-top) + 56px); }
.auth-icon { width: 88px; height: 88px; border-radius: 22px; margin: 0 auto 18px; display: grid; place-items: center; color: #fff;
  background: linear-gradient(180deg, #FF6B81, #FF2D55); box-shadow: 0 10px 30px rgba(255, 45, 85, .3); }
.auth-icon svg.i { width: 46px; height: 46px; stroke-width: 2; }
.auth-title { text-align: center; font-size: 32px; font-weight: 700; margin: 0 0 6px; letter-spacing: .3px; }
.auth-sub { text-align: center; color: var(--label-2); margin: 0 32px 26px; font-size: 15px; line-height: 1.4; }
.auth-actions { margin: 0 16px; display: flex; flex-direction: column; gap: 10px; }
.btn-secondary { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; height: 52px; border-radius: 26px; background: var(--fill); color: var(--blue); font-weight: 600; }
.btn-secondary svg.i { width: 20px; height: 20px; }
.btn-secondary:active { background: var(--fill-2); }
.btn-primary:disabled { opacity: .5; }
.auth-error { color: var(--red); font-size: 15px; margin: -12px 32px 16px; text-align: center; }
button.row:disabled { opacity: 1; cursor: default; }
.offer { text-align: center; padding: 8px 24px 12px; }
.offer-icon { width: 72px; height: 72px; margin: 4px auto 14px; border-radius: 20px; display: grid; place-items: center; background: color-mix(in srgb, var(--teal) 16%, transparent); color: var(--teal); }
.offer-icon svg.i { width: 36px; height: 36px; }
.offer h2 { margin: 0 0 8px; font-size: 22px; }
.offer p { color: var(--label-2); margin: 0 0 22px; font-size: 15px; line-height: 1.4; }
.offer .btn-plain { margin-top: 6px; width: 100%; }
