/* ============ Lift — workout tracker ============ */
:root {
  --bg: #0a0c10;
  --bg-elev: #13161d;
  --bg-elev-2: #1c2029;
  --line: #252a35;
  --text: #eef0f4;
  --text-dim: #9ba3b0;
  --text-faint: #687180;
  --accent: #4f8dff;
  --accent-2: #8b5cf6;
  --accent-press: #3a78ea;
  --accent-soft: rgba(79, 141, 255, 0.14);
  --grad: linear-gradient(135deg, #4f8dff 0%, #7c5cff 55%, #a855f7 100%);
  --good: #22c55e;
  --good-soft: rgba(34, 197, 94, 0.14);
  --warn: #f59e0b;
  --bad: #ef4444;
  --pr: #fbbf24;
  --flame: #ff8a3d;
  --shadow: 0 1px 0 rgba(255, 255, 255, 0.03) inset, 0 8px 24px rgba(0, 0, 0, 0.25);
  --radius: 16px;
  --radius-sm: 10px;
  --tap: 44px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --tabbar-h: 58px;
  --header-h: 52px;
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #f4f5f7;
  --bg-elev: #ffffff;
  --bg-elev-2: #eef0f3;
  --line: #dfe2e8;
  --text: #12151b;
  --text-dim: #5b636f;
  --text-faint: #98a0ab;
  --accent: #2f6fe8;
  --accent-press: #255fd0;
  --accent-soft: rgba(47, 111, 232, 0.1);
  --good-soft: rgba(34, 197, 94, 0.12);
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 6px 18px rgba(16, 24, 40, 0.06);
  color-scheme: light;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  overscroll-behavior-y: none;
  -webkit-font-smoothing: antialiased;
}
input, button, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: none; background: none; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, h4 { margin: 0; font-weight: 700; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

#app {
  max-width: 520px;
  margin: 0 auto;
  min-height: 100dvh;
  position: relative;
  background: var(--bg);
}

/* ---------- View / layout ---------- */
.view {
  padding: calc(var(--safe-top) + 12px) 14px calc(var(--tabbar-h) + var(--safe-bottom) + 20px);
  min-height: 100dvh;
}
.view.no-tabbar { padding-bottom: calc(var(--safe-bottom) + 20px); }

.page-head {
  display: flex; align-items: center; gap: 10px;
  min-height: var(--header-h);
  margin-bottom: 8px;
}
.page-head h1 { font-size: 26px; letter-spacing: -0.02em; flex: 1; }
.page-head .sub { color: var(--text-dim); font-size: 13px; }

.icon-btn {
  width: var(--tap); height: var(--tap);
  display: grid; place-items: center;
  border-radius: 12px; color: var(--text);
}
.icon-btn:active { background: var(--bg-elev-2); }
.icon-btn svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.back-row { display: flex; align-items: center; gap: 4px; margin: 0 0 6px -8px; }
.back-row .title { font-size: 18px; font-weight: 700; flex: 1; }

/* ---------- Cards ---------- */
.card {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 12px;
}
.card.tight { padding: 10px 12px; }
.card-row { display: flex; align-items: center; gap: 12px; }
.muted { color: var(--text-dim); }
.faint { color: var(--text-faint); }
.tiny { font-size: 12px; }
.center { text-align: center; }
.stack > * + * { margin-top: 10px; }
.rowsplit { display: flex; align-items: center; justify-content: space-between; gap: 10px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: var(--tap); padding: 0 18px;
  border-radius: 12px; font-weight: 650; font-size: 15px;
  background: var(--bg-elev-2); color: var(--text);
  border: 1px solid var(--line);
  width: 100%;
}
.btn:active { transform: scale(0.985); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:active { background: var(--accent-press); }
.btn.good { background: var(--good); border-color: var(--good); color: #05240f; }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 40%, var(--line)); }
.btn.sm { min-height: 38px; padding: 0 12px; font-size: 13px; width: auto; border-radius: 10px; }
.btn:disabled { opacity: 0.5; }
.btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.btn-row { display: flex; gap: 10px; }
.btn-row > .btn { width: 100%; }

.fab-add {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; min-height: var(--tap);
  border: 1px dashed var(--line); border-radius: 12px;
  color: var(--accent); background: var(--accent-soft); font-weight: 650;
}
.fab-add svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; }

/* ---------- Inputs ---------- */
.field { display: block; margin-bottom: 12px; }
.field > .label { display: block; font-size: 12px; color: var(--text-dim); margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.04em; }
.input, textarea.input {
  width: 100%; min-height: var(--tap);
  background: var(--bg-elev-2); border: 1px solid var(--line);
  border-radius: 12px; padding: 10px 12px; color: var(--text);
}
textarea.input { min-height: 72px; resize: vertical; line-height: 1.4; }
.input::placeholder { color: var(--text-faint); }
select.input { appearance: none; -webkit-appearance: none; }

.search {
  display: flex; align-items: center; gap: 8px;
  background: var(--bg-elev-2); border: 1px solid var(--line);
  border-radius: 12px; padding: 0 12px; min-height: var(--tap);
  margin-bottom: 10px;
}
.search input { flex: 1; background: none; border: none; outline: none; min-height: var(--tap); }
.search svg { width: 18px; height: 18px; fill: none; stroke: var(--text-faint); stroke-width: 2; }

.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 8px; margin-bottom: 4px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: 0 0 auto; padding: 7px 13px; border-radius: 999px;
  background: var(--bg-elev-2); border: 1px solid var(--line);
  font-size: 13px; color: var(--text-dim); white-space: nowrap;
}
.chip.on { background: var(--accent-soft); border-color: var(--accent); color: var(--text); }

/* ---------- Lists ---------- */
.list { display: flex; flex-direction: column; }
.list-item {
  display: flex; align-items: center; gap: 12px;
  padding: 13px 4px; border-bottom: 1px solid var(--line);
}
.list-item:last-child { border-bottom: none; }
.list-item .grow { flex: 1; min-width: 0; }
.list-item .name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-item .meta { color: var(--text-dim); font-size: 12.5px; margin-top: 2px; }
.list-item .chev { color: var(--text-faint); }
.list-item .chev svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.5; }

