.xais-chat {
    bottom: 28px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    position: fixed;
    right: 32px;
    z-index: 9999;
}

.xais-chat__cta {
    display: none;
}

.xais-chat__toggle {
    align-items: center;
    background: #111;
    border: 2px solid #fff;
    border-radius: 999px;
    box-shadow: 0 16px 34px rgba(0, 0, 0, 0.28);
    color: #fff;
    cursor: pointer;
    display: flex;
    height: 72px;
    justify-content: center;
    transition: background 140ms ease, box-shadow 140ms ease, transform 140ms ease;
    width: 72px;
}

.xais-chat__toggle:hover,
.xais-chat__toggle:focus-visible {
    background: #000;
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.34);
    outline: none;
    transform: translateY(-2px);
}

.xais-chat__toggle-icon {
    display: block;
    height: 42px;
    pointer-events: none;
    width: 42px;
}

.xais-chat__panel {
    background: #fff;
    border: 1px solid rgba(0, 0, 0, 0.22);
    border-radius: 14px;
    bottom: 90px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.24);
    display: flex;
    flex-direction: column;
    height: min(672px, calc(100vh - 118px));
    overflow: visible;
    position: absolute;
    right: 8px;
    width: min(376px, calc(100vw - 32px));
}

.xais-chat__panel[hidden] {
    display: none;
}

.xais-chat__panel::after {
    background: #fff;
    border-bottom: 1px solid rgba(0, 0, 0, 0.22);
    border-right: 1px solid rgba(0, 0, 0, 0.22);
    bottom: -10px;
    content: "";
    height: 20px;
    position: absolute;
    right: 28px;
    transform: rotate(45deg);
    width: 20px;
}

.xais-chat__header {
    align-items: center;
    background: #111;
    border-radius: 13px 13px 0 0;
    color: #fff;
    display: flex;
    justify-content: space-between;
    min-height: 62px;
    padding: 12px 18px;
}

.xais-chat__header-actions {
    align-items: center;
    display: flex;
    gap: 8px;
}

.xais-chat__identity {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.xais-chat__identity strong {
    color: #fff;
    font-size: 17px;
    font-weight: 800;
    line-height: 1.15;
}

.xais-chat__status {
    align-items: center;
    color: rgba(255, 255, 255, 0.82);
    display: inline-flex;
    font-size: 12px;
    gap: 7px;
    line-height: 1;
}

.xais-chat__status span {
    background: #22c55e;
    border-radius: 999px;
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.22), 0 0 8px rgba(34, 197, 94, 0.48);
    display: inline-block;
    height: 8px;
    width: 8px;
}

.xais-chat__new {
    align-items: center;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.24);
    border-radius: 7px;
    color: #fff;
    cursor: pointer;
    display: inline-flex;
    font: inherit;
    font-size: 12px;
    font-weight: 700;
    gap: 5px;
    line-height: 1;
    min-height: 32px;
    padding: 0 10px;
}

.xais-chat__new span {
    font-size: 18px;
    font-weight: 400;
    line-height: 1;
    margin-top: -1px;
}

.xais-chat__new:hover,
.xais-chat__new:focus-visible {
    background: #fff;
    color: #111;
    outline: none;
}

.xais-chat__close {
    align-items: center;
    background: transparent;
    border: 0;
    color: #fff;
    cursor: pointer;
    display: flex;
    font-size: 32px;
    font-weight: 300;
    height: 36px;
    justify-content: center;
    line-height: 1;
    padding: 0;
    width: 36px;
}

.xais-chat__close:hover,
.xais-chat__close:focus-visible {
    color: rgba(255, 255, 255, 0.7);
    outline: none;
}

.xais-chat__messages {
    background:
        radial-gradient(circle at 18% 12%, rgba(0, 0, 0, 0.035), transparent 28%),
        #f7f7f7;
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 14px;
    min-height: 0;
    overflow-y: auto;
    padding: 18px 16px 14px;
}

.xais-chat__message {
    display: flex;
    flex-direction: column;
    gap: 5px;
    max-width: 100%;
    position: relative;
    white-space: pre-wrap;
}

.xais-chat__message--assistant {
    align-self: flex-start;
    max-width: min(304px, calc(100% - 42px));
}

.xais-chat__message--user {
    align-self: flex-end;
    align-items: flex-end;
    max-width: min(304px, calc(100% - 42px));
}

.xais-chat__sender {
    color: #666;
    display: block;
    font-size: 10px;
    font-weight: 800;
    line-height: 1;
    padding: 0 7px;
}

