/* Reps — premium minimal. Light neutral ground, white cards, hairline borders,
   charcoal ink. The workout colour (--wc) is the only accent in the interface. */

:root {
  --bg: #F6F6F4;
  --surface: #FFFFFF;
  --border: #E8E6E1;
  --border-strong: #DBD8D2;
  --ink: #1B1917;
  --ink-2: #6F6A63;
  --ink-3: #A39D94;
  --danger: #DC2626;
  --accent: #1B1917;        /* interface accent: ink in light, teal in dark */
  --accent-ink: #FFFFFF;    /* text/icons on top of the accent */
  --surface-2: #FAFAF8;     /* hover / subtle raised surface */
  --hover: rgba(27, 25, 23, 0.05);
  --seg-bg: #ECEAE5;        /* segmented + progress tracks */
  --switch-off: #D9D5CF;
  --overlay-bg: rgba(27, 25, 23, 0.38);
  --tabbar-bg: rgba(255, 255, 255, 0.94);
  --wc: #F97316; /* overridden per workout */
  --radius: 12px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(27, 25, 23, 0.05);
  --shadow-lift: 0 8px 28px rgba(27, 25, 23, 0.14);
  --tabbar-h: 58px;
  font-size: 16px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { background: var(--bg); color-scheme: light; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
button { font: inherit; color: inherit; background: none; border: none; padding: 0; cursor: pointer; }
input, select { font: inherit; color: inherit; }
h1, h2, h3, p, ul { margin: 0; }
ul { padding: 0; list-style: none; }
a { color: inherit; text-decoration: none; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.hidden { display: none !important; }

/* ---------------- Layout ---------------- */

#app { display: grid; grid-template-columns: 220px 1fr; min-height: 100dvh; }

#sidebar {
  border-right: 1px solid var(--border);
  padding: 20px 14px;
  position: sticky; top: 0; height: 100dvh;
}
.brand { display: flex; align-items: baseline; gap: 8px; padding: 4px 10px 22px; }
.brand-mark { font-size: 20px; font-weight: 800; letter-spacing: -0.03em; }
.brand-ver { font-size: 11px; color: var(--ink-3); font-weight: 500; }

.side-nav { display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 10px; border-radius: var(--radius-sm);
  color: var(--ink-2); font-size: 14.5px; font-weight: 550;
  border: 1px solid transparent;
}
.nav-item:hover { color: var(--ink); background: var(--hover); }
.nav-item.active { color: var(--ink); background: var(--surface); border-color: var(--border); box-shadow: var(--shadow); }
.nav-item.active .icon { color: var(--accent); }

#view { width: 100%; max-width: 1000px; margin: 0 auto; padding: 28px 28px 64px; }

#tabbar { display: none; }

html.route-runner #sidebar, html.route-runner #tabbar { display: none; }
html.route-runner #app { grid-template-columns: 1fr; }

@media (max-width: 899px) {
  #app { grid-template-columns: 1fr; }
  #sidebar { display: none; }
  #view { padding: 18px 16px calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px) + 40px); }
  #tabbar {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    background: var(--tabbar-bg);
    -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
    border-top: 1px solid var(--border);
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }
  html.route-runner #view { padding-bottom: 24px; }
  .tab-item {
    flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
    padding: 8px 0 6px; font-size: 10.5px; font-weight: 550; color: var(--ink-3);
  }
  .tab-item.active { color: var(--ink); }
  .tab-item.active .icon { color: var(--accent); }
}

/* ---------------- Icons ---------------- */

.icon { display: inline-flex; width: 20px; height: 20px; flex: none; }
.icon svg { width: 100%; height: 100%; }
.icon.soft { color: var(--ink-3); }
.icon-btn {
  width: 40px; height: 40px; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: var(--radius-sm); color: var(--ink-2);
}
.icon-btn:hover { background: var(--hover); color: var(--ink); }

/* ---------------- Page headers ---------------- */

.page-head { margin-bottom: 20px; }
.page-head h1 { font-size: 26px; font-weight: 750; letter-spacing: -0.025em; }
.page-sub { color: var(--ink-2); font-size: 14px; margin-top: 3px; }
.row-between { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.builder-head { display: flex; align-items: center; gap: 8px; }
.builder-head-main h1 { font-size: 22px; }
.section-title { font-size: 15px; font-weight: 700; margin: 26px 0 12px; letter-spacing: -0.01em; }
.section-title.tight { margin: 0 0 12px; }
.eyebrow {
  font-size: 11.5px; font-weight: 700; letter-spacing: 0.09em; text-transform: uppercase;
  color: var(--ink-3);
}
.eyebrow.wc { color: var(--wc); }

/* ---------------- Cards ---------------- */

.stack { display: flex; flex-direction: column; gap: 14px; }
.stack.tight { gap: 8px; }

.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
  position: relative; text-align: left;
}
.card.spine::before {
  content: ""; position: absolute; left: 0; top: 14px; bottom: 14px; width: 3px;
  border-radius: 0 3px 3px 0; background: var(--wc);
}
.card-body { padding: 18px; display: flex; flex-direction: column; gap: 12px; }
.card-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.card-title { font-size: 18px; font-weight: 700; letter-spacing: -0.015em; }
.card-title.link { cursor: pointer; }
.card-title.link:hover { text-decoration: underline; text-underline-offset: 3px; }
.card-meta { color: var(--ink-2); font-size: 13.5px; }
.card-meta.soft { color: var(--ink-3); }

.done-badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12.5px; font-weight: 650; color: var(--ink);
  background: var(--bg); border: 1px solid var(--border);
  padding: 5px 10px; border-radius: 999px;
}
.done-badge .icon { width: 14px; height: 14px; color: var(--wc); }

