/* athlib app styles. Tokens live in tokens.css (from the design handoff). */

html, body { height: 100%; }
body { overscroll-behavior: none; }
input, textarea, select { color: var(--ink); }
input::placeholder, textarea::placeholder { color: var(--muted); }
button:disabled { cursor: default; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------------------------------------------------------------- frame */

.app {
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --tabbar-h: calc(56px + max(var(--safe-bottom), 10px));
  position: relative;
  height: 100vh;
  height: 100dvh;
  max-width: var(--col-max);
  margin: 0 auto;
  overflow: hidden;
  background: var(--bg);
}

/* Desktop: the app in a phone-sized frame; real phones never match this. */
@media (min-width: 900px) {
  body { display: grid; place-items: center; min-height: 100vh; background: #18181b; }
  .app {
    width: 390px; height: 844px; max-width: none; margin: 0;
    border-radius: 44px;
    box-shadow: 0 0 0 10px #0a0a0c, 0 30px 80px rgba(0, 0, 0, .4);
  }
}

.splash {
  position: absolute; inset: 0; z-index: var(--z-splash);
  display: grid; place-items: center; background: var(--bg);
}
.wordmark { font-size: 44px; font-weight: 700; letter-spacing: -0.04em; }
.wordmark span { color: var(--accent); }

/* ---------------------------------------------------------------- screens */

.tab-screen {
  position: absolute; left: 0; right: 0; top: 0; bottom: var(--tabbar-h);
  overflow-y: auto; scrollbar-width: none;
  padding: calc(var(--safe-top) + 12px) var(--page-x) 28px;
}
.tab-screen::-webkit-scrollbar { display: none; }

.flow {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  background: var(--bg); padding-top: var(--safe-top); z-index: 2;
}
.flow-head { display: flex; align-items: center; gap: 8px; padding: 4px 12px; }
.flow-back { width: 44px; height: 44px; border-radius: 22px; font-size: 26px; display: grid; place-items: center; }
.flow-back:disabled { opacity: .3; }
.flow-title { flex: 1; text-align: center; font-weight: 600; font-size: 16px; }
.flow-step { width: 44px; font-size: var(--fs-caption); color: var(--muted); text-align: right; }
.flow-dots { display: flex; gap: 4px; padding: 0 20px; }
.flow-dots span { flex: 1; height: 4px; border-radius: 2px; background: var(--line); }
.flow-dots span.on { background: var(--accent); }
.flow-body {
  flex: 1; overflow-y: auto; scrollbar-width: none;
  padding: 22px var(--flow-x) 20px; display: flex; flex-direction: column; gap: 16px;
}
.flow-body::-webkit-scrollbar { display: none; }
.flow-body > *, .sheet-body > * { flex-shrink: 0; }
.flow-foot {
  padding: 12px var(--flow-x) calc(18px + max(var(--safe-bottom), 12px));
  border-top: 1px solid var(--line); background: var(--bg);
  display: flex; flex-direction: column; gap: 4px;
}
.flow-center { flex: 1; display: flex; flex-direction: column; justify-content: center; gap: 16px; padding: 0 40px; text-align: center; }

h1, h2, h3 { margin: 0; }
.display { font-size: var(--fs-display); font-weight: 600; letter-spacing: -0.02em; line-height: 1.15; text-wrap: pretty; }
.hero { font-size: var(--fs-hero); font-weight: 700; letter-spacing: -0.025em; line-height: 1.1; }
.tab-title { font-size: var(--fs-tab-title); font-weight: 600; letter-spacing: -0.02em; }
.lead { margin: 0; font-size: var(--fs-small); color: var(--muted); text-wrap: pretty; }
.body-2 { margin: 0; font-size: var(--fs-body); color: var(--ink-2); text-wrap: pretty; }
.muted { color: var(--muted); }
.small { font-size: var(--fs-caption); }
.micro { font-size: var(--fs-micro); }
.eyebrow { font-size: 12px; font-weight: 700; color: var(--accent-ink); letter-spacing: .08em; text-transform: uppercase; }
.center { text-align: center; }
.divider { height: 1px; background: var(--line); margin: 8px 0; }
.stack { display: flex; flex-direction: column; gap: 8px; }
.stack-12 { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; align-items: center; gap: 8px; }
.spacer { flex: 1; }
.mt4 { margin-top: 4px; }
.good { color: var(--good); }
.bad { color: var(--bad-ink); }

/* ---------------------------------------------------------------- buttons */

.btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; text-align: center; font-weight: 600;
  transition: opacity var(--dur-quick);
}
.btn:disabled { opacity: .45; }
.btn-primary { height: var(--btn-primary-h); border-radius: var(--r-button); background: var(--cta); color: var(--cta-ink); font-size: 16px; }
.btn-secondary { height: var(--btn-secondary-h); border-radius: var(--r-input); background: var(--surface); border: 1px solid var(--line); }
.btn-quiet { height: 46px; border-radius: var(--r-input); color: var(--ink-2); }
.btn-danger { height: 46px; border-radius: var(--r-input); color: var(--bad-ink); }
.btn-danger-fill { height: var(--btn-secondary-h); border-radius: var(--r-input); background: var(--bad-ink); color: var(--bg); }
.btn-tonal { height: 48px; border-radius: 13px; background: var(--surface-2); }
.btn-small { height: 48px; border-radius: 13px; font-size: 15px; }
.btn-inline { width: auto; padding: 0 22px; height: 48px; border-radius: var(--r-input); }
.btn-pill { width: auto; height: 44px; padding: 0 16px; border-radius: 22px; background: var(--cta); color: var(--cta-ink); font-size: 14px; }
.btn-pair { display: grid; grid-template-columns: 1fr 2fr; gap: 8px; }
.btn-pair-even { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.icon-btn {
  width: 44px; height: 44px; flex: none; border-radius: 22px;
  background: var(--surface); border: 1px solid var(--line);
  display: grid; place-items: center; font-size: 22px; line-height: 1;
}
.icon-btn:disabled { opacity: .35; }
.dots3 { display: flex; gap: 3px; }
.dots3 span { width: 4px; height: 4px; border-radius: 2px; background: var(--ink); }
.link-btn { height: 32px; font-size: 13px; font-weight: 600; color: var(--accent-ink); }

/* ---------------------------------------------------------------- inputs */

.field { display: flex; flex-direction: column; gap: 6px; font-size: 14px; font-weight: 600; }
.field-label { font-size: 14px; font-weight: 600; }
.field-help { font-size: 13px; color: var(--muted); font-weight: 400; text-wrap: pretty; }
.input, .field input:not([type=checkbox]), .field textarea {
  height: var(--input-h); border-radius: var(--r-input); border: 1px solid var(--line);
  background: var(--surface); padding: 0 14px; font-size: 16px; font-weight: 500;
  outline: none; width: 100%;
}
.field textarea { height: auto; padding: 12px 14px; font-size: 15px; font-weight: 400; resize: none; font-family: inherit; }
.input:focus, .field input:focus, .field textarea:focus { border-color: var(--ink-2); }
.input-big { height: 60px !important; font-size: 26px !important; font-weight: 600 !important; }
.input-huge { height: 64px !important; font-size: 32px !important; font-weight: 600 !important; letter-spacing: -0.02em; }
.input-short { width: 110px !important; }
.field input[readonly] { background: transparent; border-style: dashed; color: var(--ink-2); }
.input-unit { display: flex; align-items: center; gap: 10px; }
.input-unit .unit { color: var(--muted); font-weight: 400; }
.error-line { font-size: 14px; color: var(--bad-ink); }
/* Above the button, where it's seen even when the form scrolls past the fold. */
.flow-foot .error-line { margin-bottom: 8px; text-align: center; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips-grid { display: grid; gap: 8px; }
.chip {
  height: 44px; padding: 0 14px; border-radius: var(--r-chip); border: 1px solid var(--line);
  background: var(--surface); color: var(--ink); font-size: 14px; font-weight: 600;
  white-space: nowrap; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
}
.chips-lg .chip { height: 56px; border-radius: 16px; font-size: 20px; }
.chips-sheet .chip { background: var(--bg); }
.chip.on { background: var(--cta); color: var(--cta-ink); }
.chip:disabled { opacity: .4; }
.chip-dot { width: 10px; height: 10px; border-radius: 5px; flex: none; }
.chip-dot.ring { background: none; border: 2px solid; }
.chip.on .chip-dot.ring { border-color: currentColor !important; }
.chips-scroll { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.chips-scroll .chip { flex: none; }

.segmented { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; background: var(--surface-2); border-radius: var(--r-input); padding: 4px; }
.segmented button { height: 44px; border-radius: 11px; font-weight: 600; font-size: 14px; color: var(--muted); text-align: center; }
.segmented button.on { background: var(--surface); color: var(--ink); }

.legend-chip { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 10px 0 8px; border-radius: 15px; background: var(--surface); border: 1px solid var(--line); font-size: 13px; }

.stepper {
  display: grid; grid-template-columns: 48px 1fr 48px; gap: 6px; align-items: center;
  background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 5px;
}
.stepper > button { height: 44px; border-radius: 12px; background: var(--surface-2); font-size: 20px; text-align: center; }
.stepper > button:disabled { opacity: .4; }
.stepper-val { display: flex; align-items: baseline; justify-content: center; gap: 4px; }
.stepper-val b { font-size: 22px; font-weight: 600; }
.stepper-val input { width: 76px; border: 0; background: none; text-align: right; font-size: 24px; font-weight: 600; outline: none; padding: 0; }
.stepper-val .unit { color: var(--muted); }

.option-card {
  display: grid; grid-template-columns: minmax(0, 1fr) 24px; gap: 12px; align-items: start;
  padding: 16px; border-radius: var(--r-row); background: var(--surface); border: 1.5px solid var(--line);
}
.option-card.on { border-color: var(--ink); }
.oc-text { display: flex; flex-direction: column; gap: 4px; }
.oc-badge { align-self: flex-start; padding: 3px 9px; border-radius: 999px; background: var(--cta); color: var(--cta-ink); font-size: 12px; font-weight: 600; }
.oc-title { font-size: var(--fs-heading); font-weight: 600; }
.oc-desc { font-size: 14px; color: var(--muted); text-wrap: pretty; }
.oc-radio { width: 22px; height: 22px; border-radius: 11px; border: 2px solid var(--line); display: grid; place-items: center; }
.option-card.on .oc-radio { border-color: var(--ink); }
.oc-radio span { width: 10px; height: 10px; border-radius: 5px; }
.option-card.on .oc-radio span { background: var(--ink); }
.option-card.disabled {
  border-style: dashed; color: var(--muted); background: none;
  grid-template-columns: minmax(0, 1fr) auto; align-items: center;
}
.soon-pill { font-size: 12px; font-weight: 600; background: var(--surface-2); padding: 4px 9px; border-radius: 10px; }

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

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card); padding: 16px; }
.card-row { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-row); padding: 14px; }
.inset { background: var(--surface-2); border-radius: 16px; padding: 12px 14px; font-size: 14px; line-height: 1.4; color: var(--ink-2); text-wrap: pretty; }
.good-card { background: var(--good-bg); border-radius: 16px; padding: 14px 16px; }
.stats { display: grid; gap: 8px; }
.stats-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.stats-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.stat-l { font-size: 11px; color: var(--muted); }
.stat-v { font-size: 17px; font-weight: 600; }
.stats-big .stat-l { font-size: 12px; }
.stats-big .stat-v { font-size: 20px; }
.stat-s { font-size: 11px; font-weight: 600; }

.notice { display: flex; gap: 8px; align-items: flex-start; border-radius: 14px; padding: 12px 6px 12px 14px; font-size: 14px; line-height: 1.4; }
.notice-body { flex: 1; text-wrap: pretty; padding-right: 8px; }
.notice-title { font-weight: 600; margin-bottom: 2px; }
.notice-hint { background: var(--surface-2); color: var(--ink-2); border-radius: 16px; }
.notice-warn { background: var(--warn-bg); color: var(--warn-ink); }
.notice-strong { background: var(--bad-bg); color: var(--bad-ink); }
.notice-x { width: 32px; height: 32px; flex: none; border-radius: 16px; font-size: 18px; color: var(--muted); display: grid; place-items: center; margin-top: -6px; }
.notice-warn .notice-x, .notice-strong .notice-x { color: inherit; }

.tag { font-size: var(--fs-tag); font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); border: 1px solid var(--line); border-radius: 6px; padding: 2px 6px; flex: none; }
.mono-pill { font: 500 13px var(--font-mono); color: var(--ink); background: var(--surface); border: 1px solid var(--line); padding: 3px 8px; border-radius: 7px; white-space: nowrap; }
.mono { font-family: var(--font-mono); font-weight: 500; }

