/*
 * Keel Fitness — app-specific components on top of the Keel UI kit (./keel/keel-ui.css).
 * Everything here uses kit tokens (--k-*): Archivo, square corners, 2px section rules,
 * flush-left labels, the Fitness accents (--k-app / -deep / -tint / -light) and Ocean
 * primary actions. Class prefix: fit-. No inline styles anywhere (production CSP).
 */

:where(body) { background: var(--k-bg); }
#main:focus { outline: none; }
.fit-pad { padding: 24px 32px; }
.fit-links { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

/* Fullscreen / distraction-free workout: hide the bar and banners. */
body.active-workout #keel-bar,
body.active-workout #live-banner { display: none; }

/* Nested kit blocks (a block rendered inside a block or a dialog) are flat. */
.k-block .k-block,
.fit-sheet .k-block,
.fit-flat,
.fit-sheet-block { padding: 0; border: 0; background: transparent; }

/* ── 2a · Workout home ───────────────────────────────────────────────────── */
.fit-home-grid { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); }
.fit-home-main { border-right: 2px solid var(--k-divider); min-width: 0; }
.fit-home-side { display: flex; flex-direction: column; min-width: 0; }
.fit-hero {
  display: flex; flex-direction: column; align-items: flex-start; gap: 8px;
  padding: 28px 32px; background: var(--k-app-tint); border-bottom: 2px solid var(--k-divider);
}
.fit-hero .k-kicker { font-size: var(--k-fs-12); }
.fit-hero-title { margin: 0; font-size: var(--k-fs-36); font-weight: 800; letter-spacing: var(--k-tracking-h1); line-height: 1.1; text-wrap: balance; }
.fit-hero .k-sub { font-size: var(--k-fs-14); }
.fit-tags { display: flex; flex-wrap: wrap; gap: 8px; }
.fit-hero-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 8px; }
.fit-start { min-width: 220px; min-height: 48px; margin-top: 8px; padding-inline: 16px; }
.fit-hero-actions .fit-start, .fit-hero-actions .k-btn { margin-top: 0; min-height: 48px; }
.fit-home-main > .k-block { border-right: 0; }
.fit-home-main > .k-state { border-bottom: 2px solid var(--k-divider); padding: 24px 32px; }

.fit-exlist { margin: 0; padding: 0; list-style: none; }
.fit-exrow, .fit-jump {
  display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; gap: 12px; align-items: center;
  width: 100%; min-height: 64px; padding: 14px 32px; margin: 0;
  font: inherit; color: var(--k-text); text-align: left; cursor: pointer;
  background: transparent; border: 0; border-bottom: 1px solid var(--k-divider);
  transition: background-color var(--k-ease);
}
.fit-exrow:hover, .fit-jump:hover { background: var(--k-row-wash); }
.fit-exrow:focus-visible, .fit-jump:focus-visible { outline-offset: -2px; }
.fit-exrow-n { color: var(--k-muted); font-weight: 800; }
.fit-exrow-main { display: flex; flex-direction: column; min-width: 0; }
.fit-exrow-name { font-size: var(--k-fs-15); font-weight: 800; line-height: 1.35; overflow-wrap: anywhere; }
.fit-exrow-note { font-size: var(--k-fs-12-5); color: var(--k-muted); line-height: 1.45; }
.fit-exrow-sets { font-size: var(--k-fs-14); font-weight: 600; white-space: nowrap; }
.fit-home-foot { padding: 14px 32px; }

.fit-side-sec { display: flex; flex-direction: column; gap: 10px; padding: 28px 32px; border-bottom: 2px solid var(--k-divider); }
.fit-side-sec:last-child { border-bottom: 0; }
.fit-side-sec .k-block-title { font-size: var(--k-fs-11); }
.fit-big { font-size: var(--k-fs-display); font-weight: 800; line-height: 1; letter-spacing: var(--k-tracking-display); }
.fit-side-text { margin: 0; font-size: var(--k-fs-13); line-height: 1.55; color: var(--k-text-2); }
.fit-side-text .k-btn { padding-inline: 2px; min-height: 0; font-size: var(--k-fs-13); }
.fit-meter { position: relative; display: block; height: 8px; background: var(--k-surface); }
.fit-meter > span { position: absolute; inset: 0 auto 0 0; width: var(--k-w, 0%); background: var(--k-app); }

