/*------------------------------------------------------------------------------------------------------------------
    WORKOUT BUILDER (docs/workout-builder.md «Grafica del builder»)
    The canvas of the builder with its structure of always (same elements in the same places) and a light, airy look
    (owner, 1 December 2026: «dare anche lì una ventata di aria fresca… senza appesantirla»): soft lines, soft fills,
    more room, no decorative borders or accent lines. Sections keep a band of their own, tinted in the brand colour.
--------------------------------------------------------------------------------------------------------------------*/

/* The tones of the builder surfaces, on each root of the canvas (the builder, and the importer's review and the single
   exercise editors that draw the same cards outside it) */
.workout-builder-dialog,
.custom-checklist,
.custom-checklist-separator,
.workout-section-card-wrapper {
    --wb-line: rgba(var(--contrast-theme-color-rgb), 0.1);
    --wb-soft: rgba(var(--contrast-theme-color-rgb), 0.045);
    --wb-soft-hover: rgba(var(--contrast-theme-color-rgb), 0.08);
    --wb-surface: rgba(var(--contrast-theme-color-rgb), 0.028);
    /* A soft fill as a solid colour: the floating label of a field paints its own background with it */
    --wb-field: color-mix(in srgb, rgb(var(--contrast-theme-color-rgb)) 4.5%, var(--bs-body-bg));
    --wb-band: rgba(var(--mangofit-color-rgb), 0.085);
    --wb-brand-text: color-mix(in srgb, var(--mangofit-color) 72%, var(--bs-body-color));
    --wb-focus: rgba(var(--mangofit-color-rgb), 0.14);
}

[data-bs-theme="dark"] :is(.workout-builder-dialog, .custom-checklist, .custom-checklist-separator, .workout-section-card-wrapper) {
    --wb-line: rgba(var(--contrast-theme-color-rgb), 0.13);
    --wb-soft: rgba(var(--contrast-theme-color-rgb), 0.065);
    --wb-soft-hover: rgba(var(--contrast-theme-color-rgb), 0.1);
    --wb-surface: rgba(var(--contrast-theme-color-rgb), 0.035);
    --wb-field: color-mix(in srgb, rgb(var(--contrast-theme-color-rgb)) 6.5%, var(--bs-body-bg));
    --wb-band: rgba(var(--mangofit-color-rgb), 0.14);
    --wb-focus: rgba(var(--mangofit-color-rgb), 0.22);
}

@media (min-width: 768px) and (max-width: 991.98px) {
    .workout-builder-dialog {
        max-width: 95% !important;
    }
}

/*----------------------------------
    HEADER AND FOOTER OF THE BUILDER: «Nome:» next to a soft field, the estimated duration as a soft chip
------------------------------------*/
.workout-builder-dialog .modal-header .modal-title {
    font-size: 1.05rem;
    font-weight: 600;
}

.workout-builder-dialog .workout-card-details-name {
    min-height: 2.5rem;
    border-color: transparent;
    border-radius: 0.7rem;
    background-color: var(--wb-field);
    font-weight: 600;
}

.workout-builder-dialog .workout-card-details-name::placeholder {
    color: var(--bs-secondary-color);
    font-weight: 400;
}

.workout-builder-dialog .workout-card-details-name:focus {
    border-color: rgba(var(--mangofit-color-rgb), 0.45);
    background-color: var(--bs-body-bg);
    box-shadow: 0 0 0 0.2rem var(--wb-focus);
}

.workout-builder-dialog .workout-card-details-name.is-invalid {
    border-color: var(--bs-form-invalid-border-color);
}

.workout-builder-dialog .workout-duration-summary {
    border-color: transparent !important;
    border-radius: 0.75rem !important;
    background-color: var(--wb-soft);
}

/* The equipment of the workout: a calm title and soft chips, as in the selection windows */
.workout-builder-dialog .workout-card-equipment-summary__label {
    color: var(--bs-heading-color);
    font-size: 0.9rem;
    letter-spacing: 0;
    text-transform: none;
}

.workout-builder-dialog .workout-card-equipment-chip {
    border-color: transparent;
    background: var(--wb-soft);
    color: var(--bs-body-color);
}

/* The empty canvas: a soft surface with a light dashed edge instead of the dark dotted frame */
.workout-builder-dialog .show-exercises-library-selection-wrapper .custom-dotted-border {
    border: 1.5px dashed rgba(var(--contrast-theme-color-rgb), 0.18);
    border-radius: 1rem;
    background-color: var(--wb-surface);
    background-image: none;
    transition: border-color 0.15s ease, background-color 0.15s ease;
}

.workout-builder-dialog .show-exercises-library-selection-wrapper .custom-dotted-border.custom-dotted-border-droppable {
    border-color: rgba(var(--mangofit-color-rgb), 0.55);
    background-color: rgba(var(--mangofit-color-rgb), 0.05);
}

