/* ============================================================
   Milo — styles
   Design tokens follow the validated reference palette
   (light + dark selected separately, not auto-flipped).
   ============================================================ */

:root {
  color-scheme: light;
  --page: #f9f9f7;
  --surface: #fcfcfb;
  --ink: #0b0b0b;
  --ink-2: #52514e;
  /* Darkened from #898781: that measured 3.5:1 on --surface, under WCAG AA
     for normal text. #6b6a65 gives ~5.2:1. (Dark mode already passes.) */
  --muted: #6b6a65;
  --grid: #e1e0d9;
  --axis: #c3c2b7;
  --border: rgba(11, 11, 11, 0.10);
  --accent: #2a78d6;
  --btn-ink: #ffffff;
  --good: #006300;
  --danger: #d03b3b;
  --overlay: rgba(20, 20, 18, 0.45);
  --shadow: 0 10px 30px rgba(11, 11, 11, 0.12);

  /* Area identity colors — categorical slots 1–6, fixed order */
  --c-pushup: #2a78d6;
  --c-squat: #1baf7a;
  --c-pullup: #eda100;
  --c-legraise: #008300;
  --c-bridge: #4a3aa7;
  --c-hspu: #e34948;
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --page: #0d0d0d;
    --surface: #1a1a19;
    --ink: #ffffff;
    --ink-2: #c3c2b7;
    --muted: #898781;
    --grid: #2c2c2a;
    --axis: #383835;
    --border: rgba(255, 255, 255, 0.10);
    --accent: #3987e5;
    --btn-ink: #0d0d0d;
    --good: #0ca30c;
    --danger: #e66767;
    --overlay: rgba(0, 0, 0, 0.55);
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.5);

    --c-pushup: #3987e5;
    --c-squat: #199e70;
    --c-pullup: #c98500;
    --c-legraise: #008300;
    --c-bridge: #9085e9;
    --c-hspu: #e66767;
  }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--page);
  color: var(--ink);
  line-height: 1.5;
  min-height: 100dvh;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

a { color: var(--accent); }

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

.wrap {
  max-width: 1020px;
  margin: 0 auto;
  padding: 16px 16px 48px;
}

header.app {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 2px 14px;
}

.title h1 {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 750;
  letter-spacing: -0.01em;
}

.title p {
  margin: 2px 0 0;
  font-size: 0.8rem;
  color: var(--muted);
}

.iconbtn {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  display: grid;
  place-items: center;
  font-size: 1.05rem;
  color: var(--ink-2);
}
/* Hover styles only on devices that truly hover — on touch screens iOS makes
   :hover stick to the last-tapped element, which reads as a bogus highlight. */
@media (hover: hover) {
  .iconbtn:hover { border-color: var(--axis); }
  .card:hover { border-color: var(--area, var(--axis)); }
  .rung:hover { border-color: var(--area, var(--axis)); }
  .chip:hover { border-color: var(--axis); }
  .btn:hover { border-color: var(--axis); }
  .btn.primary:hover { filter: brightness(1.06); }
  .sheet-head .close:hover { color: var(--ink); }
  #radar .axis-label:hover text { fill: var(--ink); }
}


/* ---------- Radar ---------- */

.radar-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 10px 8px 4px;
}

#radar { display: block; width: 100%; height: auto; }

/* Chart chrome never intercepts clicks — the wedges and dots below do. */
#radar .ring, #radar .spoke, #radar .ringnum, #radar .shape { pointer-events: none; }

#radar .ring { fill: none; stroke: var(--grid); stroke-width: 1; }
#radar .ring.major { stroke: var(--axis); }
#radar .spoke { stroke: var(--grid); stroke-width: 1; }
#radar .ringnum { fill: var(--muted); font-size: 8.5px; }

#radar .shape {
  fill: var(--ink);
  fill-opacity: 0.08;
  stroke: var(--ink);
  stroke-opacity: 0.55;
  stroke-width: 2;
  stroke-linejoin: round;
}

#radar .wedge { fill: transparent; cursor: pointer; outline-offset: -2px; }
/* Focus rings are for keyboard navigation — don't leave them behind after taps */
#radar .wedge:focus:not(:focus-visible),
#radar .dothit:focus:not(:focus-visible),
#radar .axis-label:focus:not(:focus-visible) { outline: none; }
@media (hover: hover) {
  #radar .wedge:hover { fill: var(--ink); fill-opacity: 0.04; }
}

#radar .dot { stroke: var(--surface); stroke-width: 2; pointer-events: none; }
#radar .dothit { fill: transparent; cursor: pointer; }

#radar .axis-label { cursor: pointer; }
#radar .axis-label text { fill: var(--ink-2); font-size: 11.5px; font-weight: 650; }
#radar .axis-label .stepnum { fill: var(--muted); font-size: 9.5px; font-weight: 500; }

.radar-hint {
  text-align: center;
  color: var(--muted);
  font-size: 0.78rem;
  margin: 0;
  padding: 0 12px 10px;
}

#tooltip {
  position: fixed;
  z-index: 60;
  pointer-events: none;
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow);
  padding: 7px 10px;
  font-size: 0.78rem;
  max-width: 240px;
  opacity: 0;
  transition: opacity 120ms;
}
#tooltip.show { opacity: 1; }
#tooltip .t-title { font-weight: 700; }
#tooltip .t-sub { color: var(--ink-2); }

/* ---------- Area cards ---------- */

.cards {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
@media (max-width: 480px) {
  .cards { grid-template-columns: 1fr; }
}

.card {
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 13px 14px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: border-color 120ms, transform 120ms;
}
.card:active { transform: scale(0.985); }

.card .head {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 0.92rem;
}

.swatch {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--area);
  flex: none;
}

.card .ready {
  margin-left: auto;
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--good);
  border: 1px solid currentColor;
  border-radius: 999px;
  padding: 2px 7px;
  white-space: nowrap;
}

.card .stepline { display: flex; align-items: baseline; gap: 7px; }
.card .stepline .n { font-size: 1.5rem; font-weight: 780; letter-spacing: -0.02em; }
.card .stepline .name {
  font-size: 0.84rem;
  color: var(--ink-2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card .std { font-size: 0.74rem; color: var(--muted); }

.track { display: flex; gap: 3px; }
.track span {
  flex: 1;
  height: 6px;
  border-radius: 3px;
  background: var(--grid);
  overflow: hidden;
  position: relative;
}
.track span i {
  position: absolute;
  inset: 0;
  background: var(--area);
  border-radius: 3px;
  transform-origin: left;
}

/* ---------- Sheet (area / step / settings) ---------- */

#scrim {
  position: fixed;
  inset: 0;
  background: var(--overlay);
  z-index: 40;
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms;
}
#scrim.show { opacity: 1; pointer-events: auto; }

#sheet {
  position: fixed;
  z-index: 50;
  inset: auto 0 0 0;
  top: max(5dvh, env(safe-area-inset-top));
  background: var(--page);
  border-radius: 20px 20px 0 0;
  box-shadow: var(--shadow);
  transform: translateY(100%);
  transition: transform 240ms cubic-bezier(0.2, 0.9, 0.3, 1);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
/* A closed (or closing) sheet must NEVER catch clicks meant for the page
   below it, and [hidden] must actually hide it despite the display:flex
   above (author rules beat the browser's [hidden] default). */
#sheet:not(.show) { pointer-events: none; }
#sheet[hidden] { display: none !important; }
#sheet.show { transform: translateY(0); }

@media (min-width: 700px) {
  #sheet {
    inset: 0;
    margin: auto;
    max-width: 620px;
    height: min(760px, 88dvh);
    border-radius: 20px;
    transform: translateY(14px);
    opacity: 0;
    transition: transform 200ms, opacity 200ms;
  }
  #sheet.show { transform: none; opacity: 1; }
}

.sheet-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px 10px;
  border-bottom: 1px solid var(--border);
  background: var(--page);
}

.sheet-head .back { color: var(--accent); font-weight: 650; font-size: 0.9rem; padding: 4px 6px 4px 0; }
.sheet-head .headings { flex: 1; min-width: 0; }
.sheet-head h2 {
  margin: 0;
  font-size: 1.05rem;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 8px;
  min-width: 0;
}
.sheet-head .sub { margin: 1px 0 0; font-size: 0.76rem; color: var(--muted); }
.sheet-head .close { color: var(--muted); font-size: 1.25rem; padding: 6px; line-height: 1; }

.sheet-body {
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: 14px 16px calc(24px + env(safe-area-inset-bottom));
}

/* Ladder */

.ladder { display: flex; flex-direction: column; gap: 8px; }

.rung {
  display: grid;
  grid-template-columns: 34px 1fr auto;
  align-items: center;
  gap: 11px;
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 10px 12px;
}
.rung .num {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 2px solid var(--axis);
  color: var(--muted);
  display: grid;
  place-items: center;
  font-size: 0.82rem;
  font-weight: 700;
}
.rung.current { border-color: var(--area); box-shadow: inset 0 0 0 1px var(--area); }
.rung.current .num { border-color: var(--area); color: var(--area); }
.rung.done .num { background: var(--area); border-color: var(--area); color: var(--surface); }