.preview-list { display: flex; flex-direction: column; }
.preview-list li {
  display: flex; justify-content: space-between; gap: 12px;
  padding: 7px 0; border-bottom: 1px solid var(--border); font-size: 14px;
}
.preview-list li:last-child { border-bottom: none; }
.preview-name { color: var(--ink); }
.preview-sets { color: var(--ink-2); font-variant-numeric: tabular-nums; white-space: nowrap; }

.rest-day { align-items: flex-start; }
.rest-day .card-title { font-size: 20px; }

.workout-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
@media (max-width: 680px) { .workout-grid { grid-template-columns: 1fr; } }

.empty-note { color: var(--ink-2); font-size: 14px; padding: 10px 2px; }
.hint-note { color: var(--ink-2); font-size: 13px; }

/* ---------------- Buttons ---------------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 18px;
  background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-size: 15px; font-weight: 620; letter-spacing: -0.01em;
  transition: transform 0.05s ease, background-color 0.12s ease;
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: scale(0.985); }
.btn .icon { width: 17px; height: 17px; }

.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { filter: brightness(1.12); background: var(--accent); }
.btn-accent { background: var(--wc); border-color: var(--wc); color: #fff; }
.btn-accent:hover { filter: brightness(1.05); background: var(--wc); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger-ghost { color: var(--danger); border-color: var(--border-strong); }
.btn-block { width: 100%; }
.btn-sm { min-height: 36px; padding: 0 13px; font-size: 13.5px; }
.btn-lg { min-height: 50px; font-size: 16px; }
.btn-xl { min-height: 58px; font-size: 17px; border-radius: 13px; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }
.btn-row .grow { flex: 1; }

/* ---------------- Inputs ---------------- */

.field-label { display: block; font-size: 13px; font-weight: 620; color: var(--ink-2); margin: 6px 0 -4px; }
.input {
  width: 100%; min-height: 44px; padding: 10px 13px;
  background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm); font-size: 15px;
}
.input:focus { outline: none; border-color: var(--ink); }
.input-title { font-size: 18px; font-weight: 650; }

.colour-row { display: flex; gap: 10px; flex-wrap: wrap; padding: 2px 0; }
.colour-dot {
  width: 34px; height: 34px; border-radius: 50%; background: var(--wc); flex: none;
  transition: transform 0.1s ease;
}
.colour-dot:hover { transform: scale(1.08); }
.colour-dot.selected { box-shadow: 0 0 0 3px var(--surface), 0 0 0 5px var(--wc); }