.fit-week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; margin: 0; padding: 0; list-style: none; }
.fit-day { display: flex; flex-direction: column; gap: 4px; font-size: var(--k-fs-11); color: var(--k-muted); }
.fit-day-cell { display: block; height: 48px; border: 1px solid var(--k-divider); background: transparent; }
.fit-day--done { background: var(--k-app); border-color: var(--k-app); }
.fit-day--today { background: color-mix(in srgb, var(--k-app) 30%, var(--k-raised)); }
.fit-day--planned { background: var(--k-surface); }
.fit-day[aria-current="date"] .fit-day-l { color: var(--k-text); font-weight: 800; }

.fit-mod { gap: 6px; }
.fit-mod-k { color: var(--k-muted); }
.fit-mod:disabled { opacity: 1; cursor: default; }
.fit-mod:disabled:hover { background: transparent; }

/* ── 2b · Live set logging ───────────────────────────────────────────────── */
.fit-live-grid { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); }
.fit-logger { display: flex; flex-direction: column; min-width: 0; border-right: 2px solid var(--k-divider); }
.fit-logger-head { display: flex; align-items: center; gap: 10px; padding: 16px 32px; border-bottom: 2px solid var(--k-divider); }
.fit-logger-id { display: flex; flex-direction: column; margin-right: auto; min-width: 0; }
.fit-logger-id .k-kicker { font-size: var(--k-fs-12); }
.fit-logger-title { margin: 0; font-size: var(--k-fs-20); font-weight: 800; line-height: 1.25; letter-spacing: -0.01em; overflow-wrap: anywhere; }
.fit-logger-title:focus { outline: none; }
.fit-logger-acts { display: flex; gap: 8px; flex: none; }
.fit-logger > .k-block { border-right: 0; padding: 0; }
.fit-logger > .k-block .k-note, .fit-logger > .k-note { margin: 12px 32px 0; }
.fit-logger > p.fit-pad { padding: 10px 32px 0; }