.rung .info { min-width: 0; }
.rung .info .nm { font-weight: 700; font-size: 0.9rem; display: flex; gap: 6px; align-items: center; }
.rung .info .tg { font-size: 0.74rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rung .chev { color: var(--muted); font-size: 1rem; }

.tag {
  font-size: 0.62rem;
  font-weight: 750;
  letter-spacing: 0.04em;
  border-radius: 6px;
  padding: 1.5px 6px;
  white-space: nowrap;
}
.tag.cur { background: var(--area); color: var(--surface); }
.tag.master { border: 1px solid var(--area); color: var(--area); }

/* Step detail */

.detail h3 {
  margin: 2px 0 2px;
  font-size: 1.3rem;
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
}

.detail .why { color: var(--ink-2); font-size: 0.88rem; margin: 6px 0 0; }

.sheet-body h4 {
  margin: 22px 0 8px;
  font-size: 0.72rem;
  font-weight: 750;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.sheet-body h4:first-child { margin-top: 4px; }

.howlist { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 7px; font-size: 0.9rem; }
.howlist li::marker { color: var(--area); font-weight: 700; }

.stdtable { display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.stdrow {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 12px;
  font-size: 0.86rem;
  background: var(--surface);
}
.stdrow + .stdrow { border-top: 1px solid var(--border); }
.stdrow .lb { color: var(--ink-2); display: flex; align-items: center; gap: 7px; }
.stdrow .met { color: var(--good); font-weight: 700; }
.stdrow strong { font-weight: 650; }

.hintbox {
  background: var(--surface);
  border: 1px dashed var(--axis);
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 0.85rem;
  color: var(--ink-2);
}

/* Progress chips */

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  border: 1.5px solid var(--border);
  background: var(--surface);
  border-radius: 999px;
  padding: 7px 13px;
  font-size: 0.82rem;
  font-weight: 650;
  color: var(--ink-2);
}
.chip.sel {
  border-color: var(--area);
  color: var(--ink);
  background: rgba(127, 127, 127, 0.12);
  background: color-mix(in srgb, var(--area) 16%, var(--surface));
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 12px;
  padding: 11px 16px;
  font-weight: 700;
  font-size: 0.9rem;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink);
}
.btn.primary { background: var(--area, var(--accent)); border-color: transparent; color: var(--btn-ink); }
.btn.danger { color: var(--danger); border-color: currentColor; }
.btn.wide { width: 100%; }

.advance {
  margin-top: 12px;
  border: 1.5px solid var(--good);
  background: var(--surface);
  color: var(--ink);
  border-radius: 14px;
  padding: 12px 14px;
  font-size: 0.88rem;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.advance b { color: var(--good); }

.videolink { display: inline-flex; align-items: center; gap: 8px; font-weight: 650; font-size: 0.88rem; }

.completed-note { color: var(--good); font-weight: 650; font-size: 0.85rem; display: flex; gap: 7px; align-items: center; }

/* Settings */

.settings p { font-size: 0.88rem; color: var(--ink-2); margin: 6px 0; }
.settings .hint { font-size: 0.8rem; color: var(--muted); }

/* Something is wrong with saving — has to read as a warning, not as body copy. */
.settings .warn {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--danger);
  border-radius: 10px;
  padding: 10px 12px;
  color: var(--ink);
}

/* Rarely-needed and destructive bits, collapsed by default. */
.settings details { margin-top: 20px; border-top: 1px solid var(--border); }
.settings summary {
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 12px 2px 4px;
  font-size: 0.82rem;
  font-weight: 650;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  list-style: none;
}
.settings summary::-webkit-details-marker { display: none; }
.settings summary::before {
  content: "\25B8";
  display: inline-block;
  transition: transform 0.15s ease;
}
.settings details[open] summary::before { transform: rotate(90deg); }
.settings summary:hover { color: var(--ink-2); }
.settings .more-body { padding-bottom: 4px; }
.settings h5 {
  margin: 18px 0 0;
  font-size: 0.88rem;
  font-weight: 650;
  color: var(--ink);
}
.copyrow { display: flex; gap: 8px; margin-top: 8px; }
.copyrow input {
  flex: 1;
  min-width: 0;
  font: inherit;
  font-size: 0.78rem;
  color: var(--ink-2);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 9px 11px;
}
/* iOS zooms the page when focusing inputs smaller than 16px — avoid that on touch */
@media (hover: none) {
  .copyrow input { font-size: 16px; }
}

/* Toast */

#toast {
  position: fixed;
  left: 50%;
  bottom: calc(22px + env(safe-area-inset-bottom));
  transform: translateX(-50%) translateY(16px);
  background: var(--ink);
  color: var(--page);
  border-radius: 999px;
  padding: 9px 16px;
  font-size: 0.84rem;
  font-weight: 650;
  z-index: 70;
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms, transform 180ms;
  max-width: 88vw;
  text-align: center;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }


@media (prefers-reduced-motion: reduce) {
  #sheet, #scrim, #toast, .card, .track span i { transition: none !important; }
}

/* ============================================================
   Tier 1: training log, history, rest timer
   ============================================================ */

.header-actions { display: flex; gap: 8px; }

/* --- Log-training section inside the step detail --- */
.recent { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.recent-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 0.82rem;
  padding: 8px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
}
.recent-row .rdate { color: var(--muted); }
.recent-row .rsets { color: var(--ink-2); font-weight: 600; }
.muted-note { color: var(--muted); font-size: 0.82rem; margin: 10px 0 0; }

/* --- Log pane --- */
.logpane .goalref {
  font-size: 0.8rem;
  color: var(--ink-2);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 9px 12px;
  margin: 2px 0 0;
}
.setlist { display: flex; flex-direction: column; gap: 8px; }
.setrow {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 8px 10px 8px 14px;
}
.setrow .setlabel { font-size: 0.82rem; font-weight: 650; color: var(--ink-2); min-width: 46px; }
.setrow .setinput {
  flex: 1;
  min-width: 0;
  font: inherit;
  font-size: 1.05rem;
  font-weight: 700;
  text-align: center;
  color: var(--ink);
  background: var(--page);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 8px 6px;
}
.setrow .setinput:focus { outline: 2px solid var(--area, var(--accent)); outline-offset: -1px; border-color: transparent; }
.setrow .setunit { font-size: 0.78rem; color: var(--muted); min-width: 42px; }
.setrow .removeSet {
  width: 30px; height: 30px;
  border-radius: 8px;
  color: var(--muted);
  font-size: 0.9rem;
  flex: none;
  border: 1px solid transparent;
}
.setrow .removeSet:active { background: var(--grid); }
.btn.addset { margin-top: 10px; width: 100%; border-style: dashed; color: var(--ink-2); }

.restrow { display: flex; flex-wrap: wrap; gap: 8px; }
.restpreset {
  flex: 1;
  min-width: 62px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  border-radius: 999px;
  padding: 9px 8px;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--ink-2);
  font-variant-numeric: tabular-nums;
}
.restpreset:active { border-color: var(--area, var(--accent)); color: var(--ink); }

.lognote {
  width: 100%;
  font: inherit;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 12px;
  resize: vertical;
}
.lognote:focus { outline: 2px solid var(--area, var(--accent)); outline-offset: -1px; }

/* Bigger inputs on touch screens so iOS doesn't zoom on focus */
@media (hover: none) {
  .setrow .setinput, .lognote { font-size: 16px; }
}