.segmented {
  display: inline-flex; background: var(--seg-bg); border-radius: var(--radius-sm); padding: 3px; gap: 2px;
}
.seg-btn {
  padding: 8px 16px; border-radius: 8px; font-size: 14px; font-weight: 620; color: var(--ink-2);
  min-height: 38px;
}
.segmented.small .seg-btn { padding: 6px 12px; font-size: 13px; min-height: 32px; }
.seg-btn.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
html.theme-dark .seg-btn.on { background: #34302A; }

.chip-row { display: flex; gap: 7px; flex-wrap: wrap; }
.chip-row.scroll-x { flex-wrap: nowrap; overflow-x: auto; padding: 2px 2px 6px; scrollbar-width: none; }
.chip-row.scroll-x::-webkit-scrollbar { display: none; }
.chip {
  padding: 7px 13px; min-height: 36px; border-radius: 999px;
  border: 1px solid var(--border-strong); background: var(--surface);
  font-size: 13.5px; font-weight: 600; color: var(--ink-2);
  white-space: nowrap; font-variant-numeric: tabular-nums;
}
.chip.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }

.weekday-row { display: flex; gap: 7px; flex-wrap: wrap; }
.wd-pill {
  width: 42px; height: 42px; border-radius: 50%;
  border: 1px solid var(--border-strong); background: var(--surface);
  font-size: 12.5px; font-weight: 650; color: var(--ink-2);
}
.wd-pill.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }

.switch-label { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-size: 15px; }
.switch-label.big-switch { padding: 6px 0; font-weight: 620; }
.switch-input { appearance: none; width: 46px; height: 28px; border-radius: 999px; background: var(--switch-off); position: relative; flex: none; cursor: pointer; transition: background-color 0.15s ease; margin: 0; }
.switch-input::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px;
  border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
  transition: transform 0.15s ease;
}
.switch-input:checked { background: var(--accent); }
.switch-input:checked::after { transform: translateX(18px); }

.sched-pane { display: flex; flex-direction: column; gap: 10px; }
.end-row { padding-top: 4px; }

/* ---------------- Steppers ---------------- */

.stepper { display: inline-flex; align-items: center; gap: 4px; }
.step-btn {
  width: 40px; height: 40px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong); background: var(--surface);
  display: inline-flex; align-items: center; justify-content: center; color: var(--ink);
}
.step-btn:active { background: var(--surface-2); }
.step-btn .icon { width: 16px; height: 16px; }
.step-val {
  min-width: 58px; text-align: center; font-size: 16px; font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.stepper-big .step-btn { width: 52px; height: 52px; }
.stepper-big .step-val { font-size: 24px; min-width: 84px; }

.big-stepper { display: flex; flex-direction: column; gap: 6px; align-items: center; }
.big-step-label {
  font-size: 11.5px; font-weight: 700; letter-spacing: 0.09em; text-transform: uppercase; color: var(--ink-3);
}
.big-step-row { display: flex; align-items: center; gap: 14px; }
.big-step-btn {
  width: 58px; height: 58px; border-radius: 16px;
  border: 1px solid var(--border-strong); background: var(--surface);
  display: inline-flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow);
}
.big-step-btn:active { background: var(--surface-2); transform: scale(0.96); }
.big-step-btn .icon { width: 22px; height: 22px; }
.big-step-val {
  min-width: 120px; text-align: center;
  font-size: 44px; font-weight: 760; letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}

/* ---------------- Builder ---------------- */

