/* ==========================================================================
   Workout Review: minimal dark design system
   ========================================================================== */
:root {
  --bg: #050506;
  --card: #0a0a0c;
  --card-hover: #1a1b20;
  --border: #1a1b20;
  --border-subtle: #131418;

  --text-primary: #e5e7eb;
  --text-secondary: #9ca3af;
  --text-muted: #8a8a94;  /* >= 4.5:1 on --card and --card-hover (WCAG AA) */

  --accent: #bef264;
  --accent-fg: #18181b;
  --accent-light: rgba(190, 244, 100, 0.15);
  --success: #22c55e;
  --warn: #f59e0b;
  --danger: #ef4444;

  --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', 'SFMono-Regular', Consolas, monospace;
  --nav-accent: var(--accent);
  --nav-link: var(--text-secondary);
  --nav-font: var(--font-mono);
  --radius: 8px;
  --radius-lg: 12px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  min-height: 100%;
  font-family: var(--font-sans);
  background-color: var(--bg);
  color: var(--text-primary);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }

.container { max-width: 1000px; margin: 0 auto; padding: 2rem 1.5rem 4rem; }

/* Utilities */
.hidden { display: none !important; }
.text-muted { color: var(--text-muted); }
.mb-4 { margin-bottom: 1rem; }
.mb-6 { margin-bottom: 1.5rem; }
.mt-2 { margin-top: 0.5rem; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.flex-between { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; flex-wrap: wrap; }
.flex-gap { display: flex; align-items: center; gap: 0.5rem; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
/* Same min-width:auto gotcha as .view-panels/#liftDetail - a card holding a
   wide table (Rep maxes) can otherwise blow this grid past the viewport. */
.grid-2 > * { min-width: 0; }
@media (max-width: 820px) { .grid-2 { grid-template-columns: 1fr; } }

/* ==========================================================================
   SHARED NAV: this block is identical in assets/style.css and
   workout/css/style.css, so the header doesn't move when you switch between
   the portfolio and the dashboard. Change both together. Each file maps the
   --nav-* tokens to its own palette.
   The header is 1000px wide on every page (the dashboard's width), while
   portfolio text stays at 720px for readable lines. The right side is the
   same everywhere: the dashboard has an invisible stand-in for the theme
   toggle, and "workout" is the active link at the end of the list.
   ========================================================================== */
/* Always reserve the scrollbar's space, so pages short enough not to scroll
   don't sit ~8px to the right of pages that do. */
html {
  scrollbar-gutter: stable;
}

header.site {
  padding: 1.25rem 0;
}

header.site nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.6rem 1rem;
  max-width: 1000px;
  margin: 0 auto;
  padding: 0 1.5rem;
  line-height: 1;
}

.nav-left {
  display: flex;
  align-items: center;
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 0.6rem 1.25rem;
}

.brand {
  font-family: var(--nav-font);
  font-weight: 600;
  color: var(--nav-accent);
  font-size: 1rem;
  cursor: default;
}

.nav-left .nav-here {
  font-family: var(--nav-font);
  font-weight: 600;
  font-size: 1rem;
  color: var(--nav-accent);
  text-decoration: none;
}

.nav-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-links li {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.nav-links .sep {
  color: var(--nav-link);
  font-family: var(--nav-font);
  font-size: 0.9rem;
}

.nav-links a {
  color: var(--nav-link);
  text-decoration: none;
  font-family: var(--nav-font);
  font-size: 0.9rem;
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--nav-accent);
}

/* Same box as .theme-toggle, so the links line up on pages without one. */
.nav-placeholder {
  display: inline-block;
  flex-shrink: 0;
  width: 1.75rem;
  height: 1.75rem;
  visibility: hidden;
}

/* Below this width there isn't room for brand + links + toggle to wrap
   without the toggle dropping alone (see .nav-right). Force one row instead:
   shrink text/gaps first, and let the links list itself scroll sideways as
   a fallback so it never pushes the toggle - or the page - out of place. */
@media (max-width: 480px) {
  header.site nav { flex-wrap: nowrap; gap: 0.5rem; padding: 0 1rem; }
  .nav-right { gap: 0.4rem 0.6rem; }
  .brand,
  .nav-left .nav-here { font-size: 0.85rem; }
  .nav-links {
    flex-wrap: nowrap;
    gap: 0.25rem;
    overflow-x: auto;
    min-width: 0;
    /* Scrolls on touch/swipe fine without a visible thumb - the default
       scrollbar otherwise renders right on top of the last link's text. */
    scrollbar-width: none;
  }
  .nav-links::-webkit-scrollbar { display: none; }
  .nav-links a,
  .nav-links .sep { font-size: 0.72rem; }
  .theme-toggle,
  .nav-placeholder { width: 1.4rem; height: 1.4rem; }
  .theme-toggle svg { width: 0.9rem; height: 0.9rem; }
}
/* The workout link is in every nav but shown only once this browser has
   opened the dashboard: the head script adds .workout-unlocked to <html>
   before the first paint, so the link never pops in late. */
.nav-links .nav-workout { display: none; }
.workout-unlocked .nav-links .nav-workout { display: flex; }

/* Same thin scrollbar on every page. Its width decides how much room is left
   for the page, so a different scrollbar would shift the nav sideways. */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

/* Moving between pages: the browser keeps the old page on screen until the
   new one is ready, then swaps in one frame, no fade or pop. The nav is the
   same on every page, so nothing in it moves. Browsers without cross-page
   view transitions just load the page as before. */
@view-transition { navigation: auto; }
::view-transition-group(*),
::view-transition-old(*),
::view-transition-new(*) { animation: none; }

/* Theme toggle hidden for now (and the dashboard's stand-in for it, so the
   nav still lines up). Delete this rule to bring the toggle back. */
.theme-toggle,
.nav-placeholder { display: none !important; }

/* Todo link hidden for now; /todo/ still works by URL. Delete this rule to
   bring it back. */
.nav-links .nav-todo { display: none; }
/* ======================== END SHARED NAV ======================== */

/* ==========================================================================
   VIEW TABS: vertical strip on the left, switches the dashboard view.
   Styled like a notebook's index dividers: a stack of labels each tagged
   with a small tab-colored edge, the active one lit up.
   ========================================================================== */
.container--split {
  display: grid;
  grid-template-columns: 130px 1fr;
  gap: 2.5rem;
  align-items: start;
}

/* Grid tracks default to min-width:auto, which lets wide nested content
   (the calendar heatmap, data tables) blow the whole column - and the
   whole page - past the viewport on mobile instead of scrolling inside
   its own box. min-width:0 lets this track actually shrink to fit. */
.view-panels { min-width: 0; }

.view-tabs {
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 2rem;
}

.nav-item {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-muted);
  padding: 0.55rem 0 0.55rem 0.9rem;
  border-left: 2px solid var(--border);
  white-space: nowrap;
  transition: color 0.15s ease, border-color 0.15s ease, background-color 0.15s ease;
}

