.c-chat {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 50;
    display: flex;
    flex-direction: column;
    width: 360px;
    overflow: hidden;
    border-radius: 16px;
    background-color: var(--color-white, #fff);
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.18);
}

.c-chat__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    height: 52px;
    padding: 0 16px;
    border: 0;
    background-color: var(--body-color, #1a1a1a);
    color: var(--color-white, #fff);
    cursor: pointer;
}

.c-chat__title {
    font-family: var(--font-family-second);
    font-size: 16px;
    font-weight: 600;
    line-height: 1.2;
}

.c-chat__chevron {
    flex-shrink: 0;
    fill: currentColor;
    transform: rotate(180deg);
    transition: transform 0.2s ease;
}

.c-chat.is-open .c-chat__chevron {
    transform: rotate(0deg);
}

.c-chat__body {
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    pointer-events: none;
    transition: max-height 0.25s ease, opacity 0.2s ease;
}

.c-chat.is-open .c-chat__body {
    max-height: 640px;
    opacity: 1;
    pointer-events: auto;
}

.c-chat__thread {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 280px;
    padding: 16px 16px 0;
    overflow-y: auto;
}

.c-chat__thread[hidden] {
    display: none;
}

.c-chat__msg {
    max-width: 90%;
    align-self: flex-start;
    padding: 8px 10px;
    border-radius: 10px;
    background-color: #f4f4f6;
}

.c-chat__msg--manager {
    align-self: flex-end;
    background-color: #e8f0e4;
}

.c-chat__msg-meta {
    margin-bottom: 4px;
    font-size: 11px;
    line-height: 1.2;
    color: #888;
}

.c-chat__msg-text {
    font-size: 14px;
    line-height: 1.4;
    white-space: pre-wrap;
    word-break: break-word;
}

.c-chat__form {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 16px;
    background-color: var(--color-white, #fff);
}

.c-chat__contacts {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.c-chat__contacts[hidden] {
    display: none;
}

.c-chat__form .ui-input--textarea .ui-input__field {
    min-height: 80px;
}

.c-chat__form .ui-button {
    margin-top: 4px;
}

.c-chat__errors {
    margin: 0;
    font-size: 14px;
    line-height: 1.4;
    color: var(--color-red, #c0392b);
}

.c-chat__status {
    margin: 0;
    font-size: 14px;
    line-height: 1.4;
    color: var(--primary-color);
}

body:has(.c-chat) .c-scroll-top {
    bottom: 84px;
}

@media (max-width: 575.98px) {
    .c-chat {
        right: 12px;
        left: 12px;
        bottom: 12px;
        width: auto;
    }

    body:has(.c-chat) .c-scroll-top {
        bottom: 76px;
        right: 12px;
    }
}

@media (max-width: 1023.98px) {
    body:has(.c-chat) .c-scroll-top {
        bottom: 76px;
    }
}