.avatar {
  width: 40px; height: 40px; flex: 0 0 auto;
  border-radius: 11px; background: var(--bg-elev-2);
  display: grid; place-items: center; font-weight: 700; color: var(--accent);
  border: 1px solid var(--line); font-size: 15px;
}
.ex-thumb {
  object-fit: cover; display: block; flex: 0 0 auto;
  background: var(--bg-elev-2); border: 1px solid var(--line);
}
.ex-hero {
  width: 100%; height: 190px; object-fit: cover; display: block;
  border-radius: var(--radius); background: var(--bg-elev-2);
  border: 1px solid var(--line); margin-bottom: 12px;
}

.section-label {
  font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--text-faint); margin: 18px 2px 8px;
}
.empty {
  text-align: center; color: var(--text-dim);
  padding: 40px 20px;
}
.empty svg { width: 40px; height: 40px; opacity: 0.5; margin-bottom: 10px; fill: none; stroke: currentColor; stroke-width: 1.6; }

/* ---------- Tab bar ---------- */
.tabbar[hidden] { display: none; }
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  max-width: 520px; margin: 0 auto;
  display: grid; grid-template-columns: repeat(5, 1fr);
  background: color-mix(in srgb, var(--bg-elev) 92%, transparent);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
  padding-bottom: var(--safe-bottom);
}
.tab {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  height: var(--tabbar-h); color: var(--text-faint); font-size: 10.5px; font-weight: 600;
}
.tab svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.tab.on { color: var(--accent); }