/* --- Backup buttons in settings --- */
.btnrow { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.btnrow .btn { flex: 1; min-width: 150px; }

/* --- History pane --- */
.history .empty { color: var(--muted); text-align: center; font-size: 0.9rem; padding: 30px 10px; line-height: 1.7; }
.hgroup { margin-bottom: 18px; }
.hdate {
  font-size: 0.72rem;
  font-weight: 750;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 2px 8px;
}
.hitem {
  display: flex;
  align-items: center;
  gap: 11px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 10px 10px 12px;
}
.hitem + .hitem { margin-top: 8px; }
.hitem .hswatch { width: 10px; height: 10px; border-radius: 50%; background: var(--area); flex: none; }
.hitem .hinfo { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.hitem .hname { font-weight: 700; font-size: 0.9rem; }
.hitem .hsets { font-size: 0.78rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; }

/* --- Floating rest-timer pill --- */
#restpill {
  position: fixed;
  left: 50%;
  /* Sit clear of both the toast (bottom 22px) and any bottom Save button. */
  bottom: calc(84px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 65;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  /* Theme-aware, high contrast in both modes (like the toast). */
  background: var(--ink);
  color: var(--page);
  border-radius: 999px;
  padding: 4px;
  font-size: 0.95rem;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
  box-shadow: var(--shadow);
}
#restpill[hidden] { display: none !important; }
#restpill button { color: inherit; font: inherit; min-height: 40px; border-radius: 999px; white-space: nowrap; }
/* Centred like the toast (left: 50% capped its width at half the screen,
   so opening +30 s / Skip wrapped it). With a sheet open it docks just
   above the sheet's footer, clear of the set rows, and the toast goes above it. */
#restpill { left: 16px; right: 16px; margin: 0 auto; width: fit-content; transform: none; }
body.sheet-open #restpill { bottom: calc(var(--bottom-chrome) + 10px); }
body.sheet-open.pill-on #toast { bottom: calc(var(--bottom-chrome) + 72px); }
#restMain { padding: 0 16px; }
.restmenu { display: inline-flex; gap: 4px; }
.restmenu[hidden] { display: none; }
.restmenu button { padding: 0 14px; background: rgba(127, 127, 127, 0.28); font-weight: 700; }
#restpill.done { background: var(--good); color: var(--page); animation: restdone 0.9s ease-out 3; }
/* The end of a rest has to be seen from a bench: phones give web apps no
   vibration, and the beep is muted on silent. */
@keyframes restdone {
  0%   { box-shadow: 0 0 0 0 var(--good); transform: scale(1); }
  35%  { transform: scale(1.12); }
  100% { box-shadow: 0 0 0 26px transparent; transform: scale(1); }
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  border: 0;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  overflow: hidden;
  white-space: nowrap;
}

@media (prefers-reduced-motion: reduce) {
  #restpill { transition: none !important; }
  #restpill.done { animation: none; }
}

/* ============================================================
   Tier 2: Today card, routine, ghost radar, stats, sparkline
   ============================================================ */

/* --- Today card + nudge --- */
.today-card {
  display: block;
  width: 100%;
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 14px;
}
.today-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 10px; }
.today-title { font-weight: 750; font-size: 1rem; }
.today-sub { display: block; font-size: 0.82rem; color: var(--muted); margin-top: 3px; }
button.today-card.setup { cursor: pointer; }
button.today-card.setup .today-title { color: var(--accent); }

.td-moves { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.td-move {
  display: flex;
  align-items: center;
  gap: 11px;
  text-align: left;
  background: var(--page);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 9px 11px;
}
.td-move .tdcheck {
  width: 24px; height: 24px;
  border-radius: 50%;
  border: 2px solid var(--axis);
  color: var(--surface);
  display: grid; place-items: center;
  font-size: 0.8rem; font-weight: 700;
  flex: none;
}
.td-move.done .tdcheck { background: var(--area); border-color: var(--area); }
.td-move .tdinfo { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.td-move .tdname { font-weight: 700; font-size: 0.9rem; }
.td-move .tdstep { font-size: 0.76rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.td-move .chev { color: var(--muted); font-size: 1rem; }
.td-move.done .tdname { color: var(--ink-2); }

.nudge {
  margin-top: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 10px;
  padding: 9px 12px;
  font-size: 0.85rem;
  color: var(--ink-2);
}

/* --- Ghost radar --- */
#radar .ghost {
  fill: var(--area, var(--ink));
  fill-opacity: 0.05;
  stroke: var(--ink-2);
  stroke-opacity: 0.5;
  stroke-width: 1.5;
  stroke-dasharray: 4 3;
  stroke-linejoin: round;
  pointer-events: none;
}
.radar-ctrl { text-align: center; padding: 2px 0 0; }
.ghostbtn {
  font-size: 0.76rem;
  font-weight: 650;
  color: var(--ink-2);
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 999px;
  padding: 5px 12px;
}
.ghostbtn[aria-pressed="true"] { border-color: var(--axis); color: var(--ink); }
.ghostbtn[hidden] { display: none; }
/* Set-but-nothing-to-show-yet: readable, clearly not a button to press. */
.ghostbtn:disabled { color: var(--muted); border-style: dashed; cursor: default; }

/* --- Sparkline (step detail) --- */
.sparkwrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 12px 6px;
  margin-top: 10px;
}
.sparklabel { font-size: 0.72rem; color: var(--muted); font-weight: 650; text-transform: uppercase; letter-spacing: 0.05em; }
.spark { display: block; margin-top: 4px; overflow: visible; }
.spark polyline { fill: none; stroke: var(--area, var(--accent)); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.spark circle { fill: var(--area, var(--accent)); }
.spark .spark-lbl { fill: var(--muted); font-size: 9px; font-weight: 650; }

/* --- Routine preview (settings) --- */
.routine-preview {
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  margin-top: 4px;
}
.rp-row { display: flex; gap: 12px; padding: 9px 12px; font-size: 0.85rem; background: var(--surface); }
.rp-row + .rp-row { border-top: 1px solid var(--border); }
.rp-row .rp-day { font-weight: 700; color: var(--ink-2); min-width: 48px; flex: none; }
.rp-row .rp-moves { color: var(--ink); }

/* --- History: make session rows editable --- */
.hopen {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 11px;
  text-align: left;
}

/* --- QR code --- */
.qrbox { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.qrbox:empty { display: none; }
.qrbox canvas {
  width: 220px;
  height: 220px;
  max-width: 100%;
  image-rendering: pixelated;
  border-radius: 8px;
  background: #fff;
  padding: 6px;
  margin-top: 8px;
}
.qrcap { font-size: 0.78rem; color: var(--muted); text-align: center; margin: 0; }

/* ==========================================================
   The plan: today's prescription, the guided session,
   the week map, and the exercise library.
   ========================================================== */

/* --- Today's card additions --- */
.td-move .tdready {
  display: block;
  font-size: 0.72rem;
  font-weight: 650;
  color: var(--area);
  margin-top: 2px;
}
.today-links {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 8px 10px;
}
.tdlink {
  flex: 1;
  font: inherit;
  font-size: 0.8rem;
  font-weight: 650;
  color: var(--ink-2);
  background: none;
  border: 0;
  padding: 4px 2px;
  text-align: center;
  cursor: pointer;
}
.tdlink:hover { color: var(--ink); }

/* --- Guided session --- */
.sdots { display: flex; align-items: center; gap: 6px; margin-bottom: 12px; }
.sdot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  border: 1.5px solid var(--axis);
}
.sdot.done { background: var(--area); border-color: var(--area); }
.sdot.now { box-shadow: 0 0 0 3px var(--grid); border-color: var(--area); }
.scount { margin-left: auto; font-size: 0.74rem; color: var(--muted); font-weight: 650; }

/* The one line that says what to do — deliberately the loudest thing here. */
.rx {
  display: flex;
  flex-direction: column;
  gap: 3px;
  background: var(--surface);
  border: 1px solid var(--area);
  border-radius: 14px;
  padding: 14px 16px;
  margin-bottom: 14px;
}
.rxlabel {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.rxbig { font-size: 1.5rem; font-weight: 750; color: var(--ink); line-height: 1.15; }
.rxgoal { font-size: 0.8rem; color: var(--ink-2); }

.session .cues { margin: 4px 0 0; padding-left: 20px; }
.session .cues li { font-size: 0.86rem; color: var(--ink-2); margin: 4px 0; }
.session .hint, .sheet-body .hint { font-size: 0.8rem; color: var(--muted); }
.sactions { margin-top: 18px; display: flex; flex-direction: column; gap: 8px; }

/* Swap options */
.swaps { margin-top: 16px; border-top: 1px solid var(--border); padding-top: 8px; }
.swaps summary {
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 650;
  color: var(--ink-2);
  padding: 4px 0;
  list-style: none;
}
.swaps summary::-webkit-details-marker { display: none; }
.swaps summary::before { content: "\25B8"; display: inline-block; margin-right: 7px; }
.swaps[open] summary::before { content: "\25BE"; }
.swap {
  display: flex;
  flex-direction: column;
  gap: 3px;
  width: 100%;
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 12px;
  margin-top: 8px;
  cursor: pointer;
}
.swapname { font-weight: 700; font-size: 0.88rem; color: var(--ink); display: flex; align-items: center; gap: 7px; }
.swapwhy { font-size: 0.78rem; color: var(--muted); line-height: 1.4; }
.swaptag {
  font-size: 0.6rem;
  font-weight: 750;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border-radius: 6px;
  padding: 1.5px 6px;
  border: 1px solid currentColor;
  white-space: nowrap;
}
.swaptag.easier { color: var(--muted); }
.swaptag.same { color: var(--ink-2); }
.swaptag.harder { color: var(--danger); }

/* Session complete */
.bigdone { font-size: 2.6rem; text-align: center; margin: 6px 0 2px; }
.donelist { display: flex; flex-direction: column; gap: 8px; margin: 10px 0; }
.donerow {
  display: grid;
  grid-template-columns: 26px 1fr;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 12px;
}
.doneicon {
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--area);
  color: var(--surface);
  display: grid; place-items: center;
  font-size: 0.72rem; font-weight: 800;
}
.doneinfo { min-width: 0; display: flex; flex-direction: column; }
.donename { font-weight: 700; font-size: 0.88rem; }
.donesets { font-size: 0.74rem; color: var(--muted); }

/* --- The week --- */
.wkdays { display: flex; flex-direction: column; gap: 10px; margin: 10px 0 4px; }
.wkday {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 10px 12px;
}
.wkday.now { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.wkhead { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.wkdaylabel { font-weight: 750; font-size: 0.84rem; }
.wknow {
  font-size: 0.6rem; font-weight: 750; letter-spacing: 0.05em; text-transform: uppercase;
  background: var(--accent); color: var(--btn-ink); border-radius: 6px; padding: 1.5px 6px;
}
.wkmove { display: grid; grid-template-columns: 10px 1fr auto; align-items: center; gap: 8px; padding: 3px 0; }
.wkdot { width: 8px; height: 8px; border-radius: 50%; background: var(--area); }
.wkname { font-size: 0.84rem; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wkrx { font-size: 0.76rem; color: var(--muted); white-space: nowrap; }

.mapgrid { display: flex; flex-direction: column; gap: 10px; }
.mapcard {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--area);
  border-radius: 12px;
  padding: 10px 12px;
}
.maphead { font-weight: 750; font-size: 0.9rem; }
.mapnow { font-size: 0.8rem; color: var(--ink-2); margin-top: 2px; }
.mapneed { font-size: 0.8rem; color: var(--muted); margin-top: 4px; }
.maplabel {
  font-size: 0.62rem; font-weight: 750; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--muted); margin-top: 8px;
}
.mapahead { margin: 2px 0 0; padding-left: 18px; }
.mapahead li { font-size: 0.78rem; color: var(--ink-2); margin: 2px 0; }

/* --- Library --- */
.librows { display: flex; flex-direction: column; gap: 10px; margin-top: 10px; }
.librow {
  display: grid;
  grid-template-columns: 34px 1fr auto;
  align-items: center;
  gap: 11px;
  width: 100%;
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--area);
  border-radius: 14px;
  padding: 11px 12px;
  cursor: pointer;
}
.libicon { font-size: 1.3rem; }
.libinfo { min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.libname { font-weight: 750; font-size: 0.94rem; }
.libsub { font-size: 0.76rem; color: var(--muted); }
.libwhere { font-size: 0.76rem; color: var(--area); font-weight: 650; margin-top: 2px; }

/* --- Ladder rows now carry the description and all three goals --- */
.rung .info .tg { white-space: normal; overflow: visible; line-height: 1.35; margin-top: 2px; }
.rung .info .goals { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 6px; }
.goalpill {
  font-size: 0.7rem;
  color: var(--ink-2);
  background: var(--grid);
  border-radius: 6px;
  padding: 2px 7px;
  white-space: nowrap;
}
.goalpill b { color: var(--area); }
.rung .info .tgnote { font-size: 0.7rem; color: var(--muted); margin-top: 4px; display: block; }
.rung { align-items: start; }
.rung .num, .rung .chev { margin-top: 2px; }

/* --- Variations listed under a ladder --- */
.varlist { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.varcard {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 12px;
}
.varname { font-weight: 700; font-size: 0.86rem; display: flex; align-items: center; gap: 7px; }
.varwhy { font-size: 0.78rem; color: var(--muted); line-height: 1.4; margin-top: 3px; }

/* --- Variation picker in the log form --- */
h4.tight { margin-bottom: 2px; }
.vnote { font-size: 0.78rem; color: var(--muted); line-height: 1.4; margin-top: 6px; }

.settings .buildline { margin-top: 18px; font-variant-numeric: tabular-nums; }

/* Conditions that stop the app saving (e.g. newer data on this device). */
.banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 14px;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--danger);
  border-radius: 12px;
  font-size: 0.85rem;
  color: var(--ink);
}
.banner[hidden] { display: none; }
.banner .btn { flex: none; }

/* ==========================================================
   Milo: this week's muscle groups (home), the quick gym log
   ========================================================== */

/* Group colours: the six slots of the Skills radar (chest where push-ups
   are, back where pull-ups are…), so the Body radar can reuse them. Plain
   aliases, so dark mode follows the --c-* values by itself. */
:root {
  --g-chest: var(--c-pushup);
  --g-back: var(--c-pullup);
  --g-abs: var(--c-legraise);
  --g-legs: var(--c-squat);
  --g-arms: var(--c-bridge);
  --g-shoulders: var(--c-hspu);
}

/* --- The ⓘ buttons --- */
.infobtn {
  width: 32px;
  height: 32px;
  margin: -6px 0;
  display: inline-grid;
  place-items: center;
  border-radius: 50%;
  color: var(--muted);
  font-size: 1.05rem;
  font-weight: 400;
}

/* --- "How the week is counted" --- */
.volinfo p { font-size: 0.88rem; color: var(--ink-2); margin: 6px 0; }
.volinfo .stdtable { margin: 8px 0 4px; }

/* --- Quick gym log sheet --- */
/* The body fills the sheet and scrolls; Save stays in view below it. */
.sheet-body.quickpane { flex: 1 1 auto; padding-bottom: 20px; }
.sheet-foot {
  flex: none;
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--border);
  background: var(--page);
}

.qdate {
  display: block;
  width: 100%;
  min-height: 44px;
  margin-top: 10px;
  font: inherit;
  font-size: 0.95rem;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 12px;
  -webkit-appearance: none;
  appearance: none;
}
.qdate::-webkit-date-and-time-value { text-align: left; }
.qdate:focus { outline: 2px solid var(--accent); outline-offset: -1px; }

.sheet-body .qhint { margin: -2px 0 10px; }
.sheet-body .qsum { margin: 10px 2px 0; }

.qgroups { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.qrow {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 56px;
  padding: 5px 6px 5px 5px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 12px;
}
.qrow.on {
  border-color: var(--area);
  background: rgba(127, 127, 127, 0.08);
  background: color-mix(in srgb, var(--area) 9%, var(--surface));
}
.qtoggle {
  flex: 1;
  min-width: 0;
  align-self: stretch;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 0 8px;
  border-radius: 9px;
  text-align: left;
}
.qcheck {
  width: 24px;
  height: 24px;
  flex: none;
  border-radius: 50%;
  border: 2px solid var(--axis);
  color: var(--surface);
  display: grid;
  place-items: center;
  font-size: 0.8rem;
  font-weight: 700;
}
.qrow.on .qcheck { background: var(--area); border-color: var(--area); }
.qname { font-weight: 700; font-size: 0.92rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.stepper { display: flex; align-items: center; gap: 4px; flex: none; }
.stepper[hidden] { display: none; }
.stepbtn {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--page);
  color: var(--ink);
  font-size: 1.2rem;
  font-weight: 700;
}
.stepbtn:active { background: var(--grid); }
.stepbtn[aria-disabled="true"] { color: var(--muted); opacity: 0.45; cursor: default; }
.stepval {
  width: 46px;
  font: inherit;
  font-size: 1.05rem;
  font-weight: 750;
  text-align: center;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  background: var(--page);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 7px 2px;
  -moz-appearance: textfield;
  appearance: textfield;
}
.stepval::-webkit-outer-spin-button,
.stepval::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.stepval:focus { outline: 2px solid var(--area); outline-offset: -1px; border-color: transparent; }

.qdel { margin-top: 26px; }

/* Save stays visible but reads as unavailable until a group is picked.
   Scoped: a global .btn:disabled would also dim Settings' "Sync now"
   while a sync runs, a visible change this release doesn't intend. */
.sheet-foot .btn:disabled { opacity: 0.45; cursor: default; filter: none; }

@media (hover: hover) {
  .infobtn:hover { color: var(--ink); }
  .qtoggle:hover .qcheck { border-color: var(--area); }
  .stepbtn:not([aria-disabled="true"]):hover { border-color: var(--axis); }
  .sheet-foot .btn:disabled:hover { filter: none; }
}

/* iOS zooms into inputs under 16px — keep these at 16px on touch screens. */
@media (hover: none) {
  .stepval, .qdate { font-size: 16px; }
}

/* ==========================================================
   Milo: the four tabs (Today · Body · Skills · History)
   ========================================================== */

/* --bottom-chrome: the height of whatever is fixed along the bottom of the
   screen right now — the tab bar, or an open sheet's footer (app.js
   measures the footer and sets it on <body>). The toast and the rest pill
   sit above it, so nothing covers them. */
:root {
  --tabbar-h: 58px;
  --bottom-chrome: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
}
body.sheet-open { --bottom-chrome: env(safe-area-inset-bottom); }

.wrap.shell { padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 28px); }
body.pill-on .wrap.shell { padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 96px); }
.tabpane { max-width: 640px; margin: 0 auto; }
.tabpane.wide { max-width: none; }
.tabpane[hidden] { display: none; }
.tabpane .stack > * + * { margin-top: 12px; }
.tabpane .stack > :first-child { margin-top: 0; }
.tabpane .stack > :empty { display: none; }

/* Centred without the old left: 50% (which capped its width at half the
   screen and wrapped the Undo toast onto three lines on a phone). */
#toast {
  bottom: calc(var(--bottom-chrome) + 12px);
  left: 16px;
  right: 16px;
  margin: 0 auto;
  width: fit-content;
  max-width: 88vw;
  transform: translateY(16px);
}
#toast.show { transform: none; }
#toast.act { pointer-events: auto; display: flex; align-items: center; gap: 12px; padding: 4px 6px 4px 16px; }
.toast-act { min-height: 40px; padding: 0 12px; border-radius: 999px; color: var(--page); font-weight: 800; text-decoration: underline; text-underline-offset: 3px; }
#restpill { bottom: calc(var(--bottom-chrome) + 62px); }