.xais-chat__bubble {
    border-radius: 12px;
    box-shadow: 0 5px 18px rgba(0, 0, 0, 0.08);
    box-sizing: border-box;
    font-size: 13px;
    line-height: 1.42;
    max-width: 100%;
    min-width: 0;
    padding: 10px 13px;
    position: relative;
}

.xais-chat__message--assistant .xais-chat__bubble {
    background: #fff;
    border: 1px solid #dedede;
    border-top-left-radius: 7px;
    color: #151515;
}

.xais-chat__message--assistant .xais-chat__bubble::before {
    background: #fff;
    border-bottom: 1px solid #dedede;
    border-left: 1px solid #dedede;
    content: "";
    height: 9px;
    left: -5px;
    position: absolute;
    top: 12px;
    transform: rotate(45deg);
    width: 9px;
}

.xais-chat__message--assistant .xais-chat__bubble.has-product-cards {
    width: min(286px, calc(100vw - 84px));
}

.xais-chat__bubble > :first-child {
    margin-top: 0;
}

.xais-chat__bubble > :last-child {
    margin-bottom: 0;
}

.xais-chat__bubble p {
    margin: 0 0 8px;
}

.xais-chat__bubble ul,
.xais-chat__bubble ol {
    margin: 8px 0;
    padding-left: 18px;
}

.xais-chat__bubble li {
    margin: 3px 0;
}

.xais-chat__bubble h3,
.xais-chat__bubble h4,
.xais-chat__bubble h5 {
    font-size: 13px;
    line-height: 1.25;
    margin: 8px 0 5px;
}

.xais-chat__bubble code {
    background: #f1f1f1;
    border-radius: 4px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 12px;
    padding: 1px 4px;
}

.xais-chat__bubble pre {
    background: #111;
    border-radius: 7px;
    color: #fff;
    margin: 8px 0;
    overflow-x: auto;
    padding: 9px;
}

.xais-chat__bubble pre code {
    background: transparent;
    color: inherit;
    padding: 0;
}