/*----------------------------------
    EXERCISE CARD OF THE CANVAS: a soft frame, the image as a rounded tile, the name on a soft fill, a quiet ⋯
------------------------------------*/
.custom-checklist {
    --check: var(--mangofit-color);
    --disabled: #c3c8de;

    width: 100%;
    border-radius: 0.9rem;
    border: 1px solid var(--wb-line);
    background-color: var(--bs-body-bg);
    position: relative;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    box-shadow: 0 1px 2px rgba(var(--contrast-theme-color-rgb), 0.04);
}

.custom-checklist .custom-checklist-label {
    position: relative;
    cursor: pointer;
    width: fit-content;
    transition: color 0.3s ease;
    flex-grow: 1;
}

.custom-checklist .custom-checklist-dropdown-trigger > .fa-chevron-down {
    color: var(--bs-secondary-color) !important;
}

/* The image of the exercise: a rounded tile on white, as in the library column next to the canvas */
.custom-checklist .custom-checklist-dropdown-trigger > img {
    border: 0 !important;
    border-radius: 0.75rem !important;
    background-color: #fff;
}

/* The name (the .bg-body-secondary span, read by the CDP checks) on a soft fill instead of the grey box */
.custom-checklist .custom-checklist-dropdown-trigger > .bg-body-secondary {
    display: flex;
    align-items: center;
    min-height: 2.75rem;
    border-radius: 0.7rem !important;
    background-color: var(--wb-soft) !important;
    color: var(--bs-heading-color);
    font-weight: 600;
    line-height: 1.3;
    transition: background-color 0.15s ease;
}

@media (hover: hover) and (pointer: fine) {
    .custom-checklist .custom-checklist-dropdown-trigger:hover > .bg-body-secondary {
        background-color: var(--wb-soft-hover) !important;
    }
}

/* ⋯: a quiet icon button next to the name */
.custom-checklist .exercise-actions {
    margin-inline-start: 0.375rem;
}

.custom-checklist .exercise-actions-toggle.mg-action-button {
    min-width: 2.75rem;
    min-height: 2.75rem;
    border-color: transparent !important;
    border-radius: 0.7rem !important;
    background: transparent !important;
    color: var(--bs-secondary-color) !important;
}

.custom-checklist .exercise-actions-toggle.mg-action-button:hover,
.custom-checklist .mg-dropdown.show > .exercise-actions-toggle.mg-action-button {
    border-color: transparent !important;
    background: var(--wb-soft) !important;
    color: var(--bs-body-color) !important;
}

/*----------------------------------
    CUSTOM CHECKLIST IN ERROR
------------------------------------*/
.workout-item-in-error {
    box-shadow: 0 0 0 1px rgba(220, 53, 69, 0.25), 0 0 8px rgba(220, 53, 69, 0.5);
}

/*-----------------------
    CHECKLIST SEPARATOR: the link of a superset; linked, the two cards join in one frame with a soft line
-----------------------*/
.custom-checklist-separator {
    cursor: pointer;
    font-size: 22px;
    position: relative;
}

/* Default: NOT selected -> show unchecked, hide checked */
.custom-checklist-separator:not(.selected) .checked-custom-checklist-separator {
	display: none;
}

.custom-checklist-separator:not(.selected) .unchecked-custom-checklist-separator {
	display: inline;
}

/* Selected -> show checked, hide unchecked */
.custom-checklist-separator.selected .unchecked-custom-checklist-separator {
	display: none;
}

.custom-checklist-separator.selected .checked-custom-checklist-separator {
	display: inline;
}

.custom-checklist-separator.selected {
    border-left: 1px solid var(--wb-line);
    border-right: 1px solid var(--wb-line);
    background-color: var(--bs-body-bg);
}

.custom-checklist-separator.selected::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 0;
    width: 47.5%;
    height: 1px;
    background-color: var(--wb-line);
}
.custom-checklist-separator.selected::after {
    content: "";
    position: absolute;
    top: 50%;
    right: 0;
    width: 47.5%;
    height: 1px;
    background-color: var(--wb-line);
}

.custom-checklist:has(+ .custom-checklist-separator.selected) {
    border-bottom-left-radius: 0px !important;
    border-bottom-right-radius: 0px !important;
    border-bottom: 0px !important;
    box-shadow: none !important;
}

.custom-checklist-separator.selected + .custom-checklist {
    border-top-left-radius: 0px !important;
    border-top-right-radius: 0px !important;
    border-top: 0px !important;
}

.custom-checklist-separator.selected i {
    padding: 0px 5px;
    background-color: inherit;
}

/*------------------------
    WORKOUT SECTION CARD: a soft frame; the band on top tinted in the brand colour with the name, the format, the
    target and the bin; instructions and exercises on a soft surface under it
-------------------------*/
.workout-section-card-wrapper {
    width: 100%;
    border-radius: 1rem;
    border: 1px solid var(--wb-line);
    background-color: var(--wb-surface);
}

.workout-section-header {
    border-radius: calc(1rem - 1px) calc(1rem - 1px) 0 0;
    background-color: var(--wb-band);
    color: var(--bs-body-color);
}

