/* ==========================================================================
   MAXFIT · coach workout builder
   Loads on top of card/styles.css + checkin.css — same shell/fonts/palette,
   reuses checkin's PIN row styling.
   ========================================================================== */

.builder {
  gap: 20px;
}

.builder__layout {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.builder__main {
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-width: 0;
}

/* Side-by-side only once there's real room for it (a laptop window, which
   is how Max actually uses this page — not a phone). Below this width
   .builder__side just stacks under the form like any other section. */
@media (min-width: 860px) {
  .builder {
    max-width: 900px;
  }

  .builder__layout {
    flex-direction: row;
    align-items: flex-start;
    gap: 28px;
  }

  .builder__main {
    flex: 1 1 460px;
  }

  .builder__side {
    flex: 0 0 340px;
  }
}

/* The live "how hard did this workout hit each muscle" summary — painted
   client-side by refreshMuscleLoadPanel_ (builder.js) from the rows
   currently in the workout (each row's own primary/secondary muscles x its
   own Sets value), the same primary=1/secondary=0.5 weighting the Muscle
   Heatmap uses. No network call, recomputed on every add/remove/sets-edit/
   exercise-pick. Sticky so it stays in view while scrolling a long
   exercise list on a wide window. Replaces the old per-row muscle chip
   list (2026-10-05) — that spelled out every exercise's muscles on its own
   row, which made a long workout very tall for the same information this
   panel now shows once, aggregated, for the whole thing. */
.builder__side {
  position: sticky;
  top: 20px;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.builder__side-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.builder__side-sub {
  font-family: var(--font-body);
  font-size: 12.5px;
  color: var(--dim);
}

.builder__side-figs {
  display: flex;
  justify-content: center;
  gap: 10px;
}

.builder__side-fig-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  width: 140px;
}

.builder__side-figs svg {
  width: 100%;
  height: auto;
}

.builder__side-fig-caption {
  font-family: var(--font-head);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 11px;
  color: var(--dim);
}

.builder__side-heat-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

/* A muscle (Quads, Hamstrings...) that opens to its heads (2026-10-10). */
.builder__side-fam-head {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  cursor: pointer;
  list-style: none;
}

.builder__side-fam-head::-webkit-details-marker {
  display: none;
}

.builder__side-fam-head .builder__side-heat-row {
  flex: 1;
  min-width: 0;
}

.builder__side-fam-chevron {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  color: var(--grey);
  transition: transform 0.2s ease;
}

.builder__side-fam[open] > .builder__side-fam-head .builder__side-fam-chevron {
  transform: rotate(180deg);
}

@media (prefers-reduced-motion: reduce) {
  .builder__side-fam-chevron {
    transition: none;
  }
}

.builder__side-fam-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 8px 22px 4px 4px;
  padding-left: 10px;
  border-left: 2px solid var(--line);
}

.builder__side-fam-body .builder__side-heat-row__name {
  color: var(--grey);
  font-weight: 500;
  white-space: normal;
  line-height: 1.25;
}

.builder__side-heat-row {
  display: grid;
  grid-template-columns: 92px 1fr;
  align-items: flex-start;
  gap: 8px;
}

