.mc-webchat {
    position: fixed;
    z-index: 9998;
    font-family: inherit;
    color: #111827;
}

.mc-webchat * {
    box-sizing: border-box;
}

.mc-webchat__launcher,
.mc-webchat__teaser-message,
.mc-webchat__teaser-close,
.mc-webchat__close,
.mc-webchat__send,
.mc-webchat__option {
    font-family: inherit;
}

.mc-webchat__launcher {
    width: 64px;
    height: 64px;
    border: 0;
    border-radius: 50%;
    background: transparent;
    padding: 0;
    cursor: pointer;
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 14px 34px rgba(17, 24, 39, 0.2);
}

.mc-webchat__avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    object-fit: cover;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #ffffff;
    color: var(--mc-webchat-color);
    border: 2px solid #ffffff;
}

.mc-webchat__avatar--launcher {
    width: 64px;
    height: 64px;
    border: 3px solid var(--mc-webchat-color);
}

.mc-webchat__avatar--header {
    width: 56px;
    height: 56px;
    flex: 0 0 56px;
}

.mc-webchat__avatar--message {
    width: 34px;
    height: 34px;
    border-color: var(--mc-webchat-color);
}

.mc-webchat__avatar--fallback i {
    font-size: 22px;
}

.mc-webchat__online-dot {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #22c55e;
    border: 2px solid #ffffff;
    position: absolute;
    right: 1px;
    bottom: 4px;
}

.mc-webchat__teaser {
    position: absolute;
    right: 8px;
    bottom: 82px;
    width: min(310px, calc(100vw - 34px));
    display: flex;
    align-items: flex-start;
    gap: 6px;
}

.mc-webchat[style*="left"] .mc-webchat__teaser {
    right: auto;
    left: 8px;
}

.mc-webchat.is-open .mc-webchat__teaser,
.mc-webchat.is-teaser-hidden .mc-webchat__teaser {
    display: none;
}

.mc-webchat__teaser-message {
    width: 100%;
    border: 1px solid rgba(17, 24, 39, 0.12);
    border-radius: 8px;
    background: #ffffff;
    color: #4b5563;
    font-size: 16px;
    line-height: 1.45;
    text-align: left;
    padding: 14px 16px;
    box-shadow: 0 16px 36px rgba(17, 24, 39, 0.14);
    cursor: pointer;
}

.mc-webchat__teaser-message span,
.mc-webchat__teaser-message strong,
.mc-webchat__teaser-message small {
    display: block;
}

.mc-webchat__teaser-message strong {
    color: var(--mc-webchat-color);
    font-size: 13px;
    line-height: 1.25;
    margin-top: 8px;
}

.mc-webchat__teaser-message small {
    color: #6b7280;
    font-size: 11px;
    line-height: 1.3;
    margin-top: 6px;
}

.mc-webchat__teaser-close {
    width: 24px;
    height: 24px;
    border: 0;
    border-radius: 50%;
    background: #ffffff;
    color: #6b7280;
    cursor: pointer;
    box-shadow: 0 8px 18px rgba(17, 24, 39, 0.16);
    flex: 0 0 24px;
}

.mc-webchat__panel {
    width: min(430px, calc(100vw - 24px));
    height: min(640px, calc(100vh - 40px));
    margin-bottom: 14px;
    background: #ffffff;
    border-radius: 8px;
    box-shadow: 0 24px 72px rgba(17, 24, 39, 0.26);
    overflow: hidden;
    display: none;
    flex-direction: column;
}

.mc-webchat.is-open .mc-webchat__panel {
    display: flex;
}

.mc-webchat.is-open .mc-webchat__launcher {
    display: none;
}

