/* =========================================================
    CALENDARS
    The toolbars of the program calendar, of the client's «Allenamento» on the coach profile and of the client's
    own calendar, the shared day cell of every calendar (.mf-calendar-*, also used by «Attività»), the workout
    cards inside the cells and the phone layout (agenda by day).
========================================================= */

/* ---------------------------
    PROGRAMS CALENDAR
--------------------------- */
#v-pills-library-programs .view-programs {
    cursor: pointer;
}
.mangofit-week-switcher {
    align-items: center;
    display: inline-flex;
    gap: 0.35rem;
    min-width: 0;
    white-space: nowrap;
}

.mangofit-week-switcher-label {
    align-items: center;
    color: var(--bs-body-color);
    display: inline-flex;
    gap: 0.45rem;
    min-height: 2rem;
}

.mangofit-week-switcher-label i {
    color: inherit;
}

.mangofit-week-switcher-arrow {
    --bs-btn-active-bg: transparent;
    --bs-btn-active-border-color: transparent;
    --bs-btn-bg: transparent;
    --bs-btn-border-color: transparent;
    --bs-btn-border-width: 0;
    --bs-btn-focus-box-shadow: none;
    --bs-btn-hover-bg: transparent;
    --bs-btn-hover-border-color: transparent;
    --bs-btn-padding-x: 0;
    --bs-btn-padding-y: 0;

    align-items: center;
    background: transparent !important;
    border: 0 !important;
    border-radius: 0;
    box-shadow: none !important;
    color: var(--bs-body-color);
    display: inline-flex;
    flex: 0 0 auto;
    font-size: 1.08rem;
    font-weight: 700;
    justify-content: center;
    line-height: 1;
    min-height: 2rem;
    min-width: 1.55rem;
    padding: 0;
}

.mangofit-week-switcher-arrow:hover,
.mangofit-week-switcher-arrow:focus,
.mangofit-week-switcher-arrow:focus-visible,
.mangofit-week-switcher-arrow:active {
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
    color: var(--mangofit-color);
}

.mangofit-week-switcher-arrow:disabled {
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
    color: rgba(var(--contrast-theme-color-rgb), 0.18);
    opacity: 1;
}

#v-pills-library-programs .text-whitespace {
    white-space: break-spaces;
}

#v-pills-library-programs .exercise-block {
    padding: 10px;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    background-color: #ffffff;
    margin-bottom: 10px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

#v-pills-library-programs .modal-edit-workout-body {
    max-height: 70vh; /* responsive height */
    overflow-y: auto;
    padding-right: 15px;
}

#v-pills-library-programs .program-calendar-controls {
    min-width: 0;
}

#v-pills-library-programs .program-calendar-week-nav {
    flex-shrink: 0;
    white-space: nowrap;
}

#v-pills-library-programs .program-calendar-actions {
    min-width: 0;
}

#v-pills-library-programs .paste-program-week-container {
    position: absolute;
    top: 50%;
    left: 0;
    width: 100%;
    display: flex;
    justify-content: center;
    transform: translateY(-50%);
    pointer-events: none;
    gap: 0.625rem;
}

#v-pills-library-programs .btn-paste-program-week,
#v-pills-library-programs .cancel-program-week-copy-mode {
    pointer-events: auto;
    font-weight: 600;
}

/* The toolbar of a program never runs off the screen. Its pieces may always wrap (a long program name sends the
   controls to a second row), and the toolbar is the size container of its own layout: it holds no menu, so the
   container traps no position: fixed element. With the side menu one row needs about 1,370px (name and about 940px
   of controls), so the 1,200-1,365px windows used to scroll sideways and hide «4 settimane». */
#v-pills-library-programs .program-calendar-borders {
    container: program-calendar-toolbar / inline-size;
    flex-wrap: wrap;
    row-gap: 0.5rem;
}

/* A name longer than the whole toolbar wraps on its own row instead of pushing it wider */
#v-pills-library-programs .program-calendar-borders > .go_back_to_program {
    min-width: 0;
}

#v-pills-library-programs .program-calendar-controls {
    flex-wrap: wrap;
    justify-content: flex-end;
    row-gap: 0.5rem;
    margin-inline-start: auto;
}

#v-pills-library-programs .program-calendar-actions {
    flex-wrap: wrap;
    justify-content: flex-end;
    row-gap: 0.5rem;
}

/* Below 80rem of toolbar: name and week on the first row, the actions on the second (!important: the element also
   has .d-flex) */
@container program-calendar-toolbar (max-width: 79.98rem) {
    #v-pills-library-programs .program-calendar-controls {
        display: contents !important;
    }

    #v-pills-library-programs .program-calendar-week-nav {
        margin-inline-start: auto;
    }

    #v-pills-library-programs .program-calendar-actions {
        flex: 1 1 100%;
    }
}

/* Below about 46rem the views keep their short label («1 sett.») so the actions stay on one row */
@container program-calendar-toolbar (max-width: 45.98rem) {
    #v-pills-library-programs .program-calendar-actions .calendar-view-option-label {
        display: none;
    }

    #v-pills-library-programs .program-calendar-actions .calendar-view-option-short {
        display: inline;
    }
}

@media (min-width: 768px) and (max-width: 1199.98px) {
    /* Narrower day columns keep only the day number: the week name on the left already says «Settimana N» */
    #v-pills-library-programs .mf-calendar-cell-kicker {
        display: none;
    }

    #v-pills-library-programs .mf-calendar-cell-kicker + .mf-calendar-cell-number {
        min-width: 1.75rem;
        padding-inline: 0.3rem;
    }
}

/* ---------------------------
    CLIENT CALENDARS: «Allenamento» on the coach profile and the client's own calendar
--------------------------- */

/* Weekdays hidden */
#v-pills-profile-section-training .weekdays,
#assisted-user-training-calendar .weekdays {
    display: none;
}

/* Weekday base */
#v-pills-profile-section-training .trainingcalendarweekday,
#assisted-user-training-calendar .trainingcalendarweekday {
    cursor: pointer;
    font-size: 14px;
    line-height: 1.2;
}

/* Weekday active */
#v-pills-profile-section-training .trainingcalendarweekday.active,
#assisted-user-training-calendar .trainingcalendarweekday.active {
    color: var(--mangofit-color);
    font-weight: bold;
}

/* Weekday hover */
#v-pills-profile-section-training .trainingcalendarweekday:hover,
#assisted-user-training-calendar .trainingcalendarweekday:hover {
    color: var(--mangofit-color);
}

/* Shared calendar toolbar: navigation and view, week range in the middle, date at the end (in the client's
   profile also «Genera settimana»). The profile's toolbar stays on one row: as its own width shrinks (a
   tablet, the list of clients beside it) the arrows lose their labels, the date becomes a calendar button,
   «Oggi» and the week options shorten and, as narrow as a phone, the week options are left out (container
   queries below). Phones have their own one-row grid below */
#v-pills-profile-section-training .calendar-toolbar,
#assisted-user-training-calendar .calendar-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
    padding: 0.25rem 0 0.75rem;
}

#v-pills-profile-section-training .calendar-toolbar-primary,
#assisted-user-training-calendar .calendar-toolbar-primary {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    min-width: 0;
}

#v-pills-profile-section-training .calendar-toolbar-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.6rem;
    margin-left: auto;
    min-width: 0;
}

#v-pills-profile-section-training .calendar-toolbar-actions .calendar-date-jump {
    width: 150px;
}

@media (min-width: 768px) {
    #v-pills-profile-section-training .calendar-toolbar-primary,
    #assisted-user-training-calendar .calendar-toolbar-primary {
        flex-wrap: wrap;
    }

    #v-pills-profile-section-training .calendar-toolbar {
        container: profile-calendar-toolbar / inline-size;
    }

    #v-pills-profile-section-training .calendar-week-range {
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
    }
}

/* A narrow window of a computer (768-991px): as in «Attività», the calendar takes the width of the list of clients,
   so the week stays a grid instead of seven strips (the profile's back arrow returns to the list) */
@media (min-width: 768px) and (max-width: 991.98px) {
    #users_page:has(#v-pills-profile-section-training.active) #assisted_users_sidebar_actions {
        display: none;
    }
}

