*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ── Design tokens ────────────────────────────────────────────────────────── */
:root {
  /* OLED-friendly dark palette (iOS 26 inspired) */
  --bg:            #000000;
  --surface:       #14141f;
  --surface-2:     #1c1c2c;
  --surface-glass: rgba(20, 20, 31, 0.72);
  --border:        rgba(255, 255, 255, 0.09);
  --border-strong: rgba(255, 255, 255, 0.16);
  --text:          #f5f5f7;
  --text-muted:    #9b9bb8;
  --text-faint:    #6e6e88;

  /* iOS system semantic colors */
  --safe:        #30d158;
  --warn:        #ff9f0a;
  --danger:      #ff453a;
  --safe-bg:     rgba(48, 209, 88, 0.14);
  --warn-bg:     rgba(255, 159, 10, 0.14);
  --danger-bg:   rgba(255, 69, 58, 0.14);

  /* Continuous-corner radii (squircle-ish) */
  --radius-xl:   28px;
  --radius:      22px;
  --radius-md:   18px;
  --radius-sm:   14px;
  --radius-xs:   10px;

  /* Default accent (overridden by [data-person]) */
  --accent:      #7c6af7;
  --accent-glow: rgba(124, 106, 247, 0.28);
  --accent-sub:  rgba(124, 106, 247, 0.14);
  --accent-text: #ffffff;
  --bg-tint:     transparent;

  /* Per-person aurora background (overridden by [data-person]) */
  --aurora-1: transparent;
  --aurora-2: transparent;
  --aurora-3: transparent;

  /* Dynamic Type scale (1.0 normal; iOS users can scale via prefers larger text) */
  --scale: 1;

  /* Glass / shadow */
  --glass-blur:    saturate(180%) blur(40px);
  --shadow-floating: 0 12px 40px rgba(0, 0, 0, 0.55), 0 1px 0 rgba(255,255,255,0.04) inset;
  --shadow-card:     0 1px 0 rgba(255,255,255,0.04) inset, 0 4px 24px rgba(0,0,0,0.35);

  /* Safe areas */
  --sat: env(safe-area-inset-top,    0px);
  --sab: env(safe-area-inset-bottom, 0px);
  --sal: env(safe-area-inset-left,   0px);
  --sar: env(safe-area-inset-right,  0px);

  /* Bottom tab bar height (incl. safe area + margin) */
  --tabbar-h:    72px;
}

/* ── Per-person themes ────────────────────────────────────────────────────── */
/* Each person gets a saturated accent + an aurora background that's a clear
   colour signature when their tab is active. Aurora alphas tuned to read
   on true-black without competing with content. */
body[data-person="Zoey"] {
  --accent:#ff5fa2; --accent-glow:rgba(255,95,162,0.30); --accent-sub:rgba(255,95,162,0.16);
  --accent-text:#1c0010;
  --aurora-1: rgba(255, 95, 162, 0.28);
  --aurora-2: rgba(255, 150, 200, 0.18);
  --aurora-3: rgba(190, 70, 130, 0.20);
}
body[data-person="Hudson"] {
  --accent:#5ba3ff; --accent-glow:rgba(91,163,255,0.30); --accent-sub:rgba(91,163,255,0.16);
  --accent-text:#001830;
  --aurora-1: rgba(91, 163, 255, 0.28);
  --aurora-2: rgba(120, 220, 255, 0.18);
  --aurora-3: rgba(60, 110, 220, 0.20);
}
body[data-person="Kari"] {
  --accent:#b496ff; --accent-glow:rgba(180,150,255,0.30); --accent-sub:rgba(180,150,255,0.16);
  --accent-text:#0e0028;
  --aurora-1: rgba(180, 150, 255, 0.28);
  --aurora-2: rgba(220, 180, 255, 0.16);
  --aurora-3: rgba(140, 100, 220, 0.22);
}
body[data-person="Kolby"] {
  --accent:#ff9f3a; --accent-glow:rgba(255,159,58,0.30); --accent-sub:rgba(255,159,58,0.16);
  --accent-text:#1e0a00;
  --aurora-1: rgba(255, 159, 58, 0.26);
  --aurora-2: rgba(255, 200, 100, 0.16);
  --aurora-3: rgba(220, 90, 40, 0.22);
}

/* ── Light mode ───────────────────────────────────────────────────────────── */
@media (prefers-color-scheme: light) {
  :root {
    --bg:            #f2f2f7;
    --surface:       #ffffff;
    --surface-2:     #ffffff;
    --surface-glass: rgba(255, 255, 255, 0.72);
    --border:        rgba(0, 0, 0, 0.08);
    --border-strong: rgba(0, 0, 0, 0.16);
    --text:          #0a0a14;
    --text-muted:    #5e5e7a;
    --text-faint:    #8a8aa0;
    --safe-bg:       rgba(48, 167, 73, 0.14);
    --warn-bg:       rgba(220, 130, 0, 0.14);
    --danger-bg:     rgba(220, 50, 40, 0.14);
    --shadow-floating: 0 12px 40px rgba(0,0,0,0.12), 0 1px 0 rgba(255,255,255,0.6) inset;
    --shadow-card:     0 1px 0 rgba(255,255,255,0.6) inset, 0 2px 12px rgba(0,0,0,0.06);
  }
  /* Aurora alphas softened for light mode so surfaces stay readable */
  body[data-person="Zoey"] {
    --aurora-1: rgba(255, 95, 162, 0.18);
    --aurora-2: rgba(255, 150, 200, 0.12);
    --aurora-3: rgba(190, 70, 130, 0.10);
  }
  body[data-person="Hudson"] {
    --aurora-1: rgba(91, 163, 255, 0.18);
    --aurora-2: rgba(120, 220, 255, 0.12);
    --aurora-3: rgba(60, 110, 220, 0.10);
  }
  body[data-person="Kari"] {
    --aurora-1: rgba(180, 150, 255, 0.18);
    --aurora-2: rgba(220, 180, 255, 0.10);
    --aurora-3: rgba(140, 100, 220, 0.12);
  }
  body[data-person="Kolby"] {
    --aurora-1: rgba(255, 159, 58, 0.16);
    --aurora-2: rgba(255, 200, 100, 0.10);
    --aurora-3: rgba(220, 90, 40, 0.12);
  }
}

