.calendar {
    overflow: hidden;
    position: relative;
}

.week-slider {
    width: 100%;
    transition: all 0.4s ease;
    transform-origin: center center;
    transform: scaleY(1);
    opacity: 1;
    touch-action: pan-x;
    user-select: none;
    margin: 0 auto;
}

.week-slider:not(.expanded) {
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: flex-start;
    gap: 0.6rem;
    padding-top: 1rem;
    padding-bottom: 1rem;
    overflow-x: hidden;
    overflow-y: visible;
    min-height: 7rem;
}

.week-slider.expanded {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 0.4rem;
    padding: 1rem;
    overflow-y: hidden;
}

.week-slider.expand-animation { animation: expandFromCenter 0.3s ease forwards; }

.week-slider.collapse-animation { animation: collapseToCenter 0.3s ease forwards; }

@keyframes expandFromCenter {
    from {
        transform: scaleY(0.6);
        opacity: 0;
    }

    to {
        transform: scaleY(1);
        opacity: 1;
    }
}

@keyframes collapseToCenter {
    from {
        transform: scaleY(1);
        opacity: 1;
    }

    to {
        transform: scaleY(0.6);
        opacity: 0;
    }
}

.week-day {
    display: flex;
    flex-direction: column;
    align-items: center;
    max-width: 60px;
    flex: 1 1 0;
    gap: 0.2rem;
}

    .week-day > div:first-child {
        font-size: 0.8rem;
        color: var(--mud-palette-text-primary);
        margin-bottom: 0.2rem;
        font-weight: 500;
    }

.day {
    border-radius: 10px;
    text-align: center;
    cursor: pointer;
    transition: background 0.3s ease, transform 0.2s ease;
    font-size: 0.95rem;
    background: var(--mud-palette-background-gray);
    width: 38px;
    height: 38px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: var(--mud-palette-text-primary);
    border: 1px solid var(--mud-palette-background-gray);
    margin: 0 auto;
}

.day:hover { transform: scale(1.08); }

.week-slider:not(.expanded) .day {
    padding: 0;
    min-width: 38px;
    min-height: 38px;
    max-width: 48px;
    max-height: 48px;
}

.day.selected {
    background: var(--mud-palette-tertiary);
    border: 1px solid var(--mud-palette-tertiary);
    color: var(--mud-palette-secondary);
}

.day.today { border: 1px solid var(--mud-palette-primary); }

.appointments {
    display: flex;
    gap: 1rem;
    overflow-y: auto;
    flex-direction: column;
    -ms-overflow-style: none;
    scrollbar-width: none;
    padding-bottom: 9vh;
}

.appointments.ah-calendar-m { height: calc(100% - 315px) !important; }

.appointments::-webkit-scrollbar { display: none; }

.appointment {
    background: var(--mud-palette-surface);
    border-radius: 8px;
    padding: 0.8rem;
    margin-bottom: 0.5rem;
    box-shadow: var(--custom-box-shadow);
}

.toggle-month {
    background: none;
    border: none;
    color: var(--mud-palette-text-primary);
    font-size: 1rem;
    cursor: pointer;
}

.event-dot-container {
    display: flex;
    gap: 5px;
    flex-direction: row;
}

.event-dot {
    height: 5px;
    width: 5px;
    border-radius: 50%;
}

.event-dot.memo { background-color: var(--mud-palette-info-darken); }

.event-dot.interna { background-color: var(--mud-palette-success-darken); }

.event-dot.commessa { background-color: var(--mud-palette-warning); }

@supports (-webkit-touch-callout: none) { .appointments { padding-bottom: calc(60px + env(safe-area-inset-bottom)) !important; } }