.marker {
  border-radius: 50%; color: var(--on-type); display: grid; place-items: center;
  font-weight: 700; flex: none;
}
.marker-dashed { border: 1.5px dashed var(--muted); }

.profile { display: flex; align-items: flex-end; gap: 1.5px; width: 100%; }
.profile > span { border-radius: 2px; min-width: 1px; }
.profile-lg { gap: 2px; }
.profile-lg > span { border-radius: 3px; }

/* ---------------------------------------------------------------- program */

.top-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 4px 0 6px; }
.top-bar .eyebrow-plain { font-size: 13px; color: var(--muted); }
.top-bar .name { font-size: 22px; font-weight: 600; line-height: 1.2; letter-spacing: -0.015em; text-wrap: balance; }
.sync-line { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-2); padding: 2px 0 14px; }
.sync-dot { width: 8px; height: 8px; border-radius: 4px; background: var(--good); flex: none; }
.sync-dot.off { background: var(--muted); }
.sync-dot.busy { background: var(--accent); animation: pulse 1s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .3; } }
.spinner { display: block; width: 22px; height: 22px; margin: 0 auto 10px; border-radius: 50%; border: 2.5px solid var(--line); border-top-color: var(--accent); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.sync-fail {
  display: flex; align-items: center; gap: 12px; background: var(--warn-bg); color: var(--ink-2);
  border-radius: 16px; padding: 12px 12px 12px 14px; margin: 2px 0 14px; font-size: 13px; line-height: 1.35;
}
.sync-fail > span { flex: 1; min-width: 0; }
.sf-text b { display: block; font-size: 14px; font-weight: 600; color: var(--ink); }
.sync-fail button { height: 44px; padding: 0 16px; border-radius: 22px; background: var(--ink); color: var(--bg); font-weight: 600; font-size: 14px; flex: none; }

.install-hint { display: flex; gap: 12px; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 10px 4px 10px 10px; margin-bottom: 12px; }
.app-icon { width: 42px; height: 42px; border-radius: 11px; background: var(--cta); color: var(--cta-ink); display: grid; place-items: center; font-size: 24px; font-weight: 700; flex: none; letter-spacing: -0.03em; }
.install-hint .text { flex: 1; font-size: 13px; line-height: 1.35; color: var(--ink-2); }
.install-hint .text b { display: block; color: var(--ink); font-weight: 600; }

.hatch { background: repeating-linear-gradient(135deg, var(--muted) 0 1.5px, var(--surface-2) 1.5px 4.5px); }
.week-strip { background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 12px 12px 6px; }
.ws-head { display: flex; justify-content: space-between; align-items: center; font-size: 12px; color: var(--muted); padding: 0 2px 12px; }
.ws-legend { display: flex; align-items: center; gap: 6px; }
.ws-legend i { width: 12px; height: 12px; border-radius: 3px; }
.ws-grid { display: grid; gap: 5px; }
.ws-col { display: flex; flex-direction: column; align-items: stretch; gap: 4px; min-width: 0; }
.ws-slot { height: 64px; display: flex; align-items: flex-end; padding: 0 1px; }
.ws-bar { position: relative; display: block; width: 100%; border-radius: 6px; background: var(--surface-2); overflow: hidden; transition: height var(--dur-quick); }
.ws-bar.hatch { background: repeating-linear-gradient(135deg, var(--muted) 0 1.5px, var(--surface-2) 1.5px 4.5px); }
.ws-fill { position: absolute; left: 0; right: 0; bottom: 0; background: var(--ink-2); }
.ws-col.current .ws-fill { background: var(--accent); }
.ws-col.sel .ws-bar { outline: 2px solid var(--ink); outline-offset: 2px; overflow: visible; }
.ws-col.sel .ws-fill { border-radius: 0 0 6px 6px; }
.ws-bar.hatch .ws-fill { background: repeating-linear-gradient(135deg, var(--ink-2) 0 1.5px, var(--surface-2) 1.5px 4.5px); }
.ws-col.current .ws-bar.hatch .ws-fill { background: repeating-linear-gradient(135deg, var(--accent) 0 1.5px, var(--surface-2) 1.5px 4.5px); }
.ws-n { font-size: 12px; line-height: 24px; text-align: center; color: var(--muted); }
.ws-col.current .ws-n { color: var(--accent-ink); font-weight: 700; }
.ws-col.sel .ws-n { color: var(--ink); font-weight: 700; }

.week-head { display: grid; grid-template-columns: 44px minmax(0, 1fr) 44px; align-items: center; gap: 8px; margin: 18px 0 0; }
.week-head .icon-btn { font-size: 20px; }
.wh-mid { text-align: center; min-width: 0; }
.wh-title { font-size: 24px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.15; }
.wh-title span { color: var(--muted); font-weight: 600; }
.wh-sub { font-size: 13px; color: var(--muted); }
.wh-sub b { font-weight: 600; color: var(--ink-2); }
.wh-sub b.now { color: var(--accent-ink); }
.week-sum { display: flex; justify-content: center; align-items: center; gap: 8px; font-size: 14px; color: var(--ink-2); margin: 10px 0 0; flex-wrap: wrap; }
.info-i { display: inline-grid; place-items: center; width: 13px; height: 13px; border-radius: 50%; border: 1.2px solid currentColor; font-size: 9px; font-weight: 700; line-height: 1; margin-left: 2px; vertical-align: -1px; }
.deload-chip { height: 36px; padding: 0 12px; border-radius: 18px; background: var(--surface); border: 1px solid var(--line); font-size: 13px; font-weight: 600; color: var(--ink); display: inline-flex; align-items: center; gap: 6px; }
.deload-chip i { width: 10px; height: 10px; border-radius: 3px; }
.deload-info { margin: 6px 12px 0; font-size: 13px; color: var(--muted); text-align: center; text-wrap: pretty; }
.week-progress { margin-bottom: 14px; }
.bar-track { height: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; }
.bar-fill { height: 100%; background: var(--accent); border-radius: 3px; transition: width .4s; }
.wp-labels { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin-top: 6px; }

.what-changed { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 6px 6px 14px 16px; margin-top: 16px; }
.wc-head { display: flex; align-items: center; gap: 8px; }
.wc-head span { flex: 1; font-size: 15px; font-weight: 600; }
.wc-x { width: 44px; height: 44px; font-size: 20px; color: var(--ink-2); flex: none; }
.wc-grid { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 6px 14px; padding-right: 10px; font-size: 14px; line-height: 1.4; }
.wc-k { color: var(--muted); }
.wc-v { color: var(--ink); display: flex; flex-direction: column; gap: 2px; text-wrap: pretty; }
.wc-collapsed { display: flex; align-items: center; justify-content: space-between; width: 100%; height: 44px; padding: 0 14px; border-radius: 14px; background: var(--surface-2); font-size: 14px; color: var(--ink-2); margin-top: 16px; }
.hint { display: flex; align-items: flex-start; gap: 4px; margin-top: 12px; padding: 12px 14px; border-radius: 14px; background: var(--surface-2); font-size: 13px; line-height: 1.4; color: var(--ink-2); text-wrap: pretty; }
.hint > span { flex: 1; }
.hint b { font-weight: 600; color: var(--ink); }
.hint-x { width: 36px; height: 36px; margin: -9px -10px -9px 0; font-size: 18px; color: var(--ink-2); flex: none; }
.mb10 { margin-bottom: 10px; }

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

/* Shared run rows on a vertical spine (design: topic5/program-activities) */
.spine { display: flex; flex-direction: column; padding-top: 22px; }
.spine-row { display: grid; grid-template-columns: 36px minmax(0, 1fr); gap: 12px; width: 100%; text-align: left; color: var(--ink); }
.spine-mark { position: relative; display: flex; justify-content: center; align-items: flex-start; align-self: stretch; }
.spine-mark::before { content: ""; position: absolute; top: 0; bottom: 0; width: 2px; background: var(--line); }
.spine-row:first-child .spine-mark::before { top: 18px; }
.spine-row:last-child .spine-mark::before { bottom: auto; height: 18px; }
.spine-row:only-child .spine-mark::before { display: none; }
.spine-body { display: flex; flex-direction: column; gap: 10px; min-width: 0; padding: 2px 0 26px; }
.spine-row.off .spine-body { opacity: .55; }
.spine-row.locked .spine-body, .spine-row.locked .spine-mark { opacity: .45; }
.sr-head { display: flex; align-items: flex-start; gap: 10px; }
.sr-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.sr-chips { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.sr-title { font-size: 17px; font-weight: 600; letter-spacing: -0.01em; }
.spine-row.skipped .sr-title { text-decoration: line-through; }
.sr-meta { font-size: 13px; color: var(--muted); }
.sr-state { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; text-align: right; }
.sr-done { font-size: 13px; color: var(--ink-2); white-space: nowrap; }
.pill { font-size: 13px; font-weight: 600; padding: 3px 9px; border-radius: 999px; white-space: nowrap; }
.pill-done { background: var(--good-bg); color: var(--good); }
.pill-todo { background: var(--surface-2); color: var(--ink); }
.pill-plain { color: var(--muted); }
.pill-missed { background: var(--warn-bg); color: var(--warn-ink); }
.type-chip {
  font-size: 10px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; line-height: 1.3;
  padding: 3px 7px; border-radius: 6px; background: var(--c); color: var(--on-type); border: 1.5px solid var(--c); flex: none;
}
.type-chip.off { background: transparent; color: var(--muted); border-color: var(--line); }
.type-chip.free { --c: var(--accent); background: transparent; color: var(--accent-ink); }
.bubble {
  position: relative; border-radius: 50%; display: grid; place-items: center; font-weight: 700; flex: none;
  background: var(--bg); color: var(--ink); border: 2.5px solid var(--c);
}
.bubble.done { background: var(--c); color: var(--on-type); }
.bubble.off { color: var(--muted); border: 2px dashed var(--muted); }
.run-dot { display: inline-block; border-radius: 50%; flex: none; background: var(--c); border: 2.5px solid var(--c); }
.run-dot.free { background: var(--bg); }
.run-row {
  display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; gap: 12px; align-items: center;
  width: 100%; padding: 12px; border-radius: var(--r-row); background: var(--surface); border: 1px solid var(--line);
}
.run-row.skipped { opacity: .6; }
.run-row.missed { opacity: .75; }
.rr-mid { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.rr-title { display: flex; align-items: center; gap: 6px; min-width: 0; }
.rr-title b { font-size: 16px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.run-row.skipped .rr-title b { text-decoration: line-through; }
.rr-plan { font-size: 13px; color: var(--muted); }
.rr-right { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; text-align: right; }
.rr-top { font-size: 13px; font-weight: 600; white-space: nowrap; }
.rr-bot { font-size: 12px; color: var(--muted); white-space: nowrap; }
.run-row.free { background: none; border: 1.5px dashed var(--line); }
.free-sub { font-size: 13px; color: var(--muted); }

.empty-home { position: absolute; inset: 0 0 var(--tabbar-h) 0; padding: calc(var(--safe-top) + 28px) 20px 28px; display: flex; flex-direction: column; gap: 20px; overflow-y: auto; }
.know-list { display: flex; flex-direction: column; gap: 4px; }
.know-list .micro + .know-row { margin-top: 10px; }
.know-row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.know-k { color: var(--accent-ink); font-weight: 600; font-size: 14px; }
.info-tip { position: relative; display: inline-flex; vertical-align: middle; }
.info-i { width: 18px; height: 18px; border-radius: 9px; border: 1px solid var(--muted); background: none; color: var(--muted); font: 600 11px/1 serif; font-style: italic; padding: 0; margin-left: 4px; cursor: pointer; }
.info-pop { position: absolute; left: 0; top: calc(100% + 6px); z-index: 20; width: 220px; padding: 8px 10px; border-radius: 10px; background: var(--ink); color: var(--bg); font-size: 13px; font-weight: 400; line-height: 1.35; box-shadow: 0 4px 16px rgba(0,0,0,.3); }
.know-v { font-size: 20px; font-weight: 600; white-space: nowrap; }

.center-state { position: absolute; inset: 0 0 var(--tabbar-h) 0; display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 10px; padding: 32px; text-align: center; }
.err-badge { width: 56px; height: 56px; border-radius: 28px; background: var(--bad-bg); color: var(--bad-ink); display: grid; place-items: center; font-size: 26px; font-weight: 700; }
.cs-title { font-size: 20px; font-weight: 600; text-wrap: balance; }
.cs-text { font-size: 14px; color: var(--muted); max-width: 280px; text-wrap: pretty; }
.cs-bars { display: flex; align-items: flex-end; gap: 5px; height: 48px; margin-bottom: 6px; }
.cs-bars span { width: 12px; border-radius: 3px; background: var(--surface-2); }

.skeleton { position: absolute; inset: 0 0 var(--tabbar-h) 0; padding: calc(var(--safe-top) + 14px) 16px; display: flex; flex-direction: column; gap: 10px; overflow: hidden; }
.sk { background: var(--surface-2); animation: pulse 1.4s ease-in-out infinite; }
.sk-line { height: 12px; border-radius: 6px; }
.sk-title { height: 22px; border-radius: 8px; }
.sk-card { height: 88px; border-radius: 20px; margin-top: 8px; }
.sk-row { height: 74px; border-radius: 18px; }
.sk-caption { font-size: 13px; color: var(--muted); text-align: center; margin-top: 6px; }

.pull-hint { text-align: center; font-size: 12px; color: var(--muted); height: 0; overflow: visible; transform: translateY(-14px); }

/* ---------------------------------------------------------------- tab bar */

.tabbar {
  position: absolute; left: 0; right: 0; bottom: 0; height: var(--tabbar-h); z-index: var(--z-tabbar);
  background: var(--surface); border-top: 1px solid var(--line);
  display: grid; grid-template-columns: repeat(4, 1fr);
  padding: 4px 8px max(var(--safe-bottom), 10px);
}
.tabbar button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; font-size: 13px; font-weight: 500; color: var(--muted); }
.tabbar button.on { font-weight: 600; color: var(--ink); }
.tabbar i { width: 0; height: 4px; border-radius: 2px; background: var(--accent); transition: width var(--dur-quick); }
.tabbar button.on i { width: 18px; }

/* ---------------------------------------------------------------- sheet / dialog / toast */

.scrim { position: absolute; inset: 0; background: var(--scrim); z-index: var(--z-scrim); opacity: 0; pointer-events: none; transition: opacity var(--dur-fade); }
.scrim.open { opacity: 1; pointer-events: auto; }
.sheet {
  position: absolute; left: 0; right: 0; bottom: 0; max-height: 91%; z-index: var(--z-sheet);
  background: var(--bg); border-radius: var(--r-sheet) var(--r-sheet) 0 0;
  transform: translateY(105%); visibility: hidden;
  transition: transform var(--dur-sheet) var(--ease-sheet), visibility 0s linear var(--dur-sheet);
  display: flex; flex-direction: column; box-shadow: 0 -10px 40px rgba(0, 0, 0, .15);
}
.sheet.open { transform: translateY(0); visibility: visible; transition-delay: 0s; }
.grabber { display: flex; justify-content: center; padding: 8px 0 0; }
.grabber span { width: 38px; height: 5px; border-radius: 3px; background: var(--line); }
.sheet-body { overflow-y: auto; scrollbar-width: none; padding: 8px var(--flow-x) calc(24px + max(var(--safe-bottom), 10px)); display: flex; flex-direction: column; gap: 14px; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.sheet-title-wrap { min-width: 0; flex: 1; }
.sheet-title { font-size: 22px; font-weight: 600; letter-spacing: -0.01em; }
.sheet-sub { font-size: 13px; color: var(--muted); }
.sheet-x { width: 44px; height: 44px; margin-right: -10px; border-radius: 22px; font-size: 22px; color: var(--muted); display: grid; place-items: center; flex: none; }
.sheet-text { font-size: 14px; line-height: 1.5; color: var(--ink-2); text-wrap: pretty; margin: 0; }

.dialog-wrap { position: absolute; inset: 0; background: var(--scrim); z-index: var(--z-dialog); display: flex; align-items: center; justify-content: center; padding: 22px; }
.dialog { background: var(--bg); border-radius: 24px; padding: 22px 18px 14px; display: flex; flex-direction: column; gap: 10px; width: 100%; box-shadow: 0 20px 60px rgba(0, 0, 0, .3); }
.dialog-title { font-size: 20px; font-weight: 600; letter-spacing: -0.01em; line-height: 1.25; }
.bottom-dialog-wrap { position: absolute; inset: 0; background: var(--scrim); z-index: var(--z-dialog); display: flex; align-items: flex-end; }
.bottom-dialog { background: var(--bg); border-radius: var(--r-sheet) var(--r-sheet) 0 0; padding: 24px 20px calc(24px + max(var(--safe-bottom), 10px)); width: 100%; display: flex; flex-direction: column; gap: 14px; }
.bubble-wrap { position: absolute; inset: 0; background: var(--scrim); z-index: var(--z-dialog); display: grid; place-items: center; padding: 16px; }
.bubble-card { position: relative; background: var(--bg); border-radius: var(--r-sheet); padding: 22px 48px 22px 20px; width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: 8px; }
.bubble-x { position: absolute; top: 12px; right: 8px; margin: 0; }
.bubble-title { font-size: 20px; font-weight: 600; letter-spacing: -0.01em; line-height: 1.2; margin: 0; }

.toast {
  position: absolute; top: calc(var(--safe-top) + 54px); left: 50%; z-index: var(--z-toast);
  transform: translate(-50%, -8px); opacity: 0; transition: all var(--dur-fade);
  background: var(--cta); color: var(--cta-ink); padding: 10px 16px; border-radius: 20px;
  font-size: 14px; font-weight: 500; pointer-events: none;
  width: max-content; max-width: calc(100% - 32px); text-align: center; line-height: 1.35;
}
.toast.show { transform: translate(-50%, 0); opacity: 1; }
.update-toast {
  position: absolute; left: 12px; right: 12px; bottom: calc(var(--tabbar-h) + 10px); z-index: var(--z-update);
  display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 54px;
  padding: 0 8px 0 16px; border-radius: 16px; background: var(--cta); color: var(--cta-ink);
  box-shadow: 0 10px 30px rgba(0, 0, 0, .25); font-size: 14px; font-weight: 600; width: auto;
}
.update-toast span:last-child { height: 38px; padding: 0 12px; border-radius: 10px; background: var(--cta-ink); color: var(--cta); display: grid; place-items: center; font-size: 13px; font-weight: 700; }

/* ---------------------------------------------------------------- run detail */

.rd-head { display: flex; align-items: center; gap: 14px; }
.rd-head .mid { flex: 1; min-width: 0; }
.rd-eyebrow { font-size: 13px; color: var(--muted); }
.rd-title { font-size: 24px; font-weight: 600; letter-spacing: -0.015em; line-height: 1.2; }
.state-chip { font-size: 12px; font-weight: 600; padding: 5px 10px; border-radius: 12px; flex: none; }
.rd-def { margin: -6px 0 0; font-size: 14px; color: var(--muted); text-wrap: pretty; }
.done-head { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 10px; }
.profile-legend { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); margin-top: 5px; }
.steps { display: flex; flex-direction: column; }
.step-row { display: grid; grid-template-columns: 10px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 11px 0; border-bottom: 1px solid var(--line); }
.step-swatch { width: 10px; height: 10px; border-radius: 3px; }
.step-text { display: flex; flex-direction: column; min-width: 0; }
.step-text b { font-size: 15px; font-weight: 600; }
.step-text span { font-size: 13px; color: var(--muted); }
.step-pace { font-size: 14px; font-weight: 500; color: var(--ink-2); white-space: nowrap; }
.laps-head, .lap-row { display: grid; grid-template-columns: 10px minmax(0, 1fr) 44px 44px 32px; gap: 10px; }
.laps-head { font-size: 11px; color: var(--muted); padding: 0 0 6px; border-bottom: 1px solid var(--line); }
.laps-head span:nth-child(n+3), .lap-row > span:nth-child(n+3) { text-align: right; }
.lap-row { align-items: center; padding: 11px 0; border-bottom: 1px solid var(--line); }
.lap-row .t { font-size: 13px; color: var(--muted); }
.lap-row .a { font-size: 14px; font-weight: 600; }
.lap-row .h { font-size: 13px; color: var(--ink-2); }
.step-toggle { width: 100%; text-align: left; }
.step-caret { display: inline-block; margin-left: 6px; font-size: 12px; color: var(--muted); transition: transform var(--dur-quick); }
.step-caret.on { transform: rotate(180deg); }
.part-row { padding: 7px 0 7px 12px; }
.part-row .step-swatch { width: 6px; height: 6px; border-radius: 2px; justify-self: center; }
.part-row .step-text b { font-size: 14px; font-weight: 500; }
.why { background: var(--surface-2); border-radius: 16px; padding: 12px 14px; }
.why-l { font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 3px; }
.why-t { font-size: 15px; line-height: 1.4; text-wrap: pretty; }
.watch-line { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--muted); flex-wrap: wrap; }
.form-card { display: flex; flex-direction: column; gap: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-row); padding: 14px; }
.form-card .field-label { font-size: 13px; color: var(--muted); font-weight: 400; }
.form-card input { background: var(--bg) !important; height: 46px !important; font-size: 17px !important; font-weight: 600 !important; border-radius: 12px !important; }
.form-card .chip { background: var(--bg); }
.form-card .chip.on { background: var(--cta); }
.pick-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; min-height: 54px; padding: 0 14px; border-radius: 13px; background: var(--bg); border: 1px solid var(--line); width: 100%; }
.pick-row b { font-weight: 600; color: var(--ink); }
.pick-row span { font-size: 13px; color: var(--muted); }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.cmp { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-row); padding: 4px 14px; }
.cmp-row { display: grid; grid-template-columns: 1fr 1fr 1fr; font-size: 14px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.cmp-row:last-child { border-bottom: 0; }
.cmp-head { font-size: 12px; color: var(--muted); padding: 8px 0; }
.cmp-row .r { text-align: right; }
.splits-pending .r { color: var(--muted); animation: pulse 1.2s ease-in-out infinite; }

/* ---------------------------------------------------------------- activities */

.acts-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 4px 0; }
.acts-controls { display: flex; gap: 8px; align-items: center; margin-top: 16px; }
.seg3 { flex: 1; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 2px; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 3px; }
.seg3 button { height: 36px; border-radius: 999px; font-weight: 600; font-size: 14px; color: var(--ink-2); text-align: center; }
.seg3 button.on { background: var(--ink); color: var(--bg); }
.filter-btn { height: 44px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font-weight: 600; font-size: 14px; display: flex; align-items: center; gap: 6px; flex: none; }
.badge { min-width: 20px; height: 20px; padding: 0 5px; border-radius: 10px; background: var(--ink); color: var(--bg); font-size: 12px; display: grid; place-items: center; }
.acts-active { display: flex; align-items: baseline; gap: 10px; padding: 12px 4px 0; font-size: 13px; color: var(--muted); }
.acts-active span { flex: 1; min-width: 0; }
.acts-active button { min-height: 32px; font-size: 13px; font-weight: 600; color: var(--accent-ink); }
.acts-empty { padding: 32px 8px; text-align: center; font-size: 15px; color: var(--muted); }
.spine-row.act { grid-template-columns: 16px minmax(0, 1fr); gap: 10px; cursor: pointer; }
.spine.acts .spine-row:first-child .spine-mark::before { top: 15px; }
.spine.acts .spine-row:last-child .spine-mark::before { height: 15px; }
.spine-row.act .run-dot { position: relative; margin-top: 8px; }
.spine-row.act .spine-body { padding: 4px 0 28px; }
.act-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.act-date { flex: none; width: 36px; display: flex; flex-direction: column; align-items: center; margin-top: -6px; line-height: 1.15; }
.act-date small { font-size: 11px; color: var(--muted); }
.act-date small:first-child { font-weight: 600; letter-spacing: .06em; text-transform: uppercase; }
.act-date b { font-size: 22px; font-weight: 700; line-height: 1.1; }
.act-title { font-size: 15px; font-weight: 600; min-width: 0; }
.act-sub { font-size: 12px; color: var(--muted); }
.act-stats { display: flex; align-items: flex-end; gap: 12px; }
.act-km { font-size: 15px; color: var(--muted); white-space: nowrap; }
.act-km b { font-size: 34px; font-weight: 700; letter-spacing: -0.025em; line-height: 1; color: var(--ink); }
.act-cols { margin-left: auto; display: flex; gap: 14px; text-align: right; }
.act-cols small { display: block; font-size: 12px; color: var(--muted); }
.act-cols b { font-size: 15px; font-weight: 600; white-space: nowrap; }
.route-thumb { position: relative; aspect-ratio: 16 / 9; border-radius: 14px; overflow: hidden; border: 1px solid var(--line); background: var(--surface-2); cursor: pointer; }
.route-thumb:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.route-thumb img { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.thumb-route { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.thumb-route path { fill: none; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.thumb-route path.halo { stroke: var(--bg); stroke-width: 5; }
.thumb-km { position: absolute; transform: translate(-50%, -50%); width: 6px; height: 6px; border-radius: 50%; background: var(--bg); border: 2px solid; pointer-events: none; }
.map-km { width: 18px; height: 18px; border-radius: 50%; background: var(--surface); color: var(--ink); border: 1px solid var(--line); font-size: 10px; font-weight: 700; display: grid; place-items: center; pointer-events: none; }
.map-km-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--bg); border: 2px solid; pointer-events: none; }
.thumb-start { position: absolute; transform: translate(-50%, -50%); width: 12px; height: 12px; border-radius: 50%; background: var(--bg); border: 3px solid; pointer-events: none; }
.thumb-credit { position: absolute; right: 6px; bottom: 4px; font-size: 9px; color: var(--muted); background: color-mix(in srgb, var(--surface) 70%, transparent); padding: 0 4px; border-radius: 4px; pointer-events: none; }

.filter-sheet { display: flex; flex-direction: column; gap: 18px; }
.filter-q { height: 44px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); padding: 0 14px; font: inherit; font-size: 15px; }
.fs-group { display: flex; flex-direction: column; gap: 8px; }
.fs-label { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; font-size: 13px; font-weight: 600; color: var(--ink-2); }
.fs-label .muted { font-weight: 400; }
.fs-label b { font-weight: 400; color: var(--ink); }
.fs-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.fs-chips button { height: 36px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); font-weight: 600; font-size: 14px; }
.fs-chips button.on { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.cal { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 4px 10px 10px; }
.cal-head { display: flex; align-items: center; justify-content: space-between; font-size: 15px; font-weight: 600; }
.cal-head button { width: 44px; height: 44px; font-size: 22px; color: var(--ink); }
.cal-head button:disabled { opacity: .35; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); row-gap: 2px; }
.cal-dow { text-align: center; font-size: 11px; font-weight: 600; color: var(--muted); padding: 2px 0 6px; }
.cal-day { position: relative; height: 40px; font-size: 14px; font-weight: 500; color: var(--ink); text-align: center; }
.cal-day.today { font-weight: 700; }
.cal-day:disabled { color: var(--muted); }
.cal-day.in { background: var(--surface-2); }
.cal-day.end { background: var(--ink); color: var(--bg); border-radius: 10px; }
.cal-day i { position: absolute; left: 50%; bottom: 4px; width: 5px; height: 5px; margin-left: -2.5px; border-radius: 50%; }
.rs { position: relative; padding: 0 12px; touch-action: none; cursor: pointer; }
.rs-track { position: relative; height: 44px; }
.rs-track::before { content: ""; position: absolute; left: 0; right: 0; top: 20px; height: 4px; border-radius: 2px; background: var(--surface-2); }
.rs-range { position: absolute; top: 20px; height: 4px; border-radius: 2px; background: var(--ink); }
.rs-thumb { position: absolute; top: 10px; width: 24px; height: 24px; margin-left: -12px; border-radius: 50%; background: var(--bg); border: 2px solid var(--ink); }
.rs-thumb:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.rs-ends { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin: -4px -12px 0; }
.fs-foot { display: flex; gap: 8px; margin-top: 4px; }
.fs-foot .fs-clear { width: auto; height: 48px; padding: 0 20px; border-radius: 24px; }
.fs-foot .fs-show { flex: 1; height: 48px; border-radius: 24px; }

