.rvchat {
    position: fixed;
    z-index: 99990;
    right: var(--rv-side, 24px);
    bottom: var(--rv-bottom, 24px);
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    width: min(390px, calc(100vw - 2rem));
    color: #163044;
    font-family: inherit;
    font-size: 15px;
    line-height: 1.45;
}

.rvchat.is-left {
    right: auto;
    left: var(--rv-side, 24px);
    align-items: flex-start;
}

.rvchat * {
    box-sizing: border-box;
}

.rvchat-launcher {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin-left: auto;
    border: 0;
    border-radius: 999px;
    padding: 10px 16px 10px 10px;
    background: var(--rv-primary, #0096d4);
    color: #fff;
    box-shadow: 0 10px 28px rgba(0, 96, 140, 0.28);
    cursor: pointer;
    font: inherit;
    font-weight: 600;
    transform-origin: center bottom;
    transition: background 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.rvchat.is-left .rvchat-launcher {
    margin-left: 0;
    margin-right: auto;
}

.rvchat-launcher.is-nudging {
    animation: rvchat-launcher-nudge 5.6s ease-in-out infinite;
}

.rvchat-launcher.is-nudging::before {
    content: "";
    position: absolute;
    inset: -3px;
    border-radius: inherit;
    border: 1px solid rgba(255, 255, 255, 0.45);
    opacity: 0;
    pointer-events: none;
    animation: rvchat-launcher-ring 5.6s ease-out infinite;
}

.rvchat-launcher:hover,
.rvchat-launcher:focus-visible,
.rvchat-launcher[aria-expanded="true"] {
    animation: none;
}

.rvchat-launcher:hover::before,
.rvchat-launcher:focus-visible::before,
.rvchat-launcher[aria-expanded="true"]::before {
    animation: none;
    opacity: 0;
}

.rvchat-submit:hover,
.rvchat-composer button:hover,
.rvchat-whatsapp:hover {
    background: var(--rv-hover, #007bb6);
}

#rvchat .rvchat-launcher:hover,
#rvchat .rvchat-launcher:focus-visible,
#rvchat .rvchat-launcher[aria-expanded="true"] {
    background: var(--rv-hover, #007bb6);
    color: #fff;
}

.rvchat-launcher:hover {
    transform: translateY(-1px);
    box-shadow: 0 12px 30px rgba(0, 96, 140, 0.34);
}

.rvchat-launcher[aria-expanded="true"] {
    transform: none;
    box-shadow: 0 8px 20px rgba(0, 96, 140, 0.22);
}

.rvchat-avatar {
    width: 36px;
    height: 36px;
    display: inline-flex;
    flex: 0 0 36px;
    border-radius: 50%;
    overflow: hidden;
}

.rvchat-avatar svg,
.rvchat-face {
    width: 36px;
    height: 36px;
    display: block;
    overflow: visible;
}

.rvchat-face-disk {
    fill: #ffffff;
}

.rvchat-eye {
    fill: #e8f7fd;
}

.rvchat-pupil {
    fill: #0d5f86;
}

.rvchat-face-smile {
    stroke: #0d5f86;
    fill: none;
}

.rvchat-header .rvchat-face-disk {
    fill: rgba(255, 255, 255, 0.92);
}

.rvchat-launcher .rvchat-avatar {
    background: #ffffff;
    box-shadow: inset 0 0 0 1px rgba(13, 95, 134, 0.12);
}

#rvchat .rvchat-launcher:hover .rvchat-face-disk,
#rvchat .rvchat-launcher:focus-visible .rvchat-face-disk,
#rvchat .rvchat-launcher[aria-expanded="true"] .rvchat-face-disk {
    fill: #ffffff;
}

#rvchat .rvchat-launcher:hover .rvchat-pupil,
#rvchat .rvchat-launcher:focus-visible .rvchat-pupil,
#rvchat .rvchat-launcher[aria-expanded="true"] .rvchat-pupil {
    fill: #0d5f86;
}

#rvchat .rvchat-launcher:hover .rvchat-face-smile,
#rvchat .rvchat-launcher:focus-visible .rvchat-face-smile,
#rvchat .rvchat-launcher[aria-expanded="true"] .rvchat-face-smile {
    stroke: #0d5f86;
    fill: none;
}