.xais-chat__bubble a {
    color: #111;
    font-weight: 700;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.xais-chat__citations {
    border-top: 1px solid #e5e5e5;
    margin-top: 10px;
    padding-top: 8px;
}

.xais-chat__citations-title {
    color: #555;
    display: block;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.04em;
    margin-bottom: 5px;
    text-transform: uppercase;
}

.xais-chat__citations ol {
    margin: 0;
    padding-left: 18px;
}

.xais-chat__citations li {
    color: #555;
    font-size: 11px;
    line-height: 1.35;
    margin: 4px 0;
}

.xais-chat__citations a {
    color: #111;
    font-weight: 700;
}

.xais-chat__citation-meta {
    color: #777;
    display: block;
    font-size: 10px;
    margin-top: 1px;
}

.xais-chat__typing {
    align-items: center;
    display: inline-flex;
    gap: 5px;
    min-height: 16px;
}

.xais-chat__typing span {
    animation: xais-chat-typing 1050ms infinite ease-in-out;
    background: #555;
    border-radius: 999px;
    display: block;
    height: 6px;
    width: 6px;
}

.xais-chat__typing span:nth-child(2) {
    animation-delay: 120ms;
}

.xais-chat__typing span:nth-child(3) {
    animation-delay: 240ms;
}

@keyframes xais-chat-typing {
    0%,
    80%,
    100% {
        opacity: 0.5;
        transform: translateY(0);
    }

    40% {
        opacity: 1;
        transform: translateY(-2px);
    }
}

.xais-chat__message--user .xais-chat__bubble {
    background: #111;
    border: 1px solid #111;
    border-top-right-radius: 7px;
    color: #fff;
}

.xais-chat__message--user .xais-chat__bubble::before {
    background: #111;
    content: "";
    height: 9px;
    position: absolute;
    right: -4px;
    top: 12px;
    transform: rotate(45deg);
    width: 9px;
}

.xais-chat__time {
    color: #7a7a7a;
    display: block;
    font-size: 10px;
    line-height: 1;
    margin-top: 2px;
}

.xais-chat__message--assistant .xais-chat__time {
    padding-left: 8px;
}

.xais-chat__message--user .xais-chat__time {
    padding-right: 6px;
}

.xais-chat__form {
    align-items: center;
    background: #fff;
    border-radius: 0 0 13px 13px;
    border-top: 1px solid #e1e1e1;
    display: grid;
    gap: 10px;
    grid-template-columns: 1fr auto;
    padding: 8px 12px 12px;
}

.xais-chat__form textarea {
    border: 1px solid #cfcfcf;
    border-radius: 8px;
    box-sizing: border-box;
    color: #151515;
    font: inherit;
    font-size: 13px;
    height: 46px;
    line-height: 1.35;
    max-height: 96px;
    padding: 12px 10px;
    overflow-y: auto;
    resize: none;
}

.xais-chat__form textarea:focus {
    border-color: #111;
    box-shadow: 0 0 0 2px rgba(17, 17, 17, 0.1);
    outline: none;
}

.xais-chat__form button {
    background: #111;
    border: 0;
    border-radius: 8px;
    color: #fff;
    cursor: pointer;
    font-weight: 800;
    min-height: 46px;
    padding: 0 16px;
}

.xais-chat__form button:hover,
.xais-chat__form button:focus-visible {
    background: #000;
    outline: none;
}

.xais-chat__form button:disabled,
.xais-chat__form textarea:disabled {
    cursor: wait;
    opacity: 0.7;
}

.xais-chat__product-list {
    display: flex;
    flex-direction: column;
    gap: 7px;
    list-style: none;
    margin: 12px 0 0;
    max-width: 100%;
    padding: 0;
}

.xais-chat__product-item {
    margin: 0;
    min-width: 0;
    padding: 0;
}

.xais-chat__product-card {
    align-items: start;
    background: #fff;
    border: 1px solid #dedede;
    border-radius: 8px;
    color: inherit;
    display: grid;
    gap: 9px;
    grid-template-columns: 64px minmax(0, 1fr);
    min-height: 78px;
    padding: 8px 10px 8px 8px;
    text-decoration: none;
    transition: border-color 120ms ease, box-shadow 120ms ease, transform 120ms ease;
}

.xais-chat__product-card:hover,
.xais-chat__product-card:focus-visible {
    border-color: #111;
    box-shadow: 0 5px 14px rgba(0, 0, 0, 0.12);
    outline: none;
    transform: translateY(-1px);
}

.xais-chat__product-card[aria-disabled="true"] {
    cursor: default;
    opacity: 0.7;
    pointer-events: none;
}

.xais-chat__product-thumb {
    align-items: center;
    background: #f4f4f4;
    border-radius: 6px;
    display: flex;
    height: 64px;
    justify-content: center;
    overflow: hidden;
    width: 64px;
}

.xais-chat__product-thumb.is-empty::after {
    color: #9b9b9b;
    content: "X";
    font-size: 18px;
    font-weight: 800;
}

.xais-chat__product-thumb-img {
    display: block;
    height: 100%;
    object-fit: cover;
    width: 100%;
}

.xais-chat__product-body {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.xais-chat__product-name {
    color: #151515;
    display: -webkit-box;
    font-size: 12px;
    font-weight: 800;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    line-height: 1.24;
    overflow: hidden;
    text-overflow: ellipsis;
    word-break: break-word;
}

.xais-chat__product-details {
    color: #6f6f6f;
    display: flex;
    flex-wrap: wrap;
    font-size: 10px;
    gap: 3px 7px;
    line-height: 1.25;
}

.xais-chat__product-sku {
    font-weight: 500;
    letter-spacing: 0;
}

.xais-chat__product-categories,
.xais-chat__product-description {
    display: -webkit-box;
    flex-basis: 100%;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

.xais-chat__product-price {
    align-items: baseline;
    color: #111;
    display: inline-flex;
    font-size: 12px;
    font-weight: 800;
    gap: 5px;
    line-height: 1.2;
    margin-top: 1px;
    white-space: nowrap;
}

.xais-chat__product-price-current {
    color: #111;
}

.xais-chat__product-price-regular {
    color: #9aa0a8;
    font-size: 11px;
    font-weight: 800;
    text-decoration-thickness: 1px;
}

.xais-chat__login-notice {
    background: #111;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 8px;
    bottom: 86px;
    box-shadow: 0 14px 34px rgba(0, 0, 0, 0.24);
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.35;
    max-width: min(320px, calc(100vw - 40px));
    padding: 11px 13px;
    position: absolute;
    right: 2px;
    text-align: left;
}

.xais-chat__login-notice[hidden] {
    display: none;
}

@media (max-width: 600px) {
    .xais-chat {
        bottom: 18px;
        right: 18px;
    }

    .xais-chat__panel {
        bottom: 86px;
        height: min(620px, calc(100vh - 116px));
        right: -8px;
        width: calc(100vw - 28px);
    }

    .xais-chat__login-notice {
        bottom: 82px;
        right: -4px;
    }
}
