/* ===========================================================================
   Jed's dashboard — prototype
   Palette and chart chrome follow the validated data-viz reference instance.
   Light is the base; dark is a selected set of steps, not an inversion.
   =========================================================================== */

:root {
  color-scheme: light;

  --surface-1:      #fcfcfb;   /* cards, chart surface */
  --surface-0:      #f4f4f1;   /* page plane */
  --surface-2:      #eceae4;   /* inset wells */

  --text-primary:   #0b0b0b;
  --text-secondary: #52514e;
  --text-muted:     #898781;

  --grid:           #e1e0d9;
  --axis:           #c3c2b7;
  --border:         rgba(11, 11, 11, 0.10);
  --border-strong:  rgba(11, 11, 11, 0.18);

  --accent:         #2a78d6;
  --accent-quiet:   #cde2fb;

  --good:           #0ca30c;
  --warning:        #fab219;
  --serious:        #ec835a;
  --critical:       #d03b3b;
  --good-text:      #006300;

  /* Ordinal heatmap ramp — light mode, validated (light end 2.06:1) */
  --heat-0: #eceae4;
  --heat-1: #86b6ef;
  --heat-2: #5598e7;
  --heat-3: #2a78d6;
  --heat-4: #1c5cab;
  --heat-5: #104281;

  --radius:   10px;
  --radius-s: 6px;
  --shadow:   0 1px 2px rgba(11, 11, 11, 0.05), 0 4px 14px rgba(11, 11, 11, 0.04);
}

@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;
    --surface-1:      #1a1a19;
    --surface-0:      #0d0d0d;
    --surface-2:      #242422;
    --text-primary:   #ffffff;
    --text-secondary: #c3c2b7;
    --text-muted:     #898781;
    --grid:           #2c2c2a;
    --axis:           #383835;
    --border:         rgba(255, 255, 255, 0.10);
    --border-strong:  rgba(255, 255, 255, 0.18);
    --accent:         #3987e5;
    --accent-quiet:   #18314e;
    --good-text:      #0ca30c;
    --heat-0: #242422;
    --heat-1: #1c5cab;
    --heat-2: #2a78d6;
    --heat-3: #5598e7;
    --heat-4: #86b6ef;
    --heat-5: #b7d3f6;
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --surface-1:      #1a1a19;
  --surface-0:      #0d0d0d;
  --surface-2:      #242422;
  --text-primary:   #ffffff;
  --text-secondary: #c3c2b7;
  --text-muted:     #898781;
  --grid:           #2c2c2a;
  --axis:           #383835;
  --border:         rgba(255, 255, 255, 0.10);
  --border-strong:  rgba(255, 255, 255, 0.18);
  --accent:         #3987e5;
  --accent-quiet:   #18314e;
  --good-text:      #0ca30c;
  --heat-0: #242422;
  --heat-1: #1c5cab;
  --heat-2: #2a78d6;
  --heat-3: #5598e7;
  --heat-4: #86b6ef;
  --heat-5: #b7d3f6;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--surface-0);
  color: var(--text-primary);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
  padding-bottom: env(safe-area-inset-bottom);
}

h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -0.01em; }

/* --- shell ---------------------------------------------------------------- */

header.top {
  position: sticky; top: 0; z-index: 40;
  background: color-mix(in srgb, var(--surface-0) 88%, transparent);
  backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--border);
  padding-top: env(safe-area-inset-top);
}

.top-inner {
  max-width: 1180px; margin: 0 auto;
  padding: 12px 20px 0;
  display: flex; flex-direction: column; gap: 10px;
}

.brand { display: flex; align-items: baseline; gap: 10px; }
.brand h1 { font-size: 17px; }
.brand .stamp { font-size: 12px; color: var(--text-muted); }
.brand .spacer { flex: 1; }

.theme-toggle {
  background: none; border: 1px solid var(--border); color: var(--text-secondary);
  border-radius: 999px; padding: 4px 11px; font: inherit; font-size: 12px;
  cursor: pointer;
}
.theme-toggle:hover { border-color: var(--border-strong); color: var(--text-primary); }

nav.tabs { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; }
nav.tabs::-webkit-scrollbar { display: none; }

/* Set in the eyebrow's voice — uppercase and tracked, like the section heads —
   so the tab row and "TRAINING YEAR" read as the same system. */
nav.tabs button {
  appearance: none; background: none; border: 0;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  font: inherit; font-size: 11.5px; font-weight: 500;
  text-transform: uppercase; letter-spacing: 0.14em;
  padding: 9px 14px 11px; cursor: pointer; white-space: nowrap;
}
nav.tabs button:hover { color: var(--text-secondary); }
nav.tabs button[aria-selected="true"] {
  color: var(--accent); border-bottom-color: var(--accent);
}
nav.tabs button[disabled] { color: var(--text-muted); cursor: not-allowed; opacity: 0.55; }

main { max-width: 1180px; margin: 0 auto; padding: 22px 20px 72px; }
section[hidden] { display: none; }

.stack { display: flex; flex-direction: column; gap: 22px; }

.section-head {
  display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap;
  margin-bottom: 11px;
}
.section-head h2 { font-size: 13px; text-transform: uppercase; letter-spacing: 0.07em;
  color: var(--text-muted); font-weight: 600; }