.builder__side-heat-row__name {
  font-family: var(--font-body);
  font-size: 13.5px;
  font-weight: 600;
  color: var(--white);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* The bar + its own count(s) stacked together, so the numbers below line
   up under the segment they belong to (2026-10-05, was a combined "3+5"
   off to the side in its own column). */
.builder__side-heat-row__bar {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.builder__side-heat-row__track {
  display: flex;
  height: 6px;
  border-radius: 3px;
  background: var(--bg);
  overflow: hidden;
}

.builder__side-heat-row__fill--primary {
  background: var(--red);
}

.builder__side-heat-row__fill--secondary {
  background: #e08a00;
}

.builder__side-heat-row__nums {
  display: flex;
  height: 13px;
}

.builder__side-heat-row__segnum--primary,
.builder__side-heat-row__segnum--secondary {
  display: flex;
  justify-content: center;
  overflow: visible;
  white-space: nowrap;
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.builder__side-heat-row__segnum--primary {
  color: var(--red);
}

.builder__side-heat-row__segnum--secondary {
  color: #e08a00;
}

.builder__side-empty {
  font-family: var(--font-body);
  font-size: 13px;
  color: var(--dim);
  text-align: center;
  padding: 6px 0;
}

.builder__field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.builder__select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23cccccc' stroke-width='2.5'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 38px;
}

.builder__chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.builder__chip {
  font-family: var(--font-head);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  font-size: 11px;
  color: var(--grey-light);
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 12px;
  cursor: pointer;
  touch-action: none; /* a touch-drag reorders the chip instead of scrolling the page */
  user-select: none;
}

.builder__chip:active,
.builder__chip--active {
  border-color: var(--red);
  color: var(--white);
}

.builder__chip--dragging {
  position: relative;
  z-index: 5;
  border-color: var(--red);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.5);
}

.builder__days {
  display: flex;
  gap: 6px;
}

.builder__day {
  flex: 1;
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 12px;
  color: var(--grey-light);
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  height: 38px;
  cursor: pointer;
}

.builder__day:active {
  border-color: var(--red);
}

.builder__day--active {
  background: var(--red);
  border-color: var(--red);
  color: var(--on-red);
}

.builder__delete {
  font-family: var(--font-head);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 13px;
  color: var(--dim);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px;
  cursor: pointer;
}

.builder__delete[hidden] {
  display: none;
}

.builder__delete:active {
  color: var(--red);
  border-color: var(--red);
}

.builder__exercises {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* The name gets its own full-width line — a coach needs to actually read
   which exercise this is, and sharing one line with sets/reps/handle/
   move/remove left it squeezed down to a sliver (and its muscle chips,
   nested inside the same button, stacking one per line). Sets/reps and the
   controls share the line below, the tip sits under that. (Children, in
   order: 1 name, 2 sets, 3 reps, 4 drag handle, 5 up/down, 6 remove, then
   the tip, then the superset toggle — see the nth-child rules below.) */
.builder__row {
  display: grid;
  grid-template-columns: 56px 80px 1fr 26px 26px 30px 44px;
  column-gap: 8px;
  row-gap: 6px;
  align-items: center;
}

.builder__row > :nth-child(1) { grid-column: 1 / -1; grid-row: 1; }
.builder__row > :nth-child(2) { grid-column: 1; grid-row: 2; }
.builder__row > :nth-child(3) { grid-column: 2; grid-row: 2; }
.builder__row > :nth-child(4) { grid-column: 4; grid-row: 2; }
.builder__row > :nth-child(5) { grid-column: 5; grid-row: 2; }
.builder__row > :nth-child(6) { grid-column: 6; grid-row: 2; }
/* 7 is the tip, 8 the link icon, 9 the ⋯ menu, 10 the superset header. */
.builder__row > :nth-child(9) { grid-column: 7; grid-row: 2; }

/* The first row of a superset carries the group's header, so everything else moves down one line. */
.builder__row--ss-start > .builder__ss-head { grid-column: 1 / -1; grid-row: 1; }
.builder__row--ss-start > :nth-child(1) { grid-row: 2; }
.builder__row--ss-start > :nth-child(2),
.builder__row--ss-start > :nth-child(3),
.builder__row--ss-start > :nth-child(4),
.builder__row--ss-start > :nth-child(5),
.builder__row--ss-start > :nth-child(6),
.builder__row--ss-start > :nth-child(9) { grid-row: 3; }

.builder__row input {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 14px;
  color: var(--white);
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 11px 10px;
  width: 100%;
  min-width: 0;
}

.builder__row input:focus {
  outline: none;
  border-color: var(--red);
}

/* The exercise field is a button (opens ExercisePicker), styled to match
   the row's text inputs it sits beside. */
.builder__row-exercise {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 14px;
  color: var(--white);
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 11px 10px;
  width: 100%;
  min-width: 0;
  text-align: left;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
}

.builder__row-exercise-top {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

/* The muscles this exercise mainly works, drawn from the body figure. */
.builder__row-symbol {
  flex: none;
  width: 56px;
  height: 56px;
  overflow: hidden;
  background: #111;
  border: 1px solid var(--line);
  border-radius: 10px;
}

.builder__row-symbol:not([hidden]) {
  display: block;
}

.builder__row-symbol svg {
  display: block;
  width: 100%;
  height: 100%;
}

.builder__row-exercise:active {
  border-color: var(--red);
}

.builder__row-exercise--empty .builder__row-exercise-label {
  color: var(--dim);
  font-weight: 500;
}

.builder__row-exercise-label {
  flex-grow: 1;
  min-width: 0;
}

/* A row whose exercise name has no muscle data at all — not in the
   Exercises catalog under this exact or a normalised name, or matched a
   row that itself has none set yet (2026-10-09). Sits under the name/symbol
   line; no separate button, since the row itself already reopens the
   picker on tap. */
.builder__row-exercise-warning {
  text-align: left;
  font-family: var(--font-body);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--red);
}

/* `display: block` only when actually shown — an unconditional one here
   would override the browser's own `[hidden] { display: none }` rule
   (same specificity, later in the cascade), making `.hidden = true` a
   no-op and showing the warning on every row regardless (found 2026-10-09
   while verifying the effective-sets engine in a real browser — the
   warning was rendering for every exercise, matched or not). */
.builder__row-exercise-warning:not([hidden]) {
  display: block;
}

.builder__row input[type="number"] {
  text-align: center;
  padding: 11px 4px;
}

/* The tip sits on its own line under the exercise (spans every column). It's
   the LAST input in the row, so the first three inputs keep their meaning. */
.builder__row .builder__row-tip {
  grid-column: 1 / -1;
  grid-row: 3;
  font-size: 12.5px;
  font-weight: 500;
  padding: 8px 10px;
}

.builder__row .builder__row-tip::placeholder {
  color: var(--dim);
}

.builder__note {
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.4;
  resize: vertical;
  min-height: 62px;
}

.builder__row-remove {
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 18px;
  color: var(--dim);
  background: transparent;
  border: none;
  width: 30px;
  height: 40px;
  cursor: pointer;
}

.builder__row-remove:active {
  color: var(--red);
}

.builder__row-handle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 40px;
  font-size: 16px;
  letter-spacing: -1px;
  color: var(--dim);
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  cursor: grab;
  touch-action: none; /* otherwise a touch-drag tries to scroll the page instead of reordering */
  user-select: none;
}

.builder__row--dragging {
  position: relative;
  z-index: 5;
  background: var(--bg-card);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.5);
}