.rvchat-launcher.is-nudging .rvchat-avatar {
    animation: rvchat-avatar-soft 5.6s ease-in-out infinite;
}

.rvchat-launcher.is-nudging .rvchat-face-eyes {
    animation: rvchat-eyes-look 5.6s ease-in-out infinite;
}

.rvchat-launcher.is-nudging .rvchat-eye-l,
.rvchat-launcher.is-nudging .rvchat-eye-r {
    animation: rvchat-blink 5.6s ease-in-out infinite;
    transform-box: fill-box;
    transform-origin: center;
}

.rvchat-launcher.is-nudging .rvchat-pupil-l,
.rvchat-launcher.is-nudging .rvchat-pupil-r {
    animation: rvchat-blink 5.6s ease-in-out infinite;
    transform-box: fill-box;
    transform-origin: center;
}

.rvchat-launcher.is-nudging .rvchat-face-smile {
    animation: rvchat-smile 5.6s ease-in-out infinite;
    transform-box: fill-box;
    transform-origin: center;
}

.rvchat-launcher:hover .rvchat-face-eyes {
    animation: rvchat-eyes-look 1.8s ease-in-out 1;
}

.rvchat-launcher:hover .rvchat-face-smile {
    animation: rvchat-smile-hello 0.9s ease-in-out 1;
    transform-box: fill-box;
    transform-origin: center;
}

.rvchat-launcher-label {
    display: inline-block;
}

@keyframes rvchat-launcher-nudge {
    0%,
    68%,
    100% {
        transform: translateY(0);
        box-shadow: 0 10px 28px rgba(0, 96, 140, 0.28);
    }
    72% {
        transform: translateY(-3px);
        box-shadow: 0 14px 32px rgba(0, 96, 140, 0.34);
    }
    78% {
        transform: translateY(0);
        box-shadow: 0 10px 28px rgba(0, 96, 140, 0.28);
    }
    83% {
        transform: translateY(-1.5px);
        box-shadow: 0 12px 30px rgba(0, 96, 140, 0.31);
    }
    88% {
        transform: translateY(0);
        box-shadow: 0 10px 28px rgba(0, 96, 140, 0.28);
    }
}

@keyframes rvchat-launcher-ring {
    0%,
    68% {
        opacity: 0;
        transform: scale(1);
    }
    72% {
        opacity: 0.55;
        transform: scale(1.02);
    }
    88%,
    100% {
        opacity: 0;
        transform: scale(1.12);
    }
}

@keyframes rvchat-avatar-soft {
    0%,
    68%,
    100% {
        transform: scale(1);
    }
    74% {
        transform: scale(1.06);
    }
    84% {
        transform: scale(1);
    }
}

@keyframes rvchat-eyes-look {
    0%,
    18%,
    100% {
        transform: translateX(0);
    }
    28% {
        transform: translateX(1.6px);
    }
    42% {
        transform: translateX(-1.4px);
    }
    55%,
    100% {
        transform: translateX(0);
    }
}

@keyframes rvchat-blink {
    0%,
    46%,
    54%,
    100% {
        transform: scaleY(1);
    }
    50% {
        transform: scaleY(0.12);
    }
}

@keyframes rvchat-smile {
    0%,
    62%,
    100% {
        transform: translateY(0) scaleX(1);
    }
    72% {
        transform: translateY(0.8px) scaleX(1.08);
    }
    82% {
        transform: translateY(0) scaleX(1);
    }
}

@keyframes rvchat-smile-hello {
    0%,
    100% {
        transform: scaleX(1) translateY(0);
    }
    45% {
        transform: scaleX(1.12) translateY(1px);
    }
}

