/* Only headers and filters. Calendar grids, cells, booking cards and drag remain untouched. */
.calendar-closure-fields {
    display: grid;
    gap: var(--ui-space-4);
    min-width: 0;
}
.calendar-closure-fields > * { min-width: 0; }
.calendar-closure-fields > [hidden] { display: none; }
.calendar-closure-date-range {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: end;
    gap: var(--ui-space-3);
    min-width: 0;
}
[data-calendar-closure-dialog] .ui-dialog__layout { grid-template-columns: minmax(0, 1fr); }
[data-calendar-closure-dialog] .ui-dialog__header > strong { min-width: 0; white-space: normal; overflow-wrap: anywhere; }
[data-calendar-closure-dialog] .ui-dialog__footer { flex-wrap: wrap; }
.crm-page-calendar-rates .sales-calendar-header .sales-calendar-settings-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    cursor: pointer;
}

.crm-page-calendar-rates .sales-calendar-header .sales-calendar-settings-button svg {
    display: block;
    flex: 0 0 auto;
    margin: 0;
}

.crm-page-calendar .calendar-page-header,
.crm-page-calendar-rates .sales-calendar-header,
.crm-page-statistics-occupancy .statistics-analytics-header {
    min-width: 0;
    padding: var(--ui-space-5);
    border: 1px solid var(--ui-color-border);
    border-radius: var(--ui-radius-md);
    background: var(--ui-color-surface);
    box-shadow: none;
}

.crm-page-calendar .calendar-page-header .bookings-title-row {
    flex-wrap: wrap;
    gap: var(--ui-space-4);
}

.crm-page-calendar .calendar-page-header .calendar-filter-form {
    min-width: 0;
    max-width: 100%;
    margin-left: auto;
}

.crm-page-calendar .calendar-page-header .calendar-date-range-trigger {
    min-height: 44px;
    max-width: 100%;
    border-color: var(--ui-color-border);
    border-radius: var(--ui-radius-sm);
    background: var(--ui-color-surface);
    box-shadow: none;
}

.crm-page-calendar .calendar-today-button {
    flex: 0 0 auto;
    min-height: 44px;
    padding-inline: var(--ui-space-4);
    gap: var(--ui-space-2);
    white-space: nowrap;
}

.crm-page-calendar .calendar-today-button svg {
    width: 18px;
    height: 18px;
    flex: 0 0 auto;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.crm-page-calendar .calendar-range-pagination {
    display: flex;
    align-items: center;
    min-width: 0;
    max-width: 100%;
    gap: var(--ui-space-1);
}

.crm-page-calendar .calendar-range-pagination .calendar-date-range {
    min-width: 0;
    flex: 1 1 auto;
}

.crm-page-calendar .calendar-range-page-button {
    width: 44px;
    min-width: 44px;
    height: 44px;
    padding: 0;
    flex: 0 0 44px;
}

.crm-page-calendar .calendar-range-page-button svg {
    width: 20px;
    height: 20px;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.crm-page-calendar-rates .sales-calendar-header {
    flex-wrap: wrap;
    gap: var(--ui-space-4);
}

.crm-page-calendar-rates .sales-calendar-heading {
    min-width: 0;
    overflow-wrap: anywhere;
}

.crm-page-calendar-rates .sales-calendar-filters,
.crm-page-statistics-occupancy .statistics-filter-card {
    min-width: 0;
    padding: var(--ui-space-4);
    border: 1px solid var(--ui-color-border);
    border-radius: var(--ui-radius-md);
    background: var(--ui-color-surface);
    box-shadow: none;
}

.crm-page-calendar-rates .sales-calendar-filters form {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr)) auto;
    align-items: end;
    gap: var(--ui-space-3);
}

.crm-page-calendar-rates .sales-calendar-filters form > label {
    display: grid;
    min-width: 0;
    gap: var(--ui-space-1);
}