.ex-list { margin-top: 16px; }
.ex-card { padding: 14px 16px; display: flex; flex-direction: column; gap: 12px; }
.ex-card.dragging { opacity: 0.92; box-shadow: var(--shadow-lift); z-index: 5; }
.ex-head { display: flex; align-items: center; gap: 8px; }
.drag-handle {
  width: 36px; height: 36px; flex: none; color: var(--ink-3);
  display: inline-flex; align-items: center; justify-content: center;
  cursor: grab; touch-action: none; border-radius: 8px;
}
.drag-handle:active { cursor: grabbing; }
.ex-title { flex: 1; display: flex; align-items: center; gap: 9px; min-width: 0; }
.ex-title h3 { font-size: 16.5px; font-weight: 700; letter-spacing: -0.01em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.type-tag {
  font-size: 10.5px; font-weight: 700; letter-spacing: 0.07em; text-transform: uppercase;
  color: var(--ink-3); border: 1px solid var(--border); padding: 3px 7px; border-radius: 6px; flex: none;
}
.ex-controls { display: flex; flex-wrap: wrap; gap: 14px 22px; }
.ctrl { display: flex; flex-direction: column; gap: 7px; }
.ctrl-full { flex: 1 1 100%; }
.ctrl-label { font-size: 12px; font-weight: 650; color: var(--ink-2); }

.set-list { display: flex; flex-direction: column; border-top: 1px solid var(--border); }
.set-row {
  display: flex; align-items: center; gap: 12px; min-height: 44px;
  padding: 8px 2px; border-bottom: 1px solid var(--border);
  text-align: left; font-size: 14px;
}
.set-row:last-child { border-bottom: none; }
.set-row:hover { background: var(--surface-2); }
.set-n { font-weight: 650; color: var(--ink-3); flex: none; width: 48px; font-variant-numeric: tabular-nums; }
.set-desc { flex: 1; color: var(--ink); font-variant-numeric: tabular-nums; }
.add-ex-btn { margin-top: 16px; }

/* Picker */
.picker-list { display: flex; flex-direction: column; max-height: 44dvh; overflow-y: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.picker-row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 11px 13px; border-bottom: 1px solid var(--border); text-align: left;
}
.picker-row:last-child { border-bottom: none; }
.picker-row:hover { background: var(--surface-2); }
.picker-row.added { background: color-mix(in srgb, var(--accent) 14%, var(--surface)); }
.picker-main { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.picker-name { font-size: 14.5px; font-weight: 620; }
.picker-sub { font-size: 12px; color: var(--ink-3); }
.custom-form { display: flex; flex-direction: column; gap: 8px; border-top: 1px solid var(--border); padding-top: 12px; }

/* ---------------- Runner ---------------- */

.runner { max-width: 560px; margin: 0 auto; display: flex; flex-direction: column; gap: 22px; }
.runner-head { display: flex; flex-direction: column; gap: 12px; }
.runner-head-row { display: flex; align-items: center; gap: 8px; }
.runner-head-mid { flex: 1; text-align: center; min-width: 0; }
.runner-title { font-size: 15px; font-weight: 700; letter-spacing: -0.01em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.runner-sub { font-size: 12px; color: var(--ink-2); }
.runner-count { font-size: 13px; font-weight: 650; color: var(--ink-2); font-variant-numeric: tabular-nums; min-width: 40px; text-align: right; }
.prog { height: 4px; background: var(--seg-bg); border-radius: 999px; overflow: hidden; }
.prog-fill { height: 100%; width: calc(var(--prog) * 1%); background: var(--wc); border-radius: 999px; transition: width 0.3s ease; }

.runner-main {
  background: var(--surface); border: 1px solid var(--border); border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 26px 22px 24px; display: flex; flex-direction: column; align-items: center; gap: 16px;
  text-align: center;
}
.runner-ex { font-size: 24px; font-weight: 760; letter-spacing: -0.025em; }
.runner-target { font-size: 15px; color: var(--ink-2); font-weight: 600; font-variant-numeric: tabular-nums; }
.runner-prev, .runner-next { font-size: 13.5px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.runner-note { font-size: 12px; font-weight: 700; letter-spacing: 0.09em; text-transform: uppercase; color: var(--ink-2); }

.giant-clock {
  font-size: clamp(76px, 24vw, 132px); font-weight: 780; letter-spacing: -0.045em;
  line-height: 1; font-variant-numeric: tabular-nums; color: var(--ink);
  padding: 8px 0 2px;
}
.giant-clock.dim { color: var(--ink-3); }
.rest-main { border-color: var(--border); background: var(--surface-2); }
.rest-clock { color: var(--ink-2); }

.done-main { gap: 20px; }
.summary-rows { width: 100%; display: flex; flex-direction: column; border-top: 1px solid var(--border); }
.summary-row {
  display: flex; justify-content: space-between; padding: 12px 2px;
  border-bottom: 1px solid var(--border); font-size: 14.5px; color: var(--ink-2);
}
.summary-row strong { color: var(--ink); font-weight: 700; font-variant-numeric: tabular-nums; }

.runner-sets { display: flex; flex-direction: column; gap: 6px; }
.runner-sets .eyebrow { padding-left: 2px; margin-bottom: 2px; }
.runner-set-row {
  display: flex; align-items: center; gap: 12px; min-height: 46px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 8px 12px; text-align: left; font-size: 14px;
}
.runner-set-row:disabled { cursor: default; color: var(--ink-2); }
.runner-set-row.current { border-color: var(--wc); box-shadow: 0 0 0 1px var(--wc); }
.runner-set-row.done .runner-set-desc { color: var(--ink); }
.runner-set-check {
  width: 26px; height: 26px; border-radius: 50%; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--border-strong); color: var(--ink-3);
  font-size: 12.5px; font-weight: 700; font-variant-numeric: tabular-nums;
}
.runner-set-row.done .runner-set-check { background: var(--wc); border-color: var(--wc); color: #fff; }
.runner-set-check .icon { width: 14px; height: 14px; }
.runner-set-desc { font-variant-numeric: tabular-nums; }

.resume-card .card-title { font-size: 20px; }

/* ---------------- Calendar ---------------- */

.cal-head { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.cal-nav { display: flex; align-items: center; gap: 4px; }
.cal-title { font-size: 19px; font-weight: 750; letter-spacing: -0.02em; flex: 1; min-width: 140px; }

.cal-layout { display: grid; gap: 18px; }
@media (min-width: 900px) { .cal-layout { grid-template-columns: 1fr 320px; align-items: start; } }

.month-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.month-wd { font-size: 11px; font-weight: 700; letter-spacing: 0.07em; text-transform: uppercase; color: var(--ink-3); text-align: center; padding-bottom: 2px; }
.month-cell {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
  min-height: 96px; padding: 7px 7px 6px; text-align: left;
  display: flex; flex-direction: column; gap: 4px; overflow: hidden;
}
.month-cell:hover { border-color: var(--border-strong); }
.month-cell.other { opacity: 0.45; }
.month-cell.selected { border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink); }
.cell-num { font-size: 12.5px; font-weight: 650; color: var(--ink-2); font-variant-numeric: tabular-nums; width: 22px; height: 22px; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; }
.month-cell.today .cell-num { background: var(--accent); color: var(--accent-ink); }

.cal-chip {
  display: flex; align-items: center; gap: 5px; min-width: 0;
  font-size: 11.5px; font-weight: 620; color: var(--ink);
  background: var(--bg); border: 1px solid var(--border); border-radius: 6px; padding: 2.5px 6px;
}
.chip-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--wc); flex: none; }
.chip-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-chip .chip-check { width: 12px; height: 12px; color: var(--wc); flex: none; margin-left: auto; }
.cal-chip.missed { color: var(--ink-3); }
.cal-chip.missed .chip-dot { opacity: 0.35; }
.chip-more { font-size: 11px; color: var(--ink-3); font-weight: 650; padding-left: 2px; }

@media (max-width: 640px) {
  .month-cell { min-height: 64px; padding: 5px; }
  .cal-chip { padding: 2px; border: none; background: none; gap: 3px; }
  .chip-name, .cal-chip .chip-check { display: none; }
  .chip-dot { width: 8px; height: 8px; }
  .cal-chip.completed .chip-dot { box-shadow: 0 0 0 2px color-mix(in srgb, var(--wc) 30%, transparent); }
}

.week-wrap { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; }
@media (max-width: 899px) { .week-wrap { grid-template-columns: 1fr; } }
.week-day {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 12px; min-height: 120px; text-align: left;
  display: flex; flex-direction: column; gap: 10px;
}
@media (max-width: 899px) { .week-day { min-height: 0; flex-direction: row; align-items: center; } .week-day-head { width: 64px; flex: none; } }
.week-day.selected { border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink); }
.week-day-head { display: flex; flex-direction: column; }
.week-wd { font-size: 11px; font-weight: 700; letter-spacing: 0.07em; text-transform: uppercase; color: var(--ink-3); }
.week-num { font-size: 19px; font-weight: 750; font-variant-numeric: tabular-nums; }
.week-day.today .week-num { color: var(--wc, var(--ink)); }
.week-day.today .week-wd { color: var(--ink); }
.week-chips { display: flex; flex-direction: column; gap: 5px; flex: 1; min-width: 0; }
.week-rest { color: var(--ink-3); font-size: 13px; flex: 1; }

.year-wrap { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; }
.mini-month {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 12px; text-align: left; display: flex; flex-direction: column; gap: 8px;
}
.mini-month:hover { border-color: var(--border-strong); }
.mini-title { font-size: 13px; font-weight: 700; }
.mini-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; }
.mini-cell {
  font-size: 9.5px; text-align: center; color: var(--ink-3);
  height: 20px; display: inline-flex; align-items: center; justify-content: center;
  border-radius: 5px; font-variant-numeric: tabular-nums;
}
.mini-cell.today { box-shadow: inset 0 0 0 1.5px var(--accent); color: var(--ink); font-weight: 700; }
.mini-cell.has { background: var(--wc); color: #fff; font-weight: 650; }
.mini-cell.has.missed { opacity: 0.35; }

.day-panel {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 18px; position: sticky; top: 20px;
  display: flex; flex-direction: column; gap: 14px;
}
.day-panel-title { font-size: 16px; font-weight: 700; letter-spacing: -0.01em; }
.day-body { display: flex; flex-direction: column; gap: 10px; }
.day-occ { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 14px; }
.day-occ-main { min-width: 0; }
.day-occ-name { font-size: 15px; font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.day-occ-status { font-size: 12.5px; color: var(--ink-2); }
.day-occ-status.missed { color: var(--ink-3); }
.day-occ-actions { display: flex; align-items: center; gap: 6px; flex: none; }

/* ---------------- History / lists ---------------- */

.history-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 15px 16px; width: 100%; }
.history-main { min-width: 0; }
.history-name { font-size: 16px; font-weight: 700; display: flex; align-items: center; gap: 6px; }
.inline-check { width: 15px; height: 15px; color: var(--wc); }
.history-meta { font-size: 13px; color: var(--ink-2); margin-top: 2px; font-variant-numeric: tabular-nums; }
.history-meta.strong { color: var(--ink); font-weight: 650; }

.session-ex-name { font-size: 16px; font-weight: 700; }
.session-set-list { display: flex; flex-direction: column; }
.session-set {
  display: flex; gap: 14px; padding: 7px 0; border-bottom: 1px solid var(--border);
  font-size: 14px; font-variant-numeric: tabular-nums;
}
.session-set:last-child { border-bottom: none; }
.session-set.skipped { color: var(--ink-3); }

.list-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 13px 15px; width: 100%; }
.list-row:hover { border-color: var(--border-strong); }
.list-row-name { font-size: 15px; font-weight: 650; }
.list-row-sub { font-size: 12.5px; color: var(--ink-3); margin-top: 1px; }

