.open-chat {
    display: none;
}

.legacy-chat {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 2147483000;
    font-family: Arial, Helvetica, sans-serif;
    color: #24323d;
}

.legacy-chat--hidden {
    display: none;
}

.legacy-chat__toggle {
    position: relative;
    width: 58px;
    height: 58px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: #244b63;
    color: #fff;
    box-shadow: 0 5px 18px rgba(0, 0, 0, .24);
    cursor: pointer;
}

.legacy-chat__toggle--attention {
    animation: legacy-chat-attention-bounce 850ms cubic-bezier(.22, .78, .32, 1) both;
    transform-origin: 50% 100%;
    will-change: transform, box-shadow;
}

@keyframes legacy-chat-attention-bounce {
    0% {
        transform: translateY(0) scale(1);
        box-shadow: 0 5px 18px rgba(0, 0, 0, .24);
    }
    22% {
        transform: translateY(-13px) scale(1.035, .97);
        box-shadow: 0 13px 24px rgba(0, 0, 0, .18);
    }
    42% {
        transform: translateY(0) scale(.98, 1.025);
        box-shadow: 0 4px 15px rgba(0, 0, 0, .26);
    }
    59% {
        transform: translateY(-5px) scale(1.012, .992);
        box-shadow: 0 8px 19px rgba(0, 0, 0, .21);
    }
    74% {
        transform: translateY(0) scale(.995, 1.008);
    }
    88% {
        transform: translateY(-2px) scale(1.003);
    }
    100% {
        transform: translateY(0) scale(1);
        box-shadow: 0 5px 18px rgba(0, 0, 0, .24);
    }
}

@media (prefers-reduced-motion: reduce) {
    .legacy-chat__toggle--attention {
        animation: none;
    }
}

.legacy-chat__toggle:focus,
.legacy-chat__button:focus,
.legacy-chat__panel-close:focus,
.legacy-chat__end:focus,
.legacy-chat__textarea:focus {
    outline: 3px solid rgba(45, 139, 224, .35);
    outline-offset: 2px;
}

.legacy-chat__icon {
    font-size: 26px;
    line-height: 58px;
}

.legacy-chat__dot {
    position: absolute;
    top: 1px;
    right: 1px;
    width: 14px;
    height: 14px;
    border: 3px solid #fff;
    border-radius: 50%;
}

