#open-full-calendar-btn {
    border: 0;
    background: none;
    color: inherit;
    font: inherit;
    cursor: pointer;
    padding: 0;
}

#booking-calendar {
    box-sizing: border-box;
    width: min(94vw, 520px);
    max-width: 94vw;
    max-height: 92vh;
    max-height: 92dvh;
    margin: auto;
    border: 0;
    border-radius: 14px;
    padding: 22px;
    background: #ffffff;
    color: #333333;
    overflow-y: auto;
    font: 16px/1.5 Arial, sans-serif;
}

#booking-calendar::backdrop {
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(4px);
}

#booking-calendar [hidden] {
    display: none !important;
}

#booking-calendar * {
    box-sizing: border-box;
}

#booking-calendar .bcal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    position: static;
    background: none;
    padding: 0;
    margin: 0 0 14px;
    border: 0;
    height: auto;
    width: auto;
}

#booking-calendar h2 {
    font-size: 23px;
    margin: 0;
    color: #2c3e50;
}

#booking-calendar h3 {
    margin: 0;
    font-size: 18px;
}

#booking-calendar button,
#booking-calendar input {
    font: inherit;
}

#booking-calendar button {
    cursor: pointer;
    touch-action: manipulation;
}

#booking-calendar button:disabled {
    cursor: not-allowed;
    opacity: 0.6;
}

#booking-calendar button:focus-visible,
#booking-calendar a:focus-visible {
    outline: 3px solid #2980b9;
    outline-offset: 2px;
}

#bcal-close {
    flex-shrink: 0;
    border: 0;
    background: none;
    color: #777777;
    font-size: 32px !important;
    line-height: 1;
    padding: 0 4px;
}

#booking-calendar .bcal-help {
    font-size: 13px;
    color: #626d79;
    margin: 12px 0;
}

#booking-calendar .bcal-navigation {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin: 16px 0;
}

#bcal-prev,
#bcal-next {
    width: 38px;
    height: 38px;
    flex-shrink: 0;
    border: 1px solid #ccd3dc;
    background: #f8f9fa;
    border-radius: 50%;
}

#booking-calendar .bcal-weekdays,
#booking-calendar #bcal-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 5px;
    text-align: center;
}

#booking-calendar .bcal-weekdays {
    font-size: 12px;
    font-weight: bold;
    margin-bottom: 8px;
}

/* Ячейка даты. */
#booking-calendar .bcal-day {
    position: relative;
    display: block;
    min-width: 0;
    height: 72px;
    padding: 0;
    overflow: hidden;
    border: 1px solid #bfc8d3;
    border-radius: 6px;
    background: #ffffff;
    color: #263747;
    isolation: isolate;
}

/* Две независимые кнопки внутри ячейки. */
#booking-calendar .bcal-half {
    position: absolute;
    inset: 0;
    display: block;
    width: 100%;
    height: 100%;
    min-width: 0;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    opacity: 1;
    background: #e8f4ee;
    color: #17663b;
    cursor: pointer;
    pointer-events: auto;
    touch-action: manipulation;
}

/* Диагональ /.
   Верхняя левая половина — выезд. */
#booking-calendar .bcal-checkout {
    clip-path: polygon(0 0, 100% 0, 0 100%);
    background: #e9f1fc;
    color: #245a9b;
}

/* Нижняя правая половина — заезд. */
#booking-calendar .bcal-checkin {
    clip-path: polygon(100% 0, 100% 100%, 0 100%);
}

#booking-calendar .bcal-half:disabled {
    opacity: 1;
    cursor: not-allowed;
}

@media (hover: hover) {
    #booking-calendar .bcal-half:not(:disabled):hover {
        filter: brightness(0.92);
    }
}

/* Занятые или закрытые ночи. */
#booking-calendar .bcal-half.bcal-half-busy {
    background: rgba(220, 65, 65, 0.42);
    color: #7b2020;
}

/* Промежуток выбранных дат. */
#booking-calendar .bcal-half.bcal-half-selected {
    background: rgba(225, 65, 65, 0.58);
    color: #651919;
}

/* Начало проживания. */
#booking-calendar .bcal-half.bcal-selected-start {
    background: #438bd3;
    color: #ffffff;
}

/* Конец проживания. */
#booking-calendar .bcal-half.bcal-selected-end {
    background: #35a873;
    color: #ffffff;
}

/* Прошедшие даты. */
#booking-calendar .bcal-half.bcal-half-past {
    background: #edf0f3;
    color: #939ca5;
}

/* Число и цена не перехватывают нажатия. */
#booking-calendar .bcal-caption {
    pointer-events: none;
    position: absolute;
    left: 1px;
    right: 1px;
    top: 20px;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    color: #263747;
    font-size: 14px;
    line-height: 1.3;
}

#booking-calendar .bcal-caption > span {
    background: rgba(255, 255, 255, 0.92);
    padding: 0 2px;
    border-radius: 3px;
    max-width: 100%;
}

#booking-calendar .bcal-price {
    font-size: 9px;
    color: #17663b;
    white-space: nowrap;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
}

#booking-calendar .bcal-half:focus-visible {
    outline: 0;
    box-shadow: inset 0 0 0 4px #142b52;
    z-index: 1;
}

#booking-calendar .bcal-half-arrow {
    display: none !important;
    pointer-events: none;
}

#bcal-reset,
#bcal-another {
    background: #f0f2f5;
    border: 1px solid #ccd3dc;
    border-radius: 6px;
    padding: 8px 12px;
}

#bcal-summary {
    margin: 16px 0;
    padding: 14px;
    background: #eef7f1;
    border-radius: 8px;
}

#bcal-summary p {
    margin: 4px 0;
}

#bcal-form {
    display: grid;
    gap: 14px;
    margin-top: 18px;
}

#bcal-form label {
    display: block;
}

#bcal-form input:not([type="checkbox"]) {
    width: 100%;
    display: block;
    margin-top: 5px;
    padding: 11px;
    border: 1px solid #b8c1cc;
    border-radius: 6px;
    font-size: 16px;
}

#bcal-form .bcal-consent {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-size: 13px;
}

#bcal-consent {
    margin-top: 4px;
    flex-shrink: 0;
}

#booking-calendar .bcal-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 14px 0;
}

#booking-calendar .bcal-actions button,
#booking-calendar .bcal-actions a {
    display: inline-block;
    padding: 11px 14px;
    background: #27834c;
    color: #ffffff;
    border: 0;
    border-radius: 7px;
    text-align: center;
    text-decoration: none;
    font-size: 15px;
}

#booking-calendar .bcal-actions button:active:not(:disabled) {
    transform: translateY(1px);
    filter: brightness(0.9);
}

#booking-calendar #bcal-book-max,
#booking-calendar #bcal-max {
    background: #325bbc;
}

#booking-calendar a {
    color: #2168a8;
}

#bcal-details {
    white-space: pre-line;
}

#bcal-status {
    margin-top: 14px;
    overflow-wrap: anywhere;
}

#bcal-qr-wrap {
    margin: 16px 0;
    font-size: 12px;
}

#bcal-qr {
    display: block;
    max-width: 100%;
    height: auto;
}

@media (max-width: 380px) {
    #booking-calendar {
        padding: 16px;
    }

    #booking-calendar h2 {
        font-size: 20px;
    }
}