/* The name of the section: a white field on the band */
.workout-section-header [data-section-field="name"] {
    min-height: 2.25rem;
    padding-block: 0.3rem;
    border-color: rgba(var(--mangofit-color-rgb), 0.2);
    border-radius: 0.6rem;
    background-color: var(--bs-body-bg);
    font-weight: 600;
}

/* The format («- EMOM», «- A tempo») in the brand colour, the target labels calm */
.workout-section-header-muted {
    color: var(--bs-secondary-color);
    letter-spacing: 0.03em;
}

.workout-section-header small.workout-section-header-muted:not(.text-uppercase) {
    color: var(--wb-brand-text);
    font-weight: 600;
    letter-spacing: 0;
}

.workout-section-header :is([data-section-field="target_duration_minutes"], [data-section-field="target_rounds"]),
.workout-section-header .input-group-text {
    border-color: rgba(var(--mangofit-color-rgb), 0.2);
    background-color: var(--bs-body-bg);
}

.workout-section-header .input-group-text {
    color: var(--bs-secondary-color);
}

.workout-section-header [data-section-field="target_rounds"] {
    border-radius: 0.6rem;
}

.workout-section-header .input-group > .form-control {
    border-top-left-radius: 0.6rem;
    border-bottom-left-radius: 0.6rem;
}

.workout-section-header .input-group > .input-group-text {
    border-top-right-radius: 0.6rem;
    border-bottom-right-radius: 0.6rem;
}

/* The duration of an interval, calculated from its exercises: a calm chip */
.workout-section-target-chip {
    padding: 0.35rem 0.6rem;
    border-radius: 0.6rem;
    background-color: var(--bs-body-bg);
    color: var(--bs-body-color);
    font-size: 0.8rem;
    font-weight: 600;
}

.workout-section-header [data-section-field]:focus {
    border-color: rgba(var(--mangofit-color-rgb), 0.5);
    box-shadow: 0 0 0 0.2rem var(--wb-focus);
}

.workout-section-header [data-section-field].is-invalid {
    border-color: var(--bs-form-invalid-border-color);
}

/* The chevron and the bin: buttons that keep the look of the bare icons, in the colours of the text */
.btn.workout-section-header-button {
    --bs-btn-color: var(--wb-brand-text);
    --bs-btn-hover-color: var(--mangofit-color);
    --bs-btn-active-color: var(--mangofit-color);
    position: relative;
    line-height: 1;
    text-decoration: none;
}

.btn.workout-section-header-button[onclick^="removeWorkoutItem"] {
    --bs-btn-color: var(--bs-secondary-color);
    --bs-btn-hover-color: var(--bs-danger);
    --bs-btn-active-color: var(--bs-danger);
}

.btn.workout-section-header-button:focus-visible {
    outline: 2px solid var(--mangofit-color);
    outline-offset: 2px;
    box-shadow: none;
}

/* Instructions: a white field on the soft surface; «Aggiungi esercizi» a white soft button */
.workout-section-card-wrapper [data-section-field="instructions"] {
    border-color: var(--wb-line);
    border-radius: 0.75rem;
    background-color: var(--bs-body-bg);
}

.workout-section-card-wrapper [data-section-field="instructions"]:focus {
    border-color: rgba(var(--mangofit-color-rgb), 0.45);
    box-shadow: 0 0 0 0.2rem var(--wb-focus);
}

.workout-section-card-wrapper .form-floating > label {
    color: var(--bs-secondary-color) !important;
}

.workout-section-card-wrapper :is(.workout-section-card-footer, [data-workout-section-emom-hint]) .btn-outline-contrast-theme {
    border-color: var(--wb-line) !important;
    border-radius: 0.6rem;
    background-color: var(--bs-body-bg);
    font-weight: 600;
}

.workout-section-card-wrapper :is(.workout-section-card-footer, [data-workout-section-emom-hint]) .btn-outline-contrast-theme:hover {
    background-color: var(--wb-field) !important;
}

.custom-checklist > .workout-section-move-controls {
    display: none;
}

@media (hover: hover) and (pointer: fine) {
    .custom-checklist > .workout-section-move-controls {
        position: absolute;
        top: -0.625rem;
        right: 1.25rem;
        z-index: 5;
        display: inline-flex;
        gap: 0.1875rem;
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.15s ease;
    }

    .workout-section-move-controls .btn {
        display: inline-grid;
        place-items: center;
        width: 1.25rem;
        height: 1.25rem;
        padding: 0;
        border: 1px solid var(--wb-line, var(--bs-border-color));
        border-radius: 0.3rem;
        background: var(--bs-body-bg);
        color: var(--bs-body-color);
        font-size: .75rem;
        line-height: 1;
        box-shadow: var(--bs-box-shadow-sm);
    }

    .workout-section-move-controls .btn:hover {
        background: var(--bs-primary-bg-subtle);
        border-color: var(--bs-primary-border-subtle);
        color: var(--bs-primary-text-emphasis);
    }

    .workout-section-move-controls .btn:focus-visible {
        outline: 2px solid var(--bs-primary);
        outline-offset: 1px;
    }

    .custom-checklist:hover > .workout-section-move-controls,
    .custom-checklist.workout-move-group-hover > .workout-section-move-controls,
    .custom-checklist:focus-within > .workout-section-move-controls {
        opacity: 1;
        pointer-events: auto;
    }
}

