.ds-chat,
.ds-chat * {
    box-sizing: border-box;
}

.ds-chat {
    --ds-chat-blue: #083b78;
    --ds-chat-navy: #101828;
    --ds-chat-cyan: #0ea5e9;
    --ds-chat-green: #16a34a;
    --ds-chat-border: #d9e2ef;
    --ds-chat-muted: #667085;
    --ds-chat-surface: #ffffff;
    --ds-chat-soft: #f4f8fc;
    position: fixed;
    right: 22px;
    bottom: 22px;
    z-index: 9996;
    font-family: inherit;
}

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

.ds-chat__launcher {
    width: 58px;
    height: 58px;
    border: 0;
    border-radius: 50%;
    color: #ffffff;
    background: linear-gradient(135deg, var(--ds-chat-blue), var(--ds-chat-cyan));
    box-shadow: 0 18px 38px rgba(16, 24, 40, 0.28);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: transform 160ms ease, box-shadow 160ms ease;
}

.ds-chat__launcher:hover,
.ds-chat__launcher:focus-visible {
    transform: translateY(-2px);
    box-shadow: 0 22px 44px rgba(16, 24, 40, 0.32);
    outline: none;
}

.ds-chat__launcher-icon {
    width: 28px;
    height: 28px;
    border: 2px solid rgba(255, 255, 255, 0.95);
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 18px;
    line-height: 1;
}

.ds-chat__greeting {
    position: absolute;
    right: 74px;
    bottom: 8px;
    width: max-content;
    max-width: 220px;
    padding: 10px 14px;
    border: 1px solid var(--ds-chat-border);
    border-radius: 8px;
    background: var(--ds-chat-surface);
    color: var(--ds-chat-navy);
    box-shadow: 0 14px 34px rgba(16, 24, 40, 0.16);
    font-size: 14px;
    line-height: 1.35;
    opacity: 0;
    transform: translateX(12px);
    pointer-events: none;
    transition: opacity 220ms ease, transform 220ms ease;
}

.ds-chat__greeting::after {
    content: "";
    position: absolute;
    right: -7px;
    bottom: 18px;
    width: 12px;
    height: 12px;
    border-top: 1px solid var(--ds-chat-border);
    border-right: 1px solid var(--ds-chat-border);
    background: var(--ds-chat-surface);
    transform: rotate(45deg);
}

.ds-chat__greeting.is-visible {
    opacity: 1;
    transform: translateX(0);
}

.ds-chat__panel {
    position: absolute;
    right: 0;
    bottom: 74px;
    width: min(380px, calc(100vw - 32px));
    height: min(560px, calc(100vh - 120px));
    min-height: 420px;
    border: 1px solid var(--ds-chat-border);
    border-radius: 8px;
    background: var(--ds-chat-surface);
    box-shadow: 0 24px 58px rgba(16, 24, 40, 0.24);
    overflow: hidden;
    display: grid;
    grid-template-rows: auto 1fr auto;
    opacity: 0;
    transform: translateY(14px) scale(0.98);
    pointer-events: none;
    transition: opacity 180ms ease, transform 180ms ease;
}

.ds-chat.is-open .ds-chat__panel {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

.ds-chat.is-open .ds-chat__greeting {
    display: none;
}

.ds-chat__header {
    min-height: 76px;
    padding: 16px 18px;
    background: var(--ds-chat-blue);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.ds-chat__eyebrow,
.ds-chat__title {
    margin: 0;
}

.ds-chat__eyebrow {
    font-size: 12px;
    line-height: 1.2;
    opacity: 0.82;
}

.ds-chat__title {
    margin-top: 2px;
    font-size: 18px;
    line-height: 1.25;
    font-weight: 700;
}

.ds-chat__icon-button {
    width: 34px;
    height: 34px;
    border: 1px solid rgba(255, 255, 255, 0.28);
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.12);
    color: #ffffff;
    cursor: pointer;
    font-size: 24px;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.ds-chat__icon-button:hover,
.ds-chat__icon-button:focus-visible {
    background: rgba(255, 255, 255, 0.22);
    outline: none;
}

.ds-chat__messages {
    padding: 18px;
    overflow-y: auto;
    background: var(--ds-chat-soft);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.ds-chat__message {
    max-width: 86%;
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 14px;
    line-height: 1.45;
    overflow-wrap: anywhere;
    white-space: pre-wrap;
}

.ds-chat__message--bot {
    align-self: flex-start;
    background: #ffffff;
    color: var(--ds-chat-navy);
    border: 1px solid var(--ds-chat-border);
}

.ds-chat__message--user {
    align-self: flex-end;
    background: var(--ds-chat-blue);
    color: #ffffff;
}

.ds-chat__message--typing {
    color: var(--ds-chat-muted);
    font-style: italic;
}

.ds-chat__form {
    padding: 12px;
    border-top: 1px solid var(--ds-chat-border);
    background: #ffffff;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 10px;
    align-items: end;
}

.ds-chat__input {
    width: 100%;
    max-height: 110px;
    min-height: 42px;
    resize: none;
    border: 1px solid var(--ds-chat-border);
    border-radius: 8px;
    padding: 10px 12px;
    color: var(--ds-chat-navy);
    font: inherit;
    font-size: 14px;
    line-height: 1.4;
    outline: none;
}

.ds-chat__input:focus {
    border-color: var(--ds-chat-cyan);
    box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.16);
}

.ds-chat__send {
    min-width: 74px;
    height: 42px;
    border: 0;
    border-radius: 8px;
    background: var(--ds-chat-green);
    color: #ffffff;
    cursor: pointer;
    font-weight: 700;
    font-size: 14px;
}

.ds-chat__send:hover,
.ds-chat__send:focus-visible {
    background: #12843d;
    outline: none;
}

.ds-chat__send:disabled,
.ds-chat__input:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

@media (max-width: 560px) {
    .ds-chat {
        right: 14px;
        bottom: 14px;
    }

    .ds-chat__panel {
        right: -2px;
        bottom: 70px;
        width: calc(100vw - 24px);
        height: min(620px, calc(100vh - 96px));
        min-height: 360px;
    }

    .ds-chat__greeting {
        right: 68px;
        max-width: calc(100vw - 116px);
    }

    .ds-chat__form {
        grid-template-columns: 1fr;
    }

    .ds-chat__send {
        width: 100%;
    }
}