.builder__row--dragging .builder__row-handle {
  cursor: grabbing;
  border-color: var(--red);
  color: var(--red);
}

.builder__row-move {
  display: flex;
  flex-direction: column;
  gap: 2px;
  height: 40px;
}

.builder__row-move-btn {
  flex: 1;
  font-size: 9px;
  line-height: 1;
  color: var(--dim);
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0;
  cursor: pointer;
}

.builder__row-move-btn:active {
  color: var(--red);
  border-color: var(--red);
}

/* Superset: the link icon under each row, plus the bracket, letters and header
   drawn by refreshSupersets_ in builder.js. */
.builder__row .builder__ss-link {
  grid-column: 1 / -1;
  grid-row: 5;
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  height: 44px;
  margin-top: 2px;
}

.builder__row--ss-start > .builder__row-tip { grid-row: 4; }
.builder__row--ss-start > .builder__ss-link { grid-row: 6; }

/* Drop set and Strength Progress chips (refreshRowExtras_), on the line under the tip. */
.builder__row .builder__row-chips { grid-column: 1 / -1; grid-row: 4; display: flex; flex-wrap: wrap; gap: 8px; }
.builder__row--ss-start > .builder__row-chips { grid-row: 5; }
.builder__row-chips[hidden],
.builder__row-menu-item[hidden] { display: none !important; }
.builder__chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 4px 0 12px;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 14px;
  text-transform: none;
  letter-spacing: 0;
  color: var(--white);
  border-radius: 999px;
}
.builder__chip--drop { background: rgba(224, 0, 0, 0.1); border: 1px solid rgba(224, 0, 0, 0.5); }
.builder__chip--drop svg { color: var(--red); flex-shrink: 0; }
.builder__chip--grey { color: var(--grey); background: rgba(255, 255, 255, 0.05); border: 1px solid var(--line); }
.builder__chip-btn,
.builder__chip-x {
  width: 36px;
  height: 36px;
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 18px;
  color: var(--white);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 999px;
  cursor: pointer;
}
.builder__chip-x { color: var(--dim); background: none; border: none; }
.builder__chip-btn:hover, .builder__chip-x:hover { color: var(--white); border-color: var(--red); }