.nav-item:hover { color: var(--text-primary); }
.nav-item.active {
  color: var(--accent);
  border-left-color: var(--accent);
  background: linear-gradient(90deg, var(--accent-light), transparent 70%);
}

@media (max-width: 820px) {
  .container--split { grid-template-columns: 1fr; gap: 1.25rem; }
  .view-tabs {
    position: static;
    flex-direction: row;
    overflow-x: auto;
    border-bottom: 1px solid var(--border);
  }
  .nav-item {
    padding: 0 0 0.6rem;
    margin-right: 1.25rem;
    border-left: none;
    border-bottom: 2px solid transparent;
  }
  .nav-item.active {
    border-bottom-color: var(--accent);
    background: none;
  }
}

/* ==========================================================================
   VIEWS & METRICS
   ========================================================================== */
.view-header { margin-bottom: 1.75rem; }
.view-header h2 { font-size: 1.75rem; font-weight: 700; letter-spacing: -0.02em; }

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}
@media (max-width: 820px) { .metrics-grid { grid-template-columns: repeat(2, 1fr); } }

.metric-card {
  background-color: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.15rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.metric-card__label { font-size: 0.78rem; color: var(--text-muted); font-weight: 500; }
.metric-card__value {
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.metric-card__value small { font-size: 0.85rem; color: var(--text-muted); font-weight: 400; }

/* The one-line explanation under each number - the thing that makes the
   dashboard readable without a legend. */
.metric-card__hint { font-size: 0.72rem; color: var(--text-muted); line-height: 1.35; }

/* ==========================================================================
   DELTAS
   ========================================================================== */
.delta {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  font-size: 0.75rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  width: fit-content;
}
/* Uses the brand accent rather than --success, so "up" reads as the same
   lime used for active tabs/chips/buttons instead of a second, competing
   green. --success stays as-is elsewhere (findings, tiers) - those are
   semantic status colors, not this brand touch. */
.delta--up { color: var(--accent); }
.delta--down { color: var(--danger); }
.delta--flat { color: var(--text-muted); }

/* ==========================================================================
   CARDS & CHARTS
   ========================================================================== */
.card {
  background-color: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
}

.card__header { margin-bottom: 1.25rem; }
.card__header--split {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1.5rem;
  flex-wrap: wrap;
}
.card__title { font-size: 1.05rem; font-weight: 600; }

.balance-header-right {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
  flex: 1 1 auto;
  min-width: 0;
}

.balance-ratio {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-secondary);
  white-space: nowrap;
  flex-shrink: 0;
  margin-left: auto;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.3rem 0.7rem;
}

/* On mobile the wrapped fallback (year chips + ratio dropping to their own
   row, still centered against the title above) reads as misaligned. Stack
   deliberately instead: title on top, then year chips, then the ratio -
   each its own row, all left-aligned. Must come after the unconditional
   .balance-ratio rule above - same specificity, so source order decides
   which margin-left wins regardless of the media query. */
@media (max-width: 640px) {
  .card__header--split {
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
  }
  .balance-header-right {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }
  .balance-ratio {
    margin-left: 0;
  }
}
.balance-ratio strong { color: var(--text-primary); font-variant-numeric: tabular-nums; }
.card__title--lg { font-size: 1.25rem; letter-spacing: -0.01em; }
.card__subtitle { font-size: 0.82rem; color: var(--text-muted); margin-top: 0.2rem; }

/* Hero card - lifted off the page so the calendar reads as the headline.
   Flat like every other card (the portfolio doesn't use gradient chrome) -
   the extra padding alone is what sets it apart. */
.card--hero {
  padding: 1.75rem;
}

.chart-box { width: 100%; height: 320px; position: relative; }
.chart-box--sm { height: 240px; }
/* Mobile browsers flash a gray/blue highlight over the whole canvas on tap
   by default, which looks like the chart itself reacted rather than the
   point you tapped. */
.chart-box canvas { -webkit-tap-highlight-color: transparent; }

/* ==========================================================================
   BALANCE BAR: push/pull/legs split as a single labeled stacked bar
   ========================================================================== */
.balance-bar {
  display: flex;
  height: 34px;
  margin-bottom: 0.9rem;
  border-radius: 6px;
  overflow: hidden;
}
.balance-bar__seg {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--accent-fg);
  white-space: nowrap;
  overflow: hidden;
}

