.calendar-page-header {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
}

.calendar-page-header h1 {
    color: var(--color-primary);
    letter-spacing: -0.04em;
}

.calendar-toolbar {
    border-radius: var(--radius-lg);
}

.calendar-month-navigation {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 0.5rem;
    width: 100%;
}

.calendar-month-navigation .btn:first-child {
    justify-self: stretch;
}

.calendar-month-navigation .btn:last-child {
    justify-self: stretch;
}

.calendar-picker {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 0.75rem;
    width: 100%;
}

.calendar-picker .form-label {
    margin-bottom: 0.3rem;
    font-size: 0.78rem;
    font-weight: 800;
    color: var(--color-primary);
}

.calendar-show-button {
    grid-column: 1 / -1;
}

.calendar-legend {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.45rem;
}

.calendar-legend-title {
    margin-right: 0.15rem;
    font-size: 0.8rem;
    font-weight: 800;
    color: var(--color-primary);
}

.calendar-legend-weekend,
.calendar-legend-today {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    border: 1px solid var(--color-border);
    border-radius: 999px;
    padding: 0.25rem 0.55rem;
    background: #fff;
    font-size: 0.68rem;
    font-weight: 800;
}

.calendar-legend-weekend > span,
.calendar-legend-today > span {
    width: 0.7rem;
    height: 0.7rem;
    border-radius: 50%;
}

.calendar-legend-weekend > span {
    background: #f2f4fb;
}

.calendar-legend-today > span {
    border: 2px solid var(--color-accent);
    background: #fff;
}

.calendar-board {
    overflow: hidden;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    background: #fff;
    box-shadow: var(--shadow-soft);
}

.calendar-weekdays {
    display: none;
}

.calendar-grid,
.calendar-week {
    display: block;
}

.calendar-cell {
    min-height: 5rem;
    display: grid;
    grid-template-columns: 5.25rem minmax(0, 1fr);
    gap: 0.85rem;
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--color-border);
    background: #fff;
}

.calendar-week:last-child .calendar-cell:last-child {
    border-bottom: 0;
}

.calendar-cell.is-outside-month {
    display: none;
}

.calendar-cell.is-weekend {
    background: #f7f8fd;
}

.calendar-cell.is-today {
    position: relative;
    box-shadow: inset 4px 0 0 var(--color-accent);
}

.calendar-cell.has-holidays {
    min-height: 6rem;
}

.calendar-date-heading {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    align-self: start;
}

.calendar-day-number {
    width: 2.25rem;
    height: 2.25rem;
    display: grid;
    place-items: center;
    border-radius: 50%;
    color: var(--color-primary);
    font-size: 1.1rem;
    font-weight: 800;
    line-height: 1;
}

.calendar-cell.is-today .calendar-day-number {
    color: #fff;
    background: var(--color-accent);
}

.calendar-day-mobile-label {
    margin-top: 0.25rem;
    font-size: 0.72rem;
    font-weight: 700;
    color: #6a7185;
}

.today-label {
    margin-top: 0.3rem;
    color: var(--color-accent-dark);
    font-size: 0.66rem;
    font-weight: 800;
}

.calendar-cell-events {
    display: grid;
    align-content: start;
    gap: 0.4rem;
}

.calendar-holiday-link {
    min-width: 0;
    display: flex;
    align-items: center;
    min-height: 2.2rem;
    border-radius: 0.65rem;
    padding: 0.45rem 0.65rem;
    color: #fff;
    font-size: 0.78rem;
    font-weight: 750;
    line-height: 1.25;
    text-decoration: none;
    box-shadow: 0 0.25rem 0.75rem rgba(30, 42, 74, 0.1);
    transition: transform 150ms ease, filter 150ms ease;
}

.calendar-holiday-link:hover {
    color: #fff;
    filter: brightness(0.94);
    transform: translateY(-1px);
}

.calendar-holiday-link:focus-visible {
    outline-color: var(--color-primary);
}

.calendar-holiday-name {
    overflow: hidden;
    text-overflow: ellipsis;
}

.calendar-no-event {
    align-self: center;
    color: #9aa1b3;
    font-size: 0.72rem;
}

.calendar-help {
    display: flex;
    align-items: flex-start;
    gap: 0.55rem;
    color: #6b7280;
    font-size: 0.85rem;
}

@media (min-width: 576px) {
    .calendar-page-header {
        flex-direction: row;
        align-items: flex-end;
        justify-content: space-between;
    }

    .calendar-picker {
        grid-template-columns: minmax(9rem, 1fr) minmax(7rem, 0.75fr) auto;
        align-items: end;
    }

    .calendar-show-button {
        grid-column: auto;
    }
}

@media (min-width: 768px) {
    .calendar-weekdays {
        display: grid;
        grid-template-columns: repeat(7, minmax(0, 1fr));
        border-bottom: 1px solid var(--color-border);
        background: var(--color-primary);
        color: #fff;
    }

    .calendar-weekdays span {
        padding: 0.8rem 0.5rem;
        text-align: center;
        font-size: 0.72rem;
        font-weight: 800;
        letter-spacing: 0.04em;
        text-transform: uppercase;
    }

    .calendar-weekdays .is-weekend {
        background: rgba(255, 255, 255, 0.08);
    }

    .calendar-grid {
        display: grid;
    }

    .calendar-week {
        display: grid;
        grid-template-columns: repeat(7, minmax(0, 1fr));
    }

    .calendar-cell {
        min-width: 0;
        min-height: 9rem;
        display: flex;
        flex-direction: column;
        gap: 0.3rem;
        padding: 0.55rem;
        border-right: 1px solid var(--color-border);
        border-bottom: 1px solid var(--color-border);
    }

    .calendar-week .calendar-cell:nth-child(7) {
        border-right: 0;
    }

    .calendar-week:last-child .calendar-cell {
        border-bottom: 0;
    }

    .calendar-cell.is-outside-month {
        display: flex;
        background: #fafbfe;
        color: #a4a9b7;
    }

    .calendar-cell.is-outside-month .calendar-day-number,
    .calendar-cell.is-outside-month .calendar-holiday-link {
        opacity: 0.45;
    }

    .calendar-cell.is-today {
        box-shadow: inset 0 0 0 2px var(--color-accent);
    }

    .calendar-date-heading {
        min-height: 2.1rem;
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
    }

    .calendar-day-number {
        width: 1.9rem;
        height: 1.9rem;
        font-size: 0.92rem;
    }

    .calendar-day-mobile-label,
    .calendar-no-event {
        display: none;
    }

    .today-label {
        margin: 0;
        font-size: 0.58rem;
    }

    .calendar-cell-events {
        gap: 0.3rem;
    }

    .calendar-holiday-link {
        min-height: 1.9rem;
        padding: 0.35rem 0.45rem;
        font-size: 0.66rem;
    }
}

@media (min-width: 992px) {
    .calendar-cell {
        min-height: 10.5rem;
        padding: 0.7rem;
    }

    .calendar-holiday-link {
        font-size: 0.72rem;
    }
}

@media (min-width: 1200px) {
    .calendar-month-navigation {
        width: auto;
    }

    .calendar-picker {
        width: auto;
    }

    .calendar-cell {
        min-height: 11.5rem;
    }
}

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