:root {
  --bg: #0f1115;
  --surface: #181b22;
  --surface-2: #222631;
  --line: #2c313d;
  --text: #eef0f4;
  --muted: #8b93a5;
  --accent: #3b82f6;
  --accent-ink: #ffffff;
  --good: #22c55e;
  --warn: #f59e0b;
  --bad: #ef4444;
  --gold: #fbbf24;
  --radius: 14px;
  --tabs-h: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root {
    --bg: #f4f5f8; --surface: #ffffff; --surface-2: #eef0f4; --line: #dde1e8;
    --text: #12151b; --muted: #636b7a; color-scheme: light;
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body {
  font: 15px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  min-height: 100dvh;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
.mono { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
h1 { font-size: 26px; margin: 4px 0 14px; }
h2 { font-size: 17px; margin: 22px 0 10px; }
h3 { font-size: 15px; margin: 0; }

.view {
  max-width: 640px; margin: 0 auto;
  padding: calc(env(safe-area-inset-top, 0px) + 14px) 16px calc(var(--tabs-h) + var(--safe-b) + 80px);
}

/* ---------- tabs ---------- */
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: grid; grid-template-columns: repeat(5, 1fr);
  height: calc(var(--tabs-h) + var(--safe-b)); padding-bottom: var(--safe-b);
  background: var(--surface); border-top: 1px solid var(--line);
}
.tabs a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: var(--muted); font-size: 11px; }
.tabs svg { width: 24px; height: 24px; fill: currentColor; }
.tabs a.on { color: var(--accent); }
body.in-active .tabs, body.in-active .active-bar { display: none; }

.active-bar {
  position: fixed; left: 12px; right: 12px; z-index: 19;
  bottom: calc(var(--tabs-h) + var(--safe-b) + 8px);
  max-width: 616px; margin: 0 auto;
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px; border: 0; border-radius: var(--radius);
  background: var(--accent); color: var(--accent-ink); font-weight: 600;
  box-shadow: 0 6px 20px rgb(0 0 0 / .35);
}
.active-bar #active-bar-name { flex: 1; text-align: left; }
.active-bar .dot { width: 8px; height: 8px; border-radius: 50%; background: #fff; animation: pulse 1.4s infinite; }
@keyframes pulse { 50% { opacity: .3; } }

/* ---------- generic ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin-bottom: 12px; }
.row { display: flex; align-items: center; gap: 10px; }
.row.between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.stack > * + * { margin-top: 8px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 11px 16px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--surface-2); font-weight: 600;
}
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.danger { color: var(--bad); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.block { width: 100%; }
.btn.sm { padding: 7px 11px; font-size: 13px; }
.btn:disabled { opacity: .5; }
.icon-btn { border: 0; background: transparent; padding: 6px; color: var(--muted); font-size: 20px; line-height: 1; }
.pill { display: inline-block; padding: 3px 9px; border-radius: 99px; background: var(--surface-2); font-size: 12px; color: var(--muted); }
.pill.pr { background: color-mix(in srgb, var(--gold) 18%, transparent); color: var(--gold); }
.chips { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
.chips button { flex: none; border: 1px solid var(--line); background: var(--surface); padding: 6px 12px; border-radius: 99px; font-size: 13px; }
.chips button.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
input.field, select.field, textarea.field {
  width: 100%; padding: 11px 12px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--surface-2); outline: none;
}
input.field:focus, textarea.field:focus { border-color: var(--accent); }
.empty { text-align: center; color: var(--muted); padding: 30px 10px; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stat { background: var(--surface-2); border-radius: 10px; padding: 10px; }
.stat b { display: block; font-size: 18px; }
.stat span { font-size: 12px; color: var(--muted); }
.list-item { display: flex; align-items: center; gap: 12px; padding: 11px 2px; border-bottom: 1px solid var(--line); }
.list-item:last-child { border-bottom: 0; }
.avatar { flex: none; width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; background: var(--surface-2); color: var(--accent); font-weight: 700; }

/* ---------- active workout ---------- */
.aw-head { position: sticky; top: 0; z-index: 5; background: var(--bg); margin: -14px -16px 8px; padding: calc(env(safe-area-inset-top, 0px) + 10px) 16px 10px; border-bottom: 1px solid var(--line); }
.aw-meta { display: flex; gap: 18px; margin-top: 8px; }
.aw-meta div span { display: block; font-size: 11px; color: var(--muted); }
.aw-meta div b { font-size: 16px; }
.aw-name { border: 0; background: transparent; font-size: 20px; font-weight: 700; padding: 0; width: 100%; outline: none; }
.ex-title { color: var(--accent); font-weight: 700; font-size: 16px; }
.sets { width: 100%; border-collapse: collapse; margin-top: 8px; }
.sets th { font-size: 11px; color: var(--muted); font-weight: 600; text-transform: uppercase; padding: 4px 2px; text-align: center; }
.sets td { padding: 3px 2px; text-align: center; }
.sets tr.done td { background: color-mix(in srgb, var(--good) 14%, transparent); }
.sets tr.done td:first-child { border-radius: 8px 0 0 8px; }
.sets tr.done td:last-child { border-radius: 0 8px 8px 0; }
.sets .prev { color: var(--muted); font-size: 13px; white-space: nowrap; }
.prev-copy { border: 0; background: transparent; color: inherit; font: inherit; padding: 4px 2px; cursor: pointer; text-decoration: underline dotted; text-underline-offset: 3px; }
.sets input {
  width: 100%; max-width: 74px; text-align: center; padding: 7px 4px; border-radius: 8px;
  border: 1px solid transparent; background: var(--surface-2); outline: none;
}
.sets input:focus { border-color: var(--accent); }
.sets input::placeholder { color: var(--muted); opacity: .7; }
.set-type { border: 0; background: transparent; font-weight: 700; width: 30px; padding: 6px 0; }
.set-type.warmup { color: var(--warn); }
.set-type.drop { color: #a78bfa; }
.set-type.failure { color: var(--bad); }
.check {
  width: 32px; height: 32px; border-radius: 8px; border: 0; background: var(--surface-2);
  display: grid; place-items: center; margin: 0 auto; color: var(--muted);
}
.check.on { background: var(--good); color: #fff; }
.ex-notes { width: 100%; border: 0; background: transparent; color: var(--muted); padding: 4px 0; resize: none; outline: none; }

/* ---------- rest timer ---------- */
.rest-timer {
  position: fixed; left: 12px; right: 12px; z-index: 30; max-width: 616px; margin: 0 auto;
  bottom: calc(12px + var(--safe-b));
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px 14px; box-shadow: 0 8px 30px rgb(0 0 0 / .4);
}
.rest-timer .bar { height: 4px; border-radius: 4px; background: var(--surface-2); overflow: hidden; margin-top: 10px; }
.rest-timer .bar i { display: block; height: 100%; background: var(--accent); transition: width 1s linear; }
.rest-timer .t { font-size: 24px; font-weight: 700; }

/* ---------- sheets ---------- */
.sheet-backdrop { position: fixed; inset: 0; z-index: 40; background: rgb(0 0 0 / .55); display: flex; align-items: flex-end; justify-content: center; animation: fade .15s; }
.sheet {
  width: 100%; max-width: 640px; max-height: 88dvh; display: flex; flex-direction: column;
  background: var(--bg); border-radius: 18px 18px 0 0; padding: 14px 16px calc(14px + var(--safe-b));
  animation: up .2s ease-out;
}
.sheet .sheet-body { overflow-y: auto; flex: 1; margin: 0 -16px; padding: 0 16px; }
.sheet .grab { width: 40px; height: 4px; border-radius: 4px; background: var(--line); margin: 0 auto 10px; }
@keyframes up { from { transform: translateY(40px); opacity: 0; } }
@keyframes fade { from { opacity: 0; } }
.thumb { flex: none; width: 44px; height: 44px; border-radius: 10px; object-fit: cover; background: #fff; border: 1px solid var(--line); }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; padding: 4px; margin-bottom: 14px; border-radius: 12px; background: var(--surface-2); }
.seg button { border: 0; background: transparent; padding: 8px; border-radius: 9px; font-weight: 600; color: var(--muted); }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgb(0 0 0 / .15); }
.demo { position: relative; aspect-ratio: 4 / 3; border-radius: var(--radius); overflow: hidden; background: #fff; border: 1px solid var(--line); }
.demo img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; opacity: 0; transition: opacity .35s; }
.demo img.on { opacity: 1; }
.demo-empty { display: grid; place-items: center; background: var(--surface); }
.demo-tag { position: absolute; right: 8px; bottom: 8px; font-size: 11px; padding: 3px 8px; border-radius: 99px; background: rgb(0 0 0 / .55); color: #fff; }
.demo-tag:empty { display: none; }
.steps { margin: 0; padding: 0; list-style: none; counter-reset: step; }
.steps li { counter-increment: step; position: relative; padding: 0 0 14px 38px; }
.steps li::before {
  content: counter(step); position: absolute; left: 0; top: -2px; width: 26px; height: 26px; border-radius: 50%;
  display: grid; place-items: center; background: var(--accent); color: #fff; font-size: 13px; font-weight: 700;
}
.plan-cta { display: block; margin-top: 12px; border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); background: color-mix(in srgb, var(--accent) 8%, var(--surface)); }
.plan-icon { flex: none; width: 44px; height: 44px; display: grid; place-items: center; font-size: 24px; border-radius: 12px; background: var(--surface-2); }
.plan-icon.big { width: 52px; height: 52px; font-size: 28px; }
.progress { height: 6px; border-radius: 6px; background: var(--surface-2); overflow: hidden; margin-top: 8px; }
.progress i { display: block; height: 100%; background: var(--accent); transition: width .25s; }
.option {
  width: 100%; display: flex; align-items: center; gap: 12px; text-align: left;
  padding: 15px 16px; border-radius: var(--radius); border: 1.5px solid var(--line); background: var(--surface); font-weight: 600;
}
.option.on { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, var(--surface)); color: var(--accent); }
.opt-icon { font-size: 22px; }
.reasons { margin: 8px 0 0; padding-left: 18px; font-size: 13px; }
.reasons li { margin: 3px 0; }
.tailored { border-color: color-mix(in srgb, var(--gold) 50%, var(--line)); }
.folder { margin-bottom: 8px; }
.folder > summary { list-style: none; display: flex; align-items: center; padding: 8px 2px; font-weight: 700; cursor: pointer; }
.folder > summary::-webkit-details-marker { display: none; }
.folder > summary::before { content: '▸'; margin-right: 8px; color: var(--muted); transition: transform .15s; }
.folder[open] > summary::before { transform: rotate(90deg); }
/* ---------- social ---------- */
.uav { flex: none; display: inline-grid; place-items: center; border-radius: 50%; color: #fff; font-weight: 700; }
.bell { position: relative; }
.badge { position: absolute; top: 0; right: 0; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 99px; background: var(--bad); color: #fff; font-size: 11px; font-weight: 700; display: grid; place-items: center; }
.post h3 { font-size: 17px; }
.post-stats { display: flex; gap: 22px; margin: 12px 0 10px; }
.post-stats span { display: block; font-size: 11px; color: var(--muted); }
.post-stats b { font-size: 15px; }
.post-ex { padding: 5px 0; border-top: 1px solid var(--line); }
.post-actions { display: flex; gap: 8px; margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--line); }
.post-actions > * { flex: 1; display: flex; align-items: center; justify-content: center; gap: 6px; padding: 8px; border-radius: 10px; border: 0; background: transparent; color: var(--muted); font-weight: 600; }
.post-actions > *:hover { background: var(--surface-2); }
.post-actions .on { color: var(--bad); }
.comment { gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.comment-form .field { flex: 1; }
.profile-head { display: flex; align-items: center; gap: 16px; margin: 6px 0 10px; }
.list-item.unread { background: color-mix(in srgb, var(--accent) 8%, transparent); border-radius: 10px; padding-left: 8px; }
a.stat { display: block; }
/* ---------- welcome & onboarding ---------- */
body.bare .tabs, body.bare .active-bar { display: none !important; }
body.bare .view { padding-bottom: calc(var(--safe-b) + 32px); }
.welcome { max-width: 440px; margin: 0 auto; padding-top: 12px; }
.welcome-hero { text-align: center; padding: 18px 0 10px; }
.welcome-logo { width: 84px; height: 84px; border-radius: 22px; box-shadow: 0 10px 30px color-mix(in srgb, var(--accent) 40%, transparent); }
.welcome-hero h1 { font-size: 34px; margin: 14px 0 4px; }
.welcome-hero p { color: var(--muted); margin: 0; font-size: 16px; }
.welcome-points { list-style: none; padding: 0; margin: 22px 0; display: grid; gap: 12px; }
.welcome-points li { display: flex; gap: 14px; align-items: center; padding: 12px 14px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); }
.welcome-points li > span { font-size: 24px; width: 32px; text-align: center; }
.welcome-points small { display: block; color: var(--muted); font-size: 13px; }
.onboarding { max-width: 520px; margin: 0 auto; }
.onb-hello { background: color-mix(in srgb, var(--accent) 9%, var(--surface)); border: 1px solid color-mix(in srgb, var(--accent) 30%, var(--line));
  border-radius: var(--radius); padding: 12px 14px; margin: 14px 0 0; }

/* ---------- calendar ---------- */
.week-card { margin-top: 12px; }
.week-strip { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; margin-top: 10px; }
.wday { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 0; border-radius: 10px; border: 0; background: transparent; }
.wday .wd { font-size: 11px; color: var(--muted); }
.wday .dn { font-weight: 700; font-size: 15px; }
.wday i { width: 6px; height: 6px; border-radius: 50%; background: transparent; }
.wday.planned i, .lg.planned { background: var(--accent); }
.wday.done i, .lg.done { background: var(--good); }
.wday.missed i, .lg.missed { background: var(--muted); }
.wday.today { background: color-mix(in srgb, var(--accent) 12%, transparent); }
.wday.today .dn { color: var(--accent); }
.lg { display: inline-block; width: 9px; height: 9px; border-radius: 50%; flex: none; }
.today-card { margin: 0 0 10px; gap: 12px; border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; }
.cal-grid.head span { text-align: center; font-size: 11px; color: var(--muted); padding: 4px 0; }
.cal-cell { min-height: 64px; display: flex; flex-direction: column; align-items: stretch; gap: 2px; padding: 4px 3px; text-align: left;
  border: 1px solid var(--line); border-radius: 9px; background: var(--surface); overflow: hidden; }
.cal-cell.out { opacity: .45; }
.cal-cell.today { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.cal-cell .dn { font-size: 12px; font-weight: 700; }
.chip-e { font-size: 9.5px; line-height: 1.25; padding: 1px 4px; border-radius: 5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chip-e.planned { background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--accent); }
.chip-e.done { background: color-mix(in srgb, var(--good) 18%, transparent); color: var(--good); }
.chip-e.missed { background: var(--surface-2); color: var(--muted); text-decoration: line-through; }
.chip-e.more { color: var(--muted); }

/* ---------- AI coach ---------- */
body.in-coach .view { padding-bottom: calc(var(--tabs-h) + var(--safe-b) + 150px); }
body.in-coach .active-bar { display: none; }
.plan-builder-btn { margin: 12px 0 6px; }
.coach-log { display: flex; flex-direction: column; gap: 12px; margin-top: 10px; }
.coach-hello { display: flex; gap: 12px; align-items: flex-start; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.bot-av { flex: none; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font-size: 16px;
  background: linear-gradient(135deg, #818cf8, #3b82f6); color: #fff; }
.msg { display: flex; gap: 8px; align-items: flex-end; }
.msg.user { justify-content: flex-end; }
.msg .bubble { max-width: 86%; padding: 10px 13px; border-radius: 16px; font-size: 14.5px; line-height: 1.5; overflow-wrap: anywhere; }
.msg.user .bubble { background: var(--accent); color: #fff; border-bottom-right-radius: 5px; }
.msg.bot .bubble { background: var(--surface); border: 1px solid var(--line); border-bottom-left-radius: 5px; }
.msg.bot .bubble p { margin: 0 0 6px; }
.msg.bot .bubble p:last-child { margin-bottom: 0; }
.msg.bot .bubble ul, .msg.bot .bubble ol { margin: 4px 0 8px; padding-left: 20px; }
.msg.bot .bubble li { margin: 2px 0; }
.msg.bot .bubble h4 { margin: 8px 0 4px; font-size: 14.5px; }
.msg.bot .bubble code { background: var(--surface-2); padding: 1px 5px; border-radius: 5px; font-size: 13px; }
.msg.bot .bubble .gap { height: 4px; }
.msg .err { color: var(--bad); margin: 6px 0 0; }
.typing { display: inline-flex; gap: 4px; vertical-align: middle; }
.typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); animation: blink 1.2s infinite; }
.typing i:nth-child(2) { animation-delay: .2s; }
.typing i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }
.suggest { display: flex; flex-wrap: wrap; gap: 8px; }
.chip-q { border: 1px solid var(--line); background: var(--surface); border-radius: 14px; padding: 9px 12px; font-size: 13.5px; text-align: left; }
.chip-q:hover { border-color: var(--accent); }
.coach-note { text-align: center; margin: 16px 0 0; }
.action-card { margin-top: 10px; padding: 12px; border-radius: 12px; border: 1.5px solid color-mix(in srgb, var(--accent) 55%, var(--line)); background: var(--bg); }
.action-card.approved { border-color: color-mix(in srgb, var(--good) 60%, var(--line)); }
.action-card.declined, .action-card.failed { border-color: var(--line); opacity: .85; }
.action-card .ac-head { font-weight: 700; margin-bottom: 6px; }
.action-card .ac-body { max-height: 260px; overflow-y: auto; margin-bottom: 10px; font-size: 13.5px; }
.action-card .ac-body ul { margin: 2px 0 8px; padding-left: 18px; }
.action-card .ac-routine b { display: block; margin-top: 4px; }
.action-card .ok { color: var(--good); font-weight: 600; }
.coach-input {
  position: fixed; left: 0; right: 0; z-index: 18; bottom: calc(var(--tabs-h) + var(--safe-b));
  display: flex; gap: 8px; align-items: flex-end; max-width: 640px; margin: 0 auto;
  padding: 10px 16px; background: var(--bg); border-top: 1px solid var(--line);
}
.coach-input textarea {
  flex: 1; resize: none; max-height: 140px; padding: 11px 14px; border-radius: 20px; border: 1px solid var(--line);
  background: var(--surface); outline: none; line-height: 1.35;
}
.coach-input textarea:focus { border-color: var(--accent); }
.coach-input .btn { border-radius: 50%; width: 44px; height: 44px; padding: 0; flex: none; }

/* ---------- legal pages ---------- */
.legal { line-height: 1.6; }
.legal h2 { font-size: 16px; margin: 22px 0 6px; }
.legal p, .legal li { font-size: 14px; }
.legal ul { padding-left: 20px; margin: 6px 0; }
.legal a, p.small a, .muted a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.legal .card p { margin: 6px 0; }
mark.ph { background: color-mix(in srgb, var(--warn) 28%, transparent); color: inherit; padding: 0 3px; border-radius: 4px; }
.legal-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 16px; margin: 22px 0 6px; }
.legal-links a { color: var(--muted); text-decoration: underline; text-underline-offset: 2px; }

/* ---------- Pro ---------- */
.pro-mark { display: inline-grid; place-items: center; padding: 3px 8px; border-radius: 7px; font-size: 11px; font-weight: 800; letter-spacing: .06em;
  color: #1a1200; background: linear-gradient(135deg, #fde68a, #f59e0b); vertical-align: middle; }
.pro-mark.sm { font-size: 10px; padding: 2px 6px; }
.pro-mark.big { font-size: 18px; padding: 8px 16px; border-radius: 12px; }
.pro-hero { text-align: center; padding: 10px 0 6px; }
.pro-hero h1 { margin: 12px 0 4px; }
.pro-hero p { color: var(--muted); margin: 0 0 14px; }
.benefits .row { padding: 7px 0; gap: 12px; }
.b-icon { width: 28px; text-align: center; font-size: 18px; }
.tick { color: var(--good); font-weight: 800; }
.plans { display: grid; gap: 10px; margin: 14px 0; }
.plan-opt { position: relative; display: flex; align-items: center; gap: 12px; text-align: left; padding: 15px 14px; border-radius: var(--radius);
  border: 2px solid var(--line); background: var(--surface); }
.plan-opt .grow { display: flex; flex-direction: column; }
.plan-opt.on { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, var(--surface)); }
.plan-opt .radio { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--line); flex: none; }
.plan-opt.on .radio { border: 6px solid var(--accent); }
.plan-tag { position: absolute; top: -10px; left: 14px; background: var(--accent); color: #fff; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 99px; }
.trial-pill { position: absolute; top: -10px; right: 14px; background: var(--good); color: #fff; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 99px; }
.big-cta { padding: 15px; font-size: 16px; }
.pro-card { border-color: color-mix(in srgb, var(--gold) 55%, var(--line)); }
.pro-upsell { display: block; border-color: color-mix(in srgb, var(--gold) 45%, var(--line)); background: color-mix(in srgb, var(--gold) 7%, var(--surface)); }
.pro-upsell .row { gap: 12px; }
.paywall { text-align: center; }
.paywall .pro-mark { font-size: 16px; padding: 7px 14px; margin: 6px 0 4px; }
.google-btn { display: flex; justify-content: center; min-height: 44px; margin: 14px 0 4px; }
.divider { display: flex; align-items: center; gap: 10px; margin: 14px 0; color: var(--muted); font-size: 12px; }
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.g-logo { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: #fff; border: 1px solid var(--line); color: #4285f4; font-weight: 800; font-size: 12px; margin-right: 4px; }
img.uav { object-fit: cover; background: var(--surface-2); }
.avatar-edit { position: relative; cursor: pointer; flex: none; }
.avatar-edit { display: block; }
.avatar-edit > .cam { position: absolute; right: -2px; bottom: -2px; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; background: var(--surface); border: 1px solid var(--line); }
.pick-item.on { background: color-mix(in srgb, var(--accent) 14%, transparent); border-radius: 10px; }
.pick-item.on .avatar { background: var(--accent); color: #fff; }

.toast {
  position: fixed; left: 50%; transform: translateX(-50%); z-index: 60;
  bottom: calc(var(--tabs-h) + var(--safe-b) + 70px);
  background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 99px; font-weight: 600; font-size: 14px;
}

/* ---------- charts ---------- */
.chart { width: 100%; height: auto; display: block; }
.chart .axis { stroke: var(--line); }
.chart .lbl { fill: var(--muted); font-size: 20px; }
.chart .line { fill: none; stroke: var(--accent); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.chart .area { fill: color-mix(in srgb, var(--accent) 16%, transparent); }
.chart .pt { fill: var(--accent); }
.chart .barr { fill: var(--accent); }
.muscle-bar { height: 8px; border-radius: 6px; background: var(--accent); }

.summary-hero { text-align: center; padding: 18px 0 8px; }
.summary-hero .big { font-size: 44px; }

/* =====================================================================
   Premium theme layer: refined palette, type, depth and motion.
   Sits on top of the base styles; component structure is unchanged.
   ===================================================================== */
:root {
  --bg: #0a0b0f;
  --surface: #13151b;
  --surface-2: #1c1f27;
  --line: rgba(255, 255, 255, .07);
  --text: #f3f4f8;
  --muted: #8a91a3;
  --accent: #5b7cff;
  --accent-2: #9b5cff;
  --grad: linear-gradient(135deg, #5b7cff 0%, #9b5cff 100%);
  --good: #2fd27b;
  --gold: #f6c453;
  --radius: 18px;
  --shadow: 0 1px 0 rgba(255, 255, 255, .04) inset, 0 10px 30px rgba(0, 0, 0, .35);
  --shadow-sm: 0 4px 14px rgba(0, 0, 0, .25);
}
@media (prefers-color-scheme: light) {
  :root {
    --bg: #f5f6fa; --surface: #ffffff; --surface-2: #f0f2f7; --line: rgba(15, 20, 40, .08);
    --text: #0e1120; --muted: #667089;
    --shadow: 0 1px 2px rgba(15, 20, 40, .05), 0 10px 30px rgba(15, 20, 40, .07);
    --shadow-sm: 0 3px 10px rgba(15, 20, 40, .07);
  }
}

body {
  font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 15px; letter-spacing: -0.006em;
  -webkit-font-smoothing: antialiased;
  background:
    radial-gradient(1200px 500px at 50% -220px, color-mix(in srgb, var(--accent) 16%, transparent), transparent 70%),
    var(--bg);
  background-attachment: fixed;
}
h1 { font-size: 30px; font-weight: 800; letter-spacing: -0.03em; line-height: 1.1; }
h2 { font-size: 18px; font-weight: 700; letter-spacing: -0.02em; }
h3 { font-weight: 700; letter-spacing: -0.01em; }

/* surfaces */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 12px; box-shadow: var(--shadow-sm); }
.stat b { font-size: 21px; font-weight: 800; letter-spacing: -0.02em; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* buttons */
.btn { border-radius: 13px; font-weight: 650; padding: 12px 16px; transition: transform .12s ease, filter .15s ease, background .15s; border-color: var(--line); }
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--grad); border: 0; color: #fff; box-shadow: 0 8px 22px color-mix(in srgb, var(--accent) 35%, transparent); }
.btn.primary:hover { filter: brightness(1.07); }
.btn.sm { padding: 8px 12px; border-radius: 11px; }
.big-cta { padding: 16px; font-size: 16px; border-radius: 16px; }

/* inputs */
input.field, select.field, textarea.field { border-radius: 13px; padding: 12px 14px; border: 1px solid var(--line); background: var(--surface-2); transition: border-color .15s, box-shadow .15s; }
input.field:focus, textarea.field:focus, select.field:focus { border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 18%, transparent); }

/* chips & segmented control */
.chips button { border-radius: 999px; padding: 7px 14px; background: var(--surface); border-color: var(--line); font-weight: 600; }
.chips button.on { background: var(--grad); border-color: transparent; color: #fff; }
.seg { background: var(--surface-2); border: 1px solid var(--line); border-radius: 14px; padding: 4px; }
.seg button { border-radius: 10px; font-weight: 650; }
.seg button.on { background: var(--surface); box-shadow: var(--shadow-sm); color: var(--text); }
.pill { background: var(--surface-2); border: 1px solid var(--line); font-weight: 600; }

/* frosted tab bar */
.tabs {
  background: color-mix(in srgb, var(--surface) 78%, transparent);
  backdrop-filter: saturate(160%) blur(18px); -webkit-backdrop-filter: saturate(160%) blur(18px);
  border-top: 1px solid var(--line);
}
.tabs a { font-weight: 600; gap: 4px; }
.tabs a svg { width: 23px; height: 23px; transition: transform .15s; }
.tabs a.on { color: var(--accent); }
.tabs a.on svg { transform: translateY(-1px); filter: drop-shadow(0 4px 10px color-mix(in srgb, var(--accent) 50%, transparent)); }
.active-bar { background: var(--grad); border-radius: 16px; box-shadow: 0 10px 28px color-mix(in srgb, var(--accent) 45%, transparent); }

/* lists, avatars, thumbs */
.list-item { border-color: var(--line); }
.avatar, .thumb { border-radius: 12px; }
.plan-icon { border-radius: 14px; background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line); }

/* sheets, toasts, options */
.sheet-backdrop { background: rgba(5, 6, 10, .6); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); }
.sheet { background: var(--surface); border-radius: 24px 24px 0 0; box-shadow: 0 -10px 40px rgba(0, 0, 0, .35); }
.toast { box-shadow: var(--shadow); font-weight: 600; }
.option { border-radius: 16px; background: var(--surface); box-shadow: var(--shadow-sm); transition: border-color .15s, transform .12s; }
.option:active { transform: scale(.99); }
.option.on { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, var(--surface)); color: var(--text); }
.progress i { background: var(--grad); }

/* workout logging */
.sets tr.done td { background: color-mix(in srgb, var(--good) 13%, transparent); }
.check.on { background: var(--good); box-shadow: 0 4px 12px color-mix(in srgb, var(--good) 40%, transparent); }
.ex-title { color: var(--text); font-weight: 750; }
.aw-head { background: color-mix(in srgb, var(--bg) 85%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
.coach-btn { background: color-mix(in srgb, var(--accent-2) 16%, var(--surface-2)); border-color: color-mix(in srgb, var(--accent-2) 35%, var(--line)); }

/* welcome */
.welcome-hero h1 { font-size: 40px; }
.welcome-points li { box-shadow: var(--shadow-sm); border-radius: 16px; }
.invite-banner { margin: 10px 0 0; padding: 12px 14px; border-radius: 16px; font-size: 14px;
  background: color-mix(in srgb, var(--gold) 14%, var(--surface)); border: 1px solid color-mix(in srgb, var(--gold) 40%, var(--line)); }

/* live workout banner in the coach */
.live-banner { display: flex; margin: 12px 0 6px; gap: 12px; border-color: color-mix(in srgb, var(--good) 45%, var(--line)); }
.live-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--good); box-shadow: 0 0 0 4px color-mix(in srgb, var(--good) 25%, transparent); animation: pulse 1.4s infinite; flex: none; }

/* invite friends */
.invite-card { width: 100%; display: flex; align-items: center; gap: 12px; text-align: left; cursor: pointer; color: var(--text);
  background: linear-gradient(135deg, color-mix(in srgb, var(--gold) 16%, var(--surface)), var(--surface));
  border-color: color-mix(in srgb, var(--gold) 40%, var(--line)); }
.invite-card small { display: block; color: var(--muted); font-size: 12.5px; }
.invite-gift { font-size: 28px; }
.coupon-card { display: flex; align-items: center; gap: 12px; color: var(--text);
  background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 14%, var(--surface)), var(--surface));
  border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); }
.coupon-card small { display: block; color: var(--muted); font-size: 12.5px; }
.plan-opt s { font-weight: 500; margin-right: 2px; }

/* safety: report / block / moderation */
.mod-note { margin: 8px 0 0; padding: 6px 10px; border-radius: 10px; background: color-mix(in srgb, var(--warn) 14%, var(--surface)); color: var(--text); }
.radio-row { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; cursor: pointer; }
.radio-row:has(input:checked) { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, var(--surface)); }
.report-card .report-preview { margin: 8px 0; padding: 8px 10px; border-left: 3px solid var(--line); background: var(--surface-2); border-radius: 6px; white-space: pre-wrap; }
.comment.just-added { animation: comment-flash 1.6s ease-out; border-radius: 10px; }
@keyframes comment-flash { from { background: color-mix(in srgb, var(--accent) 22%, transparent); } to { background: transparent; } }
.toast-undo { margin-left: 10px; border: 0; background: transparent; color: var(--accent); font-weight: 700; cursor: pointer; }

/* comments: likes, replies, mentions (D-23) */
.comment.reply { margin-left: 40px; }
.c-actions { display: flex; gap: 14px; margin-top: 4px; }
.c-like, .c-reply { border: 0; background: transparent; padding: 2px 0; color: var(--muted); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; }
.c-like.on { color: #ef4444; }
.mention { color: var(--accent); font-weight: 600; }
.replying { display: flex; align-items: center; justify-content: space-between; padding: 2px 4px 6px; }
.mention-box { display: grid; margin: 6px 0; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--surface); box-shadow: var(--shadow-sm, 0 4px 14px rgb(0 0 0 / .12)); }
.mention-box button { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border: 0; background: transparent; color: var(--text); text-align: left; cursor: pointer; font: inherit; }
.mention-box button:hover { background: var(--surface-2); }
.post-actions > .like-wrap { gap: 2px; padding: 0; }
.like-wrap button { border: 0; background: transparent; color: inherit; font: inherit; font-weight: 600; padding: 8px 4px; cursor: pointer; border-radius: 10px; }
.like-count { text-decoration: underline dotted; text-underline-offset: 3px; }

/* skeleton placeholders (D-22) */
.sk { display: block; background: linear-gradient(90deg, var(--surface-2) 25%, color-mix(in srgb, var(--surface-2) 55%, var(--surface)) 50%, var(--surface-2) 75%);
  background-size: 200% 100%; animation: sk-shimmer 1.3s ease-in-out infinite; border-radius: 8px; }
.sk-line { height: 12px; margin: 6px 0; }
.sk-avatar { width: 40px; height: 40px; border-radius: 50%; flex: none; }
@keyframes sk-shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .sk { animation: none; } }

/* workout summary: records, milestones, confetti (D-03) */
.pr-row .pr-badge { font-size: 22px; margin-right: 4px; }
.milestone { background: linear-gradient(135deg, color-mix(in srgb, var(--gold) 18%, var(--surface)), var(--surface));
  border-color: color-mix(in srgb, var(--gold) 45%, var(--line)); }
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 300; overflow: hidden; }
.confetti i { position: absolute; top: -12px; width: 8px; height: 14px; border-radius: 2px; animation: confetti-fall linear forwards; }
@keyframes confetti-fall { to { top: 105%; transform: translateX(40px) rotate(720deg); } }

/* payment confirmation overlay */
.pay-busy { position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; padding: 16px;
  background: rgb(0 0 0 / .45); backdrop-filter: blur(4px); }
.pay-busy-box { display: grid; justify-items: center; gap: 10px; padding: 24px 28px; border-radius: 18px;
  background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg, 0 10px 30px rgb(0 0 0 / .3)); text-align: center; }
