.rr-chatbot {
    --rr-chat-blue: #2563eb;
    position: fixed;
    right: max(22px, env(safe-area-inset-right));
    bottom: max(22px, env(safe-area-inset-bottom));
    z-index: 10000;
    font-family: inherit;
}

.rr-chatbot__launcher {
    display: grid;
    width: 62px;
    height: 62px;
    place-items: center;
    border: 0;
    border-radius: 50%;
    color: #fff;
    background: linear-gradient(145deg, #3b82f6, #1d4ed8);
    box-shadow: 0 10px 30px rgb(37 99 235 / 35%);
    cursor: pointer;
    transition: transform 180ms ease, box-shadow 180ms ease;
}

.rr-chatbot__launcher:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 34px rgb(37 99 235 / 42%);
}

.rr-chatbot__launcher:focus-visible,
.rr-chatbot button:focus-visible,
.rr-chatbot textarea:focus-visible {
    outline: 3px solid #93c5fd;
    outline-offset: 3px;
}

.rr-chatbot__launcher svg { width: 28px; height: 28px; }

.rr-chatbot__panel {
    position: absolute;
    right: 0;
    bottom: 76px;
    display: flex;
    width: min(390px, calc(100vw - 32px));
    height: min(560px, calc(100dvh - 120px));
    min-height: 360px;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid #e2e8f0;
    border-radius: 20px;
    background: #fff;
    box-shadow: 0 24px 70px rgb(15 23 42 / 22%);
    transform-origin: bottom right;
    animation: rr-chat-enter 160ms ease-out;
}

.rr-chatbot__panel[hidden] { display: none; }

@keyframes rr-chat-enter {
    from { opacity: 0; transform: translateY(8px) scale(.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.rr-chatbot__header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 18px;
    color: #fff;
    background: linear-gradient(120deg, #1e40af, #2563eb);
}

.rr-chatbot__avatar {
    display: grid;
    width: 40px;
    height: 40px;
    flex: 0 0 40px;
    place-items: center;
    border: 1px solid rgb(255 255 255 / 24%);
    border-radius: 14px;
    background: rgb(255 255 255 / 15%);
}

.rr-chatbot__avatar svg { width: 23px; height: 23px; }
.rr-chatbot__heading { min-width: 0; flex: 1; }
.rr-chatbot__heading strong { display: block; font-size: 15px; line-height: 1.35; }
.rr-chatbot__heading span { display: block; margin-top: 2px; color: #dbeafe; font-size: 12px; }

.rr-chatbot__close {
    display: grid;
    width: 34px;
    height: 34px;
    place-items: center;
    border: 0;
    border-radius: 10px;
    color: #fff;
    background: transparent;
    cursor: pointer;
}

.rr-chatbot__close:hover { background: rgb(255 255 255 / 15%); }
.rr-chatbot__close svg { width: 19px; height: 19px; }

.rr-chatbot__messages {
    display: flex;
    flex: 1;
    min-height: 0;
    flex-direction: column;
    gap: 12px;
    overflow-y: auto;
    padding: 18px 16px;
    background: #f8fafc;
    scroll-behavior: smooth;
}

.rr-chatbot__message {
    max-width: 88%;
    padding: 11px 13px;
    border-radius: 15px;
    color: #1e293b;
    background: #fff;
    box-shadow: 0 1px 3px rgb(15 23 42 / 8%);
    font-size: 13px;
    line-height: 1.55;
    overflow-wrap: anywhere;
    white-space: pre-wrap;
}

.rr-chatbot__message--assistant { align-self: flex-start; border-top-left-radius: 5px; }
.rr-chatbot__message--user { align-self: flex-end; border-top-right-radius: 5px; color: #fff; background: var(--rr-chat-blue); }
.rr-chatbot__message--status { color: #64748b; font-style: italic; }

.rr-chatbot__options {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 12px 14px 15px;
    border-top: 1px solid #e2e8f0;
    background: #fff;
}

.rr-chatbot__option {
    padding: 8px 11px;
    border: 1px solid #bfdbfe;
    border-radius: 999px;
    color: #1d4ed8;
    background: #eff6ff;
    font: inherit;
    font-size: 12px;
    line-height: 1.3;
    cursor: pointer;
    transition: background 150ms ease, border-color 150ms ease;
}

.rr-chatbot__option:hover { border-color: #93c5fd; background: #dbeafe; }

@media (max-width: 480px) {
    .rr-chatbot { right: max(16px, env(safe-area-inset-right)); bottom: max(16px, env(safe-area-inset-bottom)); }
    .rr-chatbot__launcher { width: 58px; height: 58px; }
    .rr-chatbot__panel { position: fixed; right: 12px; bottom: max(84px, calc(env(safe-area-inset-bottom) + 76px)); width: calc(100vw - 24px); height: min(600px, calc(100dvh - 110px)); }
}

@media (prefers-reduced-motion: reduce) {
    .rr-chatbot__panel { animation: none; }
    .rr-chatbot__launcher { transition: none; }
    .rr-chatbot__messages { scroll-behavior: auto; }
}
