/* Peptrac 2 — "fresh" design: dense, one-screen Today, color-coded compounds */
:root {
  --bg: #f4f5f7;
  --surface: #ffffff;
  --surface-2: #eef0f3;
  --line: #e3e6ea;
  --text: #15181d;
  --text-2: #5f6670;
  --text-3: #8b929c;
  --accent: #0e9384;
  --accent-ink: #ffffff;
  --accent-soft: #e0f4f1;
  --danger: #d93d42;
  --danger-soft: #fde8e8;
  --warn: #b86e00;
  --warn-soft: #fdf1dc;
  --ok: #12a150;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .04);
  --radius: 14px;
  --tabbar-h: 58px;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #0c0d10;
  --surface: #16181c;
  --surface-2: #1f2228;
  --line: #262a31;
  --text: #eef0f3;
  --text-2: #a3aab4;
  --text-3: #727a85;
  --accent: #2ec4b0;
  --accent-ink: #062a25;
  --accent-soft: #0f2e2a;
  --danger: #ff6b6f;
  --danger-soft: #3a1618;
  --warn: #f0b04a;
  --warn-soft: #33260f;
  --ok: #3ccf7a;
  --shadow: none;
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0c0d10;
    --surface: #16181c;
    --surface-2: #1f2228;
    --line: #262a31;
    --text: #eef0f3;
    --text-2: #a3aab4;
    --text-3: #727a85;
    --accent: #2ec4b0;
    --accent-ink: #062a25;
    --accent-soft: #0f2e2a;
    --danger: #ff6b6f;
    --danger-soft: #3a1618;
    --warn: #f0b04a;
    --warn-soft: #33260f;
    --ok: #3ccf7a;
    --shadow: none;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI Variable", "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg); color: var(--text); font-size: 15px; line-height: 1.3;
  -webkit-font-smoothing: antialiased; font-feature-settings: "tnum" 1;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }
svg { display: block; }

.app {
  max-width: 600px; margin: 0 auto;
  padding: 0 12px calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 16px);
  min-height: 100vh;
}

/* ── Header ── */
.hdr {
  position: sticky; top: 0; z-index: 15; margin: 0 -12px 6px; padding: calc(env(safe-area-inset-top) + 8px) 12px 8px;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
}
.hdr-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 40px; }
.hdr-title { font-size: 22px; font-weight: 750; margin: 0; letter-spacing: -.01em; }
.date-nav { display: flex; align-items: center; gap: 2px; min-width: 0; }
.date-pick { position: relative; display: flex; flex-direction: column; align-items: center; padding: 0 6px; cursor: pointer; min-width: 92px; }
.date-pick input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }
.date-big { font-size: 20px; font-weight: 750; letter-spacing: -.01em; }
.date-small { font-size: 11.5px; color: var(--text-2); font-weight: 600; margin-top: 1px; }
.icon-btn { width: 34px; height: 34px; border: none; background: transparent; border-radius: 10px; display: grid; place-items: center; color: var(--text-2); }
.icon-btn:hover { background: var(--surface-2); }
.icon-btn svg { width: 20px; height: 20px; }
.chip-btn { border: none; background: var(--accent-soft); color: var(--accent); font-weight: 700; font-size: 12px; padding: 5px 10px; border-radius: 99px; margin-left: 4px; }
.hdr-icons { display: flex; align-items: center; gap: 2px; }
.sync { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 600; color: var(--text-3); margin-right: 2px; }
.sync-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--text-3); }
.sync-dot.ok { background: var(--ok); }
.sync-dot.busy { background: var(--warn); }
.sync-dot.off { background: var(--danger); }
.hdr-row2 { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 6px; }
.shift-chips { display: flex; gap: 4px; background: var(--surface-2); padding: 3px; border-radius: 10px; }
.shift-chips button { border: none; background: transparent; padding: 5px 9px; border-radius: 7px; font-size: 12.5px; font-weight: 650; color: var(--text-2); white-space: nowrap; }
.shift-chips button.on { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,.12); }
#hdrProgress { display: inline-flex; align-items: center; gap: 4px; font-size: 12.5px; color: var(--text-2); white-space: nowrap; }
#hdrProgress b { color: var(--text); font-size: 14px; }
.ring { width: 22px; height: 22px; }
.ring svg { width: 22px; height: 22px; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 3.2; stroke-linecap: round; }
.ring-bg { stroke: var(--surface-2); }
.ring-fg { stroke: var(--accent); }