.workout-section-card-exercises-container.workout-section-drop-highlight {
    outline: 2px dashed rgba(var(--mangofit-color-rgb), 0.6);
    outline-offset: 4px;
    background-color: rgba(var(--mangofit-color-rgb), 0.06);
    border-radius: var(--bs-border-radius);
    min-height: 35px;
    position: relative;
}

.workout-section-card-exercises-container.workout-section-drop-highlight::before {
    content: var(--drop-here-text, "Drop Here");
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(var(--contrast-theme-color-rgb), 0.6);
    pointer-events: none;
}

.custom-checklist + .workout-section-card-wrapper {
    margin-top: 1rem; /* same as Bootstrap .mt-3 */
}

/*----------------------------------
    CHOOSING THE FORMAT AND THE EDITOR OF A NEW SECTION: soft frames, the formats as soft tiles with their icon tile
------------------------------------*/
.workout-builder-dialog :is([data-id="workout_sections_selection_container"], [data-id="workout_section_editor_container"]) > .card {
    --bs-card-border-color: var(--wb-line);
    --bs-card-border-radius: 1rem;
    --bs-box-shadow: 0 1px 2px rgba(var(--contrast-theme-color-rgb), 0.05), 0 6px 18px rgba(var(--contrast-theme-color-rgb), 0.06);
}

.workout-sections-selection [data-section-format].btn-outline-contrast-theme {
    padding: 0.75rem 0.85rem;
    border-color: transparent !important;
    border-radius: 0.9rem;
    background-color: var(--wb-soft);
}

.workout-sections-selection [data-section-format].btn-outline-contrast-theme:hover,
.workout-sections-selection [data-section-format].btn-outline-contrast-theme:focus-visible {
    border-color: rgba(var(--mangofit-color-rgb), 0.35) !important;
    background-color: rgba(var(--mangofit-color-rgb), 0.07) !important;
}

.workout-sections-selection .workout-section-format-icon {
    width: 2.25rem;
    height: 2.25rem;
    padding: 0 !important;
    border-radius: 0.65rem !important;
    background: rgba(var(--mangofit-color-rgb), 0.12);
    color: var(--wb-brand-text);
}

.workout-sections-selection .workout-section-format-icon > i {
    font-size: 1rem;
}

.workout-sections-selection [data-section-format] .badge {
    padding: 0.2rem 0.5rem;
    border: 0 !important;
    border-radius: 999px;
    background-color: var(--bs-body-bg);
    color: var(--bs-secondary-color) !important;
    font-weight: 600;
}

/*------------------------------------------------
    READ-ONLY PREVIEW (getWorkoutItemsPreviewElement)
    The cards of the canvas without what edits them
-------------------------------------------------*/
.workout-items-preview .workout-section-move-controls,
.workout-items-preview .exercise-actions,
.workout-items-preview .exercise-info-details-wrapper div:has(> .remove-set-from-exercise-button),
.workout-items-preview .workout-section-card-wrapper [onclick^="removeWorkoutItem"],
.workout-items-preview .workout-section-card-wrapper [onclick^="showExercisesLibrarySelection"] {
    display: none !important;
}

.workout-items-preview .custom-checklist-separator {
    cursor: default;
    pointer-events: none;
}

/* Compact (the importer's review): only image and name, nothing opens */
.workout-items-preview.is-compact .custom-checklist .custom-checklist-label {
    cursor: default;
}

/* Exercises that are not a superset have no link between them: the same space as in the canvas */
.workout-items-preview :not(.flex-vertical-list) > .custom-checklist + .custom-checklist,
.workout-items-preview > .custom-checklist + .custom-checklist {
    margin-top: 1rem;
}

/*------------------------
    EXERCISE GROUP LIST
-------------------------*/
.exercise-group-list {
    border-left: 1px solid var(--mangofit-color);
    padding-left: 15px;
}

.exercise-group-list .exercise-inner-wrapper::before {
    content: "";
    position: absolute;
    top: 50%;
    left: -16px;
    width: 15px;
    height: 1px;
    background-color:var(--mangofit-color);
}

/*--------------------------------
    EXERCISE TYPOLGY INPUT FIELD
---------------------------------*/
.exercise-typology-input-field {
    text-align: center;
    border-color: transparent !important;
}

.exercise-input-field[data-set-input-type="duration"] {
    cursor: pointer;
    font-variant-numeric: tabular-nums;
}

.workout-duration-picker-modal .modal-body {
    padding-top: 0.75rem;
}

.workout-duration-picker-modal .timer-wheel {
    max-width: 540px;
}

.workout-duration-picker-modal .timer-wheel.is-syncing {
    visibility: hidden;
}

.workout-duration-picker-modal .timer-wheel__item {
    font-size: clamp(1.35rem, 5vw, 1.85rem);
}

.workout-duration-picker-tooltip-trigger {
    cursor: help;
}