/* ---------------- Settings ---------------- */

.settings-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; min-height: 44px; }
.settings-label { font-size: 15px; font-weight: 620; }
.settings-note { font-size: 13px; color: var(--ink-2); margin-top: 1px; }
.settings-note.pad-b { margin-bottom: 4px; }
.settings-value { font-size: 14.5px; color: var(--ink-2); font-weight: 600; }

/* ---------------- Overlays ---------------- */

.overlay {
  position: fixed; inset: 0; z-index: 60;
  background: var(--overlay-bg);
  display: flex; align-items: flex-end; justify-content: center;
  opacity: 0; transition: opacity 0.18s ease;
}
.overlay.open { opacity: 1; }
.sheet {
  background: var(--surface); width: 100%; max-width: 520px;
  border-radius: 18px 18px 0 0;
  max-height: 90dvh; overflow-y: auto;
  padding: 10px 20px calc(20px + env(safe-area-inset-bottom, 0px));
  transform: translateY(26px); transition: transform 0.18s ease;
  display: flex; flex-direction: column;
}
.overlay.open .sheet { transform: translateY(0); }
.sheet-wide { max-width: 640px; }
.sheet-head { display: flex; align-items: center; gap: 8px; padding: 6px 0 10px; position: relative; }
.sheet-grab {
  position: absolute; top: 0; left: 50%; transform: translateX(-50%);
  width: 40px; height: 4px; border-radius: 999px; background: var(--border-strong);
}
.sheet-title { flex: 1; font-size: 16.5px; font-weight: 700; letter-spacing: -0.01em; padding-top: 10px; }
.sheet-close { margin-top: 6px; }
.sheet-body { display: flex; flex-direction: column; gap: 12px; padding-bottom: 6px; }

