:root {
  --paper: #F3F4F1;
  --surface: #FFFFFF;
  --surface-2: #ECEEE8;
  --ink: #15160F;
  --muted: #6B6D62;
  --faint: #9A9C90;
  --line: rgba(20, 22, 15, 0.10);
  --line-2: rgba(20, 22, 15, 0.18);

  --go: #1B9E5A;
  --go-press: #157E48;
  --go-tint: #E4F4EB;

  --rest: #2A7DCB;
  --prep: #D2851C;

  --radius: 12px;
  --radius-sm: 9px;
  --radius-pill: 999px;

  --font-body: "Barlow", system-ui, -apple-system, sans-serif;
  --font-head: "Barlow Semi Condensed", system-ui, sans-serif;
  --font-num: "Barlow Condensed", system-ui, sans-serif;

  --maxw: 520px;
  --pad: 18px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #14150F;
    --surface: #1F2018;
    --surface-2: #2A2B22;
    --ink: #F2F3EB;
    --muted: #A6A89B;
    --faint: #74766B;
    --line: rgba(255, 255, 255, 0.10);
    --line-2: rgba(255, 255, 255, 0.18);
    --go-tint: #18342492;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--font-body);
  background: var(--paper);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
  padding-bottom: calc(150px + var(--safe-b));
}
button { font-family: inherit; color: inherit; }
input { font-family: inherit; }

/* ---------- top bar ---------- */
.topbar {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 20px var(--pad) 10px;
  display: flex;
  align-items: baseline;
  gap: 10px;
}
.wordmark { display: flex; align-items: center; gap: 9px; }
.wordmark-tick {
  width: 11px; height: 11px; border-radius: 3px;
  background: var(--go);
  box-shadow: 0 0 0 4px var(--go-tint);
}
.wordmark-name {
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 25px;
  letter-spacing: -0.01em;
}
.tagline {
  margin: 0;
  font-family: var(--font-head);
  font-weight: 500;
  font-size: 13px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--faint);
}

main { max-width: var(--maxw); margin: 0 auto; padding: 0 var(--pad); }

.section { display: none; }
.section.is-active { display: block; animation: fade 0.18s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.block { margin: 18px 0; }
.block-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.block-title {
  font-family: var(--font-head);
  font-weight: 600; font-size: 16px;
  letter-spacing: 0.04em; text-transform: uppercase;
  margin: 0 0 4px;
}
.block-hint { margin: 0 0 12px; font-size: 13.5px; color: var(--muted); }
.summary { font-size: 13px; color: var(--faint); font-variant-numeric: tabular-nums; }

/* ---------- library ---------- */
.lib-group { margin-bottom: 14px; }
.lib-cat {
  font-family: var(--font-head);
  font-weight: 600; font-size: 12px;
  letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--muted);
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 8px;
}
.lib-cat::before {
  content: ""; width: 8px; height: 8px; border-radius: 2px;
  background: var(--cat, var(--muted));
}
.chips { display: flex; flex-wrap: wrap; gap: 7px; }
.chip {
  border: 1px solid var(--line-2);
  background: var(--surface);
  border-radius: var(--radius-pill);
  padding: 8px 14px;
  font-size: 14px; font-weight: 500;
  cursor: pointer;
  transition: transform 0.08s ease, background 0.12s ease, border-color 0.12s ease;
}
.chip:active { transform: scale(0.96); }
.chip.on {
  background: var(--cat-tint);
  border-color: var(--cat);
  color: var(--cat-ink);
}

/* ---------- custom add ---------- */
.custom-add { display: flex; gap: 8px; }
.custom-add input {
  flex: 1; min-width: 0;
  height: 44px; padding: 0 14px;
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  font-size: 15px;
}
.custom-add input::placeholder { color: var(--faint); }
.custom-add input:focus { outline: none; border-color: var(--go); box-shadow: 0 0 0 3px var(--go-tint); }