@media (hover: none), (pointer: coarse) {
    .workout-duration-picker-tooltip-trigger {
        display: none;
    }
}

.workout-duration-picker-modal .modal-footer {
    gap: 0.5rem;
}

.workout-duration-picker-start-timer-container {
    position: absolute;
    top: calc(100% + 1rem);
    left: 50%;
    transform: translateX(-50%);
    z-index: 1;
}

/*---------------------------
    EXERCISE SETS CONTAINER
---------------------------*/
.exercise-sets-container {
    border: var(--bs-border-width) var(--bs-border-style) var(--bs-border-color);
    border-radius: var(--bs-border-radius);
    margin: 0.5rem;
    overflow: hidden;
}

.exercise-set-wrapper-content {
    display: flex;
    align-items: center;
    justify-content: space-around;
    gap: 0.5rem;
    padding: 0.5rem;
}

.exercise-set-wrapper-content:not(:last-child) {
    border-bottom: var(--bs-border-width) var(--bs-border-style) var(--bs-border-color);
}

.exercise-set-wrapper-content.training-current-set-flow {
    box-shadow: inset 3px 0 0 var(--success);
}

/*---------------------------
    SETS OF THE CANVAS CARD: calm labels, each set a soft row with the values in place (no frame, no lines); a value
    shows its field on hover and focus. The training player keeps the rows above
---------------------------*/
.custom-checklist .exercise-sets-labels {
    gap: 0.5rem;
    padding: 0 0.75rem 0.4rem;
    color: var(--bs-secondary-color);
    font-size: 0.78rem;
    font-weight: 600;
}

.custom-checklist .exercise-sets-container {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
    margin: 0 0.25rem;
    border: 0;
    border-radius: 0;
    overflow: visible;
}

.custom-checklist .exercise-set-wrapper-content {
    padding: 0.3rem 0.5rem;
    border-radius: 0.75rem;
    background-color: var(--wb-soft);
}

.custom-checklist .exercise-set-wrapper-content:not(:last-child) {
    border-bottom: 0;
}