@media (min-width: 700px) {
  .overlay { align-items: center; padding: 24px; }
  .sheet { border-radius: 16px; box-shadow: var(--shadow-lift); }
  .sheet-grab { display: none; }
}

.dlg-msg { font-size: 14.5px; color: var(--ink-2); }
.dlg-actions { display: flex; gap: 10px; padding-top: 8px; }
.dlg-actions .btn { flex: 1; }

.choose-list { display: flex; flex-direction: column; gap: 6px; }
.choose-item {
  display: flex; align-items: center; gap: 12px; text-align: left;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 13px 14px; min-height: 50px; background: var(--surface);
}
.choose-item:hover { border-color: var(--border-strong); background: #FAFAF8; }
.choose-item.is-danger .choose-label { color: var(--danger); }
.choose-item .dot { width: 12px; height: 12px; border-radius: 50%; background: var(--wc); flex: none; }
.choose-main { display: flex; flex-direction: column; min-width: 0; }
.choose-label { font-size: 15px; font-weight: 650; }
.choose-sub { font-size: 12.5px; color: var(--ink-3); }

/* ---------------- Toasts, saved, resume ---------------- */

#toasts {
  position: fixed; left: 0; right: 0;
  bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px) + 14px);
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  z-index: 80; pointer-events: none;
}
@media (min-width: 900px) { #toasts { bottom: 22px; } }
.toast {
  background: var(--ink); color: var(--bg); font-size: 13.5px; font-weight: 600;
  padding: 10px 16px; border-radius: 999px; box-shadow: var(--shadow-lift);
  opacity: 0; transform: translateY(8px); transition: opacity 0.2s ease, transform 0.2s ease;
  max-width: min(90vw, 420px); text-align: center;
}
.toast.show { opacity: 1; transform: translateY(0); }

.saved-pill {
  position: fixed; top: 14px; right: 14px; z-index: 70;
  background: var(--surface); border: 1px solid var(--border);
  color: var(--ink-2); font-size: 12.5px; font-weight: 650;
  padding: 7px 12px; border-radius: 999px; box-shadow: var(--shadow);
  opacity: 0; transform: translateY(-6px); transition: opacity 0.15s ease, transform 0.15s ease;
  pointer-events: none;
}
.saved-pill.show { opacity: 1; transform: translateY(0); }

.resume-pill {
  position: fixed; right: 16px;
  bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px) + 16px);
  z-index: 40;
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--ink); color: var(--bg);
  font-size: 14px; font-weight: 650;
  padding: 12px 18px; border-radius: 999px; box-shadow: var(--shadow-lift);
}
.resume-pill .icon { width: 15px; height: 15px; color: var(--wc); }
@media (min-width: 900px) { .resume-pill { bottom: 22px; right: 22px; } }

