/* Restore history positions immediately, without Bootstrap's smooth page scroll. */
:root {
    scroll-behavior: auto;
}

details.calendar-month-picker,
details.calendar-month-picker[open] {
    width: auto;
    min-height: 0;
    margin: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
    position: relative;
    font-size: inherit;
    line-height: inherit;
    transition: none;
}

.calendar-month-picker > summary {
    list-style: none;
}

.calendar-month-picker > summary::-webkit-details-marker,
.calendar-month-picker > summary::before,
.calendar-month-picker[open] > summary::after {
    display: none;
}

.calendar-month-picker > nav {
    position: absolute;
    left: 0;
    top: calc(100% + 12px);
    z-index: 5;
    width: 340px;
    max-height: min(640px, 75vh);
    overflow-y: auto;
    padding: 18px;
    background: #fff;
    color: #4a5057;
    border: 1px solid #e3e6ee;
    border-radius: 16px;
    box-shadow: 0 12px 30px rgba(44, 49, 66, 0.1), 0 2px 6px rgba(44, 49, 66, 0.06);
    font-size: 14px;
}

.calendar-month-year-controls {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
    gap: 4px;
    min-width: 0;
    padding: 4px;
    margin: 0 0 16px;
    border: 0;
    border-radius: 999px;
    background: #f4f1ed;
}

.calendar-month-year-button {
    min-height: 36px;
    padding: 4px 12px;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: #707780;
    font: inherit;
}

.calendar-month-year-button[aria-pressed="true"] {
    background: #fff;
    color: #4a5057;
    box-shadow: 0 1px 4px rgba(44, 49, 66, 0.1);
    font-weight: 500;
}

.calendar-month-year-heading {
    margin: 0 0 12px;
    font-size: 16px;
    font-weight: 500;
}

.calendar-month-year-panel + .calendar-month-year-panel {
    margin-top: 20px;
}

.calendar-month-picker-enhanced .calendar-month-year-heading {
    display: none;
}

.calendar-month-picker-enhanced .calendar-month-year-panel {
    margin-top: 0;
}

.calendar-month-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
}

.calendar-month-option {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
    min-height: 44px;
    padding: 8px 2px;
    border: 1px solid transparent;
    border-radius: 10px;
    background: transparent;
    color: #4a5057;
    font: inherit;
    font-weight: 400;
    text-align: center;
    text-decoration: none;
    white-space: nowrap;
}

a.calendar-month-option:hover {
    background: #edf0f8;
    color: #4a5057;
    text-decoration: none;
}

.calendar-month-option[aria-current="page"],
.calendar-month-option[aria-current="page"]:hover {
    background: #667ec3;
    color: #fff;
    font-weight: 500;
}

.calendar-month-option:disabled {
    color: #b7bbc3;
    cursor: default;
}

.calendar-month-picker :is(a, button, summary):focus-visible {
    outline: 2px solid #667ec3;
    outline-offset: 2px;
}

.calendar-month-footer {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-top: 16px;
    padding-top: 13px;
    border-top: 1px solid #e3e6ee;
}

.calendar-month-range {
    color: #707780;
    font-size: 11px;
}

.calendar-current-month {
    padding: 3px 0;
    color: #667ec3;
    font-size: 12px;
    font-weight: 500;
}

@media (max-width: 991.98px) {
    .calendar-month-controls {
        position: relative;
    }

    details.calendar-month-picker,
    details.calendar-month-picker[open] {
        position: static;
    }

    .calendar-month-picker > nav {
        left: 12px;
        width: min(calc(100% - 24px), 340px);
    }
}

@media (max-width: 575.98px) {
    .calendar-month-controls {
        flex-wrap: wrap;
    }

    .calendar-month-picker > nav {
        padding: 16px;
    }
}

@media (max-width: 359.98px) {
    .calendar-month-option {
        font-size: 12px;
    }
}

.calendar-month-picker[open] > summary .bi-chevron-down {
    transform: rotate(180deg);
}