.balance-legend { display: flex; flex-wrap: wrap; gap: 0.4rem 1.1rem; font-size: 0.8rem; }
.balance-legend__row { display: flex; align-items: center; gap: 0.4rem; }
.balance-legend__swatch { width: 8px; height: 8px; border-radius: 2px; flex-shrink: 0; }
.balance-legend__label { color: var(--text-secondary); }
.balance-legend__value { color: var(--text-muted); font-variant-numeric: tabular-nums; font-size: 0.76rem; }

.balance-note {
  margin: 0.9rem 0 0;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
  font-size: 0.78rem;
  color: var(--text-muted);
}
.balance-note strong { color: var(--text-primary); font-variant-numeric: tabular-nums; }

.chart-empty {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* ==========================================================================
   MUSCLE MAP: front/back figures coloured by sets, beside a ranked list.
   Four amber-to-orange levels, deliberately apart from the calendar's lime.
   Untrained regions keep the figure's own grey.
   ========================================================================== */
/* Laid out by the card's own width, not the screen's: beside the sidebar on
   a tablet the card is as narrow as on a phone. */
#muscleMap { container: musclemap / inline-size; }
.muscle-map { display: flex; gap: 1.75rem; align-items: flex-start; }
.muscle-map__figures { display: flex; gap: 0.5rem; flex: 1 1 0; min-width: 0; }
.muscle-map__figures figure { margin: 0; text-align: center; flex: 1; min-width: 0; }
/* Figures take whatever width the list leaves, keeping the art's 343:514
   viewBox, so they grow toward the list's height. */
.muscle-map__figures svg { width: 100%; height: auto; aspect-ratio: 343 / 514; display: block; }
.muscle-map__figures figcaption {
  margin-top: 0.4rem;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-muted);
}
.muscle-map__region { transition: fill 0.2s; }
.muscle-map__region.is-hl { stroke: var(--text-primary); stroke-width: 2; }

.muscle-map__list { flex: 0 1 17rem; min-width: 0; }
.muscle-list { list-style: none; }
.muscle-list__row {
  display: grid;
  grid-template-columns: 9px 6.5rem 1fr 2.5rem;
  gap: 0.6rem;
  align-items: center;
  padding: 0.12rem 0.25rem;
  border-radius: 4px;
  font-size: 0.82rem;
  line-height: 1.3;
}
.muscle-list__row.is-hl { background: var(--card-hover); }
.muscle-list__row:focus-visible { outline: 1px solid var(--accent); outline-offset: -1px; }
.muscle-list__dot { width: 9px; height: 9px; border-radius: 50%; }
.muscle-list__name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.muscle-list__track { height: 5px; border-radius: 3px; background: rgba(255, 255, 255, 0.05); }
.muscle-list__fill { display: block; height: 5px; border-radius: 3px; transition: width 0.2s; }
.muscle-list__sets { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }

/* 0 = drawn on the body but untrained in the last 7 days (list only). */
.muscle-list__dot.muscle-lvl--0 { background: rgba(255, 255, 255, 0.15); }
.muscle-lvl--1 { background: rgba(255, 162, 0, 0.4); fill: rgba(255, 162, 0, 0.4); }
.muscle-lvl--2 { background: rgba(255, 162, 0, 0.7); fill: rgba(255, 162, 0, 0.7); }
.muscle-lvl--3 { background: rgba(255, 162, 0, 1); fill: rgba(255, 162, 0, 1); }
.muscle-lvl--4 { background: #fe7100; fill: #fe7100; }

/* Too narrow for figures and list side by side without shrinking the
   figures well under the list's height: stack them. */
@container musclemap (max-width: 680px) {
  .muscle-map { flex-direction: column; align-items: center; gap: 1.25rem; }
  .muscle-map__figures { width: 100%; max-width: 400px; flex: none; }
  .muscle-map__list { width: 100%; max-width: 480px; flex: none; }
}
@container musclemap (max-width: 380px) {
  .muscle-list__row { grid-template-columns: 9px 5.75rem 1fr 2.25rem; gap: 0.5rem; }
}
/* Rows are tapped on touch screens, so give them a finger's height. */
@media (pointer: coarse) {
  .muscle-list__row { padding: 0.4rem 0.25rem; }
}

/* ==========================================================================
   FINDINGS
   ========================================================================== */
.findings__section + .findings__section { margin-top: 1rem; }
.findings__label {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 0.5rem;
}

/* Same visual language as .metric-card / .lift-card: a bordered tile in a
   responsive grid, rather than a list, so "what stands out" reads as a set
   of scannable cards instead of a wall of text. */
.findings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 0.75rem;
}
/* minmax's 240px floor can exceed the available width on very narrow phones
   once container + card padding are subtracted -- force a single column
   there instead of letting the grid overflow its box. */
@media (max-width: 420px) {
  .findings-grid { grid-template-columns: 1fr; }
}

/* Severity reads entirely off the icon badge's color -- a colored left
   border on top of that was redundant and, at a whole grid of them, looked
   like a row of paint chips. A plain border plus a faint tint instead. */
.finding-card {
  background-color: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 0.9rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.finding-card--clickable { cursor: pointer; }
.finding-card--clickable:hover { border-color: var(--accent); background: rgba(190, 244, 100, 0.06); }

.finding-card__header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.finding-card__icon {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.68rem;
  font-weight: 700;
}

.finding-card__title { font-size: 0.88rem; font-weight: 600; }
.finding-card__detail { font-size: 0.8rem; color: var(--text-secondary); line-height: 1.4; }

.finding-card--good .finding-card__icon { background: rgba(34, 197, 94, 0.15); color: var(--success); }
.finding-card--warn .finding-card__icon { background: rgba(245, 158, 11, 0.15); color: var(--warn); }
.finding-card--bad .finding-card__icon { background: rgba(239, 68, 68, 0.15); color: var(--danger); }

/* --- Program cards (Review) ------------------------------------------------
   Same tile as .finding-card; a table got unreadable once "lift gains" had
   to stack 4 lines inside one cell, so each program is a card with a
   one-line stat summary and lift gains as wrapped chips instead. */
.program-card {
  background-color: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 0.9rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.program-card__header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.program-card__title { font-size: 0.92rem; font-weight: 600; cursor: default; }
.program-card__dates { font-size: 0.72rem; color: var(--text-muted); white-space: nowrap; }
.program-card__stats { font-size: 0.8rem; color: var(--text-secondary); }

/* Plain rows, not pills -- a filled rounded chip per lift read like a row of
   capsules once a program had several lifts of data. */
.program-lift-list {
  display: flex;
  flex-direction: column;
  border-top: 1px solid var(--border-subtle);
  margin-top: 0.15rem;
  padding-top: 0.4rem;
}
.program-lift-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.2rem 0;
  font-size: 0.8rem;
}
.program-lift-row__name { color: var(--text-secondary); }

/* ==========================================================================
   TABLES
   ========================================================================== */
/* Scrolls horizontally rather than crushing columns illegibly narrow. */
.table-scroll { overflow-x: auto; }
.table { width: 100%; min-width: 420px; border-collapse: collapse; font-size: 0.85rem; }
.table th {
  text-align: left;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  font-weight: 600;
  padding: 0 0.6rem 0.6rem;
  border-bottom: 1px solid var(--border);
}
.table th.num { text-align: right; }
.table-subhead {
  display: block;
  text-transform: none;
  letter-spacing: normal;
  font-weight: 400;
  font-size: 0.68rem;
  margin-top: 0.15rem;
  opacity: 0.75;
}
.table td { padding: 0.6rem; border-bottom: 1px solid var(--border-subtle); vertical-align: middle; }
.table tr:last-child td { border-bottom: none; }
.table-note { font-size: 0.75rem; color: var(--text-muted); margin-top: 0.75rem; }

/* ==========================================================================
   PILLS, CHIPS & BADGES
   ========================================================================== */
.set-pill {
  display: inline-block;
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  font-size: 0.75rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
/* Warm-ups are shown but visually receded - present for completeness, not
   part of the numbers that matter. */
.set-pill--warmup { opacity: 0.4; }
/* Skipped: planned but never performed - dashed and muted, not counted. */
.set-pill--skipped {
  background: transparent;
  border-style: dashed;
  color: var(--text-muted);
}
.set-pill sup { color: var(--warn); font-weight: 700; }

.chips { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.chip {
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.15s ease;
}
.chip:hover { background: var(--card-hover); color: var(--text-primary); }
.chip--main { font-weight: 600; color: var(--text-primary); }
.chip--active { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); }
.chip--active:hover { background: var(--accent); color: var(--accent-fg); }

.lift-picker__section + .lift-picker__section { margin-top: 0.75rem; }
.lift-picker__label {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 0.4rem;
}

/* Lifts page: exercise picker as a sticky sidebar list instead of a wall of
   chips above the fold - 45 exercises across 6 sections stacked as pill rows
   pushed all the detail content far down the page. */
.lifts-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 1.5rem;
  align-items: start;
}
#liftDetail { min-width: 0; }
.lifts-sidebar {
  position: sticky;
  top: 1.5rem;
  max-height: calc(100vh - 3rem);
  overflow-y: auto;
}
/* Chips read fine as a horizontal row on Overview/Review, but in this narrow
   column they should read as a plain vertical list - same left-border/wash
   treatment as the view-tabs sidebar, since it's the same kind of list. */
.lifts-sidebar .chips { flex-direction: column; gap: 0; }
.lifts-sidebar .chip {
  text-align: left;
  border-radius: 0;
  border: none;
  border-left: 2px solid var(--border);
  background: none;
  padding: 0.5rem 0 0.5rem 0.9rem;
}
.lifts-sidebar .chip:hover { background: none; border-left-color: var(--text-muted); }
.lifts-sidebar .chip--active,
.lifts-sidebar .chip--active:hover {
  color: var(--accent);
  border-left-color: var(--accent);
  background: linear-gradient(90deg, var(--accent-light), transparent 70%);
}

@media (max-width: 820px) {
  .lifts-layout { grid-template-columns: 1fr; }
  .lifts-sidebar { position: static; max-height: none; }
  .lifts-sidebar .chips { flex-direction: row; flex-wrap: wrap; gap: 0.4rem; }
  .lifts-sidebar .chip {
    text-align: center;
    border-radius: 999px;
    border: 1px solid var(--border);
    padding: 0.35rem 0.75rem;
  }
  .lifts-sidebar .chip--active {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--accent-fg);
  }
}