/* ---------- Resume / active workout banner ---------- */
.resume-bar {
  position: fixed; left: 0; right: 0; bottom: calc(var(--tabbar-h) + var(--safe-bottom));
  max-width: 520px; margin: 0 auto; z-index: 39;
  background: var(--accent); color: #fff;
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px;
}
.resume-bar .grow { flex: 1; }
.resume-bar .t { font-weight: 700; }
.resume-bar .s { font-size: 12px; opacity: 0.9; }
.resume-bar button { background: rgba(255,255,255,0.2); color: #fff; border-radius: 9px; padding: 8px 14px; font-weight: 700; }

/* ---------- Active workout screen ---------- */
.wk-header {
  position: sticky; top: 0; z-index: 20;
  background: var(--bg);
  padding-top: var(--safe-top);
  margin: calc(-1 * (var(--safe-top) + 12px)) -14px 10px;
  border-bottom: 1px solid var(--line);
}
.wk-header .row { display: flex; align-items: center; gap: 10px; padding: 8px 12px; }
.wk-title { flex: 1; font-size: 17px; font-weight: 700; background: none; border: none; min-width: 0; }
.wk-timer { font-variant-numeric: tabular-nums; color: var(--text-dim); font-size: 13px; font-weight: 600; }

/* rest timer, docked to the bottom only while a rest is running */
.rest-dock[hidden] { display: none; }
.rest-dock {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 45;
  max-width: 520px; margin: 0 auto;
  background: var(--bg-elev); border-top: 1px solid var(--line);
  padding: 12px 14px calc(12px + var(--safe-bottom));
  box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.35);
  animation: dock-in 0.2s ease-out;
}
@keyframes dock-in { from { transform: translateY(100%); } }
.rest-dock .prog { position: absolute; top: 0; left: 0; height: 3px; background: var(--accent); transition: width 0.5s linear; }
.rest-dock .row { display: flex; align-items: center; gap: 8px; }
.rest-dock .lbl { font-size: 11px; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.06em; }
.rest-dock .time { font-size: 30px; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1.1; }
.rest-dock button {
  min-width: 58px; height: 46px; border-radius: 12px;
  background: var(--bg-elev-2); border: 1px solid var(--line); font-weight: 700; font-size: 15px;
}
.rest-dock button.skip { background: var(--accent); border-color: var(--accent); color: #fff; }
.view.has-dock { padding-bottom: calc(var(--safe-bottom) + 110px); }
.rest-link { background: none; color: var(--text-faint); font-size: 12px; padding: 6px 4px; }

/* progression target */
.target-row {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  background: var(--accent-soft); border-radius: 10px; padding: 8px 10px; margin: 2px 0 8px;
}
.target-row .t { font-weight: 700; font-size: 13.5px; }
.target-row .w { font-size: 11.5px; color: var(--text-dim); margin-top: 1px; }
.target-ic { color: var(--accent); display: grid; place-items: center; }
.target-ic svg { width: 18px; height: 18px; }
.target-range {
  font-size: 12px; font-weight: 700; color: var(--accent); white-space: nowrap;
  border: 1px solid var(--accent); border-radius: 999px; padding: 2px 8px;
}

/* card headers, segmented control */
.card-title { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.card-title h3 { font-size: 15px; font-weight: 700; }
.seg { display: inline-flex; background: var(--bg-elev-2); border: 1px solid var(--line); border-radius: 9px; padding: 2px; }
.seg button { padding: 5px 9px; font-size: 12px; font-weight: 650; border-radius: 7px; color: var(--text-dim); }
.seg button.on { background: var(--bg-elev); color: var(--text); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25); }
.info-btn { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; color: var(--text-faint); }
.info-btn svg { width: 18px; height: 18px; }

/* compact labeled stats row */
.mini-stats { display: flex; gap: 8px; margin-top: 12px; }
.mini-stats > div { flex: 1; min-width: 0; }
.mini-stats .k { font-size: 11px; color: var(--text-faint); }
.mini-stats .v { font-size: 15px; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini-stats .d { font-size: 11px; font-weight: 700; }
.mini-stats .d.up { color: var(--good); }
.mini-stats .d.down { color: var(--bad); }

/* history workout card */
.wk-card { display: block; background: var(--bg-elev); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin-bottom: 12px; }
.wk-card:active { background: var(--bg-elev-2); }
.wk-card .title { font-size: 16px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wk-card .when { font-size: 12px; color: var(--text-faint); margin-top: 1px; }
.wk-lines { margin-top: 12px; border-top: 1px solid var(--line); padding-top: 8px; }
.wk-line { display: flex; align-items: center; gap: 10px; padding: 4px 0; font-size: 13.5px; }
.wk-line .n { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wk-line .b { color: var(--text-dim); font-size: 12.5px; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* month calendar */
.cal-head { display: flex; align-items: center; justify-content: space-between; margin: -6px -6px 8px; }
.cal-head .icon-btn:disabled { opacity: 0.25; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); row-gap: 4px; text-align: center; justify-items: center; }
.cal-dow { font-size: 10.5px; color: var(--text-faint); font-weight: 600; padding-bottom: 2px; }
.cal-day { width: 30px; height: 30px; display: grid; place-items: center; font-size: 12.5px; border-radius: 50%; color: var(--text-dim); font-variant-numeric: tabular-nums; }
.cal-day.out { visibility: hidden; }
.cal-day.on { background: var(--accent); color: #fff; font-weight: 700; cursor: pointer; }
.cal-day.today { box-shadow: inset 0 0 0 1.5px var(--accent); color: var(--text); font-weight: 700; }
.cal-day.on.today { box-shadow: inset 0 0 0 2px #fff; }
.cal-day.future { opacity: 0.35; }

/* effort ("how hard?") under a completed set */
.effort-tr td { padding: 2px 0 8px; }
.effort { display: flex; align-items: center; gap: 6px; }
.effort-q { font-size: 11.5px; color: var(--text-faint); white-space: nowrap; margin-right: 2px; }
.effort-btn {
  flex: 1; min-width: 0; padding: 5px 4px; border-radius: 9px; border: 1px solid var(--line);
  background: var(--bg-elev-2); color: var(--text-dim); display: flex; flex-direction: column; align-items: center; line-height: 1.15;
}
.effort-btn span { font-size: 12.5px; font-weight: 700; }
.effort-btn small { font-size: 10px; opacity: 0.8; }
.effort-btn.on.easy { background: var(--accent-soft); border-color: var(--accent); color: var(--text); }
.effort-btn.on.good { background: var(--good-soft); border-color: var(--good); color: var(--text); }
.effort-btn.on.fail { background: color-mix(in srgb, var(--bad) 16%, transparent); border-color: var(--bad); color: var(--text); }

/* stall + failure check + coach */
.stall-row {
  display: flex; align-items: center; gap: 8px; width: 100%; text-align: left; margin: 0 0 8px;
  padding: 8px 10px; border-radius: 10px; font-size: 12.5px; font-weight: 600;
  background: color-mix(in srgb, var(--warn) 14%, transparent); color: var(--text);
}
.stall-row .grow { flex: 1; }
.fail-check {
  margin: 0 0 8px; padding: 8px 10px; border-radius: 10px; font-size: 12.5px; line-height: 1.4;
  border: 1px dashed var(--bad); color: var(--text-dim);
}
.fail-check strong { color: var(--text); }
.stall-step { display: flex; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.stall-step:last-child { border-bottom: none; }
.stall-n { width: 24px; height: 24px; flex: 0 0 auto; border-radius: 50%; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; font-weight: 800; font-size: 13px; }
.stall-step .grow { flex: 1; min-width: 0; }
.stall-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.stall-actions .btn.sm { width: auto; }
.deload-card.warn { border-color: var(--warn); }
.coach-link { display: flex; align-items: center; gap: 12px; }
.coach-link .grow { flex: 1; }

/* backup */
.code-box {
  font: 700 19px/1.4 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; letter-spacing: 0.04em;
  text-align: center; padding: 16px 10px; border-radius: 12px; word-break: break-all;
  background: var(--bg-elev-2); border: 1px solid var(--line); user-select: all; -webkit-user-select: all;
}
.nudge { display: flex; align-items: center; gap: 12px; border-color: var(--accent); }
.google-btn { background: #fff; color: #1f1f1f; border-color: #dadce0; font-weight: 600; white-space: nowrap; }
.nudge .grow { flex: 1; }

/* finish: routine changes */
.change-list { margin: 0; padding: 10px 12px 10px 28px; background: var(--bg-elev-2); border-radius: 10px; }
.change-list li { font-size: 14px; margin: 3px 0; }

/* research explainer sheet */
.explain ul { margin: 0; padding-left: 18px; }
.explain li { margin-bottom: 10px; line-height: 1.45; font-size: 14px; color: var(--text-dim); }
.explain li strong { color: var(--text); }

/* weekly volume per muscle */
.vol-legend { display: flex; gap: 12px; font-size: 11.5px; color: var(--text-dim); margin-bottom: 4px; align-items: center; }
.vol-name { font-size: 13.5px; font-weight: 600; }
.vol-row { margin: 10px 0; }
.vol-track { position: relative; height: 8px; border-radius: 4px; background: var(--bg-elev-2); margin-top: 5px; overflow: hidden; }
.vol-zone { position: absolute; top: 0; bottom: 0; background: var(--good-soft); border-left: 1px solid var(--good); border-right: 1px solid var(--good); }
.vol-fill { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 4px; }
.vol-fill.low, .vol-dot.low { background: var(--bad); }
.vol-fill.ok, .vol-dot.ok { background: var(--good); }
.vol-fill.high, .vol-dot.high { background: var(--warn); }
.vol-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; }

/* wheel picker */
.wheel-wrap {
  position: relative; height: 220px; overflow: hidden;
  -webkit-mask-image: linear-gradient(transparent, #000 30%, #000 70%, transparent);
  mask-image: linear-gradient(transparent, #000 30%, #000 70%, transparent);
}
.wheel {
  height: 100%; overflow-y: auto; scroll-snap-type: y mandatory;
  padding: 88px 0; scrollbar-width: none; -webkit-overflow-scrolling: touch;
}
.wheel::-webkit-scrollbar { display: none; }
.wheel-item {
  height: 44px; line-height: 44px; text-align: center; scroll-snap-align: center;
  font-size: 20px; color: var(--text-faint); font-variant-numeric: tabular-nums;
  transition: color 0.1s, font-size 0.1s;
}
.wheel-item.on { color: var(--text); font-weight: 700; font-size: 25px; }
.wheel-band {
  position: absolute; left: 0; right: 0; top: 88px; height: 44px; pointer-events: none;
  background: var(--accent-soft); border-radius: 10px;
}

.ex-card { background: var(--bg-elev); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; margin-bottom: 12px; }
.ex-card .ex-head { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.ex-card .ex-name { flex: 1; font-weight: 700; color: var(--accent); font-size: 15px; }
.ex-card .ex-note { width: 100%; background: none; border: none; color: var(--text-dim); font-size: 13px; padding: 4px 0 6px; }
.ex-card .ex-note::placeholder { color: var(--text-faint); }

.set-grid { width: 100%; border-collapse: collapse; }
.set-grid th {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--text-faint); font-weight: 600; text-align: center; padding: 4px 2px;
}
.set-grid th.set-col, .set-grid td.set-col { width: 34px; }
.set-grid th.prev-col, .set-grid td.prev-col { width: 74px; }
.set-grid th.done-col, .set-grid td.done-col { width: 40px; }
.set-grid td { padding: 3px 2px; text-align: center; }
.set-grid tr.done td { background: var(--good-soft); }
.set-grid tr.done td:first-child { border-radius: 8px 0 0 8px; }
.set-grid tr.done td:last-child { border-radius: 0 8px 8px 0; }

.set-badge {
  width: 28px; height: 28px; margin: 0 auto; border-radius: 8px;
  display: grid; place-items: center; font-weight: 700; font-size: 13px;
  background: var(--bg-elev-2); color: var(--text-dim);
}
.set-badge.warmup { color: var(--warn); }
.set-badge.drop { color: var(--accent); }
.set-badge.fail { color: var(--bad); }

.set-input {
  width: 100%; min-height: 38px; text-align: center;
  background: var(--bg-elev-2); border: 1px solid transparent;
  border-radius: 9px; padding: 4px; font-weight: 650; font-variant-numeric: tabular-nums;
}
.set-input:focus { border-color: var(--accent); background: var(--bg); outline: none; }
tr.done .set-input { background: transparent; }
.prev-cell { color: var(--text-faint); font-size: 12px; font-variant-numeric: tabular-nums; }

.check {
  width: 32px; height: 32px; margin: 0 auto; border-radius: 9px;
  display: grid; place-items: center;
  background: var(--bg-elev-2); border: 1px solid var(--line); color: var(--text-faint);
}
.check svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 3; }
tr.done .check { background: var(--good); border-color: var(--good); color: #05240f; }

.pr-tag {
  display: inline-flex; align-items: center; gap: 3px;
  color: var(--pr); font-size: 11px; font-weight: 700;
}
.pr-tag svg { width: 12px; height: 12px; fill: currentColor; stroke: none; }

.add-set-btn {
  width: 100%; margin-top: 6px; padding: 9px; border-radius: 9px;
  background: var(--bg-elev-2); color: var(--text-dim); font-weight: 650; font-size: 13px;
}

/* ---------- Summary ---------- */
.summary-hero { text-align: center; padding: 20px 0 8px; }
.summary-hero .big { font-size: 32px; font-weight: 800; letter-spacing: -0.02em; }
.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stat-box { background: var(--bg-elev); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px 8px; text-align: center; }
.stat-box .v { font-size: 19px; font-weight: 800; font-variant-numeric: tabular-nums; }
.stat-box .k { font-size: 11px; color: var(--text-dim); margin-top: 2px; text-transform: uppercase; letter-spacing: 0.03em; }

/* ---------- Charts ---------- */
.chart-wrap { background: var(--bg-elev); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 12px 8px; margin-bottom: 12px; }
.chart-wrap .chart-title { font-size: 13px; color: var(--text-dim); margin-bottom: 8px; display: flex; justify-content: space-between; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .grid-line { stroke: var(--line); stroke-width: 1; }
.chart .axis-label { fill: var(--text-faint); font-size: 10px; }
.chart .line { fill: none; stroke: var(--accent); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.chart .area { fill: var(--accent-soft); stroke: none; }
.chart .dot { fill: var(--accent); }
.chart .bar { fill: color-mix(in srgb, var(--accent) 45%, transparent); }
.chart .bar.hl { fill: var(--accent); }
.chart .bar.dim { fill: var(--bg-elev-2); }
.chart .bar-val { fill: var(--text); font-size: 11px; font-weight: 700; }

/* ---------- Sheet / modal ---------- */
.sheet-backdrop {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(0,0,0,0.5);
  display: flex; align-items: flex-end; justify-content: center;
  opacity: 0; transition: opacity 0.18s ease;
}
.sheet-backdrop.in { opacity: 1; }
.sheet {
  width: 100%; max-width: 520px;
  background: var(--bg-elev); border-radius: 20px 20px 0 0;
  border: 1px solid var(--line); border-bottom: none;
  max-height: 88dvh; display: flex; flex-direction: column;
  transform: translateY(100%); transition: transform 0.22s cubic-bezier(0.2,0.8,0.2,1);
  padding-bottom: var(--safe-bottom);
}
.sheet-backdrop.in .sheet { transform: translateY(0); }
.sheet .grab { width: 36px; height: 4px; border-radius: 3px; background: var(--line); margin: 8px auto 4px; flex: 0 0 auto; }
.sheet .sheet-head { display: flex; align-items: center; gap: 10px; padding: 8px 14px; border-bottom: 1px solid var(--line); flex: 0 0 auto; }
.sheet .sheet-head h3 { flex: 1; font-size: 16px; }
.sheet .sheet-body { overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 12px 14px; }
.sheet .sheet-foot { padding: 12px 14px; border-top: 1px solid var(--line); flex: 0 0 auto; }

.menu-item {
  display: flex; align-items: center; gap: 12px;
  width: 100%; padding: 14px 6px; text-align: left; font-size: 15px;
  border-bottom: 1px solid var(--line);
}
.menu-item:last-child { border-bottom: none; }
.menu-item.danger { color: var(--bad); }
.menu-item svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.pick-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 4px; border-bottom: 1px solid var(--line);
}
.pick-item .box {
  width: 24px; height: 24px; border-radius: 7px; border: 2px solid var(--line);
  flex: 0 0 auto; display: grid; place-items: center;
}
.pick-item.on .box { background: var(--accent); border-color: var(--accent); }
.pick-item.on .box svg { width: 15px; height: 15px; stroke: #fff; stroke-width: 3; fill: none; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 16px);
  transform: translateX(-50%) translateY(10px);
  background: var(--bg-elev-2); color: var(--text);
  border: 1px solid var(--line); border-radius: 12px;
  padding: 11px 16px; font-size: 13.5px; font-weight: 600;
  z-index: 80; max-width: 90%; text-align: center;
  opacity: 0; transition: opacity 0.2s, transform 0.2s;
  box-shadow: 0 8px 30px rgba(0,0,0,0.4);
}
.toast.in { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- misc ---------- */
.hr { height: 1px; background: var(--line); margin: 16px 0; border: none; }
.pill { display: inline-block; padding: 2px 8px; border-radius: 999px; background: var(--bg-elev-2); font-size: 11px; color: var(--text-dim); border: 1px solid var(--line); }
.spin { width: 22px; height: 22px; border: 2.5px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.7s linear infinite; margin: 40px auto; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ============ 2026-10 refresh ============ */
.card, .ex-card, .wk-card, .chart-wrap, .stat-box { box-shadow: var(--shadow); }
.page-head h1 { font-size: 30px; font-weight: 800; letter-spacing: -0.025em; }
.btn.primary { background: var(--grad); border-color: transparent; box-shadow: 0 6px 18px rgba(79, 110, 255, 0.28); }
.btn.primary:active { filter: brightness(0.92); }
.section-label { font-weight: 700; }
.tab.on svg { filter: drop-shadow(0 0 8px rgba(79, 141, 255, 0.45)); }

/* home header */
.home-head { display: flex; align-items: flex-end; gap: 12px; margin: 6px 2px 16px; }
.home-head .grow { flex: 1; min-width: 0; }
.home-head .date { font-size: 12.5px; font-weight: 700; color: var(--text-faint); text-transform: uppercase; letter-spacing: 0.06em; }
.home-head h1 { font-size: 30px; font-weight: 800; letter-spacing: -0.025em; margin-top: 2px; }
.streak-chip {
  display: inline-flex; align-items: center; gap: 4px; padding: 6px 11px 6px 8px; border-radius: 999px;
  background: color-mix(in srgb, var(--flame) 16%, transparent); color: var(--flame); font-size: 15px;
}
.streak-chip svg { width: 18px; height: 18px; fill: currentColor; stroke: none; }

/* hero */
.hero {
  position: relative; overflow: hidden; border-radius: 22px; padding: 18px 18px 16px; margin-bottom: 14px;
  background: var(--grad); color: #fff;
  box-shadow: 0 14px 34px rgba(91, 92, 255, 0.32);
}
.hero::after {
  content: ""; position: absolute; right: -60px; top: -70px; width: 220px; height: 220px; border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.22), transparent 65%); pointer-events: none;
}
.hero-k { font-size: 11.5px; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; opacity: 0.85; }
.hero-t { font-size: 30px; font-weight: 800; letter-spacing: -0.02em; margin-top: 2px; line-height: 1.15; }
.hero-s { font-size: 13.5px; opacity: 0.9; margin-top: 3px; font-variant-numeric: tabular-nums; }
.hero-thumbs { display: flex; gap: 6px; margin-top: 14px; align-items: center; }
.hero-thumbs .ex-thumb, .hero-thumbs .avatar { border: 2px solid rgba(255, 255, 255, 0.35); background: rgba(255, 255, 255, 0.15); color: #fff; }
.hero-thumbs .more { font-size: 13px; font-weight: 700; opacity: 0.9; padding-left: 4px; }
.hero-plan {
  display: flex; align-items: center; gap: 8px; margin-top: 12px; padding: 8px 10px; border-radius: 12px;
  background: rgba(255, 255, 255, 0.14); font-size: 13px; font-weight: 600;
}
.hero-plan svg { width: 16px; height: 16px; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 2; }
.hero-bar { height: 6px; border-radius: 3px; background: rgba(255, 255, 255, 0.25); margin-top: 12px; overflow: hidden; }
.hero-bar i { display: block; height: 100%; background: #fff; border-radius: 3px; }
.hero-btn {
  position: relative; z-index: 1;
  display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; min-height: 50px; margin-top: 16px;
  border-radius: 14px; background: #fff; color: #2b2f7a; font-weight: 800; font-size: 16px;
  box-shadow: 0 6px 16px rgba(20, 20, 60, 0.25);
}
.hero-btn:active { transform: scale(0.985); }
.hero-btn svg { width: 18px; height: 18px; fill: currentColor; stroke: currentColor; stroke-width: 2; stroke-linejoin: round; }

/* this week */
.week-top { display: flex; align-items: center; gap: 14px; }
.week-top .grow { flex: 1; min-width: 0; }
.week-top .k { font-size: 12px; font-weight: 700; color: var(--text-faint); text-transform: uppercase; letter-spacing: 0.06em; }
.week-top .msg { font-size: 15px; font-weight: 700; margin-top: 2px; }
.streak { display: inline-flex; align-items: center; gap: 4px; margin-top: 4px; color: var(--flame); font-size: 12.5px; font-weight: 700; }
.streak svg { width: 14px; height: 14px; fill: currentColor; stroke: none; }
.goal-ring { position: relative; width: 64px; height: 64px; flex: 0 0 auto; }
.goal-ring svg { width: 64px; height: 64px; display: block; }
.goal-ring circle { fill: none; stroke-width: 7; }
.goal-ring .trk { stroke: var(--bg-elev-2); }
.goal-ring .val { stroke: var(--accent); stroke-linecap: round; transition: stroke-dasharray 0.6s ease; }
.goal-ring .val.full { stroke: var(--good); }
.goal-ring .num { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; }
.goal-ring .num b { font-size: 19px; font-weight: 800; }
.goal-ring .num span { font-size: 12px; color: var(--text-faint); font-weight: 700; margin-top: 4px; }
.week-strip { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; margin-top: 14px; }
.wd { display: flex; flex-direction: column; align-items: center; gap: 5px; }
.wd .l { font-size: 10.5px; font-weight: 700; color: var(--text-faint); }
.wd .d {
  width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center;
  font-size: 12.5px; font-weight: 650; color: var(--text-dim); background: var(--bg-elev-2); font-variant-numeric: tabular-nums;
}
.wd.on .d { background: var(--grad); color: #fff; }
.wd .d svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 3; }
.wd.today .d { box-shadow: 0 0 0 2px var(--bg-elev), 0 0 0 3.5px var(--accent); color: var(--text); }
.wd.on.today .d { color: #fff; }
.wd.future .d { opacity: 0.45; }

/* routine list */
.routine-card { padding: 12px 8px 12px 14px; }
.routine-main { text-align: left; min-width: 0; padding: 0; }
.routine-main h3 { font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.routine-main .muted { margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.play-btn {
  width: 42px; height: 42px; flex: 0 0 auto; border-radius: 50%; display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent);
}
.play-btn svg { width: 17px; height: 17px; fill: currentColor; stroke: currentColor; stroke-width: 2; stroke-linejoin: round; margin-left: 2px; }
.play-btn:disabled { opacity: 0.4; }

/* workout: exercise cards, supersets, warm-ups */
.ex-card .ex-name-wrap { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.ex-card .ex-name { font-size: 15.5px; }
.ss-badge { font-size: 10.5px; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; }
.ex-card.ss { border-left: 3px solid var(--ss); }
.ex-card.ss-more { margin-bottom: 4px; border-bottom-left-radius: 6px; border-bottom-right-radius: 6px; }
.ex-card.ss-cont { border-top-left-radius: 6px; border-top-right-radius: 6px; }
.ex-card.complete { border-color: color-mix(in srgb, var(--good) 45%, var(--line)); }
.ex-card.complete.ss { border-left-color: var(--ss); }
.ex-card.flash { animation: flash 0.9s ease-out; }
@keyframes flash { 0% { box-shadow: 0 0 0 3px var(--ss, var(--accent)); } 100% { box-shadow: var(--shadow); } }
.add-row { display: flex; gap: 8px; }
.add-row .add-set-btn { flex: 1; }
.add-set-btn.warm { color: var(--warn); flex: 0 0 auto; width: auto; padding: 9px 14px; }
.wk-header { background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
.rest-dock .prog { background: var(--grad); height: 4px; }
.rest-dock button.skip { background: var(--grad); border-color: transparent; }
.rest-dock .time { font-size: 34px; }

/* summary celebration */
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 70; width: 100%; height: 100%; }
.summary-hero .badge-ring {
  width: 74px; height: 74px; margin: 0 auto 10px; border-radius: 50%; display: grid; place-items: center;
  background: var(--grad); color: #fff; box-shadow: 0 10px 30px rgba(124, 92, 255, 0.45);
  animation: pop 0.5s cubic-bezier(0.2, 1.4, 0.4, 1);
}
.summary-hero .badge-ring svg { width: 34px; height: 34px; fill: none; stroke: currentColor; stroke-width: 2; }
@keyframes pop { from { transform: scale(0.4); opacity: 0; } }
.summary-hero .kicker { font-size: 12px; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; color: var(--accent); margin-bottom: 2px; }
.goal-note { display: flex; align-items: center; gap: 10px; }
.goal-note svg { width: 22px; height: 22px; color: var(--flame); fill: currentColor; stroke: none; flex: 0 0 auto; }
@media (prefers-reduced-motion: reduce) { .confetti { display: none; } }

/* toast action (Undo) */
.toast.has-action { display: flex; align-items: center; gap: 14px; text-align: left; padding: 8px 8px 8px 16px; }
.toast-act { color: var(--accent); font-weight: 800; font-size: 14px; padding: 6px 10px; border-radius: 9px; background: var(--accent-soft); }

/* pinned exercise note */
.pin-note {
  display: flex; align-items: flex-start; gap: 8px; width: 100%; text-align: left; margin: 2px 0 8px;
  padding: 7px 10px; border-radius: 10px; font-size: 13px; line-height: 1.4; font-weight: 600;
  background: color-mix(in srgb, var(--pr) 12%, transparent); color: var(--text);
}
.pin-note svg { width: 15px; height: 15px; margin-top: 2px; fill: none; stroke: var(--pr); stroke-width: 2; stroke-linejoin: round; }
.pin-note .grow { flex: 1; min-width: 0; white-space: pre-wrap; }
.pin-note.empty-note { background: none; border: 1px dashed var(--line); color: var(--text-faint); font-weight: 500; margin-bottom: 14px; }

/* swipe a set left to delete */
.set-grid tr.swiping { background: color-mix(in srgb, var(--bad) 18%, transparent); }
.set-grid tr.swiping.armed { background: color-mix(in srgb, var(--bad) 40%, transparent); }
.set-grid tr.swiping td { background: var(--bg-elev); }
.set-grid tr.swiping.done td { background: color-mix(in srgb, var(--good) 14%, var(--bg-elev)); }