/* ---------------------------------------------------------------- progress */

.chart { position: relative; display: flex; align-items: flex-end; gap: 5px; }
.chart-col { flex: 1; position: relative; height: 100%; }
.chart-col span { position: absolute; left: 0; right: 0; bottom: 0; border-radius: 4px; }
.chart-max { position: absolute; left: 0; right: 0; border-top: 1.5px dashed var(--muted); }
.chart-labels { display: flex; gap: 5px; margin-top: 6px; }
.chart-labels span { flex: 1; text-align: center; font-size: 11px; color: var(--muted); }
/* Axis on the right, matching the VO2max chart above it. */
.km-chart { display: grid; grid-template-columns: 1fr 26px; column-gap: 6px; row-gap: 6px; }
.km-grid { position: absolute; left: 0; right: 0; height: 0; border-top: 1px solid var(--line); pointer-events: none; }
.km-y { position: relative; font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.km-y span { position: absolute; left: 0; transform: translateY(50%); line-height: 1; }
.km-unit { font-size: 11px; color: var(--muted); line-height: 1; }
.chart-legend { display: flex; gap: 14px; font-size: 12px; color: var(--muted); margin-top: 10px; flex-wrap: wrap; }
.chart-legend span { display: flex; align-items: center; gap: 5px; }
.chart-legend i { width: 10px; height: 10px; border-radius: 3px; }
.card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.card-head b { font-size: 15px; font-weight: 600; }
.cons-grid { display: grid; gap: 6px; margin-top: 12px; }
.cons-col { display: flex; flex-direction: column; align-items: center; gap: 5px; }
.cons-dot { width: 14px; height: 14px; border-radius: 7px; border: 1.5px solid var(--line); }
.cons-col small { font-size: 11px; color: var(--muted); margin-top: 2px; }
.big-time { font-size: var(--fs-stat); font-weight: 700; letter-spacing: -0.03em; line-height: 1; }
.race-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.race-grid b { display: block; font-size: 19px; font-weight: 600; letter-spacing: -0.01em; }
.section-title { font-size: 12px; font-weight: 600; color: var(--muted); margin: 20px 4px 8px; text-transform: uppercase; letter-spacing: .06em; }
.past-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card); padding: 16px; display: flex; align-items: center; gap: 12px; width: 100%; }
.past-card .t { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.kv-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-row); padding: 2px 14px; }
.kv { display: flex; justify-content: space-between; padding: 11px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.kv:last-child { border-bottom: 0; }
.kv span:first-child { color: var(--muted); }
.kv span:last-child { font-weight: 600; }

/* ---------------------------------------------------------------- profile */

.profile-head { display: flex; align-items: center; gap: 14px; padding: 6px 0 0; }
.avatar { width: 56px; height: 56px; border-radius: 28px; background: var(--surface-2); display: grid; place-items: center; font-size: 20px; font-weight: 600; flex: none; }
.list-section .section-title { margin-top: 20px; }
.list-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-row); overflow: hidden; }
.list-row { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 52px; padding: 10px 14px; border-bottom: 1px solid var(--line); text-align: left; }
.list-row:last-child { border-bottom: 0; }
.lr-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.lr-label { font-size: 15px; font-weight: 500; }
.lr-label.danger { color: var(--bad-ink); }
.lr-sub { font-size: 12px; color: var(--muted); }
.lr-bar { display: block; margin-top: 8px; }
.lr-bar .bar-fill { display: block; }
.lr-value { font-size: 14px; color: var(--muted); text-align: right; }
.lr-chev { color: var(--muted); }
.section-foot { font-size: 12px; color: var(--muted); margin: 6px 4px 0; }

