#calendar {
        -moz-user-select: none;
        width: 100%;
        padding: 0;
        border: 1px solid #dfe3e8;
        border-radius: 18px;
        background: #ffffff;
        box-shadow: 0 18px 40px rgba(18, 38, 63, 0.08);
        color: #1f2933;
        font-family: "Montserrat", sans-serif;
        overflow: hidden;
}

#calendar .navigation {
        border-bottom: 1px solid #eceff3;
        background: linear-gradient(135deg, #2f3b4a 0%, #1f2933 100%);
        color: #ffffff;
}

#calendar .navigation .title {
        margin: 0;
        padding: 24px 22px 20px 22px;
        line-height: 1.7;
        text-align: center;
}

#calendar .navigation .titolo {
        margin: 0 0 8px 0;
        padding: 0;
        color: inherit;
        font-size: 1.15rem;
        font-weight: 700;
        line-height: 1.3;
        text-align: center;
        letter-spacing: 0.04em;
}

#calendar .navigation .title a {
        display: inline-block !important;
        margin: 4px 2px !important;
        padding: 7px 11px !important;
        border-radius: 10px;
        background-image: none !important;
        background-color: rgba(255,255,255,0.08);
        color: #ffffff;
        font-size: 0.87rem;
        font-weight: 600;
        line-height: 1.1 !important;
        text-decoration: none;
        transition: background-color .2s ease, transform .2s ease, opacity .2s ease;
}

#calendar .navigation .title a:hover {
        color: #ffffff !important;
        opacity: 1;
        background-color: rgba(255,255,255,0.18);
        transform: translateY(-1px);
}

#calendar .navigation .title a.ultimo {
        border-right-width: 0;
        border-right-style: none;
}

#calendar .navigation .title a.selezionato {
        background-color: #e30514;
        color: #ffffff !important;
}

#calendar .navigation .prev,
#calendar .navigation .next {
        display: none;
}

#calendar table {
        width: 100%;
        border-collapse: separate;
        border-spacing: 0;
        table-layout: fixed;
        font-size: 0.88rem;
}

#calendar table th {
        padding: 12px 6px;
        border: 0;
        background-color: #111827;
        color: #ffffff;
        font-size: 0.75rem;
        font-weight: 700;
        text-align: center;
        letter-spacing: 0.08em;
}

#calendar table td {
        padding: 8px 6px;
        border: 0;
        background-color: #ffffff;
        vertical-align: middle;
}

#calendar table td a {
        display: block;
        padding: 0 !important;
        background-color: transparent;
        background-image: none !important;
        color: inherit;
        text-decoration: none;
        font-weight: normal;
        opacity: 1;
        clear: both;
}

#calendar table td a:hover {
        background-color: transparent;
        color: inherit !important;
}

#calendar table td.current a,
#calendar table td.free,
#calendar table td.booked {
        font-weight: bold;
        opacity: 1;
}

.nr-giorno {
        display: flex;
        align-items: center;
        justify-content: center;
        min-height: 42px;
        margin: 0;
        padding: 8px;
        border-radius: 12px;
        background-color: #5f6c7a;
        color: #ffffff;
        text-align: center;
        font-size: 1rem;
        font-weight: 700;
        transition: transform .2s ease, box-shadow .2s ease, opacity .2s ease;
}

#calendar table td a:hover .nr-giorno {
        transform: translateY(-1px);
        box-shadow: 0 10px 18px rgba(18, 38, 63, 0.15);
}

#calendar table td.booked .nr-giorno {
        background-color: #cf1124;
}

/* tecnico gia' impegnato in lavorazioni: colore dedicato "sconfortante" (owner 01/10),
   distinto dal grigio delle domeniche */
#calendar table td.cal-occupied .nr-giorno {
        background-color: #b26a00;
}

#calendar table td.free .nr-giorno {
        background-color: #2f9e44;
}

#calendar table td.altro-mese .nr-giorno {
        opacity: 0.18;
}

.calendar-legend {
        display: flex;
        flex-wrap: wrap;
        gap: 10px;
        margin-top: 18px;
}

.calendar-legend__item {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        min-width: 120px;
        padding: 10px 14px;
        border-radius: 999px;
        color: #ffffff;
        font-size: 0.82rem;
        font-weight: 700;
        letter-spacing: 0.04em;
        text-transform: uppercase;
}

.calendar-legend__item.is-free {
        background-color: #2f9e44;
}

.calendar-legend__item.is-booked {
        background-color: #cf1124;
}

.calendar-legend__item.is-busy {
        background-color: #b26a00;
}

.calendar-legend__item.is-sunday {
        background-color: #5f6c7a;
}

@media (max-width: 991.98px) {
        #calendar .navigation .title {
                padding-left: 14px;
                padding-right: 14px;
        }

        #calendar .navigation .title a {
                font-size: 0.8rem;
                padding: 6px 9px !important;
        }
}

@media (max-width: 767.98px) {
        #calendar {
                border-radius: 14px;
        }

        #calendar .navigation .titolo {
                font-size: 1rem;
        }

        #calendar .navigation .title {
                padding-top: 18px;
                padding-bottom: 16px;
                line-height: 1.5;
        }

        #calendar table th {
                padding: 10px 4px;
                font-size: 0.65rem;
        }

        #calendar table td {
                padding: 4px 3px;
        }

        .nr-giorno {
                min-height: 34px;
                border-radius: 10px;
                font-size: 0.88rem;
        }

        .calendar-legend__item {
                min-width: 0;
                width: 100%;
                justify-content: flex-start;
        }
}