.section-head .note { font-size: 12px; color: var(--text-muted); }

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

.card {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow);
}
.card.flat { box-shadow: none; }
.card h3 { font-size: 14px; margin-bottom: 3px; }
.card .sub { font-size: 12.5px; color: var(--text-secondary); }

.grid { display: grid; gap: 12px; }
.grid.tiles   { grid-template-columns: repeat(auto-fit, minmax(152px, 1fr)); }
.grid.halves  { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }

/* --- stat tile ------------------------------------------------------------ */

.tile { display: flex; flex-direction: column; gap: 3px; }
.tile .label {
  font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--text-muted); font-weight: 600;
}
.tile .value { font-size: 30px; font-weight: 650; line-height: 1.12; letter-spacing: -0.02em; }
.tile .value.sm { font-size: 21px; }
.tile .unit { font-size: 14px; font-weight: 500; color: var(--text-secondary); margin-left: 3px; }
.tile .meta { font-size: 12px; color: var(--text-secondary); }
.tile.accent .value { color: var(--accent); }
.tile.warn   .value { color: var(--critical); }

.bar-track {
  height: 5px; border-radius: 3px; background: var(--surface-2);
  overflow: hidden; margin-top: 8px;
}
.bar-fill { height: 100%; border-radius: 3px; background: var(--accent); }
.bar-fill.tight { background: var(--critical); }

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

.rows { display: flex; flex-direction: column; }
.row {
  display: flex; align-items: center; gap: 12px;
  padding: 9px 0; border-bottom: 1px solid var(--grid);
}
.row:last-child { border-bottom: 0; }
.row .grow { flex: 1; min-width: 0; }
.row .name { font-size: 14px; font-weight: 500; }
.row .dim  { font-size: 12.5px; color: var(--text-secondary); }
.row .num  { font-variant-numeric: tabular-nums; font-size: 13.5px; text-align: right; }

.pill {
  display: inline-block; font-size: 11px; font-weight: 600; letter-spacing: 0.03em;
  padding: 2px 7px; border-radius: 999px;
  background: var(--surface-2); color: var(--text-secondary);
}
.pill.now   { background: var(--accent-quiet); color: var(--accent); }
.pill.exam  { background: color-mix(in srgb, var(--critical) 16%, transparent); color: var(--critical); }
.pill.dead  { background: color-mix(in srgb, var(--warning) 22%, transparent); color: var(--text-primary); }

/* --- not-connected placeholder ------------------------------------------- */

.stub { border-style: dashed; background: none; box-shadow: none; }
.stub h3 { color: var(--text-secondary); }
.stub .sub { color: var(--text-muted); }
.stub .how {
  margin-top: 10px; font-size: 12px; color: var(--text-muted);
  border-top: 1px dashed var(--border); padding-top: 9px;
}

/* --- charts --------------------------------------------------------------- */

.chart-wrap { position: relative; width: 100%; overflow-x: auto; }
svg.chart { display: block; width: 100%; height: auto; overflow: visible; }
svg.chart text { font: 11px system-ui, -apple-system, sans-serif; fill: var(--text-muted); }
svg.chart .grid-line { stroke: var(--grid); stroke-width: 1; }
svg.chart .axis-line { stroke: var(--axis); stroke-width: 1; }
svg.chart .series { fill: none; stroke: var(--accent); stroke-width: 2;
  stroke-linejoin: round; stroke-linecap: round; }
svg.chart .dot { fill: var(--accent); stroke: var(--surface-1); stroke-width: 2; }
svg.chart .bar { fill: var(--accent); }
svg.chart .crosshair { stroke: var(--axis); stroke-width: 1; stroke-dasharray: 3 3; }
svg.chart .hit { fill: transparent; cursor: crosshair; }

.tooltip {
  position: absolute; pointer-events: none; z-index: 20;
  background: var(--surface-1); border: 1px solid var(--border-strong);
  border-radius: var(--radius-s); padding: 7px 10px;
  font-size: 12.5px; line-height: 1.45; color: var(--text-primary);
  box-shadow: 0 4px 18px rgba(0,0,0,0.16);
  white-space: nowrap; opacity: 0; transition: opacity .09s;
}
.tooltip.on { opacity: 1; }
.tooltip .t-date { color: var(--text-muted); font-size: 11.5px; }
.tooltip .t-val  { font-weight: 600; font-variant-numeric: tabular-nums; }

/* --- heatmap -------------------------------------------------------------- */

.heat { display: flex; gap: 9px; align-items: flex-start; }
.heat-days {
  display: grid; grid-template-rows: repeat(7, 13px); gap: 3px;
  font-size: 9.5px; color: var(--text-muted); padding-top: 15px;
}
.heat-scroll { overflow-x: auto; flex: 1; padding-bottom: 4px; }
.heat-months { display: flex; height: 13px; font-size: 10px; color: var(--text-muted); }
.heat-grid { display: grid; grid-auto-flow: column; grid-template-rows: repeat(7, 13px); gap: 3px; }
.heat-cell {
  width: 13px; height: 13px; border-radius: 3px; background: var(--heat-0);
  outline: 1px solid rgba(128,128,128,0.10); outline-offset: -1px;
}
.heat-cell[data-l="1"] { background: var(--heat-1); }
.heat-cell[data-l="2"] { background: var(--heat-2); }
.heat-cell[data-l="3"] { background: var(--heat-3); }
.heat-cell[data-l="4"] { background: var(--heat-4); }
.heat-cell[data-l="5"] { background: var(--heat-5); }
.heat-cell[data-d] { cursor: pointer; }
.heat-legend {
  display: flex; align-items: center; gap: 5px; margin-top: 9px;
  font-size: 11.5px; color: var(--text-muted);
}