/* ---------------------------------------------------------------- creation */

.ramp-plot { display: grid; grid-template-columns: auto 1fr; gap: 6px; transition: opacity .15s; }
.ramp-y { position: relative; min-width: 18px; font-size: 10px; color: var(--muted); font-variant-numeric: tabular-nums; }
.ramp-y span { position: absolute; right: 0; transform: translateY(50%); line-height: 1; }
.ramp { position: relative; display: flex; gap: 4px; align-items: flex-end; height: 110px; }
.ramp span { flex: 1; border-radius: 4px; transition: height .25s; position: relative; }
/* Over the chart, never in the flow: the card doesn't change size. Fades in
   late so a quick update doesn't flash it. */
.ramp-busy { position: absolute; inset: 0; z-index: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 13px; font-weight: 600; color: var(--ink); pointer-events: none; opacity: 0; animation: fade-in .15s ease .15s forwards; }
.ramp-busy-pill { display: inline-flex; align-items: center; gap: 10px; padding: 10px 16px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); box-shadow: 0 4px 16px rgba(0,0,0,.25); }
.ramp-busy .spinner { width: 16px; height: 16px; margin: 0; border-width: 2px; }
@keyframes fade-in { to { opacity: 1; } }
.ramp-grid { position: absolute; left: 0; right: 0; height: 0; border-top: 1px dashed var(--line); pointer-events: none; }
.ramp-labels { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); margin-top: 6px; }
.review-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.review-col { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-row); padding: 14px 12px; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.review-col .h { font-size: 12px; font-weight: 600; }
.review-col .km { font-size: 26px; font-weight: 600; letter-spacing: -0.02em; }
.mini-run { display: flex; align-items: center; gap: 7px; font-size: 13px; min-width: 0; }
.mini-run .n { width: 20px; height: 20px; border-radius: 10px; color: var(--on-type); display: grid; place-items: center; font-size: 11px; font-weight: 700; flex: none; }
.mini-run .l { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini-run .m { color: var(--muted); }
.watch-list { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-row); padding: 6px 14px; }
.watch-list div { display: flex; align-items: center; gap: 10px; height: 44px; border-bottom: 1px solid var(--line); font: 500 14px var(--font-mono); }
.watch-list div:last-child { border-bottom: 0; }
.watch-list i { width: 8px; height: 8px; border-radius: 4px; flex: none; }
.big-check { width: 64px; height: 64px; border-radius: 32px; background: var(--good-bg); color: var(--good); display: grid; place-items: center; font-size: 30px; font-weight: 700; }