/* --- Set history (lift detail) -------------------------------------------
   Each date collapses to a summary row; expand to see individual set pills.
   The row is a fixed-column grid that doesn't shrink much below ~300px, so
   it scrolls horizontally on narrow phones rather than breaking the card. */
.history-list-scroll { overflow-x: auto; }
/* Matches the fixed columns below (14+90+100+100 + gaps) plus enough room
   for the date to not wrap - a too-small min-width here let the date column
   get squeezed to a sliver and wrap onto two lines instead of scrolling. */
.history-list { display: flex; flex-direction: column; min-width: 420px; }

.history-row__summary {
  display: grid;
  grid-template-columns: 14px 1fr 90px 100px 100px;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.85rem;
}
.history-row__summary::-webkit-details-marker { display: none; }
.history-row__summary { list-style: none; }

.history-row__summary--head {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
  padding: 0 0.25rem 0.6rem;
  border-bottom: 1px solid var(--border);
}

.history-row {
  border-bottom: 1px solid var(--border-subtle);
}
.history-row:last-child { border-bottom: none; }

/* Jumped to from a chart point click -- see goToLiftHistory() in app.js. */
.history-row--highlight {
  background: var(--accent-light);
  border-radius: 6px;
  border-bottom-color: transparent;
}
.history-row--highlight > summary.history-row__summary { border-radius: 6px; }

/* --- Program timeline (Review) --------------------------------------------
   One row per program: a faint span from first to last session, plus a tick
   at every actual session date, drawn behind a shared month ruler so every
   row reads off the same x-axis. Rendered by
   Components.renderProgramTimeline; hover crosshair wired up by
   setupProgramTimelineHover() in app.js. */
.program-timeline {
  --pt-label-width: 110px;
  margin-bottom: 1.25rem;
  padding: 1rem;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  /* --card, not --card-hover: --border equals --card-hover's color in this
     theme, which would make the gridlines invisible against that background. */
  background: var(--card);
}
/* Narrow screens: a 110px label column leaves too little room for the
   chart itself. Shrink it (labels still ellipsize via .program-timeline__label). */
@media (max-width: 640px) {
  .program-timeline { --pt-label-width: 60px; }
  .program-timeline__label { font-size: 0.7rem; }
  /* Month labels are thinned by total date-range span, not by the chart's
     actual rendered width -- the same label count that fits an 800px desktop
     chart crowds into a ~200px mobile one. Drop everything but the two edge
     dates; the gridlines (unlabeled) still give a visual ruler. */
  .program-timeline__axis-label:not(.program-timeline__axis-label--start):not(.program-timeline__axis-label--end) {
    display: none;
  }
}

.program-timeline__legend {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.72rem;
  margin: 0 0 0.75rem calc(var(--pt-label-width) + 0.75rem);
  flex-wrap: wrap;
}

/* Swatch + label grouped as one flex item, so wrapping on narrow screens
   breaks between whole items, never between a swatch and its own text. */