.today-card[hidden] { display: none; }
.ico { margin-right: 0.45em; }

/* ---------- Header: "Milo" small; the tab (or today's date) as the title ---------- */
header.app.shellhead { padding: 2px 2px 12px; align-items: flex-end; }
.title .brand {
  margin: 0;
  font-size: 0.7rem;
  font-weight: 750;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}
.title h1 { line-height: 1.25; }
.d-short { display: none; }
@media (max-width: 359px) {
  .d-long { display: none; }
  .d-short { display: inline; }
}
.gear { position: relative; }

/* The sync mark on the gear: a small green dot when synced, a hollow grey
   ring when offline, a red badge with "!" when sync needs you, nothing
   when sync is off. Shape as well as colour. */
.syncdot {
  position: absolute;
  top: 5px;
  right: 5px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  box-shadow: 0 0 0 2px var(--surface);
}
.syncdot.ok { background: var(--good); }
.syncdot.busy { background: var(--muted); }
.syncdot.offline { width: 10px; height: 10px; top: 4px; right: 4px; background: var(--surface); border: 2px solid var(--muted); }
.syncdot.failed {
  width: 17px;
  height: 17px;
  top: -6px;
  right: -6px;
  background: var(--danger);
  color: var(--surface);
  font: 800 12px/17px system-ui, -apple-system, sans-serif;
  text-align: center;
}
.syncdot.failed::after { content: "!"; }
.syncdot.none { display: none; }
.syncdot.inline { position: static; flex: none; box-shadow: none; display: inline-block; }

/* ---------- Tab bar: Today · Body · ＋ Log · Skills · History ---------- */
.tabbar {
  position: fixed;
  z-index: 30;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  justify-content: center;
  padding: 0 env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  background: var(--surface);
  border-top: 1px solid var(--border);
}
.tabbar-inner { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); width: 100%; max-width: 560px; height: var(--tabbar-h); }
.tab {
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 650;
}
.tab .ti {
  width: 52px;
  height: 30px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  transition: background-color 150ms;
}
.tab svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.tab[aria-current="page"] { color: var(--ink); font-weight: 750; }
.tab[aria-current="page"] .ti {
  color: var(--accent);
  background: rgba(42, 120, 214, 0.14);
  background: color-mix(in srgb, var(--accent) 16%, transparent);
}
/* The one action in the bar: a filled circle, so it never reads as a selected tab. */
.logtab { color: var(--ink-2); }
.logtab .fab {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--btn-ink);
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
  margin-top: -6px;
}
.tab:focus-visible { outline: 2px solid var(--accent); outline-offset: -4px; border-radius: 12px; }
.tab:focus:not(:focus-visible) { outline: none; }

/* ---------- The target bar ----------
   Grey track; the target as a band tinted with the group's colour and two
   dark ticks at its ends; the sets in the group's colour; a small ▴ under
   the bar where an even pace would be by today. */