.mini-strip .ms-bars { display: flex; gap: 4px; align-items: flex-end; }
.mini-strip .ms-bar { flex: 1; border-radius: 4px; transition: height var(--dur-quick); }
.mini-strip .ms-labels { display: flex; gap: 4px; margin-top: 6px; }
.mini-strip .ms-labels span { flex: 1; text-align: center; font-size: 10px; color: var(--muted); }

.cmp-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.cmp-col .lbl { font-size: 11px; font-weight: 600; color: var(--muted); }
.cmp-col .lbl.after { color: var(--accent-ink); }
.cmp-col .km { font-size: 20px; font-weight: 600; letter-spacing: -0.01em; }
.cmp-col .rs { display: flex; flex-direction: column; gap: 5px; margin-top: 6px; }
.cmp-col .r { display: flex; align-items: center; gap: 6px; font-size: 12px; min-width: 0; }
.cmp-col .r i { width: 8px; height: 8px; border-radius: 4px; flex: none; }
.cmp-col .r span:nth-child(2) { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cmp-col .r span:last-child { color: var(--muted); }
.sheet-menu-item { display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); min-height: 44px; text-align: left; }
.sheet-menu-item b { font-size: 16px; font-weight: 600; }
.sheet-menu-item span { font-size: 13px; color: var(--muted); }
.sheet-menu-item.danger b { color: var(--bad-ink); }
.sheet-menu-item:disabled { opacity: .5; }