.builder__ss-link[hidden],
.builder__row-more[hidden],
.builder__ss-head[hidden],
.builder__row-menu[hidden] {
  display: none !important;
}

.builder__ss-link::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  border-top: 1px solid var(--line);
}

.builder__ss-link-btn {
  position: relative;
  width: 44px;
  height: 44px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--dim);
  background: none;
  border: none;
  cursor: pointer;
}

.builder__ss-link-btn span {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 999px;
  background: var(--bg);
  border: 1px solid var(--line);
}

.builder__ss-link-btn:hover span {
  color: var(--white);
  border-color: var(--red);
}

.builder__ss-link-btn[aria-pressed="true"] {
  color: var(--on-red);
}

.builder__ss-link-btn[aria-pressed="true"] span {
  background: var(--red);
  border-color: var(--red);
}

.builder__row-more {
  position: relative;
  width: 44px;
  height: 44px;
}

.builder__row-more-btn {
  width: 44px;
  height: 44px;
  font-size: 20px;
  color: var(--grey);
  background: none;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.builder__row-more-btn:hover {
  background: rgba(255, 255, 255, 0.08);
}

.builder__row-menu {
  position: absolute;
  right: 0;
  top: 44px;
  z-index: 5;
  width: 220px;
  padding: 4px;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}

.builder__row-menu-item {
  display: block;
  width: 100%;
  min-height: 44px;
  padding: 0 12px;
  text-align: left;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 16px;
  color: var(--white);
  background: none;
  border: none;
  border-radius: 6px;
  cursor: pointer;
}

.builder__row-menu-item:hover {
  background: rgba(255, 255, 255, 0.08);
}

/* The bracket down the side of a group. It runs on through the gap between rows. */
.builder__row--ss {
  position: relative;
  padding-left: 16px;
}

.builder__row--ss::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: -10px;
  border-left: 3px solid var(--red);
}

.builder__row--ss-start::before {
  border-top: 3px solid var(--red);
  border-top-left-radius: 8px;
  width: 10px;
}

.builder__row--ss-end::before {
  bottom: 44px;
  border-bottom: 3px solid var(--red);
  border-bottom-left-radius: 8px;
  width: 10px;
}

.builder__row--ss-end:last-child::before {
  bottom: 0;
}

.builder__ss-head {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 8px 0 4px;
}

.builder__ss-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
}

.builder__ss-pill {
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 14px;
  color: var(--on-red);
  background: var(--red);
  border-radius: 999px;
  padding: 5px 12px 4px;
}

.builder__ss-rest {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 600;
  color: var(--grey);
}

.builder__ss-step {
  width: 44px;
  height: 44px;
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 20px;
  color: var(--white);
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.builder__ss-rest-value {
  min-width: 44px;
  text-align: center;
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 18px;
  color: var(--white);
  font-variant-numeric: tabular-nums;
}

.builder__ss-note {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  padding: 8px 10px;
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--grey);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}

.builder__ss-note span {
  flex: 1 1 220px;
  min-width: 0;
}

.builder__ss-match {
  min-height: 44px;
  padding: 0 14px;
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 16px;
  color: var(--white);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.builder__ss-letter {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  min-width: 34px;
  height: 24px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--red);
  color: var(--on-red);
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 15px;
}