.tb { position: relative; display: block; height: 8px; margin: 4px 0 8px; }
.tb-track { position: absolute; inset: 0; border-radius: 4px; background: var(--grid); }
.tb-band {
  position: absolute;
  top: 0;
  bottom: 0;
  background: rgba(127, 127, 127, 0.22);
  background: color-mix(in srgb, var(--area) 30%, var(--grid));
}
.tb-fill { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 4px; background: var(--area); }
.tb-tick { position: absolute; top: -3px; bottom: -3px; width: 2px; margin-left: -1px; border-radius: 1px; background: var(--ink-2); }
.tb-pace {
  position: absolute;
  top: calc(100% + 2px);
  width: 0;
  height: 0;
  margin-left: -4px;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-bottom: 5px solid var(--ink);
}
.tb-legend { display: flex; flex-wrap: wrap; gap: 4px 14px; margin: 8px 2px 0; font-size: 0.72rem; color: var(--muted); }
.tb-legend span { display: inline-flex; align-items: center; gap: 6px; }
.lg-tband { width: 16px; height: 8px; border-radius: 2px; background: rgba(127, 127, 127, 0.3); border-left: 2px solid var(--ink-2); border-right: 2px solid var(--ink-2); }
.lg-pace { width: 0; height: 0; border-left: 4px solid transparent; border-right: 4px solid transparent; border-bottom: 5px solid var(--ink); }

/* ---------- Day dots in six fixed slots (3 × 2): a dot's place says which group ---------- */
.slots {
  display: grid;
  grid-template-columns: repeat(3, 7px);
  grid-auto-rows: 7px;
  gap: 2px;
  margin-top: 3px;
}
.slots i { width: 7px; height: 7px; border-radius: 50%; border: 1px solid var(--grid); }
.slots i.on {
  background: var(--area);
  border-color: rgba(0, 0, 0, 0.3);
  border-color: color-mix(in srgb, var(--ink) 35%, var(--area));
}
/* Two levels. Solid: trained directly that day. `helped`: the group only got
   its sets by helping other exercises — a ring with a faint tint, so the two
   differ in shape, not just in how strong the colour is. */
.slots i.on.helped {
  background: transparent;
  background: color-mix(in srgb, var(--area) 16%, transparent);
  border-color: var(--area);
  border-color: color-mix(in srgb, var(--ink) 35%, var(--area));
}
.slot-lv { display: flex; flex-wrap: wrap; gap: 2px 14px; margin: 4px 2px 0; font-size: 0.72rem; color: var(--ink-2); line-height: 1.35; }
.slot-lv span { display: inline-flex; align-items: center; gap: 6px; }
.slot-lv i { width: 7px; height: 7px; border-radius: 50%; flex: none; background: var(--ink-2); border: 1px solid var(--ink-2); }
.slot-lv i.helped { background: transparent; }
.slot-key { display: flex; align-items: center; gap: 8px; margin: 6px 2px 0; font-size: 0.72rem; color: var(--ink-2); line-height: 1.35; }
.slot-key .slots { margin: 0; flex: none; }
.sk-rows { display: flex; flex-direction: column; }

/* ---------- Today ---------- */
.gnudge {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  width: 100%;
  margin: 0;
  text-align: left;
  border-left-color: var(--area);
  font-size: 0.88rem;
  line-height: 1.45;
}
.gnudge .swatch { margin-top: 5px; }
.gnudge b { color: var(--ink); }
.gnudge .nd-text { flex: 1; min-width: 0; }
button.gnudge { min-height: 44px; align-items: center; }
button.gnudge .chev { color: var(--muted); font-size: 1rem; }

.session .today-head { align-items: center; margin-bottom: 0; }
.session .today-title { margin: 0; }
.ses-sub { margin: 0 0 10px; }
.linkbtn {
  display: block;
  min-height: 40px;
  margin: 4px auto -6px;
  padding: 0 12px;
  font-size: 0.82rem;
  font-weight: 650;
  color: var(--muted);
}
.skip { text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--axis); }

.wnline { display: flex; align-items: center; gap: 2px; padding: 2px 4px 2px 12px; border-left: 3px solid var(--accent); }
.wn-open { flex: 1; min-width: 0; min-height: 44px; display: flex; align-items: center; gap: 4px; text-align: left; font-size: 0.88rem; color: var(--ink-2); }
.wn-open b { color: var(--ink); }
.wn-open .wn-text { flex: 1; min-width: 0; }
.wn-open .chev { color: var(--muted); font-size: 1rem; }
.nc-x { width: 40px; height: 40px; flex: none; color: var(--muted); font-size: 1rem; border-radius: 10px; }
.nc-list { margin: 6px 0 4px; padding-left: 18px; display: grid; gap: 5px; font-size: 0.88rem; color: var(--ink-2); line-height: 1.45; }
.nc-list b { color: var(--ink); }

.wk-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.wk-head .today-title { margin: 0; line-height: 1.3; }
.ws-link {
  flex: none;
  min-height: 40px;
  margin: -8px -6px -8px 0;
  padding: 0 8px;
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--accent);
}
.ws-days {
  list-style: none;
  margin: 0 -4px;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
}
.ws-day {
  width: 100%;
  min-height: 64px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  padding: 5px 0 6px;
  border-radius: 12px;
  border: 1.5px solid transparent;
}
button.ws-day:active { background: var(--grid); }
.ws-wd { font-size: 0.66rem; font-weight: 700; color: var(--muted); letter-spacing: 0.04em; }
.ws-n { font-size: 0.95rem; font-weight: 750; font-variant-numeric: tabular-nums; line-height: 1.3; }
.ws-day.today { border-color: var(--accent); }
.ws-day.today .ws-wd { color: var(--accent); }
.ws-day.future .ws-n { color: var(--muted); font-weight: 550; }
.ws-day.future .slots { visibility: hidden; }

.wk-sub { margin: 14px 2px 8px; padding-top: 12px; border-top: 1px solid var(--border); font-size: 0.8rem; font-weight: 700; color: var(--ink-2); }
.tr-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.tr { display: grid; grid-template-columns: 5.8rem minmax(0, 1fr) max-content; align-items: center; column-gap: 10px; min-height: 26px; }
.tr .tb { margin: 0; }
.tr-name { display: flex; align-items: center; gap: 6px; font-weight: 700; font-size: 0.84rem; white-space: nowrap; }
.tr-num { justify-self: end; font-size: 0.74rem; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.tr-num b { color: var(--ink); font-size: 0.86rem; font-weight: 750; }
.tr.st-target .tr-num, .tr.st-target .tr-num b { color: var(--good); }
.tr-num.none { color: var(--danger); font-weight: 700; font-size: 0.76rem; }
.wk > .today-title { margin: 0; }
.wk-empty { margin: 6px 0 0; font-size: 0.86rem; color: var(--ink-2); line-height: 1.5; }

/* An untouched device */
.comecard { border-left: 3px solid var(--accent); }
.comecard .today-title { margin: 0; }
.cc-text { margin: 4px 0 12px; font-size: 0.86rem; color: var(--ink-2); }
.cc-btns { display: flex; flex-wrap: wrap; gap: 8px; }
.cc-btns .btn { flex: 1 1 130px; min-height: 44px; }

/* ---------- Body ---------- */
.bd-head .today-title { margin: 0; display: flex; align-items: center; gap: 2px; }
.verdict {
  margin: 0;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  font-size: 0.88rem;
  color: var(--ink-2);
  line-height: 1.5;
}
.verdict b { color: var(--ink); }
.grows { display: flex; flex-direction: column; gap: 8px; }
.card.grow { gap: 3px; padding: 11px 12px 12px 14px; text-align: left; }
.gr-top { display: flex; align-items: baseline; gap: 8px; }
.gr-name { display: flex; align-items: center; gap: 7px; font-weight: 750; font-size: 0.95rem; flex: 1; min-width: 0; }
.gr-name .swatch { align-self: center; }
.gr-num { font-size: 0.8rem; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.gr-num b { font-size: 1.25rem; font-weight: 780; color: var(--ink); letter-spacing: -0.01em; }
.grow .chev { color: var(--muted); font-size: 1.1rem; margin-left: 2px; }
.grow .tb { margin: 5px 0 9px; }
.gr-status { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 2px 10px; font-size: 0.78rem; }
.gr-zone { font-weight: 700; color: var(--ink-2); }
.st-target .gr-zone { color: var(--good); }
.z-none .gr-zone { color: var(--danger); }
.gr-delta { color: var(--muted); }
.gr-meta { font-size: 0.76rem; color: var(--muted); line-height: 1.4; }
.nw { white-space: nowrap; }

.tabpane .sect {
  margin: 0;
  font-size: 0.72rem;
  font-weight: 750;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.stack .sect { padding: 0 2px; }
#bodyBalance { margin-top: 22px; }
#bodyBalance .sect { margin-bottom: 12px; }

.body-radar { padding: 6px 8px 12px; }
#bodyRadar { display: block; width: 100%; max-width: 420px; height: auto; margin: 0 auto; }
#bodyRadar .band { fill: var(--ink); fill-opacity: 0.12; fill-rule: evenodd; }
#bodyRadar .band-edge { fill: none; stroke: var(--ink-2); stroke-width: 1.25; }
#bodyRadar .ring { fill: none; stroke: var(--grid); stroke-width: 1; }
#bodyRadar .spoke { stroke: var(--grid); stroke-width: 1; }
#bodyRadar .shape {
  fill: var(--ink);
  fill-opacity: 0.08;
  stroke: var(--ink);
  stroke-opacity: 0.6;
  stroke-width: 2;
  stroke-linejoin: round;
}
#bodyRadar .ghost {
  fill: none;
  stroke: var(--ink-2);
  stroke-opacity: 0.75;
  stroke-width: 1.5;
  stroke-dasharray: 4 3;
  stroke-linejoin: round;
}
#bodyRadar .dot { stroke: var(--surface); stroke-width: 2; }
#bodyRadar .axis-label text { fill: var(--ink); font-size: 15px; font-weight: 700; }
#bodyRadar .axis-label .stepnum { fill: var(--ink-2); font-size: 14.5px; font-weight: 500; }
#bodyRadar .band, #bodyRadar .band-edge, #bodyRadar .ring, #bodyRadar .spoke, #bodyRadar .shape,
#bodyRadar .ghost, #bodyRadar .dot { pointer-events: none; }
#bodyRadar .wedge { fill: transparent; cursor: pointer; outline: none; }
#bodyRadar .wedge:focus-visible { fill: var(--ink); fill-opacity: 0.06; stroke: var(--accent); stroke-width: 2; }
@media (hover: hover) { #bodyRadar .wedge:hover { fill: var(--ink); fill-opacity: 0.04; } }

.legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px 16px;
  margin: 2px 0 0;
  font-size: 0.76rem;
  color: var(--ink-2);
}
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { display: inline-block; }
.lg-band { width: 14px; height: 10px; border-radius: 2px; background: rgba(127, 127, 127, 0.25); border: 1.25px solid var(--ink-2); }
.lg-now { width: 16px; border-top: 2px solid var(--ink); opacity: 0.7; }
.lg-ghost { width: 16px; border-top: 1.5px dashed var(--ink-2); }
.body-radar .radar-hint { padding: 8px 8px 0; font-size: 0.8rem; line-height: 1.45; }

.bodyempty p { margin: 6px 0 12px; font-size: 0.88rem; color: var(--ink-2); line-height: 1.5; }
.bodyempty .today-title { margin: 0; }
.bodyempty .hint { margin: 8px 2px 12px; font-size: 0.8rem; color: var(--muted); }

/* Group sheet */
.gs-sum { gap: 4px; }
.gs-sum .tb { margin: 6px 0 10px; }
.gs-sum .rxgoal { font-weight: 650; }
.gs-sum .rxgoal.st-target { color: var(--good); }
.cnt { border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.cnt-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 2.8em;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  background: var(--surface);
  font-size: 0.88rem;
}
.cnt.mixed .cnt-row { grid-template-columns: minmax(0, 1fr) auto 2.8em; }
.cnt-row + .cnt-row { border-top: 1px solid var(--border); }
.cnt-what { min-width: 0; display: flex; flex-direction: column; }
.cnt-name { font-weight: 650; }
.cnt-sub { font-size: 0.76rem; color: var(--muted); }
.cnt-x {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--ink-2);
  background: var(--grid);
  border-radius: 6px;
  padding: 2px 8px;
  white-space: nowrap;
}
.cnt-v { text-align: right; font-weight: 750; font-variant-numeric: tabular-nums; }
.cnt-total { background: var(--page); }
.cnt-total .cnt-v { font-size: 1rem; }
.sheet-body .hint b { color: var(--ink-2); }
.empty-line { margin: 4px 2px; font-size: 0.86rem; color: var(--muted); }
.empty-line.center { text-align: center; padding: 18px 8px; line-height: 1.7; }