/* tutorial */
.tut-dots { display: flex; gap: 6px; align-items: center; }
.tut-dots span { width: 6px; height: 6px; border-radius: 3px; background: var(--line); transition: width var(--dur-quick); }
.tut-dots span.on { width: 18px; background: var(--accent); }
.tut-run { display: flex; align-items: center; gap: 10px; }
.tut-run .n { width: 28px; height: 28px; border-radius: 14px; color: var(--on-type); display: grid; place-items: center; font-size: 13px; font-weight: 700; }
.tut-run b { font-size: 15px; font-weight: 600; }
.days-row { display: grid; grid-template-columns: 52px minmax(0, 1fr); align-items: center; gap: 8px; }
.days-row .lbl { font-size: 13px; font-weight: 600; }
.days { display: grid; grid-template-columns: repeat(7, 1fr); }
.days span { display: flex; flex-direction: column; align-items: center; gap: 5px; font-size: 11px; color: var(--muted); }
.days i { width: 16px; height: 16px; border-radius: 8px; border: 1.5px solid var(--line); }

/* deload stripe for strips that set --stripe */
.stripe { background: repeating-linear-gradient(135deg, var(--stripe, var(--ink-2)) 0 2.5px, transparent 2.5px 5px); }

/* program wrap-up (story cards) */
.wr-wrap { position: absolute; inset: 0; z-index: var(--z-dialog); background: radial-gradient(120% 70% at 50% 0%, color-mix(in oklab, var(--accent) 16%, var(--bg)) 0%, var(--bg) 60%); display: flex; flex-direction: column; padding: calc(var(--safe-top) + 10px) var(--flow-x) calc(max(var(--safe-bottom), 10px) + 16px); }
.wr-top { display: flex; align-items: center; gap: 8px; }
.wr-progress { flex: 1; display: flex; gap: 4px; }
.wr-progress span { flex: 1; height: 3px; border-radius: 2px; background: var(--line); transition: background var(--dur-quick); }
.wr-progress span.on { background: var(--ink); }
.wr-x { width: 44px; height: 44px; margin-right: -10px; border-radius: 22px; font-size: 26px; color: var(--ink-2); display: grid; place-items: center; flex: none; }
.wr-card { flex: 1; display: flex; flex-direction: column; justify-content: center; gap: 14px; min-height: 0; overflow-y: auto; user-select: none; -webkit-user-select: none; animation: wr-in .45s var(--ease-sheet) both; }
.wr-title { font-size: 40px; font-weight: 700; letter-spacing: -0.03em; line-height: 1.05; margin: 0; }
.wr-sub { font-size: 17px; line-height: 1.4; color: var(--ink-2); margin: 0; text-wrap: pretty; }
.wr-lead { font-size: 20px; font-weight: 600; color: var(--ink-2); }
.wr-big { font-size: 96px; font-weight: 700; letter-spacing: -0.05em; line-height: 0.95; color: var(--accent-ink); }
.wr-big-s { font-size: 64px; }
.wr-big .wr-of, .wr-big .wr-unit { font-size: 32px; letter-spacing: -0.02em; color: var(--ink); }
.wr-meter { height: 10px; border-radius: 5px; background: var(--surface-2); overflow: hidden; }
.wr-meter span { display: block; height: 100%; background: var(--accent); border-radius: 5px; animation: wr-grow 1s .25s var(--ease-sheet) both; transform-origin: left; }
.wr-extra { animation: wr-in .45s .9s var(--ease-sheet) both; }
.wr-extra b { color: var(--accent-ink); }
.wr-best { background: var(--surface); border-radius: var(--r-card); padding: 16px 18px; }
.wr-best-v { font-size: 34px; font-weight: 700; letter-spacing: -0.02em; }
.wr-races { display: flex; flex-direction: column; gap: 6px; }
.wr-race { display: grid; grid-template-columns: minmax(0, 1.3fr) auto auto minmax(64px, auto); align-items: baseline; gap: 10px; background: var(--surface); border-radius: 14px; padding: 12px 14px; }
.wr-race b { font-size: 18px; }
.wr-race .micro { text-align: right; }
.wr-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.wr-grid > div { background: var(--surface); border-radius: 16px; padding: 12px 14px; }
.wr-grid b { font-size: 22px; font-weight: 700; }
.wr-actions { display: flex; flex-direction: column; gap: 10px; margin-top: 8px; }
.wr-hint { text-align: center; margin-top: 8px; }
@keyframes wr-in { from { opacity: 0; transform: translateY(16px); } }
@keyframes wr-grow { from { transform: scaleX(0); } }