.pay-busy-box small { color: var(--muted); }
.spinner { width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--accent);
  animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.invite-hero { text-align: center; }
.invite-big { font-size: 46px; }
.invite-link { display: flex; padding: 12px 14px; margin-bottom: 10px; border-radius: 13px; background: var(--surface-2);
  border: 1px dashed color-mix(in srgb, var(--accent) 45%, var(--line)); font-weight: 600; font-size: 14px; overflow: hidden; }
.invite-link span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* share sheet */
.share-hero { width: 100%; display: flex; align-items: center; gap: 14px; padding: 14px; margin-bottom: 14px; text-align: left;
  border-radius: 16px; border: 0; color: #fff; background: linear-gradient(135deg, #f58529, #dd2a7b 45%, #8134af 75%, #515bd4); }
.share-hero small { display: block; opacity: .85; font-size: 12.5px; }
.share-hero .muted { color: #fff; opacity: .8; }
.share-ig { font-size: 26px; }
.share-images { margin-bottom: 14px; }
.share-images .share-hero { margin-bottom: 8px; }
.share-hero.alt { background: linear-gradient(135deg, #3b82f6, #8b5cf6); }
.share-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px 8px; }
.share-app { display: flex; flex-direction: column; align-items: center; gap: 6px; border: 0; background: transparent; padding: 0; }
.share-app small { font-size: 12px; color: var(--muted); font-weight: 600; }
.share-icon { width: 54px; height: 54px; border-radius: 16px; display: grid; place-items: center; font-size: 20px; font-weight: 800; box-shadow: var(--shadow-sm); }
.share-icon svg { width: 28px; height: 28px; }
.share-btn { background: linear-gradient(135deg, color-mix(in srgb, #dd2a7b 14%, var(--surface-2)), var(--surface-2)); }

/* suggested athletes (Discover) */
.athletes { display: flex; gap: 10px; overflow-x: auto; padding: 2px 2px 12px; margin: 0 -2px 6px; scrollbar-width: none; scroll-snap-type: x mandatory; }
.athlete { flex: none; width: 132px; display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 14px 10px; text-align: center;
  background: var(--surface); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow-sm); scroll-snap-align: start; }
.athlete a { display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 0; width: 100%; }
.athlete b { font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.athlete small { color: var(--muted); font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.athlete .btn { width: 100%; }

/* public workout page */
.public-head { gap: 10px; margin: 6px 0 14px; font-size: 18px; }
.cta-card { text-align: center; }

/* posts */
.post-stats b { font-weight: 800; }
.post-actions > * { border-radius: 12px; }

/* A required field left empty, e.g. weight on a ticked set (D-27). */
.sets input.invalid { outline: 2px solid var(--bad); outline-offset: -2px; }

/* Swipe a set left to delete it (D-36). */
.sets .del-set { display: none; border: 0; border-radius: 8px; background: var(--bad); color: #fff; font-weight: 700; font-size: 12px; padding: 8px 10px; cursor: pointer; }
.sets tr.swiped .del-set { display: inline-block; }
.sets tr.swiped .check { display: none; }

/* Section headings in the exercise picker (D-29). */
.pick-head { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 12px 0 4px; }

/* Sign-up username status and email code (D-30). */
.uname-ok { color: var(--good); }
.uname-bad { color: var(--bad); }
.link-btn { border: 0; background: none; color: var(--accent); font: inherit; font-weight: 600; padding: 0 0 0 4px; cursor: pointer; text-decoration: underline; }
.otp-field { font-size: 28px; letter-spacing: .5em; text-align: center; font-variant-numeric: tabular-nums; }

/* Report a bug attachments (D-34). */
.bug-files { display: flex; gap: 8px; flex-wrap: wrap; }
.bug-file, .bug-add { position: relative; width: 76px; height: 76px; border-radius: 12px; overflow: hidden; background: var(--surface-2); display: grid; place-items: center; font-size: 28px; }
.bug-file img { width: 100%; height: 100%; object-fit: cover; }
.bug-add { cursor: pointer; color: var(--muted); border: 1px dashed var(--line); }
.bug-file-x { position: absolute; top: 4px; right: 4px; width: 22px; height: 22px; border-radius: 50%; border: 0; background: rgba(0,0,0,.6); color: #fff; font-size: 12px; cursor: pointer; }

/* Coupon code on the Pro page and admin list. */
.promo-link { display: block; margin: 4px auto 10px; }
.promo-row { display: flex; gap: 8px; align-items: center; }
.promo-row .field { flex: 1; min-width: 0; text-transform: uppercase; }
.promo-ok { color: var(--good); }
.promo-bad { color: var(--bad); }
.mono { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; }
