/* Кнопки фильтра отзывов образуют единый доступный список вкладок */
#organisation .review-filter > li > .change-type {
    display: flex;
    gap: 10px;
    align-items: center;
    width: 100%;
    min-height: 44px;
    padding: 10px 12px;
    border: 0;
    border-bottom: 1px solid var(--quick-tickets-color-border);
    background: transparent;
    color: var(--quick-tickets-color-text-muted);
    font: inherit;
    font-size: 15px;
    line-height: 1.35;
    text-align: left;
    cursor: pointer;
}

#organisation .review-filter > li:last-child > .change-type {
    border-bottom: 0;
}

#organisation .review-filter > li.active > .change-type {
    padding-left: 9px;
    border-left: 3px solid var(--quick-tickets-color-brand);
    background: var(--quick-tickets-color-surface);
    color: var(--quick-tickets-color-text);
    font-weight: 600;
}

#organisation .review-filter > li > .change-type:hover {
    background: var(--quick-tickets-color-surface-muted);
    color: var(--quick-tickets-color-text);
}

/* Каждая карточка отзыва получает спокойную цветовую индикацию типа без дополнительной тени */
#organisation .reviews-list > .item {
    margin-bottom: 16px;
}

#organisation .reviews-list > .item:last-child {
    margin-bottom: 0;
}

#organisation .reviews-list > .item > .review {
    margin-bottom: 0;
    padding: 14px 16px;
    border: 1px solid var(--quick-tickets-color-border);
    border-left-width: 4px;
    border-radius: var(--quick-tickets-radius-medium);
    background: var(--quick-tickets-color-surface);
}

#organisation .reviews-list > .item.positive > .review {
    border-left-color: #179347;
}

#organisation .reviews-list > .item.negative > .review {
    border-left-color: var(--quick-tickets-color-text-muted, #6f6f6f);
}

/* Автор, тип и дата отзыва сохраняют читаемую иерархию при длинных именах */
#organisation .reviews-list .item .h {
    display: flex;
    gap: 6px 10px;
    align-items: center;
    flex-wrap: wrap;
    min-width: 0;
}

#organisation .reviews-list .item .h .a {
    min-width: 0;
    font-weight: 600;
    overflow-wrap: anywhere;
}

#organisation .reviews-list .item .h .d {
    float: none;
    flex: 0 0 auto;
    margin-left: auto;
    color: var(--quick-tickets-color-text-muted);
    font-size: 12px;
    font-variant-numeric: tabular-nums;
}

#organisation .reviews-list .item .c {
    padding-top: 10px;
    color: var(--quick-tickets-color-text);
    line-height: 1.55;
    overflow-wrap: anywhere;
}

/* Ответы сервиса и организации объединяются спокойной вертикальной направляющей */
#organisation .reviews-list .answer {
    position: relative;
    margin: 8px 0 0 28px;
    padding: 13px 16px;
    border: 0;
    border-left: 3px solid #cfd2d4;
    border-radius: 0 var(--quick-tickets-radius-medium) var(--quick-tickets-radius-medium) 0;
    background: var(--quick-tickets-color-surface-muted);
}

#organisation .reviews-list .answer::before {
    position: absolute;
    top: 20px;
    left: -15px;
    width: 12px;
    height: 1px;
    background: #cfd2d4;
    content: "";
}

#organisation .reviews-list__answer-spacer {
    height: 1px;
    margin: 12px 0;
    background: var(--quick-tickets-color-border);
}

/* Поля диалога отзыва используют общую ширину и допускают изменение высоты текста */
#modalReview .review-add__event {
    width: 100%;
    color: var(--quick-tickets-color-text-muted);
}

#modalReview .review-add__text {
    min-height: 88px;
    resize: vertical;
}

@media (max-width: 767.999px) {
    /* На телефоне действия и фильтр располагаются перед списком отзывов */
    #organisation .organisation-reviews {
        display: flex;
        flex-direction: column;
        padding-top: 12px;
        padding-bottom: 76px;
        padding-bottom: calc(76px + env(safe-area-inset-bottom));
        padding-bottom: calc(
            var(--organisation-reviews-action-height, calc(64px + env(safe-area-inset-bottom)))
            + 12px
        );
    }

    #organisation .organisation-reviews > .col-xs-9,
    #organisation .organisation-reviews > .col-xs-3 {
        float: none;
        width: 100%;
    }

    #organisation .organisation-reviews > .col-xs-3 {
        order: -1;
        margin-bottom: 14px;
    }

    /* Основное действие остаётся доступным у нижней границы экрана */
    #organisation .organisation-reviews__action {
        position: fixed;
        right: 0;
        bottom: 0;
        left: 0;
        z-index: 1030;
        display: flex;
        flex-direction: column;
        gap: 8px;
        padding: 10px;
        padding: 10px max(10px, env(safe-area-inset-right)) max(10px, env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left));
        border-top: 1px solid #ddd;
        background: rgba(255, 255, 255, 0.97);
        box-shadow: 0 -4px 14px rgba(0, 0, 0, 0.1);
    }

    #organisation .organisation-reviews__action .btn-review {
        max-width: 100%;
        min-height: 44px;
        margin: 0;
    }

    #organisation .organisation-reviews__action .review-inform {
        margin: 0;
    }

    #organisation .review-filter {
        display: flex;
        margin-top: 10px;
        overflow-x: auto;
        scrollbar-width: none;
        -webkit-overflow-scrolling: touch;
    }

    #organisation .review-filter::-webkit-scrollbar {
        display: none;
        width: 0;
        height: 0;
    }

    #organisation .review-filter > li {
        flex: 0 0 auto;
    }

    #organisation .review-filter > li > .change-type,
    #organisation .review-filter > li:last-child > .change-type {
        border: 1px solid var(--quick-tickets-color-border);
        border-left-width: 0;
        white-space: nowrap;
    }

    #organisation .review-filter > li:first-child > .change-type {
        border-left-width: 1px;
        border-radius: var(--quick-tickets-radius-small) 0 0 var(--quick-tickets-radius-small);
    }

    #organisation .review-filter > li:last-child > .change-type {
        border-radius: 0 var(--quick-tickets-radius-small) var(--quick-tickets-radius-small) 0;
    }

    #organisation .review-filter > li.active > .change-type {
        padding-left: 12px;
        border-color: var(--quick-tickets-color-brand);
        background: var(--quick-tickets-color-brand);
        color: #fff;
    }

    #organisation .review-filter > li.active > .change-type .qxf {
        color: #fff;
    }

    #organisation .reviews-list {
        padding-top: 12px;
    }

    #organisation .reviews-list > .item > .review {
        padding: 12px;
    }

    #organisation .reviews-list .item .h .d {
        flex-basis: 100%;
        margin-left: 0;
        padding-left: 30px;
        box-sizing: border-box;
    }

    #organisation .reviews-list .answer .h .d {
        margin-left: 0;
        padding-left: 0;
    }

    #organisation .reviews-list .answer {
        margin-left: 12px;
        padding: 12px;
    }

    /* Компактные вкладки полностью помещаются на экране без горизонтальной прокрутки */
    #organisation .review-filter {
        overflow-x: visible;
    }

    #organisation .review-filter > li {
        flex: 1 1 0;
        min-width: 0;
    }

    #organisation .review-filter > li > .change-type {
        justify-content: center;
        min-width: 0;
        padding-right: 10px;
        padding-left: 10px;
    }

    #organisation .review-filter > li.active > .change-type {
        padding-left: 10px;
    }

    #organisation .review-filter > li > .change-type > span {
        display: none;
    }
}