/* finish-line scene (web/img/program-*.svg, inlined): fills the deck behind card 1 */
.wr-scene { position: absolute; inset: 0; pointer-events: none; }
.wr-scene svg { display: block; width: 100%; height: 100%; }
.wr-scene .fl-pc-bg, .wr-scene .fl-pe-bg { fill: none; }
.wr-top { position: relative; }
.wr-card-scene { justify-content: flex-end; }
.wr-scene-sub { animation: wr-in .6s 2.2s var(--ease-sheet) both; }
@media (prefers-reduced-motion: reduce) {
  .wr-card, .wr-extra, .wr-meter span, .wr-scene-sub { animation: none !important; }
}

/* Maintain mode: setup runs + Run B heart-rate trend */
.maintain-run { display: flex; gap: 12px; align-items: flex-start; }
.maintain-run > div { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.maintain-run b { font-size: 15px; font-weight: 600; }
.maintain-run > div > span { font-size: 13px; color: var(--ink-2); line-height: 1.4; }
.trend-legend { display: flex; gap: 14px; font-size: 12px; color: var(--ink-2); }
.trend-legend span { display: inline-flex; align-items: center; gap: 6px; }
.trend-legend i { width: 14px; height: 2px; border-radius: 1px; }
.trend-svg { width: 100%; height: auto; display: block; overflow: visible; }
.trend-grid { stroke: var(--line); stroke-width: 1; }
.trend-cross { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 2 3; }
.trend-axis { fill: var(--muted); font-size: 10px; }
.trend-label { fill: var(--ink-2); font-size: 11px; font-weight: 600; }
.trend-hit { cursor: pointer; }
.trend-bubble rect { fill: var(--surface); stroke-width: 1.5; }
.trend-bubble text { font-size: 11px; font-weight: 600; font-variant-numeric: tabular-nums; }

/* Progress: General */
.range-nav { display: flex; align-items: center; justify-content: space-between; margin-top: 8px; }
.range-nav span { font-size: 14px; font-weight: 600; }
.range-nav button { width: 44px; height: 36px; border-radius: 10px; font-size: 22px; color: var(--ink); }
.range-nav button:disabled { opacity: .25; }
.vo2-chart { position: relative; height: 110px; margin-top: 14px; margin-right: 26px; }
.vo2-chart svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.vo2-dot { position: absolute; width: 22px; height: 22px; margin: -11px 0 0 -11px; border-radius: 11px; }
.vo2-dot::after { content: ""; position: absolute; inset: 7px; border-radius: 4px; background: var(--surface); border: 2px solid var(--accent); }
.vo2-dot.on::after { inset: 5px; border-radius: 6px; background: var(--accent); }
/* Fitness tests: a filled diamond in the test's colour; entered efforts: a muted ring. */
.vo2-dot.src-test::after, .vo2-mark.src-test { background: var(--vo2); border-color: var(--vo2); border-radius: 2px; transform: rotate(45deg); }
.vo2-dot.src-test::after { inset: 6px; }
.vo2-dot.src-test.on::after { inset: 4px; box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--vo2); }
.vo2-dot.src-entered::after, .vo2-mark.src-entered { border-color: var(--muted); }
.vo2-dot.src-entered.on::after { background: var(--muted); }
.vo2-legend { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 10px; font-size: 12px; color: var(--muted); }
.vo2-legend span { display: inline-flex; align-items: center; gap: 6px; }
.vo2-mark { width: 8px; height: 8px; border-radius: 4px; background: var(--surface); border: 2px solid var(--accent); flex: none; }
.vo2-axis { position: absolute; right: -26px; font-size: 11px; color: var(--muted); line-height: 1; transform: translateY(-50%); }
.vo2-x { position: relative; height: 16px; margin: 0 26px 0 0; }
.vo2-x span { position: absolute; top: 5px; font-size: 11px; color: var(--muted); line-height: 1; white-space: nowrap; }
.heat { display: grid; grid-template-rows: repeat(8, auto); grid-auto-flow: column; margin-top: 14px; align-items: center; }
.heat small { font-size: 10px; color: var(--muted); padding-right: 4px; line-height: 1; }
.heat-cell { display: block; aspect-ratio: 1; border-radius: 3px; background: var(--surface-2); min-width: 0; }
.heat-cell.out { background: transparent; }
.heat.dense .heat-cell { border-radius: 1.5px; }
.heat small.heat-x { width: 0; overflow: visible; white-space: nowrap; padding: 4px 0 0; }
.heat-key { display: flex; gap: 3px; margin-top: 14px; }
.heat-key div { flex: 1; min-width: 0; }
.heat-key span { display: block; height: 8px; border-radius: 2px; }
.heat-key small { display: block; margin-top: 4px; font-size: 10px; color: var(--muted); white-space: nowrap; }
.heat-cell.on { outline: 2px solid var(--ink); outline-offset: 1px; }

