/* PepTimer — "chronograph" design system: night-navy track, signal orange, Barlow. */
@font-face { font-family: "Barlow"; src: url("/fonts/Barlow-Regular.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Barlow"; src: url("/fonts/Barlow-SemiBold.woff2") format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Barlow"; src: url("/fonts/Barlow-Bold.woff2") format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Barlow Condensed"; src: url("/fonts/BarlowCondensed-Bold.woff2") format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Barlow Condensed"; src: url("/fonts/BarlowCondensed-ExtraBoldItalic.woff2") format("woff2"); font-weight: 800; font-style: italic; font-display: swap; }

:root {
  --bg: #0D1526;
  --surface: #141E33;
  --surface-2: #1B2742;
  --line: #283754;
  --text: #E9EEF7;
  --muted: #93A0BA;
  --accent: #FF6B2C;
  --accent-ink: #1C0B02;
  --accent-soft: #3A2430;
  --data: #38D3F5;
  --ok: #3DDC97;
  --ok-soft: #133A35;
  --warn: #FFC24B;
  --warn-soft: #3A3226;
  --danger: #FF5C6C;
  --danger-soft: #3D1F30;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: none;
  --font: "Barlow", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --display: "Barlow Condensed", "Arial Narrow", "Barlow", system-ui, sans-serif;
  --serif: var(--display);
  --nav-h: 64px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.55 var(--font); -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-underline-offset: 3px; }
h1, h2, h3 { font-family: var(--display); font-weight: 700; line-height: 1.1; margin: 0 0 .5em; letter-spacing: .005em; }
h1 { font-weight: 800; font-style: italic; font-size: clamp(2rem, 6vw, 2.75rem); letter-spacing: -.005em; }
h2 { font-size: 1.5rem; margin-top: 1.4em; }
h3 { font-size: 1.2rem; }
p { margin: 0 0 .8em; }
.container { width: 100%; max-width: 1040px; margin: 0 auto; padding: 0 16px; }
main.container { padding-top: 24px; padding-bottom: 48px; outline: none; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.num { font-variant-numeric: tabular-nums; }

/* Top bar */
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 20px; padding: 0 20px; height: 60px; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 9px; font-family: var(--display); font-weight: 800; font-style: italic; font-size: 1.55rem; letter-spacing: -.01em; color: var(--text); text-decoration: none; }
.brand-mark { width: 30px; height: 30px; flex: none; display: block; }
.nav { display: flex; gap: 2px; align-items: center; }
.nav a { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: var(--radius-sm); color: var(--muted); text-decoration: none; font-weight: 600; font-size: .95rem; }
.nav a:hover { color: var(--text); background: var(--surface); }
.nav a.active { color: var(--text); background: var(--surface-2); }
.nav a.active .ico { color: var(--accent); }
.nav .ico { width: 20px; height: 20px; flex: none; }
.topbar-end { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.go-premium { font-weight: 700; font-size: .88rem; padding: 6px 12px; border-radius: 99px; color: var(--accent); border: 1px solid color-mix(in srgb, var(--accent) 55%, transparent); text-decoration: none; white-space: nowrap; }
.go-premium:hover { background: var(--accent-soft); }
.avatar { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); color: var(--text); font-family: var(--display); font-weight: 700; font-size: 1.05rem; text-decoration: none; border: 2px solid var(--line); }
.avatar:hover, .avatar.active { border-color: var(--accent); }
.pro-tag { font-family: var(--display); font-weight: 800; font-style: italic; font-size: .85rem; color: var(--accent-ink); background: var(--accent); padding: 1px 7px; border-radius: 6px; }
.menu-btn { display: none; }

/* Mobile: the main sections move to a bottom tab bar */
@media (max-width: 760px) {
  /* no backdrop-filter here: it would make the fixed tab bar position itself inside the top bar */
  .topbar { padding: 0 16px; height: 56px; background: var(--bg); backdrop-filter: none; -webkit-backdrop-filter: none; }
  .topbar .nav { position: fixed; z-index: 20; left: 0; right: 0; bottom: 0; top: auto; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 0; padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); background: color-mix(in srgb, var(--surface) 94%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-top: 1px solid var(--line); }
  .nav a { flex-direction: column; gap: 3px; padding: 6px 2px; font-size: .72rem; font-weight: 600; border-radius: 10px; }
  .nav a.active { background: none; color: var(--text); }
  .nav .ico { width: 24px; height: 24px; }
  body { padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom)); }
  .toast { bottom: calc(var(--nav-h) + 16px + env(safe-area-inset-bottom)) !important; }
}

/* Cards and layout */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-bottom: 16px; }
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.grid-2 { display: grid; gap: 16px; grid-template-columns: 1fr 1fr; }
@media (max-width: 760px) { .grid-2 { grid-template-columns: 1fr; } }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.spread { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.stack > * + * { margin-top: 12px; }
.hero { padding: 8px 0 16px; }
.hero p { max-width: 60ch; font-size: 1.1rem; color: var(--muted); }
.linkcard { display: block; color: inherit; text-decoration: none; transition: border-color .15s; }
.linkcard:hover { border-color: color-mix(in srgb, var(--accent) 60%, var(--line)); }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.stat { font-family: var(--display); font-weight: 800; font-style: italic; font-size: 2.1rem; line-height: 1.05; font-variant-numeric: tabular-nums; }
.prose { white-space: pre-line; }

/* Badges and banners */
.badge { display: inline-block; font-size: .78rem; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--surface-2); color: var(--muted); }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.danger { background: var(--danger-soft); color: var(--danger); }
.badge.accent { background: var(--accent-soft); color: var(--accent); }
.banner { border-radius: var(--radius); padding: 12px 14px; margin-bottom: 16px; border: 1px solid transparent; }
.banner.warn { background: var(--warn-soft); color: var(--text); border-color: color-mix(in srgb, var(--warn) 35%, transparent); }
.banner.danger { background: var(--danger-soft); color: var(--text); border-color: color-mix(in srgb, var(--danger) 35%, transparent); }
.banner.info { background: var(--accent-soft); color: var(--text); }

/* Forms */
form .field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; }
label { font-weight: 600; font-size: .92rem; }
.hint { font-weight: 400; color: var(--muted); font-size: .84rem; }
input, select, textarea { font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 12px; width: 100%; }
input::placeholder, textarea::placeholder { color: color-mix(in srgb, var(--muted) 75%, transparent); }
textarea { min-height: 80px; resize: vertical; }
input:focus, select:focus, textarea:focus, button:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; margin-bottom: 12px; }
.check input { width: auto; margin-top: 4px; }
.fields { display: grid; gap: 0 12px; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; font: inherit; font-weight: 700; padding: 10px 18px; border-radius: var(--radius-sm); border: 1px solid var(--accent); background: var(--accent); color: var(--accent-ink); cursor: pointer; text-decoration: none; }
.btn:hover { filter: brightness(1.08); }
.btn:active { transform: translateY(1px); }
.btn.secondary { background: transparent; color: var(--accent); }
.btn.ghost { background: transparent; color: var(--muted); border-color: var(--line); }
.btn.danger { background: transparent; color: var(--danger); border-color: var(--danger); }
.btn.sm { padding: 6px 12px; font-size: .88rem; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.error { color: var(--danger); font-weight: 600; min-height: 1.2em; }

/* Tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .94rem; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: .84rem; }
td.actions { text-align: right; white-space: nowrap; }

/* Calculator */
.calc-result { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin: 12px 0; }
.calc-result .card { margin: 0; padding: 14px; }
.calc-result .stat { font-size: 1.5rem; }
.syringe { width: 100%; height: auto; display: block; margin-top: 8px; }
.syringe .barrel { fill: var(--surface); stroke: var(--muted); }
.syringe .fill { fill: var(--accent); opacity: .85; }
.syringe .tick { stroke: var(--muted); }
.syringe text { fill: var(--muted); font: 11px var(--font); }

/* Progress and charts */
.progress { height: 8px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--accent); }
.chart { width: 100%; height: auto; }
.chart .grid-line { stroke: var(--line); }
.chart .axis-label { fill: var(--muted); font: 11px var(--font); }
.chart .line { fill: none; stroke: var(--data); stroke-width: 2.5; }
.chart .dot { fill: var(--data); }

.steps { list-style: none; padding: 0; margin: 0; }
.steps li { display: flex; justify-content: space-between; padding: 6px 10px; border-radius: 6px; }
.steps li.current { background: var(--accent-soft); font-weight: 600; }
.titration-row { display: grid; grid-template-columns: 1fr 1fr auto; gap: 8px; margin-bottom: 8px; }

.footer { padding-top: 20px; padding-bottom: 28px; border-top: 1px solid var(--line); color: var(--muted); font-size: .82rem; line-height: 1.5; }
.footer p { max-width: 90ch; }
.toast { position: fixed; z-index: 30; bottom: 20px; left: 50%; transform: translateX(-50%) translateY(20px); background: var(--text); color: var(--bg); font-weight: 600; padding: 10px 16px; border-radius: var(--radius-sm); opacity: 0; pointer-events: none; transition: .2s; max-width: calc(100% - 32px); }
.toast.show { opacity: 1; transform: translateX(-50%); }
.empty { text-align: center; padding: 28px 16px; color: var(--muted); }
.hidden { display: none !important; }
.narrow { max-width: 480px; margin-left: auto; margin-right: auto; }

/* Tabs */
.tabs { display: flex; gap: 4px; padding: 4px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; margin-bottom: 16px; width: fit-content; max-width: 100%; }
.tabs a { padding: 6px 16px; border-radius: 7px; color: var(--muted); text-decoration: none; font-weight: 600; font-size: .92rem; }
.tabs a.active { background: var(--surface-2); color: var(--text); box-shadow: inset 0 -2px 0 var(--accent); }
.center { text-align: center; }
.cap::first-letter { text-transform: uppercase; }

/* Premium */
.premium-mark { font-size: 2rem; color: var(--accent); line-height: 1; }
.feature-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); margin-bottom: 16px; }
.feature-grid .card { padding: 14px; }
.feature-grid h3 { font-size: 1rem; }
.feature-grid .card { margin: 0; }
.plans { display: grid; gap: 12px; margin-bottom: 12px; }
.plan { position: relative; display: grid; grid-template-columns: auto 1fr auto; grid-template-areas: "radio name price" "radio trial sub"; align-items: center; gap: 2px 12px; padding: 16px; border: 1.5px solid var(--line); border-radius: var(--radius); cursor: pointer; font-weight: 400; }
.plan input { grid-area: radio; width: 18px; height: 18px; accent-color: var(--accent); }
.plan-name { grid-area: name; font-weight: 600; font-size: 1.05rem; }
.plan-price { grid-area: price; font-weight: 700; font-size: 1.05rem; text-align: right; }
.plan-sub { grid-area: sub; text-align: right; }
.plan-trial { grid-area: trial; color: var(--accent); font-weight: 600; }
.plan:has(input:checked) { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, var(--surface)); }
.plan .save { position: absolute; top: -10px; right: 12px; background: var(--accent); color: var(--accent-ink); font-size: .75rem; font-weight: 700; padding: 2px 8px; border-radius: 99px; }
.btn.wide { width: 100%; justify-content: center; padding: 12px; font-size: 1.02rem; }