.fit-sets-wrap { overflow-x: auto; }
.fit-sets { width: 100%; border-collapse: collapse; table-layout: fixed; }
.fit-sets th, .fit-sets td { padding: 6px 4px; text-align: left; vertical-align: middle; }
.fit-sets thead th {
  padding: 8px 4px; font-size: var(--k-fs-10-5); font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--k-muted); border-bottom: 2px solid var(--k-divider); white-space: nowrap;
}
.fit-sets thead th:first-child, .fit-sets tbody th { padding-left: 32px; }
.fit-sets thead th:last-child, .fit-sets td:last-child { padding-right: 32px; }
.fit-sets thead th:nth-child(1) { width: calc(32px + 48px); }
.fit-sets thead th:nth-child(3) { width: 72px; }
.fit-sets thead th:nth-child(4) { width: 60px; }
.fit-sets thead th:nth-child(5) { width: 56px; }
.fit-sets thead th:nth-child(6) { width: calc(32px + 52px); }
.fit-sets tbody tr { border-bottom: 1px solid var(--k-divider); height: 56px; }
.fit-sets tbody tr.fit-is-done { background: var(--k-tone-success-bg); }
.fit-sets tbody th { font-weight: 800; }
.fit-c-prev { font-size: var(--k-fs-13); color: var(--k-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fit-c-num { font-weight: 600; }
.fit-na { color: var(--k-muted); }
.fit-setno {
  display: inline-grid; place-items: center start; min-width: 44px; min-height: 44px; padding: 0 4px; margin: 0;
  font: inherit; font-weight: 800; color: var(--k-text); background: transparent; border: 0; cursor: pointer;
}
span.fit-setno { cursor: default; }
.fit-setno--type { color: var(--k-app-deep); }
.fit-pr { margin-left: 4px; padding: 0 5px; font-size: 10px; vertical-align: middle; }
.fit-cell {
  width: 100%; min-height: 44px; padding: 0 4px; margin: 0;
  font: inherit; font-size: var(--k-fs-15); font-weight: 600; color: var(--k-text);
  background: transparent; border: 0; border-bottom: 1px dashed var(--k-divider); border-radius: 0;
  -moz-appearance: textfield; appearance: textfield;
}
.fit-cell::-webkit-outer-spin-button, .fit-cell::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.fit-cell::placeholder { color: var(--k-muted); opacity: 1; }
.fit-cell:hover { border-bottom-color: var(--k-text); }
.fit-cell:focus-visible { outline: 2px solid var(--k-focus); outline-offset: 0; border-bottom-color: transparent; background: var(--k-raised); }
.fit-done {
  position: relative; display: grid; place-items: center; width: 44px; height: 44px; padding: 0; margin: 0;
  color: var(--k-on-status); font-size: 18px; line-height: 1; cursor: pointer;
  background: transparent; border: 2px solid var(--k-muted); border-radius: 0;
}
.fit-done[aria-checked="true"] { background: var(--k-success); border-color: var(--k-success); }
.fit-done[aria-checked="true"]::after { content: "✓"; }
.fit-done:hover { border-color: var(--k-text); }
.fit-done[aria-checked="true"]:hover { background: color-mix(in srgb, var(--k-success) 86%, #000); }
.fit-done:disabled { cursor: not-allowed; }

.fit-logger-after { display: flex; flex-direction: column; gap: 10px; padding: 16px 32px; }
.fit-rest-card {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 10px;
  padding: 12px; background: var(--k-raised);
}
.fit-rest-card-l { font-size: var(--k-fs-13); }
.fit-rest-card-acts { display: flex; gap: 6px; justify-content: flex-end; visibility: hidden; }
.fit-rest-card.fit-is-running .fit-rest-card-acts { visibility: visible; }
.fit-rest-card-acts .k-btn { min-height: 44px; min-width: 44px; padding: 4px 8px; font-size: var(--k-fs-12); }
/* Empty-state actions are tap targets too (kit default is 35px outside the card variant). */
.k-state .k-btn { min-height: 44px; }
.fit-rest-card-clock { font-size: var(--k-fs-22); font-weight: 800; font-variant-numeric: tabular-nums; min-width: 3.2em; text-align: right; }
.fit-logger-bar {
  position: sticky; bottom: 0; z-index: 5; display: flex; gap: 8px; margin-top: auto;
  padding: 12px 32px; background: var(--k-bg); border-top: 2px solid var(--k-divider);
}
.fit-logger-bar .k-btn { min-height: 52px; }
.fit-next { flex: 1; padding-inline: 16px; }
.fit-live-side { display: flex; flex-direction: column; min-width: 0; }
.fit-live-side .fit-side-sec { padding: 22px 28px; }
.fit-exlist--compact .fit-jump { padding: 10px 0; min-height: 52px; }
.fit-jump.fit-is-current { background: var(--k-app-tint); box-shadow: inset 3px 0 0 var(--k-app-deep); padding-left: 10px; }

/* Floating rest timer (elsewhere in the app; the live logger shows it inline) */
.fit-rest {
  position: fixed; right: 16px; bottom: 16px; z-index: 60; width: 300px;
  display: flex; flex-direction: column; gap: 8px; padding: 14px 16px;
  background: var(--k-raised); color: var(--k-text); border-top: 4px solid var(--k-app); box-shadow: var(--k-shadow-lg);
}
body.fit-inline-rest .fit-rest { display: none; }
.fit-rest-top { display: flex; justify-content: space-between; gap: 8px; font-size: var(--k-fs-12); }
.fit-rest-label { font-size: var(--k-fs-11); font-weight: 600; letter-spacing: var(--k-tracking-label); text-transform: uppercase; color: var(--k-muted); }
.fit-rest-next { color: var(--k-text-2); text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fit-rest-clock { font-size: var(--k-fs-40); font-weight: 800; letter-spacing: -0.03em; line-height: 1; font-variant-numeric: tabular-nums; }
.fit-rest.fit-is-done .fit-rest-clock { color: var(--k-success); }
.fit-rest-track { position: relative; height: 6px; background: var(--k-track); }
.fit-rest-track > span { position: absolute; inset: 0 auto 0 0; width: var(--k-w, 0%); background: var(--k-app); }
.fit-rest-controls { display: flex; gap: 6px; }
.fit-rest-controls .k-btn { flex: 1; }

/* Live banner (non-workout tabs) */
.fit-live-banner .k-banner { padding-block: 6px; }

/* ── Dialog panel (sheets) ───────────────────────────────────────────────── */
.fit-sheet { gap: 14px; padding: 20px; }
.fit-sheet-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.fit-sheet-head .k-dialog-title { overflow-wrap: anywhere; }
.fit-sheet-body { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.fit-sheet-body .k-list { border-top: 1px solid var(--k-divider); }
.fit-options { border-top: 1px solid var(--k-divider); }
.fit-options .k-list-row { padding: 0; }
.fit-option {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: 56px; padding: 10px 6px;
  font: inherit; color: var(--k-text); text-align: left; background: transparent; border: 0; cursor: pointer;
}
.fit-option:hover { background: var(--k-row-wash); }
.fit-option[aria-pressed="true"] { background: var(--k-app-tint); }
.fit-option:focus-visible { outline-offset: -2px; }
.fit-rpe .k-chips { gap: 6px; }
.fit-rpe .k-chip { min-width: 44px; justify-content: center; }
.fit-picker { max-height: 50vh; overflow: auto; }
.fit-plan-acts { justify-content: flex-start; }

/* ── Toast ───────────────────────────────────────────────────────────────── */
.fit-toast {
  position: fixed; left: 50%; bottom: 24px; z-index: 1000; transform: translateX(-50%);
  width: max-content; max-width: min(460px, calc(100vw - 32px)); padding: 12px 16px;
  font-size: var(--k-fs-14); line-height: 1.45; box-shadow: var(--k-shadow-md);
  background: var(--k-tone-bg); color: var(--k-tone-fg); border-left: 4px solid var(--k-tone-edge);
}

/* ── Plate calculator ────────────────────────────────────────────────────── */
.fit-plates { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 24px 32px; }
.fit-sheet .fit-plates { grid-template-columns: minmax(0, 1fr); }
.fit-plates-form { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.fit-plates-out { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.fit-stepper { display: flex; gap: 8px; align-items: stretch; }
.fit-stepper .k-input { -moz-appearance: textfield; appearance: textfield; text-align: center; font-size: var(--k-fs-20); font-weight: 800; }
.fit-stepper .k-btn.k-btn-icon { width: 44px; min-width: 44px; min-height: 44px; height: auto; font-size: var(--k-fs-20); }
.fit-more summary { cursor: pointer; font-size: var(--k-fs-13); font-weight: 600; color: var(--k-link-strong); min-height: 44px; display: flex; align-items: center; }
.fit-more[open] summary { margin-bottom: 8px; }
.fit-barbell { display: flex; align-items: center; justify-content: center; min-height: 170px; padding: 10px 0; background: var(--k-raised); overflow: hidden; }
.fit-shaft { flex: 1 1 60px; max-width: 120px; height: 10px; background: var(--k-muted); }
.fit-bar-side { display: flex; align-items: center; gap: 2px; }
.fit-bar-side--l { flex-direction: row-reverse; }
.fit-collar { width: 8px; height: 40px; background: var(--k-text-2); }
.fit-sleeve { width: 30px; height: 14px; background: var(--k-muted); }
.fit-plate {
  display: grid; place-items: center; height: 46px; width: 7px;
  font-size: 9px; font-weight: 800; writing-mode: vertical-rl; line-height: 1; overflow: hidden;
  color: var(--k-on-status); background: var(--k-track); border: 1px solid color-mix(in srgb, var(--k-text) 25%, transparent);
}
.fit-plate--r0 { height: 150px; width: 22px; background: var(--k-error); }
.fit-plate--r1 { height: 150px; width: 20px; background: var(--k-sleep); }
.fit-plate--r2 { height: 138px; width: 17px; background: var(--k-money); color: var(--k-ink); }
.fit-plate--r3 { height: 124px; width: 15px; background: var(--k-success); }
.fit-plate--r4 { height: 90px; width: 12px; background: var(--k-white); color: var(--k-ink); }
.fit-plate--r5 { height: 72px; width: 10px; background: var(--k-ink); }
.fit-plate--r6 { height: 58px; width: 8px; background: var(--k-toggle-off); color: var(--k-ink); }
.fit-plate--r7 { height: 46px; width: 7px; background: var(--k-track); color: var(--k-ink); }
.fit-legend { display: flex; flex-wrap: wrap; gap: 8px 16px; margin: 0; padding: 0; list-style: none; font-size: var(--k-fs-12); color: var(--k-text-2); }
.fit-legend li { display: inline-flex; align-items: center; gap: 6px; }
.fit-swatch { display: inline-block; width: 12px; height: 12px; flex: none; border: 1px solid color-mix(in srgb, var(--k-text) 25%, transparent); writing-mode: initial; }
.fit-legend .fit-plate--r0, .fit-legend .fit-plate--r1, .fit-legend .fit-plate--r2, .fit-legend .fit-plate--r3,
.fit-legend .fit-plate--r4, .fit-legend .fit-plate--r5, .fit-legend .fit-plate--r6, .fit-legend .fit-plate--r7 { width: 12px; height: 12px; }

/* ── Recovery body map ───────────────────────────────────────────────────── */
.fit-bodymap { display: flex; justify-content: center; gap: 24px; }
.fit-bodymap figure { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.fit-bodymap svg { width: 140px; height: 270px; }
.fit-bodymap figcaption { font-size: var(--k-fs-12); color: var(--k-muted); }
.fit-base { fill: var(--k-surface); stroke: var(--k-divider); stroke-width: 1; }
.fit-part { stroke: var(--k-bg); stroke-width: 1; cursor: default; }
.fit-part:focus-visible { outline: none; stroke: var(--k-focus); stroke-width: 2.5; }
.fit-part--fresh { fill: var(--k-success); background: var(--k-success); }
.fit-part--recovering { fill: var(--k-caution); background: var(--k-caution); }
.fit-part--fatigued { fill: var(--k-error); background: var(--k-error); }
.fit-part--unknown { fill: var(--k-toggle-off); background: var(--k-toggle-off); }

/* ── Exercise detail ─────────────────────────────────────────────────────── */
.fit-demo { display: grid; place-items: center; height: 280px; background: var(--k-surface); }
.fit-demo svg { width: 240px; height: 240px; }
.fit-demo svg rect { fill: var(--k-surface); rx: 0; }
.fit-demo svg g { stroke: var(--k-text); }
.fit-demo svg circle { fill: var(--k-text); }
.fit-demo svg text { fill: var(--k-muted); font-family: var(--k-font); }
.fit-plot-wrap { width: 100%; min-width: 0; }
.fit-plot { display: block; max-width: 100%; height: auto; touch-action: pan-y; overflow: visible; }
.fit-plot text { fill: var(--k-muted); font-size: var(--k-fs-11); font-family: var(--k-font); }
.fit-plot-grid { stroke: var(--k-divider); stroke-width: 1; }
.fit-plot-trend { fill: none; stroke: var(--k-app); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.fit-plot-point { fill: var(--k-app-deep); }
.fit-plot-hit { fill: transparent; }
.fit-plot-hair { stroke: var(--k-muted); stroke-width: 1; stroke-dasharray: 3 3; }
.fit-plot g:focus-visible { outline: none; }
.fit-plot g:focus-visible .fit-plot-point { stroke: var(--k-focus); stroke-width: 3; }

/* ── Exercise library ────────────────────────────────────────────────────── */
.fit-libbar { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 12px 18px; }
.fit-lib-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding-top: 12px; }
/* Row links read as links (underline) and stretch over their whole table row, so the row is the
   tap target (≥44px) on phones — not just the name text. */
.fit-rowlink { color: var(--k-text); font-weight: 600; margin-right: 8px; text-decoration: underline;
  text-decoration-thickness: 1px; text-underline-offset: 3px; text-decoration-color: var(--k-divider-strong); }
.fit-rowlink:hover { color: var(--k-link); text-decoration-color: currentColor; }
.fit-rowlink::after { content: ''; position: absolute; inset: 0; }
.k-table tbody tr:has(.fit-rowlink) { position: relative; cursor: pointer; }
.k-table td a { font-weight: 600; }
.fit-inline-chips { margin-top: 4px; }

/* ── Builder ─────────────────────────────────────────────────────────────── */
.fit-brow-acts { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.fit-move { display: inline-flex; gap: 4px; }
.fit-move .k-btn.k-btn-icon { width: 44px; height: 44px; min-height: 44px; justify-content: center; }
#b-list .k-list-row { cursor: grab; }
#b-list .k-list-row.fit-is-dragging { opacity: 0.5; }
#b-list .k-list-row.fit-is-over { box-shadow: inset 0 2px 0 var(--k-app-deep); }
#b-list .k-list-lead { width: 40px; color: var(--k-muted); }

/* ── Settings & equipment ────────────────────────────────────────────────── */
.fit-injuries { display: flex; flex-direction: column; gap: 8px; margin-top: 18px; }
.fit-injuries-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.fit-injuries-tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; list-style: none; }
.fit-inj-tag { white-space: normal; font-size: var(--k-fs-12-5); }
.fit-injuries .k-help { margin: 0; }
.fit-additem { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; gap: 10px; align-items: end; }
.fit-occ { font-size: var(--k-fs-12-5); white-space: nowrap; }
.fit-card-acts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }

/* Phone-only second line in a table's first cell (the columns it repeats are hidden on phones). */
.fit-cell-sub { display: none; margin-top: 2px; font-size: var(--k-fs-12); font-weight: 400; color: var(--k-muted); }
@container k-page (max-width: 600px) {
  .fit-lib-table .k-table :is(th, td):is(:nth-child(2), :nth-child(3)),
  .fit-best-table .k-table :is(th, td):is(:nth-child(3), :nth-child(5)),
  .fit-recent-table .k-table :is(th, td):is(:nth-child(3), :nth-child(5)) { display: none; }
  .fit-lib-table .fit-cell-sub, .fit-best-table .fit-cell-sub, .fit-recent-table .fit-cell-sub { display: block; }
  .fit-recent-table .k-table :is(th, td):is(:nth-child(1), :nth-child(4)) { white-space: nowrap; }
  .fit-best-table .k-table th { white-space: normal; }
  .fit-lib-table .k-table td:last-child, .fit-best-table .k-table td { white-space: nowrap; }
  .fit-best-table .k-table td:first-child { white-space: normal; }
  /* Long "What's shaping today" values wrap under their bar instead of squeezing it to nothing. */
  .fit-shaping .k-hbar { grid-template-columns: minmax(80px, 1fr) minmax(0, 1.4fr); row-gap: 4px; }
  .fit-shaping .k-hbar-value { grid-column: 1 / -1; white-space: normal; }
  /* Builder rows: move, edit and remove sit on their own line under the exercise name. */
  #b-list .k-list-row { flex-wrap: wrap; row-gap: 6px; }
  #b-list .fit-brow-acts { flex-basis: 100%; padding-left: 52px; }
}

/* ── Phones (390 artboards): the page follows its own width ──────────────── */
@container k-page (max-width: 720px) {
  .fit-pad { padding: 18px 16px; }
  .fit-home-grid, .fit-live-grid { grid-template-columns: minmax(0, 1fr); }
  .fit-home-main, .fit-logger { border-right: 0; border-bottom: 2px solid var(--k-divider); }
  .fit-hero { padding: 20px 16px; }
  .fit-hero-title { font-size: var(--k-fs-28); }
  .fit-start { min-width: 0; width: 100%; }
  .fit-hero-actions { width: 100%; }
  .fit-hero-actions .k-btn { flex: 1 1 auto; }
  .fit-exrow, .fit-jump { padding: 12px 16px; }
  .fit-home-foot { padding: 12px 16px; }
  .fit-home-main > .k-state { padding: 18px 16px; }
  .fit-side-sec, .fit-live-side .fit-side-sec { padding: 20px 16px; }
  .fit-big { font-size: var(--k-fs-44); }

  .fit-logger { min-height: calc(100svh - 112px); }
  .fit-logger-head { padding: 16px; }
  .fit-logger > .k-block .k-note, .fit-logger > .k-note { margin: 12px 16px 0; }
  .fit-logger > p.fit-pad { padding: 10px 16px 0; }
  .fit-sets thead th:first-child, .fit-sets tbody th { padding-left: 16px; }
  .fit-sets thead th:last-child, .fit-sets td:last-child { padding-right: 16px; }
  .fit-sets thead th:nth-child(1) { width: calc(16px + 48px); }
  .fit-sets thead th:nth-child(3) { width: 60px; }
  .fit-sets thead th:nth-child(4) { width: 52px; }
  .fit-sets thead th:nth-child(5) { width: 52px; }
  .fit-sets th, .fit-sets td { padding-inline: 2px; }
  .fit-cell { min-width: 44px; }
  .fit-sets thead th:nth-child(6) { width: calc(16px + 48px); }
  .fit-logger-after { padding: 16px; }
  .fit-logger-bar { padding: 12px 16px; }
  .fit-jump.fit-is-current { padding-left: 10px; }
  .fit-rest-card { grid-template-columns: auto minmax(0, 1fr) auto; }

  .fit-plates { grid-template-columns: minmax(0, 1fr); }
  .fit-libbar { grid-template-columns: minmax(0, 1fr); }
  .fit-additem { grid-template-columns: minmax(0, 1fr); }
  .fit-bodymap svg { width: 120px; height: 232px; }
}

@media (max-width: 720px) {
  .fit-rest { left: 16px; right: 16px; width: auto; bottom: calc(16px + env(safe-area-inset-bottom, 0px)); }
  dialog.fit-sheet { width: 100%; max-width: 100%; margin: auto 0 0; max-height: 88vh; }
}

/* Toasts clear the live logger's sticky action bar and the floating rest timer (app.js measures them into --fit-toast-lift). */
.fit-toast { bottom: calc(var(--fit-toast-lift, 0px) + 16px + env(safe-area-inset-bottom, 0px)); }

@media (prefers-reduced-motion: reduce) {
  .fit-exrow, .fit-jump, .fit-option { transition: none; }
}
@media (forced-colors: active) {
  .fit-done[aria-checked="true"], .fit-day--done, .fit-meter > span, .fit-rest-track > span { background: Highlight; forced-color-adjust: none; }
  .fit-day--today, .fit-day--planned { border: 2px solid CanvasText; }
}
/* A table rendered inside another block keeps its caption for assistive tech but no visible title. */
.fit-flat > .k-block-head { display: none; }
.fit-sets tr.fit-is-done .fit-c-num { padding-left: 8px; }
.fit-exlist--compact .fit-jump { padding-right: 6px; }
.fit-stepper .k-input::-webkit-outer-spin-button, .fit-stepper .k-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