/* Run maps (route-map.js) */
.route-map { position: relative; height: 180px; border-radius: var(--r-row); overflow: hidden; background: var(--surface-2); border: 1px solid var(--line); cursor: pointer; }
.route-map:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
/* Beats `.maplibregl-map { position: relative }`, which loads after this file. */
.route-map > .route-map-canvas, .route-full > .route-full-map { position: absolute; inset: 0; }
.route-sketch { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.route-map-note { position: absolute; left: 10px; bottom: 8px; font-size: 12px; color: var(--muted); }
.route-map-pending { cursor: default; animation: pulse 1.2s ease-in-out infinite; }
.route-full { position: absolute; inset: 0; z-index: var(--z-dialog); background: var(--surface-2); }
.route-full-x {
  position: absolute; top: calc(var(--safe-top) + 10px); left: 12px; width: 44px; height: 44px; border-radius: 22px;
  background: var(--surface); color: var(--ink); border: 1px solid var(--line); font-size: 24px; display: grid; place-items: center;
  box-shadow: 0 2px 10px rgba(0,0,0,.25);
}
.route-full .maplibregl-ctrl-top-right { top: var(--safe-top); }
.route-map-credit {
  position: absolute; right: 0; bottom: 0; padding: 2px 8px; border-top-left-radius: 8px;
  font-size: 10px; color: var(--ink-2); background: color-mix(in oklab, var(--surface) 80%, transparent);
}