/* Calendar */
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; padding: 10px; }
.cal-head { text-align: center; font-size: .78rem; font-weight: 600; color: var(--muted); padding-bottom: 4px; }
.cal-day { min-height: 64px; display: flex; flex-direction: column; align-items: flex-start; gap: 6px; padding: 6px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--text); font: inherit; cursor: pointer; text-align: left; }
.cal-day[disabled] { cursor: default; opacity: .7; }
.cal-day.empty { border: none; background: none; }
.cal-day.today { border-color: var(--accent); }
.cal-day.today .cal-num { color: var(--accent); font-weight: 700; }
.cal-day.selected { background: var(--accent-soft); }
.cal-num { font-size: .85rem; }
.cal-dots { display: flex; flex-wrap: wrap; gap: 3px; }
.cal-dots span, .legend span span { display: inline-block; width: 9px; height: 9px; border-radius: 50%; }
.dot-taken { background: var(--ok); }
.dot-missed { background: var(--danger); }
.dot-due { background: var(--warn); }
.dot-planned { background: transparent; border: 1.5px solid var(--muted); }
.legend { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; color: var(--muted); }
.legend > span { display: inline-flex; align-items: center; gap: 6px; }
@media (max-width: 520px) { .cal { gap: 2px; padding: 6px; } .cal-day { min-height: 48px; padding: 4px; } .cal-head { font-size: .7rem; } }

/* Chart: reference band */
.chart .band { fill: var(--ok); opacity: .1; }

/* Blend calculator */
.blend-row { display: grid; grid-template-columns: 2fr 1fr auto; gap: 8px; margin-bottom: 8px; }
.top-gap { margin-top: 12px; }

/* Disclaimer dialog */
.disclaimer { max-width: 440px; width: calc(100% - 32px); border: 1px solid var(--line); border-radius: 16px; padding: 24px; background: var(--surface); color: var(--text); box-shadow: 0 20px 60px rgba(0, 0, 0, .3); }
.disclaimer::backdrop { background: rgba(5, 9, 18, .72); backdrop-filter: blur(4px); }
.disclaimer h2 { margin-top: 0; font-size: 1.25rem; }
.disclaimer p { font-size: .95rem; }
.disclaimer .btn { margin-top: 8px; }

/* Library filters */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.chip { font: inherit; font-size: .88rem; font-weight: 600; padding: 6px 12px; border-radius: 99px; border: 1px solid var(--line); background: var(--surface); color: var(--muted); cursor: pointer; }
.chip[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); }
.chip-n { font-weight: 400; opacity: .75; font-variant-numeric: tabular-nums; }

/* Fact sheet */
.sheet-head .lede { font-size: 1.12rem; line-height: 1.55; max-width: 62ch; margin-top: 4px; }
.quick .eyebrow { font-family: var(--display); font-size: 1.05rem; font-weight: 700; color: var(--muted); margin: 0 0 10px; }
.quick .kv { margin-bottom: 12px; }
.chip-link { display: inline-block; padding: 4px 10px; border-radius: 99px; background: var(--accent-soft); color: var(--accent); text-decoration: none; font-weight: 600; }
.chip-link:hover { text-decoration: underline; }
.sheet { display: grid; gap: 4px; margin: 8px 0 16px; }
.sheet-section { padding: 14px 0; border-bottom: 1px solid var(--line); max-width: 68ch; }
.sheet-section:last-child { border-bottom: 0; }
.sheet-section h2 { font-size: 1.15rem; margin: 0 0 8px; }
.sheet-section p { margin: 0; }
.bullets { margin: 0; padding-left: 1.2em; display: grid; gap: 6px; }
.bullets li::marker { color: var(--accent); }

/* Supplies */
.meter { height: 10px; background: var(--surface-2); border-radius: 99px; overflow: hidden; margin: 8px 0 12px; }
.meter > span { display: block; height: 100%; background: var(--accent); }
.vial .kv { margin-bottom: 10px; }
.vial .row { margin-top: 8px; }

/* Insights */
.chart .step-a { fill: var(--accent); opacity: .07; }
.chart .step-b { fill: var(--accent); opacity: .14; }
.chart .event line { stroke: var(--warn); stroke-width: 1.5; }
.chart .event circle { fill: var(--warn); }
.chart .event.severe line { stroke: var(--danger); }
.chart .event.severe circle { fill: var(--danger); }
.leg-line { display: inline-block; width: 16px; height: 3px; background: var(--accent); border-radius: 2px; }
.leg-band { display: inline-block; width: 14px; height: 10px; background: var(--accent-soft); border-radius: 2px; }
.wbars { display: grid; grid-template-columns: repeat(12, 1fr); gap: 6px; height: 90px; align-items: end; margin: 8px 0 12px; }
.wbar { height: 100%; display: flex; align-items: flex-end; background: var(--surface-2); border-radius: 4px; overflow: hidden; }
.wbar span { display: block; width: 100%; }
.wbar .full { background: var(--ok); }
.wbar .part { background: var(--warn); }
.wbar .zero { background: var(--danger); }
.wbar .none { background: var(--line); }
.narrow-field { max-width: 320px; }

/* Doctor report */
.report { padding: 24px; }
.report-head { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; border-bottom: 2px solid var(--text); padding-bottom: 12px; margin-bottom: 8px; }
.report-head h2 { margin: 6px 0 0; }
.report-brand { font-size: 1rem; }
.report section { padding: 12px 0; border-bottom: 1px solid var(--line); }
.report section h3 { margin: 0 0 8px; font-size: 1.05rem; }
.report-block { margin-bottom: 10px; }
.report-block h4 { margin: 0 0 4px; font-size: .98rem; }
.report-block p { margin: 0 0 2px; }
.report footer { padding-top: 12px; }
@media print {
  @page { margin: 14mm; }
  .topbar, .footer, .no-print, .toast, .demo-bar, #disclaimer { display: none !important; }
  body { background: #fff; color: #111; padding: 0 !important; }
  main.container { padding: 0; max-width: none; }
  .report { border: 0; box-shadow: none; padding: 0; }
  .report section { break-inside: avoid; }
  .badge, .banner { border: 1px solid #999; }
}
@media print {
  :root:not(#print), :root[data-theme="dark"]:not(#print) {
    --bg: #fff; --surface: #fff; --surface-2: #f1f3f2; --text: #111; --muted: #555; --line: #cfd4d2;
    --accent: #C2410C; --accent-ink: #fff; --accent-soft: #fde8dc; --data: #0e7490; --ok: #1f7a46; --ok-soft: #e1f2e7;
    --warn: #9a5b00; --warn-soft: #fbefd9; --danger: #b0322a; --danger-soft: #f8e1df; color-scheme: light;
  }
}

/* Compound management enhancements */
.compound-extra { margin: 14px 0; border: 1px solid var(--line); border-radius: 12px; padding: 14px; }
.compound-extra summary { cursor: pointer; font-weight: 650; padding: 3px 0; }
.compound-extra[open] summary { margin-bottom: 15px; }
.compound-chips { display: flex; flex-wrap: wrap; gap: 9px; margin: 12px 0; }
.compound-chip { position: relative; cursor: pointer; }
.compound-chip input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.compound-chip span, .compound-display-chip { display: inline-block; padding: 9px 13px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface-2); color: var(--text); font-size: .93rem; }
.plain-fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
.plain-fieldset legend { font-weight: 600; font-size: .92rem; padding: 0; }
.chart.decay { max-width: 560px; }
.compound-chip input:checked + span { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }
.compound-chip input:focus-visible + span { outline: 3px solid var(--accent); outline-offset: 2px; }

/* Consistent source-labelled dosing detail layout */
.dosage-guide{border:1px solid var(--line);border-radius:14px;padding:18px;margin:18px 0}
.dosage-guide .spread{gap:12px;flex-wrap:wrap}
.dosage-overview{display:grid;grid-template-columns:repeat(auto-fit,minmax(150px,1fr));gap:12px;margin:16px 0}
.dosage-overview>div{background:var(--surface-2);border:1px solid var(--line);border-radius:10px;padding:12px;overflow-wrap:anywhere}
.dosage-overview strong,.dosage-overview span{display:block}.dosage-overview strong{margin-top:6px}
.dosage-schedule{padding:12px 0;border-bottom:1px solid var(--line)}
.dosage-schedule .btn{margin-top:8px}
.dosage-extra{margin-top:16px;padding:12px;border-radius:10px;border:1px solid var(--line)}
.dosage-extra summary{font-weight:700;cursor:pointer}
.third-party-ref { margin-top: 1rem; }

/* ---------- Dose dial (the signature element) */
.dial { display: block; max-width: 100%; height: auto; }
.dial-seg { fill: none; stroke: var(--surface-2); stroke-width: 16; stroke-linecap: butt; }
.dial-seg.on { stroke: var(--accent); }
.dial-num { font-family: var(--display); font-weight: 800; font-style: italic; font-size: 64px; fill: var(--text); font-variant-numeric: tabular-nums; }
.dial-of { fill: var(--muted); font-size: 34px; }
.dial-label { font-family: var(--font); font-weight: 600; font-size: 15px; fill: var(--muted); }
@media (prefers-reduced-motion: no-preference) {
  .today .dial-seg.on { animation: seg-in .5s ease-out both; }
  @keyframes seg-in { from { stroke-opacity: 0; } }
}

/* ---------- Landing (logged out) */
.landing { display: grid; grid-template-columns: 1.3fr 1fr; gap: 32px; align-items: center; padding: 24px 0 40px; }
.landing .display { font-size: clamp(2.8rem, 8vw, 4.75rem); line-height: .95; margin-bottom: 18px; }
.landing p { font-size: 1.15rem; color: var(--muted); max-width: 52ch; margin-bottom: 24px; }
.landing-dial { justify-self: center; }
.features { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); border-top: 1px solid var(--line); }
.features a { display: grid; align-content: start; gap: 6px; padding: 22px 20px 22px 0; color: var(--text); text-decoration: none; height: 100%; }
.features li + li a { padding-left: 20px; border-left: 1px solid var(--line); }
.features .ico { width: 28px; height: 28px; color: var(--accent); }
.features strong { font-family: var(--display); font-size: 1.35rem; }
.features span { color: var(--muted); font-size: .95rem; }
.features a:hover strong { color: var(--accent); }
@media (max-width: 760px) {
  .landing { grid-template-columns: 1fr; gap: 8px; padding-top: 8px; }
  .landing-dial { order: -1; width: 180px; }
  .features { grid-template-columns: 1fr; }
  .features li + li a { padding-left: 0; border-left: 0; border-top: 1px solid var(--line); }
}

