:root {
    --vdnl-chat-forest: #173f35;
    --vdnl-chat-forest-dark: #0f3029;
    --vdnl-chat-sage: #dce5d8;
    --vdnl-chat-sage-light: #edf2ea;
    --vdnl-chat-cream: #faf7ef;
    --vdnl-chat-white: #ffffff;
    --vdnl-chat-ink: #1b2521;
    --vdnl-chat-muted: #64706a;
    --vdnl-chat-line: #dce2dc;
    --vdnl-chat-ochre: #c26e2e;
    --vdnl-chat-focus: #ec9c45;
}

#vdnl-chatbot-root,
#vdnl-chatbot-root * {
    box-sizing: border-box;
}

#vdnl-chatbot-root {
    position: relative;
    z-index: 999999;
    color: var(--vdnl-chat-ink);
    font-family: Lato, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 16px;
    line-height: 1.5;
}

.vdnl-chatbot-sr-only {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

.vdnl-chatbot-bubble {
    position: fixed;
    right: max(20px, env(safe-area-inset-right));
    bottom: max(20px, env(safe-area-inset-bottom));
    width: 62px;
    height: 62px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    color: var(--vdnl-chat-white);
    background: var(--vdnl-chat-forest);
    box-shadow: 0 12px 32px rgba(15, 48, 41, 0.27);
    cursor: pointer;
    display: grid;
    place-items: center;
    transition: opacity 160ms ease, transform 180ms ease, background-color 180ms ease, box-shadow 180ms ease;
}

.vdnl-chatbot-bubble[aria-expanded="true"] {
    opacity: 0;
    pointer-events: none;
    transform: translateY(8px) scale(0.9);
}

.vdnl-chatbot-bubble:hover {
    color: var(--vdnl-chat-white);
    background: var(--vdnl-chat-forest-dark);
    box-shadow: 0 15px 36px rgba(15, 48, 41, 0.34);
    transform: translateY(-2px);
}

.vdnl-chatbot-bubble:focus-visible,
.vdnl-chatbot-header button:focus-visible,
.vdnl-chatbot-send:focus-visible,
.vdnl-chatbot-input:focus-visible,
.vdnl-chatbot-link-button:focus-visible {
    outline: 3px solid var(--vdnl-chat-focus);
    outline-offset: 3px;
}

.vdnl-chatbot-bubble > svg {
    position: relative;
    z-index: 1;
    width: 31px;
    height: 31px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.vdnl-chatbot-bubble-pulse {
    position: absolute;
    inset: -1px;
    border: 2px solid rgba(23, 63, 53, 0.35);
    border-radius: inherit;
    animation: vdnl-chatbot-pulse 2.8s ease-out infinite;
    pointer-events: none;
}

@keyframes vdnl-chatbot-pulse {
    0%, 45% {
        opacity: 0.65;
        transform: scale(1);
    }
    90%, 100% {
        opacity: 0;
        transform: scale(1.35);
    }
}

.vdnl-chatbot-modal {
    position: fixed;
    inset: 0;
    z-index: 999998;
    display: flex;
    align-items: flex-end;
    justify-content: flex-end;
    padding: 20px;
    visibility: hidden;
    opacity: 0;
    background: rgba(15, 30, 25, 0.22);
    pointer-events: none;
    transition: opacity 180ms ease, visibility 180ms ease;
}

.vdnl-chatbot-modal.is-open {
    visibility: visible;
    opacity: 1;
    pointer-events: auto;
}

.vdnl-chatbot-dialog {
    width: min(540px, calc(100vw - 40px));
    height: min(720px, calc(100dvh - 40px));
    min-height: 520px;
    max-width: none;
    margin: 0;
    padding: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    gap: 0;
    border: 1px solid rgba(23, 63, 53, 0.14);
    border-radius: 20px;
    background: var(--vdnl-chat-white);
    box-shadow: 0 24px 70px rgba(15, 48, 41, 0.24);
    opacity: 0;
    transform: translateY(14px) scale(0.985);
    transform-origin: right bottom;
    transition: opacity 180ms ease, transform 180ms ease;
}

.vdnl-chatbot-modal.is-open .vdnl-chatbot-dialog {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.vdnl-chatbot-header {
    flex: 0 0 70px;
    width: 100%;
    max-width: none;
    min-height: 70px;
    margin: 0;
    padding: 11px 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    color: var(--vdnl-chat-white);
    background: linear-gradient(135deg, var(--vdnl-chat-forest) 0%, var(--vdnl-chat-forest-dark) 100%);
}

.vdnl-chatbot-brand {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.vdnl-chatbot-logo {
    flex: 0 0 42px;
    width: 42px;
    height: 42px;
    padding: 4px;
    border: 1px solid rgba(255, 255, 255, 0.42);
    border-radius: 12px;
    background: var(--vdnl-chat-white);
    object-fit: contain;
}

.vdnl-chatbot-logo-fallback {
    padding: 7px;
    color: var(--vdnl-chat-forest);
    display: grid;
    place-items: center;
}

.vdnl-chatbot-logo-fallback svg {
    width: 100%;
    height: 100%;
}

.vdnl-chatbot-brand-text {
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.vdnl-chatbot-title {
    overflow: hidden;
    color: inherit;
    font-size: 15px;
    font-weight: 750;
    line-height: 1.25;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.vdnl-chatbot-subtitle {
    margin-top: 3px;
    overflow: hidden;
    display: flex;
    align-items: center;
    gap: 6px;
    color: rgba(255, 255, 255, 0.82);
    font-size: 11.5px;
    line-height: 1.25;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.vdnl-chatbot-subtitle i {
    flex: 0 0 7px;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #9bd18a;
    box-shadow: 0 0 0 2px rgba(155, 209, 138, 0.17);
}

.vdnl-chatbot-header-actions {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 4px;
}

.vdnl-chatbot-header button {
    width: 36px;
    height: 36px;
    padding: 7px;
    border: 0;
    border-radius: 10px;
    color: var(--vdnl-chat-white);
    background: transparent;
    cursor: pointer;
    display: grid;
    place-items: center;
    transition: background-color 160ms ease;
}

.vdnl-chatbot-header button:hover {
    color: var(--vdnl-chat-white);
    background: rgba(255, 255, 255, 0.13);
}

.vdnl-chatbot-header button svg {
    width: 22px;
    height: 22px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.vdnl-chatbot-messages {
    flex: 1 1 auto;
    width: 100%;
    max-width: none;
    min-height: 0;
    margin: 0;
    padding: 14px 14px 9px;
    overflow-x: hidden;
    overflow-y: auto;
    display: block;
    gap: 0;
    overscroll-behavior: contain;
    background:
        radial-gradient(circle at 0 0, rgba(220, 229, 216, 0.55), transparent 34%),
        var(--vdnl-chat-cream);
    scrollbar-color: #b9c5bc transparent;
    scrollbar-width: thin;
}

.vdnl-chatbot-message {
    width: fit-content;
    max-width: 92%;
    margin: 0 0 10px;
    padding: 10px 12px;
    border-radius: 16px;
    font-size: 14.5px;
    line-height: 1.5;
    overflow-wrap: anywhere;
}

.vdnl-chatbot-message-bot {
    margin-right: auto;
    border: 1px solid var(--vdnl-chat-line);
    border-bottom-left-radius: 5px;
    color: var(--vdnl-chat-ink);
    background: var(--vdnl-chat-white);
    box-shadow: 0 2px 8px rgba(23, 63, 53, 0.05);
}

.vdnl-chatbot-message-user {
    margin-left: auto;
    border-bottom-right-radius: 5px;
    color: var(--vdnl-chat-white);
    background: var(--vdnl-chat-forest);
}

.vdnl-chatbot-message-label {
    display: block;
    margin-bottom: 3px;
    color: var(--vdnl-chat-forest);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.06em;
    line-height: 1.2;
    text-transform: uppercase;
}

.vdnl-chatbot-message-content strong {
    font-weight: 750;
}

.vdnl-chatbot-message-content em {
    font-style: italic;
}

.vdnl-chatbot-link-button {
    width: fit-content;
    max-width: 100%;
    min-height: 34px;
    margin: 8px 0 2px;
    padding: 6px 11px;
    border: 1px solid var(--vdnl-chat-ochre);
    border-radius: 999px;
    color: #7e3d14 !important;
    background: #fff8f1;
    display: inline-flex;
    align-items: center;
    font-size: 11.5px;
    font-weight: 750;
    line-height: 1.25;
    text-decoration: none !important;
    transition: color 150ms ease, background-color 150ms ease;
}

.vdnl-chatbot-link-button::after {
    content: "→";
    margin-left: 6px;
    font-size: 14px;
}

.vdnl-chatbot-link-button:hover {
    color: var(--vdnl-chat-white) !important;
    background: var(--vdnl-chat-ochre);
}

.vdnl-chatbot-typing {
    width: fit-content;
    margin: 2px 0 12px;
    padding: 8px 11px;
    border: 1px solid var(--vdnl-chat-line);
    border-radius: 14px 14px 14px 5px;
    color: var(--vdnl-chat-muted);
    background: rgba(255, 255, 255, 0.86);
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 11.5px;
}

.vdnl-chatbot-typing-dots {
    display: inline-flex;
    align-items: center;
    gap: 3px;
}

.vdnl-chatbot-typing-dots i {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--vdnl-chat-forest);
    animation: vdnl-chatbot-dot 1.2s ease-in-out infinite;
}

.vdnl-chatbot-typing-dots i:nth-child(2) {
    animation-delay: 150ms;
}

.vdnl-chatbot-typing-dots i:nth-child(3) {
    animation-delay: 300ms;
}

@keyframes vdnl-chatbot-dot {
    0%, 60%, 100% {
        opacity: 0.28;
        transform: translateY(0);
    }
    30% {
        opacity: 1;
        transform: translateY(-3px);
    }
}

.vdnl-chatbot-form {
    flex: 0 0 auto;
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 9px 10px 8px;
    border-top: 1px solid var(--vdnl-chat-line);
    background: var(--vdnl-chat-white);
}

.vdnl-chatbot-composer {
    min-height: 46px;
    padding: 4px 4px 4px 14px;
    border: 1px solid #bfcac1;
    border-radius: 16px;
    display: flex;
    align-items: flex-end;
    gap: 7px;
    transition: border-color 150ms ease, box-shadow 150ms ease;
}

.vdnl-chatbot-composer:focus-within {
    border-color: var(--vdnl-chat-forest);
    box-shadow: 0 0 0 3px rgba(23, 63, 53, 0.11);
}

.vdnl-chatbot-input {
    flex: 1 1 auto;
    width: 100%;
    min-width: 0;
    min-height: 36px;
    max-height: 112px;
    margin: 0;
    padding: 7px 0 5px;
    resize: none;
    overflow-y: auto;
    border: 0 !important;
    border-radius: 0;
    outline: 0 !important;
    color: var(--vdnl-chat-ink);
    background: transparent !important;
    box-shadow: none !important;
    font: inherit;
    font-size: 14px;
    line-height: 1.45;
}

.vdnl-chatbot-input::placeholder {
    color: #77827d;
    opacity: 1;
}

.vdnl-chatbot-input:disabled {
    cursor: wait;
    opacity: 0.68;
}

.vdnl-chatbot-send {
    flex: 0 0 38px;
    width: 38px;
    height: 38px;
    margin: 0;
    padding: 8px;
    border: 0;
    border-radius: 12px;
    color: var(--vdnl-chat-white);
    background: var(--vdnl-chat-forest);
    cursor: pointer;
    display: grid;
    place-items: center;
    transition: background-color 150ms ease, transform 150ms ease, opacity 150ms ease;
}

.vdnl-chatbot-send:hover:not(:disabled) {
    color: var(--vdnl-chat-white);
    background: var(--vdnl-chat-forest-dark);
    transform: translateY(-1px);
}

.vdnl-chatbot-send:disabled {
    cursor: wait;
    opacity: 0.48;
}

.vdnl-chatbot-send svg {
    width: 21px;
    height: 21px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.vdnl-chatbot-disclaimer {
    margin: 6px 2px 0;
    color: var(--vdnl-chat-muted);
    font-size: 9.5px;
    line-height: 1.35;
    text-align: center;
}

.vdnl-chatbot-disclaimer a {
    color: var(--vdnl-chat-forest);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.vdnl-chatbot-disclaimer a:hover {
    color: var(--vdnl-chat-ochre);
}

@media (max-width: 767px) {
    body.vdnl-chatbot-open {
        overflow: hidden;
    }

    .vdnl-chatbot-bubble {
        right: max(16px, env(safe-area-inset-right));
        bottom: max(16px, env(safe-area-inset-bottom));
        width: 56px;
        height: 56px;
    }

    .vdnl-chatbot-bubble > svg {
        width: 28px;
        height: 28px;
    }

    .vdnl-chatbot-modal {
        padding: 0;
        background: rgba(15, 30, 25, 0.38);
    }

    .vdnl-chatbot-dialog {
        width: 100%;
        height: min(90dvh, 760px);
        min-height: min(520px, 90dvh);
        border-right: 0;
        border-bottom: 0;
        border-left: 0;
        border-radius: 20px 20px 0 0;
        transform: translateY(24px);
        transform-origin: center bottom;
    }

    .vdnl-chatbot-header {
        flex-basis: 68px;
        min-height: 68px;
        padding-top: 10px;
    }

    .vdnl-chatbot-logo {
        flex-basis: 40px;
        width: 40px;
        height: 40px;
    }

    .vdnl-chatbot-messages {
        padding: 13px 11px 8px;
    }

    .vdnl-chatbot-message {
        max-width: 94%;
    }

    .vdnl-chatbot-form {
        padding-right: max(10px, env(safe-area-inset-right));
        padding-bottom: max(8px, env(safe-area-inset-bottom));
        padding-left: max(10px, env(safe-area-inset-left));
    }
}

@media (max-width: 380px) {
    .vdnl-chatbot-title {
        max-width: 150px;
    }

    .vdnl-chatbot-subtitle {
        max-width: 150px;
    }

    .vdnl-chatbot-header-actions {
        gap: 0;
    }
}

@media (prefers-reduced-motion: reduce) {
    .vdnl-chatbot-bubble,
    .vdnl-chatbot-modal,
    .vdnl-chatbot-dialog,
    .vdnl-chatbot-send,
    .vdnl-chatbot-link-button {
        transition: none !important;
    }

    .vdnl-chatbot-bubble-pulse,
    .vdnl-chatbot-typing-dots i {
        animation: none !important;
    }
}