/* --- table ---------------------------------------------------------------- */

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th {
  text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--text-muted); font-weight: 600; padding: 6px 10px 8px 0;
  border-bottom: 1px solid var(--axis); white-space: nowrap;
  /* Keeps the header visible in the vertically-scrolling history table. */
  position: sticky; top: 0; background: var(--surface-1); z-index: 2;
}
th.r, td.r { text-align: right; }
td { padding: 9px 10px 9px 0; border-bottom: 1px solid var(--grid); vertical-align: middle; }
td.num { font-variant-numeric: tabular-nums; }
tbody tr.click { cursor: pointer; }
tbody tr.click:hover td { background: var(--surface-2); }
tbody tr[aria-selected="true"] td { background: var(--accent-quiet); }
.muted { color: var(--text-muted); }

/* --- exercise detail ------------------------------------------------------ */

.detail-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin-bottom: 4px; }
.detail-head h3 { font-size: 18px; }

.seg { display: inline-flex; background: var(--surface-2); border-radius: 999px; padding: 2px; }
.seg button {
  appearance: none; border: 0; background: none; color: var(--text-secondary);
  font: inherit; font-size: 12px; font-weight: 500; padding: 4px 11px;
  border-radius: 999px; cursor: pointer;
}
.seg button[aria-pressed="true"] { background: var(--surface-1); color: var(--text-primary); box-shadow: var(--shadow); }

.setline { font-variant-numeric: tabular-nums; font-size: 13px; color: var(--text-secondary); }
.setline b { color: var(--text-primary); font-weight: 600; }

/* --- capture form --------------------------------------------------------- */

textarea, input[type="date"] {
  width: 100%; background: var(--surface-0); color: var(--text-primary);
  border: 1px solid var(--border-strong); border-radius: var(--radius-s);
  padding: 9px 11px; font: inherit; font-size: 13.5px;
}
textarea { min-height: 108px; resize: vertical; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; }
textarea:focus, input:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }

.btn {
  appearance: none; border: 1px solid transparent; border-radius: var(--radius-s);
  background: var(--accent); color: #fff; font: inherit; font-size: 13.5px; font-weight: 600;
  padding: 8px 15px; cursor: pointer;
}
.btn:hover { filter: brightness(1.08); }
.btn.ghost { background: none; color: var(--text-secondary); border-color: var(--border-strong); }
.btn.ghost:hover { color: var(--text-primary); filter: none; background: var(--surface-2); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; filter: none; }

.form-row { display: flex; gap: 9px; align-items: center; flex-wrap: wrap; margin-top: 10px; }
.hint { font-size: 12px; color: var(--text-muted); }

/* --- warnings ------------------------------------------------------------- */

details.warnings summary {
  cursor: pointer; font-size: 13px; color: var(--text-secondary);
  padding: 3px 0; list-style: none; display: flex; align-items: center; gap: 8px;
}
details.warnings summary::-webkit-details-marker { display: none; }
details.warnings summary::before { content: "▸"; color: var(--text-muted); font-size: 11px; }
details.warnings[open] summary::before { content: "▾"; }
details.warnings ul { margin: 9px 0 0; padding-left: 20px; font-size: 12.5px;
  color: var(--text-secondary); line-height: 1.65; }
details.warnings code { font-size: 12px; background: var(--surface-2); padding: 1px 4px; border-radius: 3px; }

.badge-warn {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11.5px; font-weight: 600; color: var(--text-primary);
  background: color-mix(in srgb, var(--warning) 22%, transparent);
  padding: 2px 8px; border-radius: 999px;
}