/* ── Alerts strip ── */
.alerts { background: var(--warn-soft); border-radius: 12px; margin-bottom: 6px; overflow: hidden; }
.alerts-sum { width: 100%; display: flex; align-items: center; gap: 8px; border: none; background: transparent; padding: 8px 12px; font-size: 13px; font-weight: 650; color: var(--warn); text-align: left; }
.alerts-sum span:nth-child(2) { flex: 1; }
.alerts-sum svg { width: 16px; height: 16px; transition: transform .2s; }
.alerts.open .alerts-sum svg { transform: rotate(180deg); }
.warn-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--warn); flex: none; }
.alerts-body { padding: 0 12px 10px 27px; font-size: 13px; color: var(--text); display: grid; gap: 4px; }
.fast-line { display: flex; align-items: center; gap: 6px; width: 100%; border: none; background: var(--accent-soft); color: var(--accent); font-weight: 650; font-size: 13px; padding: 8px 12px; border-radius: 12px; margin-bottom: 6px; }
.fast-line svg { width: 16px; height: 16px; }

/* ── Dose list ── */
.slot-head { display: flex; align-items: baseline; gap: 8px; padding: 10px 4px 5px; }
.slot-name { font-size: 12px; font-weight: 750; text-transform: uppercase; letter-spacing: .04em; color: var(--text-2); }
.slot-head .btn { margin-left: auto; }
.slot-time { font-size: 12px; color: var(--text-3); font-weight: 500; }
.slot-count { margin-left: auto; font-size: 12px; font-weight: 700; color: var(--text-3); }
.slot-count.all { color: var(--ok); }
.list { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.row { display: flex; align-items: center; gap: 8px; padding: 0 10px 0 0; min-height: 50px; border-bottom: 1px solid var(--line); position: relative; }
.row:last-child { border-bottom: none; }
.row .bar { align-self: stretch; width: 4px; background: var(--c); flex: none; margin-right: 4px; }
.row-main { flex: 1; min-width: 0; padding: 6px 0; }
.row-name { font-size: 15.5px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; align-items: center; gap: 6px; }
.row-name .tag { font-size: 10.5px; font-weight: 700; color: var(--text-2); background: var(--surface-2); padding: 1px 5px; border-radius: 5px; }
.row-sub { font-size: 11.5px; color: var(--text-3); margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-transform: none; }
.row-amt { text-align: right; white-space: nowrap; line-height: 1.05; min-width: 52px; }
.row-amt b { font-size: 18px; font-weight: 750; color: var(--c); letter-spacing: -.01em; }
.row-amt span { font-size: 12px; font-weight: 700; color: var(--c); margin-left: 1px; }
.row-amt small { display: block; font-size: 10.5px; color: var(--text-3); font-weight: 600; margin-top: 2px; }
.row-amt.over b, .row-amt.over span { color: var(--danger); }
.site { width: 62px; flex: none; font-size: 11.5px; font-weight: 650; padding: 5px 4px; border-radius: 8px; border: none; background: var(--surface-2); color: var(--text-2); text-align: center; text-align-last: center; appearance: none; -webkit-appearance: none; }
.site.none { background: transparent; }
.check { position: relative; width: 32px; height: 32px; flex: none; }
.check input { appearance: none; -webkit-appearance: none; margin: 0; width: 32px; height: 32px; border-radius: 50%; border: 2px solid var(--line); background: transparent; cursor: pointer; transition: background .15s, border-color .15s; }
.check input:hover { border-color: var(--accent); }
.check input:checked { background: var(--accent); border-color: var(--accent); }
.check svg { position: absolute; inset: 0; margin: auto; width: 17px; height: 17px; pointer-events: none; opacity: 0; }
.check svg path { stroke: var(--accent-ink); }
.check input:checked + svg { opacity: 1; }
.row.done .row-name, .row.done .row-amt b, .row.done .row-amt span { color: var(--text-3); }
.row.done .row-name { text-decoration: line-through; text-decoration-thickness: 1.5px; }
.row.done .bar { opacity: .35; }
.rest-line { display: flex; flex-wrap: wrap; gap: 4px 12px; padding: 10px 4px 0; font-size: 12px; color: var(--text-2); }
.rest-line span { display: inline-flex; align-items: center; gap: 5px; font-weight: 650; }
.rest-line i { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }
.rest-line em { font-style: normal; font-weight: 500; color: var(--text-3); }
.empty { background: var(--surface); border-radius: var(--radius); padding: 18px; text-align: center; box-shadow: var(--shadow); margin-top: 8px; }
.empty p { color: var(--text-2); font-size: 14px; margin: 6px 0 12px; }
.empty .btns { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.small-empty { color: var(--text-2); font-size: 14px; }

/* ── Protocol cards ── */
.cards { display: grid; gap: 8px; }
@media (min-width: 900px) { .app { max-width: 880px; } .cards { grid-template-columns: 1fr 1fr; } }
.pcard { background: var(--surface); border-radius: var(--radius); padding: 12px 14px; box-shadow: var(--shadow); border-left: 4px solid var(--c); }
.pc-top { display: flex; align-items: center; gap: 8px; }
.pc-top .dot { display: none; }
.pc-name { font-weight: 750; font-size: 16.5px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.status { font-size: 11px; font-weight: 750; padding: 2px 8px; border-radius: 99px; text-transform: uppercase; letter-spacing: .03em; }
.status.on { background: var(--accent-soft); color: var(--accent); }
.status.off { background: var(--surface-2); color: var(--text-2); }
.status.brk { background: var(--warn-soft); color: var(--warn); }
.pc-meta { font-size: 12.5px; color: var(--text-2); margin-top: 3px; }
.pbar { height: 5px; background: var(--surface-2); border-radius: 3px; margin-top: 9px; overflow: hidden; }
.pbar > div { height: 100%; background: var(--c); border-radius: 3px; }
.pbar > div.brk { background: var(--warn); }
.pmeta { display: flex; justify-content: space-between; gap: 8px; font-size: 11.5px; color: var(--text-3); margin-top: 4px; font-weight: 600; }
.chips { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }
.chip { font-size: 11.5px; font-weight: 650; padding: 3px 8px; border-radius: 7px; background: var(--surface-2); color: var(--text-2); }
.chip.bad { background: var(--danger-soft); color: var(--danger); }
.pc-notes { font-size: 12.5px; color: var(--text-2); margin-top: 7px; }
.pc-actions { display: flex; gap: 2px; margin: 8px -8px -4px; }
.pc-actions button { border: none; background: none; color: var(--accent); font-weight: 700; font-size: 13.5px; padding: 6px 8px; border-radius: 8px; }
.pc-actions button:hover { background: var(--surface-2); }

/* ── Shared building blocks (other tabs, forms) ── */
.section-label { display: flex; justify-content: space-between; align-items: baseline; font-size: 12px; font-weight: 750; text-transform: uppercase; letter-spacing: .04em; color: var(--text-2); margin: 16px 4px 6px; }
.section-label .slot-time { text-transform: none; letter-spacing: 0; }
.section-label .link-btn { text-transform: none; letter-spacing: 0; font-size: 14px; }
.group { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.cell { padding: 11px 14px; border-bottom: 1px solid var(--line); }
.cell:last-child { border-bottom: none; }
.cell.muted { color: var(--text-2); font-size: 13px; }
.cell-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.cell-info { min-width: 0; flex: 1; }
.badge { font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 6px; }
.segmented { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 3px; background: var(--surface-2); padding: 3px; border-radius: 10px; }
.segmented button { border: none; background: transparent; padding: 7px 0; border-radius: 8px; font-size: 13px; font-weight: 650; color: var(--text-2); }
.segmented button.active { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.btn { border: none; background: var(--surface-2); color: var(--accent); font-weight: 700; font-size: 14px; padding: 8px 13px; border-radius: 10px; }
.btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn.danger { color: var(--danger); }
.btn.full { width: 100%; padding: 12px; font-size: 16px; }
.btn.sm { padding: 6px 11px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: default; }
.link-btn { border: none; background: none; color: var(--accent); font-weight: 700; padding: 0; }
.card-actions { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.small { font-size: 12px; color: var(--text-2); }
.p14 { padding: 12px 14px; }
.banner { background: var(--warn-soft); border-radius: 10px; padding: 8px 12px; font-size: 12px; margin-bottom: 10px; }
.disclaimer { font-size: 11px; color: var(--text-3); text-align: center; margin: 20px 8px 0; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 12px 14px; }
.form-grid .span2 { grid-column: span 2; }
.field label { display: block; font-size: 12px; font-weight: 650; color: var(--text-2); margin-bottom: 4px; }
.field input, .field select, .field textarea { width: 100%; padding: 9px 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface-2); font-size: 15px; }
.field input:focus, .field select:focus, .field textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.field textarea { min-height: 64px; resize: vertical; }
.field .hint { font-size: 11px; color: var(--text-3); margin-top: 3px; }
.checks-row { display: flex; gap: 4px; flex-wrap: wrap; }
.checks-row label { display: inline-flex; align-items: center; justify-content: center; width: 40px; padding: 6px 0; border-radius: 8px; background: var(--surface-2); font-size: 12px; font-weight: 650; cursor: pointer; color: var(--text-2); margin: 0; }
.checks-row input { display: none; }
.checks-row label:has(input:checked) { background: var(--accent); color: var(--accent-ink); }
.swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.swatches label { width: 28px; height: 28px; border-radius: 50%; background: var(--c); cursor: pointer; margin: 0; position: relative; }
.swatches input { display: none; }
.swatches label:has(input:checked) { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--c); }
.toggle-row { display: flex; align-items: center; justify-content: space-between; }
.switch { position: relative; width: 50px; height: 30px; flex: none; }
.switch input { appearance: none; -webkit-appearance: none; width: 50px; height: 30px; border-radius: 15px; background: var(--line); margin: 0; cursor: pointer; transition: background .2s; }
.switch input:checked { background: var(--accent); }
.switch input::after { content: ""; position: absolute; top: 2px; left: 2px; width: 26px; height: 26px; border-radius: 50%; background: #fff; box-shadow: 0 2px 4px rgba(0,0,0,.25); transition: transform .2s; }
.switch input:checked::after { transform: translateX(20px); }
.steps-list .step { display: grid; grid-template-columns: 1fr 1fr auto; gap: 6px; margin-bottom: 6px; align-items: center; }
.steps-list input { width: 100%; padding: 8px; border-radius: 9px; border: 1px solid var(--line); background: var(--surface-2); }

.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th, .table td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.table th { font-size: 11px; color: var(--text-3); text-transform: uppercase; font-weight: 700; }
.table tr:last-child td { border-bottom: none; }
.scroll-x { overflow-x: auto; }

.timer { font-size: 44px; font-weight: 750; text-align: center; padding: 16px 0 4px; letter-spacing: -.02em; }
.timer-sub { text-align: center; color: var(--text-2); font-size: 13px; padding-bottom: 12px; }
.btn-row { display: flex; gap: 8px; padding: 0 14px 14px; }
.btn-row .btn { flex: 1; padding: 9px 6px; }

/* ── Tab bar ── */
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; background: color-mix(in srgb, var(--surface) 90%, transparent); -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
.tabbar-inner { max-width: 600px; margin: 0 auto; display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); height: var(--tabbar-h); }
.tab-btn { border: none; background: none; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: var(--text-3); font-size: 10.5px; font-weight: 650; }
.tab-btn svg { width: 22px; height: 22px; }
.tab-btn.active { color: var(--accent); }
.tab { display: none; }
.tab.active { display: block; }

/* ── Modal ── */
.modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 50; display: flex; align-items: flex-end; justify-content: center; }
.modal { background: var(--bg); width: 100%; max-width: 560px; max-height: 92vh; overflow-y: auto; border-radius: 18px 18px 0 0; padding: 14px 14px calc(20px + env(safe-area-inset-bottom)); }
@media (min-width: 700px) { .modal-bg { align-items: center; } .modal { border-radius: 18px; } }
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.modal-head h2 { font-size: 18px; margin: 0; }

/* ── Auth ── */
.auth { max-width: 380px; margin: 12vh auto 0; padding: 0 16px; }
.auth h1 { text-align: center; margin: 0 0 4px; font-size: 30px; letter-spacing: -.02em; }
.auth p.sub { text-align: center; color: var(--text-2); margin: 0 0 20px; font-size: 14px; }
.auth .group { padding: 4px 0; }
.auth .msg { font-size: 13px; margin: 10px 4px; }
.auth .msg.err { color: var(--danger); }
.auth .msg.ok { color: var(--ok); }
.auth .alt { text-align: center; margin-top: 14px; font-size: 14px; }

.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 12px); background: var(--text); color: var(--bg); padding: 9px 16px; border-radius: 99px; font-size: 13px; font-weight: 650; z-index: 60; max-width: 90vw; }

/* Desktop: side rail instead of bottom bar */
@media (min-width: 900px) {
  .tabbar { top: 0; bottom: 0; right: auto; width: 92px; border-top: none; border-right: 1px solid var(--line); padding: 16px 0; }
  .tabbar-inner { grid-template-columns: 1fr; grid-auto-rows: 72px; height: auto; }
  body { padding-left: 92px; }
  .app { padding-bottom: 32px; }
  .toast { bottom: 24px; }
}
#hdrProgress .ring { margin-right: 2px; }
.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 64px; }
.pw-toggle { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); border: none; background: none; color: var(--accent); font-weight: 700; font-size: 13px; padding: 6px 8px; }