/* ---------------- Motion ---------------- */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* ---------------- Audit-round additions (v1.0.1) ---------------- */

/* P2-04: tappable stepper values for direct numeric entry */
.step-val-edit { border-radius: 8px; padding: 4px 6px; }
.step-val-edit:hover { background: rgba(27, 25, 23, 0.05); }
.step-input, .big-step-input {
  border: 1px solid var(--ink); border-radius: 8px; background: var(--surface);
  text-align: center; -moz-appearance: textfield; appearance: textfield;
}
.step-input { width: 76px; padding: 4px 2px; }
.big-step-input { width: 150px; padding: 2px; }
.step-input::-webkit-outer-spin-button, .step-input::-webkit-inner-spin-button,
.big-step-input::-webkit-outer-spin-button, .big-step-input::-webkit-inner-spin-button {
  -webkit-appearance: none; margin: 0;
}

/* P1-02: ended-early completions get a dimmed check */
.cal-chip.partial .chip-check { opacity: 0.4; }

/* P2-06: two workout colours per year-view cell */
.mini-cell.has.multi {
  background: linear-gradient(135deg, var(--wc) 0 50%, var(--wc2) 50% 100%);
}

.seg-btn:disabled { opacity: 0.45; cursor: not-allowed; }

/* ---------------- Dark theme (v1.01): charcoal + teal accent ---------------- */