.program-timeline__legend-item {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

/* Live readout on hover, pushed to the right end of the legend row --
   collapses away entirely (no leftover gap) when not hovering. */
.program-timeline__hover-readout {
  margin-left: auto;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.program-timeline__hover-readout:empty { display: none; }

/* Placed after the base .program-timeline__legend rule above so it
   actually wins the cascade at equal specificity (a same-selector
   override earlier in the file, e.g. inside the first mobile media
   query above, loses to this later rule regardless of media match).
   Labels are short enough (range/session/PR) to force one row: they
   stay left, the hover date pins right via its own margin-left: auto. */
@media (max-width: 640px) {
  .program-timeline__legend {
    flex-wrap: nowrap;
    gap: 0.5rem;
    margin-left: 0;
  }
}

.program-timeline__legend-swatch {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  flex-shrink: 0;
}
.program-timeline__legend-swatch--span { background: var(--accent-light); }
.program-timeline__legend-swatch--tick { background: var(--accent); width: 2px; border-radius: 1px; }
.program-timeline__legend-swatch--pr { background: var(--success); width: 2px; border-radius: 1px; }

.program-timeline__body {
  display: flex;
  gap: 0.75rem;
}

.program-timeline__labels {
  flex: 0 0 var(--pt-label-width);
  display: flex;
  flex-direction: column;
}

.program-timeline__label {
  height: 18px;
  margin: 0.35rem 0;
  display: flex;
  align-items: center;
  font-size: 0.8rem;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: default;
}

/* Program names with a Boostcamp page link out; the others stay plain text. */
.program-timeline__label a,
.program-card__title a {
  color: inherit;
  text-decoration: underline;
  text-decoration-color: var(--border);
  text-underline-offset: 3px;
}
.program-timeline__label a:hover,
.program-card__title a:hover { color: var(--accent); text-decoration-color: var(--accent); }

.program-timeline__chart {
  position: relative;
  flex: 1;
  min-width: 0;
  /* cursor toggled between pointer/default in JS depending on proximity to
     an actual session -- see setupProgramTimelineHover() in app.js. */
  cursor: default;
  /* Mobile browsers flash a gray/blue highlight on tap by default -- the
     chart isn't a real link/button, so suppress it. */
  -webkit-tap-highlight-color: transparent;
}

.program-timeline__gridlines, .program-timeline__crosshair {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.program-timeline__gridline {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 1px;
  background: var(--border);
}

.program-timeline__crosshair {
  display: none;
  border-left: 1px solid var(--accent);
}

.program-timeline__tracks {
  display: flex;
  flex-direction: column;
  position: relative;
}

.program-timeline__track {
  position: relative;
  height: 18px;
  margin: 0.35rem 0;
  background: var(--border-subtle);
  border-radius: 4px;
}

.program-timeline__span {
  position: absolute;
  top: 0;
  bottom: 0;
  background: var(--accent-light);
  border-radius: 4px;
}

.program-timeline__tick {
  position: absolute;
  top: 2px;
  bottom: 2px;
  width: 2px;
  background: var(--accent);
  border-radius: 1px;
  transform: translateX(-1px);
}

/* A main lift hit a new all-time best that day -- taller and in --success
   green so it reads as a highlight against the regular accent-colored ticks. */
.program-timeline__tick--pr {
  background: var(--success);
}

.program-timeline__axis {
  position: relative;
  height: 14px;
  margin: 0.5rem 0 0 calc(var(--pt-label-width) + 0.75rem);
}

.program-timeline__axis-label {
  position: absolute;
  top: 0;
  transform: translateX(-50%);
  font-size: 0.72rem;
  color: var(--text-muted);
  white-space: nowrap;
}
.program-timeline__axis-label--start { transform: translateX(0); }
.program-timeline__axis-label--end { transform: translateX(-100%); }

.history-row > summary.history-row__summary {
  padding: 0.6rem 0.25rem;
  cursor: pointer;
}
.history-row > summary.history-row__summary:hover { background: var(--card-hover); }

.history-row__arrow {
  display: inline-block;
  color: var(--text-muted);
  font-size: 0.65rem;
  transition: transform 0.15s ease;
}
.history-row[open] .history-row__arrow { transform: rotate(90deg); }

.history-row__date { color: var(--text-primary); font-weight: 500; }
.history-row__count { font-size: 0.78rem; }

.history-row__sets {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  padding: 0 0.25rem 0.75rem 1.6rem;
}

/* Covers essentially every phone (iPhone SE through Pro Max, most Android) -
   the old 400px cutoff left the most common widths (~390-430px) on the
   5-column desktop grid, which needs ~420px and squeezed the date column
   into wrapping onto two lines instead of scrolling. */
@media (max-width: 620px) {
  .history-row__summary {
    grid-template-columns: 12px 1fr 70px 80px;
    gap: 0.4rem;
    font-size: 0.78rem;
  }
  .history-row__count { display: none; }
  .history-list { min-width: 260px; }
}

.badge {
  display: inline-block;
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: capitalize;
  margin-left: 0.35rem;
}
.badge--boostcamp, .badge--strong {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.tier {
  display: inline-block;
  padding: 0.05rem 0.35rem;
  border-radius: 4px;
  font-size: 0.65rem;
  font-weight: 700;
  margin-right: 0.4rem;
}
.tier--T1 { background: rgba(239, 68, 68, 0.18); color: #fca5a5; }
.tier--T2 { background: rgba(245, 158, 11, 0.18); color: #fcd34d; }
.tier--T3 { background: rgba(34, 197, 94, 0.18); color: #86efac; }

/* ==========================================================================
   WORKOUT CARDS
   ========================================================================== */
.workout-card {
  background-color: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: 0.6rem;
  overflow: hidden;
}

.workout-card__head {
  padding: 0.9rem 1.1rem;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  list-style: none;
  transition: background 0.15s ease;
}
.workout-card__head::-webkit-details-marker { display: none; }
.workout-card__head:hover { background: var(--card-hover); }

.workout-card__title { display: flex; align-items: baseline; gap: 0.6rem; flex-wrap: wrap; }
.workout-card__date { font-weight: 600; font-size: 0.9rem; }
.workout-card__name { font-size: 0.8rem; color: var(--text-muted); }
.workout-card__meta { font-size: 0.78rem; color: var(--text-muted); display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; }
.workout-card__meta-text { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; color: var(--text-muted); }

/* Biometric extras (heart rate, calories, steps) backfilled from a fitness
   tracker - marked with a small icon instead of blending into the plain
   text stats, since they come from a different source than the workout log. */
.workout-card__bio { display: flex; align-items: center; gap: 0.55rem; }
.bio-chip { display: inline-flex; align-items: center; gap: 0.25rem; }
.bio-chip svg { flex-shrink: 0; opacity: 0.75; }

.workout-card__body { padding: 0.25rem 1.1rem 1rem; border-top: 1px solid var(--border-subtle); }

.exercise-row {
  display: grid;
  grid-template-columns: 190px 1fr;
  gap: 0.75rem;
  align-items: center;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border-subtle);
}
.exercise-row:last-child { border-bottom: none; }
.exercise-row__name { font-size: 0.85rem; display: flex; align-items: center; }
.exercise-row__sets { display: flex; flex-wrap: wrap; gap: 0.25rem; }

.exercise-row__link {
  font: inherit;
  color: inherit;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  text-align: left;
}
.exercise-row__link:hover,
.exercise-row__link:focus-visible { color: var(--accent); }

@media (max-width: 640px) {
  .exercise-row { grid-template-columns: 1fr; gap: 0.35rem; }
}

/* ==========================================================================
   CALENDAR HEATMAP: the hero element of the Overview
   ========================================================================== */
:root {
  --cell: 20px;
  --cell-gap: 4px;
}

/* Below ~900px the full year no longer fits at full size; shrink the cells
   rather than forcing a horizontal scroll straight away. */
@media (max-width: 900px) { :root { --cell: 15px; --cell-gap: 3px; } }
@media (max-width: 620px) { :root { --cell: 12px; --cell-gap: 2px; } }

.heatmap { display: flex; gap: 0.6rem; align-items: flex-start; }

.heatmap__gutter {
  display: flex;
  flex-direction: column;
  gap: var(--cell-gap);
  flex-shrink: 0;
  padding-top: 0;
}
.heatmap__gutter-spacer { height: 1rem; }
.heatmap__weekday {
  height: var(--cell);
  line-height: var(--cell);
  font-size: 0.68rem;
  color: var(--text-muted);
  text-align: right;
  white-space: nowrap;
}

.heatmap__scroll { overflow-x: auto; padding-bottom: 0.35rem; flex: 1; min-width: 0; }

.heatmap__months {
  display: flex;
  gap: var(--cell-gap);
  height: 1rem;
  padding-left: 1px;
}
.heatmap__month {
  width: var(--cell);
  font-size: 0.7rem;
  color: var(--text-secondary);
  white-space: nowrap;
  flex-shrink: 0;
}

.heatmap__body { display: flex; gap: var(--cell-gap); }
.heatmap__week { display: flex; flex-direction: column; gap: var(--cell-gap); }

.heatmap__day {
  width: var(--cell);
  height: var(--cell);
  border-radius: 4px;
  flex-shrink: 0;
  transition: transform 0.1s ease, outline-color 0.1s ease;
  outline: 2px solid transparent;
}
.heatmap__day:hover { transform: scale(1.18); outline-color: rgba(255, 255, 255, 0.5); }
.heatmap__day[data-date] { cursor: pointer; }

.heatmap__day--0 { background: rgba(255, 255, 255, 0.05); }
.heatmap__day--1 { background: rgba(190, 244, 100, 0.35); }
.heatmap__day--2 { background: rgba(190, 244, 100, 0.58); }
.heatmap__day--3 { background: rgba(190, 244, 100, 0.8); }
.heatmap__day--4 { background: #a3e635; }
.heatmap__day--future { background: transparent; }
.heatmap__day--future:hover { transform: none; outline-color: transparent; }

.heatmap__legend {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-top: 1rem;
  font-size: 0.72rem;
  color: var(--text-muted);
  flex-wrap: wrap;
}
.heatmap__legend-scale { display: flex; align-items: center; gap: 3px; }
.heatmap__legend-scale .heatmap__day { width: 12px; height: 12px; }
.heatmap__legend-scale .heatmap__day:hover { transform: none; outline-color: transparent; }
.heatmap__legend-scale span:first-child { margin-right: 0.3rem; }
.heatmap__legend-scale span:last-child { margin-left: 0.3rem; }

/* Compact stat row - used above the calendar and on the lift detail card.
   Stays on one line always; scrolls horizontally rather than wrapping to a
   second row when the column isn't wide enough for all of them. */
.heatmap-stats {
  display: flex;
  flex-wrap: nowrap;
  gap: 1.25rem;
  overflow-x: auto;
  padding-bottom: 0.2rem;
}
.heatmap-stat { display: flex; flex-direction: column; flex-shrink: 0; cursor: help; }
.heatmap-stat__value {
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}
.heatmap-stat__value small { font-size: 0.75rem; color: var(--text-muted); font-weight: 400; }
.heatmap-stat__label { font-size: 0.68rem; color: var(--text-muted); white-space: nowrap; }

@media (max-width: 700px) {
  .heatmap-stats { gap: 0.9rem; }
  .heatmap-stat__value { font-size: 1.05rem; }
}

/* ==========================================================================
   LIFT SPARKLINE CARDS: overview main lifts section
   ========================================================================== */
.lift-cards {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.75rem;
}
@media (max-width: 620px) { .lift-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

.lift-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1rem 0.75rem;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0; /* grid items default to min-width:auto, which lets nowrap text overflow the 1fr track */
}
.lift-card:hover { border-color: var(--accent); background: rgba(190, 244, 100, 0.04); }

.lift-card__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.lift-card__name {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  min-width: 0;
}

.lift-card__figure {
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
  margin-top: 0.1rem;
}

.lift-card__e1rm {
  font-size: 1.45rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}
.lift-card__e1rm small {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 400;
}

.lift-card__relative {
  font-size: 0.68rem;
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
}

.lift-card__level {
  padding: 0.1rem 0.4rem;
  border-radius: 999px;
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.level--untrained    { background: rgba(113, 113, 122, 0.18); color: var(--text-muted); }
.level--beginner     { background: rgba(161, 161, 170, 0.18); color: var(--text-secondary); }
.level--novice       { background: rgba(190, 244, 100, 0.18); color: #d9f99d; }
.level--intermediate { background: rgba(34, 197, 94, 0.18); color: #4ade80; }
.level--advanced     { background: rgba(168, 85, 247, 0.18); color: #c4b5fd; }
.level--elite        { background: rgba(245, 158, 11, 0.18); color: #fcd34d; }

.lift-card__change { font-size: 0.72rem; font-weight: 600; min-height: 1.1em; white-space: nowrap; }

/* Two cards per row on phones leaves no room for the name and the change
   side by side: stack them instead of truncating "DEADLIFT" to "DEADLI…". */
@media (max-width: 620px) {
  .lift-card__top { flex-direction: column; align-items: flex-start; gap: 0.1rem; }
  .lift-card__e1rm { white-space: nowrap; }
  .lift-card__figure { flex-wrap: wrap; row-gap: 0; }
}

.lift-card__sparkline {
  height: 40px;
  position: relative;
  margin-top: 0.5rem;
}

/* auto pushes the foot row to the bottom of the card, so it lines up across
   cards even when one card's e1RM/BW line wraps and others don't. */
/* Always pill-then-text, stacked, rather than a row that wraps for some
   cards and not others - keeps every card's foot the same height no matter
   how long "+N kg to next" ends up being. */
.lift-card__foot {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.3rem;
  margin-top: auto;
  padding-top: 0.5rem;
}

.lift-card__next {
  font-size: 0.66rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

/* ==========================================================================
   FORMS
   ========================================================================== */
.input, .select {
  background-color: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.85rem;
  padding: 0.45rem 0.7rem;
}
.input:focus, .select:focus { outline: none; border-color: var(--accent); }
.input--full { width: 100%; }
.select { cursor: pointer; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.9rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background-color: var(--card);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}
.btn:hover { background-color: var(--card-hover); }
.btn--primary { background-color: var(--accent); border-color: var(--accent); color: var(--accent-fg); }
.btn--primary:hover { filter: brightness(1.1); background-color: var(--accent); }
.btn--sm { padding: 0.35rem 0.7rem; font-size: 0.8rem; }

.empty-state { padding: 2.5rem 1rem; text-align: center; color: var(--text-muted); font-size: 0.875rem; }

.code-block {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  font-family: ui-monospace, 'SF Mono', Menlo, monospace;
  font-size: 0.85rem;
  margin: 0.75rem 0;
  overflow-x: auto;
}
code {
  font-family: ui-monospace, 'SF Mono', Menlo, monospace;
  font-size: 0.85em;
  background: rgba(255, 255, 255, 0.06);
  padding: 0.1rem 0.3rem;
  border-radius: 4px;
}

