.rmc-chatbot {
    position: fixed;
    right: 24px;
    bottom: 88px;
    z-index: 99999;
    width: min(calc(100vw - 32px), 430px);
    color: #1f2328;
    font: 15px/1.45 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.rmc-chatbot__panel {
    border: 1px solid #d8dee4;
    border-radius: 8px;
    background: #ffffff;
    box-shadow: 0 20px 60px rgba(20, 30, 45, 0.22);
    overflow: hidden;
    transform-origin: bottom right;
    transition: opacity 160ms ease, transform 160ms ease, visibility 160ms ease;
}

.rmc-chatbot--closed .rmc-chatbot__panel {
    visibility: hidden;
    opacity: 0;
    transform: translateY(12px) scale(0.98);
    pointer-events: none;
}

.rmc-chatbot--open .rmc-chatbot__panel {
    visibility: visible;
    opacity: 1;
    transform: translateY(0) scale(1);
}

.rmc-chatbot__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 14px;
    border-bottom: 1px solid #d8dee4;
    background: #f6f8fa;
}

.rmc-chatbot__close {
    width: 32px;
    height: 32px;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: #57606a;
    cursor: pointer;
    font-size: 24px;
    line-height: 1;
}

.rmc-chatbot__close:hover,
.rmc-chatbot__close:focus {
    background: #eaeef2;
    color: #1f2328;
}

.rmc-chatbot__messages {
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 300px;
    max-height: min(520px, calc(100vh - 230px));
    padding: 14px;
    overflow-y: auto;
}

.rmc-chatbot__message {
    max-width: 88%;
    padding: 10px 12px;
    border-radius: 8px;
    overflow-wrap: anywhere;
    white-space: pre-line;
}

.rmc-chatbot__message-body {
    white-space: normal;
}

.rmc-chatbot__message-body p {
    margin: 0 0 8px;
}

.rmc-chatbot__message-body p:last-child {
    margin-bottom: 0;
}

.rmc-chatbot__message-body ul {
    margin: 6px 0 8px;
    padding-left: 18px;
}

.rmc-chatbot__message-body li {
    margin: 3px 0;
}

.rmc-chatbot__message--assistant {
    align-self: flex-start;
    background: #eef6ff;
}

.rmc-chatbot__message--user {
    align-self: flex-end;
    background: #2f6fed;
    color: #ffffff;
}

.rmc-chatbot__sources {
    margin: 8px 0 0;
    padding-left: 18px;
    font-size: 13px;
}

.rmc-chatbot__lead {
    align-self: flex-start;
    width: min(100%, 320px);
    padding: 12px;
    border: 1px solid #d8dee4;
    border-radius: 8px;
    background: #ffffff;
}

.rmc-chatbot__lead-form {
    display: grid;
    gap: 8px;
}

.rmc-chatbot__lead-form input,
.rmc-chatbot__lead-form textarea {
    width: 100%;
    border: 1px solid #d8dee4;
    border-radius: 6px;
    padding: 9px 10px;
    font: inherit;
}

.rmc-chatbot__lead-form button {
    justify-self: end;
    border: 0;
    border-radius: 6px;
    background: #2f6fed;
    color: #ffffff;
    cursor: pointer;
    padding: 9px 14px;
    font-weight: 700;
}

.rmc-chatbot__lead-form button:disabled {
    cursor: wait;
    opacity: 0.75;
}

.rmc-chatbot__form {
    display: grid;
    grid-template-columns: 1fr 48px;
    gap: 8px;
    padding: 12px;
    border-top: 1px solid #d8dee4;
}

.rmc-chatbot__form textarea {
    min-height: 44px;
    max-height: 96px;
    padding: 10px 12px;
    border: 1px solid #d8dee4;
    border-radius: 6px;
    resize: vertical;
}

.rmc-chatbot__form button {
    width: 48px;
    min-width: 48px;
    height: 48px;
    border: 0;
    border-radius: 6px;
    background: #2f6fed;
    color: #ffffff;
    cursor: pointer;
    font-size: 22px;
    font-weight: 700;
    line-height: 1;
}

.rmc-chatbot__form button:hover,
.rmc-chatbot__form button:focus {
    background: #245fd0;
}

.rmc-chatbot__privacy {
    padding: 0 12px 10px;
    color: #6b7280;
    font-size: 11px;
    line-height: 1.35;
}

.rmc-chatbot__launcher {
    position: absolute;
    right: 0;
    bottom: 0;
    width: 60px;
    height: 60px;
    border: 0;
    border-radius: 50%;
    background: #2f6fed;
    color: #ffffff;
    box-shadow: 0 14px 36px rgba(47, 111, 237, 0.38);
    cursor: pointer;
    font-size: 22px;
    font-weight: 700;
    line-height: 1;
    transition: transform 140ms ease, box-shadow 140ms ease, background 140ms ease;
}

.rmc-chatbot__launcher span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

.rmc-chatbot__launcher:hover,
.rmc-chatbot__launcher:focus {
    background: #245fd0;
    box-shadow: 0 16px 40px rgba(47, 111, 237, 0.46);
    transform: translateY(-2px);
}

.rmc-chatbot--open .rmc-chatbot__launcher {
    transform: scale(0);
    pointer-events: none;
}

@media (max-width: 520px) {
    .rmc-chatbot {
        right: 16px;
        bottom: 84px;
        width: calc(100vw - 32px);
    }

    .rmc-chatbot__messages {
        max-height: min(420px, calc(100vh - 260px));
    }

    .rmc-chatbot__launcher {
        width: 56px;
        height: 56px;
    }
}