/* ── Higher contrast (iOS Increase Contrast) ─────────────────────────────── */
@media (prefers-contrast: more) {
  :root {
    --border:        rgba(255, 255, 255, 0.28);
    --border-strong: rgba(255, 255, 255, 0.42);
    --text-muted:    #c5c5dc;
    --text-faint:    #a0a0b8;
    /* Soften the aurora — it competes with content under high contrast */
    --aurora-1: transparent;
    --aurora-2: transparent;
    --aurora-3: transparent;
  }
  @media (prefers-color-scheme: light) {
    :root {
      --border:        rgba(0, 0, 0, 0.28);
      --border-strong: rgba(0, 0, 0, 0.42);
      --text-muted:    #2a2a40;
      --text-faint:    #4a4a60;
    }
  }
}

/* ── Backdrop-filter fallback (older Android Chrome, pre-iOS 15) ─────────── */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  :root { --surface-glass: var(--surface); }
  .header, .person-tabs, .modal-card, .confirm-card, .toast { background: var(--surface); }
}

/* ── Reduced motion ───────────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  .status-card.state-overdue { animation: none; box-shadow: 0 0 0 1px var(--danger); }
}

html { height: 100%; }

html { font-size: calc(16px * var(--scale)); }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100%;
  /* room for floating tab bar + home indicator */
  padding-bottom: calc(var(--tabbar-h) + 16px + var(--sab));
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}

/* Per-person aurora background — three overlapping radial gradients give each
   person a distinctive colour ambience without competing with content. */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(70vw 60vh at 12% -5%,  var(--aurora-1), transparent 60%),
    radial-gradient(60vw 55vh at 95% 35%,  var(--aurora-2), transparent 65%),
    radial-gradient(80vw 70vh at 50% 110%, var(--aurora-3), transparent 65%),
    var(--bg-tint);
  pointer-events: none;
  z-index: 0;
  transition: background 0.5s ease;
  /* Anchor gradients to viewport even when content scrolls */
  background-attachment: fixed;
}

@keyframes auroraDrift {
  0%, 100% { transform: translate3d(0, 0, 0) scale(1); }
  50%       { transform: translate3d(0, -2%, 0) scale(1.03); }
}
@media (prefers-reduced-motion: no-preference) {
  body::before { animation: auroraDrift 24s ease-in-out infinite; }
}

.header, .person-tabs, .main, .modal, #toast, .confirm-sheet { position: relative; z-index: 1; }

/* ── Header (Liquid Glass) ────────────────────────────────────────────────── */
.header {
  background: var(--surface-glass);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-bottom: 0.5px solid var(--border);
  padding-top: var(--sat);
  padding-left: calc(16px + var(--sal));
  padding-right: calc(12px + var(--sar));
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 8px;
  height: calc(54px + var(--sat));
  padding-bottom: 10px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.app-title {
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.4px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Generic icon button used in header */
.icon-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s, background 0.15s, transform 0.1s;
  -webkit-tap-highlight-color: transparent;
}
.icon-btn:active { background: var(--accent-sub); color: var(--accent); transform: scale(0.92); }
.icon-btn svg { width: 22px; height: 22px; }
.icon-btn.notif-on { color: var(--accent); }
.icon-btn:disabled { opacity: 0.3; }

.notif-test-btn {
  background: none;
  border: 1px solid var(--border-strong);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  cursor: pointer;
  padding: 6px 10px;
  border-radius: 100px;
  min-height: 32px;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.notif-test-btn:active { color: var(--text); border-color: var(--accent); background: var(--accent-sub); }
.notif-test-btn:disabled { opacity: 0.3; }

/* ── Bottom Tab Bar (Liquid Glass floating capsule) ───────────────────────── */
.person-tabs {
  position: fixed;
  left: 50%;
  bottom: calc(10px + var(--sab));
  transform: translateX(-50%);
  z-index: 90;
  display: flex;
  gap: 4px;
  padding: 5px;
  background: var(--surface-glass);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 0.5px solid var(--border-strong);
  border-radius: 100px;
  box-shadow: var(--shadow-floating);
  max-width: calc(100vw - 24px);
  overflow-x: auto;
  scrollbar-width: none;
}
.person-tabs::-webkit-scrollbar { display: none; }

.person-tab {
  flex: 0 0 auto;
  min-width: 60px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  padding: 6px 10px 7px;
  min-height: 56px;
  border-radius: 100px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  transition: color 0.2s, background 0.2s, transform 0.1s;
  -webkit-tap-highlight-color: transparent;
}
.person-tab:active { transform: scale(0.94); }
.person-tab-emoji { font-size: 22px; line-height: 1; }
.person-tab.active {
  color: var(--accent-text);
  background: var(--accent);
  box-shadow: 0 4px 18px var(--accent-glow);
}

/* ── Main ─────────────────────────────────────────────────────────────────── */
.main {
  padding: 14px;
  padding-left: calc(14px + var(--sal));
  padding-right: calc(14px + var(--sar));
  max-width: 600px;
  margin: 0 auto;
}
.section { margin-bottom: 22px; }
.section-title-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.section-title-row .section-title { margin-bottom: 0; }
.section-title {
  font-size: 12px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.8px; color: var(--text-muted); margin-bottom: 10px;
}
.weight-badge {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 100px; padding: 4px 12px;
  font-size: 12px; font-weight: 600; color: var(--text-muted);
  cursor: pointer; min-height: 28px;
  -webkit-tap-highlight-color: transparent;
}
.weight-badge:active { opacity: 0.7; }
.weight-badge-stale { border-color: var(--warn); color: var(--warn); }

/* ── Status Grid ──────────────────────────────────────────────────────────── */
.status-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (min-width: 500px) { .status-grid { grid-template-columns: repeat(3, 1fr); } }

@keyframes overdueGlow {
  0%, 100% { box-shadow: 0 0 0 1px var(--danger), 0 4px 16px rgba(255,69,58,0.12); }
  50%       { box-shadow: 0 0 0 1px var(--danger), 0 4px 32px rgba(255,69,58,0.45); }
}

.status-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 14px 12px;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-card);
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.1s;
}
.status-card.state-ok      { border-color: var(--safe);   box-shadow: 0 0 0 1px var(--safe), 0 4px 18px rgba(48,209,88,0.12); }
.status-card.state-overdue { border-color: var(--danger); animation: overdueGlow 2s ease-in-out infinite; }
.status-card.state-warn    { border-color: var(--warn); }