@media (max-width: 640px) {
  main { padding: 16px 14px 60px; }
  .top-inner { padding: 10px 14px 0; }
  .tile .value { font-size: 26px; }
  .grid.tiles { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
}

/* ===========================================================================
   Session card navigation
   =========================================================================== */

.session-card { position: relative; }
/* A strip running the full height of the card, inside its bounds. The card
   grows and shrinks with the number of sets, so a vertically-centred puck moved
   out from under the cursor as you stepped through sessions; a full-height
   target keeps the same spot clickable whatever the next session holds.
   pointer-events has to track opacity — an invisible strip that still swallowed
   clicks would block the card content underneath it. */
.nav-arrow {
  position: absolute; top: 0; bottom: 0; width: 42px;
  border: 0; background: none; padding: 0;
  color: var(--text-muted); font: inherit; font-size: 18px; line-height: 1;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; z-index: 3;
  opacity: 0; pointer-events: none;
  transition: opacity .12s, background-color .12s, color .12s;
}
.session-card:hover .nav-arrow,
.session-card:focus-within .nav-arrow { opacity: 1; pointer-events: auto; }
.nav-arrow:hover { background: var(--surface-2); color: var(--text-primary); }
.nav-arrow:disabled { opacity: 0 !important; pointer-events: none !important; }
.nav-arrow.prev { left: 0;  border-radius: var(--radius) 0 0 var(--radius); }
.nav-arrow.next { right: 0; border-radius: 0 var(--radius) var(--radius) 0; }
/* `.card-tools` — the absolutely-positioned top-right button slot — was removed
   2026-08-17. It overlapped the header pills whenever they wrapped, and the one
   control it held moved to the card footer. Do not reintroduce a corner overlay
   here: the header is variable-width by nature. */
@media (hover: none) {
  .nav-arrow { opacity: 1; pointer-events: auto; }
}

/* Card footer: position counter left, link right, on one baseline. The link is
   set in the counter's voice deliberately — same family, size and colour — so it
   reads as part of the card's furniture rather than as a call to action. */
.card-foot {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 12px; margin-top: 10px;
}
.card-foot .hint { margin: 0; }
.foot-link {
  appearance: none; background: none; border: 0; padding: 0;
  font: inherit; font-size: 12px; color: var(--text-muted);
  cursor: pointer; white-space: nowrap;
}
.foot-link:hover { color: var(--text-primary); }

/* Exercise rotation on the strength chart. */
.ex-nav { display: inline-flex; gap: 2px; margin-right: 4px; }
.ex-nav button {
  appearance: none; background: none; border: 1px solid var(--border);
  border-radius: var(--radius-s); color: var(--text-secondary);
  font: inherit; font-size: 14px; line-height: 1;
  width: 26px; height: 26px; display: grid; place-items: center; cursor: pointer;
}
.ex-nav button:hover { background: var(--surface-2); color: var(--accent); border-color: var(--border-strong); }

/* ===========================================================================
   Full-screen overlays
   =========================================================================== */

.overlay {
  position: fixed; inset: 0; z-index: 100;
  background: var(--surface-0); color: var(--text-primary);
  display: flex; flex-direction: column;
  animation: rise .16s ease-out;
}
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }
@media (prefers-reduced-motion: reduce) { .overlay { animation: none; } }

.overlay-head {
  position: sticky; top: 0; z-index: 5;
  background: var(--surface-0);
  border-bottom: 1px solid var(--border);
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}
.overlay-head h2 { font-size: 16px; flex: 1; min-width: 0; }
.overlay-body {
  flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch;
  padding: 16px 16px calc(96px + env(safe-area-inset-bottom));
}
.overlay-body > .wrap { max-width: 900px; margin: 0 auto;
  display: flex; flex-direction: column; gap: 14px; }

.icon-btn {
  appearance: none; width: 34px; height: 34px; flex: 0 0 34px;
  border-radius: 999px; border: 1px solid var(--border-strong);
  background: none; color: var(--text-secondary);
  font: inherit; font-size: 16px; line-height: 1;
  display: grid; place-items: center; cursor: pointer;
}
.icon-btn:hover { color: var(--text-primary); background: var(--surface-2); }

/* ===========================================================================
   Records browser — search
   =========================================================================== */

.search-row { display: flex; gap: 8px; align-items: center; width: 100%; }
.search-row input[type="search"] {
  flex: 1; min-width: 0;
  background: var(--surface-2); color: var(--text-primary);
  border: 1px solid transparent; border-radius: 999px;
  padding: 8px 14px; font: inherit; font-size: 14px;
}
.search-row input[type="search"]:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.match-count { font-size: 12.5px; color: var(--text-muted);
  font-variant-numeric: tabular-nums; white-space: nowrap; }