.builder__add {
  font-family: var(--font-head);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 13px;
  color: var(--grey-light);
  background: transparent;
  border: 1px dashed var(--line-strong, var(--line));
  border-radius: var(--radius-sm);
  padding: 12px;
  cursor: pointer;
}

.builder__add:active {
  border-color: var(--red);
  color: var(--red);
}

.builder__save {
  font-family: var(--font-head);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 16px;
  color: var(--on-red);
  background: var(--red);
  border: none;
  border-radius: var(--radius-sm);
  padding: 18px;
  cursor: pointer;
}

.builder__save:active {
  background: var(--red-dim);
}

.builder__save:disabled {
  opacity: 0.55;
  cursor: default;
}

.builder__success {
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--grey-light);
  text-align: center;
  margin: 0;
}

/* The smallest phones: trim the fixed columns so the row still fits inside the card. */
@media (max-width: 360px) {
  .builder__row {
    grid-template-columns: 48px 64px 1fr 24px 24px 26px 40px;
    column-gap: 6px;
  }

  .builder__row .builder__row-handle {
    width: 24px;
  }

  .builder__row .builder__row-remove {
    width: 26px;
  }
}

/* ==========================================================================
   Boxing rounds (built 2026-11-07) — a block row in the exercise list (just
   a summary + Edit, never expands inline like a normal exercise row), and
   the block editor dialog that builds/edits one.
   ========================================================================== */

.builder__add-row {
  display: flex;
  gap: 10px;
}

.builder__add-row .builder__add {
  flex: 1;
}

.builder__add--boxing:active {
  border-color: var(--red);
  color: var(--red);
}

.builder__row--boxing {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
}

.builder__boxing-summary {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: left;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 4px;
}

.builder__boxing-summary-tag {
  flex-shrink: 0;
  font-family: var(--font-head);
  font-weight: 700;
  letter-spacing: 0.04em;
  font-size: 12px;
  color: var(--on-red);
  background: var(--red);
  border-radius: 999px;
  padding: 4px 10px 3px;
}