/* ---------- plan list ---------- */
.plan { display: flex; flex-direction: column; gap: 9px; }
.plan-empty {
  border: 1px dashed var(--line-2);
  border-radius: var(--radius);
  padding: 22px 16px;
  text-align: center;
  color: var(--faint);
  font-size: 14px;
}
.ex {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  border-left: 4px solid var(--cat, var(--line-2));
  padding: 11px 12px;
}
.ex-top { display: flex; align-items: center; gap: 9px; margin-bottom: 9px; }
.ex-name { flex: 1; min-width: 0; font-weight: 600; font-size: 15.5px; font-family: var(--font-head);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ex-cat {
  font-size: 10.5px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--cat-ink); background: var(--cat-tint);
  padding: 3px 7px; border-radius: 5px; white-space: nowrap;
}
.ex-rm {
  width: 30px; height: 30px; flex: none;
  border: none; background: transparent; color: var(--faint);
  border-radius: 7px; cursor: pointer; font-size: 18px; line-height: 1;
}
.ex-rm:active { background: var(--surface-2); }
.ex-fields { display: flex; gap: 8px; }
.field {
  flex: 1; display: flex; flex-direction: column; align-items: center;
  background: var(--surface-2); border-radius: var(--radius-sm); padding: 6px 4px;
}
.field input {
  width: 100%; border: none; background: transparent; text-align: center;
  font-family: var(--font-num); font-weight: 700; font-size: 22px; color: var(--ink);
  -moz-appearance: textfield;
}
.field input::-webkit-outer-spin-button,
.field input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.field input:focus { outline: none; }
.field span { font-size: 10.5px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); margin-top: 1px; }

/* ---------- rest row ---------- */
.rest-row {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 12px 14px;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
.rest-row > label { font-size: 14px; font-weight: 500; }
.rest-control { display: flex; align-items: center; gap: 6px; }
.rest-control input {
  width: 60px; height: 38px; text-align: center;
  border: 1px solid var(--line-2); border-radius: var(--radius-sm);
  background: var(--paper); color: var(--ink);
  font-family: var(--font-num); font-weight: 700; font-size: 18px;
}
.rest-control input:focus { outline: none; border-color: var(--go); }
.rest-control .unit { font-size: 13px; color: var(--muted); margin-right: 4px; }

/* ---------- buttons ---------- */
.btn {
  border: 1px solid var(--line-2); background: var(--surface);
  border-radius: var(--radius); padding: 0 16px; height: 44px;
  font-weight: 600; font-size: 15px; cursor: pointer;
  font-family: var(--font-head); letter-spacing: 0.01em;
  transition: transform 0.08s ease, background 0.12s ease;
}
.btn:active { transform: scale(0.97); }
.btn-quiet { background: var(--surface); }
.btn-quiet:active { background: var(--surface-2); }
.btn-sm { height: 36px; font-size: 13.5px; padding: 0 12px; }
.btn-go {
  background: var(--go); border-color: var(--go); color: #fff;
}
.btn-go:active { background: var(--go-press); }
.btn-go:disabled { opacity: 0.4; }
.btn-lg { height: 54px; font-size: 18px; width: 100%; letter-spacing: 0.02em; }

/* ---------- start dock ---------- */
.start-dock {
  position: fixed; left: 0; right: 0;
  bottom: calc(64px + var(--safe-b));
  padding: 10px var(--pad);
  max-width: var(--maxw); margin: 0 auto;
  pointer-events: none;
}
.start-dock .btn { pointer-events: auto; box-shadow: 0 6px 20px rgba(20,22,15,0.18); }
.start-dock[hidden] { display: none; }

/* ---------- bottom tab bar ---------- */
.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0;
  height: calc(64px + var(--safe-b));
  padding-bottom: var(--safe-b);
  background: var(--surface);
  border-top: 1px solid var(--line);
  display: flex;
  z-index: 20;
}
.tab {
  flex: 1; border: none; background: transparent; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: var(--faint); padding-top: 6px;
}
.tab-label { font-family: var(--font-head); font-weight: 600; font-size: 12px; letter-spacing: 0.06em; text-transform: uppercase; }
.tab.is-active { color: var(--go); }
.tab-ico { display: block; height: 22px; }

/* ---------- run section ---------- */
.run-empty {
  text-align: center; padding: 40px 20px 20px;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
}
.run-empty-mark {
  width: 54px; height: 54px; border-radius: 16px;
  background: var(--surface); border: 1px solid var(--line-2);
  position: relative; margin-bottom: 8px;
}
.run-empty-mark::after {
  content: ""; position: absolute; inset: 16px; border-radius: 50%;
  border: 3px solid var(--faint);
  border-top-color: transparent;
}
.run-empty h2 { font-family: var(--font-head); font-weight: 600; margin: 4px 0 0; font-size: 19px; }
.run-empty p { margin: 0 0 10px; color: var(--muted); font-size: 14px; max-width: 30ch; }

