/* ═══════════════════════════════════════════════════════════════════════════
   training-builder-drawer.css — FASE C: stile del drawer dettaglio
   Carica DOPO training-builder.css. Usa i token di theme.css (chiaro/scuro).
   ═══════════════════════════════════════════════════════════════════════════ */

.pbd { display: flex; flex-direction: column; height: 100%; margin: -16px; /* riempi il padding del .pb-right */ }


.pbd .pb-drawer-head { align-items: center; gap: 10px; padding: 14px 16px;
  background: color-mix(in srgb, var(--ex-color) 6%, var(--bg-surface));
  border-bottom: 1px solid var(--border-light); border-radius: 0; }
.pbd-head-txt { flex: 1; min-width: 0; }
.pbd .pb-drawer-ic { background: var(--ex-color); }

.pbd-body { scrollbar-width: none; flex: 1; overflow: auto; padding: 20px; display: flex; flex-direction: column; gap: 24px; }
.pbd-volume-card {
  border: 1.5px solid color-mix(in srgb, var(--ex-color) 24%, var(--border-light));
  border-radius: 11px;
  background: color-mix(in srgb, var(--ex-color) 7%, var(--bg-surface-raised));
  max-height: 10px;
}
.pbd-volume-card .pb-vol-row { min-height: 26px; }
.pbd-volume-card .pb-vol-name { width: 88px; color: var(--text-heading); }
.pbd-sec { background: var(--bg-surface-raised); border: 1.5px solid var(--border-light); border-radius: 11px; padding: 14px; }
.pbd-sec--disabled { opacity: .64; }
.pbd-sec--disabled input,
.pbd-sec--disabled select,
.pbd-sec--disabled textarea,
.pbd-sec--disabled button { pointer-events: none; }
.pbd-sec-h { display: flex; align-items: center; justify-content: space-between; gap: 8px;
  font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .07em;
  color: var(--text-muted); margin-bottom: 12px; }
.pbd-grid {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 11px 10px;
  align-items: start;
}
.pbd-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; align-self: start; }
.pbd-field--series { grid-column: span 2; }
.pbd-field--reps { grid-column: span 6; }
.pbd-field--peso,
.pbd-field--recupero,
.pbd-field--rpe,
.pbd-field--rir { grid-column: span 4; }
.pbd-label {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 13px;
  width: 100%;
  text-align: center;
  font-size: 9.5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-muted);
}
.pbd .exercise-input { width: 100% !important; min-width: 0; min-height: 40px; box-sizing: border-box; padding: 9px 10px; text-align: center;
  border: 1.5px solid var(--border-medium); border-radius: 9px; background: var(--bg-surface-raised);
  color: var(--text-heading); font-size: 15px; font-weight: 800; font-variant-numeric: tabular-nums; }