.builder__boxing-summary-text {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.builder__boxing-summary-name {
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 15px;
  color: var(--white);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.builder__boxing-summary-meta {
  font-family: var(--font-body);
  font-size: 13px;
  color: var(--dim);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---- Block editor dialog ------------------------------------------------ */

.builder__boxing-modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.builder__boxing-modal[hidden] {
  display: none;
}

.builder__boxing-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
}

.builder__boxing-modal-panel {
  position: relative;
  width: 100%;
  max-width: 520px;
  max-height: 88vh;
  overflow-y: auto;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.builder__boxing-modal-title {
  margin: 0;
  font-family: var(--font-head);
  font-weight: 800;
  text-transform: uppercase;
  font-size: 22px;
  letter-spacing: 0.02em;
  color: var(--white);
}

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

.builder__boxing-select {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 15px;
  color: var(--white);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
}

.builder__boxing-segmented {
  display: flex;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 3px;
  gap: 3px;
}

.builder__boxing-segmented-btn {
  flex: 1;
  min-height: 40px;
  font-family: var(--font-head);
  font-weight: 700;
  text-transform: none;
  letter-spacing: 0;
  font-size: 14px;
  color: var(--grey-light);
  background: transparent;
  border: none;
  border-radius: calc(var(--radius-sm) - 3px);
  cursor: pointer;
}

.builder__boxing-segmented-btn[aria-pressed="true"] {
  color: var(--on-red);
  background: var(--red);
}

.builder__boxing-steppers {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.builder__boxing-stepper {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 10px;
}

.builder__boxing-stepper-label {
  font-family: var(--font-head);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  font-size: 11px;
  color: var(--dim);
}

.builder__boxing-stepper-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.builder__boxing-step-btn {
  flex-shrink: 0;
  width: 30px;
  height: 30px;
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 16px;
  color: var(--white);
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 999px;
  cursor: pointer;
}

.builder__boxing-step-value {
  min-width: 46px;
  text-align: center;
  font-family: var(--font-head);
  font-weight: 800;
  font-size: 16px;
  color: var(--white);
  font-variant-numeric: tabular-nums;
}

.builder__boxing-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.builder__boxing-chip {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 13px;
  color: var(--grey-light);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 12px;
  cursor: pointer;
}

.builder__boxing-chip:active {
  border-color: var(--red);
  color: var(--red);
}

.builder__boxing-rounds-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.builder__boxing-round-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.builder__boxing-round-num {
  flex-shrink: 0;
  width: 26px;
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 13px;
  color: var(--dim);
}

.builder__boxing-round-input {
  flex: 1;
  min-width: 0;
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--white);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
}

.builder__boxing-round-input--active {
  border-color: var(--red);
}

.builder__boxing-switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.builder__boxing-switch-label {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 15px;
  color: var(--white);
}

.builder__boxing-switch {
  flex-shrink: 0;
  position: relative;
  width: 46px;
  height: 26px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 999px;
  cursor: pointer;
}

.builder__boxing-switch[aria-pressed="true"] {
  background: var(--red);
  border-color: var(--red);
}

.builder__boxing-switch-knob {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--white);
  transition: transform 0.15s ease;
}

.builder__boxing-switch[aria-pressed="true"] .builder__boxing-switch-knob {
  transform: translateX(20px);
}

.builder__boxing-modal-actions {
  display: flex;
  gap: 10px;
}

.builder__boxing-modal-cancel {
  flex: 1;
  min-height: 48px;
  font-family: var(--font-head);
  font-weight: 700;
  text-transform: none;
  letter-spacing: 0;
  font-size: 15px;
  color: var(--grey-light);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.builder__boxing-modal-confirm {
  flex: 2;
  min-height: 48px;
  font-family: var(--font-head);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: 15px;
  color: var(--on-red);
  background: var(--red);
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.builder__boxing-modal-confirm:active {
  background: var(--red-dim);
}

/* ==========================================================================
   "This week" muscle overview (built 2026-11-08) — a second panel in the
   same side column as "this workout" above, scoped to every named workout
   this client has rather than just the one being edited. Read-only.
   ========================================================================== */

.builder__week {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

.builder__week-summary {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  list-style: none;
}

.builder__week-summary::-webkit-details-marker {
  display: none;
}

.builder__week-summary .card__label {
  flex-shrink: 0;
}

.builder__week-summary-text {
  flex: 1;
  min-width: 0;
  font-family: var(--font-body);
  font-size: 13px;
  color: var(--dim);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.builder__week-summary .builder__side-fam-chevron {
  flex-shrink: 0;
  transition: transform 0.15s ease;
}

.builder__week[open] > .builder__week-summary .builder__side-fam-chevron {
  transform: rotate(180deg);
}

.builder__week-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 14px;
}

.builder__week-toggle {
  display: flex;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 3px;
  gap: 3px;
}

.builder__week-toggle button {
  flex: 1;
  min-height: 36px;
  font-family: var(--font-head);
  font-weight: 700;
  text-transform: none;
  letter-spacing: 0;
  font-size: 13px;
  color: var(--grey-light);
  background: transparent;
  border: none;
  border-radius: calc(var(--radius-sm) - 3px);
  cursor: pointer;
}

.builder__week-toggle button.is-active {
  color: var(--on-red);
  background: var(--red);
}

.builder__week-no-days {
  margin: 0;
  font-family: var(--font-body);
  font-size: 12px;
  color: var(--dim);
}

.builder__week-heat-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.builder__week-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.builder__week-row .builder__side-heat-row {
  flex: 1;
  min-width: 0;
}

.builder__week-diff {
  flex-shrink: 0;
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 12px;
  padding: 2px 6px;
  border-radius: 999px;
}

.builder__week-diff--up {
  color: var(--red);
  background: rgba(224, 0, 0, 0.12);
}

.builder__week-diff--down {
  color: var(--dim);
  background: rgba(255, 255, 255, 0.06);
}

.builder__week-note {
  margin: 0;
  font-family: var(--font-body);
  font-size: 12px;
  line-height: 1.4;
  color: var(--dim);
}

@media (max-width: 859px) {
  .builder__week {
    margin-top: 16px;
  }
}