.wk8 { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 12px 10px 4px 6px; }
.wk8 svg { display: block; width: 100%; height: auto; }
.wk8 .bar { fill: var(--area); }
.wk8 .bar.now { fill-opacity: 0.45; }
.wk8 .band { fill: var(--ink); fill-opacity: 0.1; }
.wk8 .band-edge { stroke: var(--ink-2); stroke-width: 1; stroke-dasharray: 3 3; }
.wk8 .base { stroke: var(--axis); stroke-width: 1; }
.wk8 .tick { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.wk8 .nowlbl { fill: var(--ink-2); font-weight: 700; }
.wk8 .vlbl { fill: var(--ink); font-size: 11.5px; font-weight: 750; }
.groupsheet .librows { margin-top: 0; }
.groupsheet .libname { font-size: 0.9rem; }

/* ---------- Skills ---------- */
.intro { margin: 0 2px; font-size: 0.86rem; color: var(--ink-2); }
.skills-layout { display: grid; gap: 14px; }
@media (min-width: 880px) {
  .skills-layout { grid-template-columns: minmax(360px, 460px) 1fr; align-items: start; }
  .skills-layout .radar-panel { position: sticky; top: 16px; }
}
@media (min-width: 360px) { .cards.skcards { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; } }
.cards.skcards .card { gap: 6px; padding: 12px 12px 13px; min-width: 0; }
.cards.skcards .card .head { font-size: 0.88rem; min-width: 0; flex-wrap: wrap; row-gap: 3px; }
.cards.skcards .card .ready { margin-left: 0; }
.cards.skcards .card .stepline .n { font-size: 1.35rem; }
.cards.skcards .card .stepline .name { font-size: 0.82rem; }
.sk-next { font-size: 0.76rem; color: var(--ink-2); line-height: 1.4; margin-top: 2px; }
.sk-next b { color: var(--ink); font-weight: 750; }

/* ---------- History ---------- */
.statline {
  display: flex;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 8px 4px 8px 0;
}
.statline .ss { flex: 1; min-width: 0; display: flex; flex-direction: column; padding: 0 12px; }
.statline .ss + .ss { border-left: 1px solid var(--border); }
.statline .statval { font-size: 1.4rem; font-weight: 780; letter-spacing: -0.02em; line-height: 1.15; }
.statline .statlab { font-size: 0.74rem; color: var(--muted); line-height: 1.3; }
.statline .infobtn { flex: none; margin: 0; }

.cal { padding: 8px 10px 12px; }
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 2px; }
.cal-head .today-title { margin: 0; }
.cal-nav { font-size: 1.3rem; line-height: 1; }
.cal-nav:disabled { opacity: 0.35; cursor: default; }
.cal-grid { width: 100%; border-collapse: collapse; table-layout: fixed; }
.cal-grid th { text-align: center; font-size: 0.66rem; font-weight: 700; color: var(--muted); padding: 2px 0 3px; letter-spacing: 0.04em; }
.cal-grid td { padding: 0 1px; vertical-align: top; }
.cal-cell {
  width: 100%;
  min-height: 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 3px 0 2px;
  border-radius: 10px;
  border: 1.5px solid transparent;
  font-size: 0.84rem;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  line-height: 1.15;
}
button.cal-cell:active { background: var(--grid); }
.cal-cell.today { border-color: var(--accent); }
.cal-cell.future { color: var(--muted); font-weight: 500; }
.cal-cell .slots { margin-top: 2px; }
.cal-cell:not(.has) .slots { visibility: hidden; }
.cal .slot-key { margin-top: 6px; }

.tabpane .stack > .hfilter { margin-top: 14px; }
.hfilter { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; padding: 0 2px; }
.hfilter .chips { gap: 6px; }
.hfilter .chip { min-height: 40px; padding: 7px 12px; }
.hdate { margin-top: 0; }
.history .hgroup:last-of-type { margin-bottom: 4px; }
.hitem .hopen { padding: 10px 12px; min-height: 52px; }
.hitem .chev { color: var(--muted); font-size: 1rem; flex: none; }
.hitem.ms { border-style: dashed; }
.hitem.ms .hname { font-weight: 650; }
.dayline { margin: 0 2px 8px; font-size: 0.84rem; color: var(--ink-2); }
.dayline b { color: var(--ink); }
.dayslots { display: flex; align-items: center; gap: 8px; margin: 0 2px 14px; font-size: 0.76rem; color: var(--muted); }
.dayslots .slots { margin: 0; }
.tabpane .stack > .linkbtn { margin-top: 6px; }