.rvchat-panel {
    width: 100%;
    max-height: min(640px, calc(100dvh - 110px));
    display: flex;
    flex-direction: column;
    margin-bottom: 12px;
    background: #f7fbfd;
    border: 1px solid var(--rv-border, #b7e4f4);
    border-radius: 20px;
    box-shadow: 0 16px 64px rgba(12, 48, 72, 0.22);
    overflow: hidden;
}

.rvchat-panel[hidden],
.rvchat-enquiry[hidden],
.rvchat-thanks[hidden],
.rvchat-bottom[hidden],
.rvchat-suggestions[hidden],
.rvchat-error[hidden],
.rvchat-whatsapp[hidden] {
    display: none !important;
}

.rvchat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex: 0 0 auto;
    padding: 14px 14px 14px 16px;
    background: var(--rv-primary, #0096d4);
    color: #fff;
}

.rvchat-identity {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    flex: 1 1 auto;
}

.rvchat-identity strong,
.rvchat-identity span {
    display: block;
}

.rvchat-identity strong {
    font-size: 15px;
}

.rvchat-identity span {
    margin-top: 2px;
    font-size: 12px;
    opacity: 0.9;
}

#rvchat .rvchat-icon {
    overflow: visible;
    flex: 0 0 auto;
}

#rvchat .rvchat-icon path {
    fill: currentColor;
    stroke: none;
}

.rvchat-close,
.rvchat-back,
.rvchat-new,
.rvchat-contact {
    border: 0;
    background: transparent;
    font: inherit;
    cursor: pointer;
}

#rvchat .rvchat-close {
    flex: 0 0 auto;
    width: 40px;
    height: 40px;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.22);
    color: #fff;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.35);
    line-height: 0;
}

#rvchat .rvchat-close .rvchat-icon {
    width: 18px;
    height: 18px;
    display: block;
    fill: #ffffff;
    color: #ffffff;
}

#rvchat .rvchat-close:hover,
#rvchat .rvchat-close:focus-visible {
    background: rgba(255, 255, 255, 0.34);
}

.rvchat-log {
    overflow-y: auto;
    overscroll-behavior: contain;
    flex: 1 1 auto;
    min-height: 0;
    padding: 16px;
}