/* Every control with its label needs about 1,000px: below that the arrows keep only their icon */
@container profile-calendar-toolbar (max-width: 1010px) {
    #v-pills-profile-section-training .calendar-toolbar .calendar-nav-btn:not(.calendar-today-btn) span {
        display: none;
    }
}

/* Below about 850px the date becomes a calendar button: the week range next to it already says the week */
@container profile-calendar-toolbar (max-width: 850px) {
    #v-pills-profile-section-training .calendar-toolbar-actions .calendar-date-jump {
        position: relative;
        justify-content: center;
        width: 36px;
        padding: 0;
    }

    #v-pills-profile-section-training .calendar-toolbar-actions .calendar-date-input {
        position: absolute;
        inset: 0;
        opacity: 0;
        cursor: pointer;
    }
}

/* Below about 700px (a 10" tablet in landscape beside the list of clients) «Oggi» keeps its icon and the
   week options their short label («1 sett.»); the buttons keep the full label for screen readers */
@container profile-calendar-toolbar (max-width: 700px) {
    #v-pills-profile-section-training .calendar-toolbar .calendar-today-btn span,
    #v-pills-profile-section-training .calendar-toolbar .calendar-view-option-label {
        display: none;
    }

    #v-pills-profile-section-training .calendar-toolbar .calendar-view-option-short {
        display: inline;
    }

    #v-pills-profile-section-training .calendar-toolbar .calendar-view-option {
        padding: 0 0.55rem;
    }
}

/* As narrow as a phone (a tablet in portrait beside the list of clients): the week options are left out,
   as on phones */
@container profile-calendar-toolbar (max-width: 540px) {
    #v-pills-profile-section-training .calendar-toolbar .calendar-view-toggle {
        display: none;
    }
}

/* Narrower still (a 9.7" tablet in portrait): tighter arrows, and the week range takes the room that is left,
   on two short lines like on the narrowest phones */
@container profile-calendar-toolbar (max-width: 420px) {
    #v-pills-profile-section-training .calendar-toolbar .calendar-nav-btn {
        padding: 0 0.5rem;
    }

    /* At most about 70px wide, so the two lines split after the dash («ott 26 -», «nov 1») */
    #v-pills-profile-section-training .calendar-toolbar .calendar-week-range {
        flex: 1 1 0;
        min-width: 3.8rem;
        max-width: 4.4rem;
        margin-inline: auto;
        font-size: 0.85rem;
        line-height: 1.1;
        white-space: normal;
        text-overflow: clip;
    }
}

#v-pills-profile-section-training .calendar-nav-group,
#assisted-user-training-calendar .calendar-nav-group,
#v-pills-profile-section-training .calendar-view-toggle,
#assisted-user-training-calendar .calendar-view-toggle,
#v-pills-profile-section-training .calendar-date-jump,
#assisted-user-training-calendar .calendar-date-jump {
    border: 1px solid rgba(var(--contrast-theme-color-rgb), 0.13);
    background: rgba(var(--current-theme-color-rgb), 0.9);
    box-shadow: 0 8px 20px rgba(var(--contrast-theme-color-rgb), 0.06);
}

.week-view-toggle {
    border: 1px solid rgba(var(--contrast-theme-color-rgb), 0.13);
    background: rgba(var(--current-theme-color-rgb), 0.9);
    box-shadow: 0 8px 20px rgba(var(--contrast-theme-color-rgb), 0.06);
}

#v-pills-profile-section-training .calendar-nav-group,
#assisted-user-training-calendar .calendar-nav-group,
#v-pills-profile-section-training .calendar-view-toggle,
#assisted-user-training-calendar .calendar-view-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    padding: 0.2rem;
    border-radius: 8px;
}

.week-view-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    padding: 0.2rem;
    border-radius: 8px;
}

#v-pills-profile-section-training .calendar-nav-btn,
#assisted-user-training-calendar .calendar-nav-btn,
#v-pills-profile-section-training .calendar-view-option,
#assisted-user-training-calendar .calendar-view-option {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    min-height: 32px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: rgba(var(--contrast-theme-color-rgb), 0.82);
    font-size: 0.82rem;
    font-weight: 700;
    line-height: 1;
    white-space: nowrap;
    transition: color 0.18s ease, background-color 0.18s ease, box-shadow 0.18s ease;
}

/* The short label of a week option appears only in a short calendar toolbar (container queries above) */
.calendar-view-option-short {
    display: none;
}

.week-view-toggle-option {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    min-height: 32px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: rgba(var(--contrast-theme-color-rgb), 0.82);
    font-size: 0.76rem;
    font-weight: 700;
    line-height: 1;
    white-space: nowrap;
    padding: 0 0.75rem;
    transition: color 0.18s ease, background-color 0.18s ease, box-shadow 0.18s ease;
}

#v-pills-profile-section-training .calendar-nav-btn {
    padding: 0 0.7rem;
}

#assisted-user-training-calendar .calendar-nav-btn {
    padding: 0 0.7rem;
}

#v-pills-profile-section-training .calendar-view-option,
#assisted-user-training-calendar .calendar-view-option {
    padding: 0 0.75rem;
    font-size: 0.76rem;
}

#v-pills-profile-section-training .calendar-nav-btn:hover,
#assisted-user-training-calendar .calendar-nav-btn:hover,
#v-pills-profile-section-training .calendar-view-option:hover,
#assisted-user-training-calendar .calendar-view-option:hover {
    background: rgba(var(--mangofit-color-rgb), 0.08);
    color: var(--mangofit-color);
}

.week-view-toggle-option:hover:not(:disabled) {
    background: rgba(var(--mangofit-color-rgb), 0.08);
    color: var(--mangofit-color);
}

#v-pills-profile-section-training .calendar-today-btn,
#assisted-user-training-calendar .calendar-today-btn {
    color: var(--mangofit-color);
}

#v-pills-profile-section-training .calendar-view-option.active,
#assisted-user-training-calendar .calendar-view-option.active {
    background: var(--mangofit-color);
    color: #fff;
    box-shadow: 0 5px 12px rgba(var(--mangofit-color-rgb), 0.24);
}

.week-view-toggle-option.active {
    background: var(--mangofit-color);
    color: #fff;
    box-shadow: 0 5px 12px rgba(var(--mangofit-color-rgb), 0.24);
}

.week-view-toggle-option:disabled,
.week-view-toggle-option.disabled {
    opacity: 0.45;
    pointer-events: none;
    box-shadow: none;
}

/* The days shown, with the same type as the range of «Attività» */
#v-pills-profile-section-training .calendar-week-range,
#assisted-user-training-calendar .calendar-week-range {
    flex: 1 1 auto;
    margin: 0;
    font-size: clamp(1rem, 1.25vw, 1.2rem);
    font-weight: 700;
    line-height: 1.1;
    letter-spacing: 0;
    text-align: center;
    white-space: nowrap;
}

#v-pills-profile-section-training .calendar-date-jump,
#assisted-user-training-calendar .calendar-date-jump {
    flex: 0 0 auto;
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: min(100%, 210px);
    height: 36px;
    padding: 0 0.7rem;
    border-radius: 8px;
    color: rgba(var(--contrast-theme-color-rgb), 0.58);
}

#v-pills-profile-section-training .calendar-date-input,
#assisted-user-training-calendar .calendar-date-input {
    width: 100%;
    min-width: 0;
    border: 0;
    outline: 0;
    background: transparent;
    color: rgba(var(--contrast-theme-color-rgb), 0.82);
    font-size: 0.84rem;
    font-weight: 650;
}

#v-pills-profile-section-training .calendar-date-input:focus,
#assisted-user-training-calendar .calendar-date-input:focus {
    outline: none;
}

#v-pills-profile-section-training .calendar-date-jump:focus-within,
#assisted-user-training-calendar .calendar-date-jump:focus-within {
    border-color: rgba(var(--mangofit-color-rgb), 0.38);
    box-shadow: 0 0 0 3px rgba(var(--mangofit-color-rgb), 0.1);
}

#v-pills-profile-section-training #trainingWeekdayHeaders,
#assisted-user-training-calendar #trainingWeekdayHeaders {
    border: 1px solid rgba(var(--contrast-theme-color-rgb), 0.08) !important;
    border-radius: 8px;
    background: rgba(var(--current-theme-color-rgb), 0.96);
    box-shadow: 0 8px 20px rgba(var(--contrast-theme-color-rgb), 0.06) !important;
}