.custom-checklist .exercise-typology-input-field {
    border-radius: 0.55rem;
    background-color: transparent;
    font-variant-numeric: tabular-nums;
    transition: background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

@media (hover: hover) and (pointer: fine) {
    .custom-checklist .exercise-typology-input-field:hover {
        background-color: var(--bs-body-bg);
    }
}

.custom-checklist .exercise-typology-input-field:focus {
    border-color: rgba(var(--mangofit-color-rgb), 0.45) !important;
    background-color: var(--bs-body-bg);
    box-shadow: 0 0 0 0.2rem var(--wb-focus);
}

/* «Rimuovi serie» stays red, as a soft red button; «Aggiungi serie» and its «+» are two soft segments */
.custom-checklist .remove-set-from-exercise-button.btn-danger {
    --bs-btn-color: var(--bs-danger-text-emphasis);
    --bs-btn-bg: rgba(var(--bs-danger-rgb), 0.1);
    --bs-btn-border-color: transparent;
    --bs-btn-hover-color: var(--bs-danger-text-emphasis);
    --bs-btn-hover-bg: rgba(var(--bs-danger-rgb), 0.17);
    --bs-btn-hover-border-color: transparent;
    --bs-btn-active-color: var(--bs-danger-text-emphasis);
    --bs-btn-active-bg: rgba(var(--bs-danger-rgb), 0.22);
    --bs-btn-active-border-color: transparent;
    --bs-btn-border-radius: 0.6rem;
    font-weight: 600;
}

.custom-checklist .append-multiple-sets-to-exercise-btn-group .btn-outline-contrast-theme {
    --bs-btn-border-radius: 0.6rem;
    border-color: transparent !important;
    background-color: var(--wb-soft);
    font-weight: 600;
}

.custom-checklist .append-multiple-sets-to-exercise-btn-group .btn-outline-contrast-theme:hover,
.custom-checklist .append-multiple-sets-to-exercise-btn-group .btn-outline-contrast-theme.show {
    background-color: var(--wb-soft-hover) !important;
}

.custom-checklist .append-multiple-sets-to-exercise-btn-group.btn-group > .btn-group {
    margin-left: 2px;
}

.custom-checklist .append-multiple-sets-to-exercise-btn-group .rounded-end-1 {
    border-radius: 0 0.6rem 0.6rem 0 !important;
}

/* «Per lato», the tempo and the notes: soft fields */
.custom-checklist .exercise-info-details-wrapper .exercise-input-field.bg-body-secondary {
    border-color: transparent;
    border-radius: 0.65rem;
    background-color: var(--wb-field) !important;
}

.custom-checklist .exercise-info-details-wrapper [data-set-input-type="tempo"] {
    min-height: 2.25rem;
    letter-spacing: 0.04em;
}

.custom-checklist .exercise-info-details-wrapper textarea.exercise-input-field {
    border-radius: 0.75rem;
}

.custom-checklist .exercise-info-details-wrapper .exercise-input-field.bg-body-secondary:focus {
    border-color: rgba(var(--mangofit-color-rgb), 0.45);
    box-shadow: 0 0 0 0.2rem var(--wb-focus);
}

.custom-checklist .exercise-info-details-wrapper .form-floating > .form-control ~ label {
    color: var(--bs-secondary-color);
}

.custom-checklist .exercise-info-details-wrapper .form-floating > .form-control ~ label::after {
    background-color: var(--wb-field);
}

/*---------------------------
    WORKOUT ITEM WRAPPER
---------------------------*/
.workout-sorting-section-wrapper-element .section-item-hoverable-draggable-icon,
.workout-sorting-section-wrapper-element .exercise-item-hoverable-draggable-icon,
.workout-sorting-exercise-wrapper-element .exercise-item-hoverable-draggable-icon {
    opacity: 0;
}

.workout-sorting-section-wrapper-element:hover .section-item-hoverable-draggable-icon,
.workout-sorting-section-wrapper-element .exercise-draggable-item-template:hover .exercise-item-hoverable-draggable-icon,
.workout-sorting-exercise-wrapper-element:hover .exercise-item-hoverable-draggable-icon {
    opacity: 1 !important;
}

/*---------------------------
    «DISPOSIZIONE» OF THE BUILDER: the same structure (circle, triangle of a section, «SUPERSERIE», drag icon) on soft
    rows; a section is a soft frame with its tinted band, a superset a soft surface with its brand chip. The previews
    of the workouts keep their cards (getExerciseTemplate is shared)
---------------------------*/
.workout-builder-dialog [data-id="sort_exercises_container"] {
    --bs-box-shadow-sm: none;
}

.workout-builder-dialog [data-id="sort_exercises_container"] .workout-sorting-exercise-wrapper-element.card {
    --bs-card-border-radius: 0.75rem;
    --bs-card-bg: var(--wb-soft);
    border-color: transparent !important;
}

.workout-builder-dialog [data-id="sort_exercises_container"] .exercise-draggable-item-template.p-3 {
    padding: 0.65rem 0.85rem !important;
}

.workout-builder-dialog [data-id="sort_exercises_container"] :is(.exercise-draggable-item-template, .section-draggable-item-template) h6 {
    color: var(--bs-heading-color);
    font-weight: 600;
    line-height: 1.3;
}

.workout-builder-dialog [data-id="sort_exercises_container"] .exercise-draggable-item-template > .bi-circle {
    color: var(--bs-secondary-color);
}

.workout-builder-dialog [data-id="sort_exercises_container"] .workout-sorting-section-wrapper-element.card {
    --bs-card-border-radius: 0.9rem;
    --bs-card-inner-border-radius: calc(0.9rem - 1px);
    border-color: var(--wb-line) !important;
}

.workout-builder-dialog [data-id="sort_exercises_container"] .section-draggable-item-template {
    padding: 0.7rem 0.85rem !important;
    border-radius: calc(0.9rem - 1px) calc(0.9rem - 1px) 0 0;
    background-color: var(--wb-band);
}

.workout-builder-dialog [data-id="sort_exercises_container"] .section-draggable-item-template:only-child {
    border-radius: calc(0.9rem - 1px);
}

.workout-builder-dialog [data-id="sort_exercises_container"] .workout-sorting-section-exercises-toggleable-container {
    padding: 0.5rem !important;
    border-top: 0 !important;
}

.workout-builder-dialog [data-id="sort_exercises_container"] .workout-sorting-section-exercises-list {
    gap: 0.4rem !important;
}

.workout-builder-dialog [data-id="sort_exercises_container"] [data-group-type="superset"] {
    padding: 0.45rem;
    border-radius: 0.9rem;
    background-color: var(--wb-soft);
}

.workout-builder-dialog [data-id="sort_exercises_container"] [data-group-type="superset"] .badge.bg-mangofit-color {
    --bs-bg-opacity: 0.14;
    --bs-badge-color: var(--wb-brand-text);
    --bs-badge-padding-x: 0.6rem;
    --bs-badge-padding-y: 0.35rem;
    margin: 0.1rem 0 0.45rem 0.1rem !important;
    border-radius: 999px;
    letter-spacing: 0.03em;
}

.workout-builder-dialog [data-id="sort_exercises_container"] [data-group-type="superset"] .exercise-group-list {
    gap: 0.4rem;
    padding-left: 0;
    border-left: 0;
}

.workout-builder-dialog [data-id="sort_exercises_container"] [data-group-type="superset"] .exercise-group-list .exercise-inner-wrapper::before {
    display: none;
}

.workout-builder-dialog [data-id="sort_exercises_container"] [data-group-type="superset"] .workout-sorting-exercise-wrapper-element.card {
    --bs-card-bg: var(--bs-body-bg);
}

/*-----------------------
    KEYFRAMES
-----------------------*/
@keyframes move {
    50% {
        padding-left: 8px;
        padding-right: 0px;
    }

    100% {
        padding-right: 4px;
    }
}

@keyframes slice {
    60% {
        width: 100%;
        left: 4px;
    }

    100% {
        width: 100%;
        left: -2px;
        padding-left: 0;
    }
}

@keyframes check-01 {
    0% {
        width: 4px;
        top: auto;
        transform: rotate(0);
    }

    50% {
        width: 0px;
        top: auto;
        transform: rotate(0);
    }

    51% {
        width: 0px;
        top: 8px;
        transform: rotate(45deg);
    }

    100% {
        width: 5px;
        top: 8px;
        transform: rotate(45deg);
    }
}

@keyframes check-02 {
    0% {
        width: 4px;
        top: auto;
        transform: rotate(0);
    }

    50% {
        width: 0px;
        top: auto;
        transform: rotate(0);
    }

    51% {
        width: 0px;
        top: 8px;
        transform: rotate(-45deg);
    }

    100% {
        width: 10px;
        top: 8px;
        transform: rotate(-45deg);
    }
}

@keyframes firework {
    0% {
        opacity: 1;
        box-shadow: 0 0 0 -2px #4f29f0, 0 0 0 -2px #4f29f0, 0 0 0 -2px #4f29f0,
            0 0 0 -2px #4f29f0, 0 0 0 -2px #4f29f0, 0 0 0 -2px #4f29f0;
    }

    30% {
        opacity: 1;
    }

    100% {
        opacity: 0;
        box-shadow: 0 -15px 0 0px #4f29f0, 14px -8px 0 0px #4f29f0,
            14px 8px 0 0px #4f29f0, 0 15px 0 0px #4f29f0,
            -14px 8px 0 0px #4f29f0, -14px -8px 0 0px #4f29f0;
    }
}

/*==================================================================================================================
    FIXES OF THE RESTYLE (1 December 2026), kept in the light refresh
==================================================================================================================*/

/*---------------------------
    ERRORS OF A SET: a value in error has a red outline (the borders of the set fields are transparent) and its
    message is red text under the value instead of a framed alert
---------------------------*/
.custom-checklist :is(.exercise-typology-input-field, .exercise-input-field).is-invalid {
    border-color: var(--bs-form-invalid-border-color) !important;
}

.custom-checklist .exercise-info-details-wrapper .alert.invalid-feedback {
    margin: 0.2rem 0 0;
    padding: 0;
    border: 0;
    background: none;
    color: var(--bs-form-invalid-color);
    font-size: 0.75rem;
    line-height: 1.3;
    text-align: center;
}

/*---------------------------
    SINGLE EXERCISE EDITORS (a program day, the client's calendar: renderExerciseChecklistInModal) put the canvas card
    in a set container of their own: no second frame around the card
---------------------------*/
.exercise-sets-container:has(> .custom-checklist) {
    margin: 0;
    overflow: visible;
    border: 0;
}

/*---------------------------
    LIBRARY COLUMN OF THE BUILDER: search bar and list heights without inline styles
---------------------------*/
.workout-builder-library-toolbar {
    height: 40px;
}

.bootstrap-scroll-table.workout-builder-library-list {
    height: calc(100% - 40px) !important;
}

/*---------------------------
    SET COLUMNS: in the builder they share the row by weight (the set column a little wider) instead of the equal
    inline widths of getExerciseSetFieldWidthStyle(), which the training player keeps
---------------------------*/
.custom-checklist :is(.exercise-sets-labels, .exercise-set-wrapper-content) > div {
    flex: 1 1 0;
    width: auto !important;
    min-width: 0;
}

.custom-checklist :is(.exercise-sets-labels, .exercise-set-wrapper-content) > div:first-child {
    flex-grow: 1.6;
}

/*---------------------------
    NARROW CANVAS (phones, and the canvas between the side columns up to 1199 px): each set stays on one line under
    its column titles, as before the restyle (owner, 2 December 2026: the kind on a line of its own broke the rows).
    The kind has less inner space and, when it is still too long, ends with «…»; the open list shows it whole
---------------------------*/
@media (max-width: 1199.98px) {
    .custom-checklist .exercise-set-wrapper-content > div:first-child .form-select {
        min-width: 0;
        padding-inline: 0.4rem 1.5rem;
        background-position: right 0.35rem center;
        background-size: 12px 9px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    /* The values keep their digits whole («30,00», «100,00») in the narrower columns */
    .custom-checklist .exercise-set-wrapper-content input.exercise-typology-input-field {
        padding-inline: 0.2rem;
    }
}

@media (max-width: 1199.98px) {
    .workout-builder-dialog .workout-builder-add-row {
        flex-wrap: wrap;
    }

    .workout-builder-dialog .custom-checklist :is(.custom-checklist-label, .custom-checklist-dropdown-trigger) {
        min-width: 0;
    }

    .workout-builder-dialog .custom-checklist-dropdown-trigger > .bg-body-secondary {
        min-width: 0;
        overflow-wrap: anywhere;
    }

    .workout-builder-dialog .exercise-set-wrapper-content input[data-set-input-type="weight_amount"] {
        appearance: textfield;
        padding-inline: 0;
    }

    .workout-builder-dialog .exercise-set-wrapper-content input[data-set-input-type="weight_amount"]::-webkit-inner-spin-button {
        appearance: none;
    }
}

@media (min-width: 768px) and (max-width: 1199.98px) {
    .workout-builder-dialog .custom-checklist-dropdown-trigger {
        gap: 0.25rem !important;
    }

    .workout-builder-dialog .custom-checklist-dropdown-trigger > img {
        width: 44px !important;
        height: 44px !important;
    }

    .workout-builder-dialog .custom-checklist-dropdown-trigger > .bg-body-secondary {
        margin-inline-start: 0 !important;
        padding-inline: 0.5rem !important;
    }

    .workout-builder-dialog .custom-checklist :is(.exercise-sets-labels, .exercise-set-wrapper-content) {
        column-gap: 0.25rem;
    }
}

/* On phones the set column takes a little more of the row, so «1 - Regolare» reads whole beside three values */
@media (max-width: 767.98px) {
    .custom-checklist :is(.exercise-sets-labels, .exercise-set-wrapper-content) > div:first-child {
        flex-grow: 2;
    }
}

/*---------------------------
    PHONES (below 768 px): targets of at least 40 px. Where the look must not change, the target grows with an
    invisible area around the control
---------------------------*/
@media (max-width: 767.98px) {
    .workout-builder-dialog .modal-header > .circle-icon-button,
    .workout-builder-arrangement-head .circle-icon-button {
        min-width: 2.5rem;
        min-height: 2.5rem;
    }

    .workout-builder-dialog .modal-footer .mg-action-button,
    .custom-checklist .workout-card-set-actions .btn,
    .btn.workout-section-header-button,
    .workout-section-card-footer .btn,
    .workout-sorting-section-toggle,
    .workout-section-editor-back {
        position: relative;
    }

    .workout-builder-dialog .modal-footer .mg-action-button::after {
        position: absolute;
        inset: -2px 0;
        content: "";
    }

    .custom-checklist .workout-card-set-actions .btn::after,
    .workout-section-card-footer .btn::after {
        position: absolute;
        inset: -0.35rem -0.15rem;
        content: "";
    }

    .custom-checklist .append-multiple-sets-to-exercise-btn-group [data-bs-toggle="dropdown"] {
        min-width: 2.5rem;
        min-height: 2.5rem;
    }

    .btn.workout-section-header-button::after,
    .workout-sorting-section-toggle::after,
    .workout-section-editor-back::after {
        position: absolute;
        top: 50%;
        left: 50%;
        width: 2.5rem;
        height: 2.5rem;
        transform: translate(-50%, -50%);
        content: "";
    }

    .custom-checklist .workout-card-set-actions .dropdown-item {
        min-height: 2.5rem;
    }

    /* The whole «Per lato» row is the target: its label covers the row */
    .custom-checklist .workout-card-each-side {
        position: relative;
        display: flex;
        align-items: center;
        gap: 0.5rem;
        min-height: 2.5rem;
    }

    .custom-checklist .workout-card-each-side .form-check-input {
        margin-top: 0;
    }

    .custom-checklist .workout-card-each-side label::before {
        position: absolute;
        inset: 0;
        content: "";
    }

    .custom-checklist .exercise-typology-input-field {
        min-height: 2.5rem;
    }

    .custom-checklist-separator {
        display: flex;
        align-items: center;
        justify-content: center;
        min-height: 2.5rem;
    }
}

/* The narrowest phones: the band of a section keeps its bin and its format inside the card (the name field gives up
   width, the target field and the gaps are a little smaller); «Aggiungi esercizi» and «Aggiungi sezione» go one above
   the other */
@media (max-width: 399.98px) {
    [data-workout-section-header] [data-section-field="name"] {
        flex: 0 1 auto;
        min-width: 0;
    }

    [data-workout-section-header] > .ms-auto {
        gap: 0.6rem !important;
    }

    [data-workout-section-header] .w-100-px {
        width: 5rem !important;
    }

    /* The name of an exercise gets the room of its words: less inner space and a 40 px ⋯ */
    .custom-checklist .custom-checklist-dropdown-trigger > .bg-body-secondary {
        margin-inline-start: 0 !important;
        padding-inline: 0.65rem !important;
        font-size: 0.95rem;
    }

    .custom-checklist .exercise-actions {
        margin-inline-start: 0.125rem;
    }

    .custom-checklist .exercise-actions-toggle.mg-action-button {
        min-width: 2.5rem;
    }
}

@media (max-width: 379.98px) {
    .workout-builder-add-row {
        flex-direction: column;
        align-items: stretch !important;
    }

    /* A smaller image leaves the name of the exercise room for its words */
    .custom-checklist .custom-checklist-dropdown-trigger > img {
        width: 48px !important;
        height: 48px !important;
    }
}

/* At 320 px the footer keeps one row: «Ordina esercizi» shows only its icon, its label stays for screen readers */
@media (max-width: 359.98px) {
    .workout-builder-sort-button .mg-action-button-content > span {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(0 0 0 0);
        white-space: nowrap;
    }

    .btn.mg-action-button.workout-builder-sort-button {
        min-width: 2.75rem;
    }
}