mark.hit {
  background: color-mix(in srgb, var(--warning) 40%, transparent);
  color: var(--text-primary); border-radius: 2px; padding: 0 1px;
}
mark.hit.on { background: var(--accent); color: #fff; }

.record-day { border-bottom: 1px solid var(--grid); padding: 12px 0; }
.record-day:last-child { border-bottom: 0; }
.record-head { display: flex; align-items: baseline; gap: 9px; flex-wrap: wrap; margin-bottom: 6px; }
.record-head .rd-date { font-size: 14.5px; font-weight: 600; }
.record-ex { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px;
  padding: 3px 0; font-size: 13.5px; }
.record-ex .rx-name { color: var(--text-primary); }
.record-ex .rx-sets { color: var(--text-secondary); font-variant-numeric: tabular-nums; }

/* ===========================================================================
   Routine picker
   =========================================================================== */

.scrim {
  position: fixed; inset: 0; z-index: 110;
  background: rgba(0,0,0,0.45);
  display: grid; place-items: end center;
  animation: fade .14s ease-out;
}
@keyframes fade { from { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .scrim { animation: none; } }
@media (min-width: 640px) { .scrim { place-items: center; } }

.sheet {
  width: min(440px, 100%);
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 16px 16px 0 0;
  padding: 16px 16px calc(16px + env(safe-area-inset-bottom));
  display: flex; flex-direction: column; gap: 8px;
  box-shadow: 0 -8px 40px rgba(0,0,0,0.3);
}
@media (min-width: 640px) { .sheet { border-radius: 16px; box-shadow: 0 12px 48px rgba(0,0,0,0.35); } }
.sheet h3 { font-size: 15px; margin-bottom: 4px; }

.routine-btn {
  appearance: none; text-align: left; width: 100%;
  background: var(--surface-2); border: 1px solid transparent;
  border-radius: var(--radius); padding: 12px 14px; cursor: pointer;
  color: var(--text-primary); font: inherit;
  display: flex; align-items: center; gap: 12px;
}
.routine-btn:hover { border-color: var(--border-strong); }
.routine-btn .rb-name { font-size: 14.5px; font-weight: 600; }
.routine-btn .rb-sub { font-size: 12.5px; color: var(--text-secondary); margin-top: 2px; }
.routine-btn.new { background: none; border: 1px dashed var(--accent); color: var(--accent); }
.routine-btn.new .rb-name { color: var(--accent); }
.routine-btn.flex-kind { border-left: 3px solid var(--accent); }

/* ===========================================================================
   Workout logger
   =========================================================================== */

.log-stats {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px;
  padding: 12px 0; border-bottom: 1px solid var(--grid);
}
.log-stats .ls { display: flex; flex-direction: column; gap: 2px; }
.log-stats .ls-k { font-size: 11px; text-transform: uppercase; letter-spacing: .06em;
  color: var(--text-muted); font-weight: 600; }
.log-stats .ls-v { font-size: 18px; font-weight: 650; font-variant-numeric: tabular-nums; }
.log-stats .ls-v.live { color: var(--accent); }

.ex-block { padding: 14px 0; border-bottom: 1px solid var(--grid); }
.ex-block:last-of-type { border-bottom: 0; }
.ex-title { font-size: 15px; font-weight: 650; color: var(--accent); margin-bottom: 6px; }
.ex-note {
  width: 100%; background: none; border: 0; color: var(--text-secondary);
  font: inherit; font-size: 13px; padding: 2px 0; resize: none; min-height: 22px;
}
.ex-note::placeholder { color: var(--text-muted); }
.ex-note:focus { outline: none; color: var(--text-primary); }

.set-grid { display: grid; gap: 0; margin-top: 8px; }
.set-grid.strength { grid-template-columns: 34px 1fr 62px 56px 50px 44px; }
.set-grid.mobility { grid-template-columns: 34px 1fr 84px 44px; }
.set-grid > * { padding: 7px 4px; display: flex; align-items: center; }
.set-hd {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: .05em;
  color: var(--text-muted); font-weight: 600; justify-content: center;
}
.set-hd.l { justify-content: flex-start; }
.set-cell { justify-content: center; font-variant-numeric: tabular-nums; font-size: 13.5px; }
.set-cell.l { justify-content: flex-start; color: var(--text-muted); font-size: 12.5px; }
.set-row-bg { grid-column: 1 / -1; height: 1px; background: var(--grid); }

.set-input {
  width: 100%; text-align: center; background: var(--surface-2);
  border: 1px solid transparent; border-radius: var(--radius-s);
  color: var(--text-primary); font: inherit; font-size: 14px;
  font-variant-numeric: tabular-nums; padding: 6px 2px;
  -moz-appearance: textfield;
}
.set-input::-webkit-outer-spin-button,
.set-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.set-input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.set-input.ghost { color: var(--text-muted); }

.set-check {
  appearance: none; width: 30px; height: 30px; border-radius: var(--radius-s);
  border: 0; background: var(--surface-2); color: var(--text-muted);
  cursor: pointer; display: grid; place-items: center; font-size: 15px; line-height: 1;
}
.set-check[aria-pressed="true"] { background: var(--good); color: #fff; }
.set-done { background: color-mix(in srgb, var(--good) 15%, transparent); }

.add-set {
  width: 100%; margin-top: 10px; appearance: none;
  background: var(--surface-2); border: 0; border-radius: var(--radius-s);
  color: var(--text-secondary); font: inherit; font-size: 13.5px; font-weight: 600;
  padding: 9px; cursor: pointer;
}
.add-set:hover { color: var(--text-primary); }

.rest-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 120;
  background: var(--surface-1); border-top: 1px solid var(--border-strong);
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
  display: flex; align-items: center; gap: 10px; justify-content: center;
  box-shadow: 0 -4px 24px rgba(0,0,0,0.18);
}
.rest-bar .rt-time {
  font-size: 22px; font-weight: 650; font-variant-numeric: tabular-nums;
  min-width: 76px; text-align: center;
}
.rest-bar .rt-time.done { color: var(--good); }
.rest-progress {
  position: absolute; left: 0; top: 0; height: 2px;
  background: var(--accent); transition: width .25s linear;
}

.overlay-foot {
  position: sticky; bottom: 0;
  background: var(--surface-0); border-top: 1px solid var(--border);
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
  display: flex; gap: 10px; justify-content: flex-end;
}

.chip-row { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  appearance: none; border: 1px solid var(--border-strong); background: none;
  color: var(--text-secondary); font: inherit; font-size: 13px;
  border-radius: 999px; padding: 6px 13px; cursor: pointer;
}
.chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field > label { font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em;
  color: var(--text-muted); font-weight: 600; }

.btn.danger { background: none; color: var(--critical); border-color: transparent; }
.btn.danger:hover { background: color-mix(in srgb, var(--critical) 12%, transparent); filter: none; }

.start-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.btn.big { font-size: 15px; padding: 11px 22px; border-radius: 999px; }

/* Recessed rather than filled: the accent does the talking, and the button
   stops competing with the charts for the one bright colour on the page.
   --surface-2 is the inset well, so this stays dark in dark mode and reads as
   a recess in light mode rather than becoming a second accent block. */
.btn.start {
  background: var(--surface-2);
  color: var(--accent);
  border-color: var(--border);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 13px;
}
.btn.start:hover { background: var(--accent-quiet); filter: none; }
.btn.caps { text-transform: uppercase; letter-spacing: 0.1em; }

/* --- prescription line, above each exercise's set grid --------------------
   Added 2026-08-16 with the auto-prescription engine. Two lines: what to lift
   today, and the progression decision that produced it. The `why` is muted
   normally and coloured only when the load actually steps up, so a working
   week reads as a series of small green confirmations rather than noise. */
.ex-target {
  display: flex; flex-direction: column; gap: 2px;
  margin: -2px 0 8px; padding: 7px 10px;
  background: var(--surface-2, rgba(127, 127, 127, 0.08));
  border-radius: 8px;
  border-left: 2px solid var(--accent, #6aa9ff);
}
.ex-target .tg-main {
  font-size: 14px; font-weight: 600; letter-spacing: -0.01em;
}
.ex-target .tg-why {
  font-size: 12px; opacity: 0.62; line-height: 1.35;
}
.ex-target .tg-why.up {
  opacity: 1; color: var(--good, #3fb950); font-weight: 550;
}

/* ===========================================================================
   Button voice, revised 2026-08-16
   ---------------------------------------------------------------------------
   Jed's call, and it is a system rule rather than a one-off: no filled light-
   blue buttons anywhere. Every button is a dark recess with accent text, set
   in the same uppercase, thin, tracked voice as the tab row — so the whole app
   speaks with one typographic accent instead of the nav saying one thing and
   the controls another. `.btn.solid` exists only as a deliberate escape hatch;
   nothing uses it today.
   =========================================================================== */

.btn {
  background: var(--surface-2);
  color: var(--accent);
  border-color: var(--border);
  text-transform: uppercase;
  letter-spacing: 0.13em;
  font-size: 12px;
  font-weight: 500;
}
.btn:hover { background: var(--accent-quiet); filter: none; }
.btn.solid { background: var(--accent); color: #fff; border-color: transparent; }
.btn.ghost {
  background: none; color: var(--text-secondary); border-color: var(--border-strong);
}
.btn.ghost:hover { color: var(--text-primary); background: var(--surface-2); }
.btn.danger { background: none; color: var(--critical); border-color: transparent; }

/* Start workout / View records. Thinner and smaller than before, sized between
   the old 15px and the 11.5px tab row so the row reads as a quieter sibling of
   the nav rather than a competing block. */
.btn.big { font-size: 12.5px; font-weight: 500; padding: 11px 22px; border-radius: 999px; }
.start-row .btn.ghost.caps { font-size: 12.5px; font-weight: 500; letter-spacing: 0.13em; }

/* Session-card arrows: thinner stroke and translucent, so they sit behind the
   content they navigate rather than on top of it. */
.nav-arrow { font-weight: 200; font-size: 22px; }
.session-card:hover .nav-arrow,
.session-card:focus-within .nav-arrow { opacity: 0.4; }
.nav-arrow:hover { opacity: 0.85 !important; background: none; color: var(--text-primary); }
@media (hover: none) { .nav-arrow { opacity: 0.4; } }

/* Routine names in the picker, and exercise names in the logger, both in the
   tab row's voice. */
.routine-btn .rb-name,
.ex-title {
  text-transform: uppercase; letter-spacing: 0.14em;
  font-size: 12.5px; font-weight: 500; color: var(--accent);
}
.ex-title { margin-bottom: 7px; }

/* --- rest bar ------------------------------------------------------------- */

/* The ±15 controls were .icon-btn — a 34px circle at 16px type, which "−15"
   overflows. Their own class: wide enough for three glyphs, type scaled to
   fit, tabular so the two buttons are identical widths. */
.rt-adj {
  appearance: none; width: 42px; height: 42px; flex: 0 0 42px;
  border-radius: 999px; border: 1px solid var(--border-strong);
  background: none; color: var(--text-secondary);
  font: inherit; font-size: 12.5px; font-weight: 500; line-height: 1;
  letter-spacing: 0; font-variant-numeric: tabular-nums;
  display: grid; place-items: center; cursor: pointer; padding: 0;
}
.rt-adj:hover { color: var(--text-primary); background: var(--surface-2); }
.rest-bar { gap: 14px; }
.rest-bar .rt-time { font-weight: 600; }

/* --- bottom sheet --------------------------------------------------------- */

.sheet-scrim {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(0, 0, 0, 0.45);
  display: flex; align-items: flex-end; justify-content: center;
  animation: fade .14s ease-out;
}
@keyframes fade { from { opacity: 0; } }
.sheet {
  width: 100%; max-width: 560px;
  background: var(--surface-1); color: var(--text-primary);
  border-radius: 16px 16px 0 0;
  border: 1px solid var(--border); border-bottom: 0;
  padding: 10px 16px calc(14px + env(safe-area-inset-bottom));
  display: flex; flex-direction: column; gap: 12px;
  max-height: 78vh;
  animation: slideup .18s cubic-bezier(.2, .8, .3, 1);
}
@keyframes slideup { from { transform: translateY(100%); } }
@media (prefers-reduced-motion: reduce) {
  .sheet, .sheet-scrim { animation: none; }
}
.sheet-grab {
  width: 38px; height: 4px; border-radius: 999px;
  background: var(--border-strong); align-self: center; margin-bottom: 2px;
}
.sheet-title { text-align: center; font-size: 15px; font-weight: 600; }
.sheet-sub {
  text-align: center; font-size: 12.5px; color: var(--text-secondary); margin-top: -8px;
}
.sheet-list {
  overflow-y: auto; -webkit-overflow-scrolling: touch;
  display: flex; flex-direction: column; gap: 2px;
  border-top: 1px solid var(--grid); padding-top: 8px;
}
.sheet-opt {
  appearance: none; background: none; border: 0; border-radius: 8px;
  color: var(--text-secondary); font: inherit; font-size: 15px;
  padding: 11px 14px; cursor: pointer; text-align: center; width: 100%;
  font-variant-numeric: tabular-nums;
}
.sheet-opt:hover { background: var(--surface-2); color: var(--text-primary); }
.sheet-opt[aria-selected="true"] {
  background: var(--surface-2); color: var(--accent); font-weight: 600;
}
.sheet-opt.l { text-align: left; font-size: 14px; }
.sheet-opt.l .so-sub { display: block; font-size: 12px; color: var(--text-muted); }

/* --- minimised workout pill ----------------------------------------------- */

.mini-bar {
  position: fixed; left: 12px; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom));
  z-index: 115; max-width: 560px; margin: 0 auto;
  background: var(--surface-1); border: 1px solid var(--border-strong);
  border-radius: 999px; box-shadow: 0 6px 28px rgba(0, 0, 0, 0.28);
  display: flex; align-items: center; gap: 12px; padding: 8px 10px 8px 14px;
  cursor: pointer;
}
.mini-bar .mb-dot {
  width: 8px; height: 8px; border-radius: 999px; background: var(--accent); flex: 0 0 8px;
}
.mini-bar .mb-text { flex: 1; min-width: 0; }
.mini-bar .mb-main {
  font-size: 13.5px; font-weight: 600; font-variant-numeric: tabular-nums;
}
.mini-bar .mb-sub {
  font-size: 12px; color: var(--text-secondary);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* --- logger footer actions ------------------------------------------------ */

.log-foot { display: flex; flex-direction: column; gap: 10px; margin-top: 22px; }
.log-foot .lf-row { display: flex; gap: 10px; }
.log-foot .lf-row > .btn { flex: 1; justify-content: center; }
.log-foot .btn { padding: 12px 16px; text-align: center; }

/* Rest bar hides while the workout is minimised — the pill carries the time,
   and stacking two fixed bars at the bottom of a phone is unreadable. */
body.workout-minimised .rest-bar { display: none; }

/* Selected gym chip was the last filled-accent surface in the app. Same
   treatment as the buttons: a recess with accent text, not a blue block. */
.chip[aria-pressed="true"] {
  background: var(--accent-quiet); border-color: var(--accent); color: var(--accent);
}

/* ===========================================================================
   Sheet dialogs, exercise menu, records delete — added 2026-08-16
   =========================================================================== */

.sheet-msg { font-size: 13.5px; line-height: 1.55; color: var(--text-secondary);
  padding: 4px 2px 8px; text-align: left; }
.sheet-actions { display: flex; flex-direction: column; gap: 8px; margin-top: 6px; }
.sheet-actions > .btn { width: 100%; text-align: center; }

.sheet-input {
  width: 100%; background: var(--surface-2); color: var(--text-primary);
  border: 1px solid transparent; border-radius: 999px;
  padding: 10px 15px; font: inherit; font-size: 14.5px; margin-bottom: 6px;
}
.sheet-input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.sheet-input::-webkit-search-cancel-button { -webkit-appearance: none; }

.sheet-text {
  width: 100%; min-height: 168px; resize: vertical;
  background: var(--surface-2); color: var(--text-primary);
  border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px;
  line-height: 1.5;
}
.sheet-opt.danger-opt { color: var(--critical); }
.sheet-opt.danger-opt:hover { background: color-mix(in srgb, var(--critical) 12%, transparent); }

/* Exercise header: title left, options button right. Hidden until the block is
   hovered or focused, per Jed — but always visible on touch, where there is no
   hover and an invisible control is simply a missing one. */
.ex-head { display: flex; align-items: center; gap: 8px; }
.ex-head .ex-title { flex: 1; min-width: 0; margin-bottom: 0; }
.ex-menu {
  appearance: none; width: 30px; height: 30px; flex: 0 0 30px;
  border: 0; border-radius: 999px; background: none;
  color: var(--text-muted); font: inherit; font-size: 17px; line-height: 1;
  display: grid; place-items: center; cursor: pointer;
  opacity: 0; transition: opacity .12s, color .12s, background-color .12s;
}
.ex-block:hover .ex-menu, .ex-block:focus-within .ex-menu { opacity: 1; }
.ex-menu:hover { color: var(--text-primary); background: var(--surface-2); }
@media (hover: none) { .ex-menu { opacity: 1; } }

.rd-del {
  appearance: none; background: none; border: 0; padding: 2px 4px;
  color: var(--text-muted); font: inherit; font-size: 11px; font-weight: 500;
  text-transform: uppercase; letter-spacing: .1em; cursor: pointer;
  margin-left: auto;
}
.rd-del:hover { color: var(--critical); }

/* Minimised pill: time left, routine name centred, Resume as text not a box. */
.mini-bar { gap: 10px; }
.mini-bar .mb-main {
  font-size: 13.5px; font-weight: 600; font-variant-numeric: tabular-nums;
  flex: 0 0 auto;
}
.mini-bar .mb-sub {
  flex: 1; min-width: 0; text-align: center;
  font-size: 12.5px; color: var(--text-secondary);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.mini-bar .mb-resume {
  appearance: none; background: none; border: 0; padding: 4px 8px;
  color: var(--accent); font: inherit; font-size: 11.5px; font-weight: 500;
  text-transform: uppercase; letter-spacing: .13em; cursor: pointer;
  flex: 0 0 auto;
}
.mini-bar .mb-resume:hover { opacity: .75; }

/* ===========================================================================
   Rest bar, revised 2026-08-17
   Timer group centred in the bar; Skip pinned right, mirroring Resume on the
   minimised pill. Skip is out of the flex flow on purpose — inside it, the
   group centred against Skip's width rather than the screen's.

   Do NOT restate `position` here. This block once carried `position: relative`
   to give `.rt-skip` a containing block; `position: fixed` above already is
   one, and at equal specificity the later rule won — which dropped the whole
   bar out of the viewport into normal flow at the bottom of <body>, hidden
   behind the overlay. The timer kept running and dinging invisibly, so it read
   as "the timer stopped appearing" rather than as a layout bug.
   =========================================================================== */

.rest-bar { justify-content: center; gap: 0; }
.rt-group { display: flex; align-items: center; gap: 14px; }

/* Same family, weight and tracking as an exercise name; size and colour kept. */
.rest-bar .rt-time {
  font-family: var(--s-body, inherit);
  font-size: 22px; font-weight: 500; letter-spacing: 0.14em;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums; min-width: 92px; text-align: center;
}
/* "Rest done" takes the Skip button's voice entirely — same font, size, colour. */
.rest-bar .rt-time.done {
  font-size: 12px; font-weight: 500; letter-spacing: 0.13em;
  text-transform: uppercase; color: var(--accent);
}
.rt-skip {
  position: absolute; right: 16px; top: 50%; transform: translateY(-50%);
  appearance: none; background: none; border: 0; padding: 6px 8px;
  color: var(--accent); font: inherit; font-size: 12px; font-weight: 500;
  text-transform: uppercase; letter-spacing: 0.13em; cursor: pointer;
}
.rt-skip:hover { opacity: .75; }

/* --- Appearance panel ----------------------------------------------------- */
#ap-open { margin-left: 6px; }
.ap-field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px;
  text-align: left; }
.ap-field > label {
  font-family: var(--s-mono, inherit); font-size: 9.5px; letter-spacing: .12em;
  text-transform: uppercase; color: var(--text-muted);
}
.ap-select {
  width: 100%; font: inherit; font-size: 13px; color: var(--text-primary);
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 8px; padding: 9px 10px;
}
.ap-select:focus { outline: 2px solid var(--accent); outline-offset: -1px; }

/* ===========================================================================
   PWA update prompt — added 2026-08-17
   Built and styled by public/pwa.js, which only ever loads from index.html.
   These rules therefore ship unused in the published artifact; that costs a few
   hundred bytes and keeps the project on one stylesheet, which is the better
   trade than a second styling mechanism living inside a JS file.

   Top edge, not bottom: the rest bar (z 120) and the minimised-workout pill
   (z 115) both own the bottom of the screen, and stacking fixed bars down there
   is the readability problem this app already solved once.
   =========================================================================== */

.update-bar {
  position: fixed; left: 0; right: 0; top: 0; z-index: 130;
  padding: calc(9px + env(safe-area-inset-top)) 14px 9px;
  display: flex; align-items: center; gap: 12px;
  background: var(--surface-1);
  border-bottom: 1px solid var(--accent);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.30);
  animation: rise .16s ease-out;
}
.update-bar .ub-text {
  flex: 1; min-width: 0;
  font-size: 13px; font-weight: 500; color: var(--text-primary);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.update-bar .ub-go {
  appearance: none; background: none; border: 0; padding: 6px 8px;
  color: var(--accent); font: inherit; font-size: 12px; font-weight: 500;
  text-transform: uppercase; letter-spacing: 0.13em; cursor: pointer;
}
.update-bar .ub-go:hover { opacity: .75; }
.update-bar .ub-go[disabled] { color: var(--text-muted); cursor: default; }
.update-bar .ub-dismiss {
  appearance: none; background: none; border: 0; padding: 4px 2px;
  color: var(--text-muted); font: inherit; font-size: 14px;
  line-height: 1; cursor: pointer; flex: 0 0 auto;
}
.update-bar .ub-dismiss:hover { color: var(--text-primary); }