/* Paste week container */
#v-pills-profile-section-training .paste-week-container {
    position: absolute;
    top: 50%;
    left: 0;
    width: 100%;
    display: flex;
    justify-content: center;
    transform: translateY(-50%);
    pointer-events: none;
    gap: 0.625rem;
}

#v-pills-profile-section-training .btn-paste-training-assisted-user-week,
#v-pills-profile-section-training .cancel-training-user-week-copy-mode {
    pointer-events: auto;
    font-weight: 600;
}

.remove-training-calendar-menu-toggle-icon::after {
    display: none !important;
}

/* ---------------------------
    SHARED DAY CELLS (.mf-calendar)
    One component for the client's «Allenamento» on the coach profile, the program calendar, «Attività» and the
    client's own calendar (MangofitCalendarCells in calendar_shared.js): rounded cell with a light surface, the
    day number on the left (today in a filled circle), a discreet + on the right and the cards scrolling inside
    the cell. From md up the weeks share the height left on the screen: with two or four weeks the rows get
    shorter and every cell scrolls inside, so the page itself never scrolls. Below md the cells become a day
    agenda (rules at the end of the file).
    Nothing between a card and the viewport may create a containing block (transform, filter, contain,
    container-type): the card and day menus are position: fixed to leave the scrolling cell.
--------------------------- */
.mf-calendar {
    --mf-calendar-gap: 0.5rem;
    --mf-calendar-aside: 0px;
    --mf-calendar-aside-gap: 0px;
    --mf-calendar-line: rgba(var(--contrast-theme-color-rgb), 0.12);
    --mf-calendar-line-strong: rgba(var(--contrast-theme-color-rgb), 0.2);
    --mf-calendar-surface: rgba(var(--contrast-theme-color-rgb), 0.025);
    --mf-calendar-muted: var(--bs-secondary-color);
    --mf-calendar-brand-soft: rgba(var(--mangofit-color-rgb), 0.1);
    --mf-calendar-radius: 0.75rem;
    /* Top padding of a day head */
    --mf-calendar-head-top: 0.4rem;
    /* The ⋯ of a card (workouts and «Attività») and the ⋮ of an exercise: small and light with a mouse, a larger
       target on touch screens and in the phone agenda (below) */
    --mf-calendar-menu-size: 1.25rem;

    display: flex;
    flex-direction: column;
    gap: var(--mf-calendar-gap);
    min-width: 0;
    min-height: 0;
    overflow-x: hidden;
    /* Only on a screen too short even for the smallest rows: the calendar scrolls, never the page */
    overflow-y: auto;
}

/* Calendars with a week column on the left («Copia settimana»; in the programs also «Elimina settimana» and the
   name of the week) */
.mf-calendar--with-aside {
    --mf-calendar-aside: 1.75rem;
    --mf-calendar-aside-gap: 0.25rem;
}

.mf-calendar-weekdays {
    flex: 0 0 auto;
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: var(--mf-calendar-gap);
    margin-inline-start: calc(var(--mf-calendar-aside) + var(--mf-calendar-aside-gap));
    color: var(--mf-calendar-muted);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    line-height: 1.2;
    text-transform: uppercase;
}

