/* Editorial experiment: common shell, semantic themes, and training page compositions. */
:root {
  color-scheme: dark;
  --fd-surface-canvas: #151715;
  --fd-surface-base: #1d211e;
  --fd-surface-raised: #282e29;
  --fd-surface-sunken: #191d1a;
  --fd-surface-overlay: #282e29;
  --fd-text-primary: #f2efe7;
  --fd-text-secondary: #b8bcb3;
  --fd-text-tertiary: #959990;
  --fd-border-default: #353b35;
  --fd-border-subtle: #2e342e;
  --fd-border-focus: #91b39e;
  --fd-focus-halo: transparent;
  --fd-action-primary: #527b67;
  --fd-action-primary-hover: #426653;
  --fd-action-primary-text: #fffaf2;
  --fd-feedback-danger: #ff5a78;
  --fd-accent: #91b39e;
  --fd-accent-soft: #25332b;
  --fd-viz-progress: #30d158;
  --fd-viz-gamification: #c6a2f2;
  --fd-viz-measurement: #64a9ff;
  --fd-viz-health: #66c9e3;
  --fd-font-display: 'Iowan Old Style', 'Baskerville', 'Times New Roman', serif;
  --fd-font-interface: 'Avenir Next', 'Segoe UI', 'Helvetica Neue', sans-serif;
  /* Foundry 2 type scale; RepUp uses the top of the 40–44px hero range. */
  --fd-font-size-hero: 44px;
  --fd-font-size-operational: 23px;
  --fd-font-size-heading: 22px;
  --fd-font-size-heading-mobile: 21px;
  --fd-font-size-body: 14px;
  --fd-font-size-meta: 13px;
  --fd-font-size-label: 12px;
  --fd-font-size-input: 16px;
  --fd-font-weight-regular: 400;
  --fd-font-weight-medium: 500;
  --fd-line-height-title: 1.12;
  --fd-line-height-feature: 1.08;
  --fd-line-height-heading: 1.2;
  --fd-line-height-value: 1.2;
  --fd-line-height-body: 1.5;
  /* Foundry brand row (9f8f281): size the lockup by its visible mark, 32px desktop / 28px mobile. */
  --fd-logo-mark-height: 32px;
  --fd-logo-mark-height-mobile: 28px;
  --fd-logo-lockup-ink: 0.85;
  --fd-logo-optical: 1;
  --green: var(--fd-viz-progress);
  --fd-nav-background: #0b100f;
  --fd-nav-active: #202622;
  --fd-nav-text: #c0c1bb;
  --fd-nav-accent: #91b39e;
  --fd-viz-gamification-surface: #262131;
  --fd-positive: #65d984;
  --fd-viz-measurement-surface: #192b36;
}
:root[data-theme='light'] {
  color-scheme: light;
  --fd-surface-canvas: #f7f4ed;
  --fd-surface-base: #fffdf8;
  --fd-surface-raised: #f0ece3;
  --fd-surface-sunken: #f4eee6;
  --fd-surface-overlay: #fffdf8;
  --fd-text-primary: #191c19;
  --fd-text-secondary: #4d534a;
  --fd-text-tertiary: #696b64;
  --fd-border-default: #e2ded5;
  --fd-border-subtle: #e9e5dd;
  --fd-border-focus: #466a58;
  --fd-accent: #466a58;
  --fd-accent-soft: #e6eee8;
  --fd-viz-progress: #22733b;
  --fd-viz-gamification: #7944a8;
  --fd-viz-measurement: #1767ae;
  --fd-viz-health: #087a94;
  --fd-viz-comparison: #a86200;
  --fd-feedback-danger: #a8233f;
  --fd-viz-gamification-surface: #f3edf7;
  --fd-positive: #22733b;
  --fd-viz-measurement-surface: #eaf3f8;
}
body { font-size: var(--fd-font-size-body); line-height: var(--fd-line-height-body); }
button, input, select { font-family: var(--fd-font-interface); }
header {
  background: var(--bg); border-bottom: 1px solid var(--border);
  backdrop-filter: none; -webkit-backdrop-filter: none;
}
.editorial-wordmark, .rail-brand {
  color: var(--text);
}
.editorial-wordmark { display: block; }
.brand-lockup { display: block; width: auto; aspect-ratio: 148 / 44; height: calc(var(--fd-logo-mark-height) * var(--fd-logo-optical) / var(--fd-logo-lockup-ink)); }
@media (max-width: 820px) { .brand-lockup { height: calc(var(--fd-logo-mark-height-mobile) * var(--fd-logo-optical) / var(--fd-logo-lockup-ink)); } }
/* At 320px the 28px-mark lockup plus three 44px header buttons fill the row; drop the button gaps instead of shrinking the logo. */
@media (max-width: 359px) { header .header-actions { gap: 0; } }
.brand-lockup-light { display: none; }
:root[data-theme='light'] header .brand-lockup-dark { display: none; }
:root[data-theme='light'] header .brand-lockup-light { display: block; }
.icon-btn { background: transparent; border: 0; border-radius: 6px; }
.icon-btn:hover { background: var(--fd-surface-raised); }
.jump-btn svg {
  width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.7;
  stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0;
}
.rail-brand { display: none; }
main { padding: 24px 18px 104px; }
.card, .hero-week { border-radius: 6px; padding: 20px; box-shadow: none; }
.card h2, #sec-home .card h2, #sec-log .card h2,
#sec-detail .card h2, #sec-health .card h2,
#sec-activity .activity-card h2, #sec-strength .stats-chart-card h2,
#sec-exercises .lifts-card h2, #ex-detail-card .exercise-overview-head h2 {
  font: var(--fd-font-weight-medium) var(--fd-font-size-heading)/var(--fd-line-height-heading) var(--fd-font-display);
  color: var(--text); text-transform: none; letter-spacing: -.025em;
}
/* Sections inside one Exercise Detail card share a single sub-heading step. */
#ex-detail-card .exercise-section-head h2, .next-pr-label, .strength-level-title {
  font: 500 18px/1.25 var(--fd-font-display);
  color: var(--text); text-transform: none; letter-spacing: -.015em;
}
.sec h1, .workout-detail-title, .exercise-detail-header h1 {
  font-family: var(--fd-font-display); font-weight: 500;
  font-size: clamp(28px, 4vw, 32px); line-height: var(--fd-line-height-title);
  letter-spacing: -.035em; overflow-wrap: anywhere;
}
[class$='-eyebrow'] { font-weight: 500; letter-spacing: .08em; }
[class$='-intro-copy'] { color: var(--muted); font-size: var(--fd-font-size-body); }
.hero-week-stat .value { font-weight: 500; color: var(--fd-accent); }
.hero-week-stat { padding: 0 20px; border-left: 1px solid var(--border); }
.hero-week-stat:first-child { padding-left: 0; border-left: 0; }
.hero-week-stat:last-child { padding-right: 0; }
.hero-ref strong { color: var(--text); font-weight: 500; }
.home-status.ready::before { background: var(--green); }
.home-status.health-context.ready::before { background: var(--fd-viz-health); }
.xp-card { background: var(--fd-viz-gamification-surface); }
.xp-level, .xp-head, .xp-earned { color: var(--purple); }
.xp-fill { background: var(--purple); }
.xp-bar { background: var(--fd-surface-raised); }
.next-focus-main { font: 500 28px/1.15 var(--fd-font-display); }
.next-kicker { color: var(--muted); text-transform: none; letter-spacing: 0; }
/* Routine split: next routine with per-exercise prescription and last result. */
.split-after { margin: -6px 0 12px; color: var(--muted); font-size: var(--fd-font-size-meta); }
.split-list { border-top: 1px solid var(--border); }
.split-ex {
  width: 100%; min-height: 44px; display: flex; align-items: flex-start; gap: 10px;
  padding: 11px 0; border: 0; border-top: 1px solid var(--border); background: none;
  color: var(--text); text-align: left; font: inherit;
}
.split-ex:first-child { border-top: 0; }
button.split-ex { cursor: pointer; }
button.split-ex:active { opacity: 0.6; }
.split-ex-spacer { visibility: hidden; }
.split-ex-main { flex: 1; min-width: 0; }
.split-ex-top { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.split-ex-name { min-width: 0; font-size: var(--fd-font-size-body); overflow-wrap: anywhere; }
.split-ex-plan {
  flex-shrink: 0; color: var(--text); font-size: var(--fd-font-size-body); font-weight: 500;
  font-variant-numeric: tabular-nums; white-space: nowrap;
}
.split-ex-last {
  margin-top: 3px; color: var(--muted); font-size: var(--fd-font-size-meta);
  font-variant-numeric: tabular-nums;
}
.next-plan-action { margin-top: 14px; }
.next-plan-action .btn { width: 100%; }
.session-plan-intro { margin-bottom: 18px; }
.session-plan-intro h1 { margin: 4px 0 8px; }
.session-plan-intro p { max-width: 60ch; color: var(--muted); }
.session-plan-focus { margin-top: 10px; color: var(--fd-accent); font-size: var(--fd-font-size-body); font-weight: 500; }
.session-plan-picker { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: end; }
.session-plan-picker label { grid-column: 1 / -1; font-size: var(--fd-font-size-body); font-weight: 500; }
.session-plan-picker input {
  width: 100%; min-width: 0; min-height: 44px; padding: 10px 12px;
  background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: 6px;
  font-size: var(--fd-font-size-input);
}
.session-plan-picker .btn { min-width: 92px; }
.session-plan-feedback { margin-top: 7px; color: var(--muted); font-size: var(--fd-font-size-meta); }
.session-plan-feedback:empty { display: none; }
.session-plan-feedback.error { color: var(--orange); }
.session-plan-list { display: grid; gap: 0; }
.session-plan-empty { padding: 12px 0; color: var(--muted); }
.session-plan-exercise { padding: 16px 0; border-top: 1px solid var(--border); }
.session-plan-exercise:first-child { border-top: 0; padding-top: 0; }
.session-plan-exercise-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.session-plan-exercise-title { min-width: 0; color: var(--text); font-size: 16px; font-weight: 550; overflow-wrap: anywhere; }
.session-plan-exercise-meta { color: var(--muted); font-size: var(--fd-font-size-meta); line-height: 1.4; }
.session-plan-remove {
  flex: 0 0 auto; min-width: 44px; min-height: 44px; border: 0; background: transparent;
  color: var(--muted); cursor: pointer; font: inherit; text-decoration: underline; text-underline-offset: 3px;
}
.session-plan-controls { display: flex; align-items: center; gap: 12px; margin-top: 10px; }
.session-plan-controls button {
  width: 44px; height: 44px; border: 1px solid var(--border); border-radius: 6px;
  background: var(--surface); color: var(--text); cursor: pointer; font-size: 21px;
}
.session-plan-count { min-width: 88px; text-align: center; font-variant-numeric: tabular-nums; }
.session-plan-count strong { display: block; color: var(--text); font-size: 20px; font-weight: 500; line-height: 1.15; }
.session-plan-count span { color: var(--muted); font-size: var(--fd-font-size-label); }
/* Plain buttons are neutral; only explicit primary/recovery actions use sage. */
.btn {
  min-height: 44px; background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: 6px; font-weight: 500;
}
.btn:hover { background: var(--fd-surface-raised); color: var(--text); }
.btn.primary, .btn-primary, .error-action {
  min-height: 44px; background: var(--fd-action-primary); color: var(--fd-action-primary-text);
  border: 1px solid transparent; border-radius: 6px; font-weight: 500;
}
.btn.primary:hover, .btn-primary:hover, .error-action:hover { background: var(--fd-action-primary-hover); color: var(--fd-action-primary-text); }
.btn.danger { background: var(--surface); color: var(--fd-feedback-danger); border-color: var(--fd-feedback-danger); }
.btn.danger:hover { background: var(--fd-surface-raised); color: var(--fd-feedback-danger); }
.btn-ghost, .btn.secondary { background: var(--surface); color: var(--text); border: 1px solid var(--border); }
/* Pagination stays a quiet divider row rather than a filled button. */
.btn.log-more, .pr-more {
  width: 100%; min-height: 44px; margin-top: 12px; padding: 12px 2px;
  background: none; border: 0; border-top: 1px solid var(--border); border-radius: 0;
  color: var(--text); font-size: var(--fd-font-size-body); font-weight: 500;
}
.btn.log-more:hover, .pr-more:hover { background: none; color: var(--fd-accent); }
.detail-back { color: var(--muted); padding-bottom: 0; margin-bottom: 12px; }
.detail-back:hover, .workout-detail-link:hover { color: var(--fd-accent); }
.lw-stat { background: none; border-radius: 0; text-align: left; padding: 4px 14px; border-left: 1px solid var(--border); min-width: 0; }
.lw-stat:first-child { border-left: 0; padding-left: 0; }
.lw-stat .v { font: var(--fd-font-weight-medium) var(--fd-font-size-operational)/var(--fd-line-height-value) var(--fd-font-interface); }
.lw-stat .l { letter-spacing: .04em; }
.workout-detail-summary .lw-stats, .workout-health .lw-stats { gap: 0; }
.workout-detail-link { border-top: 1px solid var(--border); margin-top: 16px; }
.workout-detail-link-title { font-weight: 500; }
.lw-set { background: var(--fd-surface-raised); border: 0; border-radius: 4px; }
.lw-ex { padding: 16px 0; }
.lw-ex-name { font-size: 16px; }
.seg { border: 1px solid var(--border); background: transparent; border-radius: 6px; }
.seg-btn { border-radius: 4px; min-height: 40px; }
.seg-btn.active, .sort-btn.active { background: var(--fd-action-primary); color: var(--fd-action-primary-text); }
.m-search, .settings-input, .settings-select, input, select { background: var(--surface); color: var(--text); border-color: var(--border); border-radius: 6px; }
input::placeholder { color: var(--muted); opacity: 1; }
.wk-delta.up, .trend-chip.up, .pr-gain { color: var(--fd-positive); }
.wk-delta.flat { color: var(--muted); }
/* A decline is information, not an error: neutral text, with the sign carrying direction. Danger stays for destructive actions and form errors. */
.wk-delta.down { color: var(--fd-text-secondary); }
.trend-chip.down { background: var(--fd-surface-raised); color: var(--fd-text-secondary); }
#sec-log .log-card { background: transparent; border: 0; padding: 0; }
#sec-log .log-row { padding: 22px 0; min-height: 100px; }
.log-title { white-space: normal; overflow-wrap: anywhere; font-weight: 500; font-size: 16px; }
.log-day { font: 500 30px/1 var(--fd-font-display); }
.log-month { font: var(--fd-font-weight-medium) var(--fd-font-size-heading)/var(--fd-line-height-heading) var(--fd-font-display); letter-spacing: -.02em; color: var(--text); margin: 28px 0 10px; }
.log-performance { padding-left: 12px; border-left: 1px solid var(--border); }
.log-meta { font-size: var(--fd-font-size-meta); }

.workout-health-title, .health-card h3 { color: var(--text); }
.workout-health-note, .workout-detail-meta, .workout-health-source,
.health-source-note, .health-loading, .health-metric-note { color: var(--muted); }
.health-metric .value { color: var(--blue); }
.health-period-btn.active { background: var(--fd-action-primary); color: var(--fd-action-primary-text); }
/* Health follows the shared editorial headings and flat operational stats. */
#sec-health .card > .card-head h2, #sec-health .health-trends-head h2 {
  font: var(--fd-font-weight-medium) var(--fd-font-size-heading)/var(--fd-line-height-heading) var(--fd-font-display); letter-spacing: -.025em;
}
.health-metric-value { font: var(--fd-font-weight-medium) var(--fd-font-size-operational)/var(--fd-line-height-value) var(--fd-font-interface); }
.health-overview-region ~ .health-overview-region { margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--border); }
.health-metric-label, .health-time-row, .health-stage-head { font-size: var(--fd-font-size-body); }
.health-sleep-total-value { font: 500 40px/1.15 var(--fd-font-interface); }
.health-personal-context > span { display: block; }
.health-personal-context > .health-metric-note { font-size: var(--fd-font-size-label); }
.health-explainer { color: var(--muted); font-size: var(--fd-font-size-body); line-height: 1.5; }
.health-explainer summary, .health-goal-settings summary {
  min-height: 44px; display: flex; align-items: center; gap: 12px; cursor: pointer;
  list-style: none;
}
.health-explainer summary::-webkit-details-marker, .health-goal-settings summary::-webkit-details-marker { display: none; }
.health-explainer summary::after, .health-goal-settings summary::after { content: '›'; margin-left: auto; font-size: 20px; }
.health-explainer[open] summary::after, .health-goal-settings[open] summary::after { transform: rotate(90deg); }
.health-explainer p { margin: 4px 0 12px; }
.health-goal-settings { margin-top: 12px; padding-top: 8px; border-top: 1px solid var(--border); }
.health-goal-settings summary { font-size: var(--fd-font-size-body); }
.health-goal-settings summary span { margin-left: auto; color: var(--muted); font-variant-numeric: tabular-nums; }
.health-goal-settings summary::after { margin-left: 0; }
.health-sleep-goal { display: grid; grid-template-columns: 90px minmax(0, 1fr); padding-top: 0; margin-top: 8px; border: 0; }
.health-sleep-goal label, #health-sleep-goal-feedback { grid-column: 1 / -1; }
#health-sleep-goal-feedback:empty { display: none; }
.health-insight-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 12px; }
.health-insight-head h3 { color: var(--text); font-size: var(--fd-font-size-body); font-weight: 500; }
.health-shortfall { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 14px; border-top: 1px solid var(--border); }
.health-shortfall .health-metric-value { flex-shrink: 0; }
.health-shortfall .health-metric-label { margin-top: 0; }
#sec-health .health-stage-fill { background: var(--blue); }
@media (max-width: 560px) {
  .health-trend-panel .card-head { flex-direction: column; gap: 4px; }
  #sec-health .health-chart-meta { max-width: none; text-align: left; }
  .health-trends-head { align-items: center; gap: 10px; }
  .health-trends-copy { max-width: 130px; }
  .health-metric { padding-right: 12px; padding-left: 12px; }
  .health-shortfall { align-items: flex-start; }
  .session-plan-picker { grid-template-columns: minmax(0, 1fr); }
  .session-plan-picker .btn { width: 100%; }
}
#sec-settings .settings-row { border-color: var(--border); }
:where(a, button, input, select, textarea, [tabindex]):focus-visible { outline: 2px solid var(--fd-border-focus); outline-offset: 3px; box-shadow: none; }
@media (max-width: 820px) {
  header { height: calc(64px + env(safe-area-inset-top)); padding: env(safe-area-inset-top) 18px 0; }
  .jumpbar {
    position: fixed; top: auto; bottom: 0; left: 0; right: 0;
    height: calc(68px + env(safe-area-inset-bottom)); padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
    max-width: none; margin: 0; border: 0; border-top: 1px solid #353b35; border-radius: 0;
    background: var(--fd-nav-background); backdrop-filter: none; -webkit-backdrop-filter: none;
    gap: 0; overflow: visible;
  }
  .jump-btn { display: flex; flex: 1; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
    min-width: 0; padding: 4px 0; min-height: 44px; color: var(--fd-nav-text); font-size: var(--fd-font-size-label); border-radius: 4px; }
  .jump-btn.active { color: var(--fd-nav-accent); background: transparent; }
  .jump-btn:focus-visible { outline-color: var(--fd-nav-accent); outline-offset: -2px; }
  .card, .hero-week { padding: 16px; }
  .card h2, #sec-home .card h2, #sec-detail .card h2,
  #sec-activity .activity-card h2, #sec-strength .stats-chart-card h2,
  #sec-exercises .lifts-card h2, #ex-detail-card .exercise-overview-head h2 { font-size: var(--fd-font-size-heading-mobile); }
  .workout-detail-title-row { align-items: flex-start; flex-wrap: wrap; }
  #sec-home .xp-card { padding: 12px 16px; }
}
@media (max-width: 560px) {
  .hero-week-stat { padding: 4px 12px; }
  .hero-week-stat:nth-child(n+3) { border-color: var(--border); }
  .lw-stats:not(.cols-2):not(.cols-3) { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0; }
  .lw-stat:nth-child(odd), :is(#last-workout-content, #monthly-recap-teaser) .lw-stat:nth-child(odd) { padding-left: 0; border-left: 0; }
  .lw-stat:nth-child(even), :is(#last-workout-content, #monthly-recap-teaser) .lw-stat:nth-child(even) { padding-right: 0; }
  .lw-stat:nth-child(n+3), :is(#last-workout-content, #monthly-recap-teaser) .lw-stat:nth-child(n+3) { padding-top: 16px; margin-top: 12px; border-top: 1px solid var(--border); }
  .hero-week-stat .value { font-size: 2.6rem; }
  #sec-log .log-row { grid-template-columns: 36px minmax(0,1fr) auto 8px; gap: 8px; padding: 18px 0; }
  #sec-log .log-date { width: 36px; }
  .log-title { font-size: var(--fd-font-size-body); }
  .log-performance { padding-left: 8px; }
  .log-performance .xp-earned { font-size: 18px; }
  .next-focus { flex-wrap: wrap; }
  .health-chart-meta { max-width: none; }
}
@media (min-width: 821px) {
  body { padding-left: 184px; }
  header { height: 64px; padding: 0 28px; justify-content: flex-end; }
  header .brand-home { display: none; }
  .jumpbar, .jumpbar.detail-mode {
    position: fixed; top: 0; bottom: 0; left: 0; width: 184px; height: 100dvh;
    display: flex; flex-direction: column; justify-content: flex-start; gap: 6px;
    margin: 0; padding: 22px 12px; border: 0; border-right: 1px solid #202622; border-radius: 0;
    background: var(--fd-nav-background); backdrop-filter: none; -webkit-backdrop-filter: none;
  }
  .rail-brand { display: block; min-height: 44px; text-align: left; margin-bottom: 28px; padding: 0 12px;
    color: #fffaf1; border: 0; background: transparent; cursor: pointer; }
  .jump-btn { display: flex; align-items: center; justify-content: flex-start; gap: 12px;
    flex: 0 0 auto; min-height: 48px; padding: 0 12px; font-size: var(--fd-font-size-body); color: var(--fd-nav-text); border-radius: 5px; }
  .jump-btn.active { color: #fffaf1; background: var(--fd-nav-active); box-shadow: inset 2px 0 var(--fd-nav-accent); }
  .jump-btn.active svg { color: var(--fd-nav-accent); }
  .jump-btn:hover { background: var(--fd-nav-active); }
  .jump-btn:focus-visible, .rail-brand:focus-visible { outline-color: var(--fd-nav-accent); }
  main { width: min(100%, 1280px); margin: 0 auto; padding: 28px 28px 64px; }
  section.sec.active { max-width: none; }
  #sec-home.active { display: block; }
  #sec-home > .home-intro { padding-bottom: 22px; }
  #sec-home .home-columns { display: grid; grid-template-columns: minmax(0,1.05fr) minmax(0,1fr); gap: 18px; align-items: start; }
  #sec-home .home-primary, #sec-home .home-secondary { min-width: 0; }
  #sec-home .home-columns .card { margin-top: 0; margin-bottom: 18px; }
  #sec-home > .xp-card { padding: 14px 20px; }
  .xp-card .xp-track { grid-template-columns: minmax(180px, 260px) minmax(0, 1fr); align-items: center; }
  .xp-card .xp-head { display: flex; flex-wrap: wrap; }
  .hero-week-stat .value { font-size: var(--fd-font-size-hero); }
  .card, .hero-week { border-radius: 6px; padding: 20px; }
  #sec-log, #sec-detail { max-width: 1000px; margin: 0 auto; }
}
@media (min-width: 821px) and (max-width: 1100px) {
  #sec-home .home-columns { grid-template-columns: minmax(0,1fr); gap: 0; }
}

.home-primary, .home-secondary { min-width: 0; }

/* Recaps share the workout summary typography and disclosure controls. */
.monthly-recap-teaser-highlight[hidden] { display: none; }
.monthly-recap-month-control { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 10px; margin-top: 14px; }
.monthly-recap-month-control label { color: var(--muted); font-size: var(--fd-font-size-body); }
.monthly-recap-month-picker { display: grid; grid-template-columns: 44px minmax(0, 1fr) 44px; gap: 6px; }
.monthly-recap-step { min-height: 44px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface); color: var(--text); font-size: 22px; line-height: 1; cursor: pointer; }
.monthly-recap-step:disabled { color: var(--muted); opacity: 0.45; cursor: default; }
#monthly-recap-month { width: 100%; min-width: 0; min-height: 44px; padding: 8px 12px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font-size: var(--fd-font-size-input); }
#sec-monthly-recap .lw-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0; }
#sec-monthly-recap .lw-stat .v { overflow-wrap: anywhere; }
.monthly-recap-level { margin-top: 14px; color: var(--muted); font-size: var(--fd-font-size-body); }
.monthly-recap-level strong { color: var(--purple); font-weight: 500; }
.monthly-recap-note { margin-top: 12px; margin-bottom: 0; }
.monthly-recap-week-list { display: grid; gap: 14px; }
.monthly-recap-week-row { display: grid; grid-template-columns: 64px minmax(0, 1fr) 82px; align-items: center; gap: 10px; }
.monthly-recap-week-label { color: var(--muted); font-size: var(--fd-font-size-body); }
.monthly-recap-week-track { height: 7px; overflow: hidden; border-radius: 999px; background: var(--fd-surface-raised); }
.monthly-recap-week-fill { height: 100%; border-radius: inherit; background: var(--green); }
.monthly-recap-week-count { color: var(--text); font-size: var(--fd-font-size-body); font-variant-numeric: tabular-nums; text-align: right; }
.monthly-recap-comparison .lw-stats { margin-bottom: 0; }
.monthly-delta-zero { color: var(--muted); }
@media (min-width: 561px) {
  #sec-monthly-recap .lw-stat:nth-child(3n + 1) { padding-left: 0; border-left: 0; }
  #sec-monthly-recap .lw-stat:nth-child(3n) { padding-right: 0; }
  #sec-monthly-recap .lw-stat:nth-child(n+4) { margin-top: 12px; padding-top: 16px; border-top: 1px solid var(--border); }
}
@media (min-width: 821px) {
  #sec-monthly-recap { max-width: 1000px; margin: 0 auto; }
}
@media (max-width: 560px) {
  #sec-monthly-recap .lw-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .monthly-recap-month-control { grid-template-columns: minmax(0, 1fr); gap: 4px; }
  .monthly-recap-week-row { grid-template-columns: 54px minmax(0, 1fr) 76px; gap: 8px; }
  #sec-monthly-recap .card-head { flex-wrap: wrap; align-items: flex-start; }
  #sec-monthly-recap .activity-chart-meta { text-align: left; }
}
/* Literal inline colors in older components must also retain readable theme roles. */
.home-status.stale, .home-status.error, .health-error-title, .health-coverage-status.error { color: var(--orange); }
.health-coverage-status.ready { color: var(--fd-positive); }

.muscles-worked-title { font-size: var(--fd-font-size-body); font-weight: 500; text-transform: none; letter-spacing: 0; }
.wk-target-track { display: block; height: 5px; border-radius: 3px; background: var(--fd-surface-raised); margin: 8px 0 0 16px; max-width: 240px; }

.strength-level-overview-list { min-width: 0; }
.strength-level-overview-empty { min-height: 44px; display: flex; align-items: center; color: var(--muted); font-size: var(--fd-font-size-body); }
.strength-level-overview-row {
  width: 100%; min-height: 64px; display: grid; grid-template-columns: minmax(0, 1fr) auto 10px; align-items: center; gap: 10px;
  padding: 10px 2px; border: 0; border-top: 1px solid var(--border); border-radius: 4px;
  background: transparent; color: var(--text); text-align: left; cursor: pointer;
}
.strength-level-overview-row:first-child { border-top: 0; }
.strength-level-overview-row:hover { background: var(--fd-surface-raised); }
.strength-level-overview-exercise { min-width: 0; display: grid; gap: 2px; }
.strength-level-overview-name { color: var(--text); font-size: 15px; font-weight: 500; overflow-wrap: anywhere; }
.strength-level-overview-value { color: var(--muted); font-size: var(--fd-font-size-meta); font-variant-numeric: tabular-nums; }
.strength-level-overview-result { color: var(--fd-accent); font-size: var(--fd-font-size-body); font-weight: 550; text-align: right; white-space: nowrap; }
.strength-level-overview-result.needs-profile { color: var(--muted); font-weight: 500; }
.strength-level-overview-profile {
  width: 100%; min-height: 48px; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-top: 6px; padding: 8px 2px; border: 0; border-top: 1px solid var(--border);
  background: transparent; color: var(--text); text-align: left; font: inherit; font-size: var(--fd-font-size-body); font-weight: 500; cursor: pointer;
}
.strength-level-overview-profile:hover { color: var(--fd-accent); }
@media (max-width: 360px) {
  .strength-level-overview-row { grid-template-columns: minmax(0, 1fr) auto 8px; gap: 7px; }
  .strength-level-overview-result { font-size: var(--fd-font-size-meta); }
}
.wk-target-fill { display: block; height: 100%; border-radius: inherit; }
.wk-row-l { padding-right: 12px; }

@media (max-width: 820px) { .seg-btn { min-height: 44px; } }

/* Three workout facts remain on one row after retiring Workout Score. */
#last-workout-content .lw-stats.workout-summary-stats,
.workout-detail-summary .lw-stats.workout-summary-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
:is(#last-workout-content, .workout-detail-summary) .workout-summary-stats .lw-stat:nth-child(n) {
  margin-top: 0; padding-top: 0; border-top: 0;
}
:is(#last-workout-content, .workout-detail-summary) .workout-summary-stats .lw-stat + .lw-stat {
  padding-left: 12px; border-left: 1px solid var(--border);
}

/* Per-workout XP is the primary reward, with a separate quiet unit label. */
.workout-xp, .log-performance .workout-xp {
  display: flex; flex-direction: column; align-items: flex-end; gap: 4px;
  line-height: 1; margin: 0; flex-shrink: 0;
}
.workout-xp-value { font: 500 26px/1.1 var(--fd-font-interface); font-variant-numeric: tabular-nums; }
.workout-xp-label { font: var(--fd-font-weight-medium) var(--fd-font-size-label)/var(--fd-line-height-value) var(--fd-font-interface); letter-spacing: .05em; }
.workout-detail-title-row .workout-xp-value { font-size: 28px; }
.workout-xp-toggle {
  background: transparent; border: 0; padding: 4px 0 4px 12px;
  min-width: 64px; min-height: 56px; cursor: pointer; color: var(--purple);
}
.workout-xp-toggle:focus-visible { outline: 2px solid var(--fd-accent); outline-offset: 4px; border-radius: 4px; }
.workout-xp-breakdown { margin-top: 16px; padding: 16px 0 0; border-top: 1px solid var(--border); }
.workout-xp-breakdown h2 { margin: 0 0 12px; font-size: 20px; }
.workout-xp-breakdown dl { margin: 0; }
.workout-xp-breakdown dl > div { display: flex; justify-content: space-between; gap: 16px; padding: 7px 0; }
.workout-xp-breakdown dt { color: var(--muted); }
.workout-xp-breakdown dd { margin: 0; color: var(--purple); font-variant-numeric: tabular-nums; white-space: nowrap; }
.workout-xp-breakdown p { margin: 12px 0 0; font-size: var(--fd-font-size-meta); color: var(--muted); }

.monthly-progress-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; width: 100%; min-height: 64px; padding: 14px 0; background: transparent; border: 0; border-top: 1px solid var(--border); color: var(--text); text-align: left; cursor: pointer; }
.monthly-progress-copy { display: grid; min-width: 0; gap: 5px; }
.monthly-progress-name { font-size: 16px; font-weight: 500; overflow-wrap: anywhere; }
.monthly-progress-values, .monthly-balance-previous { color: var(--muted); font-size: var(--fd-font-size-meta); }
.monthly-progress-gain { color: var(--fd-positive); font-size: var(--fd-font-size-body); font-variant-numeric: tabular-nums; }
.monthly-insights-empty, .monthly-insights-note { color: var(--muted); font-size: var(--fd-font-size-body); line-height: 1.5; margin: 0; }
.monthly-insights-note { margin-top: 12px; font-size: var(--fd-font-size-meta); }
.monthly-balance-row + .monthly-balance-row { margin-top: 16px; }
.monthly-balance-head { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 4px 12px; font-size: var(--fd-font-size-body); font-variant-numeric: tabular-nums; }
.monthly-balance-track { height: 6px; background: var(--fd-surface-raised); border-radius: 3px; overflow: hidden; margin-top: 8px; }
.monthly-balance-track > div { height: 100%; border-radius: inherit; }
.monthly-balance-previous { margin-top: 5px; }

/* Achievements live in a collection drilldown; Home keeps one compact entry. */
/* Milestones entry: one quiet row inside the XP strip, below the level bar. */
.ms-home-entry { display: grid; grid-template-columns: minmax(0, 1fr) 12px; gap: 12px; align-items: center; width: 100%; min-height: 44px; margin-top: 12px; padding: 10px 0 0; border: 0; border-top: 1px solid var(--border); background: none; color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.ms-home-entry:disabled { cursor: default; }
.ms-home-entry:focus-visible { outline: 2px solid var(--fd-accent); outline-offset: 3px; }
.ms-home-copy { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; min-width: 0; font-size: var(--fd-font-size-body); }
.ms-home-title { font-weight: 550; }
.ms-home-meta { color: var(--muted); overflow-wrap: anywhere; }
.ms-home-entry:not(:disabled):hover .ms-home-title { color: var(--fd-accent); }

/* Milestones: an "Up next" progress list and a dated timeline. No badge art,
   no category colors; bars keep the shared meanings (purple XP, green progress). */
#sec-achievements { max-width: 760px; margin: 0 auto; }
.achievements-intro { margin-bottom: 20px; }
.achievements-intro h1 { font: 500 30px/1.12 var(--fd-font-display); margin: 7px 0 8px; }
.ms-card { margin-bottom: 16px; }
.ms-card h2 { margin-bottom: 6px; }
.ms-name { font-size: 16px; font-weight: 550; color: var(--text); overflow-wrap: anywhere; }
.ms-meta { display: block; color: var(--muted); font-size: var(--fd-font-size-meta); line-height: 1.45; margin-top: 3px; overflow-wrap: anywhere; }
.ms-next { padding: 14px 0; border-top: 1px solid var(--border); }
.ms-next:first-child { border-top: 0; }
.ms-next-top { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.ms-pct { flex-shrink: 0; font-size: var(--fd-font-size-body); color: var(--muted); font-variant-numeric: tabular-nums; }
.ms-track { height: 5px; border-radius: 3px; background: var(--fd-surface-raised); overflow: hidden; margin-top: 10px; }
.ms-track > span { display: block; height: 100%; border-radius: inherit; }
.ms-month { color: var(--muted); font-size: var(--fd-font-size-label); letter-spacing: .06em; text-transform: uppercase; padding: 18px 0 4px; }
.ms-month:first-child { padding-top: 8px; }
.ms-row { display: grid; grid-template-columns: 44px minmax(0, 1fr) 12px; gap: 14px; align-items: center; width: 100%; min-height: 64px; padding: 12px 0; border: 0; border-top: 1px solid var(--border); background: transparent; color: var(--text); font: inherit; text-align: left; }
button.ms-row { cursor: pointer; }
button.ms-row:hover .ms-name { color: var(--fd-accent); }
.ms-row:focus-visible { outline: 2px solid var(--fd-accent); outline-offset: 2px; }
.ms-month + .ms-row { border-top: 0; }
.ms-date { display: grid; justify-items: center; align-self: start; line-height: 1.05; padding-top: 2px; }
.ms-date > span { font: 500 22px/1 var(--fd-font-display); color: var(--text); }
.ms-date > small { font-size: var(--fd-font-size-label); color: var(--muted); margin-top: 4px; }
.ms-copy { display: grid; gap: 2px; min-width: 0; }
.ms-chevron { color: var(--muted); font-size: 20px; line-height: 1; }
.ms-empty { color: var(--muted); font-size: var(--fd-font-size-body); line-height: 1.5; padding: 8px 0 4px; }

/* Accessible Activity calendar buttons. */
button.minical-cell, button.heatmap-cell {
  appearance: none; border: 0; padding: 0; font-family: inherit;
}
button.heatmap-cell { display: block; flex-shrink: 0; }

/* Quiet, non-interactive parent endorsement (Foundry 2); no Foundry URL exists yet. */
.foundry-signature {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  margin: 0; color: var(--fd-text-secondary); font-size: var(--fd-font-size-label);
}
.settings-foot { display: flex; justify-content: center; margin-top: 40px; }
.settings-card .settings-sync-row .btn { display: inline-flex; align-items: center; text-decoration: none; flex: none; }
.foundry-signature img { width: 24px; height: 24px; }

/* Foundry geometry: fields, filter controls, calendar cells and empty-state frames use 6px; small status chips use 4px. */
.key-input-wrap input, .profile-field input, .profile-field select,
.mg-btn, .minical-cell,
.activity-chart-empty, .stats-chart-empty, .health-chart-empty { border-radius: 6px; }
.trend-chip { border-radius: 4px; }
/* Foundry 2 iOS home-screen top clearance: iOS blurs about 30-40pt below the status bar even under this opaque sticky header.
   Start the mobile header row 24px lower in iOS standalone mode only; browser tabs, desktop installed apps and the rail layout are unchanged. */
@media (display-mode: standalone) and (max-width: 820px) {
  @supports (-webkit-touch-callout: none) {
    header { height: calc(64px + env(safe-area-inset-top) + 24px); padding-top: calc(env(safe-area-inset-top) + 24px); }
  }
}