/* ---------- Today */
.today-head { align-items: baseline; }
.today-head h1 { margin-bottom: 12px; }
.today { display: grid; grid-template-columns: auto 1fr; gap: 28px; align-items: center; padding: 22px; }
.today-dial { width: 180px; }
.dose-list { list-style: none; margin: 0 0 8px; padding: 0; }
.dose-row { display: grid; grid-template-columns: 1fr auto auto; gap: 16px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); }
.dose-row:first-child { padding-top: 0; }
.dose-row:last-child { border-bottom: 0; }
.dose-main { display: grid; color: var(--text); text-decoration: none; min-width: 0; }
.dose-main strong { font-size: 1.05rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dose-main:hover strong { color: var(--accent); }
.dose-amt { font-family: var(--display); font-weight: 700; font-size: 1.5rem; white-space: nowrap; }
.dose-amt small { font-family: var(--font); font-size: .8rem; color: var(--muted); font-weight: 600; }
.dose-row .btn { min-width: 84px; }
.dose-row.done .dose-main strong, .dose-row.done .dose-amt { color: var(--muted); }
.done-mark { min-width: 84px; text-align: center; font-weight: 700; font-size: .9rem; color: var(--ok); }
.rest { font-family: var(--display); font-size: 1.4rem; color: var(--muted); }
.stat-strip { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 16px; }
.stat-strip a { display: grid; gap: 2px; padding: 14px 16px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); color: var(--text); text-decoration: none; }
.stat-strip a:hover { border-color: color-mix(in srgb, var(--accent) 60%, var(--line)); }
.stat-strip .stat { font-size: 1.9rem; }
.start h2 { margin-top: 0; }
@media (max-width: 760px) {
  .today { grid-template-columns: 1fr; gap: 16px; padding: 18px; }
  .today-dial { width: 160px; justify-self: center; }
  .dose-row { gap: 10px; }
  .dose-amt { font-size: 1.25rem; }
  .dose-row .btn, .done-mark { min-width: 72px; }
  .stat-strip { gap: 8px; }
  .stat-strip a { padding: 12px; }
  .stat-strip .stat { font-size: 1.5rem; }
}

/* ---------- Library cards: scan first, details on the fact sheet */
.grid > .card { margin: 0; }
.lede-sm { max-width: 60ch; }

/* Headings that link stay quiet; the orange is reserved for actions */
h1 a, h2 a, h3 a { color: inherit; text-decoration: none; }
h1 a:hover, h2 a:hover, h3 a:hover { color: var(--accent); }
.chip[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.chip[aria-pressed="true"] .chip-n { opacity: .7; }

/* ---------- Invites */
.invite-banner { padding: 14px 16px; margin-bottom: 16px; border-radius: var(--radius); background: color-mix(in srgb, var(--accent) 14%, var(--surface)); border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent); }
.invite { padding: 22px; }
.invite-lede { font-size: 1.1rem; max-width: 52ch; margin-bottom: 18px; }
.invite-link { display: flex; gap: 8px; margin: 6px 0 10px; }
.invite-link input { flex: 1; min-width: 0; font-variant-numeric: tabular-nums; }
.invite-link .btn { flex: none; }
.invite-code { font-family: var(--display); font-size: 1.15rem; letter-spacing: .06em; color: var(--text); }
.stat-strip > div { display: grid; gap: 2px; padding: 14px 16px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); }
.invite-cta { display: grid; gap: 2px; }
.invite-cta strong { font-family: var(--display); font-size: 1.2rem; }
.invite-cta strong::after { content: " \2192"; color: var(--accent); }
@media (max-width: 520px) { .invite-link { flex-direction: column; } }

/* ---------- Protocol colours */
.c-blue { --pc: #4C9BFF; } .c-green { --pc: #3DDC97; } .c-violet { --pc: #A87BFF; } .c-amber { --pc: #FFC24B; }
.c-pink { --pc: #FF6FB5; } .c-teal { --pc: #2DD4BF; } .c-orange { --pc: #FF8A3D; }
.pdot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--pc, var(--muted)); margin-right: 8px; vertical-align: .08em; flex: none; }
.pdot.big { width: 14px; height: 14px; margin-right: 10px; vertical-align: .18em; }
.pcard { border-left: 3px solid var(--pc); }
.swatches { display: flex; flex-wrap: wrap; gap: 10px; margin: 6px 0 4px; }
.swatch { position: relative; cursor: pointer; }
.swatch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.swatch span { display: block; width: 32px; height: 32px; border-radius: 50%; background: var(--pc); border: 3px solid var(--surface); box-shadow: 0 0 0 1px var(--line); }
.swatch input:checked + span { box-shadow: 0 0 0 2px var(--text); }
.swatch input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 3px; }
.colour-pick { margin: 4px 0 12px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* ---------- Today: next dose and week strip */
.next { display: grid; gap: 4px; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.dose-list + .next, .rest + .next { margin-top: 4px; }
.rest + .next { border-top: 0; padding-top: 0; }
.next-when { font-family: var(--display); font-size: 1.5rem; }
.next ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.week { list-style: none; margin: 0 0 16px; padding: 10px 6px; display: grid; grid-template-columns: repeat(7, 1fr); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.week li { display: grid; justify-items: center; gap: 2px; padding: 4px 0; border-radius: 10px; }
.wk-day { font-size: .72rem; color: var(--muted); font-weight: 600; }
.wk-num { font-family: var(--display); font-weight: 700; font-size: 1.15rem; }
.wk-dot { width: 8px; height: 8px; border-radius: 50%; background: transparent; }
.wk-done .wk-dot { background: var(--ok); }
.wk-partial .wk-dot { background: var(--warn); }
.wk-missed .wk-dot { background: var(--danger); }
.wk-planned .wk-dot { box-shadow: inset 0 0 0 1.5px var(--muted); }
.wk-today { background: var(--surface-2); }
.wk-today .wk-num { color: var(--accent); }
.wk-today:not(.wk-done) .wk-dot { box-shadow: inset 0 0 0 1.5px var(--accent); }
.today-actions { margin: 4px 0 16px; }
.upcoming-line { margin: -6px 0 16px; }

/* ---------- Journal */
.journal { list-style: none; margin: 0; padding: 0; }
.j-entry .prose { margin: 8px 0; }
.j-prot { font-size: .85rem; color: var(--muted); display: inline-flex; align-items: center; }
.journal-tools { display: grid; gap: 10px; }
.journal-tools .chips { margin: 0; }

/* ---------- Levels */
.chart .lv-line { fill: none; stroke: var(--pc); stroke-width: 2.25; stroke-linejoin: round; }
.chart .lv-proj { fill: none; stroke: var(--pc); stroke-width: 1.75; stroke-dasharray: 4 4; opacity: .7; }
.chart .now-line { stroke: var(--muted); stroke-dasharray: 2 4; }
.leg-swatch { display: inline-block; width: 16px; height: 3px; border-radius: 2px; background: var(--pc); }
.leg-dash { display: inline-block; width: 16px; height: 0; border-top: 2px dashed var(--muted); vertical-align: middle; }
.lv-card .stat { margin-top: 6px; }
.tabs { overflow-x: auto; scrollbar-width: none; }
.tabs a { white-space: nowrap; }
.tabs.seg { margin: 0; }
.tabs.seg a { padding: 4px 12px; }

/* ---------- Welcome tour */
.welcome { position: relative; max-width: 460px; margin: 0 auto; min-height: calc(100dvh - 240px); display: grid; grid-template-rows: auto 1fr auto auto; gap: 18px; text-align: center; padding-top: 8px; }
.welcome-skip { justify-self: end; background: none; border: 0; color: var(--muted); font: inherit; font-weight: 600; cursor: pointer; padding: 6px 4px; }
.welcome-slide { display: grid; align-content: center; gap: 10px; }
.welcome-slide h1 { font-size: clamp(2.2rem, 9vw, 3rem); margin: 0; }
.welcome-brand { font-size: clamp(3rem, 14vw, 4.5rem) !important; }
.welcome-slide p { color: var(--muted); font-size: 1.1rem; margin: 0 auto; max-width: 34ch; }
.welcome-art { display: grid; place-items: center; min-height: 230px; }
.welcome-art .dial, .welcome-art .chart { width: 100%; max-width: 360px; }
.welcome-logo { width: 120px; height: 120px; }
.w-cards { display: grid; gap: 10px; width: 100%; max-width: 320px; }
.w-card { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 14px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); text-align: left; }
.w-calc { display: grid; gap: 4px; justify-items: center; padding: 24px 32px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.w-calc .stat { font-size: 2.6rem; }
.accent-num { color: var(--accent); }
.welcome-dots { display: flex; justify-content: center; gap: 6px; }
.welcome-dots span { width: 8px; height: 6px; border-radius: 3px; background: var(--line); transition: width .2s; }
.welcome-dots span.on { width: 24px; background: var(--text); }
.welcome-actions { display: grid; gap: 10px; padding-bottom: 8px; }
@media (prefers-reduced-motion: reduce) { .welcome-dots span { transition: none; } }
.chart .lv-short .lv-line { stroke-width: 1.25; opacity: .55; }

/* ---------- Protocol form assistant */
.assist { margin: 4px 0 16px; padding: 12px 14px; border-radius: var(--radius-sm); background: var(--surface-2); border: 1px solid var(--line); }
.assist p { margin: 4px 0 0; }
.assist-options { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 4px; }
.mix-calc { margin: -4px 0 16px; }
.mix-result { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; padding: 12px 14px; border-radius: var(--radius-sm); background: color-mix(in srgb, var(--accent) 10%, var(--surface)); border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent); }
.mix-result .stat { color: var(--accent); }
.step-units { margin-top: 8px; width: 100%; }
.step-units th, .step-units td { padding: 4px 8px; text-align: left; }
.step-units td + td, .step-units th + th { text-align: right; }
.warn-text { color: var(--warn); margin: 6px 0 0; }
.pep-pick { max-width: 420px; }

/* ---------- Vial / pen / other */
.form-pick { margin: 0 0 14px; }
.seg-choice { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 6px; }
.seg-choice label { position: relative; cursor: pointer; font-weight: 400; }
.seg-choice input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.seg-choice span { display: grid; gap: 2px; height: 100%; padding: 10px 12px; border-radius: var(--radius-sm); border: 1.5px solid var(--line); background: var(--bg); }
.seg-choice small { color: var(--muted); font-size: .8rem; }
.seg-choice input:checked + span { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, var(--surface)); }
.seg-choice input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.pen-note:empty { display: none; }
@media (max-width: 520px) { .seg-choice { grid-template-columns: 1fr; } .seg-choice span { grid-template-columns: auto 1fr; align-items: baseline; gap: 8px; } }

/* ---------- Step-ups */
.step-summary:empty { display: none; }
.step-summary { margin: 0 0 10px; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--surface-2); }
.step-builder { margin-top: 12px; }
.step-up { display: inline-block; margin-top: 4px; font-size: .8rem; font-weight: 700; color: var(--accent); }
.step-up.now { color: var(--ok); }
.stepup { list-style: none; margin: 4px 0 12px; padding: 0; display: grid; gap: 0; }
.stepup li { display: grid; grid-template-columns: 110px 1fr; align-items: baseline; gap: 12px; padding: 8px 0 8px 18px; position: relative; border-left: 2px solid var(--line); margin-left: 6px; }
.stepup li::before { content: ""; position: absolute; left: -7px; top: 13px; width: 12px; height: 12px; border-radius: 50%; background: var(--bg); border: 2px solid var(--line); }
.stepup li.done::before { background: var(--muted); border-color: var(--muted); }
.stepup li.current::before { background: var(--accent); border-color: var(--accent); }
.stepup li.current .stepup-dose { color: var(--accent); }
.stepup-dose { font-family: var(--display); font-weight: 700; font-size: 1.2rem; }
.stepup li.done .stepup-dose { color: var(--muted); }
.preset-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 10px; }
.preset-row .chip[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }

/* ---------- One-tap logging on the protocol page */
.log-card { display: grid; gap: 8px; }
.log-card .btn.wide { padding: 14px; font-size: 1.1rem; }
.log-more { justify-content: center; }
.logged-msg { font-family: var(--display); font-size: 1.4rem; color: var(--ok); margin: 0; text-align: center; }
.tabs.sub { margin-top: -6px; }

/* ---------- Protocol form: plan summary */
.start-field { max-width: 260px; }
.plan-card { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 16px; margin: 4px 0 12px; border-radius: var(--radius-sm); background: var(--surface-2); border: 1px solid var(--line); }
.plan-card > div { display: grid; gap: 2px; }
.plan-card strong { font-family: var(--display); font-size: 1.35rem; }
.plan-fields { margin-bottom: 8px; }
.more-settings { margin-top: 16px; }

/* ---------- Step-ups in the form: readable list, editor on demand */
.step-list { list-style: none; margin: 4px 0 6px; padding: 0; border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; }
.step-list li { display: flex; justify-content: space-between; gap: 12px; padding: 10px 14px; border-top: 1px solid var(--line); }
.step-list li:first-child { border-top: 0; }
.step-list li.last strong { color: var(--accent); }
.step-list strong { font-family: var(--display); font-size: 1.15rem; }
.step-editor { margin-top: 12px; }
.step-head { display: grid; grid-template-columns: 1fr 1fr auto; gap: 8px; margin-bottom: 4px; padding-right: 44px; }
.plan-line2 { color: var(--muted); } .plan-line2:empty { display: none; }
.invite-btn { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: 99px; color: var(--text); text-decoration: none; font-weight: 700; font-size: .88rem; border: 1px solid var(--line); }
.invite-btn svg { width: 18px; height: 18px; color: var(--accent); }
.invite-btn:hover, .invite-btn.active { border-color: var(--accent); }
@media (max-width: 420px) { .invite-btn span { display: none; } .invite-btn { padding: 7px; } }
.lab-info { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; margin: 6px 0 10px; color: var(--muted); }
.coa-ok { color: var(--ok); font-weight: 700; text-decoration: none; }
.coa-ok:hover { text-decoration: underline; }
.coa-missing { color: var(--warn); }

/* ---------- Member card */
.member-card { position: relative; overflow: hidden; display: grid; gap: 4px; max-width: 420px; aspect-ratio: 1.6; padding: 20px 22px; margin-bottom: 16px; border-radius: 20px; color: var(--text);
  background: radial-gradient(120% 90% at 100% 0%, color-mix(in srgb, var(--accent) 45%, transparent), transparent 60%), linear-gradient(160deg, #1D2C4D, #0B1222 70%); border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--line)); }
.member-card.compact { max-width: 300px; padding: 16px 18px; border-radius: 16px; margin: 0 auto 12px; }
.mc-art { position: absolute; right: -40px; bottom: -50px; width: 220px; height: 220px; opacity: .08; }
.mc-top { display: flex; justify-content: space-between; align-items: center; }
.mc-logo { width: 26px; height: 26px; }
.mc-tag { font-size: .78rem; font-weight: 700; padding: 3px 10px; border-radius: 99px; background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.14); }
.mc-label { margin-top: auto; font-size: .82rem; color: var(--muted); }
.mc-day { font-family: var(--display); font-weight: 800; font-style: italic; font-size: 3.6rem; line-height: .9; }
.mc-day span { font-size: 1.6rem; margin-right: 8px; }
.member-card.compact .mc-day { font-size: 2.6rem; }
.mc-bottom { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-top: 6px; font-size: .85rem; color: var(--muted); }
.mc-bottom strong { color: var(--text); font-size: 1rem; }
.invite-head { margin-bottom: 4px; }
.goals-cta { display: grid; gap: 2px; }
.goals-cta strong { font-family: var(--display); font-size: 1.2rem; }

/* ---------- Goals */
.setup { padding-top: 8px; }
.setup h1 { font-size: clamp(2rem, 7vw, 2.6rem); }
.goal-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 18px 0 20px; }
.goal { display: flex; align-items: center; gap: 10px; padding: 16px 14px; border-radius: var(--radius); border: 1.5px solid var(--line); background: var(--surface); color: var(--text); font: inherit; font-weight: 700; text-align: left; cursor: pointer; }
.goal-ico { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 8px; background: var(--surface-2); color: var(--accent); font-size: 1rem; }
.goal[aria-pressed="true"] { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, var(--surface)); }
.goal[aria-pressed="true"] .goal-ico { background: var(--accent); color: var(--accent-ink); }
.setup .btn.wide + .btn.wide { margin-top: 8px; }
.goal-line { margin: 0 0 10px; }

/* ---------- Welcome: chat art */
.w-chat { display: grid; gap: 8px; width: 100%; max-width: 320px; text-align: left; }
.w-q { justify-self: end; max-width: 85%; padding: 10px 14px; border-radius: 16px 16px 4px 16px; background: var(--surface-2); }
.w-a { max-width: 85%; padding: 10px 14px; border-radius: 16px 16px 16px 4px; background: var(--surface); border: 1px solid var(--line); }
.w-chat .badge { justify-self: end; }

/* ---------- Deleting things */
.entries { list-style: none; margin: 0; padding: 0; }
.entries li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.entries li:first-child { border-top: 0; padding-top: 0; }
.entries li > div { display: grid; gap: 2px; min-width: 0; }
.icon-del { flex: none; width: 36px; height: 36px; border-radius: 10px; border: 1px solid var(--line); background: transparent; color: var(--muted); font: inherit; cursor: pointer; }
.icon-del:hover { color: var(--danger); border-color: var(--danger); }
.danger-text { color: var(--danger) !important; }
.head-actions { margin: -4px 0 8px; gap: 8px; }
.card-actions { margin-top: 8px; gap: 8px; }
.form-actions { gap: 10px; }
.done-wrap { display: inline-grid; justify-items: center; gap: 0; min-width: 72px; }
.undo { background: none; border: 0; color: var(--muted); font: inherit; font-size: .78rem; text-decoration: underline; cursor: pointer; padding: 2px; }
.undo:hover { color: var(--text); }
.welcome .member-card { text-align: left; margin: 0 auto; width: 100%; }
.pub-steps li { display: grid; grid-template-columns: 1fr auto 76px; align-items: baseline; gap: 10px; }
.pub-steps li span:last-child { text-align: right; }
.dosage-schedule.published .btn { margin-top: 8px; }