.crm-page-calendar-rates .sales-calendar-filters form > label > span {
    color: var(--ui-color-text-muted);
    font-size: var(--ui-font-xs);
    font-weight: 600;
}

.crm-page-calendar .calendar-page-header .round-add-button,
.crm-page-calendar-rates .sales-calendar-filters .send-button {
    min-height: 44px;
    border-radius: var(--ui-radius-sm);
    background: var(--ui-color-primary);
    color: var(--ui-color-surface);
    box-shadow: none;
}

.crm-page-calendar .calendar-page-header :is(button, a):focus-visible,
.crm-page-calendar-rates .sales-calendar-header button:focus-visible,
.crm-page-calendar-rates .sales-calendar-filters button:focus-visible {
    outline: 2px solid var(--ui-color-primary);
    outline-offset: 2px;
}

@media (max-width: 1100px) {
    .crm-page-calendar-rates .sales-calendar-filters form,
    .crm-page-statistics-occupancy .statistics-filter-form {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 900px) {
    .crm-page-calendar .calendar-page-header .calendar-filter-form {
        grid-template-columns: max-content minmax(0, 1fr);
    }

    .crm-page-calendar .calendar-page-header .calendar-property-filter {
        grid-column: 1 / -1;
    }

    .crm-page-calendar .calendar-page-header .calendar-range-pagination {
        width: 100%;
    }
}

@media (max-width: 760px) {
    .crm-page-calendar .calendar-page-header,
    .crm-page-calendar-rates .sales-calendar-header,
    .crm-page-statistics-occupancy .statistics-analytics-header {
        padding: var(--ui-space-3);
    }

    .crm-page-calendar-rates .sales-calendar-header {
        position: relative;
        padding-right: calc(var(--ui-space-3) + 44px + var(--ui-space-2));
    }

    .crm-page-calendar-rates .sales-calendar-header .sales-calendar-settings-button {
        position: absolute;
        top: var(--ui-space-3);
        right: var(--ui-space-3);
        width: 44px;
        min-width: 44px;
        height: 44px;
    }

    .crm-page-calendar .calendar-page-header .calendar-filter-form {
        width: 100%;
        margin-left: 0;
    }

    .crm-page-calendar-rates .sales-calendar-filters form,
    .crm-page-statistics-occupancy .statistics-filter-form {
        grid-template-columns: minmax(0, 1fr);
    }
}

@media (max-width: 640px) {
    .crm-page-calendar .calendar-page-header {
        padding: 0;
        border: 0;
        border-radius: 0;
        background: transparent;
        box-shadow: none;
    }

    .crm-page-calendar .calendar-page-header .calendar-filter-form {
        grid-template-columns: 44px minmax(0, 1fr);
    }

    .crm-page-calendar .calendar-page-header .calendar-property-filter {
        grid-column: 1 / -1;
    }

    .crm-page-calendar .calendar-page-header .calendar-today-button {
        grid-column: 1;
        width: 44px;
        min-width: 44px;
        padding: 0;
    }

    .crm-page-calendar .calendar-page-header .calendar-date-range {
        grid-column: 2;
    }

    .crm-page-calendar .calendar-page-header .calendar-range-pagination {
        grid-column: 2;
    }

    .crm-page-calendar .calendar-today-button-label {
        display: none;
    }
}
.crm-page-calendar .calendar-page-header .calendar-group-booking-button {
    width: 44px;
    flex-basis: 44px;
    padding: 0;
}

.crm-page-calendar .calendar-page-header .calendar-group-booking-button .visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

/* Group membership marker within the clipped booking name. */
.calendar-booking-label strong .calendar-booking-group-icon {
    display: inline-flex;
    width: 16px;
    height: 16px;
    margin-right: 4px;
    vertical-align: middle;
    opacity: 1;
    overflow: visible;
    pointer-events: auto;
}
.calendar-booking-group-icon svg { width: 16px; height: 16px; flex: none; }