.mc-webchat__header {
    background: var(--mc-webchat-color);
    color: #ffffff;
    padding: 14px 18px;
    min-height: 78px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.mc-webchat__identity {
    flex: 1;
    min-width: 0;
}

.mc-webchat__title,
.mc-webchat__subtitle {
    margin: 0;
    overflow-wrap: anywhere;
}

.mc-webchat__title {
    font-size: 17px;
    font-weight: 800;
    line-height: 1.2;
}

.mc-webchat__subtitle {
    font-size: 12px;
    font-weight: 600;
    line-height: 1.3;
    opacity: 0.95;
}

.mc-webchat__close {
    width: 30px;
    height: 30px;
    border: 2px solid #ffffff;
    border-radius: 50%;
    background: transparent;
    color: #ffffff;
    cursor: pointer;
    font-size: 20px;
    line-height: 1;
    flex: 0 0 30px;
}

.mc-webchat__body {
    flex: 1;
    min-height: 0;
    background: #ffffff;
    display: flex;
    flex-direction: column;
}

.mc-webchat__messages {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 18px 24px 12px;
    scrollbar-width: thin;
    scrollbar-color: var(--mc-webchat-color) #f3f4f6;
}

.mc-webchat__messages::-webkit-scrollbar {
    width: 6px;
}

.mc-webchat__messages::-webkit-scrollbar-track {
    background: #f3f4f6;
}

.mc-webchat__messages::-webkit-scrollbar-thumb {
    background: var(--mc-webchat-color);
    border-radius: 999px;
}

.mc-webchat__row {
    display: flex;
    gap: 8px;
    align-items: flex-end;
    margin-bottom: 12px;
}

.mc-webchat__row--visitor {
    justify-content: flex-end;
}

.mc-webchat__row-avatar {
    width: 34px;
    flex: 0 0 34px;
}

.mc-webchat__message-stack {
    max-width: 82%;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.mc-webchat__bubble {
    padding: 13px 16px;
    border-radius: 20px;
    font-size: 14px;
    line-height: 1.42;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.mc-webchat__bubble--visitor {
    background: var(--mc-webchat-color);
    color: #ffffff;
    border-bottom-right-radius: 8px;
    font-weight: 700;
}

.mc-webchat__bubble--agent {
    background: #f0f1f3;
    color: #111827;
    border-bottom-left-radius: 8px;
}

.mc-webchat__options {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: flex-end;
}

.mc-webchat__option {
    border: 0;
    border-radius: 999px;
    background: var(--mc-webchat-color);
    color: #ffffff;
    font-size: 14px;
    font-weight: 800;
    line-height: 1.25;
    padding: 12px 18px;
    cursor: pointer;
    box-shadow: 0 8px 18px rgba(17, 24, 39, 0.16);
    max-width: 100%;
    overflow-wrap: anywhere;
}

.mc-webchat__composer {
    display: flex;
    align-items: stretch;
    gap: 8px;
    padding: 10px 12px 12px;
    background: #ffffff;
}

.mc-webchat__composer.is-hidden {
    display: none;
}

.mc-webchat__field {
    width: 100%;
    min-height: 48px;
    max-height: 110px;
    resize: none;
    border: 2px solid #111827;
    border-radius: 999px;
    background: #ffffff;
    color: #111827;
    padding: 13px 16px;
    font-size: 14px;
    outline: none;
}

.mc-webchat__field:focus {
    border-color: var(--mc-webchat-color);
    box-shadow: 0 0 0 3px rgba(31, 122, 236, 0.12);
}

.mc-webchat__send {
    width: 48px;
    height: 48px;
    border: 0;
    border-radius: 50%;
    background: var(--mc-webchat-color);
    color: #ffffff;
    cursor: pointer;
    flex: 0 0 48px;
}

.mc-webchat__send:disabled,
.mc-webchat__field:disabled {
    opacity: 0.6;
    cursor: progress;
}

.mc-webchat__credit {
    height: 28px;
    border-top: 1px solid rgba(17, 24, 39, 0.08);
    background: #ffffff;
    color: #6b7280;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    font-size: 12px;
}

.mc-webchat__error {
    color: #b42318;
    background: #fff1f0;
    border: 1px solid #ffd7d2;
    border-radius: 6px;
    padding: 8px 10px;
    margin: 12px 12px 0;
    font-size: 12px;
    line-height: 1.35;
    display: none;
}

.mc-webchat.has-error .mc-webchat__error {
    display: block;
}

.mc-webchat__typing-bubble {
    width: 66px;
    height: 42px;
    border-radius: 20px;
    background: #f0f1f3;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.mc-webchat__typing-bubble span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #c7c9ce;
    animation: mc-webchat-typing 1s infinite ease-in-out;
}

.mc-webchat__typing-bubble span:nth-child(2) {
    animation-delay: 0.15s;
}

.mc-webchat__typing-bubble span:nth-child(3) {
    animation-delay: 0.3s;
}

@keyframes mc-webchat-typing {
    0%,
    80%,
    100% {
        transform: translateY(0);
        opacity: 0.45;
    }

    40% {
        transform: translateY(-4px);
        opacity: 1;
    }
}

@media (max-width: 575.98px) {
    .mc-webchat {
        right: 12px !important;
        left: 12px !important;
        bottom: 12px !important;
    }

    .mc-webchat__panel {
        width: 100%;
        height: min(640px, calc(100vh - 24px));
        margin-bottom: 0;
    }

    .mc-webchat__teaser {
        right: 0;
        left: 0;
        width: 100%;
    }

    .mc-webchat__message-stack {
        max-width: 86%;
    }

    .mc-webchat__messages {
        padding: 16px 12px 10px;
    }
}