.pbd-field--intensity-locked .exercise-input {
  border-color: color-mix(in srgb, #f59e0b 52%, var(--border-medium));
  color: var(--text-muted);
  background:
    repeating-linear-gradient(135deg, rgba(245, 158, 11, .12) 0 7px, transparent 7px 14px),
    color-mix(in srgb, #f59e0b 8%, var(--bg-surface-raised));
  cursor: not-allowed;
  box-shadow: inset 0 0 0 1px rgba(245, 158, 11, .08);
}
.pbd-lock-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 20px;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, #f59e0b 48%, var(--border-medium));
  background: color-mix(in srgb, #f59e0b 10%, var(--bg-surface));
  color: color-mix(in srgb, #f59e0b 80%, var(--text-heading));
  font-size: 10px;
  font-weight: 850;
  line-height: 1;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.pbd-lock-badge::before {
  content: "";
  width: 6px;
  height: 6px;
  margin-right: 5px;
  border: 1.5px solid currentColor;
  border-radius: 2px;
  box-shadow: 0 -4px 0 -2px currentColor;
}
.pbd .exercise-input--target { color: var(--gradient-app-start);
  border-color: color-mix(in srgb, var(--gradient-app-start) 35%, var(--border-medium));
  background: color-mix(in srgb, var(--gradient-app-start) 7%, var(--bg-surface-raised)); }
.pbd .combo-wrap {
  display: flex;
  align-items: stretch;
  width: 100%;
  gap: 5px;
}
.pbd .combo-wrap .exercise-input,
.pbd .peso-wrap > .exercise-input {
  flex: 1 1 auto;
  width: auto !important;
}

.pbd .combo-invert {
  flex: 0 0 31px;
  width: 31px;
  min-height: 40px;
  height: auto;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 800;
}
.pbd-field--series > .exercise-input,
.pbd-field--reps .combo-wrap--range,
.pbd-field--reps .pbd-reps-min,
.pbd-field--reps .reps-unit-sel {
  min-height: 50px;
}
.pbd .reps-range-wrap {
  display: flex;
  align-items: stretch;
  gap: 6px;
  flex-wrap: nowrap;
  width: 100%;
}
.pbd-field--reps .combo-wrap {
  flex: 1 1 auto;
  width: auto;
  min-width: 0;
}
.pbd-field--reps .combo-wrap--range {
  align-items: stretch;
}
.pbd-field--reps .exercise-input--repsbound {
  flex: 1 1 0;
  width: auto !important;
  min-width: 0;
}
.pbd-field--reps .reps-range-sep {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 8px;
  color: var(--text-muted);
  font-weight: 800;
}
.pbd-field--reps .reps-unit-sel {
  flex: 0 0 58px;
  width: 58px;
  box-sizing: border-box;
  padding: 0 9px;
  border: 1.5px solid var(--border-medium);
  border-radius: 9px;
  background: var(--bg-surface-raised);
  color: var(--text-heading);
  font-family: inherit;
  font-size: 12px;
  font-weight: 800;
  text-align: center;
}
.pbd-field--reps-seconds .pbd-reps-max,
.pbd-field--reps-seconds .reps-range-sep,
.pbd-field--reps-seconds .combo-toggle,
.pbd-field--reps-seconds .combo-invert {
  display: none !important;
}
.pbd-field--reps-seconds .pbd-reps-min {
  flex: 1 1 auto;
  width: auto !important;
}
.pbd-reps-disclaimer[hidden] {
  display: none !important;
}
.pbd-reps-disclaimer {
  margin: 0;
  padding: 6px 8px;
  border: 1px solid color-mix(in srgb, var(--gradient-app-start) 20%, transparent);
  border-radius: 8px;
  background: color-mix(in srgb, var(--gradient-app-start) 6%, transparent);
  color: var(--text-muted);
  font-size: 10.5px;
  font-weight: 700;
  line-height: 1.25;
  text-align: center;
}
.pbd .peso-wrap { display: flex; align-items: stretch; width: 100%; gap: 6px; min-width: 0; }
.pbd .peso-type-sel { display: none; }
.pbd .peso-wrap--bw {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  grid-template-areas:
    "type input"
    "hint hint";
  align-items: stretch;
}
.pbd .peso-type-picker.progress-exercise-picker {
  position: relative;
  width: 58px;
  min-width: 58px;
  flex: 0 0 58px;
  grid-area: type;
}
.pbd .peso-wrap--bw > .exercise-input {
  grid-area: input;
}
.pbd .peso-wrap--bw .peso-bw-hint {
  grid-area: hint;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  min-height: 25px;
  padding: 4px 8px;
  border: 1px solid color-mix(in srgb, var(--gradient-app-start) 22%, var(--border-light));
  border-radius: 8px;
  background: color-mix(in srgb, var(--gradient-app-start) 7%, var(--bg-surface-raised));
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 800;
  line-height: 1.2;
  text-align: center;
  white-space: normal;
}
.pbd .pbd-massimale-note {
  margin: 6px 0 0;
  padding: 5px 8px;
  border: 1px solid color-mix(in srgb, var(--gradient-app-start) 18%, var(--border-light));
  border-radius: 8px;
  background: color-mix(in srgb, var(--gradient-app-start) 6%, transparent);
  color: var(--text-muted);
  font-size: 10.5px;
  font-weight: 700;
  line-height: 1.3;
  text-align: center;
}
.pbd .pbd-massimale-note b { color: var(--text-secondary); font-weight: 800; }
.pbd .pbd-bw-note {
  margin: 0 0 8px;
  padding: 6px 8px;
  border: 1px solid color-mix(in srgb, var(--gradient-app-start) 20%, var(--border-light));
  border-radius: 8px;
  background: color-mix(in srgb, var(--gradient-app-start) 7%, var(--bg-surface-raised));
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.3;
}
.pbd .pbd-bw-note b { color: var(--text-heading); font-weight: 800; }
.pbd .peso-type-trigger.progress-exercise-trigger {
  height: 40px;
  min-height: 40px;
  border-radius: 9px;
  background: var(--bg-surface-raised);
}
.pbd .peso-type-picker.open .peso-type-trigger.progress-exercise-trigger {
  border-radius: 9px 9px 0 0;
}
.pbd .peso-type-dropdown.progress-exercise-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  display: none;
  min-width: 100%;
  z-index: 1200;
}
.pbd .peso-type-dropdown.progress-exercise-dropdown.active {
  display: block;
}

.pbd-emom { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 12px 14px; border-radius: 11px;
  background: color-mix(in srgb, #0ea5e9 10%, transparent); border: 1.5px solid color-mix(in srgb, #0ea5e9 25%, transparent);
  font-size: 13px; color: var(--text-primary); }

.pbd-pills { display: flex; flex-wrap: wrap; gap: 6px; }
.pbd-muted { font-size: 12px; color: var(--text-muted); font-style: italic; line-height: 1.5; }
.pbd-muted code { font-style: normal; font-size: 11px; background: var(--bg-surface-raised); padding: 1px 5px; border-radius: 5px; }

.pbd-sec--techniques { display: flex; flex-direction: column; gap: 10px; }
.pbd-tech-list { display: flex; flex-direction: column; gap: 10px; }
.pbd-tech-add { display: flex; justify-content: flex-end; }
.pbd-tech-add-select {
  width: min(100%, 190px);
  min-height: 34px;
  padding: 7px 10px;
  border: 1.5px dashed var(--border-medium);
  border-radius: 8px;
  background: var(--bg-surface);
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 12px;
  font-weight: 800;
}
.pbd-tech-card {
  border: 1.5px solid var(--border-light);
  border-radius: 10px;
  background: var(--bg-surface);
  overflow: hidden;
}
.pbd-tech-card--dirty {
  border-color: color-mix(in srgb, #f59e0b 56%, var(--border-medium));
  box-shadow: inset 3px 0 0 #f59e0b;
}
.pbd-tech-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 12px;
}
.pbd-tech-title-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 0;
}
.pbd-tech-title {
  font-size: 13px;
  font-weight: 850;
  color: var(--text-heading);
}
.pbd-tech-unsaved {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  padding: 2px 7px;
  border: 1px solid color-mix(in srgb, #f59e0b 45%, transparent);
  border-radius: 999px;
  background: color-mix(in srgb, #f59e0b 13%, var(--bg-surface));
  color: #b45309;
  font-size: 10px;
  font-weight: 850;
  line-height: 1;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.pbd-tech-unsaved[hidden] {
  display: none !important;
}
.pbd-tech-sub {
  margin-top: 2px;
  font-size: 11px;
  font-weight: 800;
  color: var(--text-muted);
}
.pbd-tech-head-actions { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.pbd-tech-editor {
  border-top: 1px solid var(--border-light);
  padding: 12px;
  background: color-mix(in srgb, var(--bg-surface-raised) 68%, transparent);
}
.pbd-tech-editor[hidden] { display: none; }
.pbd-tech-desc {
  margin: 0 0 11px;
  padding: 9px 10px;
  border-left: 3px solid var(--gradient-app-start);
  border-radius: 8px;
  background: var(--bg-surface);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 650;
  line-height: 1.45;
}
.pbd-tech-label {
  display: block;
  margin-bottom: 7px;
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: .06em;
}
.pbd-tech-series { margin-bottom: 11px; }
.pbd-serie-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.pbd-serie-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 28px;
  padding: 4px 9px;
  border: 1.5px solid var(--border-light);
  border-radius: 999px;
  background: var(--bg-surface);
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 850;
}
.pbd-serie-chip input { margin: 0; }
.pbd-serie-chip:has(input:checked) {
  border-color: color-mix(in srgb, var(--gradient-app-start) 48%, var(--border-medium));
  background: color-mix(in srgb, var(--gradient-app-start) 10%, var(--bg-surface));
  color: var(--text-heading);
}
.pbd-serie-chip--all { border-style: dashed; }
.pbd-tech-extra-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.pbd-tech-extra-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.pbd-tech-extra-field--wide { grid-column: 1 / -1; }
.pbd-tech-extra-field span {
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: .05em;
}
.pbd-tech-extra-field input,
.pbd-tech-extra-field select,
.pbd-tech-input {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  min-height: 36px;
  padding: 8px 9px;
  border: 1.5px solid var(--border-medium);
  border-radius: 8px;
  background: var(--bg-surface);
  color: var(--text-heading);
  font-family: inherit;
  font-size: 12px;
  font-weight: 800;
}
.pbd-tech-extra-number {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.pbd-tech-extra-number input { flex: 1 1 auto; }
.pbd-tech-extra-field .pbd-tech-extra-unit {
  flex: 0 0 auto;
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 850;
  text-transform: none;
  letter-spacing: 0;
}
.pbd-tech-extra-field .pbd-tech-extra-help {
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  line-height: 1.35;
  text-transform: none;
  letter-spacing: 0;
}
.pbd-param-segment {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.pbd-param-segment-btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  min-height: 42px;
  padding: 9px 10px;
  border: 1.5px solid var(--border-medium);
  border-radius: 10px;
  background: var(--bg-surface);
  color: var(--text-heading);
  cursor: pointer;
  text-align: center;
  overflow: hidden;
}
.pbd-param-segment-btn input {
  position: absolute;
  width: 1px;
  height: 1px;
  min-width: 0;
  min-height: 0;
  margin: 0;
  padding: 0;
  border: 0;
  opacity: 0;
  pointer-events: none;
  clip-path: inset(50%);
}
.pbd-param-segment-btn span {
  min-width: 0;
  color: inherit;
  font-size: 12px;
  font-weight: 850;
  line-height: 1.25;
  text-transform: none;
  letter-spacing: 0;
}
.pbd-param-segment-btn:has(input:checked),
.pbd-param-segment-btn.is-active {
  border-color: color-mix(in srgb, var(--gradient-app-start) 58%, var(--border-medium));
  background: color-mix(in srgb, var(--gradient-app-start) 16%, var(--bg-surface));
  color: var(--text-heading);
}
.pbd-tech-extra-field--toggle {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 6px 8px;
  min-height: 36px;
}
.pbd-tech-extra-field--toggle input {
  width: 16px;
  min-height: 16px;
}
.pbd-tech-extra-field--toggle .pbd-tech-extra-help {
  grid-column: 1 / -1;
}
.pbd-m21-block { display: flex; flex-direction: column; gap: 6px; margin-top: 4px; }
.pbd-m21-head { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px; color: var(--text-secondary); }
.pbd-m21-row { display: grid; grid-template-columns: minmax(0,1fr) auto auto; gap: 10px; align-items: center; padding: 7px 10px; border: 1px solid var(--border-light); border-radius: 9px; background: color-mix(in srgb, #06b6d4 7%, var(--bg-surface-raised)); }
.pbd-m21-label { font-size: 12.5px; font-weight: 800; color: #06b6d4; white-space: nowrap; }
.pbd-m21-val { font-size: 12px; color: var(--text-primary); white-space: nowrap; }

.pbd-pyramid-editor { display: flex; flex-direction: column; gap: 8px; }
.pbd-pyramid-head { display: none; }
.pbd-pyramid-rows { display: flex; flex-direction: column; gap: 8px; }
.pbd-pyramid-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px 10px;
  align-items: start;
  padding: 9px;
  border: 1px solid var(--border-light);
  border-radius: 9px;
  background: var(--bg-surface);
}
.pbd-pyramid-row-main {
  min-width: 0;
  display: grid;
  grid-template-columns: 86px minmax(0, 1fr);
  gap: 7px;
  align-items: end;
}
.pbd-pyramid-row-values {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 7px;
}
.pbd-pyramid-field {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.pbd-pyramid-field span {
  color: var(--text-muted);
  font-size: 9.5px;
  font-weight: 850;
  line-height: 1;
  text-transform: uppercase;
  letter-spacing: .05em;
}
.pbd-pyramid-row-actions {
  display: flex;
  justify-content: flex-end;
  align-self: end;
  gap: 4px;
  flex-wrap: wrap;
}
.pbd-linked-editor { display: flex; flex-direction: column; gap: 10px; }
.pbd-linked-flow {
  display: grid;
  grid-template-columns: minmax(0,1fr) auto minmax(0,.8fr);
  align-items: center;
  gap: 8px;
  padding: 9px 10px;
  border: 1.5px solid color-mix(in srgb, var(--gradient-app-start) 26%, var(--border-light));
  border-radius: 9px;
  background: color-mix(in srgb, var(--gradient-app-start) 7%, var(--bg-surface));
  color: var(--text-heading);
  font-size: 12px;
  font-weight: 850;
}
.pbd-linked-flow span { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pbd-linked-arrow { color: var(--gradient-app-start); text-align: center; }
.pbd-linked-list {
  display: grid;
  gap: 7px;
  max-height: 340px;
  overflow: auto;
  scrollbar-width: none;
}
.pbd-linked-list::-webkit-scrollbar { display: none; }
.pbd-linked-option {
  display: grid;
  grid-template-columns: 18px minmax(0,1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 9px 10px;
  border: 1.5px solid var(--border-light);
  border-radius: 9px;
  background: var(--bg-surface);
  cursor: pointer;
}
.pbd-linked-option input { position: absolute; opacity: 0; pointer-events: none; }
.pbd-linked-check {
  width: 17px;
  height: 17px;
  border: 1.5px solid var(--border-medium);
  border-radius: 5px;
  background: var(--bg-surface-raised);
}
.pbd-linked-option:has(input:checked) {
  border-color: color-mix(in srgb, var(--gradient-app-start) 48%, var(--border-medium));
  background: color-mix(in srgb, var(--gradient-app-start) 8%, var(--bg-surface));
}
.pbd-linked-option:has(input:checked) .pbd-linked-check {
  background: var(--gradient-app-start);
  border-color: var(--gradient-app-start);
  box-shadow: inset 0 0 0 3px var(--bg-surface);
}
.pbd-linked-name {
  min-width: 0;
  color: var(--text-heading);
  font-size: 12px;
  font-weight: 850;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pbd-linked-muscle {
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}
.pbd-linked-item { display: grid; gap: 7px; }
.pbd-linked-rows {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 0 4px 2px 22px;
  padding: 9px 10px;
  border: 1px solid color-mix(in srgb, #06b6d4 30%, var(--border-light));
  border-radius: 9px;
  background: color-mix(in srgb, #06b6d4 6%, var(--bg-surface));
}
.pbd-linked-rows[hidden] { display: none; }
.pbd-linked-rows-head {
  font-size: 10.5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .4px;
  color: var(--text-secondary);
}
.pbd-linked-row {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, .65fr) minmax(0, 1.5fr) minmax(0, 1fr);
  gap: 6px;
  align-items: end;
  padding-right: 16px;
}
.pbd-linked-field { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.pbd-linked-field span { font-size: 10px; font-weight: 700; color: var(--text-muted); }
.pbd-linked-field--reps .reps-range-wrap {
  display: flex;
  align-items: stretch;
  gap: 5px;
  flex-wrap: nowrap;
  width: 100%;
}
.pbd-linked-field--reps .pbd-reps-min,
.pbd-linked-field--reps .pbd-reps-max {
  flex: 1 1 0;
  width: auto;
  min-width: 0;
  text-align: center;
}
.pbd-linked-field--reps .reps-range-sep {
  display: inline-flex;
  align-items: center;
  flex: 0 0 6px;
  color: var(--text-muted);
  font-weight: 800;
}
.pbd-linked-row-x {
  position: absolute;
  top: 0;
  right: 0;
  width: 16px;
  height: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: none;
  border-radius: 5px;
  background: transparent;
  color: var(--text-muted);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
}
.pbd-linked-row-x:hover { color: #ef4444; background: color-mix(in srgb, #ef4444 12%, transparent); }
.pbd-linked-add { align-self: flex-start; }
.pbd-tech-actions { display: flex; justify-content: flex-end; margin-top: 11px; }

@media (max-width: 560px) {
  .pbd-tech-head { align-items: flex-start; flex-direction: column; }
  .pbd-tech-head-actions { width: 100%; justify-content: flex-end; }
  .pbd-tech-extra-grid { grid-template-columns: 1fr; }
  .pbd-pyramid-row { grid-template-columns: 1fr; }
  .pbd-linked-rows { margin-left: 10px; }
  .pbd-linked-row { grid-template-columns: minmax(0, .7fr) minmax(0, 1.6fr) minmax(0, 1fr); }
  .pbd-pyramid-row-main { grid-template-columns: 82px minmax(0, 1fr); }
  .pbd-pyramid-row-values { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pbd-pyramid-row-actions {
    grid-column: auto;
    justify-content: flex-start;
  }
  .pbd-linked-flow { grid-template-columns: 1fr; }
  .pbd-linked-arrow { display: none; }
  .pbd-linked-option { grid-template-columns: 18px minmax(0,1fr); }
  .pbd-linked-muscle { grid-column: 2; }
}

.pbd-set-list { display: flex; flex-direction: column; gap: 10px; }
.pbd-set-card {
  padding: 12px;
  border: 1.5px solid var(--border-light);
  border-radius: 10px;
  background: var(--bg-surface);
}
.pbd-set-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 11px;
}
.pbd-set-title {
  font-size: 13px;
  font-weight: 800;
  color: var(--text-heading);
}
.pbd-set-sub {
  margin-top: 2px;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
}
.pbd-set-grid { gap: 10px; }
.pbd-field--readonly .exercise-input {
  border-style: dashed;
  color: var(--text-secondary);
  cursor: default;
}

.pbd-mini { display: inline-flex; align-items: center; gap: 4px; padding: 4px 10px; border-radius: 8px; cursor: pointer;
  font-family: inherit; font-size: 11px; font-weight: 700; border: 1.5px dashed var(--border-medium);
  background: transparent; color: var(--text-secondary); }
.pbd-mini:hover { border-color: var(--gradient-app-start); color: var(--gradient-app-start); }
.pbd-mini--danger:hover {
  border-color: var(--danger, #e74c3c);
  color: var(--danger, #e74c3c);
}

.pbd-note { display: flex; align-items: center; gap: 10px; border: 1.5px solid var(--border-light); border-radius: 9px;
  background: var(--bg-surface-raised); padding: 0 11px; margin-bottom: 10px; }
.pbd-note-ic { flex-shrink: 0; font-size: 13px; }
.pbd-note input { flex: 1; min-width: 0; border: none; outline: none; background: transparent; padding: 9px 0;
  font-size: 12.5px; font-family: inherit; color: var(--text-heading); }
.pbd-note--textarea { align-items: flex-start; }
.pbd-note--textarea .pbd-note-ic,
.pbd-note--textarea .pbd-note-cap { margin-top: 9px; }
.pbd-note textarea { flex: 1; min-width: 0; border: none; outline: none; background: transparent; padding: 9px 0;
  font-size: 12.5px; font-family: inherit; color: var(--text-heading); resize: none; overflow: hidden;
  min-height: 38px; line-height: 1.4; }
.pbd-note-cap { flex-shrink: 0; font-size: 9.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); }

.pbd-count { font-size: 11px; font-weight: 800; color: var(--gradient-app-start);
  background: color-mix(in srgb, var(--gradient-app-start) 14%, transparent); border-radius: 99px; padding: 1px 8px; }
.pbd-block-btn { width: 100%; display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 10px;
  border-radius: 9px; cursor: pointer; font-family: inherit; font-size: 12.5px; font-weight: 700;
  border: 1.5px solid var(--border-medium); background: var(--bg-surface); color: var(--text-secondary); }
.pbd-block-btn:hover { border-color: var(--gradient-app-start); color: var(--gradient-app-start); }
.pbd-scope-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 10px; }

.pb-drawer-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 14px 16px;
  border-top: 1px solid var(--border-light); flex-shrink: 0; }
.pbd-saved { font-size: 11.5px; font-weight: 700; color: var(--success, #11998e); }

/* ─── Modale serie collegato ─────────────────────────────────────────────── */
body.pbd-modal-open { overflow: hidden; }
.pbd-modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.5); display: flex; align-items: center; justify-content: center; z-index: 1000; padding: 16px; }
.pbd-modal {
  display: flex;
  flex-direction: column;
  background: var(--bg-surface-raised);
  border: 1.5px solid var(--border-light);
  border-radius: 14px;
  width: min(620px, calc(100vw - 32px));
  max-height: 88vh;
  overflow: hidden;
  box-shadow: 0 18px 54px rgba(0,0,0,.45);
}
.pbd-modal-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-light);
  background: var(--bg-surface);
}
.pbd-modal-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 16px;
  border-top: 1px solid var(--border-light);
  background: var(--bg-surface);
}
.pbd-modal-title {
  min-width: 0;
  font-size: 15px;
  font-weight: 850;
  color: var(--text-heading);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pbd-modal-body { flex: 1; min-height: 0; overflow: auto; scrollbar-width: none; padding: 16px; }
.pbd-modal-body::-webkit-scrollbar { display: none; }
.pbd-modal .pbd-linked-modal-prescription {
  margin: 0;
  padding: 14px;
}
.pbd-modal .pbd-grid {
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 11px 10px;
  align-items: start;
}
.pbd-modal .pbd-field--series { grid-column: span 2; }
.pbd-modal .pbd-field--reps { grid-column: span 6; }
.pbd-modal .pbd-field--peso,
.pbd-modal .pbd-field--recupero,
.pbd-modal .pbd-field--rpe,
.pbd-modal .pbd-field--rir { grid-column: span 4; }
.pbd-modal .pbd-field { gap: 6px; }
.pbd-modal .exercise-input {
  width: 100% !important;
  min-width: 0;
  min-height: 40px;
  box-sizing: border-box;
  padding: 9px 10px;
  text-align: center;
  border: 1.5px solid var(--border-medium);
  border-radius: 9px;
  background: var(--bg-surface-raised);
  color: var(--text-heading);
  font-size: 15px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}
.pbd-modal .exercise-input--target {
  color: var(--gradient-app-start);
  border-color: color-mix(in srgb, var(--gradient-app-start) 35%, var(--border-medium));
  background: color-mix(in srgb, var(--gradient-app-start) 7%, var(--bg-surface-raised));
}
.pbd-modal .reps-range-wrap,
.pbd-modal .combo-wrap {
  display: flex;
  align-items: stretch;
  flex-wrap: nowrap;
  gap: 5px;
  width: 100%;
}
.pbd-modal .combo-toggle,
.pbd-modal .combo-invert {
  flex: 0 0 31px;
  width: 31px;
  min-height: 50px;
  height: auto;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 800;
}
.pbd-modal .exercise-input--repsbound {
  flex: 1 1 0;
  width: auto !important;
  min-width: 0;
}
.pbd-modal .pbd-field--series > .exercise-input,
.pbd-modal .pbd-field--reps .combo-wrap--range,
.pbd-modal .pbd-field--reps .pbd-reps-min,
.pbd-modal .pbd-field--reps .reps-unit-sel {
  min-height: 50px;
}
.pbd-modal .reps-unit-sel {
  flex: 0 0 58px;
  width: 58px;
  box-sizing: border-box;
  padding: 0 9px;
  border: 1.5px solid var(--border-medium);
  border-radius: 9px;
  background: var(--bg-surface-raised);
  color: var(--text-heading);
  font-family: inherit;
  font-size: 12px;
  font-weight: 800;
  text-align: center;
}
.pbd-modal .pbd-reps-disclaimer {
  display: none;
}
.pbd-modal .peso-wrap {
  display: flex;
  align-items: stretch;
  gap: 6px;
  min-width: 0;
}
.pbd-modal .peso-type-picker.progress-exercise-picker {
  width: 58px;
  min-width: 58px;
  flex: 0 0 58px;
}
.pbd-modal .peso-type-trigger.progress-exercise-trigger {
  height: 40px;
  min-height: 40px;
  border-radius: 9px;
  background: var(--bg-surface-raised);
}
.pbd-modal .peso-wrap > .exercise-input {
  flex: 1 1 auto;
  width: auto !important;
}
.pbd-modal .peso-wrap--bw {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  grid-template-areas:
    "type input"
    "hint hint";
}
.pbd-modal .peso-wrap--bw .peso-type-picker { grid-area: type; }
.pbd-modal .peso-wrap--bw > .exercise-input { grid-area: input; }
.pbd-modal .peso-wrap--bw .peso-bw-hint {
  grid-area: hint;
  white-space: normal;
  text-align: center;
}
.pbd-modal .pbd-muted { margin: 10px 0 0; }

@media (max-width: 720px) {
  .pbd-modal .pbd-grid { grid-template-columns: repeat(8, minmax(0, 1fr)); }
  .pbd-modal .pbd-field--series { grid-column: span 2; }
  .pbd-modal .pbd-field--reps { grid-column: span 6; }
  .pbd-modal .pbd-field--peso,
  .pbd-modal .pbd-field--recupero,
  .pbd-modal .pbd-field--rpe,
  .pbd-modal .pbd-field--rir { grid-column: span 4; }
}

@media (max-width: 460px) {
  .pbd-modal-overlay { padding: 12px; }
  .pbd-modal { width: min(620px, calc(100vw - 24px)); }
  .pbd-modal .pbd-grid { grid-template-columns: repeat(8, minmax(0, 1fr)); }
  .pbd-modal .pbd-field--series { grid-column: span 2; }
  .pbd-modal .pbd-field--reps { grid-column: span 6; }
  .pbd-modal .pbd-field--peso,
  .pbd-modal .pbd-field--recupero,
  .pbd-modal .pbd-field--rpe,
  .pbd-modal .pbd-field--rir { grid-column: span 4; }
}

/* ─── Editor collegati: proposte (chip), rest intra, ricerca DB ──────────── */
/* Prescription redesign: drawer + linked modal share the same compact rows. */

.pbd-modal .pbd-linked-modal-prescription {
  padding: 17px 18px;
}
.pbd-sec--prescription .pbd-sec-h {
  min-height: 82px;
  margin: 0;
  padding: 14px 16px;
  align-items: flex-start;
  justify-content: flex-start;
  border: 1px solid color-mix(in srgb, var(--pbd-presc-accent) 30%, var(--pbd-presc-border));
  border-radius: 12px;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--pbd-presc-accent) 8%, transparent), transparent 58%),
    color-mix(in srgb, var(--pbd-presc-soft) 88%, #303038);
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 850;
  letter-spacing: .09em;
  line-height: 1.2;
}
.pbd-sec--prescription .pbd-sec-h::after {
  content: "una riga per parametro";
  display: block;
  margin-left: 8px;
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: none;
}
.pbd-sec--prescription .pbd-grid,
.pbd-modal .pbd-sec--prescription .pbd-grid {
  display: flex;
  flex-direction: column;
  gap: 0;
}
.pbd-sec--prescription .pbd-field,
.pbd-modal .pbd-sec--prescription .pbd-field {
  display: grid;
  grid-template-columns: minmax(86px, 1fr) minmax(0, 230px);
  gap: 14px;
  align-items: center;
  min-width: 0;
  padding: 13px 0;
  border-top: 1px solid var(--pbd-presc-line);
  grid-column: auto;
}
.pbd-sec--prescription .pbd-field:first-child {
  border-top: 0;
}
.pbd-sec--prescription .pbd-label {
  min-height: 0;
  align-items: flex-start;
  justify-content: center;
  width: auto;
  text-align: left;
  color: var(--text-heading);
  font-size: 13.5px;
  font-weight: 850;
  letter-spacing: 0;
  line-height: 1.15;
  text-transform: none;
}
.pbd-sec--prescription .pbd-label::after {
  display: block;
  margin-top: 3px;
  color: var(--text-muted);
  font-size: 10.5px;
  font-weight: 700;
  line-height: 1.15;
}
.pbd-sec--prescription .pbd-field--series .pbd-label::after { content: "numero di serie"; }
.pbd-sec--prescription .pbd-field--reps .pbd-label::after { content: "range o singola"; }
.pbd-sec--prescription .pbd-field--peso .pbd-label::after { content: "tipo + valore"; }
.pbd-sec--prescription .pbd-field--recupero .pbd-label::after { content: "secondi tra le serie"; }
.pbd-sec--prescription .pbd-field--rpe .pbd-label::after,
.pbd-sec--prescription .pbd-field--rir .pbd-label::after { content: "opzionale"; }
.pbd-sec--prescription .exercise-input,
.pbd-sec--prescription .reps-unit-sel,
.pbd-sec--prescription .combo-invert,
.pbd-sec--prescription .peso-type-trigger.progress-exercise-trigger,
.pbd-sec--prescription .pbd-knowledge-empty-load {
  min-height: 44px;
  border-radius: 11px;
  border-color: color-mix(in srgb, var(--text-muted) 28%, var(--border-medium));
  background: var(--pbd-presc-control);
  color: var(--text-heading);
  box-shadow: inset 0 1px 0 color-mix(in srgb, #ffffff 5%, transparent);
}
.pbd-sec--prescription .exercise-input {
  font-size: 16px;
  font-weight: 900;
}
.pbd-sec--prescription .pbd-field--series > .exercise-input {
  justify-self: end;
  max-width: 150px;
}
.pbd-sec--prescription .pbd-field--reps .reps-range-wrap {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 70px;
  gap: 8px;
  align-items: stretch;
}
.pbd-sec--prescription .pbd-field--reps .combo-wrap--range {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr) 34px 34px;
  gap: 6px;
  align-items: stretch;
  min-height: 44px;
}
.pbd-sec--prescription .pbd-field--reps .exercise-input--repsbound,
.pbd-sec--prescription .pbd-field--reps .pbd-reps-min,
.pbd-sec--prescription .pbd-field--reps .pbd-reps-max {
  min-height: 44px;
}
.pbd-sec--prescription .pbd-field--reps .reps-range-sep {
  width: 8px;
}
.pbd-sec--prescription .reps-unit-sel,
.pbd-sec--prescription .peso-type-trigger.progress-exercise-trigger {
  border-color: color-mix(in srgb, var(--pbd-presc-accent) 72%, transparent);
  background: linear-gradient(180deg, color-mix(in srgb, #ffffff 14%, transparent), transparent), var(--pbd-presc-accent);
  color: #fff;
  font-size: 12px;
  font-weight: 900;
}
.pbd-sec--prescription .combo-toggle,
.pbd-sec--prescription .combo-invert {
  flex-basis: 34px;
  width: 34px;
  min-width: 34px;
  padding: 0;
  color: var(--text-secondary);
}
.pbd-sec--prescription .combo-toggle:hover,
.pbd-sec--prescription .combo-invert:hover {
  border-color: color-mix(in srgb, var(--pbd-presc-accent) 58%, var(--border-medium));
  color: var(--text-heading);
}
.pbd-sec--prescription .pbd-field--reps-seconds .reps-range-wrap {
  grid-template-columns: minmax(0, 1fr) 70px;
}
.pbd-sec--prescription .pbd-field--reps-seconds .pbd-reps-min {
  width: 100% !important;
}
.pbd-sec--prescription .pbd-reps-disclaimer {
  margin-top: 7px;
  grid-column: 2;
  text-align: left;
}
.pbd-sec--prescription .peso-wrap {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 8px;
  align-items: stretch;
}
.pbd-sec--prescription .peso-type-picker.progress-exercise-picker {
  width: 72px;
  min-width: 72px;
  flex-basis: 72px;
}
.pbd-sec--prescription .peso-wrap--bw {
  grid-template-columns: 72px minmax(0, 1fr);
}
.pbd-sec--prescription .peso-bw-hint,
.pbd-sec--prescription .pbd-massimale-note {
  border-color: color-mix(in srgb, var(--pbd-presc-accent) 22%, var(--pbd-presc-border));
  background: color-mix(in srgb, var(--pbd-presc-accent) 7%, var(--pbd-presc-control));
}
.pbd-sec--prescription .pbd-field--intensity-locked .exercise-input {
  background:
    repeating-linear-gradient(135deg, rgba(245, 158, 11, .12) 0 7px, transparent 7px 14px),
    var(--pbd-presc-control);
}
.pbd-sec--prescription .pbd-lock-badge {
  justify-self: end;
}
.pbd-sec--prescription .pbd-muted {
  margin: 0;
  padding: 10px 12px;
  border-radius: 10px;
  background: color-mix(in srgb, #f59e0b 8%, var(--pbd-presc-control));
  border: 1px solid color-mix(in srgb, #f59e0b 24%, var(--pbd-presc-border));
}
.pbd-sec--prescription .pbd-emom {
  margin-top: 0;
  border-color: color-mix(in srgb, #0ea5e9 35%, var(--pbd-presc-border));
  background: color-mix(in srgb, #0ea5e9 10%, var(--pbd-presc-control));
}
@media (max-width: 460px) {
  .pbd-sec--prescription .pbd-field,
  .pbd-modal .pbd-sec--prescription .pbd-field {
    grid-template-columns: 1fr;
    gap: 8px;
    padding: 12px 0;
  }
  .pbd-sec--prescription .pbd-field--series > .exercise-input,
  .pbd-sec--prescription .pbd-lock-badge {
    justify-self: stretch;
    max-width: none;
  }
  .pbd-sec--prescription .pbd-reps-disclaimer {
    grid-column: auto;
  }
}

.pbd-linked-suggest { display: flex; flex-direction: column; gap: 10px; }
.pbd-linked-suggest-group { display: flex; flex-direction: column; gap: 6px; }
.pbd-linked-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.pbd-linked-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 30px;
  padding: 5px 11px;
  border: 1.5px solid var(--border-medium);
  border-radius: 999px;
  background: var(--bg-surface);
  color: var(--text-heading);
  font-family: inherit;
  font-size: 11.5px;
  font-weight: 800;
  cursor: pointer;
  transition: border-color .12s ease, background .12s ease, color .12s ease;
}
.pbd-linked-chip:hover:not([disabled]) {
  border-color: var(--gradient-app-start);
  color: var(--gradient-app-start);
  background: color-mix(in srgb, var(--gradient-app-start) 9%, var(--bg-surface));
}
.pbd-linked-chip--on,
.pbd-linked-chip[disabled] {
  border-color: color-mix(in srgb, var(--success, #11998e) 50%, var(--border-medium));
  background: color-mix(in srgb, var(--success, #11998e) 14%, var(--bg-surface));
  color: var(--success, #11998e);
  cursor: default;
}
.pbd-linked-chip--on::before { content: '✓ '; font-weight: 900; }

.pbd-linked-rest {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  padding: 9px 11px;
  border: 1.5px solid var(--border-light);
  border-radius: 9px;
  background: var(--bg-surface);
}
.pbd-linked-rest .pbd-tech-label { flex-basis: 100%; margin-bottom: 0; }
.pbd-radio {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}
.pbd-radio input { margin: 0; accent-color: var(--gradient-app-start); }
.pbd .pbd-linked-rest .exercise-input { width: 84px !important; min-height: 34px; }

.pbd-linked-search-results { display: flex; flex-direction: column; gap: 2px; margin-top: 6px; }
.pbd-linked-search-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: var(--bg-surface);
  color: var(--text-heading);
  font-family: inherit;
  text-align: left;
  cursor: pointer;
}
.pbd-linked-search-row:hover {
  border-color: color-mix(in srgb, var(--gradient-app-start) 40%, var(--border-light));
  background: color-mix(in srgb, var(--gradient-app-start) 7%, var(--bg-surface));
}

.pbd-del { color: var(--danger, #e74c3c); border-color: color-mix(in srgb, var(--danger, #e74c3c) 30%, transparent); }

/* ─── Scheda conoscitiva — carico da trovare in app + toggle tipo scheda ──── */
.pbd-knowledge-empty-load {
  min-height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-light);
  border-radius: 9px;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
  background: var(--bg-surface);
}
.tpw-segment {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--border-light);
  border-radius: 9px;
  background: var(--bg-surface);
}
.tpw-segment button {
  border: 0;
  border-radius: 7px;
  padding: 8px 12px;
  color: var(--text-secondary);
  background: transparent;
  font-weight: 800;
  cursor: pointer;
}
.tpw-segment button.is-active {
  color: var(--text-heading);
  background: var(--bg-surface-raised);
}

/* Prescription v2: reference-style summary + one row per parameter. */
.pbd .pbd-sec--prescription,
.pbd-modal .pbd-sec--prescription.pbd-linked-modal-prescription {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 18px;
  border-radius: 14px;
  border: 1.5px solid color-mix(in srgb, var(--text-muted) 26%, var(--border-light));
  box-shadow: inset 0 1px 0 color-mix(in srgb, #fff 6%, transparent);
}

.pbd-presc-summary {
  min-height: 104px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 8px;
  padding: 15px 18px;
  border-radius: 12px;
  border: 1px solid color-mix(in srgb, var(--gradient-app-start) 34%, var(--border-light));
  background:var(--bg-surface-sunken-training);
}

.pbd-presc-kicker {
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 850;
  line-height: 1;
  letter-spacing: .09em;
  text-transform: uppercase;
}

.pbd-presc-value {
  color: var(--text-heading);
  font-size: 28px;
  font-weight: 900;
  line-height: 1;
  letter-spacing: 0;
  font-variant-numeric: tabular-nums;
}

.pbd-presc-meta {
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.2;
}

.pbd-load-suggestion {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid color-mix(in srgb, var(--pbd-load-suggestion-color, var(--gradient-app-start)) 28%, var(--border-light));
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--pbd-load-suggestion-color, var(--gradient-app-start)) 12%, transparent), transparent 72%),
    var(--bg-surface-sunken-training);
}

.pbd-load-suggestion--increase {
  --pbd-load-suggestion-color: #16a34a;
}

.pbd-load-suggestion--decrease {
  --pbd-load-suggestion-color: #dc2626;
}

.pbd-load-suggestion-badge {
  color: var(--pbd-load-suggestion-color, var(--gradient-app-start));
  background: color-mix(in srgb, var(--pbd-load-suggestion-color, var(--gradient-app-start)) 14%, transparent);
  border-radius: 999px;
  padding: 4px 9px;
  font-size: 11px;
  font-weight: 900;
  line-height: 1;
  white-space: nowrap;
}

.pbd-load-suggestion-text {
  min-width: 0;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 750;
  line-height: 1.25;
}

.pbd .pbd-sec--prescription .pbd-presc-list,
.pbd-modal .pbd-sec--prescription .pbd-presc-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.pbd .pbd-sec--prescription .pbd-presc-row,
.pbd-modal .pbd-sec--prescription .pbd-presc-row {
  display: grid;
  grid-template-columns: minmax(96px, 1fr) minmax(0, 222px);
  gap: 18px;
  align-items: center;
  min-width: 0;
  padding: 13px 0;
  border-top: 1px solid color-mix(in srgb, var(--text-muted) 16%, transparent);
  grid-column: auto;
}

.pbd .pbd-sec--prescription .pbd-presc-row:first-child,
.pbd-modal .pbd-sec--prescription .pbd-presc-row:first-child {
  border-top: 0;
}

.pbd .pbd-sec--prescription .pbd-presc-row .pbd-label,
.pbd-modal .pbd-sec--prescription .pbd-presc-row .pbd-label {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  min-height: 0;
  width: auto;
  text-align: left;
  color: var(--text-heading);
  letter-spacing: 0;
  text-transform: none;
}

.pbd .pbd-sec--prescription .pbd-presc-row .pbd-label::after,
.pbd-modal .pbd-sec--prescription .pbd-presc-row .pbd-label::after {
  content: none !important;
  display: none !important;
}

.pbd-label-main {
  color: var(--text-heading);
  font-size: 14px;
  font-weight: 900;
  line-height: 1.1;
}

.pbd-label-sub {
  margin-top: 3px;
  color: var(--text-muted);
  font-size: 10.5px;
  font-weight: 750;
  line-height: 1.15;
  text-transform: none;
}

.pbd-presc-control {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: stretch;
}

.pbd-modal .pbd-sec--prescription.pbd-linked-modal-prescription {
  padding: 20px;
}

.pbd-modal .pbd-sec--prescription .pbd-presc-row {
  grid-template-columns: minmax(132px, 1fr) minmax(0, 320px);
  gap: 22px;
}

.pbd .pbd-sec--prescription .exercise-input,
.pbd .pbd-sec--prescription .pbd-knowledge-empty-load,
.pbd .pbd-sec--prescription .combo-toggle,
.pbd .pbd-sec--prescription .combo-invert {
  min-height: 44px;

  border-color: color-mix(in srgb, var(--text-muted) 30%, var(--border-medium));
  background: var(--bg-surface-sunken-training);
  color: var(--text-heading);
  font-size: 16px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  box-shadow: inset 0 1px 0 color-mix(in srgb, #fff 5%, transparent);
}

.pbd-stepper {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) 44px;
  align-items: stretch;
  min-width: 0;
  border-radius: 12px;
}

.pbd-stepper > .exercise-input,
.pbd-stepper > .combo-wrap {
  min-width: 0;
}

.pbd-stepper-btn {
  min-height: 44px;
  border: 1.5px solid color-mix(in srgb, var(--text-muted) 30%, var(--border-medium));
  background: var(--bg-surface-sunken-training);
  color: var(--text-heading);
  font-family: inherit;
  font-size: 17px;
  font-weight: 900;
  cursor: pointer;
}

.pbd-stepper-btn:first-child {
  border-radius: 12px 0 0 12px;
  border-right: 0;
}

.pbd-stepper-btn:last-child {
  border-radius: 0 12px 12px 0;
  border-left: 0;
}

.pbd-stepper .exercise-input {
  border-radius: 0;
}

.pbd-combo-stepper {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 38px;
  gap: 6px;
  align-items: stretch;
  min-width: 0;
}

.pbd-combo-stepper > .pbd-stepper {
  min-width: 0;
}

.pbd-combo-stepper > .combo-toggle {
  width: 38px;
  min-width: 38px;
  border-radius: 10px;
}

.pbd-field--reps .reps-range-wrap {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 9px;
}

.pbd .pbd-sec--prescription .reps-range-wrap--prescription,
.pbd-modal .pbd-sec--prescription .reps-range-wrap--prescription {
  display: flex;
  flex-direction: column;
  gap: 9px;
  align-items: stretch;
  width: 100%;
}

.pbd .pbd-sec--prescription .reps-range-wrap--prescription .pbd-unit-segment,
.pbd-modal .pbd-sec--prescription .reps-range-wrap--prescription .pbd-unit-segment {
  align-self: flex-end;
  width: min(116px, 100%);
}

.pbd .pbd-sec--prescription .pbd-field--reps-seconds .reps-range-wrap--prescription,
.pbd-modal .pbd-sec--prescription .pbd-field--reps-seconds .reps-range-wrap--prescription {
  display: grid;
  grid-template-columns: minmax(64px, 84px) minmax(116px, 1fr);
  column-gap: 12px;
  row-gap: 0;
  align-items: stretch;
}

.pbd .pbd-sec--prescription .pbd-field--reps-seconds .reps-range-wrap--prescription .pbd-unit-segment,
.pbd-modal .pbd-sec--prescription .pbd-field--reps-seconds .reps-range-wrap--prescription .pbd-unit-segment {
  grid-column: 2;
  grid-row: 1;
  align-self: stretch;
  justify-self: end;
}

.pbd-field--reps .combo-wrap--range {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 10px minmax(0, 1fr) 38px 38px;
  gap: 6px;
  align-items: stretch;
  min-width: 0;
}

.pbd .pbd-sec--prescription .combo-wrap--range,
.pbd-modal .pbd-sec--prescription .combo-wrap--range {
  grid-template-columns: minmax(0, 1fr) 18px minmax(0, 1fr) 38px 38px;
  column-gap: 6px;
}

.pbd .pbd-sec--prescription .pbd-field--reps-seconds .combo-wrap--range,
.pbd-modal .pbd-sec--prescription .pbd-field--reps-seconds .combo-wrap--range {
  grid-column: 1;
  grid-row: 1;
  grid-template-columns: minmax(64px, 84px);
  column-gap: 0;
}

.pbd .pbd-sec--prescription .combo-wrap--range .reps-range-sep,
.pbd-modal .pbd-sec--prescription .combo-wrap--range .reps-range-sep {
  margin: 0;
}

.pbd .pbd-sec--prescription .combo-wrap--range .pbd-reps-max,
.pbd-modal .pbd-sec--prescription .combo-wrap--range .pbd-reps-max {
  border-top-right-radius: 10px;
  border-bottom-right-radius: 10px;
}

.pbd .pbd-sec--prescription .combo-wrap--range .combo-toggle,
.pbd-modal .pbd-sec--prescription .combo-wrap--range .combo-toggle {
  border-radius: 10px;
  margin-left: 0;
  border-left: 1.5px solid color-mix(in srgb, var(--text-muted) 30%, var(--border-medium));
}

.pbd .pbd-sec--prescription .combo-wrap--range .combo-invert,
.pbd-modal .pbd-sec--prescription .combo-wrap--range .combo-invert {
  margin-left: 0;
}

.pbd-field--reps .reps-range-sep {
  width: auto;
}

.pbd-unit-segment,
.pbd-peso-segment {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
  gap: 6px;
  min-width: 0;
}

.pbd-unit-btn {
  min-height: 36px;
  border: 1.5px solid color-mix(in srgb, var(--text-muted) 28%, var(--border-medium));
  border-radius: 10px;
  background: var(--bg-surface-sunken-training);
  color: var(--text-heading);
  font-family: inherit;
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
}

.pbd-unit-btn.is-active {
  border-color: color-mix(in srgb, var(--gradient-app-start) 78%, transparent);
  background: linear-gradient(180deg, color-mix(in srgb, #fff 14%, transparent), transparent), var(--gradient-app-start);
  color: #fff;
}

/* Bottone «max» dei segment di prescrizione (ripetizioni massimali): accento ambra
   coerente con il lock RPE/RIR (.pbd-field--intensity-locked). */
.pbd-unit-btn--max.is-active {
  border-color: color-mix(in srgb, #f59e0b 70%, transparent);
  background: linear-gradient(180deg, color-mix(in srgb, #fff 12%, transparent), transparent), #f59e0b;
  color: #fff;
}
.pbd-unit-btn--max:not(.is-active) {
  border-color: color-mix(in srgb, #f59e0b 40%, var(--border-medium));
  color: color-mix(in srgb, #f59e0b 78%, var(--text-heading));
}

.pbd-sec--prescription .peso-wrap {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
  min-width: 0;
}

.pbd-sec--prescription .peso-wrap .peso-type-sel {
  display: none;
}

.pbd-sec--prescription .peso-wrap--bw {
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas: none;
}

.pbd-sec--prescription .peso-wrap--bw .pbd-peso-segment,
.pbd-sec--prescription .peso-wrap--bw .peso-bw-hint,
.pbd-sec--prescription .peso-wrap--bw > .exercise-input {
  grid-area: auto;
}

.pbd-sec--prescription .peso-bw-hint,
.pbd-sec--prescription .pbd-massimale-note {
  border-color: color-mix(in srgb, var(--gradient-app-start) 22%, var(--border-light));
  background: color-mix(in srgb, var(--gradient-app-start) 7%, var(--bg-surface-raised));
}

.pbd-sec--prescription .pbd-reps-disclaimer {
  margin: 0;
  text-align: left;
}

.pbd-sec--prescription .pbd-lock-badge {
  align-self: flex-start;
}

.pbd-sec--prescription .pbd-emom,
.pbd-sec--prescription .pbd-muted {
  margin: 0;
}

@media (max-width: 460px) {
  .pbd .pbd-sec--prescription .pbd-presc-row,
  .pbd-modal .pbd-sec--prescription .pbd-presc-row {
    grid-template-columns: 1fr;
    gap: 9px;
  }

  .pbd-load-suggestion {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .pbd-load-suggestion-badge {
    justify-self: start;
  }

  .pbd-field--reps .combo-wrap--range {
    grid-template-columns: minmax(0, 1fr) 8px minmax(0, 1fr) 36px 36px;
  }
}

/* Serie aggiuntive: switcher a tab dei blocchi prescrizione */
.pbd-presc-group { display: flex; flex-direction: column; gap: 14px; }
.pbd-presc-tabs {
  display: flex; flex-wrap: wrap; gap: 6px; align-items: center;
}
.pbd-presc-tab {
  padding: 7px 14px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--border-medium);
  background: var(--bg-surface-raised);
  color: var(--text-secondary);
  font-size: 12px; font-weight: 800; letter-spacing: .02em;
  line-height: 1; min-height: 32px;
}
.pbd-presc-tab.is-active {
  border-color: color-mix(in srgb, #f59e0b 60%, var(--border-medium));
  background: #f59e0b; color: #fff;
}
.pbd-presc-tab--add { font-size: 16px; font-weight: 900; padding: 7px 12px; }
.pbd-presc-panels { display: block; }
.pbd-presc-panel:not(.is-active) { display: none; }
.pbd-presc-panel.is-active { display: flex; flex-direction: column; }
.pbd-presc-card-actions { display: flex; justify-content: flex-end; margin-top: 4px; }

/* Il pannello Extra eredita .pbd-sec--prescription (padding/bordo/ombra propri): dentro la card a tab
   quella chrome interna crea un "doppio bordo". La card esterna .pbd-presc-group basta. */
.pbd .pbd-presc-panel.pbd-sec--prescription {
  padding: 0;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}