.mf-calendar-weekdays > * {
    min-width: 0;
    padding-inline: 0.6rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mf-calendar-weekdays > .is-today {
    color: var(--mangofit-color);
}

.mf-calendar-week {
    position: relative;
    flex: 1 1 0;
    display: flex;
    gap: var(--mf-calendar-aside-gap);
    min-width: 0;
    min-height: 6rem;
}

/* Its commands sit in the middle of the row of days, as before the shared cells (until 27 November they were at the
   top, on the line of the day numbers). In the programs the name of the week follows them: when the row is too short
   for both, the buttons move up just enough for the name to stay whole (the third row never gets less than the name) */
.mf-calendar-week-aside {
    flex: 0 0 var(--mf-calendar-aside);
    display: grid;
    grid-template-rows: minmax(0, 1fr) auto minmax(min-content, 1fr);
    justify-items: center;
    gap: 0.6rem;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
}

/* The commands of the week, always in view: the same buttons and place in «Allenamento» and in the programs */
.mf-calendar-week-actions {
    grid-row: 2;
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.3rem;
}

/* The name of the week reads upwards; in a short row it is cut rather than pushing the next week */
.mf-calendar-week-label {
    grid-row: 3;
    align-self: start;
    flex: 0 1 auto;
    min-height: 0;
    overflow: hidden;
    color: var(--mf-calendar-muted);
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-overflow: ellipsis;
    text-transform: uppercase;
    white-space: nowrap;
    writing-mode: vertical-rl;
    transform: rotate(180deg);
}

.btn.mf-calendar-week-action,
.btn.mf-calendar-cell-add {
    --bs-btn-padding-x: 0;
    --bs-btn-padding-y: 0;
    --bs-btn-color: var(--mf-calendar-muted);
    --bs-btn-bg: transparent;
    --bs-btn-border-color: transparent;
    --bs-btn-hover-color: var(--mangofit-color);
    --bs-btn-hover-bg: var(--mf-calendar-brand-soft);
    --bs-btn-hover-border-color: transparent;
    --bs-btn-active-color: var(--mangofit-color);
    --bs-btn-active-bg: rgba(var(--mangofit-color-rgb), 0.16);
    --bs-btn-active-border-color: transparent;
    --bs-btn-focus-box-shadow: 0 0 0 0.2rem rgba(var(--mangofit-color-rgb), 0.3);

    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.75rem;
    height: 1.75rem;
    min-height: 0;
    border-radius: 999px;
    font-size: 0.95rem;
    line-height: 1;
}

/* «Elimina settimana»: neutral like the others, red only under the pointer */
.btn.mf-calendar-week-action--danger {
    --bs-btn-hover-color: var(--bs-danger);
    --bs-btn-hover-bg: rgba(var(--bs-danger-rgb), 0.1);
    --bs-btn-active-color: var(--bs-danger);
    --bs-btn-active-bg: rgba(var(--bs-danger-rgb), 0.16);
    --bs-btn-focus-box-shadow: 0 0 0 0.2rem rgba(var(--bs-danger-rgb), 0.3);
}

/* The week being copied */
.btn.mf-calendar-week-action.is-active,
.btn.mf-calendar-week-action.show,
.btn.mf-calendar-cell-add.show {
    color: var(--mangofit-color);
    background-color: var(--mf-calendar-brand-soft);
}

.btn.mf-calendar-week-action:focus-visible,
.btn.mf-calendar-cell-add:focus-visible {
    outline: 2px solid rgba(var(--mangofit-color-rgb), 0.6);
    outline-offset: 1px;
}

.mf-calendar-days {
    flex: 1 1 auto;
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    grid-auto-rows: minmax(0, 1fr);
    gap: var(--mf-calendar-gap);
    min-width: 0;
    min-height: 0;
}

/* The client's calendars keep a box around the cell: the copy overlay and «Oggi» scrolling use it */
.mf-calendar-slot {
    position: relative;
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
}

.mf-calendar-cell {
    position: relative;
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
    border: 1px solid var(--mf-calendar-line);
    border-radius: var(--mf-calendar-radius);
    background: var(--mf-calendar-surface);
    text-align: start;
    transition: border-color 0.15s ease, background-color 0.15s ease;
}

.mf-calendar-cell:hover {
    border-color: var(--mf-calendar-line-strong);
}

.mf-calendar-cell.is-today {
    border-color: rgba(var(--mangofit-color-rgb), 0.45);
    background: rgba(var(--mangofit-color-rgb), 0.035);
}

.mf-calendar-cell-head {
    flex: 0 0 auto;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.15rem 0.25rem;
    min-width: 0;
    padding: var(--mf-calendar-head-top) 0.4rem 0.3rem 0.5rem;
}

/* In a very narrow column (a tablet beside the list of clients) the + goes under the number, on the right */
.mf-calendar-cell-head > :last-child:not(.mf-calendar-cell-title) {
    margin-inline-start: auto;
}

.mf-calendar-cell-title {
    display: inline-flex;
    align-items: center;
    gap: 0.15rem;
    min-width: 0;
}

.mf-calendar-cell-kicker {
    min-width: 0;
    overflow: hidden;
    color: var(--mf-calendar-muted);
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-overflow: ellipsis;
    text-transform: uppercase;
    white-space: nowrap;
}

.mf-calendar-cell-number {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.75rem;
    height: 1.75rem;
    padding-inline: 0.3rem;
    border-radius: 999px;
    color: var(--bs-body-color);
    font-size: 0.88rem;
    font-weight: 700;
    line-height: 1;
}

.mf-calendar-cell.is-today .mf-calendar-cell-number {
    color: var(--bs-white);
    background: var(--mangofit-color);
}

/* «Giorno 8» of the programs: the number follows its word and reads with it as one label */
.mf-calendar-cell-kicker + .mf-calendar-cell-number {
    min-width: 0;
    padding-inline: 0.25rem;
    font-size: 0.76rem;
    letter-spacing: 0.02em;
}

/* The full day name and «Oggi» belong to the phone agenda */
.mf-calendar-cell-label,
.mf-calendar-cell-today {
    display: none;
}

.mf-calendar-cell-today {
    padding: 0.1rem 0.45rem;
    border-radius: 999px;
    color: var(--mangofit-color);
    background: var(--mf-calendar-brand-soft);
    font-size: 0.68rem;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.mf-calendar-cell:hover .btn.mf-calendar-cell-add {
    color: var(--mangofit-color);
}

/* The cards keep the same room on the left and on the right of their day. The room of the scrollbar is always kept
   on the right (scrollbar-gutter), whether or not the day scrolls, and the same room is added on the left:
   --mf-calendar-scrollbar is its width, measured by MangofitCalendarCells (0 where scrollbars float over the page).
   Until 27 November a scrolling day of «Attività» had 7 px on the left and 17 px on the right of its cards. */
.mf-calendar-cell-body {
    --mf-calendar-body-inset: 0.35rem;
    --mf-calendar-body-side: max(var(--mf-calendar-body-inset), var(--mf-calendar-scrollbar, 0px));

    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    min-height: 0;
    padding: 0 calc(var(--mf-calendar-body-side) - var(--mf-calendar-scrollbar, 0px)) 0.4rem var(--mf-calendar-body-side);
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
}

/* A thin, neutral scrollbar (the 3 px one of the app is orange: in four weeks there would be dozens of them) */
.mf-calendar-cell-body::-webkit-scrollbar {
    width: 4px;
}

.mf-calendar-cell-body::-webkit-scrollbar-thumb {
    border-radius: 999px;
    background: rgba(var(--contrast-theme-color-rgb), 0.22);
}

.mf-calendar-cell-body::-webkit-scrollbar-thumb:hover {
    background: rgba(var(--contrast-theme-color-rgb), 0.36);
}

.mf-calendar-cell-body::-webkit-scrollbar-track {
    background: transparent;
}

@supports not selector(::-webkit-scrollbar) {
    .mf-calendar-cell-body {
        scrollbar-color: rgba(var(--contrast-theme-color-rgb), 0.22) transparent;
        scrollbar-width: thin;
    }
}

/* The hidden cell body that measures the scrollbar (measureScrollbar in calendar_shared.js) */
.mf-calendar-cell-body.mf-calendar-scrollbar-probe {
    position: absolute;
    inset-block-start: -10rem;
    inset-inline-start: 0;
    width: 100px;
    height: 50px;
    overflow-y: scroll;
    visibility: hidden;
    pointer-events: none;
}

.mf-calendar-cell-body > * {
    flex: 0 0 auto;
}

.mf-calendar-cell-body > .card.calendar-workout-cell-container {
    margin-bottom: 0;
}

/* Tablets: a little less room between the days and around the cards, more for the cards */
@media (min-width: 768px) and (max-width: 991.98px) {
    .mf-calendar {
        --mf-calendar-gap: 0.35rem;
        --mf-calendar-head-top: 0.3rem;
    }

    .mf-calendar-weekdays > * {
        padding-inline: 0.3rem;
    }

    .mf-calendar-cell-head {
        padding: var(--mf-calendar-head-top) 0.25rem 0.25rem 0.3rem;
    }

    .mf-calendar-cell-body {
        --mf-calendar-body-inset: 0.25rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .mf-calendar-cell {
        transition: none;
    }
}

/* Below md every calendar becomes an agenda by day: the full name of the day («Lunedì 23 novembre», with «Oggi»)
   and the + beside it, then the cards; the program weeks keep their name and commands above their days. The same
   agenda serves a calendar too narrow for seven days on a larger screen (a tablet in portrait beside the list of
   clients): MangofitCalendarCells.watchDensity() gives it .mf-calendar--agenda. Keep the two blocks identical. */
@media (max-width: 767.98px) {
    .mf-calendar {
        --mf-calendar-menu-size: 2rem;

        gap: 0;
    }

    .mf-calendar-weekdays {
        display: none;
    }

    .mf-calendar-week {
        display: block;
        flex: none;
        min-height: 0;
    }

    /* The program week: its name on the left, «Copia settimana» and «Elimina settimana» on the right */
    .mf-calendar-week-aside {
        display: flex;
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 0.5rem;
        padding-top: 0;
        overflow: visible;
    }

    .mf-calendar-week-actions {
        order: 1;
        flex-direction: row;
    }

    .mf-calendar-week-label {
        writing-mode: horizontal-tb;
        transform: none;
    }

    .mf-calendar-days {
        display: block;
    }

    .mf-calendar-cell {
        margin-bottom: 0.9rem;
        border: 0;
        border-radius: 0;
        background: transparent;
    }

    .mf-calendar-cell.is-today {
        background: transparent;
    }

    /* A little room on the right keeps the round + and its focus ring inside the scrolling agenda */
    .mf-calendar-cell-head {
        padding: 0.1rem 0.2rem 0.45rem 0;
    }

    .mf-calendar-cell--dated .mf-calendar-cell-number {
        display: none;
    }

    .mf-calendar-cell-label {
        display: inline-flex;
        align-items: center;
        gap: 0.45rem;
        min-width: 0;
        color: var(--bs-body-color);
        font-size: 0.9rem;
        font-weight: 700;
    }

    .mf-calendar-cell.is-today .mf-calendar-cell-today {
        display: inline;
    }

    .btn.mf-calendar-week-action,
    .btn.mf-calendar-cell-add {
        width: 2.5rem;
        height: 2.5rem;
        font-size: 1.05rem;
    }

    .btn.mf-calendar-cell-add {
        --bs-btn-color: var(--mangofit-color);
        --bs-btn-bg: var(--mf-calendar-brand-soft);
    }

    .mf-calendar-cell-body {
        padding: 0;
        overflow: visible;
    }

    /* In the agenda the cards have the whole width: always the exercises, never the short summary */
    .mf-calendar-card-summary {
        display: none;
    }

    .mf-calendar .calendar-workout-items-list {
        display: block;
    }

    /* While a workout is copied, an empty day still has room for «Incolla qui» */
    .mf-calendar-slot:has(> .mf-calendar-paste) {
        min-height: 5.5rem;
    }

    /* «Incolla settimana» at the top of each week, in view while the week scrolls */
    .mf-calendar-week:has(> .paste-week-container, > .paste-program-week-container) {
        display: flex;
        flex-direction: column;
    }

    .mf-calendar .paste-week-container,
    .mf-calendar .paste-program-week-container {
        position: sticky;
        top: 0;
        z-index: 4;
        order: -1;
        margin-bottom: 0.5rem;
        transform: none;
    }
}

.mf-calendar.mf-calendar--agenda {
    --mf-calendar-menu-size: 2rem;

    gap: 0;
}

.mf-calendar--agenda .mf-calendar-weekdays {
    display: none;
}

.mf-calendar--agenda .mf-calendar-week {
    display: block;
    flex: none;
    min-height: 0;
}

/* The program week: its name on the left, «Copia settimana» and «Elimina settimana» on the right */
.mf-calendar--agenda .mf-calendar-week-aside {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
    padding-top: 0;
    overflow: visible;
}

.mf-calendar--agenda .mf-calendar-week-actions {
    order: 1;
    flex-direction: row;
}

.mf-calendar--agenda .mf-calendar-week-label {
    writing-mode: horizontal-tb;
    transform: none;
}

.mf-calendar--agenda .mf-calendar-days {
    display: block;
}

.mf-calendar--agenda .mf-calendar-cell {
    margin-bottom: 0.9rem;
    border: 0;
    border-radius: 0;
    background: transparent;
}

.mf-calendar--agenda .mf-calendar-cell.is-today {
    background: transparent;
}

/* A little room on the right keeps the round + and its focus ring inside the scrolling agenda */
.mf-calendar--agenda .mf-calendar-cell-head {
    padding: 0.1rem 0.2rem 0.45rem 0;
}

.mf-calendar--agenda .mf-calendar-cell--dated .mf-calendar-cell-number {
    display: none;
}

.mf-calendar--agenda .mf-calendar-cell-label {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    min-width: 0;
    color: var(--bs-body-color);
    font-size: 0.9rem;
    font-weight: 700;
}

.mf-calendar--agenda .mf-calendar-cell.is-today .mf-calendar-cell-today {
    display: inline;
}

.mf-calendar--agenda .btn.mf-calendar-week-action,
.mf-calendar--agenda .btn.mf-calendar-cell-add {
    width: 2.5rem;
    height: 2.5rem;
    font-size: 1.05rem;
}

.mf-calendar--agenda .btn.mf-calendar-cell-add {
    --bs-btn-color: var(--mangofit-color);
    --bs-btn-bg: var(--mf-calendar-brand-soft);
}

.mf-calendar--agenda .mf-calendar-cell-body {
    padding: 0;
    overflow: visible;
}

/* In the agenda the cards have the whole width: always the exercises, never the short summary */
.mf-calendar--agenda .mf-calendar-card-summary {
    display: none;
}

.mf-calendar--agenda .calendar-workout-items-list {
    display: block;
}

/* While a workout is copied, an empty day still has room for «Incolla qui» */
.mf-calendar--agenda .mf-calendar-slot:has(> .mf-calendar-paste) {
    min-height: 5.5rem;
}

/* «Incolla settimana» at the top of each week, in view while the week scrolls */
.mf-calendar--agenda .mf-calendar-week:has(> .paste-week-container, > .paste-program-week-container) {
    display: flex;
    flex-direction: column;
}

.mf-calendar--agenda .paste-week-container,
.mf-calendar--agenda .paste-program-week-container {
    position: sticky;
    top: 0;
    z-index: 4;
    order: -1;
    margin-bottom: 0.5rem;
    transform: none;
}

/* «Copia settimana» belongs to the grid, as on phones */
.mf-calendar--agenda .training-calendar-copy-layout {
    display: none !important;
}

/* ---------------------------
    WORKOUT CARDS IN THE DAY CELLS («Allenamento», programs, the client's calendar)
    MangofitCalendarCells.workoutCardHtml(): the name on up to two lines, the ⋯ menu of the coach (or the eye of the
    client) on its right, then the exercises as light rows: sets, name and, for the coach, a ⋮ that appears over the
    end of the row on hover (always in view on touch screens). A superset is one row group; a section is a title line
    with a thin line on its left. In narrow days (.mf-calendar--compact) the card keeps the name and «N esercizi».
    No transform, filter or contain here: the menus are position: fixed.
--------------------------- */
/* .card in the selectors: Bootstrap's card rules come later in the page */
.card.calendar-workout-cell-container {
    margin-bottom: 1rem;
    border: 1px solid var(--bs-border-color);
    border-radius: 0.6rem;
    background: var(--bs-body-bg);
    box-shadow: 0 1px 2px rgba(var(--contrast-theme-color-rgb), 0.06);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.card.calendar-workout-cell-container:hover {
    border-color: rgba(var(--mangofit-color-rgb), 0.35);
}

/* Words wrap only between words (Bootstrap's .card breaks them anywhere); what does not fit ends with an ellipsis */
.card.mf-calendar-card {
    overflow-wrap: normal;
    word-wrap: normal;
}

/* The padding of the card and of the exercise rows: the ⋯ of the card lines up with the ⋮ of the rows */
.card.mf-calendar-card {
    --mf-calendar-card-pad-top: 0.45rem;
    --mf-calendar-card-pad-end: 0.4rem;
    --mf-calendar-row-inline: 0.35rem;
}

.card-body.mf-calendar-card-body {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    min-width: 0;
    padding: var(--mf-calendar-card-pad-top) var(--mf-calendar-card-pad-end) 0.45rem 0.5rem;
}

.mf-calendar-card-head {
    display: flex;
    align-items: flex-start;
    gap: 0.2rem;
    min-width: 0;
}

.mf-calendar-card-name {
    flex: 1 1 auto;
    min-width: 0;
}

/* The workout name: one line ending with «…» (the whole name is in its title and read by screen readers), so that
   every card starts its exercises at the same height. Until 27 November a long name took two lines */
.mf-calendar-card-name .card-title {
    display: block;
    overflow: hidden;
    color: var(--bs-body-color);
    font-size: 0.78rem;
    font-weight: 650;
    line-height: 1.25;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.calendar-workout-cell-container:hover .edit-program-workout-card-label,
.calendar-workout-cell-container:hover .edit-assigned-workout-card-label,
.calendar-workout-cell-container:hover .assigned-workout-card-name {
    color: var(--mangofit-color);
    cursor: pointer;
}

/* The status of a started or completed workout: its icon, then «Completato · 8 esercizi» */
.mf-calendar-card-status {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    min-width: 0;
    margin-top: 0.2rem;
}

.mf-calendar-card-status > i {
    flex: 0 0 auto;
    font-size: 0.75rem;
}

/* The status goes on two lines rather than being cut («Completato · 8 e…»); .text-truncate comes from the markup */
.mf-calendar-card-status > p.text-truncate {
    min-width: 0;
    white-space: normal;
    line-height: 1.2;
}

/* The ⋯ of the coach and the eye of the client: a small, light square (no border, no shadow) with the size and the
   style of the ⋯ of the cards of «Attività» (--mf-calendar-menu-size). Until 27 November it was larger, white with a
   shadow, and almost touched the ⋮ of the first exercise */
/* Beside the name (touch screens) its right edge lines up with the ⋮ of the exercise rows */
.mf-calendar-card-menu {
    flex: 0 0 auto;
    display: flex;
    margin-inline-end: var(--mf-calendar-row-inline, 0.35rem);
}

.mf-calendar-card-menu > .btn {
    --bs-btn-padding-x: 0;
    --bs-btn-padding-y: 0;
    --bs-btn-color: var(--mf-calendar-muted, var(--bs-secondary-color));
    --bs-btn-bg: transparent;
    --bs-btn-border-color: transparent;
    --bs-btn-hover-color: var(--bs-body-color);
    --bs-btn-hover-bg: rgba(var(--contrast-theme-color-rgb), 0.08);
    --bs-btn-hover-border-color: transparent;
    --bs-btn-active-color: var(--bs-body-color);
    --bs-btn-active-bg: rgba(var(--contrast-theme-color-rgb), 0.12);
    --bs-btn-active-border-color: transparent;

    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: var(--mf-calendar-menu-size, 1.25rem);
    height: var(--mf-calendar-menu-size, 1.25rem);
    /* On touch screens, beside the name: centred on its line (0.4875rem is half of it), within the card's padding */
    margin-top: max(-0.35rem, calc(0.4875rem - var(--mf-calendar-menu-size, 1.25rem) / 2));
    border-radius: 0.35rem;
    font-size: 0.72rem;
    line-height: 1;
}

.mf-calendar-card-menu > .btn.show {
    color: var(--bs-body-color);
    background-color: rgba(var(--contrast-theme-color-rgb), 0.12);
}

.mf-calendar-card-menu > .btn:focus-visible {
    outline: 2px solid rgba(var(--mangofit-color-rgb), 0.6);
    outline-offset: 1px;
}

/* The card whose menu (⋯ or ⋮ of an exercise) is open stays above the next cards: their ⋯ (z-index 2, later in the
   page) would otherwise cover the open menu and take its clicks */
.card.calendar-workout-cell-container:has(.dropdown-menu.show) {
    z-index: 6;
}

/* With a mouse, as on the cards of «Attività», the ⋯ (or the eye) appears at the top right of the card on hover or
   focus and the name keeps the whole width; on touch screens it stays in view beside the name. It sits on the line of
   the name and in the column of the ⋮ of the exercises, with a soft fade over the end of the name instead of a hard
   cut: between the two there are at least 8 px, also when both are in view */
@media (hover: hover) {
    .mf-calendar-card-head > .mf-calendar-card-menu {
        position: absolute;
        z-index: 2;
        inset-block-start: 0;
        inset-inline-end: 0;
        padding-block-start: calc(var(--mf-calendar-card-pad-top) + 0.4875rem - var(--mf-calendar-menu-size, 1.25rem) / 2);
        padding-inline: 0.6rem calc(var(--mf-calendar-card-pad-end) + var(--mf-calendar-row-inline) - 0.2rem);
        margin-inline-end: 0;
        border-start-end-radius: calc(0.6rem - 1px);
        background: linear-gradient(90deg, transparent, var(--bs-body-bg) 0.6rem);
        opacity: 0;
        transition: opacity 0.12s ease;
    }

    .calendar-workout-cell-container:hover .mf-calendar-card-head > .mf-calendar-card-menu,
    .mf-calendar-card-head > .mf-calendar-card-menu:focus-within,
    .mf-calendar-card-head > .mf-calendar-card-menu:has(> .show) {
        opacity: 1;
    }

    .mf-calendar-card-head > .mf-calendar-card-menu > .btn {
        margin-top: 0;
    }

    /* Narrow days: the button appears at the bottom right, over the end of «N esercizi», never over the name. The row
       of «N esercizi» (or of the status of a started or completed workout) is as tall as the button, so that the
       button and its fade stay on that row also under a name on two lines */
    .mf-calendar--compact .mf-calendar-card-head > .mf-calendar-card-menu {
        inset-block: auto 0.3rem;
        inset-inline-end: 0.3rem;
        padding-block-start: 0;
        padding-inline-end: 0;
        border-radius: 0;
    }

    .mf-calendar--compact .card-body.mf-calendar-card-body:has(> .mf-calendar-card-summary) {
        grid-template-rows: auto minmax(var(--mf-calendar-menu-size, 1.25rem), auto);
    }

    .mf-calendar--compact .mf-calendar-card-status {
        min-height: var(--mf-calendar-menu-size, 1.25rem);
    }
}

/* On touch screens the ⋯ is always in view: a larger target, still light. In the phone agenda larger again */
@media (hover: none) {
    .mf-calendar {
        --mf-calendar-menu-size: 1.75rem;
    }
}

/* «N esercizi»: only when the days are too narrow for the exercises */
.mf-calendar-card-summary {
    display: none;
    margin: 0;
    color: var(--mf-calendar-muted, var(--bs-secondary-color));
    font-size: 0.7rem;
    line-height: 1.2;
}

/* Narrow days: the name takes the whole width of the card, «N esercizi» below it (on two lines if needed). On touch
   screens the ⋯ (or the eye) shares that line */
.mf-calendar--compact .card-body.mf-calendar-card-body {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: "name name" "summary action";
    align-items: center;
    gap: 0.2rem;
    padding: 0.35rem 0.3rem 0.3rem 0.4rem;
}

.mf-calendar--compact .mf-calendar-card-head {
    display: contents;
}

.mf-calendar--compact .mf-calendar-card-name {
    grid-area: name;
}

.mf-calendar--compact .mf-calendar-card-head > :not(.mf-calendar-card-name) {
    grid-area: action;
    justify-self: end;
}

.mf-calendar--compact .mf-calendar-card-summary {
    display: block;
    grid-area: summary;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* A started or completed workout keeps its status icon (named by its title) and «N esercizi», like the other compact
   cards: «Completato · 8 esercizi» would break in pieces */
.mf-calendar-card-status-count {
    display: none;
}

.mf-calendar--compact .mf-calendar-card-status > p {
    display: none;
}

/* The icon first; «8 esercizi» beside it, or on the line below when the card is narrow */
.mf-calendar--compact .mf-calendar-card-status {
    flex-wrap: wrap;
    row-gap: 0.1rem;
}

.mf-calendar--compact .mf-calendar-card-status-count {
    display: block;
    flex: 1 1 3.4rem;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--mf-calendar-muted, var(--bs-secondary-color));
    font-size: 0.7rem;
    line-height: 1.2;
}

/* Short rows (four weeks): the name of the week gets smaller so that «SETTIMANA 12» still fits beside its buttons */
.mf-calendar--compact .mf-calendar-week-aside {
    gap: 0.4rem;
}

.mf-calendar--compact .mf-calendar-week-label {
    font-size: 0.6rem;
    letter-spacing: 0.02em;
}

.mf-calendar--compact .calendar-workout-items-list {
    display: none;
}

/* The only exception to the one-line name: a compact card has nothing but its name and «N esercizi» in a column of
   about 65 px, where one line made «Full Body A», «B» and «C» all read «Full Bod…». There the name may take two lines,
   between words, and ends with «…» on the second */
.mf-calendar--compact .mf-calendar-card-name .card-title {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    font-size: 0.72rem;
    overflow-wrap: normal;
    word-break: normal;
    white-space: normal;
}

.mf-calendar--compact .mf-calendar-card-menu {
    margin-inline-end: 0;
}

.mf-calendar--compact .mf-calendar-card-menu > .btn {
    margin-top: 0;
}

.mf-calendar--compact .mf-calendar-cell-body {
    --mf-calendar-body-inset: 0.25rem;
}

/* The exercises */
.calendar-workout-items-list .flex-vertical-list {
    gap: 0.25rem;
}

.mf-calendar-exercise {
    min-width: 0;
    border-radius: 0.4rem;
    background: rgba(var(--contrast-theme-color-rgb), 0.04);
    transition: background-color 0.15s ease;
}

.calendar-workout-items-list:not(.calendar-workout-items-list-no-hoverable) .mf-calendar-exercise:hover {
    background: rgba(var(--mangofit-color-rgb), 0.08);
}

.mf-calendar-exercise-rows {
    min-width: 0;
    padding: 0.15rem var(--mf-calendar-row-inline, 0.35rem);
}

.mf-calendar-exercise-row {
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: 0.3rem;
    min-width: 0;
    min-height: 1.4rem;
    font-size: 0.74rem;
    line-height: 1.2;
}

/* The exercises of a superset share their group, one line each */
.mf-calendar-exercise-row + .mf-calendar-exercise-row {
    border-top: 1px solid rgba(var(--contrast-theme-color-rgb), 0.08);
}

.mf-calendar-exercise-sets {
    flex: 0 0 auto;
    padding-block: 0.1rem;
    color: var(--mf-calendar-muted, var(--bs-secondary-color));
    font-variant-numeric: tabular-nums;
}

/* Up to two lines: «Pressa su panca con bilanciere» and «… con manubri» must stay distinguishable */
.mf-calendar-exercise-name {
    flex: 1 1 auto;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    min-width: 0;
    overflow: hidden;
    color: var(--bs-body-color);
    overflow-wrap: normal;
    word-break: normal;
    text-overflow: ellipsis;
    padding-block: 0.1rem;
}

/* Narrow days (100-150 px, for example 1,024 px or Allenamento beside the list of clients at 1,280 px:
   .mf-calendar--narrow of watchDensity): up to four lines and a little less padding, so the end of the name that tells
   two variants apart stays in view */
.mf-calendar--narrow .mf-calendar-exercise-name {
    -webkit-line-clamp: 4;
}

.mf-calendar--narrow .mf-calendar-card {
    --mf-calendar-row-inline: 0.25rem;
}

.mf-calendar--narrow .mf-calendar-exercise-row {
    gap: 0.25rem;
}

.mf-calendar-exercise-flag {
    flex: 0 0 auto;
    padding-block: 0.15rem;
    color: var(--mf-calendar-muted, var(--bs-secondary-color));
    font-size: 0.7rem;
}

.mf-calendar-exercise-menu {
    flex: 0 0 auto;
}

.mf-calendar-exercise-menu > .btn {
    --bs-btn-padding-x: 0;
    --bs-btn-padding-y: 0;
    --bs-btn-color: var(--mf-calendar-muted, var(--bs-secondary-color));
    --bs-btn-bg: var(--bs-body-bg);
    --bs-btn-border-color: transparent;
    --bs-btn-hover-color: var(--bs-body-color);
    --bs-btn-hover-bg: var(--bs-body-bg);
    --bs-btn-hover-border-color: var(--bs-border-color);
    --bs-btn-active-color: var(--bs-body-color);
    --bs-btn-active-bg: var(--bs-body-bg);
    --bs-btn-active-border-color: var(--bs-border-color);

    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.25rem;
    height: 1.25rem;
    border-radius: 0.35rem;
    font-size: 0.7rem;
    line-height: 1;
}

.mf-calendar-exercise-menu > .btn:focus-visible {
    outline: 2px solid rgba(var(--mangofit-color-rgb), 0.6);
    outline-offset: 0;
}

/* With a mouse the ⋮ leaves the whole row to the name and appears over its end on hover or focus (.dropdown in the
   selector: Bootstrap's position: relative comes later in the page) */
@media (hover: hover) {
    .dropdown.mf-calendar-exercise-menu {
        position: absolute;
        inset-block: 0;
        inset-inline-end: -0.2rem;
        display: flex;
        align-items: center;
        opacity: 0;
        transition: opacity 0.12s ease;
    }

    .mf-calendar-exercise-row:hover .mf-calendar-exercise-menu,
    .mf-calendar-exercise-menu:focus-within,
    .mf-calendar-exercise-menu:has(> .show) {
        opacity: 1;
    }

    .mf-calendar-exercise-menu > .btn {
        box-shadow: 0 1px 3px rgba(var(--contrast-theme-color-rgb), 0.18);
    }

    /* The ⋮ covers the end of the row only on hover, with a soft fade instead of a hard cut */
    .dropdown.mf-calendar-exercise-menu {
        padding-inline-start: 0.6rem;
        background: linear-gradient(90deg, transparent, var(--bs-body-bg) 0.6rem);
        border-radius: 0 0.4rem 0.4rem 0;
    }
}

/* A section: the coloured icon of its kind, its name and the label of its kind; a thin line in the same tone ties its
   exercises together (MangofitCalendarCells.sectionHtml). The tone says the role at a glance: warm-up amber,
   cool-down blue, recovery violet, a main part with a special format (interval, AMRAP, for time, EMOM, freestyle) in
   the brand colour, a regular one neutral. Text and icon mix the tone with the text colour, readable in both themes */
.mf-calendar-section {
    --mf-calendar-section-rgb: var(--contrast-theme-color-rgb);
    --mf-calendar-section-ink: color-mix(in srgb, rgb(var(--mf-calendar-section-rgb)) 65%, var(--bs-body-color));

    min-width: 0;
    padding: 0.05rem 0 0.1rem 0.4rem;
    border-inline-start: 2px solid rgba(var(--mf-calendar-section-rgb), 0.6);
}

.mf-calendar-section--regular {
    --mf-calendar-section-ink: var(--mf-calendar-muted, var(--bs-secondary-color));

    border-inline-start-color: rgba(var(--contrast-theme-color-rgb), 0.18);
}

.mf-calendar-section--format {
    --mf-calendar-section-rgb: var(--mangofit-color-rgb);
}

.mf-calendar-section--warmup {
    --mf-calendar-section-rgb: 214, 146, 12;
}

.mf-calendar-section--cooldown {
    --mf-calendar-section-rgb: 13, 148, 196;
}

.mf-calendar-section--recovery {
    --mf-calendar-section-rgb: 124, 77, 214;
}

.mf-calendar-section-head {
    display: flex;
    align-items: baseline;
    gap: 0.3rem;
    min-width: 0;
    margin-bottom: 0.2rem;
}

.mf-calendar-section-icon {
    flex: 0 0 auto;
    color: var(--mf-calendar-section-ink);
    font-size: 0.72rem;
    line-height: 1;
}

/* The name, then the label of the kind: the label stays whole and goes to the next line when both do not fit */
.mf-calendar-section-title {
    flex: 1 1 auto;
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0 0.35rem;
    min-width: 0;
}

.mf-calendar-section-name {
    flex: 0 1 auto;
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
    color: var(--bs-body-color);
    font-size: 0.72rem;
    font-weight: 700;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* In sentence case, which takes less room than capitals: «Riscaldamento» stays whole in a 1,440 px day beside the
   list of clients */
.mf-calendar-section-kind {
    flex: 0 0 auto;
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
    color: var(--mf-calendar-section-ink);
    font-size: 0.66rem;
    font-weight: 600;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mf-calendar-section-items {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    min-width: 0;
}

/* ---------------------------
    COPYING A WEEK OR A WORKOUT
    The bar above the days (MangofitCalendarCells.showCopyBar) says what to do and holds the only «Annulla copia»;
    every other week gets «Incolla settimana», every day «Incolla qui» over its cell.
--------------------------- */
/* Sticky with a solid surface: in the agenda the calendar scrolls and the bar stays in view */
.mf-calendar-copy-bar {
    position: sticky;
    top: 0;
    z-index: 5;
    flex: 0 0 auto;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem 0.75rem;
    min-width: 0;
    padding: 0.4rem 0.45rem 0.4rem 0.75rem;
    border: 1px solid rgba(var(--mangofit-color-rgb), 0.28);
    border-radius: var(--mf-calendar-radius, 0.75rem);
    background: linear-gradient(rgba(var(--mangofit-color-rgb), 0.07), rgba(var(--mangofit-color-rgb), 0.07)), var(--bs-body-bg);
    color: var(--bs-body-color);
    font-size: 0.84rem;
    font-weight: 600;
    line-height: 1.3;
}

/* The agenda has no gap between its rows */
.mf-calendar--agenda > .mf-calendar-copy-bar {
    margin-bottom: 0.75rem;
}

@media (max-width: 767.98px) {
    .mf-calendar > .mf-calendar-copy-bar {
        margin-bottom: 0.75rem;
    }
}

.mf-calendar-copy-bar-icon {
    flex: 0 0 auto;
    color: var(--mangofit-color);
    font-size: 1rem;
}

.mf-calendar-copy-bar-text {
    flex: 1 1 12rem;
    min-width: 0;
}

.mf-calendar-paste {
    position: absolute;
    inset: 0;
    z-index: 3;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.35rem;
}

/* A solid button over the attenuated cards (!important: the soft action buttons are translucent with !important) */
.mf-calendar-paste .mg-action-button,
.paste-week-container .mg-action-button,
.paste-program-week-container .mg-action-button {
    max-width: 100%;
    white-space: normal;
    background: linear-gradient(rgba(var(--mg-action-rgb), 0.12), rgba(var(--mg-action-rgb), 0.12)), var(--bs-body-bg) !important;
    box-shadow: 0 2px 10px rgba(var(--contrast-theme-color-rgb), 0.16);
}

.mf-calendar-paste .mg-action-button:hover,
.paste-week-container .mg-action-button:hover,
.paste-program-week-container .mg-action-button:hover {
    background: linear-gradient(rgba(var(--mg-action-rgb), 0.2), rgba(var(--mg-action-rgb), 0.2)), var(--bs-body-bg) !important;
}

#v-pills-profile-section-training .multi-set-dropdown-menu,
#v-pills-library-programs .multi-set-dropdown-menu,
.multi-set-dropdown-menu {
    max-height: 150px;
    overflow-y: auto;
}

/* While copying, the days stay readable (no blur: the coach reads dates and workouts to choose where to paste) but
   cannot be used, only their «Incolla» buttons */
#v-pills-library-programs .copy-mode-disabled,
#v-pills-profile-section-training .copy-mode-disabled,
#assisted-user-training-calendar .copy-mode-disabled {
    opacity: 0.6;
    pointer-events: none;
    user-select: none;
}

/* ---------------------------
   RESPONSIVE (Bootstrap xs/sm)
--------------------------- */
@media (max-width: 767.98px) {
    #v-pills-library-programs
        .border-top.border-bottom.program-calendar-borders {
        flex-direction: column !important;
        align-items: stretch !important;
        text-align: left;
    }

    #v-pills-library-programs
        .border-top.border-bottom.program-calendar-borders
        > h5 {
        width: 100%;
        margin-bottom: 0.5rem;
        padding-left: 0.5rem;
    }

    #v-pills-library-programs
        .border-top.border-bottom.program-calendar-borders
        > div {
        flex-wrap: wrap;
        justify-content: center !important;
        width: 100%;
    }

    #v-pills-library-programs .program-calendar-controls {
        flex-direction: column;
        align-items: center !important;
        gap: 0.5rem !important;
    }

    #v-pills-library-programs .program-calendar-actions {
        flex-wrap: wrap;
        justify-content: center;
    }

    #v-pills-profile-section-training .week-controls-wrapper,
    #assisted-user-training-calendar .week-controls-wrapper {
        flex-direction: column !important;
        align-items: center !important;
        text-align: center;
    }

    #v-pills-profile-section-training .week-controls-wrapper > div,
    #v-pills-profile-section-training .week-controls-wrapper > h4,
    #v-pills-profile-section-training .week-controls-wrapper > input,
    #assisted-user-training-calendar .week-controls-wrapper > div,
    #assisted-user-training-calendar .week-controls-wrapper > h4,
    #assisted-user-training-calendar .week-controls-wrapper > input {
        width: 100%;
        justify-content: center !important;
        text-align: center !important;
        margin-bottom: 0.5rem;
    }

    #v-pills-profile-section-training #trainingWeekdayHeaders,
    #assisted-user-training-calendar #trainingWeekdayHeaders {
        display: none !important;
    }

    #v-pills-library-programs .week-toggle-group,
    #v-pills-profile-section-training .week-toggle-group,
    #assisted-user-training-calendar .week-toggle-group {
        display: none;
    }

    #v-pills-profile-section-training #calendarWrapper,
    #assisted-user-training-calendar #assistedUserCalendarWrapper {
        flex: 1 1 auto !important;
        height: auto !important;
        min-height: 0;
        overflow-x: hidden !important;
        overflow-y: auto !important;
    }

    #v-pills-profile-section-training .training-calendar-copy-layout {
        display: none !important;
    }

    #v-pills-profile-section-training > .d-flex,
    #assisted-user-training-calendar > .d-flex {
        min-height: 0;
    }

    #v-pills-profile-section-training .calendar-toolbar,
    #assisted-user-training-calendar .calendar-toolbar {
        display: grid !important;
        grid-template-columns: auto minmax(0, 1fr);
        grid-template-areas: "range range" "controls date";
        justify-content: stretch;
        align-items: center !important;
        gap: 0.45rem;
        width: 100%;
        margin: 0 0 0.65rem;
        padding: 0 0.15rem 0.45rem;
        text-align: left;
    }

    #v-pills-profile-section-training .calendar-toolbar > div,
    #v-pills-profile-section-training .calendar-toolbar > h4,
    #assisted-user-training-calendar .calendar-toolbar > div,
    #assisted-user-training-calendar .calendar-toolbar > h4 {
        width: auto;
        margin-bottom: 0;
        text-align: left !important;
    }

    /* The profile keeps one row on the phone too: arrows, week range, the date as a round calendar button
       (like the arrows) and «Genera settimana»; on the narrowest phones the range goes on two lines (below) */
    #v-pills-profile-section-training .calendar-toolbar {
        grid-template-columns: auto minmax(0, 1fr);
        grid-template-areas: "range range" "controls actions";
    }

    /* !important and the longer selector: the generic phone rule of .week-controls-wrapper above centres its blocks */
    #v-pills-profile-section-training .calendar-toolbar > .calendar-toolbar-actions {
        grid-area: actions;
        justify-content: flex-end !important;
        gap: 0.4rem;
        margin-left: 0;
    }

    #v-pills-profile-section-training .calendar-toolbar-actions .calendar-date-jump {
        position: relative;
        justify-content: center;
        width: 32px;
        margin-left: 0;
        padding: 0;
    }

    #v-pills-profile-section-training .calendar-toolbar-actions .calendar-date-input {
        position: absolute;
        inset: 0;
        opacity: 0;
        cursor: pointer;
    }

    #v-pills-profile-section-training .calendar-toolbar-primary,
    #assisted-user-training-calendar .calendar-toolbar-primary {
        grid-area: controls;
        justify-content: flex-start !important;
        width: auto !important;
        min-width: 0;
    }

    #v-pills-profile-section-training .calendar-nav-group,
    #assisted-user-training-calendar .calendar-nav-group {
        display: grid;
        grid-template-columns: repeat(3, 32px);
        gap: 0.32rem;
        width: auto;
        max-width: none;
        min-width: 0;
        padding: 0;
        border: 0;
        background: transparent;
        box-shadow: none;
    }

    #v-pills-profile-section-training .calendar-nav-btn,
    #assisted-user-training-calendar .calendar-nav-btn {
        width: 32px;
        min-width: 0;
        height: 32px;
        min-height: 32px;
        padding: 0;
        border: 1px solid rgba(var(--contrast-theme-color-rgb), 0.13);
        border-radius: 999px;
        background: rgba(var(--current-theme-color-rgb), 0.96);
        box-shadow: 0 5px 14px rgba(var(--contrast-theme-color-rgb), 0.06);
        font-size: 0.78rem;
    }

    #v-pills-profile-section-training .calendar-nav-btn span,
    #assisted-user-training-calendar .calendar-nav-btn span {
        display: none;
    }

    #v-pills-profile-section-training .calendar-week-range,
    #assisted-user-training-calendar .calendar-week-range {
        display: block !important;
        grid-area: range;
        justify-self: start;
        max-width: 100%;
        overflow: hidden;
        color: var(--bs-body-color);
        font-size: 1rem;
        font-weight: 700;
        text-align: start !important;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    #v-pills-profile-section-training #weekRange.calendar-week-range,
    #assisted-user-training-calendar #weekRange.calendar-week-range {
        text-align: start !important;
    }

    #v-pills-profile-section-training .calendar-today-btn,
    #assisted-user-training-calendar .calendar-today-btn {
        border-color: rgba(var(--mangofit-color-rgb), 0.18);
        background: rgba(var(--mangofit-color-rgb), 0.08);
    }

    #v-pills-profile-section-training .calendar-date-jump,
    #assisted-user-training-calendar .calendar-date-jump {
        grid-area: date;
        justify-self: end;
        width: 154px;
        height: 32px;
        padding: 0 0.6rem;
        border-radius: 999px;
        box-shadow: 0 5px 14px rgba(var(--contrast-theme-color-rgb), 0.06);
    }

    #v-pills-profile-section-training .calendar-date-input,
    #assisted-user-training-calendar .calendar-date-input {
        font-size: 0.75rem;
        font-weight: 700;
    }

    #v-pills-profile-section-training #trainingWeekdayHeaders,
    #assisted-user-training-calendar #trainingWeekdayHeaders {
        padding: 0 !important;
        margin-bottom: 0 !important;
    }

    #v-pills-profile-section-training .trainingcalendarweekday,
    #assisted-user-training-calendar .trainingcalendarweekday {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        min-width: 30px;
        min-height: 32px;
        border-radius: 8px;
        font-size: 0.78rem;
        font-weight: 700;
    }

    #v-pills-profile-section-training .trainingcalendarweekday.active,
    #assisted-user-training-calendar .trainingcalendarweekday.active {
        background: rgba(var(--mangofit-color-rgb), 0.1);
    }
}