.card-stripe { position: absolute; top: 0; left: 0; right: 0; height: 3px; }

.card-edit-btn {
  position: absolute; top: 6px; right: 6px;
  background: none; border: none; color: var(--text-muted);
  cursor: pointer; padding: 6px;
  width: 34px; height: 34px;
  display: flex; align-items: center; justify-content: center;
  opacity: 0.55; border-radius: 10px;
  -webkit-tap-highlight-color: transparent; transition: opacity 0.15s, background 0.15s, color 0.15s;
}
.card-edit-btn:active { opacity: 1; color: var(--accent); background: var(--accent-sub); }
.card-edit-btn svg { width: 16px; height: 16px; }

.card-name {
  font-size: 16px; font-weight: 700;
  margin: 6px 0 4px; line-height: 1.25;
  letter-spacing: -0.2px;
}
.card-interval {
  font-size: 11px; color: var(--text-muted);
  margin-bottom: 7px; font-weight: 500;
}

.status-badge {
  display: inline-block; font-size: 11px; font-weight: 700;
  padding: 3px 9px; border-radius: 100px; margin-bottom: 7px;
  text-transform: uppercase; letter-spacing: 0.3px;
}
.badge-ok      { background: var(--safe-bg);    color: var(--safe); }
.badge-wait    { background: var(--warn-bg);    color: var(--warn); }
.badge-overdue { background: var(--danger-bg);  color: var(--danger); }
.badge-first   { background: var(--accent-sub); color: var(--accent); }

.card-time { font-size: 12px; color: var(--text-muted); line-height: 1.7; }
.card-time strong       { color: var(--text); font-weight: 600; }
.card-time .by          { font-size: 11px; color: var(--text-faint); }
.card-time .overdue-txt { color: var(--danger); font-weight: 600; }
.never-given { color: var(--text-muted); font-size: 12px; }
.dose-timestamp { font-size: 11px; color: var(--text-muted); opacity: 0.8; margin-top: 1px; }
.daily-taken { font-size: 12px; font-weight: 700; margin-top: 6px; }
.daily-taken.yes { color: var(--safe); }
.daily-taken.no  { color: var(--danger); }

