:root {
  --bg: #0e1013;
  --surface: #171a1f;
  --surface-2: #1f232a;
  --surface-3: #282d36;
  --border: #2c313a;
  --text: #eef1f5;
  --muted: #aab2be;
  --faint: #868e9b;
  --accent: #c8f169;
  --accent-ink: #14200a;
  --accent-soft: rgba(200, 241, 105, 0.12);
  --danger: #ff6b6b;
  --danger-soft: rgba(255, 107, 107, 0.12);
  --warn: #ffc857;
  --warn-soft: rgba(255, 200, 87, 0.12);
  --info: #6cb8ff;
  --up: #6ee7a8;
  --down: #ff8a8a;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --nav-h: 66px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 var(--font);
  font-variant-numeric: tabular-nums;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
a { color: var(--accent); text-decoration: none; }
h1, h2, h3, h4 { margin: 0; line-height: 1.2; letter-spacing: -0.01em; }
h1 { font-size: 24px; font-weight: 750; }
h2 { font-size: 19px; font-weight: 700; }
h3 { font-size: 16px; font-weight: 650; }
p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
img { display: block; max-width: 100%; }
[hidden] { display: none !important; }

.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 14px; }
.tiny { font-size: 12.5px; }
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.stack.lg { gap: 20px; }
.grow { flex: 1; min-width: 0; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.capitalize { text-transform: capitalize; }

/* ───────── Layout ───────── */
.app { min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 16px;
  padding: 12px 16px; background: rgba(14, 16, 19, 0.88);
  backdrop-filter: blur(12px); border-bottom: 1px solid var(--border);
}
.brand { white-space: nowrap; font-weight: 800; letter-spacing: -0.02em; font-size: 18px; color: var(--text); display: flex; align-items: center; gap: 8px; }
.brand-mark { width: 26px; height: 26px; border-radius: 8px; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; font-size: 15px; font-weight: 900; }
.topnav { display: flex; gap: 4px; margin-left: 12px; }
.topnav a { color: var(--muted); padding: 8px 12px; border-radius: 10px; font-weight: 550; }
.topnav a.active { color: var(--text); background: var(--surface-2); }
.topbar .spacer { flex: 1; }
.main { flex: 1; width: 100%; max-width: 900px; margin: 0 auto; padding: 18px 16px calc(var(--nav-h) + 28px); }
.main.wide { max-width: 1100px; }

.bottomnav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 20;
  display: none; height: calc(var(--nav-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: rgba(23, 26, 31, 0.96); backdrop-filter: blur(12px);
  border-top: 1px solid var(--border);
}
.bottomnav a {
  flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  color: var(--muted); font-size: 12px; font-weight: 650;
}
.bottomnav a span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bottomnav a svg { width: 24px; height: 24px; }
.bottomnav a.active { color: var(--accent); }
.bottomnav a.active svg { filter: drop-shadow(0 0 8px rgba(200, 241, 105, 0.35)); }
@media (max-width: 760px) {
  .topnav { display: none; }
  .bottomnav { display: flex; }
  .topbar { gap: 10px; padding: 10px 14px; padding-top: calc(10px + env(safe-area-inset-top)); }
  .topbar .who { display: none; }
  .main { padding-left: 14px; padding-right: 14px; }
}
@media (min-width: 761px) {
  .main { padding-bottom: 40px; }
}

/* ───────── Cards & surfaces ───────── */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }
.card.tight { padding: 12px; }
.card-title { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.divider { height: 1px; background: var(--border); margin: 4px 0; }
.empty { text-align: center; padding: 36px 16px; color: var(--muted); }
.empty .big { font-size: 40px; margin-bottom: 8px; }

/* ───────── Buttons ───────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 42px; padding: 0 16px; border-radius: 11px; border: 1px solid var(--border);
  background: var(--surface-2); color: var(--text); font-weight: 600; cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.05s; white-space: nowrap;
}
.btn:hover { background: var(--surface-3); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.btn.primary:hover { filter: brightness(1.06); }
.btn.danger { color: var(--danger); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { color: var(--text); background: var(--surface-2); }
.btn.sm { min-height: 34px; padding: 0 12px; font-size: 13.5px; border-radius: 9px; }
.btn.block { width: 100%; }
.icon-btn {
  width: 34px; height: 34px; border-radius: 50%; display: inline-grid; place-items: center;
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text); cursor: pointer; flex: none;
}
.icon-btn:hover { background: var(--surface-3); }
.icon-btn svg { width: 17px; height: 17px; }
.info-btn { font-family: Georgia, serif; font-style: italic; font-weight: 700; font-size: 16px; }
.how-btn { border-radius: 999px; width: auto; padding: 0 12px; height: 34px; font-weight: 700; font-size: 13px; gap: 6px; display: inline-flex; align-items: center; }
.how-btn svg { width: 14px; height: 14px; color: #ff4e45; }

/* ───────── Forms ───────── */
label.field { display: flex; flex-direction: column; gap: 6px; font-size: 14px; color: var(--muted); font-weight: 550; }
.input, select.input, textarea.input {
  width: 100%; min-height: 46px; padding: 10px 12px; border-radius: 10px;
  background: var(--bg); border: 1px solid #353b46; color: var(--text); font-size: 16px;
  outline: none; transition: border-color 0.15s, box-shadow 0.15s;
}
textarea.input { min-height: 80px; resize: vertical; }
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.input:disabled { opacity: 0.6; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
@media (max-width: 520px) { .grid-3 { grid-template-columns: 1fr 1fr; } }
.seg { display: inline-flex; background: var(--bg); border: 1px solid var(--border); border-radius: 11px; padding: 3px; gap: 2px; }
.seg button { border: 0; background: transparent; color: var(--muted); padding: 9px 14px; border-radius: 8px; cursor: pointer; font-weight: 650; font-size: 14px; }
.seg button.on { background: var(--surface-3); color: var(--text); }
.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; font-weight: 550; }
.switch input { appearance: none; width: 42px; height: 24px; border-radius: 99px; background: var(--surface-3); position: relative; cursor: pointer; transition: background 0.15s; margin: 0; }
.switch input::after { content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: transform 0.15s; }
.switch input:checked { background: var(--accent); }
.switch input:checked::after { transform: translateX(18px); background: var(--accent-ink); }
.error-text { color: var(--danger); font-size: 13.5px; }

/* ───────── Badges / chips ───────── */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 99px; font-size: 12.5px; font-weight: 650; background: var(--surface-3); color: var(--muted); white-space: nowrap; }
.badge.ok { background: var(--accent-soft); color: var(--accent); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.bad { background: var(--danger-soft); color: var(--danger); }
.badge.info { background: rgba(108, 184, 255, 0.12); color: var(--info); }
.chips { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; padding: 9px 14px; border-radius: 99px; border: 1px solid var(--border); background: var(--surface); color: var(--muted); font-size: 14px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.chip.on { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.chip .n { opacity: 0.6; margin-left: 4px; font-weight: 500; }

/* ───────── Banner ───────── */
.banner { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: 12px; font-size: 14px; border: 1px solid; }
.banner.warn { background: var(--warn-soft); border-color: rgba(255, 200, 87, 0.3); color: #ffe2a3; }
.banner.bad { background: var(--danger-soft); border-color: rgba(255, 107, 107, 0.3); color: #ffc4c4; }
.banner.info { background: rgba(108, 184, 255, 0.1); border-color: rgba(108, 184, 255, 0.3); color: #cfe6ff; }
.banner b { color: #fff; }

/* ───────── Auth ───────── */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background:
  radial-gradient(800px 400px at 10% -10%, rgba(200, 241, 105, 0.12), transparent 60%),
  radial-gradient(600px 400px at 110% 110%, rgba(108, 184, 255, 0.08), transparent 60%), var(--bg); }
.auth-card { width: 100%; max-width: 420px; }
.auth-card .brand { justify-content: center; font-size: 24px; margin-bottom: 6px; }
.auth-card .brand-mark { width: 34px; height: 34px; font-size: 19px; border-radius: 10px; }

/* ───────── Week strip ───────── */
.week-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.week-head .label { flex: 1; text-align: center; font-weight: 650; }
.week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.day-pill {
  display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 2px 9px; border-radius: 12px;
  background: var(--surface); border: 1px solid var(--border); cursor: pointer; position: relative; min-width: 0;
}
.day-pill .dow { font-size: 11.5px; color: var(--faint); font-weight: 650; text-transform: uppercase; letter-spacing: 0.04em; }
.day-pill .num { font-size: 19px; font-weight: 800; }
.day-pill .tag { font-size: 11px; color: var(--muted); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 0 3px; }
.day-pill.today .num { color: var(--accent); }
.day-pill.sel { background: var(--accent); border-color: transparent; }
.day-pill.sel .dow, .day-pill.sel .num, .day-pill.sel .tag { color: var(--accent-ink); }
.day-pill .dot { position: absolute; top: 6px; right: 6px; width: 6px; height: 6px; border-radius: 50%; background: var(--up); }
.day-pill.sel .dot { background: var(--accent-ink); }

/* ───────── Exercise card (member day) ───────── */
.ex-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.ex-card.complete { border-color: rgba(200, 241, 105, 0.45); }
.ex-head { display: flex; gap: 12px; padding: 12px; align-items: flex-start; }
.ex-thumb {
  width: 72px; height: 72px; border-radius: 11px; flex: none; overflow: hidden; background: #fff; cursor: pointer;
  position: relative; border: 1px solid var(--border);
}
.ex-thumb img { width: 100%; height: 100%; object-fit: cover; }
.ex-thumb.ph { background: linear-gradient(135deg, var(--surface-3), var(--surface-2)); display: grid; place-items: center; font-size: 30px; }
.ex-thumb.sm { width: 48px; height: 48px; border-radius: 9px; }
.ex-thumb.sm.ph { font-size: 22px; }
.ex-title { font-weight: 700; font-size: 16px; line-height: 1.25; }
.ex-meta { display: flex; flex-wrap: wrap; gap: 6px 10px; margin-top: 5px; font-size: 14px; color: var(--muted); }
.ex-meta b { color: var(--text); font-weight: 650; }
.ex-actions { display: flex; gap: 6px; flex: none; }
.coach-note { margin: 0 12px 10px; padding: 9px 11px; border-radius: 9px; background: var(--surface-2); font-size: 14.5px; color: var(--muted); border-left: 3px solid var(--accent); }
.coach-note b { color: var(--text); }
.sets { padding: 0 12px 12px; }
.set-row { display: grid; align-items: center; gap: 8px; padding: 5px 0; }
.set-row.head { font-size: 12px; color: var(--faint); font-weight: 650; text-transform: uppercase; letter-spacing: 0.04em; padding-bottom: 2px; }
.set-row .no { width: 28px; height: 28px; border-radius: 8px; background: var(--surface-2); display: grid; place-items: center; font-weight: 750; font-size: 14px; }
.set-row .prev { font-size: 13.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.set-row .cell { min-height: 44px; padding: 6px 6px; text-align: center; font-weight: 750; font-size: 18px; border-radius: 9px; width: 100%; }
.set-row .cell::placeholder { color: var(--faint); font-weight: 500; }
.set-row.done .cell { background: var(--accent-soft); border-color: transparent; }
.set-row.done .no { background: var(--accent); color: var(--accent-ink); }
.check {
  width: 44px; height: 44px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface-2);
  display: grid; place-items: center; cursor: pointer; color: var(--faint);
}
.check svg { width: 20px; height: 20px; }
.check.on { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.check:disabled { cursor: not-allowed; opacity: 0.6; }
.ex-foot { display: flex; gap: 8px; padding: 0 12px 12px; flex-wrap: wrap; }
.cols-2 { grid-template-columns: 28px minmax(0, 1fr) 84px 70px 44px; }
.cols-1 { grid-template-columns: 28px minmax(0, 1fr) 112px 44px; }
@media (max-width: 400px) {
  .set-row { gap: 6px; }
  .cols-2 { grid-template-columns: 26px minmax(0, 1fr) 74px 58px 44px; }
  .cols-1 { grid-template-columns: 26px minmax(0, 1fr) 100px 44px; }
}
.day-summary { display: flex; gap: 10px; }
.stat { flex: 1; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; }
.stat .v { font-size: 22px; font-weight: 800; letter-spacing: -0.02em; }
.stat .k { font-size: 13px; color: var(--muted); font-weight: 600; }
.progress-bar { height: 6px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.progress-bar > div { height: 100%; background: var(--accent); border-radius: 99px; transition: width 0.3s; }

.rest-day { text-align: center; padding: 40px 20px; }
.rest-day .big { font-size: 54px; margin-bottom: 8px; }

/* ───────── Rest timer ───────── */
.rest-timer {
  position: fixed; left: 50%; transform: translateX(-50%); z-index: 40;
  bottom: calc(var(--nav-h) + 14px + env(safe-area-inset-bottom));
  display: flex; align-items: center; gap: 10px; padding: 8px 8px 8px 16px; border-radius: 99px;
  background: var(--accent); color: var(--accent-ink); box-shadow: var(--shadow); font-weight: 700;
}
.rest-timer .t { font-size: 20px; font-variant-numeric: tabular-nums; min-width: 54px; }
.rest-timer button { border: 0; background: rgba(0, 0, 0, 0.12); color: inherit; border-radius: 99px; padding: 7px 12px; font-weight: 700; cursor: pointer; }
@media (min-width: 761px) { .rest-timer { bottom: 24px; } }

/* ───────── Modal ───────── */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 50; background: rgba(0, 0, 0, 0.6); backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center; padding: 16px; animation: fade 0.15s ease-out;
}
.modal {
  width: 100%; max-width: 560px; max-height: calc(100vh - 32px); overflow: auto; background: var(--surface);
  border: 1px solid var(--border); border-radius: 18px; box-shadow: var(--shadow); animation: pop 0.18s ease-out;
}
.modal.wide { max-width: 760px; }
.modal-head { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; gap: 10px; padding: 14px 16px; background: var(--surface); border-bottom: 1px solid var(--border); }
.modal-head h2 { flex: 1; font-size: 18px; }
.modal-body { padding: 16px; }
@media (max-width: 560px) {
  .modal-backdrop { align-items: flex-end; padding: 0; }
  .modal { max-height: 92vh; border-radius: 18px 18px 0 0; border-bottom: 0; animation: slideup 0.2s ease-out; }
}
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { transform: scale(0.97); opacity: 0; } }
@keyframes slideup { from { transform: translateY(40px); opacity: 0; } }

.video-frame { position: relative; width: 100%; aspect-ratio: 16 / 9; border-radius: 12px; overflow: hidden; background: #000; }
.video-frame.short { aspect-ratio: 9 / 16; width: min(100%, calc(70vh * 9 / 16)); margin: 0 auto; }
.video-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.demo-img { width: 100%; aspect-ratio: 4 / 3; object-fit: contain; background: #fff; border-radius: 12px; }
.steps { margin: 0; padding-left: 22px; display: flex; flex-direction: column; gap: 8px; }
.steps li::marker { color: var(--accent); font-weight: 700; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; text-transform: capitalize; }

/* ───────── Lists ───────── */
.list { display: flex; flex-direction: column; }
.list-item { display: flex; align-items: center; gap: 12px; padding: 12px 4px; border-bottom: 1px solid var(--border); cursor: pointer; color: var(--text); }
.list-item:last-child { border-bottom: 0; }
.list-item:hover { background: rgba(255, 255, 255, 0.02); }
.list-item .chev { color: var(--faint); }
.avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--surface-3); display: grid; place-items: center; font-weight: 700; flex: none; color: var(--muted); }

/* ───────── Tabs ───────── */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 16px; overflow-x: auto; scrollbar-width: none; }
.tabs a { padding: 10px 14px; color: var(--muted); font-weight: 600; border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs a.active { color: var(--text); border-color: var(--accent); }

/* ───────── Plan editor ───────── */
.plan-days { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.plan-item { background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; padding: 10px; }
.plan-item .fields { display: grid; grid-template-columns: 70px 1fr 1fr 90px; gap: 8px; margin-top: 10px; }
.plan-item .fields label { font-size: 11.5px; }
.plan-item .input { min-height: 38px; padding: 7px 10px; font-size: 14px; }
@media (max-width: 560px) { .plan-item .fields { grid-template-columns: 1fr 1fr; } }

/* ───────── Picker ───────── */
.pick-list { display: flex; flex-direction: column; gap: 2px; }
.pick-item { display: flex; align-items: center; gap: 12px; padding: 8px; border-radius: 11px; cursor: pointer; }
.pick-item:hover { background: var(--surface-2); }
.pick-item .tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 3px; }

/* ───────── Progress ───────── */
.chart { width: 100%; height: auto; display: block; }
.chart .grid line { stroke: var(--border); }
.chart .axis text { fill: var(--muted); font-size: 12px; }
.chart .line { fill: none; stroke: var(--accent); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.chart .area { fill: url(#chartFill); }
.chart .pt { fill: var(--surface); stroke: var(--accent); stroke-width: 2; }
.chart .pt.best { fill: var(--accent); }
table.tbl { width: 100%; border-collapse: collapse; font-size: 15px; }
.tbl th { text-align: left; font-size: 12.5px; color: var(--muted); font-weight: 650; text-transform: uppercase; letter-spacing: 0.04em; padding: 8px 6px; border-bottom: 1px solid var(--border); }
.tbl td { padding: 9px 6px; border-bottom: 1px solid var(--border); vertical-align: top; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.delta.up { color: var(--up); }
.delta.down { color: var(--down); }
.table-scroll { overflow-x: auto; }

/* ───────── Toast ───────── */
.toasts { position: fixed; top: 14px; left: 50%; transform: translateX(-50%); z-index: 100; display: flex; flex-direction: column; gap: 8px; width: min(92vw, 420px); pointer-events: none; }
.toast { background: var(--surface-3); border: 1px solid var(--border); padding: 11px 14px; border-radius: 12px; box-shadow: var(--shadow); font-weight: 550; font-size: 14px; animation: pop 0.18s ease-out; }
.toast.err { border-color: rgba(255, 107, 107, 0.5); color: #ffd0d0; }
.toast.ok { border-color: rgba(200, 241, 105, 0.5); }

.spinner { width: 22px; height: 22px; border-radius: 50%; border: 3px solid var(--surface-3); border-top-color: var(--accent); animation: spin 0.7s linear infinite; margin: 30px auto; }
@keyframes spin { to { transform: rotate(360deg); } }
.skeleton { background: linear-gradient(90deg, var(--surface) 0%, var(--surface-2) 50%, var(--surface) 100%); background-size: 200% 100%; animation: shimmer 1.2s infinite; border-radius: var(--radius); }
@keyframes shimmer { to { background-position: -200% 0; } }
.hide-sm { }
@media (max-width: 520px) { .hide-sm { display: none; } }
.btn svg { width: 18px; height: 18px; flex: none; }
.btn.sm svg { width: 15px; height: 15px; }
.save-bar { position: sticky; bottom: calc(var(--nav-h) + 10px); background: var(--bg); padding: 10px 0; z-index: 5; }
@media (min-width: 761px) { .save-bar { bottom: 0; } }
.ring { --p: 0; --c: var(--accent); width: 112px; height: 112px; border-radius: 50%; flex: none; display: grid; place-items: center; text-align: center;
  background: radial-gradient(closest-side, var(--surface) 78%, transparent 79%), conic-gradient(var(--c) calc(var(--p) * 1%), var(--surface-3) 0); }
.ring-v { font-size: 24px; font-weight: 800; letter-spacing: -0.02em; line-height: 1.1; }
@media (max-width: 400px) { .ring { width: 96px; height: 96px; } .ring-v { font-size: 20px; } }

/* ───────── Macros ───────── */
.dot-c { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; vertical-align: 1px; }
.mbar .progress-bar { height: 7px; }
.setup-card { border-color: rgba(200, 241, 105, 0.45); background: linear-gradient(135deg, rgba(200, 241, 105, 0.08), var(--surface)); }
.advice { gap: 10px; }
.advice-row { display: flex; gap: 10px; align-items: flex-start; font-size: 15px; padding: 8px 10px; border-radius: 10px; background: var(--surface-2); border-left: 3px solid var(--faint); }
.advice-row.good { border-left-color: #4ade80; }
.advice-row.tip { border-left-color: #ffd43b; }
.advice-row.warn { border-left-color: #ff9f43; }
.advice-icon { font-size: 17px; line-height: 1.3; flex: none; }
.sugg { display: flex; gap: 10px; align-items: center; padding: 6px 8px; border-radius: 10px; background: var(--surface-2); }
.report-teaser { display: flex; align-items: center; gap: 8px; text-align: left; cursor: pointer; color: var(--text); border-color: rgba(108, 184, 255, 0.4); font: inherit; width: 100%; }
.report-teaser .chev { margin-left: auto; color: var(--faint); }
.report-teaser .chev svg, .list-item .chev svg { width: 16px; height: 16px; }
.report-msg { display: flex; flex-direction: column; gap: 8px; border-width: 1px; }
.report-msg.good { border-color: rgba(74, 222, 128, 0.5); background: linear-gradient(135deg, rgba(74, 222, 128, 0.1), var(--surface)); }
.report-msg.tip { border-color: rgba(255, 212, 59, 0.45); background: linear-gradient(135deg, rgba(255, 212, 59, 0.08), var(--surface)); }
.report-msg p { color: var(--muted); }
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
@media (max-width: 600px) { .stat-grid { grid-template-columns: 1fr 1fr; } }
.macro-tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; text-align: center; }
.macro-tiles b { display: block; font-size: 20px; font-weight: 800; letter-spacing: -0.02em; }
.macro-tiles span { font-size: 12.5px; color: var(--muted); }
.target-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.big-input { font-size: 20px; font-weight: 750; }
.tbl tfoot td { border-top: 1px solid var(--border); border-bottom: 0; }
.food-name { overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.facts { display: flex; flex-direction: column; gap: 12px; }
.facts-kcal { display: flex; justify-content: space-between; align-items: baseline; border-bottom: 6px solid var(--text); padding-bottom: 6px; font-weight: 800; font-size: 18px; }
.facts-kcal b { font-size: 26px; }
.facts-title { font-size: 12px; font-weight: 750; text-transform: uppercase; letter-spacing: 0.06em; color: var(--accent); margin-bottom: 4px; }
.facts-row { display: grid; grid-template-columns: 1fr auto 48px; gap: 2px 10px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--border); font-size: 15px; }
.facts-val { font-variant-numeric: tabular-nums; }
.facts-dv { text-align: right; color: var(--muted); font-size: 13.5px; font-variant-numeric: tabular-nums; }
.facts-bar { grid-column: 1 / -1; height: 4px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.facts-bar i { display: block; height: 100%; background: var(--accent); border-radius: 99px; }
.tbl.compact th, .tbl.compact td { padding: 8px 4px; }
.video-row.has { border-color: rgba(200, 241, 105, 0.35); }
.bottomnav a svg[fill="currentColor"] { width: 22px; height: 22px; }

/* ───────── Weekly progress photos ───────── */
.privacy-note { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 12px; background: rgba(108, 184, 255, 0.08); border: 1px solid rgba(108, 184, 255, 0.25); }
.privacy-note > span { font-size: 18px; }
.photo-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
@media (max-width: 520px) { .photo-grid:not(.small) { grid-template-columns: 1fr 1fr; } }
.photo-slot { position: relative; aspect-ratio: 3 / 4; border-radius: 12px; border: 1.5px dashed var(--border); background: var(--surface-2); overflow: hidden; cursor: pointer; padding: 0; color: var(--muted); display: grid; place-items: center; font: inherit; }
.photo-slot.has { border-style: solid; border-color: rgba(200, 241, 105, 0.4); }
.photo-slot.ghost { cursor: default; opacity: 0.45; }
.photo-slot.tall { aspect-ratio: 3 / 4; width: 100%; }
.photo-slot:disabled { cursor: default; }
.photo-slot .protected, .photo-slot canvas { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.photo-slot canvas { object-fit: cover; }
.slot-empty svg { width: 26px; height: 26px; }
.slot-label { position: absolute; left: 6px; bottom: 6px; font-size: 12.5px; font-weight: 700; padding: 2px 8px; border-radius: 99px; background: rgba(0, 0, 0, 0.55); color: #fff; }
.photo-grid.small .slot-label { font-size: 10px; padding: 1px 6px; }
.share-switch { align-items: flex-start; padding: 10px 12px; border-radius: 12px; background: var(--surface-2); }
.share-switch input { flex: none; margin-top: 2px; }
.compare-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; max-width: 760px; width: 100%; margin: 0 auto; }
.compare-cell { display: flex; flex-direction: column; gap: 4px; }
.compare-cell canvas { width: 100%; height: auto; border-radius: 12px; display: block; }
.protected { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.protected canvas { pointer-events: none; transition: filter 0.15s; }
body.shield .protected canvas { filter: blur(28px) brightness(0.6); }
@media print { .protected, .protected canvas { display: none !important; } }

/* ───────── Water & supplements ───────── */
.glasses { display: flex; flex-wrap: wrap; gap: 6px; }
/* A cup: water rises with a small wave on top; the cup pops when it gets water. */
.glass { position: relative; width: 20px; height: 26px; border: 2px solid #4c90d9; border-top: 0; border-radius: 0 0 6px 6px; overflow: hidden; }
.glass i { position: absolute; left: 0; right: 0; bottom: 0; height: 0; background: linear-gradient(to top, #2f7fe0, #5aa9ff); transition: height 0.5s cubic-bezier(0.3, 1.3, 0.5, 1); }
.glass i::before { content: ''; position: absolute; left: -50%; top: -3px; width: 200%; height: 6px; border-radius: 50%; background: #8cc4ff; opacity: 0; }
.glass.pop { animation: glass-pop 0.5s ease-out; }
.glass.pop i::before { opacity: 0.75; animation: glass-wave 0.5s ease-in-out 2; }
@keyframes glass-pop { 0% { transform: scale(1); } 35% { transform: scale(1.22) translateY(-2px); } 100% { transform: scale(1); } }
@keyframes glass-wave { 0%, 100% { transform: translateX(0); } 50% { transform: translateX(22%); } }
@media (prefers-reduced-motion: reduce) { .glass i { transition: none; } .glass.pop, .glass.pop i::before { animation: none; } }
.wrap-chips { display: flex; flex-wrap: wrap; gap: 6px; }
@media (max-width: 640px) { .grid-2.wide-2 { grid-template-columns: 1fr; } }

/* ───────── Printing (weekly report → PDF) ───────── */
@media print {
  :root { --bg: #fff; --surface: #fff; --surface-2: #f4f5f7; --surface-3: #e5e7eb; --border: #d6d9de; --text: #111; --muted: #4b5563; --faint: #6b7280; color-scheme: light; }
  body { background: #fff; }
  .topbar, .bottomnav, .toasts, .no-print, .rest-timer, .tabs, .week-head .icon-btn, a.small.muted { display: none !important; }
  .main { padding: 0 !important; max-width: none; }
  .card, .stat { break-inside: avoid; box-shadow: none; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* ───────── Missed days / swaps ───────── */
.ask-card { border-color: rgba(255, 200, 87, 0.5); background: linear-gradient(135deg, rgba(255, 200, 87, 0.1), var(--surface)); }
.done-card { text-align: center; padding: 28px 18px; border-color: rgba(74, 222, 128, 0.45); }
.done-card .big { font-size: 46px; margin-bottom: 6px; }
.link-btn { background: none; border: 0; padding: 0; color: var(--accent); font: inherit; font-weight: 650; cursor: pointer; text-decoration: underline; }
.swap-choice { cursor: pointer; color: var(--text); }
.swap-choice:hover { background: var(--surface-2); }

/* ───────── Owner dashboard, plan length, notifications ───────── */
.owner-trainer .owner-members { margin-top: 12px; border-top: 1px solid var(--border); padding-top: 10px; }
.contact { font-size: 14px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 2px; }
.contact a { overflow-wrap: anywhere; }
.owner-trainer [data-toggle] { align-items: flex-start; }
.contact a { color: var(--text); }
.cycle-card.ending { border-color: rgba(108, 184, 255, 0.5); }
.cycle-card.finished { border-color: rgba(255, 200, 87, 0.55); background: linear-gradient(135deg, rgba(255, 200, 87, 0.08), var(--surface)); }
.radio { display: flex; gap: 8px; align-items: center; font-size: 14px; cursor: pointer; }
.bell { position: relative; }
.bell-dot { position: absolute; top: -4px; right: -4px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 99px; background: #ff5d5d; color: #fff; font-size: 10.5px; font-weight: 800; display: grid; place-items: center; }
.notif.unread { background: rgba(108, 184, 255, 0.06); }

/* ───────── Mobile readability ───────── */
/* Calories / macros as labelled chips: "233 kcal" "19 g protein" … */
.mchips { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 5px; max-width: 380px; margin-top: 6px; line-height: 1.2; }
.mc { display: flex; flex-direction: column; align-items: center; justify-content: center; min-width: 0; padding: 5px 2px; border-radius: 8px; background: var(--surface-2); text-align: center; }
.mc b { color: var(--text); font-weight: 750; font-size: 15px; white-space: nowrap; }
.mc i { font-style: normal; font-size: 11.5px; color: var(--muted); font-weight: 600; }
.mc.kcal { background: var(--accent-soft); }
.mc.kcal b { color: var(--accent); }
.sugg .mc, .plan-item .mc { background: var(--surface-3); }
.sugg .mc.kcal { background: var(--accent-soft); }
.badges { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.wrap-name { overflow-wrap: anywhere; }
/* Phones: bigger touch targets (at least 40 px). */
@media (pointer: coarse), (max-width: 760px) {
  .icon-btn { width: 40px; height: 40px; }
  .icon-btn svg { width: 19px; height: 19px; }
  .btn { min-height: 46px; }
  .btn.sm { min-height: 40px; font-size: 14px; padding: 0 13px; }
  .how-btn { height: 40px; font-size: 14px; }
}
/* Phones: tabs wrap into pills so every section is visible (no hidden sideways scrolling). */
@media (max-width: 760px) {
  .tabs { flex-wrap: wrap; gap: 6px; border-bottom: 0; overflow: visible; }
  .tabs a { border: 1px solid var(--border); border-radius: 99px; padding: 8px 14px; background: var(--surface); font-size: 14px; }
  .tabs a.active { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
  .card { padding: 14px; }
}
/* Phones: wide tables become stacked cards. */
@media (max-width: 560px) {
  .tbl.cards-sm thead { display: none; }
  .tbl.cards-sm, .tbl.cards-sm tbody, .tbl.cards-sm tr, .tbl.cards-sm td { display: block; width: 100%; }
  .tbl.cards-sm tr { padding: 10px 0; border-bottom: 1px solid var(--border); }
  .tbl.cards-sm tr:last-child { border-bottom: 0; }
  .tbl.cards-sm td { border: 0; padding: 3px 0; white-space: normal; }
  .tbl.cards-sm td[data-label]::before { content: attr(data-label); display: block; font-size: 12px; color: var(--faint); font-weight: 650; text-transform: uppercase; letter-spacing: 0.04em; }
}

/* Macros day: chips under the food name, full width. Summary stacks on phones. */
.food-row, .sugg { flex-wrap: wrap; }
.food-row > .mchips, .sugg > .mchips { flex-basis: 100%; margin-top: 0; }
.sugg > .mchips { padding-left: 28px; }
.mbar .progress-bar { height: 9px; }
@media (max-width: 560px) {
  .macro-summary { flex-direction: column; align-items: stretch; }
  .macro-summary .ring { align-self: center; width: 132px; height: 132px; }
  .macro-summary .ring .ring-v { font-size: 28px; }
  .macro-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .macro-actions .btn { width: 100%; min-width: 0; padding: 0 8px; white-space: normal; line-height: 1.2; background: var(--surface-2); color: var(--text); border-color: var(--border); }
  .ex-foot { gap: 6px; }
  .ex-foot .btn.sm { padding: 0 11px; }
}

/* Plan editor: exercise buttons move under the name on phones so names stay readable. */
.plan-item-actions { display: flex; gap: 6px; flex: none; }
@media (max-width: 560px) {
  .plan-item > .row { flex-wrap: wrap; }
  .plan-item-actions { flex-basis: 100%; justify-content: flex-end; }
}

/* Search sheets: a fixed height on phones so typing never makes the sheet jump; the list stays
   visible (faded) while new results load. dvh follows the keyboard on Android. */
.pick-list { transition: opacity 0.12s; }
.pick-list.loading { opacity: 0.5; }
.modal { max-height: calc(100dvh - 32px); overscroll-behavior: contain; }
@media (max-width: 560px) {
  .modal { max-height: 94dvh; }
  .modal.sheet { height: 94dvh; display: flex; flex-direction: column; }
  .modal.sheet .modal-body { flex: 1; overflow-y: auto; overscroll-behavior: contain; }
  .modal.sheet { overflow: hidden; }
}
.modal.sheet .row:has(> [data-q]), .modal.sheet .row:has(> .grow > [data-q]) { position: sticky; top: -16px; z-index: 3; background: var(--surface); margin: -16px -16px 0; padding: 16px 16px 8px; }

/* Plan: weeks left */
.weeks-left { display: inline-block; margin-left: 6px; padding: 2px 9px; border-radius: 99px; font-size: 13px; font-weight: 700; vertical-align: 2px; background: rgba(108, 184, 255, 0.14); color: var(--info); }
.weeks-left.last { background: var(--warn-soft); color: var(--warn); }