.legacy-chat__dot--green { background: #2ca45c; }
.legacy-chat__dot--lightgreen { background: #6fbd8b; }
.legacy-chat__dot--yellow { background: #e1a526; }
.legacy-chat__dot--gray { background: #89949c; }

.legacy-chat__greeting {
    display: none;
    position: absolute;
    right: 72px;
    bottom: 5px;
    width: 270px;
    max-width: calc(100vw - 110px);
    border: 1px solid #d5dfe4;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 7px 24px rgba(23, 43, 56, .2);
}

.legacy-chat__greeting--visible {
    display: flex;
    align-items: flex-start;
}

.legacy-chat__greeting::after {
    content: '';
    position: absolute;
    right: -9px;
    bottom: 16px;
    width: 16px;
    height: 16px;
    border-top: 1px solid #d5dfe4;
    border-right: 1px solid #d5dfe4;
    background: #fff;
    transform: rotate(45deg);
}

.legacy-chat__greeting-open {
    flex: 1;
    min-width: 0;
    padding: 13px 8px 13px 14px;
    border: 0;
    background: transparent;
    color: #24323d;
    text-align: left;
    cursor: pointer;
}

.legacy-chat__greeting-text {
    display: block;
    font-size: 14px;
    line-height: 1.45;
}

.legacy-chat__greeting-close {
    position: relative;
    z-index: 1;
    flex: 0 0 32px;
    width: 32px;
    height: 34px;
    padding: 0;
    border: 0;
    background: transparent;
    color: #718089;
    font-size: 20px;
    line-height: 32px;
    cursor: pointer;
}

.legacy-chat__greeting-open:focus,
.legacy-chat__greeting-close:focus {
    outline: 3px solid rgba(45, 139, 224, .35);
    outline-offset: 2px;
}

.legacy-chat__panel {
    display: none;
    position: absolute;
    right: 0;
    bottom: 70px;
    width: 350px;
    max-width: calc(100vw - 28px);
    max-height: min(560px, calc(100vh - 110px));
    overflow: hidden;
    border: 1px solid #d9e0e4;
    border-radius: 13px;
    background: #fff;
    box-shadow: 0 12px 35px rgba(23, 43, 56, .22);
}

.legacy-chat__panel--open {
    display: flex;
    flex-direction: column;
}

.legacy-chat__header,
.legacy-chat__status,
.legacy-chat__end {
    flex: 0 0 auto;
}

.legacy-chat__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    background: #244b63;
    color: #fff;
}

.legacy-chat__title {
    font-size: 16px;
}

.legacy-chat__panel-close {
    width: 32px;
    height: 32px;
    padding: 0;
    border: 0;
    background: transparent;
    color: #fff;
    font-size: 27px;
    line-height: 28px;
    cursor: pointer;
}

.legacy-chat__status {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 15px;
    border-bottom: 1px solid #e4e9ec;
    background: #f6f8f9;
    font-size: 13px;
    line-height: 1.45;
}

.legacy-chat__status-symbol {
    display: inline-flex;
    flex: 0 0 25px;
    align-items: center;
    justify-content: center;
    width: 25px;
    height: 25px;
    border-radius: 50%;
    background: #89949c;
    color: #fff;
    font-size: 16px;
    font-weight: bold;
    line-height: 1;
}

.legacy-chat__status-symbol--green { background: #2ca45c; }
.legacy-chat__status-symbol--lightgreen { background: #6fbd8b; }
.legacy-chat__status-symbol--yellow { background: #e1a526; }
.legacy-chat__status-symbol--gray { background: #89949c; }

.legacy-chat__status-symbol--waiting {
    animation: legacy-chat-waiting-pulse 1.45s ease-in-out infinite;
}

@keyframes legacy-chat-waiting-pulse {
    0%, 100% {
        transform: scale(1);
        opacity: .78;
    }
    50% {
        transform: scale(1.09);
        opacity: 1;
    }
}

@media (prefers-reduced-motion: reduce) {
    .legacy-chat__status-symbol--waiting {
        animation: none;
    }
}

.legacy-chat__status-text {
    min-width: 0;
}

.legacy-chat__messages {
    flex: 1 1 auto;
    min-height: 0;
    max-height: 275px;
    overflow-y: auto;
    padding: 13px;
    background: #fff;
}

.legacy-chat__message {
    display: flex;
    margin: 6px 0;
}

.legacy-chat__message--visitor {
    justify-content: flex-end;
}

.legacy-chat__bubble {
    max-width: 82%;
    padding: 9px 11px;
    border-radius: 12px;
    background: #eef2f4;
    font-size: 14px;
    line-height: 1.4;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.legacy-chat__message--visitor .legacy-chat__bubble {
    background: #dcecf5;
}

.legacy-chat__message-link {
    color: #17638f;
    font-weight: bold;
    text-decoration: underline;
}

.legacy-chat__message-link:hover,
.legacy-chat__message-link:focus {
    text-decoration: none;
}

.legacy-chat__typing-bubble {
    display: inline-flex;
    align-items: center;
    background: #f0f3f4;
    color: #64747d;
    font-style: italic;
}

.legacy-chat__typing-dots {
    display: inline-flex;
    margin-left: 5px;
    font-style: normal;
}

.legacy-chat__typing-dot {
    display: inline-block;
    animation: legacy-chat-typing-dot 1.2s ease-in-out infinite;
    opacity: .3;
}

.legacy-chat__typing-dot:nth-child(2) { animation-delay: .16s; }
.legacy-chat__typing-dot:nth-child(3) { animation-delay: .32s; }

@keyframes legacy-chat-typing-dot {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: .3;
    }
    30% {
        transform: translateY(-2px);
        opacity: 1;
    }
}

@media (prefers-reduced-motion: reduce) {
    .legacy-chat__typing-dot {
        animation: none;
        opacity: 1;
    }
}

.legacy-chat__start-form,
.legacy-chat__send-form,
.legacy-chat__restart-form {
    flex: 0 0 auto;
    padding: 12px 13px;
}

.legacy-chat__send-form,
.legacy-chat__restart-form {
    display: none;
    border-top: 1px solid #e4e9ec;
}

.legacy-chat__restart-button {
    width: 100%;
}

.legacy-chat__textarea {
    display: block;
    box-sizing: border-box;
    width: 100%;
    margin: 0 0 9px;
    padding: 9px 10px;
    resize: vertical;
    border: 1px solid #becbd2;
    border-radius: 7px;
    color: #24323d;
    font: inherit;
}

.legacy-chat__button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 9px 14px;
    border: 0;
    border-radius: 7px;
    background: #244b63;
    color: #fff;
    font-weight: bold;
    cursor: pointer;
}

.legacy-chat__button-icon {
    width: 20px;
    height: 20px;
    margin-right: 8px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.legacy-chat__button:disabled {
    opacity: .55;
    cursor: wait;
}

.legacy-chat__end {
    display: none;
    margin: 0 13px 13px;
    padding: 5px 0;
    border: 0;
    background: transparent;
    color: #667781;
    text-decoration: underline;
    cursor: pointer;
}

@media (max-width: 480px) {
    .legacy-chat {
        right: 14px;
        bottom: 14px;
    }

    .legacy-chat__panel {
        position: fixed;
        right: 10px;
        bottom: 82px;
        left: 10px;
        width: auto;
        max-width: none;
    }

    .legacy-chat__greeting {
        right: 0;
        bottom: 72px;
        max-width: calc(100vw - 28px);
    }

    .legacy-chat__greeting::after {
        right: 19px;
        bottom: -9px;
        transform: rotate(135deg);
    }
}