.drag-handle {
  display: flex; justify-content: center; padding: 10px 0 2px;
  cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.drag-handle:active { cursor: grabbing; }
.drag-dots {
  display: block; width: 22px; height: 14px;
  background-image:
    linear-gradient(currentColor 0 0),
    linear-gradient(currentColor 0 0),
    linear-gradient(currentColor 0 0);
  background-size: 22px 2px;
  background-repeat: no-repeat;
  background-position: 0 2px, 0 6px, 0 10px;
  color: var(--text-muted);
  opacity: 0.4; transition: opacity 0.15s;
}
.drag-handle:hover .drag-dots,
.drag-handle:active .drag-dots { opacity: 0.85; }
.card-ghost { opacity: 0.2; transition: opacity 0.12s; }

.card-countdown {
  font-size: 24px; font-weight: 800; color: var(--warn);
  font-variant-numeric: tabular-nums; letter-spacing: -0.6px;
  margin: 2px 0 4px; line-height: 1.1;
  font-feature-settings: "ss01", "tnum";
}

.wait-progress {
  height: 4px; background: var(--warn-bg); border-radius: 100px;
  margin-top: 10px; overflow: hidden;
}
.wait-progress-bar {
  height: 100%; background: var(--warn); border-radius: 100px;
  transition: width 0.8s linear;
}

/* Tap targets ≥ 44px */
.card-give-btn, .card-overdue-btn {
  width: 100%; margin-top: 10px;
  padding: 12px 8px;
  border: none; border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 700; cursor: pointer;
  min-height: 44px; letter-spacing: -0.1px;
  transition: opacity 0.15s, transform 0.1s, box-shadow 0.15s;
}
.card-give-btn:active, .card-overdue-btn:active { opacity: 0.85; transform: scale(0.97); }
.card-give-btn    { background: var(--safe);   color: #00140a; box-shadow: 0 4px 16px rgba(48,209,88,0.25); }
.card-overdue-btn { background: var(--danger); color: white;   box-shadow: 0 4px 16px rgba(255,69,58,0.3); }

.form-group { margin-bottom: 14px; }
.form-label {
  display: block; font-size: 12px; font-weight: 700;
  color: var(--text-muted); text-transform: uppercase;
  letter-spacing: 0.5px; margin-bottom: 8px;
}
.medicine-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.add-medicine-hint { font-size: 12px; color: var(--text-muted); }
.hint-link {
  background: none; border: none; color: var(--accent);
  font-size: 13px; font-weight: 600; cursor: pointer;
  padding: 0;
  min-height: 44px; display: inline-flex; align-items: center; gap: 4px;
  -webkit-tap-highlight-color: transparent;
}
.hint-link:active { opacity: 0.7; }

.med-chip {
  border: none; border-radius: 100px; padding: 10px 16px;
  font-size: 14px; font-weight: 600; cursor: pointer;
  color: white; opacity: 0.92;
  min-height: 44px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.25);
  transition: opacity 0.15s, transform 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.med-chip:active { transform: scale(0.94); opacity: 1; }

.dose-input {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text);
  /* 16px prevents iOS auto-zoom */
  font-size: 16px; padding: 13px 14px; width: 100%;
  outline: none; transition: border-color 0.2s, background 0.2s;
  min-height: 48px;
  -webkit-appearance: none;
}
.dose-input:focus { border-color: var(--accent); background: var(--surface); }
.dose-input::placeholder { color: var(--text-faint); }

.dose-presets { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.dose-preset {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 100px; color: var(--text-muted);
  font-size: 13px; padding: 8px 14px; font-weight: 600;
  min-height: 44px; display: flex; align-items: center;
  cursor: pointer; transition: all 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.dose-preset.active, .dose-preset:active {
  border-color: var(--accent); color: var(--accent); background: var(--accent-sub);
}


.overdue-toggle-label {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-size: 14px;
  color: var(--text-muted);
  padding: 4px 0;
}
.overdue-toggle-label:has(.overdue-check:checked) { color: var(--text); }
.overdue-check {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: var(--accent);
}

.log-btn {
  width: 100%; padding: 16px; border: none; border-radius: var(--radius);
  background: var(--accent); color: var(--accent-text);
  font-size: 17px; font-weight: 700; cursor: pointer;
  margin-top: 4px; min-height: 52px;
  letter-spacing: -0.2px;
  box-shadow: 0 6px 22px var(--accent-glow);
  transition: all 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.log-btn:active { transform: scale(0.98); opacity: 0.92; }
.log-btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }
.med-edit-delete-btn {
  display: block; width: 100%; margin-top: 8px; padding: 12px;
  background: none; border: none; cursor: pointer;
  color: var(--danger); font-size: 14px; font-weight: 600; text-align: center;
  -webkit-tap-highlight-color: transparent;
}
.med-edit-delete-btn:active { opacity: 0.7; }

/* ── History ──────────────────────────────────────────────────────────────── */
.history-list { display: flex; flex-direction: column; gap: 8px; }
.history-item {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 12px 14px;
  display: flex; align-items: center; gap: 12px;
  box-shadow: var(--shadow-card);
}
.history-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.history-info { flex: 1; min-width: 0; }
.history-name { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.history-meta { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.history-edit-btn {
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm);
  color: var(--text-muted); font-size: 13px; font-weight: 600;
  min-width: 52px; min-height: 44px;
  padding: 0 12px; cursor: pointer; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.15s; -webkit-tap-highlight-color: transparent;
}
.history-edit-btn:active { border-color: var(--accent); color: var(--accent); background: var(--accent-sub); }

.hist-edit { flex: 1; min-width: 0; }
.hist-edit-name { font-size: 13px; font-weight: 700; margin-bottom: 8px; }
.hist-edit-row { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.hist-dose-input { flex: 1; min-width: 80px; font-size: 15px !important; min-height: 44px; }
.hist-save-btn, .hist-remove-btn, .hist-cancel-btn {
  border: none; border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 700; cursor: pointer;
  padding: 0 14px; min-height: 44px; min-width: 44px;
  -webkit-tap-highlight-color: transparent; transition: opacity 0.15s;
}
.hist-save-btn:active, .hist-remove-btn:active, .hist-cancel-btn:active { opacity: 0.8; }
.hist-save-btn   { background: var(--accent);  color: var(--accent-text); }
.hist-remove-btn { background: var(--danger);  color: white; }
.hist-cancel-btn { background: var(--surface-2); border: 1px solid var(--border); color: var(--text-muted); }

.empty-state, .loading-state {
  text-align: center; color: var(--text-muted); font-size: 14px; padding: 28px 16px;
}

/* ── Modal / Bottom Sheet ─────────────────────────────────────────────────── */
@keyframes slideUp {
  from { transform: translateY(60px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.modal {
  position: fixed; inset: 0; background: rgba(0,0,0,0.55);
  display: flex; align-items: flex-end; z-index: 200;
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  animation: fadeIn 0.18s ease-out;
}
.modal-card {
  background: var(--surface-glass);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  border: 0.5px solid var(--border-strong); border-bottom: none;
  width: 100%; max-height: 90vh; overflow-y: auto;
  padding: 8px 16px 20px;
  padding-bottom: calc(32px + var(--sab));
  padding-left: calc(16px + var(--sal));
  padding-right: calc(16px + var(--sar));
  animation: slideUp 0.28s cubic-bezier(0.32, 0.72, 0, 1);
  box-shadow: 0 -10px 40px rgba(0,0,0,0.4);
}
/* Sheet handle (iOS pattern) */
.modal-card::before {
  content: '';
  display: block;
  width: 36px; height: 5px;
  border-radius: 100px;
  background: var(--border-strong);
  margin: 6px auto 12px;
  opacity: 0.7;
}

/* Log sheet header */
.log-sheet-header-info { flex: 1; min-width: 0; }
.log-sheet-med-name { font-size: 19px; font-weight: 700; letter-spacing: -0.3px; }
.log-sheet-interval { font-size: 13px; color: var(--text-muted); margin-top: 2px; }

.log-anyway-btn {
  width: 100%; margin-top: 8px;
  background: none; border: none;
  color: var(--text-muted); font-size: 12px; font-weight: 600;
  cursor: pointer; padding: 8px 0; text-align: center;
  min-height: 36px; -webkit-tap-highlight-color: transparent;
}
.log-anyway-btn:active { color: var(--accent); }

.add-note-link {
  display: inline-flex; align-items: center;
  background: none; border: none;
  color: var(--accent); font-size: 14px; font-weight: 600;
  cursor: pointer; padding: 0; margin-bottom: 14px;
  min-height: 36px; -webkit-tap-highlight-color: transparent;
}

.history-date-label {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.8px; color: var(--text-muted);
  padding: 14px 0 6px;
}
.history-date-label:first-child { padding-top: 2px; }
.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.modal-header h3 { font-size: 18px; font-weight: 700; letter-spacing: -0.3px; }
.modal-close {
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 50%;
  width: 36px; height: 36px;
  color: var(--text-muted); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  -webkit-tap-highlight-color: transparent;
  transition: color 0.15s, background 0.15s;
}
.modal-close:active { color: var(--text); background: var(--border); }
.modal-close svg { width: 16px; height: 16px; }
/* Larger tap surface via padding */
.modal-close { padding: 0; }

.manage-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.manage-item {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 12px;
  display: flex; align-items: center; gap: 10px;
  min-height: 56px;
}
.manage-dot { width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0; }
.manage-info { flex: 1; min-width: 0; }
.manage-name { font-size: 14px; font-weight: 600; }
.manage-sub  { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.manage-info-btn {
  flex: 1; min-width: 0; background: none; border: none;
  text-align: left; cursor: pointer; padding: 0;
  -webkit-tap-highlight-color: transparent;
}
.manage-info-btn:active .manage-name { color: var(--accent); }
.edit-hint { font-size: 11px; color: var(--accent); opacity: 0.7; }

.manage-edit-form { flex: 1; min-width: 0; }
.manage-edit-form > .dose-input { width: 100%; margin-bottom: 8px; font-size: 15px !important; min-height: 44px; }
.manage-edit-row { display: flex; gap: 8px; margin: 0 0 10px; }
.manage-edit-row .dose-input { flex: 1; font-size: 15px !important; min-height: 44px; }
.manage-edit-row .dose-input:last-child { max-width: 90px; }
.manage-edit-actions { display: flex; gap: 8px; }
.manage-save-btn, .manage-cancel-btn, .manage-delete-btn {
  flex: 1; border: none; border-radius: var(--radius-sm);
  font-size: 15px; font-weight: 700; cursor: pointer;
  min-height: 44px; -webkit-tap-highlight-color: transparent; transition: opacity 0.15s;
}
.manage-save-btn:active, .manage-cancel-btn:active, .manage-delete-btn:active { opacity: 0.8; }
.manage-save-btn   { background: var(--accent); color: var(--accent-text); }
.manage-cancel-btn { background: var(--surface-2); border: 1px solid var(--border); color: var(--text-muted); }
.manage-delete-btn { background: var(--surface-2); border: 1px solid var(--border); color: var(--danger); flex: 0 0 auto; padding: 0 16px; }

.manage-delete {
  background: none; border: none; color: var(--text-muted);
  cursor: pointer;
  min-width: 44px; min-height: 44px;
  display: flex; align-items: center; justify-content: center;
  -webkit-tap-highlight-color: transparent; transition: color 0.15s;
}
.manage-delete:active { color: var(--danger); }
.manage-delete svg { width: 18px; height: 18px; }

.export-btn {
  width: 100%; padding: 12px; margin-bottom: 4px;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text-muted);
  font-size: 14px; font-weight: 600; cursor: pointer; min-height: 44px;
  -webkit-tap-highlight-color: transparent; transition: color 0.15s, border-color 0.15s;
}
.export-btn:active { color: var(--text); border-color: var(--accent); }

.when-row { display: flex; gap: 8px; }
.when-chip {
  flex: 1; padding: 11px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); background: var(--surface-2); color: var(--text-muted);
  font-size: 14px; font-weight: 600; cursor: pointer; min-height: 44px;
  -webkit-tap-highlight-color: transparent; transition: all 0.15s;
}
.when-chip.active { background: var(--accent-sub); border-color: var(--accent); color: var(--accent); }

.divider { border: none; border-top: 1px solid var(--border); margin: 16px 0; }
.sub-heading { font-size: 14px; font-weight: 700; color: var(--text-muted); margin-bottom: 12px; }
.add-form { display: flex; flex-direction: column; gap: 10px; }

.autocomplete-wrap { position: relative; }
.med-suggestions {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 200;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm); list-style: none;
  max-height: 280px; overflow-y: auto;
  box-shadow: 0 12px 32px rgba(0,0,0,0.5);
}
.med-sug {
  display: flex; flex-direction: column; padding: 11px 14px;
  min-height: 52px; cursor: pointer;
  border-bottom: 1px solid var(--border);
  -webkit-tap-highlight-color: transparent;
}
.med-sug:last-child { border-bottom: none; }
.med-sug:active { background: var(--accent-sub); }
.sug-name  { font-size: 14px; font-weight: 500; }
.sug-name mark { background: none; color: var(--accent); font-weight: 700; }
.sug-detail { font-size: 12px; color: var(--text-muted); margin-top: 3px; }
.interval-row { display: flex; align-items: center; gap: 8px; }
.interval-input { flex: 1; }
.interval-sep { color: var(--text-muted); font-size: 13px; white-space: nowrap; }
.interval-hint { font-size: 12px; color: var(--text-muted); line-height: 1.5; }
.interval-color-row { display: flex; gap: 10px; align-items: stretch; }
.interval-color-row .dose-input { flex: 1; }

.interval-presets { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.interval-chip {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 100px; color: var(--text-muted);
  font-size: 12px; font-weight: 600; padding: 6px 12px;
  min-height: 36px; display: flex; align-items: center;
  cursor: pointer; transition: all 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.interval-chip.active,
.interval-chip:active {
  border-color: var(--accent); color: var(--accent); background: var(--accent-sub);
}
.interval-dh-row {
  display: flex; align-items: center; gap: 8px;
}
.interval-dh {
  flex: 1; min-width: 0;
}
.interval-dh-label {
  font-size: 13px; color: var(--text-muted); white-space: nowrap; flex-shrink: 0;
}

.color-input {
  width: 52px; height: 48px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); background: var(--surface-2); cursor: pointer; padding: 4px;
  flex-shrink: 0;
}
.add-btn {
  padding: 15px; border: none; border-radius: var(--radius);
  background: var(--accent); color: var(--accent-text);
  font-size: 16px; font-weight: 700; cursor: pointer; min-height: 52px;
  box-shadow: 0 4px 18px var(--accent-glow);
  -webkit-tap-highlight-color: transparent;
}
.add-btn:active { opacity: 0.88; transform: scale(0.98); }

/* ── Confirm Sheet ────────────────────────────────────────────────────────── */
.confirm-sheet {
  position: fixed; inset: 0; z-index: 400;
  display: flex; align-items: flex-end;
  animation: fadeIn 0.16s ease-out;
}
.confirm-backdrop {
  position: absolute; inset: 0;
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
.confirm-card {
  position: relative; width: 100%;
  background: var(--surface-glass);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  border: 0.5px solid var(--border-strong); border-bottom: none;
  padding: 8px 16px 20px;
  padding-bottom: calc(20px + var(--sab));
  padding-left: calc(16px + var(--sal));
  padding-right: calc(16px + var(--sar));
  z-index: 1;
  animation: slideUp 0.28s cubic-bezier(0.32, 0.72, 0, 1);
  box-shadow: 0 -10px 40px rgba(0,0,0,0.4);
}
.confirm-card::before {
  content: '';
  display: block;
  width: 36px; height: 5px;
  border-radius: 100px;
  background: var(--border-strong);
  margin: 6px auto 18px;
  opacity: 0.7;
}
.confirm-msg {
  font-size: 16px; font-weight: 600; text-align: center;
  margin-bottom: 20px; line-height: 1.4; color: var(--text);
}
.confirm-actions { display: flex; gap: 10px; }
.confirm-cancel, .confirm-ok {
  flex: 1; padding: 15px; border: none; border-radius: var(--radius);
  font-size: 16px; font-weight: 700; cursor: pointer; min-height: 52px;
  -webkit-tap-highlight-color: transparent; transition: opacity 0.15s, transform 0.1s;
}
.confirm-cancel:active, .confirm-ok:active { opacity: 0.85; transform: scale(0.98); }
.confirm-cancel { background: var(--surface-2); border: 1px solid var(--border); color: var(--text-muted); }
.confirm-ok     { background: var(--accent); color: var(--accent-text); box-shadow: 0 4px 16px var(--accent-glow); }

/* ── Toast ────────────────────────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: calc(var(--tabbar-h) + 26px + var(--sab));
  left: 50%;
  transform: translateX(-50%) translateY(16px);
  background: rgba(40, 40, 56, 0.85);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  color: var(--text);
  border: 0.5px solid var(--border-strong); border-radius: 100px;
  padding: 11px 22px; font-size: 14px; font-weight: 600;
  opacity: 0; transition: all 0.28s; white-space: nowrap;
  z-index: 300; pointer-events: none;
  max-width: calc(100vw - 32px);
  box-shadow: 0 8px 28px rgba(0,0,0,0.4);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast { display: flex; align-items: center; gap: 12px; }
.toast-undo-btn {
  background: none; border: 1px solid rgba(255,255,255,0.25);
  border-radius: 100px; color: var(--accent);
  font-size: 13px; font-weight: 700; padding: 5px 14px;
  cursor: pointer; flex-shrink: 0;
}

/* ── What's New / Changelog sheet ───────────────────────────────────────── */
.whats-new-card { max-height: 88vh; overflow-y: auto; }
.whats-new-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin: 4px 0 16px;
}
.whats-new-list li {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  font-size: 14px;
  line-height: 1.45;
}
.wn-icon { font-size: 18px; flex-shrink: 0; margin-top: 1px; }
.wn-version-header {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.8px; color: var(--text-muted);
  padding: 10px 0 0; border-top: 1px solid var(--border);
  display: block;
}
.wn-version-header:first-child { border-top: none; padding-top: 0; }
#whats-new-ps {
  font-size: 13px; color: var(--text-muted); text-align: center;
  margin: -4px 0 16px; line-height: 1.5;
}

/* ── PIN overlay ──────────────────────────────────────────────────────────── */
.pin-overlay {
  position: fixed; inset: 0; z-index: 500;
  background: var(--bg);
  display: flex; align-items: center; justify-content: center;
}
.pin-container {
  display: flex; flex-direction: column; align-items: center;
  padding: 0 24px; width: 100%; max-width: 320px;
}
.pin-app-icon    { font-size: 28px; margin-bottom: 28px; opacity: 0.4; }
.pin-person-emoji { font-size: 52px; line-height: 1; margin-bottom: 10px; }
.pin-person-name  { font-size: 22px; font-weight: 700; margin-bottom: 4px; letter-spacing: -0.3px; }
.pin-subtitle     { font-size: 14px; color: var(--text-muted); margin-bottom: 30px; }
.pin-dots {
  display: flex; gap: 18px; margin-bottom: 40px;
}
.pin-dot {
  width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid var(--border-strong);
  transition: background 0.12s, border-color 0.12s, transform 0.12s;
}
.pin-dot.filled { background: var(--accent); border-color: var(--accent); transform: scale(1.2); }

.pin-pad {
  display: grid; grid-template-columns: repeat(3, 72px);
  gap: 14px; justify-items: center;
}
.pin-key {
  width: 72px; height: 72px; border-radius: 50%;
  background: var(--surface); border: 1px solid var(--border);
  color: var(--text); font-size: 26px; font-weight: 400;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: background 0.1s, transform 0.1s, border-color 0.1s;
  -webkit-tap-highlight-color: transparent;
  user-select: none; -webkit-user-select: none;
  font-feature-settings: "ss01", "tnum";
}
.pin-key:active { background: var(--accent-sub); border-color: var(--accent); transform: scale(0.92); }
.pin-key-back   { background: none; border-color: transparent; color: var(--text-muted); font-size: 22px; }
.pin-back-link  {
  margin-top: 36px; background: none; border: none;
  color: var(--text-muted); font-size: 14px; cursor: pointer; padding: 8px;
  -webkit-tap-highlight-color: transparent;
}
.pin-back-link:active { color: var(--text); }

.picker-grid {
  display: grid; grid-template-columns: repeat(2, 1fr);
  gap: 12px; width: 100%;
}
.picker-person {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 22px 12px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md);
  cursor: pointer; color: var(--text);
  transition: background 0.1s, transform 0.1s, border-color 0.1s;
  -webkit-tap-highlight-color: transparent; user-select: none; -webkit-user-select: none;
}
.picker-person:active  { background: var(--accent-sub); border-color: var(--accent); transform: scale(0.95); }
.picker-person.picker-last { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.picker-emoji { font-size: 40px; line-height: 1; }
.picker-name    { font-size: 15px; font-weight: 600; }
.picker-version { margin-top: 24px; font-size: 12px; color: var(--text-muted); opacity: 0.5; }

@keyframes pinShake {
  0%, 100% { transform: translateX(0); }
  15%       { transform: translateX(-10px); }
  35%       { transform: translateX(10px); }
  55%       { transform: translateX(-6px); }
  75%       { transform: translateX(6px); }
  90%       { transform: translateX(-3px); }
}
.pin-dots.shake { animation: pinShake 0.45s ease-in-out; }

/* ── Temperature tracker ──────────────────────────────────────────────────── */
#temp-section { display: none; }
body[data-person="Zoey"] #temp-section,
body[data-person="Hudson"] #temp-section { display: block; }

.temp-log-row { display: flex; gap: 10px; margin-bottom: 12px; align-items: stretch; }
.temp-input { flex: 1; }
.temp-log-btn {
  padding: 0 22px; border: none; border-radius: var(--radius-sm);
  background: var(--accent); color: var(--accent-text);
  font-size: 15px; font-weight: 700; cursor: pointer;
  min-height: 48px; flex-shrink: 0;
  box-shadow: 0 4px 14px var(--accent-glow);
  -webkit-tap-highlight-color: transparent; transition: opacity 0.15s, transform 0.1s;
}
.temp-log-btn:active { opacity: 0.88; transform: scale(0.97); }
.temp-log-btn:disabled { opacity: 0.4; cursor: not-allowed; }

.temp-sparkline {
  margin-bottom: 10px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 6px 4px 4px;
}
.temp-sparkline svg { display: block; width: 100%; height: 52px; }

.temp-live-hint {
  font-size: 13px; font-weight: 700; min-height: 1.2em;
  margin-top: 6px; margin-bottom: 4px; display: none;
}

.temp-emergency {
  background: rgba(255,69,58,0.12); border: 1.5px solid var(--danger); border-radius: var(--radius-sm);
  padding: 14px 16px; margin-bottom: 12px;
}
.temp-emergency-title { font-size: 15px; font-weight: 700; color: #ff6b60; margin-bottom: 10px; }
.temp-call-doctor {
  background: var(--surface); border: 1.5px solid var(--danger); border-radius: var(--radius-sm);
  padding: 12px 14px; margin-bottom: 12px; font-size: 14px; font-weight: 600; color: var(--danger);
}
.temp-call-doctor span { display: block; margin-bottom: 8px; }
.temp-emergency-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.temp-call-btn {
  display: inline-block; padding: 10px 16px; border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 700; text-decoration: none; text-align: center;
  -webkit-tap-highlight-color: transparent;
}
.temp-call-primary  { background: var(--danger); color: white; box-shadow: 0 4px 14px rgba(255,69,58,0.3); }
.temp-call-after    { background: var(--surface-2); border: 1px solid var(--border); color: var(--text); }
.temp-list { display: flex; flex-direction: column; gap: 8px; }
.temp-item {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 12px 14px;
  display: flex; align-items: center; gap: 12px;
  box-shadow: var(--shadow-card);
}
.temp-reading { display: flex; align-items: baseline; gap: 5px; min-width: 105px; }
.temp-val   { font-size: 24px; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -0.5px; }
.temp-trend { font-size: 15px; font-weight: 700; }
.temp-meta  { flex: 1; min-width: 0; }
.temp-badge { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.3px; }
.temp-time  { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.temp-delete-btn {
  background: none; border: none; color: var(--text-muted);
  cursor: pointer;
  min-width: 40px; min-height: 40px;
  display: flex; align-items: center; justify-content: center;
  -webkit-tap-highlight-color: transparent; transition: color 0.15s; flex-shrink: 0;
}
.temp-delete-btn:active { color: var(--danger); }
.temp-delete-btn svg { width: 18px; height: 18px; }

/* ── App footer (version + changelog) ────────────────────────────────────── */
.app-footer {
  text-align: center;
  font-size: 11px;
  color: var(--text-muted);
  opacity: 0.5;
  padding: 8px 16px 16px;
  letter-spacing: 0.3px;
}
.changelog-link {
  background: none; border: none; color: var(--accent);
  font-size: 11px; font-weight: 600; cursor: pointer; padding: 0;
  text-decoration: underline; letter-spacing: 0.3px;
  -webkit-tap-highlight-color: transparent;
}
.changelog-link:active { opacity: 0.7; }

/* ── Fever alternating panel ─────────────────────────────────────────────── */
.fever-panel { margin-bottom: 12px; }
.fever-panel-inner {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 11px 13px;
  box-shadow: var(--shadow-card);
}
.fever-title {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.6px; color: var(--text-muted); margin-bottom: 9px;
}
.fever-row {
  display: grid;
  grid-template-columns: 10px 1fr auto auto;
  align-items: center;
  gap: 10px;
  padding: 5px 0;
  min-height: 36px;
}
.fever-row + .fever-row { border-top: 1px solid var(--border); }
.fever-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.fever-med-name { font-size: 14px; font-weight: 600; }
.fever-state { font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums; }
.fever-ready { color: var(--safe); }
.fever-wait  { color: var(--warn); }
.fever-log-btn {
  background: var(--accent); color: var(--accent-text); border: none;
  border-radius: var(--radius-sm); padding: 7px 14px;
  font-size: 13px; font-weight: 700; cursor: pointer;
  min-height: 34px; -webkit-tap-highlight-color: transparent;
  transition: opacity 0.15s, transform 0.1s;
}
.fever-log-btn:active { opacity: 0.88; transform: scale(0.96); }

/* ── Injection site picker ───────────────────────────────────────────────── */
.site-picker { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.site-btn {
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text);
  border-radius: var(--radius-sm); padding: 9px 14px;
  font-size: 14px; font-weight: 600; cursor: pointer; min-height: 40px;
  -webkit-tap-highlight-color: transparent; transition: all 0.12s;
}
.site-btn.active {
  background: var(--accent-sub); border-color: var(--accent);
  color: var(--accent); font-weight: 700;
}
.site-btn:active { opacity: 0.78; }
.site-hint { font-size: 12px; color: var(--text-muted); margin-top: 6px; }
.inj-site-display { font-size: 11px; color: var(--text-muted); margin-top: 1px; }

/* ── Weight input row ─────────────────────────────────────────────────── */
.weight-input-row {
  display: flex; gap: 8px; align-items: center; margin-top: 8px;
}
.weight-unit-label {
  font-size: 15px; font-weight: 600; color: var(--text-muted); flex-shrink: 0;
}
#weight-sheet .weight-input-row .dose-input { flex: 1; }

/* ── Already-dosed warning ───────────────────────────────────────────── */
.log-sheet-already-warn {
  background: var(--warn-bg); border: 1px solid rgba(255,159,10,0.4);
  border-radius: var(--radius-sm); padding: 11px 14px;
  font-size: 13px; font-weight: 600; color: var(--warn);
  margin-bottom: 12px;
}

/* ── Weight-based dose hint ─────────────────────────────────────────── */
.weight-dose-hint {
  font-size: 13px; color: var(--safe); margin-top: 8px;
  padding: 8px 12px;
  background: var(--safe-bg);
  border: 1px solid rgba(48,209,88,0.25);
  border-radius: var(--radius-sm);
}

/* ── Day-name display for multi-day countdowns ──────────────────────── */
.card-ready-day {
  font-size: 18px; font-weight: 800; color: var(--warn);
  letter-spacing: -0.3px; margin: 2px 0 1px; line-height: 1.2;
}
.card-countdown-sub {
  font-size: 13px; color: var(--text-muted);
  font-variant-numeric: tabular-nums; margin-bottom: 4px;
}


/* ── Today summary card ──────────────────────────────────────────────────── */
.today-summary {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  margin-bottom: 12px;
  box-shadow: var(--shadow-card);
}
.today-summary-ring { flex-shrink: 0; }
.today-summary-text { flex: 1; min-width: 0; }
.today-summary-title {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.8px; color: var(--text-muted); margin-bottom: 2px;
}
.today-summary-stat {
  font-size: 15px; font-weight: 700; letter-spacing: -0.2px;
}
.today-summary-pills { display: flex; gap: 8px; flex-shrink: 0; flex-wrap: wrap; justify-content: flex-end; }
.summary-pill {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12px; font-weight: 700;
  padding: 4px 10px; border-radius: 100px;
  font-variant-numeric: tabular-nums;
}
.summary-pill::before {
  content: ''; width: 7px; height: 7px; border-radius: 50%;
  background: currentColor;
}
.summary-pill.ok       { background: var(--safe-bg);   color: var(--safe); }
.summary-pill.wait     { background: var(--warn-bg);   color: var(--warn); }
.summary-pill.overdue  { background: var(--danger-bg); color: var(--danger); }

/* ── Skeleton shimmer loaders ────────────────────────────────────────────── */
@keyframes shimmer {
  0%   { background-position: -200px 0; }
  100% { background-position: calc(200px + 100%) 0; }
}
.skeleton-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
}
.skeleton-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  min-height: 140px;
  position: relative; overflow: hidden;
}
.skeleton-card::before {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(
    90deg,
    transparent 0,
    rgba(255, 255, 255, 0.05) 20%,
    rgba(255, 255, 255, 0.10) 50%,
    rgba(255, 255, 255, 0.05) 80%,
    transparent 100%
  );
  background-size: 200px 100%;
  background-repeat: no-repeat;
  animation: shimmer 1.6s linear infinite;
}
.skeleton-card:first-child { grid-column: 1 / -1; min-height: 180px; }
.skeleton-line {
  height: 10px; border-radius: 100px;
  background: var(--surface-2);
  margin-bottom: 8px;
}
.skeleton-line.w-60 { width: 60%; }
.skeleton-line.w-40 { width: 40%; }
.skeleton-line.w-80 { width: 80%; }
.skeleton-line.tall { height: 28px; margin: 8px 0; }
@media (prefers-reduced-motion: reduce) {
  .skeleton-card::before { animation: none; opacity: 0.5; }
}
@media (prefers-color-scheme: light) {
  .skeleton-card::before {
    background: linear-gradient(
      90deg,
      transparent 0,
      rgba(0, 0, 0, 0.04) 20%,
      rgba(0, 0, 0, 0.08) 50%,
      rgba(0, 0, 0, 0.04) 80%,
      transparent 100%
    );
    background-size: 200px 100%;
    background-repeat: no-repeat;
  }
}

/* ── Radial progress ring (wait-state cards) ─────────────────────────────── */
.ring-wrap { position: relative; display: inline-flex; align-items: center; gap: 12px; }
.progress-ring {
  display: block;
  width: 56px; height: 56px;
  flex-shrink: 0;
  transform: rotate(-90deg);
}
.progress-ring-bg { stroke: var(--warn-bg); }
.progress-ring-fg { stroke: var(--warn); stroke-linecap: round; transition: stroke-dashoffset 0.8s linear; }
.ring-countdown {
  font-size: 22px; font-weight: 800; color: var(--warn);
  font-variant-numeric: tabular-nums; letter-spacing: -0.5px;
  font-feature-settings: "ss01", "tnum";
  line-height: 1;
}

/* ── Streak badge ────────────────────────────────────────────────────────── */
.streak-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px; font-weight: 700;
  padding: 3px 9px;
  border-radius: 100px;
  background: linear-gradient(135deg, rgba(255,159,10,0.18), rgba(255,69,58,0.16));
  border: 1px solid rgba(255,159,10,0.32);
  color: #ffb84d;
  margin-top: 6px;
  font-variant-numeric: tabular-nums;
}
.streak-badge.broken {
  background: var(--surface-2);
  border-color: var(--border);
  color: var(--text-faint);
}
.status-card[data-hero="1"] .streak-badge {
  font-size: 13px; padding: 4px 11px;
}
.streak-hint {
  font-size: 11px;
  color: var(--text-faint);
  line-height: 1.45;
  margin-top: 6px;
  padding-left: 28px;
}

/* ── Swatch grid color picker (replaces native input[type=color]) ────────── */
.swatch-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 8px;
  padding: 4px 0;
}
.swatch {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.1s, border-color 0.15s, box-shadow 0.15s;
  padding: 0;
  position: relative;
}
.swatch:active { transform: scale(0.88); }
.swatch.selected {
  border-color: var(--text);
  box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--text), 0 4px 12px rgba(0,0,0,0.3);
  transform: scale(1.05);
}
@media (prefers-color-scheme: light) {
  .swatch.selected { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--text), 0 4px 12px rgba(0,0,0,0.15); }
}