.run-stage { padding-top: 4px; }
.run-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.run-count { font-family: var(--font-head); font-weight: 600; font-size: 13px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.run-bar { height: 6px; border-radius: 999px; background: var(--surface-2); overflow: hidden; margin-bottom: 16px; }
.run-bar-fill { height: 100%; width: 0%; background: var(--go); border-radius: 999px; transition: width 0.35s ease; }

.run-card {
  border-radius: 18px;
  padding: 34px 18px;
  text-align: center;
  background: var(--surface);
  border: 1px solid var(--line);
  transition: background 0.25s ease, border-color 0.25s ease;
  min-height: 270px;
  display: flex; flex-direction: column; justify-content: center;
}
.run-card[data-phase="work"] { background: #12834A; border-color: transparent; }
.run-card[data-phase="rest"] { background: #1E6BB8; border-color: transparent; }
.run-card[data-phase="prep"] { background: #C4791A; border-color: transparent; }
.run-card[data-phase="done"] { background: #12834A; border-color: transparent; }

.run-phase {
  font-family: var(--font-head); font-weight: 700;
  font-size: 13px; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--muted); margin-bottom: 8px;
}
.run-name {
  font-family: var(--font-head); font-weight: 700;
  font-size: 30px; line-height: 1.1; color: var(--ink);
}
.run-detail { font-size: 16px; font-weight: 500; color: var(--muted); margin-top: 10px; }
.run-timer {
  font-family: var(--font-num); font-weight: 700;
  font-size: 86px; line-height: 1; letter-spacing: 0.01em;
  font-variant-numeric: tabular-nums; margin-top: 10px; color: var(--ink);
}
.run-card[data-phase="work"] .run-phase,
.run-card[data-phase="work"] .run-name,
.run-card[data-phase="work"] .run-detail,
.run-card[data-phase="done"] .run-phase,
.run-card[data-phase="done"] .run-name,
.run-card[data-phase="done"] .run-detail { color: #EAFBF1; }
.run-card[data-phase="rest"] .run-phase,
.run-card[data-phase="rest"] .run-name,
.run-card[data-phase="rest"] .run-detail,
.run-card[data-phase="rest"] .run-timer { color: #EAF3FC; }
.run-card[data-phase="prep"] .run-phase,
.run-card[data-phase="prep"] .run-name,
.run-card[data-phase="prep"] .run-detail,
.run-card[data-phase="prep"] .run-timer { color: #FCF3E3; }

.run-controls { display: flex; gap: 10px; margin-top: 16px; }
.run-controls .btn { flex: 1; height: 52px; font-size: 17px; }

/* ---------- reps/time segmented toggle (build) ---------- */
.seg {
  display: inline-flex;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  padding: 3px;
  gap: 3px;
  margin-bottom: 9px;
}
.seg-btn {
  border: none; background: transparent; cursor: pointer;
  font-family: var(--font-head); font-weight: 600;
  font-size: 12px; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--muted); padding: 5px 12px; border-radius: 6px;
  transition: background 0.12s ease, color 0.12s ease;
}
.seg-btn.on { background: var(--surface); color: var(--cat, var(--go)); box-shadow: 0 1px 2px rgba(20,22,15,0.12); }

/* ---------- run header: total stopwatch ---------- */
.run-clock {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--font-num); font-weight: 700;
  font-size: 22px; letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}
.run-clock-ico { color: var(--go); }

/* ---------- run progress row ---------- */
.run-progress { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.run-progress .run-bar { flex: 1; margin-bottom: 0; }
.run-count { white-space: nowrap; }

/* ---------- paused state ---------- */
.run-stage.is-paused .run-card { filter: saturate(0.55) brightness(0.97); }
.run-stage.is-paused .run-clock { opacity: 0.5; }

/* ---------- settings block (order + rest) ---------- */
.settings { display: flex; flex-direction: column; gap: 9px; }
.setting-row {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 12px 14px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.setting-row > label { font-size: 14px; font-weight: 500; }
.setting-label { display: flex; flex-direction: column; gap: 1px; }
.setting-label > span { font-size: 14px; font-weight: 500; }
.setting-label > small { font-size: 11.5px; color: var(--faint); }
.setting-row .seg { margin-bottom: 0; }

/* ---------- saved workouts ---------- */
.save-row { display: flex; gap: 8px; margin-bottom: 12px; }
.save-row input {
  flex: 1; min-width: 0; height: 44px; padding: 0 14px;
  border: 1px solid var(--line-2); border-radius: var(--radius);
  background: var(--surface); color: var(--ink); font-size: 15px;
}
.save-row input::placeholder { color: var(--faint); }
.save-row input:focus { outline: none; border-color: var(--go); box-shadow: 0 0 0 3px var(--go-tint); }
.saved-list { display: flex; flex-direction: column; gap: 8px; }
.saved-empty {
  color: var(--faint); font-size: 14px; text-align: center;
  border: 1px dashed var(--line-2); border-radius: var(--radius); padding: 18px 14px;
}
.saved {
  display: flex; align-items: center; gap: 10px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 10px 12px;
}
.saved-info { flex: 1; min-width: 0; }
.saved-name {
  font-family: var(--font-head); font-weight: 600; font-size: 15px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.saved-meta { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.saved-actions { display: flex; gap: 6px; flex: none; }

/* ---------- run: rep counter emphasis ---------- */
.run-timer.is-reps { font-size: 74px; }
.run-timer.is-reps .rep-total { color: inherit; opacity: 0.5; font-size: 0.6em; }

/* ---------- run: start / finish times ---------- */
.run-times {
  display: flex; justify-content: space-between;
  margin: -6px 0 14px; padding: 0 2px;
}
.rt-item {
  display: inline-flex; align-items: baseline; gap: 6px;
  font-family: var(--font-head); font-weight: 600;
  font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--faint);
}
.rt-item b {
  font-family: var(--font-num); font-weight: 700; font-size: 17px;
  letter-spacing: 0.01em; color: var(--ink); text-transform: none;
  font-variant-numeric: tabular-nums;
}

/* ---------- run: live tempo stepper ---------- */
.run-tempo {
  display: flex; align-items: center; justify-content: center; gap: 16px;
  margin-top: 14px;
}
.run-tempo[hidden] { display: none; }
.tempo-btn {
  width: 54px; height: 54px; flex: none;
  border-radius: 15px; border: 1px solid var(--line-2);
  background: var(--surface); color: var(--ink);
  font-size: 27px; font-weight: 600; line-height: 1; cursor: pointer;
  transition: transform 0.08s ease, background 0.12s ease;
}
.tempo-btn:active { background: var(--surface-2); transform: scale(0.95); }
.tempo-mid { text-align: center; min-width: 96px; }
.tempo-mid b {
  font-family: var(--font-num); font-weight: 700; font-size: 32px;
  display: block; line-height: 1; font-variant-numeric: tabular-nums;
}
.tempo-mid span { font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }

/* ---------- build: per-exercise rep tempo ---------- */
.ex-tempo {
  display: flex; align-items: center; gap: 10px;
  margin-top: 9px; padding-top: 9px; border-top: 1px dashed var(--line);
}
.ex-tempo .lbl {
  font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--muted); margin-right: auto;
}
.ex-step { display: inline-flex; align-items: center; gap: 8px; }
.ex-step button {
  width: 32px; height: 32px; border-radius: 8px;
  border: 1px solid var(--line-2); background: var(--surface-2); color: var(--ink);
  font-size: 18px; line-height: 1; cursor: pointer;
}
.ex-step button:active { transform: scale(0.95); }
.ex-step b {
  font-family: var(--font-num); font-weight: 700; font-size: 19px;
  min-width: 38px; text-align: center; font-variant-numeric: tabular-nums;
}
.ex-step small { color: var(--muted); font-size: 11px; }

/* ========== v5: bigger run readouts + rename + presets/preview + week ========== */

/* bigger timer, clock and start/finish times */
.run-clock { font-size: 25px; }
.run-timer { font-size: 104px; }
.run-timer.is-reps { font-size: 90px; }
.run-times { margin: -4px 0 18px; }
.rt-item { font-size: 12px; }
.rt-item b { font-size: 24px; }
.run-card { min-height: 288px; }

/* editable exercise name */
.ex-name-input {
  flex: 1; min-width: 0;
  font-family: var(--font-head); font-weight: 600; font-size: 15.5px;
  color: var(--ink); background: transparent;
  border: none; border-bottom: 1px dashed transparent;
  padding: 3px 0; border-radius: 0;
}
.ex-name-input:hover { border-bottom-color: var(--line-2); }
.ex-name-input:focus { outline: none; border-bottom-color: var(--cat, var(--go)); }

/* preset preview */
.saved { flex-wrap: wrap; }
.saved-preview {
  flex-basis: 100%; width: 100%;
  margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--line);
  display: none;
}
.saved.is-open .saved-preview { display: block; }
.saved-ex {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
  font-size: 13px; color: var(--muted); padding: 3px 0;
}
.saved-ex .nm { color: var(--ink); font-weight: 600; font-family: var(--font-head); }
.saved-ex .dt { white-space: nowrap; font-variant-numeric: tabular-nums; }

/* weekly plan */
.week { display: flex; flex-direction: column; gap: 8px; }
.day-row {
  display: flex; align-items: center; gap: 10px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 9px 12px;
}
.day-row.is-today { border-color: var(--go); box-shadow: 0 0 0 3px var(--go-tint); }
.day-name {
  width: 42px; flex: none;
  font-family: var(--font-head); font-weight: 600; font-size: 13px;
  letter-spacing: 0.06em; text-transform: uppercase;
}
.day-select {
  flex: 1; min-width: 0; height: 38px;
  border: 1px solid var(--line-2); border-radius: var(--radius-sm);
  background: var(--paper); color: var(--ink);
  font-size: 14px; padding: 0 8px; font-family: var(--font-body);
}
.day-select:focus { outline: none; border-color: var(--go); }
.day-load { flex: none; }

/* ========== v6: calendar ========== */
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.cal-title { font-family: var(--font-head); font-weight: 700; font-size: 19px; }
.cal-nav { display: flex; gap: 6px; }

.cal-dow { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; margin-bottom: 6px; }
.cal-dow span {
  text-align: center; font-family: var(--font-head); font-weight: 600;
  font-size: 11px; letter-spacing: 0.03em; text-transform: uppercase; color: var(--faint);
}
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cal-cell {
  min-height: 56px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--surface); padding: 5px 5px 4px;
  display: flex; flex-direction: column; gap: 3px; cursor: pointer; overflow: hidden;
  text-align: left;
}
.cal-cell.blank { border: none; background: transparent; cursor: default; }
.cal-cell.is-today { border-color: var(--go); }
.cal-cell.is-selected { box-shadow: 0 0 0 2px var(--go); border-color: var(--go); }
.cal-cell-top { display: flex; align-items: center; justify-content: space-between; }
.cal-num { font-family: var(--font-num); font-weight: 700; font-size: 15px; line-height: 1; color: var(--ink); }
.cal-cell.is-today .cal-num { color: var(--go); }
.cal-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.cal-dot.done { background: var(--go); }
.cal-dot.plan { background: var(--prep); }
.cal-dot.hint { background: transparent; border: 1.5px solid var(--faint); }
.cal-label { font-size: 9.5px; line-height: 1.15; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-label.hint { color: var(--faint); font-style: italic; }

.cal-legend { display: flex; flex-wrap: wrap; gap: 16px; margin: 14px 2px 6px; font-size: 12px; color: var(--muted); }
.cal-legend span { display: inline-flex; align-items: center; gap: 6px; }
.cal-legend i { width: 8px; height: 8px; border-radius: 50%; }

.cal-editor { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 15px; margin-top: 8px; }
.cal-ed-date { font-family: var(--font-head); font-weight: 700; font-size: 16px; margin-bottom: 12px; }
.cal-field { margin-bottom: 11px; }
.cal-field > label { display: block; font-size: 11px; letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted); margin-bottom: 5px; }
.cal-field select, .cal-field input {
  width: 100%; height: 42px; border: 1px solid var(--line-2); border-radius: var(--radius-sm);
  background: var(--paper); color: var(--ink); font-size: 14px; padding: 0 10px; font-family: var(--font-body);
}
.cal-field select:focus, .cal-field input:focus { outline: none; border-color: var(--go); }
.cal-done-btn { width: 100%; height: 44px; }
.cal-done-btn.on { background: var(--go); border-color: var(--go); color: #fff; }
.cal-ed-actions { display: flex; gap: 8px; margin-top: 4px; }
.cal-ed-actions .btn { flex: 1; }

/* ========== v7: motivation + activity logging ========== */
.motiv-card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px;
}
.motiv-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.motiv-level { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.motiv-badge {
  font-family: var(--font-head); font-weight: 700; font-size: 12px; letter-spacing: 0.04em;
  color: #fff; background: var(--go); padding: 4px 9px; border-radius: 7px;
}
.motiv-title { font-family: var(--font-head); font-weight: 700; font-size: 20px; }
.motiv-total { text-align: right; line-height: 1; }
.motiv-total b { font-family: var(--font-num); font-weight: 700; font-size: 30px; font-variant-numeric: tabular-nums; }
.motiv-total span { display: block; font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); margin-top: 2px; }
.motiv-bar { height: 8px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.motiv-fill { height: 100%; background: var(--go); border-radius: 999px; transition: width 0.4s ease; }
.motiv-next { font-size: 12px; color: var(--muted); margin-top: 6px; }
.motiv-stats { display: flex; gap: 10px; margin-top: 14px; }
.motiv-stats > div {
  flex: 1; text-align: center; background: var(--surface-2);
  border-radius: var(--radius-sm); padding: 9px 4px;
}
.motiv-stats b { display: block; font-family: var(--font-num); font-weight: 700; font-size: 22px; font-variant-numeric: tabular-nums; }
.motiv-stats span { font-size: 10.5px; letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted); }

/* points pill on calendar cells */
.cal-pts {
  font-family: var(--font-num); font-weight: 700; font-size: 11px;
  color: #fff; background: var(--go); border-radius: 999px; padding: 1px 5px; line-height: 1.4;
}

/* day editor: activities */
.cal-ed-pts { float: right; font-family: var(--font-num); font-weight: 700; font-size: 15px; color: var(--go); }
.cal-acts { display: flex; flex-direction: column; gap: 7px; margin-bottom: 12px; }
.cal-acts-empty { font-size: 13px; color: var(--faint); padding: 8px 0; }
.cal-act {
  display: flex; align-items: center; gap: 9px;
  background: var(--surface-2); border-radius: var(--radius-sm); padding: 8px 10px;
}
.cal-act-dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.cal-act-nm { flex: 1; min-width: 0; font-size: 14px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-act-pts { font-family: var(--font-num); font-weight: 700; font-size: 15px; color: var(--go); }
.cal-act-pts.warn { font-family: var(--font-body); font-size: 11px; font-weight: 600; color: var(--prep); }
.cal-act-rm { width: 26px; height: 26px; border: none; background: transparent; color: var(--faint); font-size: 17px; line-height: 1; cursor: pointer; border-radius: 6px; flex: none; }
.cal-act-rm:active { background: var(--line); }

/* day editor: add activity */
.cal-add { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 12px; }
.cal-add-sport { flex: 1 1 100%; height: 42px; border: 1px solid var(--line-2); border-radius: var(--radius-sm); background: var(--paper); color: var(--ink); font-size: 14px; padding: 0 10px; font-family: var(--font-body); }
.cal-add-km, .cal-add-other { flex: 1 1 90px; height: 42px; border: 1px solid var(--line-2); border-radius: var(--radius-sm); background: var(--paper); color: var(--ink); font-size: 14px; padding: 0 10px; }
.cal-add-preset { flex: 1 1 120px; height: 42px; border: 1px solid var(--line-2); border-radius: var(--radius-sm); background: var(--paper); color: var(--ink); font-size: 14px; padding: 0 8px; font-family: var(--font-body); }
.cal-add-btn { flex: 1 1 70px; height: 42px; }
.cal-add select:focus, .cal-add input:focus { outline: none; border-color: var(--go); }

/* let finish screen wrap 3 buttons */
.run-controls { flex-wrap: wrap; }
.run-controls .btn { min-width: 110px; }