/* ---------- Sheets ---------- */
@media (max-width: 699px) {
  #sheet::before { content: ""; flex: none; align-self: center; width: 36px; height: 5px; margin: 6px 0 -2px; border-radius: 3px; background: var(--axis); }
  /* A short sheet (the ＋ Log picker) hugs its content. */
  #sheet.short { top: auto; max-height: 88dvh; }
}
@media (min-width: 700px) { #sheet.short { height: fit-content; max-height: min(760px, 88dvh); } }
.sheet-head .swatch { width: 11px; height: 11px; }
.sheet-head h2 .ico { margin-right: 0.35em; }
/* A long "‹ Wall Walking Bridges (Down)" shrinks and ends in "…" rather
   than squeezing the title into a narrow column (the full name stays in
   the DOM for screen readers). */
.sheet-head .back { flex: 0 1 auto; max-width: 40%; min-width: 0; min-height: 40px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#tabTitle:focus { outline: none; }
body.pill-on #sheet .sheet-body { padding-bottom: calc(24px + env(safe-area-inset-bottom) + 72px); }
.sheet-head h2:focus { outline: none; }
.logpick .librows { margin-top: 0; gap: 8px; }
.logpick .librow { padding: 8px 12px; }
.logpick h4 { margin: 16px 0 6px; }
.logpick h4:first-child { margin-top: 2px; }
.whatsnew .nc-list { margin-bottom: 0; }

/* Settings: sync line, weekly targets */
.syncline { display: flex; align-items: center; gap: 10px; }
.volrow { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 8px; }
.vlab { font-size: 0.9rem; font-weight: 650; }
.stepbtn[aria-disabled="true"] { color: var(--muted); opacity: 0.45; cursor: default; }

/* ---------- Touch sizes: every control at least 40 px, inputs 16 px ---------- */
.infobtn { width: 40px; height: 40px; margin: -10px -4px; }
.sheet-head .close { min-width: 40px; min-height: 40px; margin: -6px -8px -6px 0; }
.ghostbtn { min-height: 40px; padding: 6px 14px; }
.tdlink { min-height: 40px; }
.iconbtn { min-width: 40px; }
.qdate, .lognote, .stepval, .copyrow input { font-size: 16px; }

@media (max-width: 340px) {
  .wrap.shell { padding-left: 12px; padding-right: 12px; }
  .today-card.wk { padding-left: 10px; padding-right: 10px; }
  .cal { padding-left: 4px; padding-right: 4px; }
  .cal-grid td { padding: 0; }
  .statline .ss { padding: 0 8px; }
  .tr { grid-template-columns: 5.4rem minmax(0, 1fr) max-content; column-gap: 8px; }
}

@media (prefers-reduced-motion: reduce) {
  .tab .ti { transition: none; }
}


/* ==========================================================
   Milo: gym exercises (picker, gym sheet, exercise, your own)
   ========================================================== */

.exsearch {
  display: block;
  width: 100%;
  min-height: 44px;
  margin: 2px 0 6px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 16px;
}
.exsect h4 { display: flex; align-items: center; gap: 7px; }
/* Exercise rows have no icon: text and chevron only. */
.librow.exrow, .exsheet .librow { grid-template-columns: minmax(0, 1fr) auto; }
.exinfo { width: 32px; height: 32px; margin: -6px 0 -6px 2px; vertical-align: middle; }
.exsect[hidden], .exrow[hidden] { display: none; }
.exmine { font-size: 0.66rem; font-weight: 700; color: var(--muted); border: 1px solid var(--axis); border-radius: 999px; padding: 1px 6px; margin-left: 4px; vertical-align: 1px; }

.gympane .chips { margin-top: 2px; }
.glast { margin: 12px 2px 4px; font-size: 0.84rem; color: var(--ink-2); }
.glast b { color: var(--ink); }
.gymrx { margin: 8px 0 4px; gap: 4px; }
.gymrx .rxgoal { font-weight: 500; line-height: 1.45; }
.gymrx .rxgoal b { font-weight: 750; }

.gsets { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 6px; }
.gset {
  display: grid;
  grid-template-columns: 44px auto minmax(3rem, 1fr) auto 44px;
  align-items: center;
  gap: 6px;
  padding: 6px 6px 6px 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
}
.gpane-bw .gset { grid-template-columns: 44px minmax(3.2rem, 1fr) auto 44px; }
/* The set's label is a button: tap it to make the set a warm-up (W, logged
   but not counted) or a counted set again. A 44 px target around a small chip. */
.gnum { width: 44px; height: 44px; display: grid; place-items: center; padding: 0; border-radius: 12px; }
.gchip {
  min-width: 30px;
  height: 30px;
  padding: 0 4px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  border: 1.5px solid var(--axis);
  color: var(--ink-2);
  font-weight: 750;
  font-size: 0.9rem;
  font-variant-numeric: tabular-nums;
}
.gnum:active .gchip { border-color: var(--area); }
.gset .stepper { gap: 3px; }
.gset .stepbtn { width: 34px; height: 40px; }
.gset .kgval { width: 4.2rem; }
.gset .repval { width: 100%; min-width: 0; }
.gset .repval::placeholder, .gset .kgval::placeholder { color: var(--muted); opacity: 0.8; }
.gunit { font-size: 0.74rem; color: var(--muted); }
.gtick {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  border: 1.5px solid var(--axis);
  color: var(--muted);
  font-size: 1.1rem;
  font-weight: 800;
}
.gset.done { border-color: var(--area); background: rgba(127, 127, 127, 0.06); background: color-mix(in srgb, var(--area) 8%, var(--surface)); }
.gset.done .gtick { background: var(--area); border-color: var(--area); color: var(--btn-ink); }
.gset.done .gchip { color: var(--area); border-color: var(--area); }
/* A warm-up: a dashed row, a filled W, and a grey tick — it is logged, not counted. */
.gset.warm { border-style: dashed; background: var(--surface); }
.gset.warm .gchip { background: var(--muted); border-color: var(--muted); color: var(--page); }
.gset.warm.done { border-color: var(--axis); }
.gset.warm.done .gtick { background: var(--axis); border-color: var(--axis); color: var(--ink); }
.gset.warm .stepval { color: var(--ink-2); }
.gtip { margin: 8px 2px 4px; }
.gymfoot { display: flex; gap: 8px; }
.gymfoot .btn { flex: 1; }
.gymfoot .btn.primary { flex: 1.4; }

.exsheet p { font-size: 0.88rem; color: var(--ink-2); margin: 6px 0; }
.exnote {
  display: block;
  width: 100%;
  min-height: 44px;
  margin: 6px 0 4px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 16px;
}
.exnotel { display: block; margin-top: 14px; }
.exform .vlab { display: block; }
.exform .volrow .vlab { display: inline; }
.exform .volrow .stepval { width: 5rem; }
.exchk { display: flex; align-items: center; gap: 10px; min-height: 44px; font-size: 0.9rem; color: var(--ink-2); }
.exchk input { width: 22px; height: 22px; accent-color: var(--accent); }

@media (max-width: 374px) {
  .gset { grid-template-columns: 40px auto minmax(2.6rem, 1fr) 40px; gap: 4px; }
  .gnum { width: 40px; height: 44px; }
  .gset .gunit { display: none; }
  .gset .stepbtn { width: 30px; }
  .gset .kgval { width: 3.6rem; }
  .gtick { width: 40px; height: 40px; }
  .gpane-bw .gset { grid-template-columns: 40px minmax(2.6rem, 1fr) 40px; }
}

/* ---------- P5: records, line charts, body weight ---------- */
.bwcard { width: 100%; }
.bwcard .gr-name .ico { margin-right: -2px; }
.bw-add { color: var(--accent); font-size: 0.9rem; font-weight: 700; }
.glast + .glast { margin-top: 2px; }
.hitem .hrec { font-size: 0.78rem; font-weight: 650; color: var(--ink-2); }
.wclash { margin: 8px 2px 0; }
.wclash[hidden] { display: none; }
.weighpane .volrow { margin-top: 10px; }
.weighpane .bwkg { width: 5.6rem; font-size: 1.25rem; }
.weighpane .bwwaist { width: 5.6rem; }
.weightsheet p { font-size: 0.88rem; color: var(--ink-2); margin: 6px 0; }
.weightsheet .stdtable { margin-top: 10px; }
.settings .syncspace { margin: 10px 0 0; }
/* Their footers stay at the bottom while there is little to show. */
.sheet-body.weightsheet, .sheet-body.whatsnew { flex: 1 1 auto; }

/* A line chart (app.js, lineChartSVG): the 8-week chart's frame and type
   sizes. The line is the group's colour mixed towards the ink, so yellow
   and mint still read on a phone in a bright gym (plain ink-2 where the
   browser can't mix colours). */
.lc { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 12px 10px 4px 6px; }
.lc svg { display: block; width: 100%; max-width: 420px; height: auto; margin: 0 auto; overflow: visible; }
.lc .grid { stroke: var(--grid); stroke-width: 1; }
.lc .tick { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.lc .line { fill: none; stroke: var(--ink-2); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.lc .line.gap { stroke-width: 1.5; stroke-dasharray: 0.1 5; }
.lc .dot { fill: var(--surface); stroke: var(--ink-2); stroke-width: 1.5; }
/* Behind @supports: a second "stroke" using var() would be accepted by a
   browser without color-mix and then drawn as no line at all. */
@supports (color: color-mix(in srgb, red, blue)) {
  .lc .line, .lc .dot { stroke: color-mix(in srgb, var(--area, var(--accent)) 70%, var(--ink)); }
}
.lc .dot.big { fill: var(--ink); stroke: var(--surface); }
.lc .dot.raw { fill: var(--muted); stroke: none; }
.lc .vlbl { fill: var(--ink); font-size: 11.5px; font-weight: 750; font-variant-numeric: tabular-nums; }
.lc .hit { fill: transparent; }
p.lc-cap { margin: 6px 2px 0; font-size: 0.8rem; color: var(--muted); line-height: 1.45; }
.lc-legend { justify-content: flex-start; margin: 6px 2px 0; }
.lg-rec { width: 9px; height: 9px; border-radius: 50%; background: var(--ink); }
.lg-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); }
.lg-avg { width: 16px; border-top: 2px solid var(--ink-2); border-top-color: color-mix(in srgb, var(--area, var(--accent)) 70%, var(--ink)); }
.lg-gap { width: 16px; border-top: 2px dotted var(--ink-2); border-top-color: color-mix(in srgb, var(--area, var(--accent)) 70%, var(--ink)); }
.sheet-body.history > .chips { margin-bottom: 14px; }

/* ---------- Progress, group by group ---------- */
.gr-prog { font-size: 0.76rem; color: var(--ink-2); line-height: 1.4; }
.gr-prog b { color: var(--ink); font-weight: 750; }
.gr-prog.ok, .gr-prog.ok b { color: var(--good); }
.groupsheet p.pg-sum { margin: 2px 2px 8px; font-size: 0.88rem; font-weight: 650; color: var(--ink-2); }
.groupsheet p.pg-sum.ok, .groupsheet p.pg-sum.ok b { color: var(--good); }
.pg-tag { margin-left: 6px; font-size: 0.72rem; font-weight: 700; color: var(--muted); white-space: nowrap; }
.pg-tag.up { color: var(--good); }
.pg-tag.down { color: var(--ink-2); }
.groupsheet .pg-kg { margin-top: 10px; }

/* ---------- The plan: a gym split ---------- */
.plan-done { margin: 0 0 6px; font-size: 0.9rem; color: var(--good); font-weight: 650; }
.plan-done b { font-weight: 750; }
.gymfoot .btn { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.settings p.planlab { margin: 12px 0 6px; font-size: 0.78rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.planoff { margin-top: 12px; }
.wkday .wkex { margin: 6px 0 0; font-size: 0.86rem; color: var(--ink); line-height: 1.45; }
.wkday .wklast { margin: 4px 0 0; font-size: 0.76rem; color: var(--muted); }
.wkhead .wkpick { min-height: 36px; padding: 4px 12px; font-size: 0.8rem; flex: none; margin-left: auto; }
.planlinks { display: flex; justify-content: space-between; gap: 12px; margin-top: 4px; }
.planlinks .linkbtn { margin: 0; }

/* ---------- The work clock: a countdown for a timed set ---------- */
/* A play button in each set still to do, left of its tick. */
.gpane-play .gset { grid-template-columns: 44px minmax(3rem, 1fr) auto 44px 44px; }
.gplay {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  padding: 0 0 0 2px;
  border-radius: 12px;
  border: 1.5px solid var(--area);
  color: var(--area);
  font-size: 0.95rem;
}
.gplay.none { border: 0; }
.sheet-body p.ghf { margin: -4px 2px 4px 32px; }
@media (max-width: 374px) {
  .gpane-play .gset { grid-template-columns: 40px minmax(2.6rem, 1fr) 40px 40px; }
  .gplay { width: 40px; height: 40px; }
}
/* The clock itself, in place of the sets while it runs: big enough to read
   from the floor. */
.sheet-body.wcpane { display: flex; flex-direction: column; justify-content: center; }
.wc { text-align: center; padding: 8px 4px 16px; }
.wc p { margin: 0; }
.wc .wc-phase { font-size: 1.15rem; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-2); }
.wc .wc-time {
  margin: 2px 0 12px;
  font-size: clamp(5.5rem, 38vw, 10rem);
  font-weight: 800;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}
.wc[data-k="work"] .wc-phase, .wc[data-k="hold"] .wc-phase { color: var(--area); }
.wc-bar { height: 10px; max-width: 22rem; margin: 0 auto 18px; border-radius: 999px; background: var(--grid); overflow: hidden; }
.wc-bar span { display: block; height: 100%; width: 0; border-radius: 999px; background: var(--muted); }
.wc[data-k="work"] .wc-bar span, .wc[data-k="hold"] .wc-bar span { background: var(--area); }
/* A hold past the number to pass: the bar is full and says so. */
.wc.past .wc-phase { color: var(--good); }
.wc.past .wc-bar span { background: var(--good); }
.wc .wc-set { font-size: 1.02rem; font-weight: 700; color: var(--ink); }
.wc .wc-next { min-height: 2.9em; margin: 6px auto 0; max-width: 24rem; font-size: 0.92rem; line-height: 1.45; color: var(--ink-2); }
.wc[data-k="rest"] .wc-next { font-size: 1.02rem; font-weight: 650; color: var(--ink); }
.wc #wcSkip { margin-top: 10px; }
.wc #wcSkip[hidden] { display: none; }
.wc.paused .wc-time { opacity: 0.4; }

/* ---------- A set time: seconds per set, and the circuit's times ---------- */
.gympane .secsrow { margin: 10px 2px 2px; }
.secsrow .vlab { min-width: 0; }
.secsrow .stepval { width: 56px; }
.gympane .circlink { margin: 2px 2px 0; }
.circuitpane .secsrow { margin-top: 10px; }
.secsfree { font-size: 0.84rem; color: var(--muted); text-align: right; }
.circuitpane .hint { margin: 10px 2px 0; }

/* ---------- Gym or bodyweight: the switch on Today's plan ---------- */
.plancard .planmode { margin: 0 0 12px; }
.plancard .planmode .chip { min-height: 36px; }

/* ---------- The circuit: its exercises in order, their times ---------- */
.circrow {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas: "name ctrl" "acts ctrl";
  align-items: center;
  gap: 4px 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.circrow .vlab { grid-area: name; }
.circrow .stepper, .circrow .secsfree { grid-area: ctrl; }
.circrow .stepval { width: 56px; }
.circacts { grid-area: acts; display: flex; gap: 6px; }
.circbtn { min-height: 32px; padding: 0 10px; border: 1px solid var(--border); border-radius: 999px; font-size: 0.78rem; font-weight: 650; color: var(--ink-2); }
.circadd { margin-top: 6px; }

/* ---------- The week in review ---------- */
.report h4 { margin-top: 22px; }
.rv-nav { display: flex; justify-content: space-between; gap: 8px; margin: 0 0 12px; }
.rv-nav .btn { min-height: 38px; padding: 0 12px; font-size: 0.82rem; }
.rv-tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.rv-tile { display: flex; flex-direction: column; padding: 10px 12px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; min-width: 0; }
.rv-val { font-size: 1.55rem; font-weight: 780; letter-spacing: -0.02em; line-height: 1.1; color: var(--ink); }
.rv-lab { font-size: 0.8rem; font-weight: 650; color: var(--ink-2); }
.rv-sub { margin-top: 2px; font-size: 0.74rem; color: var(--muted); line-height: 1.3; }
.rv-notes { list-style: none; margin: 6px 0 0; padding: 0; display: grid; gap: 6px; }
.rv-note, .rv-recs li { display: flex; gap: 8px; align-items: baseline; padding: 9px 12px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; font-size: 0.86rem; line-height: 1.45; color: var(--ink-2); }
.rv-note b, .rv-recs b { color: var(--ink); }
.rv-ni { flex: none; width: 1.1em; text-align: center; color: var(--muted); }
.rv-note.low .rv-ni, .rv-note.high .rv-ni { color: var(--area); }
.rv-note.good .rv-ni { color: var(--good); }
.rv-bars { display: grid; gap: 10px; margin-top: 6px; }
.rv-row { display: grid; grid-template-columns: 5.2rem minmax(0, 1fr) auto; grid-template-areas: "name track num" ". meta meta"; align-items: center; gap: 2px 10px; }
.rv-row .rv-gname { grid-area: name; }
.rv-gname { font-size: 0.82rem; font-weight: 700; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rv-track { grid-area: track; position: relative; height: 10px; border-radius: 999px; background: var(--grid); overflow: hidden; }
.rv-band { position: absolute; top: 0; bottom: 0; background: var(--ink); opacity: 0.12; }
.rv-fill { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 999px; background: var(--area); }
.rv-num { grid-area: num; font-size: 0.8rem; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.rv-num b { color: var(--ink); font-weight: 750; }
.rv-meta { grid-area: meta; font-size: 0.74rem; color: var(--muted); }
.rv-grid { display: grid; gap: 3px; margin-top: 6px; padding: 10px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; }
.rv-grow { display: grid; grid-template-columns: 5.2rem repeat(12, minmax(0, 1fr)); gap: 3px; align-items: center; }
.rv-ghead .rv-cell { height: auto; font-size: 0.62rem; color: var(--muted); text-align: center; background: none; white-space: nowrap; }
.rv-cell { height: 18px; border-radius: 4px; background: var(--area); }
.rv-cell.z-none { background: none; box-shadow: inset 0 0 0 1px var(--grid); }
.rv-cell.z-low { opacity: 0.22; }
.rv-cell.z-building { opacity: 0.5; }
.rv-cell.z-above { box-shadow: inset 0 0 0 2px var(--surface), inset 0 0 0 4px var(--area); background: var(--area); }
.rv-legend { flex-wrap: wrap; gap: 6px 12px; }
.rv-key { display: inline-block; width: 12px; height: 12px; border-radius: 3px; background: var(--ink-2); vertical-align: -2px; }
.rv-key.z-low { opacity: 0.22; }
.rv-key.z-building { opacity: 0.5; }
.rv-key.z-none { background: none; box-shadow: inset 0 0 0 1px var(--axis); }
.rv-key.z-above { box-shadow: inset 0 0 0 2px var(--page), inset 0 0 0 3px var(--ink-2); }
.rv-prog { display: grid; gap: 4px; margin: 8px 0 4px; font-size: 0.84rem; color: var(--ink-2); }
.rv-prow { display: grid; grid-template-columns: 5.2rem 1fr; gap: 10px; }
.rv-sparks { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
.rv-spark { display: grid; grid-template-columns: 1fr auto; align-items: baseline; gap: 2px 6px; padding: 8px 10px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; min-width: 0; }
.rv-sname { font-size: 0.8rem; font-weight: 700; color: var(--ink); }
.rv-spct { font-size: 0.8rem; font-weight: 750; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.rv-sempty { grid-column: 1 / -1; font-size: 0.72rem; color: var(--muted); }
.rv-spark svg { grid-column: 1 / -1; width: 100%; height: 36px; display: block; }
.rv-spark .sp-line { fill: none; stroke: var(--area); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.rv-spark .sp-end { fill: var(--area); stroke: var(--surface); stroke-width: 2; }
.rv-lift { margin: 14px 2px 6px; font-size: 0.86rem; color: var(--ink-2); }
.rv-lift b { color: var(--ink); }
.rv-days .grid { stroke: var(--grid); stroke-width: 1; }
.rv-days .bar.this { fill-opacity: 1; }
.report h5 { margin: 16px 0 6px; font-size: 0.78rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.rv-when { display: grid; gap: 2px; padding: 10px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; }
.rv-wrow { display: grid; grid-template-columns: 2.6rem repeat(4, minmax(0, 1fr)); align-items: center; min-height: 28px; }
.rv-whead span { font-size: 0.68rem; color: var(--muted); text-align: center; }
.rv-wday { font-size: 0.76rem; font-weight: 650; color: var(--ink-2); }
.rv-wcell { display: grid; place-items: center; }
.rv-wcell i { display: block; border-radius: 50%; background: var(--grid); }
.rv-wcell i.on { background: var(--accent); }
.rv-bodyline { margin: 6px 2px 8px; font-size: 0.88rem; color: var(--ink-2); }
.rv-bodyline b { color: var(--ink); }
@media (max-width: 374px) {
  .rv-row, .rv-prow { grid-template-columns: 4.4rem minmax(0, 1fr) auto; }
  .rv-grow { grid-template-columns: 4.4rem repeat(12, minmax(0, 1fr)); gap: 2px; }
  .rv-val { font-size: 1.35rem; }
}