@media (max-width: 575.98px) {
    #assigned_cards_page [data-id="heading_page"] h4 {
        max-width: 100%;
        overflow: hidden;
        text-overflow: ellipsis;
        font-size: 1.05rem;
        letter-spacing: 0.22rem !important;
        white-space: nowrap;
    }

    #assisted-user-training-calendar {
        padding-right: 0.85rem;
        padding-left: 0.85rem;
    }

    #v-pills-profile-section-training .calendar-toolbar,
    #assisted-user-training-calendar .calendar-toolbar {
        gap: 0.5rem 0.4rem;
    }

    #v-pills-profile-section-training .calendar-nav-group,
    #assisted-user-training-calendar .calendar-nav-group {
        grid-template-columns: repeat(3, 30px);
        gap: 0.28rem;
    }

    #v-pills-profile-section-training .calendar-toolbar-actions .calendar-date-jump {
        width: 30px;
    }

    #v-pills-profile-section-training .calendar-nav-btn,
    #assisted-user-training-calendar .calendar-nav-btn {
        width: 30px;
        height: 30px;
        min-height: 30px;
    }

    #v-pills-profile-section-training .calendar-date-jump,
    #assisted-user-training-calendar .calendar-date-jump {
        width: 136px;
        height: 30px;
    }

    #v-pills-profile-section-training .calendar-week-range,
    #assisted-user-training-calendar .calendar-week-range {
        font-size: 0.95rem;
    }
}

/* ---------------------------
    MISC
--------------------------- */
@media (min-width: 768px) {
    .go_back_to_program {
        white-space: nowrap;
    }
}