.rvchat-bubble {
    margin: 0 0 10px;
    padding: 12px 14px;
    border-radius: 14px;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.rvchat-bubble.is-assistant {
    background: var(--rv-soft, #e7f6fc);
}

.rvchat-bubble.is-user {
    background: var(--rv-primary, #0096d4);
    color: #fff;
    margin-left: 32px;
}

.rvchat-bubble a {
    color: inherit;
}

.rvchat-who {
    display: block;
    margin-bottom: 4px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.rvchat-typing {
    opacity: 0.7;
}

.rvchat-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 0 16px 12px;
}

.rvchat-suggestions button {
    border: 1px solid var(--rv-border, #b7e4f4);
    background: #fff;
    color: var(--rv-primary, #0096d4);
    border-radius: 999px;
    padding: 7px 10px;
    font: inherit;
    font-size: 13px;
    cursor: pointer;
}

.rvchat-suggestions button:hover {
    background: var(--rv-soft, #e7f6fc);
}

.rvchat-bottom {
    flex: 0 0 auto;
    padding: 12px 16px 14px;
    border-top: 1px solid var(--rv-border, #b7e4f4);
}

.rvchat-enquiry,
.rvchat-thanks {
    position: relative;
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
    padding: 12px 16px 14px;
    border-top: 1px solid var(--rv-border, #b7e4f4);
}

.rvchat-notice,
.rvchat-hours,
.rvchat-thanks p {
    margin: 0 0 10px;
    color: #5b6b7c;
    font-size: 12px;
    line-height: 1.5;
}

.rvchat-notice a,
.rvchat-consent a,
.rvchat-contact {
    color: var(--rv-hover, #007bb6);
}

.rvchat-composer {
    display: flex;
    gap: 8px;
}

.rvchat-composer input,
.rvchat-enquiry input,
.rvchat-enquiry textarea,
.rvchat-enquiry select {
    width: 100%;
    border: 1px solid var(--rv-border, #b7e4f4);
    background: #fff;
    color: #163044;
    border-radius: 10px;
    padding: 10px 12px;
    font: inherit;
}

.rvchat-composer input {
    min-width: 0;
    flex: 1;
}

.rvchat-composer button,
.rvchat-submit,
.rvchat-whatsapp {
    border: 0;
    border-radius: 10px;
    background: var(--rv-primary, #0096d4);
    color: #fff;
    cursor: pointer;
}

#rvchat .rvchat-send {
    flex: 0 0 48px;
    width: 48px;
    height: 44px;
    min-width: 48px;
    padding: 0;
    margin: 0;
    border: 0;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--rv-primary, #0096d4);
    color: #fff;
    line-height: 0;
}

#rvchat .rvchat-send .rvchat-icon {
    width: 20px;
    height: 20px;
    display: block;
    fill: #ffffff;
    color: #ffffff;
}

#rvchat .rvchat-send:hover:not(:disabled),
#rvchat .rvchat-send:focus-visible:not(:disabled) {
    background: var(--rv-hover, #007bb6);
}

#rvchat .rvchat-send:disabled {
    opacity: 1;
    cursor: default;
    background: #9ecfe6;
}

#rvchat .rvchat-send:disabled .rvchat-icon {
    fill: #ffffff;
    opacity: 0.95;
}

.rvchat button:disabled {
    cursor: default;
}

.rvchat-submit:disabled,
.rvchat-composer button:disabled:not(.rvchat-send) {
    opacity: 0.55;
}

.rvchat-contact,
.rvchat-new,
.rvchat-back {
    display: block;
    margin-top: 8px;
    padding: 0;
    text-align: left;
    font-size: 13px;
}

.rvchat-new,
.rvchat-back {
    color: #5b6b7c;
    text-decoration: underline;
}

.rvchat-enquiry h3,
.rvchat-thanks h3 {
    margin: 0 0 6px;
    font-size: 16px;
}

.rvchat-enquiry label {
    display: grid;
    gap: 4px;
    margin: 10px 0;
    font-size: 13px;
    font-weight: 700;
}

.rvchat-enquiry label span {
    font-weight: 500;
    color: #5b6b7c;
}

.rvchat-consent {
    display: flex !important;
    grid-template-columns: none;
    gap: 8px;
    align-items: flex-start;
    font-weight: 500 !important;
}

.rvchat-consent input {
    width: auto;
    margin-top: 3px;
}

.rvchat-submit,
.rvchat-whatsapp {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 12px 14px;
    font: inherit;
    font-weight: 700;
    text-decoration: none;
}

.rvchat-error {
    color: #9f1d1d;
    font-size: 13px;
    margin: 0 0 8px;
}

.rvchat-honey {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.rvchat a:focus-visible,
.rvchat button:focus-visible,
.rvchat input:focus-visible,
.rvchat textarea:focus-visible,
.rvchat select:focus-visible {
    outline: 3px solid var(--rv-primary, #0096d4);
    outline-offset: 2px;
}

.rvchat-header button:focus-visible {
    outline-color: #fff;
}

@media (max-width: 640px) {
    .rvchat {
        left: max(10px, env(safe-area-inset-left));
        right: max(10px, env(safe-area-inset-right));
        bottom: max(10px, env(safe-area-inset-bottom));
        width: auto;
        align-items: stretch;
    }

    .rvchat-launcher {
        align-self: flex-end;
    }

    .rvchat.is-left .rvchat-launcher {
        align-self: flex-start;
    }
}

@media (prefers-reduced-motion: reduce) {
    .rvchat * {
        scroll-behavior: auto !important;
        animation: none !important;
        transition: none !important;
    }

    .rvchat-launcher.is-nudging,
    .rvchat-launcher.is-nudging::before,
    .rvchat-launcher.is-nudging .rvchat-avatar,
    .rvchat-launcher.is-nudging .rvchat-face-eyes,
    .rvchat-launcher.is-nudging .rvchat-eye-l,
    .rvchat-launcher.is-nudging .rvchat-eye-r,
    .rvchat-launcher.is-nudging .rvchat-pupil-l,
    .rvchat-launcher.is-nudging .rvchat-pupil-r,
    .rvchat-launcher.is-nudging .rvchat-face-smile,
    .rvchat-launcher:hover .rvchat-face-eyes,
    .rvchat-launcher:hover .rvchat-face-smile {
        animation: none !important;
    }

    .rvchat-launcher:hover {
        transform: none;
    }
}