/* ── Phone fit fixes ── */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
html, body { overflow-x: hidden; max-width: 100%; }
/* iOS zooms in on any field under 16px; keep fields at 16px on touch screens */
@media (pointer: coarse) {
  .field input, .field select, .field textarea, .steps-list input, .auth input { font-size: 16px; }
}
@media (max-width: 360px) {
  .shift-chips button { padding: 5px 6px; font-size: 12px; }
  #hdrProgress > span:not(.ring) { display: none; }
  .site { width: 56px; }
  .row-amt { min-width: 44px; }
}
/* Hide the hosting provider's floating badge */
#nl-badge-frame, iframe[id^="nl-badge"] { display: none !important; }

/* ── v6.7 "Bold gradient header" color theme (Amin picked option B) ── */
:root { --bg: #eef1f8; --accent: #4f46e5; --accent-soft: #e7e6fd; --slot: #4338ca;
  --hdr-grad: linear-gradient(120deg, #0e9384 0%, #2563eb 60%, #6d28d9 100%);
  --rail-grad: linear-gradient(180deg, #0e9384, #4f46e5); }
:root[data-theme="dark"] { --bg: #0b0c12; --accent: #818cf8; --accent-ink: #0b0a2a; --accent-soft: #1e1b4b; --slot: #a5b4fc;
  --hdr-grad: linear-gradient(120deg, #0b6f64 0%, #1d4ed8 60%, #5b21b6 100%);
  --rail-grad: linear-gradient(180deg, #0b6f64, #3730a3); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --bg: #0b0c12; --accent: #818cf8; --accent-ink: #0b0a2a; --accent-soft: #1e1b4b; --slot: #a5b4fc;
  --hdr-grad: linear-gradient(120deg, #0b6f64 0%, #1d4ed8 60%, #5b21b6 100%);
  --rail-grad: linear-gradient(180deg, #0b6f64, #3730a3); } }
.hdr { background: var(--hdr-grad); color: #fff; border-radius: 0 0 22px 22px; padding-bottom: 12px; margin-bottom: 10px; -webkit-backdrop-filter: none; backdrop-filter: none; }
.hdr .icon-btn, .hdr .date-small, .hdr .sync, .hdr #hdrProgress, .hdr #hdrProgress b { color: #fff; }
.hdr .icon-btn:hover { background: rgba(255,255,255,.15); }
.hdr .chip-btn { background: rgba(255,255,255,.22); color: #fff; }
.hdr .shift-chips { background: rgba(255,255,255,.18); }
.hdr .shift-chips button { color: rgba(255,255,255,.85); }
.hdr .shift-chips button.on { background: #fff; color: #3730a3; }
.hdr .ring-bg { stroke: rgba(255,255,255,.3); } .hdr .ring-fg { stroke: #fff; }
.row .bar { width: 5px; border-radius: 0 4px 4px 0; }
.check input:checked { background: var(--c); border-color: var(--c); }
.check svg path { stroke: #fff; }
.slot-name, .section-label { color: var(--slot); }
.tab-btn.active svg { background: var(--accent-soft); border-radius: 10px; padding: 3px 12px; box-sizing: content-box; }
@media (min-width: 900px) {
  .tabbar { background: var(--rail-grad); border: none; }
  .tab-btn { color: rgba(255,255,255,.75); }
  .tab-btn.active { color: #fff; }
  .tab-btn.active svg { background: rgba(255,255,255,.2); }
}

/* ── v6.8 Health tab ── */
.health-add { margin: 2px 0 10px; }
.vgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
@media (min-width: 700px) { .vgrid { grid-template-columns: repeat(4, 1fr); } }
.vtile { position: relative; text-align: left; border: none; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 10px 12px 9px 14px; display: flex; flex-direction: column; gap: 3px; min-height: 104px; overflow: hidden; color: var(--text); }
.vtile::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 5px; background: var(--c); }
.vt-label { font-size: 12px; font-weight: 750; color: var(--c); text-transform: uppercase; letter-spacing: .03em; }
.vt-val { display: flex; align-items: baseline; gap: 4px; flex-wrap: wrap; }
.vt-val b { font-size: 24px; font-weight: 800; letter-spacing: -.02em; }
.vt-val small { font-size: 12px; font-weight: 650; color: var(--text-3); }
.vt-delta { font-size: 11px; font-weight: 700; color: var(--text-2); margin-left: auto; }
.vt-when { font-size: 11px; color: var(--text-3); font-weight: 600; }
.vtile .spark { width: 100%; color: var(--c); margin: 1px 0; }
.empty-tile { justify-content: space-between; background: color-mix(in srgb, var(--c) 7%, var(--surface)); }
.vt-none { font-size: 14px; font-weight: 700; color: var(--c); }
.spark { display: block; width: 100%; overflow: visible; }
.spark-ax { font-size: 10px; fill: var(--text-3); stroke: none; }
.flag-warn, .vt-val.flag-warn b { color: var(--warn) !important; }
.flag-high, .vt-val.flag-high b { color: var(--danger) !important; }
.vrow { display: block; width: 100%; text-align: left; border: none; border-bottom: 1px solid var(--line); background: transparent; color: var(--text); }
.vrow:last-child { border-bottom: none; }
.vrow-when { font-size: 12px; font-weight: 700; color: var(--text-2); margin-bottom: 3px; }
.vrow-vals { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 14px; font-weight: 650; }

/* ── v6.9 Common compounds picker ── */
.preset-disclaimer { margin: 6px 4px 2px; color: var(--text-3); font-size: 12px; line-height: 1.35; }
.preset-row { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-bottom: 1px solid var(--line); cursor: pointer; }
.preset-row:last-child { border-bottom: none; }
.preset-row input { width: 22px; height: 22px; flex: none; accent-color: var(--accent); margin: 0; }
.preset-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.preset-info b { font-size: 15px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.preset-info .tag { font-size: 10.5px; font-weight: 700; color: var(--accent); background: var(--accent-soft); padding: 1px 6px; border-radius: 5px; }
.preset-info .small { font-size: 12px; color: var(--text-2); }
.preset-row.owned { opacity: .5; cursor: default; }
.preset-bar { position: sticky; bottom: calc(-20px - env(safe-area-inset-bottom)); margin: 12px -14px 0; padding: 10px 14px calc(10px + env(safe-area-inset-bottom)); background: var(--bg); border-top: 1px solid var(--line); }
.preset-bar .btn:disabled { opacity: .45; }

/* ── v7.0 Tools: grouped, collapsible sections ── */
.tgroup { overflow: hidden; }
.tsec { border-bottom: 1px solid var(--line); }
.tsec:last-child { border-bottom: none; }
.tsec-head { width: 100%; display: flex; align-items: center; gap: 12px; padding: 11px 14px; border: none; background: transparent; color: var(--text); text-align: left; }
.tsec-ic { width: 34px; height: 34px; border-radius: 10px; flex: none; display: grid; place-items: center; background: color-mix(in srgb, var(--c) 14%, var(--surface)); color: var(--c); }
.tsec-ic svg { width: 19px; height: 19px; }
.tsec-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.tsec-txt b { font-size: 15.5px; font-weight: 700; }
.tsec-txt span { font-size: 12.5px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tsec-chev { color: var(--text-3); transition: transform .2s; }
.tsec-chev svg { width: 18px; height: 18px; }
.tsec.open .tsec-chev { transform: rotate(90deg); color: var(--c); }
.tsec.open .tsec-head { background: color-mix(in srgb, var(--c) 5%, var(--surface)); }
.tsec-body { border-top: 1px solid var(--line); background: var(--surface); }
.tsec-body .cell:last-child { border-bottom: none; }
.tsec-hist .section-label { display: none; }
.tsec-hist .group { box-shadow: none; border-radius: 0; }
.tsec-hist > div[style] { padding-bottom: 10px; }
.install-steps b { color: var(--text); }

/* ── v7.1 Health: compact layouts ── */
.hlist { overflow: hidden; }
.hrow { width: 100%; display: flex; align-items: center; gap: 10px; padding: 0 14px; min-height: 48px; border: none; border-bottom: 1px solid var(--line); background: transparent; color: var(--text); text-align: left; }
.hrow:last-child { border-bottom: none; }
.hdot { width: 9px; height: 9px; border-radius: 50%; background: var(--c); flex: none; }
.hr-label { flex: 1; min-width: 0; font-size: 15px; font-weight: 650; display: flex; flex-direction: column; }
.hr-label small { font-size: 11px; color: var(--text-3); font-weight: 600; margin-top: 1px; }
.hr-spark { width: 56px; flex: none; color: var(--c); }
.hr-val { display: flex; align-items: baseline; gap: 3px; justify-content: flex-end; min-width: 104px; white-space: nowrap; }
.hr-val b, .ht-val b { font-size: 18px; font-weight: 800; letter-spacing: -.01em; }
.hr-val small, .ht-val small { font-size: 11.5px; color: var(--text-3); font-weight: 650; }
.harr { font-style: normal; font-size: 10px; color: var(--text-3); margin-left: 3px; width: 10px; display: inline-block; }
.hnone { font-size: 14px; font-weight: 700; color: var(--c); }
.hgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
@media (min-width: 700px) { .hgrid { grid-template-columns: repeat(4, 1fr); } }
.htile { text-align: left; border: none; background: var(--surface); box-shadow: var(--shadow); border-radius: 12px; padding: 8px 10px 8px 12px; display: flex; flex-direction: column; gap: 1px; color: var(--text); border-left: 4px solid var(--c); min-height: 66px; }
.ht-label { font-size: 11.5px; font-weight: 750; color: var(--c); text-transform: uppercase; letter-spacing: .03em; }
.ht-val { display: flex; align-items: baseline; gap: 3px; }
.ht-when { font-size: 10.5px; color: var(--text-3); font-weight: 600; }
.vmore { width: 100%; border: none; background: transparent; color: var(--accent); font-weight: 700; font-size: 14px; text-align: center; }
@media (max-width: 360px) { .hr-spark { display: none; } .hr-val { min-width: 0; } }
.h-last { font-size: 12px; color: var(--text-3); font-weight: 600; margin: -4px 4px 0; }
.htile { min-height: 54px; }

/* ── v7.2 picker: collapsible groups ── */
.preset-top { display: flex; gap: 8px; align-items: center; }
.preset-top input { flex: 1; min-width: 0; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); font-size: 16px; }
.preset-top .btn { white-space: nowrap; }
.pgroup { margin-top: 8px; }
.pgroup-head { width: 100%; display: flex; align-items: center; gap: 8px; border: none; background: transparent; padding: 8px 4px; color: var(--slot, var(--text-2)); font-size: 12.5px; font-weight: 750; text-transform: uppercase; letter-spacing: .04em; text-align: left; }
.pgroup-head span { flex: 1; }
.pgroup-head em { font-style: normal; font-size: 11.5px; font-weight: 700; color: var(--text-3); background: var(--surface-2); padding: 1px 7px; border-radius: 99px; }
.pgroup-head svg { width: 16px; height: 16px; color: var(--text-3); transition: transform .2s; }
.pgroup.open .pgroup-head svg, .pgroup.searching .pgroup-head svg { transform: rotate(90deg); }
.pgroup-body { display: none; }
.pgroup.open .pgroup-body, .pgroup.searching .pgroup-body { display: block; }
.preset-info .tag-soft { color: var(--text-2); background: var(--surface-2); }
.preset-row.nodose .small { color: var(--text-3); font-style: italic; }
.set-dose { border: none; background: var(--warn-soft); color: var(--warn); font-weight: 700; font-size: 12.5px; padding: 5px 9px; border-radius: 8px; white-space: nowrap; }

/* ── v7.3 delete compound + undo toast ── */
.pc-actions .pc-del { margin-left: auto; color: var(--text-3); padding: 6px 8px; display: grid; place-items: center; }
.pc-actions .pc-del svg { width: 18px; height: 18px; }
.pc-actions .pc-del:hover, .pc-actions .pc-del:active { color: var(--danger); background: var(--danger-soft); }
.toast { display: flex; align-items: center; gap: 12px; }
.toast.hidden { display: none; }
.toast-act { border: none; background: transparent; color: var(--accent-soft); font-weight: 800; font-size: 13px; padding: 0; text-transform: uppercase; letter-spacing: .03em; }

/* ── v7.4 Protocol card icon buttons ── */
.pc-actions { gap: 6px; margin: 10px 0 0; align-items: flex-end; }
.pc-actions .pc-btn { width: 54px; min-height: 48px; padding: 6px 0 4px; display: flex; flex-direction: column; align-items: center; gap: 3px; border: none; border-radius: 12px; background: var(--accent-soft); color: var(--accent); }
.pc-actions .pc-btn svg { width: 20px; height: 20px; }
.pc-actions .pc-btn span { font-size: 10px; font-weight: 700; line-height: 1; white-space: nowrap; }
.pc-actions .pc-btn:hover { background: color-mix(in srgb, var(--accent) 18%, var(--surface)); }
.pc-actions .pc-btn.resume { background: var(--accent); color: var(--accent-ink); }
.pc-actions .pc-btn.pc-del { margin-left: auto; background: var(--surface-2); color: var(--text-3); }
.pc-actions .pc-btn.pc-del:hover, .pc-actions .pc-btn.pc-del:active { background: var(--danger-soft); color: var(--danger); }
.pc-actions .pc-btn.pc-del svg { width: 19px; height: 19px; }

/* ── v7.5 reminders ── */
.push-msg { color: var(--accent); font-weight: 650; }
.field .toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
input[type=time] { min-width: 0; }
.remind-times { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.remind-times input[type=time] { width: 100%; min-width: 0; padding: 8px 4px; font-size: 14px; }
@media (pointer: coarse) { .remind-times input[type=time] { font-size: 16px; } }
.remind-times { grid-template-columns: 1fr; gap: 6px; }
.remind-times .field { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.remind-times .field label { margin: 0; font-size: 14px; color: var(--text); }
.remind-times input[type=time] { width: 150px; flex: none; }

/* ── v7.6 per-compound dose times ── */
.dose-times { display: grid; gap: 6px; }
.dose-times .dt { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 0; }
.dose-times .dt span { font-size: 14px; font-weight: 600; color: var(--text); }
.dose-times input[type=time] { width: 150px; flex: none; }

/* v7.9 schedule pill */
.shift-pill { display: inline-flex; align-items: center; gap: 4px; border: none; background: rgba(255,255,255,.2); color: #fff; font-weight: 700; font-size: 13px; padding: 6px 10px 6px 12px; border-radius: 999px; }
.shift-pill svg { width: 15px; height: 15px; }
.shift-opt { display: flex; align-items: center; width: 100%; text-align: left; background: none; border: none; border-bottom: 1px solid var(--border, rgba(0,0,0,.06)); font: inherit; color: inherit; cursor: pointer; }
.shift-opt .cell-info { flex: 1; }
.shift-opt svg { width: 20px; height: 20px; color: var(--accent, #4f46e5); }
.shift-opt.on b { color: var(--accent, #4f46e5); }

/* v8.1 work schedule label */
.shift-wrap { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; }
.shift-cap { font-size: 10.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: rgba(255,255,255,.75); padding-left: 4px; }

/* v8.2 header design B: brand row + date left + big progress ring */
.hdr-brand { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; min-height: 38px; }
.hdr-brand .icon-btn { justify-self: start; margin-left: -6px; }
.hdr-brand .sync { justify-self: end; margin-right: 2px; font-size: 12px; }
.brand-mark { display: inline-flex; align-items: center; gap: 7px; font-weight: 800; font-size: 18px; letter-spacing: -.01em; }
.brand-logo { width: 26px; height: 26px; border-radius: 8px; background: rgba(255,255,255,.22); display: grid; place-items: center; }
.brand-logo svg { width: 19px; height: 19px; }
.hdr .hdr-row { margin-top: 4px; }
.hdr-main { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 8px; }
.hdr-left { display: flex; flex-direction: column; align-items: flex-start; min-width: 0; }
.hdr-left .date-nav { margin-left: -8px; }
.hdr-left .date-pick { align-items: flex-start; min-width: 0; padding: 0 2px; }
.hdr-left .date-big { font-size: 26px; font-weight: 800; }
.hdr-left .date-small { font-size: 13px; margin: 0 0 0 2px; opacity: .9; }
.hdr-left .shift-pill { margin-top: 10px; }
.big-ring { position: relative; width: 84px; height: 84px; display: block; flex: none; }
.big-ring svg { width: 84px; height: 84px; transform: rotate(-90deg); }
.big-ring circle { fill: none; stroke-width: 3.2; stroke-linecap: round; }
.hdr .big-ring .ring-bg { stroke: rgba(255,255,255,.25); }
.big-ring-txt { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1.05; color: #fff; }
.big-ring-txt b { font-size: 21px; font-weight: 800; color: #fff; }
.big-ring-txt small { font-size: 10px; font-weight: 700; letter-spacing: .05em; opacity: .85; }
@media (max-width: 360px) { .big-ring, .big-ring svg { width: 70px; height: 70px; } .hdr-left .date-big { font-size: 23px; } }

/* v8.3 disclaimer */
.disc-list .cell b { font-size: 15px; }
.disc-ok { width: 100%; margin-top: 12px; padding: 14px; font-size: 16px; }

/* v8.4 terms */
.terms-link { display: block; margin: 12px auto 4px; font-weight: 700; }
.terms-check { display: flex; gap: 10px; align-items: flex-start; margin: 10px 4px 0; font-size: 14px; line-height: 1.35; cursor: pointer; }
.terms-check input { width: 22px; height: 22px; flex: none; margin: 0; accent-color: var(--accent); }
.disc-ok[disabled] { opacity: .45; }
.terms-text { background: var(--surface); border-radius: 14px; padding: 6px 16px 12px; font-size: 14px; line-height: 1.5; }
.terms-text h3 { font-size: 15px; margin: 14px 0 4px; }
.terms-text p { margin: 0 0 8px; color: var(--text-2); }