html.theme-dark {
  color-scheme: dark;
  --bg: #131110;
  --surface: #1C1917;
  --border: #2A2622;
  --border-strong: #3B352E;
  --ink: #EDEAE3;
  --ink-2: #A8A199;
  --ink-3: #6E6860;
  --danger: #F87171;
  --accent: #2DD4BF;
  --accent-ink: #082A25;
  --surface-2: #23201C;
  --hover: rgba(255, 255, 255, 0.06);
  --seg-bg: #26221E;
  --switch-off: #3B352E;
  --overlay-bg: rgba(0, 0, 0, 0.58);
  --tabbar-bg: rgba(22, 19, 17, 0.92);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-lift: 0 10px 32px rgba(0, 0, 0, 0.55);
}
html.theme-dark .brand-mark { color: var(--ink); }
html.theme-dark .brand-ver { color: var(--accent); }
html.theme-dark .btn-danger { color: #1A0B0B; }
html.theme-dark .month-cell.selected,
html.theme-dark .week-day.selected { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
html.theme-dark .runner-set-row.done .runner-set-check { color: #0B1210; }
html.theme-dark .mini-cell.has { color: #0B1210; }
html.theme-dark .switch-input::after { box-shadow: 0 1px 3px rgba(0, 0, 0, 0.6); }

/* ---------------- Filter-row polish (Exercises view) ---------------- */

.filter-row { margin: 12px 0 14px; }
.exercise-search { margin-top: 2px; }

/* ---------------- Sharing (v1.03) ---------------- */

.share-link-box { font-size: 12.5px; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; }
.share-preview { margin: 4px 0; }
.share-actions { margin-top: 16px; }
.error-note { color: var(--danger); }

/* ---------------- Compare (v1.04) ---------------- */

.cmp-table { display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; }
.cmp-row { display: grid; grid-template-columns: 1.2fr 1fr 1fr; gap: 8px; padding: 9px 12px; border-bottom: 1px solid var(--border); font-size: 13.5px; align-items: baseline; }
.cmp-row:last-child { border-bottom: none; }
.cmp-head { background: var(--surface-2); font-weight: 700; }
.cmp-head .cmp-val { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cmp-sub { background: var(--surface-2); }
.cmp-sub .cmp-label { font-size: 11.5px; font-weight: 700; letter-spacing: 0.07em; text-transform: uppercase; color: var(--ink-3); }
.cmp-label { color: var(--ink-2); }
.cmp-val { font-variant-numeric: tabular-nums; text-align: right; font-weight: 620; }
.cmp-group { display: flex; flex-direction: column; gap: 8px; margin-top: 6px; }
.cmp-diff { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px; }
.cmp-diff-name { font-size: 14.5px; font-weight: 700; margin-bottom: 2px; }
.cmp-diff-line { font-size: 13px; color: var(--ink-2); font-variant-numeric: tabular-nums; }

.preview-list.rich li { flex-direction: column; align-items: stretch; gap: 2px; }
.preview-main { display: flex; justify-content: space-between; gap: 12px; }
.preview-note { font-size: 12px; color: var(--ink-3); font-style: italic; }
.weights-badge { color: var(--ink); }
.weights-badge .icon { display: none; }