/* ---------- Library list: alphabetical, grouped by letter */
.lib-tools { position: sticky; top: 60px; z-index: 5; background: var(--bg); padding: 8px 0 10px; margin: 4px 0 6px; display: grid; gap: 10px; }
.lib-tools input { width: 100%; background: var(--surface); }
.lib-chips { flex-wrap: nowrap; overflow-x: auto; margin: 0; scrollbar-width: none; }
.lib-chips::-webkit-scrollbar { display: none; }
.lib-chips .chip { flex: none; }
.lib-count { margin: 4px 0 0; color: var(--muted); font-size: .85rem; }
.lib-group { margin-top: 18px; }
.lib-letter { font-size: 1.05rem; color: var(--accent); margin: 0 0 8px; padding-bottom: 6px; border-bottom: 1px solid var(--line); letter-spacing: .04em; }
.lib-rows { display: grid; gap: 8px; }
@media (min-width: 760px) { .lib-rows { grid-template-columns: 1fr 1fr; } }
.lib-row { display: grid; grid-template-columns: minmax(0, 1fr) auto 16px; grid-template-areas: "name side chev" "alias alias chev" "sum sum chev"; align-items: center; column-gap: 10px; row-gap: 2px; padding: 12px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; color: inherit; text-decoration: none; min-width: 0; align-content: center; transition: border-color .15s; }
.lib-row:hover { border-color: color-mix(in srgb, var(--accent) 60%, var(--line)); }
.lib-name { grid-area: name; font-family: 'Barlow Condensed', var(--font, sans-serif); font-weight: 700; font-size: 1.12rem; line-height: 1.2; min-width: 0; }
.lib-alias, .lib-sum { font-size: .82rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.lib-alias { grid-area: alias; color: var(--muted); }
.lib-sum { grid-area: sum; color: color-mix(in srgb, var(--muted) 80%, transparent); }
.lib-side { grid-area: side; display: flex; align-items: center; gap: 8px; align-self: start; }
.lib-chev { grid-area: chev; }
.lib-tag { font-size: .72rem; font-weight: 700; padding: 3px 8px; border-radius: 99px; white-space: nowrap; }
.lib-tag.ok { color: #3ddc97; background: rgba(61, 220, 151, .12); }
.lib-tag.warn { color: #f5b942; background: rgba(245, 185, 66, .12); }
.lib-tag.blend { color: #8fb3ff; background: rgba(143, 179, 255, .12); }
.lib-proto { font-size: .72rem; color: var(--accent); font-weight: 600; white-space: nowrap; }
.lib-chev { width: 16px; height: 16px; fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
@media (max-width: 760px) { .lib-tools { top: 56px; } }
@media (max-width: 520px) { .lib-row { padding: 11px 12px; column-gap: 10px; } }

/* ---------- Calculator: schedule with units per step */
.calc-plan h3 { margin: 0 0 4px; }
.calc-steps li { display: grid; grid-template-columns: 1fr auto 96px; align-items: baseline; gap: 10px; cursor: pointer; }
.calc-steps li:hover { background: color-mix(in srgb, var(--accent) 6%, transparent); }
.calc-steps li.on { background: var(--accent-soft); }
.calc-u { text-align: right; color: var(--muted); }
.calc-u b { color: var(--text); font-size: 1.1rem; }
.calc-steps li.on .calc-u b { color: var(--accent); }
#cvials { align-items: center; margin-top: 4px; }

/* "Already taking it?" on the protocol form */
.now-box { margin: -4px 0 14px; padding: 12px 16px; border: 1px dashed var(--line); border-radius: var(--radius-sm); }
.now-box p { margin: 0 0 8px; }
.now-box .chips { margin: 0; }
.now-box #nowWeeks { margin: 10px 0 0; display: flex; align-items: center; gap: 8px; }
.now-box #nowWeeks.hidden { display: none; }
.now-box select { width: auto; padding: 6px 10px; }

/* ---------- Progress photos */
.photo-actions { margin: 4px 0 16px; }
.photo-actions .btn { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.photo-actions .ico { width: 18px; height: 18px; }
.ph-new { display: grid; grid-template-columns: minmax(0, 220px) minmax(0, 1fr); gap: 18px; align-items: start; }
.ph-new img { width: 100%; border-radius: var(--radius-sm); background: var(--bg); }
@media (max-width: 560px) { .ph-new { grid-template-columns: minmax(0, 1fr); } .ph-new img { max-height: 38vh; object-fit: contain; } }
.chip-radio { display: inline-flex; cursor: pointer; }
.chip-radio { position: relative; }
.chip-radio input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; pointer-events: none; }
.chip-radio span { font-size: .88rem; font-weight: 600; padding: 6px 12px; border-radius: 99px; border: 1px solid var(--line); background: var(--surface); color: var(--muted); }
.chip-radio input:checked + span { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.chip-radio input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 1px; }
.ph-compare h2 { margin: 0; }
.ph-compare .chips { margin: 0; }
.ph-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.ph-pair figure { margin: 0; display: grid; gap: 8px; }
.ph-pair img { width: 100%; aspect-ratio: 3 / 4; object-fit: cover; border-radius: var(--radius-sm); background: var(--bg); height: auto; }
.ph-pair select { width: 100%; padding: 6px 8px; font-size: .9rem; }
.ph-gap { text-align: center; margin: 10px 0 0; font-family: var(--display); font-size: 1.15rem; color: var(--accent); }
.ph-grid { list-style: none; margin: 8px 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.ph-thumb { all: unset; display: grid; gap: 6px; cursor: pointer; width: 100%; }
.ph-thumb img { width: 100%; aspect-ratio: 3 / 4; object-fit: cover; border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--surface); height: auto; }
.ph-thumb span { font-size: .8rem; color: var(--muted); }
.ph-thumb:focus-visible img, .ph-thumb:hover img { border-color: var(--accent); }
.ph-dialog { padding: 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--text); width: min(560px, 94vw); }
.ph-dialog::backdrop { background: rgba(5, 9, 18, .8); }
.ph-dlg-body { display: grid; gap: 12px; padding: 12px; }
.ph-full { width: 100%; max-height: 70vh; object-fit: contain; border-radius: var(--radius-sm); background: var(--bg); height: auto; }
.pro-mini { font-family: var(--display); font-weight: 800; font-style: italic; font-size: .72rem; color: var(--accent-ink); background: var(--accent); padding: 0 5px; border-radius: 4px; margin-left: 4px; }

/* ---------- Course & break */
.cycle-card h3 { margin: 0; }
.cycle-card .progress { margin: 10px 0 6px; }

/* ---------- Injection site map */
.site-card h3 { margin: 0; }
.site-wrap { display: grid; grid-template-columns: minmax(120px, 170px) 1fr; gap: 18px; align-items: center; margin: 10px 0; }
.site-svg { width: 100%; height: auto; max-height: 300px; }
.site-svg .body > * { fill: var(--surface-2); stroke: var(--line); stroke-width: 1.5; }
.site-dot { cursor: pointer; outline: none; }
.site-dot circle:not(.ring) { stroke: var(--bg); stroke-width: 2; }
.site-dot .ring { fill: transparent; stroke: transparent; stroke-width: 2.5; }
.site-dot.on .ring, .site-dot:focus-visible .ring { stroke: var(--accent); }
.site-dot.rested circle:not(.ring), .sdot.rested { fill: #3ddc97; background: #3ddc97; }
.site-dot.resting circle:not(.ring), .sdot.resting { fill: #f5b942; background: #f5b942; }
.site-dot.recent circle:not(.ring), .sdot.recent { fill: #ff5d5d; background: #ff5d5d; }
.sdot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; vertical-align: middle; margin: 0 2px 0 6px; }
.site-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.site-list li { border-radius: 8px; font-size: .92rem; }
.site-row { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 8px; width: 100%; padding: 8px 8px; border: 0; border-radius: 8px; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.site-row:hover { background: var(--surface-2); }
.site-row:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.site-svg .body .hair { fill: var(--line); }
.site-list li .sdot { margin: 0; }
.site-list li.on { background: var(--accent-soft); font-weight: 600; }
.site-teaser { margin: 8px 0 0; }
@media (max-width: 520px) { .site-wrap { grid-template-columns: 120px 1fr; gap: 12px; } .site-list li { font-size: .86rem; } .site-row { padding: 7px 6px; } }

/* ---------- Side effects & dose */
.se-chart h3 { margin: 0 0 6px; }
.se-dose { fill: color-mix(in srgb, var(--muted) 45%, transparent); }
.se-dot { stroke: var(--surface); stroke-width: 2; }
.se-dot.sev-1, .se-dot.sev-2 { fill: #f5b942; }
.se-dot.sev-3 { fill: #ff8a3d; }
.se-dot.sev-4, .se-dot.sev-5 { fill: #ff5d5d; }
.se-key { display: inline-block; width: 10px; height: 10px; vertical-align: middle; margin: 0 4px 0 8px; border-radius: 2px; }
.se-key.dose { background: color-mix(in srgb, var(--muted) 45%, transparent); }
.se-key.sev { background: #ff8a3d; border-radius: 50%; }
.se-notes { margin: 8px 0 4px; padding-left: 18px; }
.se-notes li { margin: 4px 0; }

/* ---------- Weight goal */
.goal-card h3, .goal-form h3 { margin: 0; }
.goal-form .row input { width: 140px; }
.goal-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 12px 0 10px; }
.goal-stats > div { display: grid; gap: 2px; }
.goal-stats strong { font-family: var(--display); font-size: 1.3rem; }
.calc-out { display: flex; align-items: baseline; gap: 8px; min-height: 44px; padding: 10px 12px; border: 1px dashed var(--line); border-radius: var(--radius-sm); }
.calc-out strong { font-family: var(--display); font-size: 1.2rem; }

/* ---------- Mobile-friendly form fields */
.field { min-width: 0; }
/* iOS Safari gives date/time inputs a fixed intrinsic width that overflows grid columns */
input[type="date"], input[type="time"] { -webkit-appearance: none; appearance: none; min-width: 0; max-width: 100%; display: block; min-height: 44px; text-align: left; }
input[type="date"]::-webkit-date-and-time-value, input[type="time"]::-webkit-date-and-time-value { text-align: left; }
/* Measurements: date on its own row, height | weight, BMI full width, waist | body fat */
.m-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.m-fields .m-date, .m-fields .m-bmi { grid-column: 1 / -1; }
.m-fields .m-date input { max-width: 260px; }
.calc-out { flex-wrap: wrap; row-gap: 4px; }
.bmi-range { margin-left: auto; }
@media (min-width: 900px) { .grid-2 > #mForm .m-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* ---------- Language picker */
.lang-row { display: flex; justify-content: flex-end; margin-bottom: 8px; }
.lang-pick { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); }
.lang-pick .ico { width: 16px; height: 16px; }
.lang-pick select { width: auto; padding: 6px 28px 6px 10px; font-size: .9rem; background-color: var(--surface); }
/* Tap-to-pick vial sizes under a mg field */
.size-row { flex-wrap: wrap; gap: 6px; align-items: center; margin: 4px 0 10px; }
.size-row:empty { display: none; }
.fields > .size-row { grid-column: 1 / -1; margin-top: -4px; }
.blend-row + .b-sizes { margin: -2px 0 8px; }
/* Simple new-protocol form: details appear only when asked for */
.linkish { background: none; border: 0; padding: 0; color: var(--accent); text-decoration: underline; cursor: pointer; font: inherit; }
.linkish.small { font-size: .875rem; }
#pform.simple .seg-choice { grid-template-columns: repeat(3, 1fr); gap: 6px; }
#pform.simple .seg-choice span { display: block; padding: 9px 8px; text-align: center; }
#pform.simple .seg-choice small { display: none; }
#mixEdit { margin: 4px 0 6px; }
#pform.empty > :not(.pep-pick) { display: none; }
#pform.simple #pepAssist .assist:not(.alt) > strong { display: none; }
/* Protocol page: folded sections */
.dose-now { margin: 0 0 12px; display: flex; flex-wrap: wrap; gap: 6px; align-items: baseline; }
.dose-now strong.num { font-size: 1.15rem; }
details.sect { background: var(--surface); }
details.sect > summary { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; list-style: none; }
details.sect > summary::-webkit-details-marker { display: none; }
details.sect > summary::after { content: '▾'; color: var(--muted); margin-left: 8px; transition: transform .15s; }
details.sect[open] > summary::after { transform: rotate(180deg); }
details.sect > summary > span:first-child { flex: 1; }
.sect-sub { text-align: right; font-weight: 400; }
/* Progress: one-field weigh-in, the rest on request */
.quick-weigh { display: flex; gap: 10px; align-items: flex-end; }
.quick-weigh .field { flex: 1; margin: 0; }
.quick-weigh .btn { flex: none; }
.more-meas { margin-top: 10px; }
.more-meas > summary { cursor: pointer; color: var(--accent); }
.more-meas[open] > summary { margin-bottom: 10px; }
details.sect form { margin: 0; }
/* Supplies: add a vial or pen */
#vialForm .seg-choice.seg-2 { grid-template-columns: 1fr 1fr; margin: 4px 0 10px; }
#vialForm .seg-choice span { display: block; text-align: center; padding: 9px 8px; }
#vialForm .v-count input { max-width: 110px; }
#vialForm .size-row { margin-bottom: 4px; }
#v_other { margin: 0 0 10px; display: block; }
#v_other.hidden { display: none; }
.linkcard.compact { padding: 12px 16px; }
.rf-head { align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; } .rf-head h1 { margin: 0; } .rf-head .lang-pick select { width: auto; }
/* Today: personal layer */
.today-head { display: grid; gap: 2px; margin-bottom: 12px; }
.today-head h1 { margin: 0; }
.milestone { display: grid; grid-template-columns: auto 1fr auto; gap: 14px; align-items: center; border-color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, var(--surface)); animation: ms-pop .5s ease-out; }
.milestone p { margin: 2px 0 0; }
.ms-badge { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; font-size: 1.4rem; color: var(--accent-ink); background: var(--accent); }
@keyframes ms-pop { from { transform: scale(.96); opacity: 0; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .milestone { animation: none; } }
.focus h3, .week-card h3 { margin: 0; }
.focus p, .week-card p { margin: 8px 0 0; }
.focus .progress { margin-top: 10px; }
@media (max-width: 420px) { .milestone { grid-template-columns: auto 1fr; } .milestone .btn { grid-column: 1 / -1; } }
.ms-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.ms-list li { color: var(--muted); }
.ms-list li.got { color: var(--text); }
.ms-list li.got span { color: var(--accent); }

/* Consent: one screen, one button */
.consent { text-align: center; padding: 8px 0 24px; }
.consent-mark { width: 64px; height: 64px; margin: 8px auto 12px; border-radius: 50%; display: grid; place-items: center; color: var(--accent); background: var(--accent-soft); }
.consent-mark svg { width: 34px; height: 34px; }
.consent h1 { margin: 0 0 10px; }
.consent-lede { color: var(--muted); margin: 0 auto 20px; max-width: 34em; }
.consent-rows { display: grid; gap: 10px; text-align: left; margin-bottom: 16px; }
.consent-row { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line, rgba(255,255,255,.08)); color: var(--text); text-decoration: none; }
a.consent-row:hover { background: var(--surface-2); }
.consent-ico { flex: none; width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; color: var(--accent); background: var(--accent-soft); }
.consent-ico svg { width: 22px; height: 22px; }
.consent-txt { display: grid; gap: 2px; flex: 1; min-width: 0; }
.consent-go { color: var(--muted); font-size: 1.1rem; }
.consent-fine { margin: 0 0 16px; line-height: 1.5; }
.consent-btn { padding-top: 16px; padding-bottom: 16px; font-size: 1.05rem; border-radius: 999px; }
.consent .center { margin-top: 12px; }

/* Terms & privacy */
.legal h2 { font-size: 1.1rem; margin: 24px 0 6px; }
.legal p, .legal li { line-height: 1.6; }
.foot-links { margin-top: 8px; }
.foot-links a { color: var(--muted); }
.focus-mode #nav, .focus-mode #topEnd, .focus-mode .footer { display: none; }
.legal ul + p { margin-top: 10px; }

/* Onboarding: one question per screen */
.accent-text { color: var(--accent); }
.onb { max-width: 480px; margin: 0 auto; min-height: calc(100vh - 140px); min-height: calc(100dvh - 140px); display: flex; flex-direction: column; padding-bottom: 8px; }
.onb-top { display: flex; align-items: center; gap: 12px; margin: 4px 0 20px; }
.onb-back { flex: none; width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); color: var(--text); font: inherit; font-size: 1.1rem; cursor: pointer; }
.onb-bar { flex: 1; height: 4px; border-radius: 4px; background: var(--surface-2); overflow: hidden; }
.onb-bar span { display: block; height: 100%; background: var(--accent); border-radius: 4px; transition: width .3s ease; }
.onb-login { color: var(--accent); font-weight: 600; text-decoration: none; }
.onb-body { flex: 1; }
.onb h1 { margin: 0 0 8px; line-height: 1.15; }
.onb-body > .muted { margin: 0 0 20px; }
.onb-h2 { font-size: 1rem; margin: 18px 0 8px; }
.onb-opts { display: grid; gap: 10px; }
.onb-opt { display: flex; align-items: center; gap: 14px; width: 100%; padding: 14px 16px; text-align: left; font: inherit; color: var(--text); background: var(--surface); border: 1.5px solid var(--line); border-radius: var(--radius); cursor: pointer; }
.onb-opt:hover { background: var(--surface-2); }
.onb-opt[aria-pressed="true"] { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, var(--surface)); }
.onb-oico { flex: none; width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; color: var(--accent); background: var(--accent-soft); }
.onb-oico svg { width: 20px; height: 20px; }
.goal-glyph { font-size: 1.1rem; line-height: 1; }
.onb-otxt { flex: 1; display: grid; gap: 2px; min-width: 0; }
.onb-tick { flex: none; width: 22px; height: 22px; border-radius: 50%; border: 1.5px solid var(--line); display: grid; place-items: center; }
.onb-opt[aria-pressed="true"] .onb-tick { background: var(--accent); border-color: var(--accent); }
.onb-opt[aria-pressed="true"] .onb-tick::after { content: ''; width: 9px; height: 5px; border-left: 2px solid var(--accent-ink); border-bottom: 2px solid var(--accent-ink); transform: translateY(-1px) rotate(-45deg); }
.onb-foot { position: sticky; bottom: 0; display: grid; gap: 10px; padding: 16px 0 8px; margin-top: 16px; background: linear-gradient(to bottom, transparent, var(--bg) 30%); }
.onb-foot:empty { display: none; }
.onb-cta, .onb-foot .btn.wide { padding-top: 15px; padding-bottom: 15px; font-size: 1.05rem; border-radius: 999px; }
.onb-skip { justify-self: center; color: var(--muted); }
.onb-search { width: 100%; margin-bottom: 6px; }
.onb-label { margin: 10px 0 8px; text-transform: uppercase; letter-spacing: .04em; font-size: .75rem; }
.onb-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.onb-chip { font: inherit; font-size: .95rem; font-weight: 600; color: var(--text); background: var(--surface); border: 1.5px solid var(--line); border-radius: 999px; padding: 8px 14px; cursor: pointer; }
.onb-chip[aria-pressed="true"] { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, var(--surface)); }
.onb-chip span { color: var(--accent); }
.onb-year { margin-top: 20px; }
.onb-units { display: inline-flex; gap: 4px; padding: 4px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); margin-bottom: 16px; }
.onb-units button { font: inherit; font-weight: 600; color: var(--muted); background: none; border: 0; border-radius: 999px; padding: 8px 18px; cursor: pointer; }
.onb-units button[aria-pressed="true"] { background: var(--surface-2); color: var(--text); }
.onb-fields { display: grid; gap: 4px; }
.onb-form .lang-pick { margin: 4px 0 12px; }
.onb-welcome { text-align: center; padding-top: 12px; }
.onb-hero { display: grid; place-items: center; margin: 4px 0 16px; }
.onb-points { list-style: none; padding: 0; margin: 20px auto 8px; display: grid; gap: 12px; text-align: left; max-width: 340px; }
.onb-points li { display: flex; align-items: center; gap: 12px; }
.onb-points svg { flex: none; width: 22px; height: 22px; color: var(--accent); }
.onb-center { justify-content: center; text-align: center; }
.consent-mark.big { width: 84px; height: 84px; }
.consent-mark.big svg { width: 42px; height: 42px; }
.onb-plan { text-align: left; }
.onb-plan .consent-mark { margin-left: 0; }
.plan-block { margin-top: 18px; }
.plan-peps { display: grid; gap: 8px; margin-top: 8px; }
.plan-pep { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 12px 10px 16px; border-radius: var(--radius-sm); background: var(--surface); border: 1px solid var(--line); color: var(--text); text-decoration: none; font-weight: 600; }
.plan-premium { margin-top: 20px; border-color: color-mix(in srgb, var(--accent) 50%, var(--line)); }
.pending-card .plan-peps { margin-bottom: 8px; }

/* Toast with an action (Undo) */
.toast.has-action { display: flex; align-items: center; gap: 14px; }
.toast.show.has-action { pointer-events: auto; }
.toast-btn { font: inherit; font-weight: 700; background: transparent; color: var(--accent); border: 0; padding: 4px 2px; cursor: pointer; text-transform: uppercase; letter-spacing: .03em; font-size: .85rem; }
.toast-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.pending-delete { display: none !important; }

/* Offline */
.offline-bar { position: sticky; top: 0; z-index: 19; padding: 8px 16px; text-align: center; font-size: .88rem; font-weight: 600; background: var(--warn-soft); color: var(--text); border-bottom: 1px solid color-mix(in srgb, var(--warn) 35%, transparent); }

/* Premium ending soon */
.trial-card { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.trial-card h3 { margin: 0; }
.trial-card p { margin: 6px 0 0; }

/* Admin: sign-up funnel */
.funnel { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 8px; }
.funnel li { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(60px, 2fr) auto; gap: 10px; align-items: center; font-size: .9rem; }
.funnel-bar { height: 8px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.funnel-bar > span { display: block; height: 100%; background: var(--accent); }
.funnel-n { white-space: nowrap; text-align: right; }
@media (max-width: 520px) { .funnel li { grid-template-columns: 1fr auto; } .funnel-bar { grid-column: 1 / -1; grid-row: 2; } }

/* Public library pages (/da/bpc-157 etc.) */
.seo .topbar { justify-content: space-between; }
.seo-list { list-style: none; margin: 0 0 24px; padding: 0; display: grid; gap: 8px; }
.seo-list a { display: grid; gap: 2px; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); color: var(--text); text-decoration: none; }
.seo-list a:hover { border-color: var(--accent); }
.seo-cta { display: grid; gap: 6px; justify-items: start; margin: 16px 0; }
.seo-langs { text-align: center; }
.seo-langs a[aria-current] { font-weight: 700; color: var(--text); }

/* Log for another day */
.week li:has(.wk-btn) { padding: 0; }
.wk-btn { all: unset; box-sizing: border-box; width: 100%; display: grid; justify-items: center; gap: 2px; padding: 4px 0; border-radius: 10px; cursor: pointer; }
.wk-btn:hover { background: var(--surface-2); }
.wk-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.week li.wk-sel { background: color-mix(in srgb, var(--accent) 18%, var(--surface-2)); box-shadow: inset 0 0 0 1.5px var(--accent); }
.day-hint { margin: -8px 0 16px; text-align: center; }
.day-log .day-head { flex-wrap: nowrap; gap: 8px; margin-bottom: 8px; }
.day-log .day-head h3 { margin: 0; text-align: center; flex: 1; }
.day-log .day-head h3::first-letter { text-transform: uppercase; }
.day-log .day-head h3 .muted { display: block; font-weight: 400; text-transform: none; }
.day-log .day-head .btn { min-width: 40px; font-size: 1.2rem; line-height: 1; }
.day-log .dose-row { grid-template-columns: minmax(0, 1fr) auto auto; }
.day-doses { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.day-dose { display: inline-flex; align-items: center; gap: 4px; padding: 2px 4px 2px 8px; border-radius: 99px; background: var(--surface-2); }
.day-dose .icon-del { padding: 0 4px; }
.day-pick { align-items: center; justify-content: center; gap: 8px; margin-top: 12px; }
.day-pick input { width: auto; }
.day-name { color: var(--text); text-decoration: none; min-width: 0; display: grid; }

/* Reminder times on a protocol */
.rem-times { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 8px; }
.rem-chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 6px 4px 12px; border-radius: 99px; background: var(--surface-2); border: 1px solid var(--line); font-weight: 600; }
.rem-del { all: unset; cursor: pointer; padding: 0 6px; color: var(--muted); }
.rem-del:hover, .rem-del:focus-visible { color: var(--danger); }
.rem-add { align-items: center; gap: 8px; }
.rem-add input[type=time] { width: auto; }

/* Home screen guide */
.install-steps { list-style: none; margin: 12px 0; padding: 0; display: grid; gap: 10px; text-align: left; }
.install-steps li { display: grid; grid-template-columns: 28px 1fr; gap: 10px; align-items: center; }
.install-n { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--accent); color: var(--accent-ink, #fff); font-weight: 700; font-size: .9rem; }
.ico-inline { width: 1.15em; height: 1.15em; vertical-align: -0.2em; color: var(--accent); }
.install-card { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.install-card h3 { margin: 0; }
.onb .install-steps { max-width: 360px; margin: 16px auto; }

/* Today: how much to draw */
.dose-amt { text-align: right; }
.dose-draw { display: block; font-family: var(--font); font-size: .82rem; font-weight: 700; color: var(--accent); margin-top: 2px; }
.dose-row.done .dose-draw { color: var(--muted); font-weight: 600; }
.dose-draw.add { font-weight: 600; color: var(--muted); text-decoration: underline; white-space: normal; max-width: 140px; margin-left: auto; line-height: 1.25; }

/* Log all, "How do you feel?", edit a dose */
.log-all { margin-top: 10px; }
.feel-card { border-color: color-mix(in srgb, var(--ok) 40%, var(--line)); }
.feel-card h3 { margin: 0; }
.feel-chips { margin: 8px 0; }
.feel-chip.on { border-color: var(--accent); color: var(--text); }
.feel-chip[aria-pressed="true"], .feel-chip[aria-pressed="true"]:disabled { background: var(--ok-soft); border-color: var(--ok); color: var(--ok); opacity: 1; }
.feel-sev { margin: 4px 0 8px; }
.entry-acts { display: inline-flex; gap: 2px; }
.entries li.editing { display: block; }
.dose-edit .fields { margin-bottom: 0; }

/* Today: next injection site */
.site-next { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); margin-top: 2px; }
.site-ico { width: 8px; height: 8px; border-radius: 50%; box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 35%, transparent); background: var(--accent); }

/* Today: weight forecast */
.forecast { margin-top: 10px; display: grid; gap: 4px; }
.forecast p { margin: 0; }
.forecast-line { font-weight: 600; }
.spark { width: 100%; max-width: 360px; height: 56px; }
.spark-line { fill: none; stroke: var(--accent); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.spark-dot { fill: var(--accent); }
.spark-goal { stroke: var(--ok); stroke-width: 1.5; stroke-dasharray: 4 4; }

/* Share the doctor report */
.share-card h3 { margin-top: 0; }
.share-link { display: grid; gap: 8px; margin: 8px 0; }
.share-link input { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .85rem; }
.share-make { align-items: center; gap: 8px; }
.share-make select { width: auto; }
.share-list li > div { display: grid; }
.shared-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

/* Today: what's left in the vial or pen */
.supply-line { display: block; margin-top: 2px; }
.dose-row > .supply-line { grid-column: 1 / -1; margin-top: -6px; padding-left: 18px; }
.supply-line.low { color: var(--warn); font-weight: 600; }
.supply-line .linkish { font-weight: 600; }

/* Daily mood */
.mood-card { padding: 14px 18px; }
.mood-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.mood-head h3 { margin: 0; }
.mood-row { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin-top: 10px; }
.mood-btn { font: inherit; font-size: 1.6rem; line-height: 1; padding: 10px 0; border-radius: 12px; border: 1px solid var(--line); background: var(--surface-2); cursor: pointer; filter: grayscale(.6); opacity: .8; transition: transform .12s, filter .12s, opacity .12s; }
.mood-btn:hover { filter: none; opacity: 1; }
.mood-btn[aria-pressed="true"] { filter: none; opacity: 1; border-color: var(--accent); box-shadow: inset 0 0 0 1.5px var(--accent); transform: scale(1.04); }
.mood-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.mood-axis { font-size: 12px; }
.mood-step { stroke: var(--warn); stroke-width: 1.5; stroke-dasharray: 4 4; }
.mood-step-key { display: inline-block; width: 14px; border-top: 2px dashed var(--warn); vertical-align: middle; }
@media (prefers-reduced-motion: reduce) { .mood-btn { transition: none; } }

/* Next blood test */
.lab-card { display: grid; gap: 2px; border-color: color-mix(in srgb, var(--data, var(--accent)) 45%, var(--line)); }
.lab-plan h3 { margin: 0; }

/* =====================================================================================
   Theme: light and calm, in the family of the Aurex system — warm off-white, white cards,
   hairline borders, black primary buttons and a Cormorant Garamond wordmark and headings.
   PepTimer's own touch: the signal-orange accent (dose ring, progress, active states),
   the stopwatch mark and a background of peptide chains and hexagon rings.
   ===================================================================================== */
@font-face { font-family: "Cormorant Garamond"; src: url("/fonts/CormorantGaramond-Medium.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Cormorant Garamond"; src: url("/fonts/CormorantGaramond-SemiBold.woff2") format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Cormorant Garamond"; src: url("/fonts/CormorantGaramond-MediumItalic.woff2") format("woff2"); font-weight: 500; font-style: italic; font-display: swap; }
:root {
  color-scheme: light;
  --bg: #f6f6f4; --surface: #ffffff; --surface-2: #f2f2ef; --line: #e2e2de; --line-strong: #c9c9c4;
  --text: #151515; --muted: #6f6f73;
  --ink: #151515; --ink-2: #3a3a3a; --on-ink: #ffffff;   /* primary buttons, like Aurex */
  --accent: #e8571b; --accent-ink: #ffffff; --accent-soft: #fdeee6;   /* PepTimer orange */
  --blend-soft: #e8f0f9; --info-bg: #f1f1ee;
  --data: #2b6cb0; --ok: #1f8a57; --ok-soft: #e4f3eb; --warn: #a8670f; --warn-soft: #fbf1e0; --danger: #c43d3d; --danger-soft: #fae8e8;
  --radius: 12px; --radius-sm: 9px; --shadow: 0 8px 30px rgba(0, 0, 0, .06);
  --font: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, "Helvetica Neue", sans-serif;
  --display: "Cormorant Garamond", "Times New Roman", Georgia, serif;
  --serif: var(--display);
  --side-w: 236px;
}
body { background: var(--bg) url("/bg-soft.svg") 0 0 / 1100px repeat; font-size: 15.5px; line-height: 1.55; }
a { color: var(--ink-2); text-decoration-color: color-mix(in srgb, var(--accent) 55%, transparent); }
a:hover { color: var(--text); }

/* Type: serif headings, sans for everything that is a number */
h1, h2, h3 { font-family: var(--display); font-weight: 600; letter-spacing: .01em; line-height: 1.12; }
h1 { font-style: normal; font-size: clamp(2rem, 5.2vw, 2.55rem); }
h2 { font-size: 1.6rem; }
h3 { font-size: 1.32rem; }
.stat, .dial-num, .dose-amt, .wk-num, .stepup-dose, .mc-day, .invite-code, .goal-stats strong, .calc-out strong, .avatar, .pro-tag, .pro-mini {
  font-family: var(--font); font-style: normal; letter-spacing: 0;
}
.stat { font-weight: 700; font-size: 1.9rem; }
.dial-num { font-weight: 700; font-size: 58px; }
.dose-amt { font-weight: 700; font-size: 1.4rem; }
.wk-num { font-weight: 700; font-size: 1.05rem; }
.mc-day { font-weight: 700; font-size: 3.2rem; }
.rest, .next-when, .features strong, .invite-cta strong, .logged-msg, .plan-card strong, .step-list strong, .goals-cta strong, .ph-gap, .quick .eyebrow { font-weight: 600; }
.next-when, .rest, .logged-msg { font-size: 1.6rem; }
.quick .eyebrow { font-size: 1.15rem; color: var(--text); }
.kv dt, th, .card .muted.small:first-child { letter-spacing: .01em; }
th { text-transform: uppercase; font-size: .76rem; letter-spacing: .05em; background: var(--surface-2); }

/* Brand: letter-spaced wordmark, orange stopwatch */
.brand { font-family: var(--display); font-style: normal; font-weight: 500; font-size: 1.3rem; letter-spacing: .32em; text-transform: uppercase; gap: 10px; }
.brand-mark { width: 26px; height: 26px; }

/* Surfaces */
.card, .compound-extra, .tabs, .week, .cal-day:not(.empty), .disclaimer, .plan { background: var(--surface); border-color: var(--line); }
.card { border-radius: var(--radius); }
.linkcard:hover { border-color: var(--line-strong); box-shadow: var(--shadow); }
input, select, textarea { background: var(--bg); border-color: var(--line); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent); }
button:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Buttons: black primary, quiet secondary; orange stays for the dose itself */
.btn { background: var(--ink); border-color: var(--ink); color: var(--on-ink); font-weight: 650; border-radius: var(--radius-sm); }
.btn:hover { filter: none; background: var(--ink-2); border-color: var(--ink-2); }
.btn.secondary { background: var(--surface-2); color: var(--text); border-color: var(--line); }
.btn.secondary:hover { background: var(--surface-2); border-color: var(--line-strong); }
.btn.ghost { background: transparent; color: var(--ink-2); border-color: var(--line); }
.btn.ghost:hover { background: var(--surface-2); border-color: var(--line-strong); }
.btn.danger { background: transparent; color: var(--danger); border-color: color-mix(in srgb, var(--danger) 45%, var(--line)); }
.btn.danger:hover { background: var(--danger-soft); }
.quick-log, #quickDose, .day-log-btn:not(.ghost), .onb-cta { background: var(--accent); border-color: var(--accent); color: #fff; }
.quick-log:hover, #quickDose:hover, .day-log-btn:not(.ghost):hover, .onb-cta:hover { background: #cf4a12; border-color: #cf4a12; }
.linkish { color: var(--ink-2); text-decoration-color: color-mix(in srgb, var(--accent) 60%, transparent); }

/* Chips, tabs, badges */
.chip { background: var(--surface); color: var(--ink-2); }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--on-ink); border-color: var(--ink); }
.tabs a.active { background: var(--surface-2); color: var(--text); box-shadow: inset 0 -2px 0 var(--accent); }
.badge { border: 1px solid var(--line); background: var(--surface-2); }
.badge.ok { border-color: color-mix(in srgb, var(--ok) 30%, transparent); }
.badge.warn { border-color: color-mix(in srgb, var(--warn) 30%, transparent); }
.badge.danger { border-color: color-mix(in srgb, var(--danger) 30%, transparent); }
.badge.accent { border-color: color-mix(in srgb, var(--accent) 35%, transparent); }
.banner.info { background: var(--info-bg); border-color: var(--line); }
.chip-link { background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line); }
.pro-tag, .pro-mini { background: var(--accent); color: #fff; font-weight: 700; }
.go-premium { color: var(--ink); border-color: var(--line-strong); }
.go-premium:hover { background: var(--surface-2); }
.lib-tag.ok { color: var(--ok); background: var(--ok-soft); }
.lib-tag.warn { color: var(--warn); background: var(--warn-soft); }
.lib-tag.blend { color: var(--data); background: var(--blend-soft); }

/* Colours tuned for a light background */
.c-blue { --pc: #2f6fd1; } .c-green { --pc: #1f9a62; } .c-violet { --pc: #7c4ddb; } .c-amber { --pc: #c98a0c; }
.c-pink { --pc: #d6458f; } .c-teal { --pc: #11998a; } .c-orange { --pc: #e8571b; }
.site-dot.rested circle:not(.ring), .sdot.rested { fill: #1f9a62; background: #1f9a62; }
.site-dot.resting circle:not(.ring), .sdot.resting { fill: #c98a0c; background: #c98a0c; }
.site-dot.recent circle:not(.ring), .sdot.recent { fill: #d64545; background: #d64545; }
.se-dot.sev-1, .se-dot.sev-2 { fill: #c98a0c; } .se-dot.sev-3 { fill: #e8571b; } .se-dot.sev-4, .se-dot.sev-5 { fill: #d64545; }
.disclaimer::backdrop { background: rgba(20, 20, 20, .35); }
.toast { background: var(--ink); color: var(--on-ink); box-shadow: var(--shadow); }
.offline-bar { background: var(--warn-soft); }

/* Member card: black, with the orange glow */
.member-card, .mcard-pt { background: radial-gradient(120% 90% at 100% 0%, color-mix(in srgb, var(--accent) 40%, transparent), transparent 60%), linear-gradient(160deg, #262626, #121212 70%); color: #fff; border-color: #111; }

/* Top bar (phones and tablets) */
.topbar { background: color-mix(in srgb, var(--surface) 92%, transparent); border-bottom-color: var(--line); }
.nav a { color: var(--muted); }
.nav a:hover { background: var(--surface-2); color: var(--text); }
.nav a.active { background: var(--surface-2); color: var(--text); }
.nav a.active .ico { color: var(--accent); }
.avatar { background: var(--surface-2); color: var(--text); border-color: var(--line); font-weight: 700; }
@media (max-width: 760px) {
  .topbar { background: var(--surface); }
  .topbar .brand { font-size: 1.15rem; }
  .topbar .nav { background: color-mix(in srgb, var(--surface) 96%, transparent); border-top-color: var(--line); }
  .nav a.active { background: none; color: var(--text); }
  input, select, textarea { font-size: 16px; } /* no auto-zoom on iPhone */
  /* Today on a phone: the name gets the full width, dose and button underneath */
  .today .dose-row { grid-template-columns: 1fr auto; row-gap: 8px; column-gap: 12px; }
  .today .dose-row > .dose-main { grid-column: 1 / -1; }
  .today .dose-row > .dose-amt { text-align: left; display: flex; align-items: baseline; gap: 4px; flex-wrap: wrap; }
  .today .dose-row > .dose-amt .dose-draw { display: inline; margin: 0 0 0 6px; }
  .today .dose-row > .supply-line { padding-left: 0; margin-top: -4px; }
}

/* Computers: a side menu like Aurex */
@media (min-width: 1000px) {
  body { padding-left: var(--side-w); background-attachment: fixed; }
  .topbar { position: fixed; top: 0; bottom: 0; left: 0; width: var(--side-w); height: auto; flex-direction: column; align-items: stretch; gap: 4px;
    padding: 22px 12px 16px; background: var(--surface); border-bottom: 0; border-right: 1px solid var(--line); backdrop-filter: none; -webkit-backdrop-filter: none; z-index: 25; }
  .topbar .brand { padding: 4px 10px 22px; font-size: 1.25rem; }
  .topbar .nav { flex-direction: column; align-items: stretch; gap: 2px; }
  .topbar .nav a { padding: 10px 12px; border-radius: var(--radius-sm); font-size: .95rem; }
  .topbar-end { margin: auto 0 0; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 8px; padding: 14px 6px 0; border-top: 1px solid var(--line); }
  main.container, .footer.container { max-width: 1080px; padding-left: 32px; padding-right: 32px; }
  .offline-bar { margin-left: 0; }
}
@media print { body { padding-left: 0 !important; background: #fff !important; } }

/* Public library pages (no side menu there) */
body.seo { padding-left: 0; }
@media (min-width: 1000px) {
  body.seo .topbar { position: sticky; bottom: auto; width: auto; height: 60px; flex-direction: row; align-items: center; padding: 0 24px; border-right: 0; border-bottom: 1px solid var(--line); }
  body.seo .topbar .brand { padding: 0; }
  body.seo .topbar-end { margin: 0 0 0 auto; padding: 0; border-top: 0; flex-wrap: nowrap; }
}
.lib-name { font-family: var(--display); font-weight: 600; font-size: 1.28rem; letter-spacing: .01em; }
.member-card { --text: #fff; --muted: rgba(255, 255, 255, .62); --line: rgba(255, 255, 255, .16); color: #fff; }
.member-card .mc-tag { color: #fff; }
.brand-mark { color: var(--text); }
h1, h2, h3, .brand, .lib-name, .rest, .next-when { font-variant-numeric: lining-nums; } /* Cormorant's old-style figures read oddly in "100 kg" */

/* =====================================================================================
   Dark mode: the same calm design at night — near-black surfaces, light primary buttons
   (the mirror of the black ones) and the same orange. Chosen under Account, or follows the device.
   ===================================================================================== */
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #121212; --surface: #1b1b1a; --surface-2: #242423; --line: #30302e; --line-strong: #4a4a47;
  --text: #ecebe7; --muted: #9b9a96;
  --ink: #ecebe7; --ink-2: #d2d1cc; --on-ink: #121212;
  --accent: #f0662a; --accent-ink: #ffffff; --accent-soft: #3a2216;
  --blend-soft: #1c2a3a; --info-bg: #21211f;
  --data: #6aa8ec; --ok: #45c486; --ok-soft: #15301f; --warn: #e2a748; --warn-soft: #362a15; --danger: #f07070; --danger-soft: #3a1c1c;
  --shadow: 0 8px 30px rgba(0, 0, 0, .45);
}
:root[data-theme="dark"] body { background-image: url("/bg-dark.svg"); }
:root[data-theme="dark"] .c-blue { --pc: #5b95ea; } :root[data-theme="dark"] .c-green { --pc: #3fbf7f; } :root[data-theme="dark"] .c-violet { --pc: #a07ff0; }
:root[data-theme="dark"] .c-amber { --pc: #e0a83a; } :root[data-theme="dark"] .c-pink { --pc: #ec6fae; } :root[data-theme="dark"] .c-teal { --pc: #2fc2b0; }
:root[data-theme="dark"] .disclaimer::backdrop { background: rgba(0, 0, 0, .6); }
:root[data-theme="dark"] .member-card, :root[data-theme="dark"] .mcard-pt { border-color: var(--line-strong); }
@media print { :root[data-theme="dark"] body { background-image: none; } }

/* Appearance picker */
.theme-pick { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.theme-pick label { display: grid; justify-items: center; gap: 6px; padding: 12px 8px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); cursor: pointer; font-weight: 600; font-size: .92rem; text-align: center; }
.theme-pick label:has(input:checked) { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.theme-pick input { position: absolute; opacity: 0; pointer-events: none; }
.theme-pick label:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.theme-swatch { width: 44px; height: 30px; border-radius: 7px; border: 1px solid var(--line-strong); }
.theme-swatch.light { background: linear-gradient(135deg, #f6f6f4 50%, #151515 50%); }
.theme-swatch.dark { background: linear-gradient(135deg, #1b1b1a 50%, #ecebe7 50%); }
.theme-swatch.system { background: linear-gradient(90deg, #f6f6f4 50%, #1b1b1a 50%); }
.lang-row { gap: 10px; flex-wrap: wrap; }

/* =====================================================================================
   Phones: a tidier library (feedback 30 Oct)
   ===================================================================================== */
/* A tap leaves no orange "hover" border behind on touch screens */
@media (hover: none) {
  .lib-row:hover, .linkcard:hover, .stat-strip a:hover, .seo-list a:hover { border-color: var(--line); box-shadow: none; }
}
/* Published schedule: its own card, plain numbers, units on one line */
.dosage-guide { background: var(--surface); }
.step-list strong { font-family: var(--font); font-size: 1.02rem; }
.pub-steps li { grid-template-columns: minmax(0, 1fr) auto auto; }
.pub-steps li > * { white-space: nowrap; }
@media (max-width: 760px) {
  /* The pattern stays, but much fainter behind long text */
  body { background-image: none; }
  body::before { content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none; background: url("/bg-soft.svg") 0 0 / 1100px repeat; opacity: .45; }
  :root[data-theme="dark"] body { background-image: none; }
  :root[data-theme="dark"] body::before { background-image: url("/bg-dark.svg"); opacity: .6; }
  /* Search and filters: a clean full-width bar with a hairline, so cards don't look cut off */
  .lib-tools { margin-left: -16px; margin-right: -16px; padding: 8px 16px 10px; border-bottom: 1px solid var(--line); }
  .lib-tools .lib-chips { margin-right: -16px; padding-right: 16px; }
  /* Library rows: the name gets the full width, badges sit underneath */
  .lib-row { grid-template-columns: minmax(0, 1fr) 16px; grid-template-areas: "name chev" "side chev" "alias chev" "sum chev"; row-gap: 4px; }
  .lib-side { align-self: center; flex-wrap: wrap; gap: 6px; margin: 1px 0 2px; }
  .lib-side .lib-tag { order: -1; }
  /* Facts: labels take at most 40 % and may wrap; values get the room */
  .kv { grid-template-columns: minmax(0, 40%) minmax(0, 1fr); column-gap: 12px; }
  .kv dt { font-size: .92em; }
  .dosage-guide { padding: 14px; }
}
.reset-box p { margin: 0 0 6px; }
.reset-box .row { flex-wrap: nowrap; gap: 8px; }
.reset-box input { flex: 1; min-width: 0; font-size: .85rem; }

/* Message from PepTimer on Today */
.news-card { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); box-shadow: inset 3px 0 0 var(--accent); }
.news-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.news-tag { font-size: .72rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); }
.news-x { background: none; border: 0; color: var(--muted); font: inherit; font-size: 1rem; width: 32px; height: 32px; border-radius: 8px; cursor: pointer; }
.news-x:hover { background: var(--surface-2); color: var(--text); }
.news-card h3 { margin: 0 0 4px; }
.news-card p { margin: 0; }
.cal-actions { gap: 8px; margin: 10px 0 6px; }
.landing-offer { margin: 14px 0 18px; max-width: 34rem; }
