#zyl-ai-root {
    --zyl-primary: #c9a227;
    --zyl-dark: #151515;
    --zyl-text: #1c1c1c;
    --zyl-border: #e8e4dc;
    --zyl-soft: #f8f7f4;
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 999999;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
    font-size: 14px;
    line-height: 1.45;
}

#zyl-ai-root *, #zyl-ai-root *::before, #zyl-ai-root *::after {
    box-sizing: border-box;
}

.zyl-ai-launcher {
    width: auto;
    min-width: 58px;
    height: 58px;
    padding: 0 18px 0 14px;
    border: 0;
    border-radius: 999px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    cursor: pointer;
    color: #fff;
    background: var(--zyl-dark);
    box-shadow: 0 10px 30px rgba(0,0,0,.22);
    transition: transform .2s ease, box-shadow .2s ease;
}

.zyl-ai-launcher:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 34px rgba(0,0,0,.25);
}

.zyl-ai-launcher-icon {
    width: 30px;
    height: 30px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    color: #151515;
    background: var(--zyl-primary);
}

.zyl-ai-launcher-icon svg { width: 18px; height: 18px; }
.zyl-ai-launcher-label { font-size: 13px; font-weight: 600; white-space: nowrap; }

.zyl-ai-window {
    position: absolute;
    right: 0;
    bottom: 0;
    width: 390px;
    height: min(650px, calc(100vh - 48px));
    min-height: 480px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid rgba(0,0,0,.08);
    border-radius: 20px;
    background: #fff;
    box-shadow: 0 20px 60px rgba(0,0,0,.18);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(18px) scale(.97);
    transform-origin: bottom right;
    transition: opacity .2s ease, visibility .2s ease, transform .2s ease;
}

#zyl-ai-root.is-open .zyl-ai-window {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(0) scale(1);
}

#zyl-ai-root.is-open .zyl-ai-launcher {
    opacity: 0;
    pointer-events: none;
    transform: scale(.92);
}

.zyl-ai-header {
    min-height: 72px;
    padding: 13px 14px 13px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: #fff;
    background: linear-gradient(135deg, #121212 0%, #1d1d1d 58%, #272114 100%);
}

.zyl-ai-brand { display: flex; align-items: center; gap: 11px; min-width: 0; }

.zyl-ai-avatar {
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    display: grid;
    place-items: center;
    border: 1px solid rgba(201,162,39,.65);
    border-radius: 50%;
    color: var(--zyl-primary);
    background: rgba(255,255,255,.05);
    font-family: Georgia, serif;
    font-size: 20px;
    font-weight: 700;
}

.zyl-ai-title {
    max-width: 225px;
    overflow: hidden;
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.zyl-ai-status {
    margin-top: 2px;
    display: flex;
    align-items: center;
    gap: 5px;
    color: rgba(255,255,255,.62);
    font-size: 11px;
}

.zyl-ai-status span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #59c46a;
}

.zyl-ai-actions { display: flex; align-items: center; gap: 4px; }

.zyl-ai-icon-button {
    width: 36px;
    height: 36px;
    padding: 0;
    border: 1px solid rgba(255,255,255,.11);
    border-radius: 10px;
    display: grid;
    place-items: center;
    cursor: pointer;
    color: rgba(255,255,255,.86);
    background: rgba(255,255,255,.06);
}

.zyl-ai-icon-button:hover { color: #fff; background: rgba(255,255,255,.13); }
.zyl-ai-icon-button svg { width: 18px; height: 18px; }

.zyl-ai-messages {
    flex: 1;
    min-height: 0;
    padding: 18px 15px 12px;
    overflow-y: auto;
    overscroll-behavior: contain;
    background: radial-gradient(circle at 100% 0, rgba(201,162,39,.06), transparent 34%), #fff;
    scrollbar-width: thin;
}

.zyl-ai-message-row { width: 100%; margin: 0 0 12px; display: flex; }
.zyl-ai-message-row.is-user { justify-content: flex-end; }

.zyl-ai-message {
    max-width: 82%;
    padding: 10px 12px;
    border-radius: 15px;
    color: var(--zyl-text);
    background: var(--zyl-soft);
    border: 1px solid var(--zyl-border);
    font-size: 13px;
    overflow-wrap: anywhere;
}

.is-user .zyl-ai-message {
    color: #fff;
    background: var(--zyl-dark);
    border-color: var(--zyl-dark);
    border-bottom-right-radius: 5px;
}

.is-assistant .zyl-ai-message { border-bottom-left-radius: 5px; }

.zyl-ai-message strong { font-weight: 700; }

.zyl-ai-products {
    width: 100%;
    margin: -2px 0 15px;
    display: grid;
    gap: 9px;
}

.zyl-ai-product-card {
    display: grid;
    grid-template-columns: 72px minmax(0,1fr);
    min-width: 0;
    overflow: hidden;
    border: 1px solid #e9e5dd;
    border-radius: 13px;
    background: #fff;
    box-shadow: 0 3px 12px rgba(0,0,0,.04);
}

.zyl-ai-product-image {
    width: 72px;
    height: 88px;
    overflow: hidden;
    display: grid;
    place-items: center;
    color: #9c8a53;
    background: #f5f3ee;
    font-size: 8px;
    font-weight: 700;
    letter-spacing: .08em;
}

.zyl-ai-product-image img { width: 100%; height: 100%; display: block; object-fit: cover; }

.zyl-ai-product-info { min-width: 0; padding: 9px 10px; }

.zyl-ai-product-info h4 {
    margin: 0 0 6px;
    color: #1c1c1c;
    font-size: 11px;
    font-weight: 700;
    line-height: 1.35;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
}

.zyl-ai-product-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 7px;
}

.zyl-ai-product-meta strong { color: #171717; font-size: 12px; }

.zyl-ai-stock {
    padding: 2px 6px;
    border-radius: 999px;
    font-size: 9px;
    font-weight: 600;
}

.zyl-ai-stock.is-in-stock { color: #2c6c37; background: #eaf7ec; }
.zyl-ai-stock.is-out-stock { color: #9a3535; background: #fbecec; }
.zyl-ai-stock.is-unknown { color: #74622c; background: #f8f2df; }

.zyl-ai-product-link {
    display: inline-flex;
    color: #927117 !important;
    font-size: 10px;
    font-weight: 700;
    text-decoration: none !important;
}

.zyl-ai-product-link:hover { text-decoration: underline !important; }

.zyl-ai-typing {
    flex: 0 0 auto;
    padding: 0 15px 8px;
    display: flex;
    align-items: center;
    gap: 4px;
    color: #8a8a8a;
    background: #fff;
    font-size: 10px;
}

.zyl-ai-typing span {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: #999;
    animation: zyl-ai-bounce 1s infinite ease-in-out;
}

.zyl-ai-typing span:nth-child(2) { animation-delay: .12s; }
.zyl-ai-typing span:nth-child(3) { animation-delay: .24s; }

.zyl-ai-typing em { margin-left: 4px; font-style: normal; }

@keyframes zyl-ai-bounce {
    0%,70%,100% { transform: translateY(0); opacity: .45; }
    35% { transform: translateY(-3px); opacity: 1; }
}

.zyl-ai-composer {
    flex: 0 0 auto;
    margin: 0;
    padding: 10px 11px;
    display: flex;
    align-items: flex-end;
    gap: 8px;
    border-top: 1px solid #ece9e3;
    background: #fff;
}

.zyl-ai-input {
    width: 100%;
    min-height: 42px;
    max-height: 120px;
    margin: 0 !important;
    padding: 11px 12px !important;
    resize: none;
    outline: none !important;
    border: 1px solid #dedbd4 !important;
    border-radius: 12px !important;
    color: #222 !important;
    background: #fafaf9 !important;
    box-shadow: none !important;
    font-size: 13px !important;
    line-height: 1.4;
}

.zyl-ai-input:focus {
    border-color: var(--zyl-primary) !important;
    box-shadow: 0 0 0 3px rgba(201,162,39,.1) !important;
}

.zyl-ai-input::placeholder { color: #9a9a9a; }

.zyl-ai-send {
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    padding: 0;
    border: 0;
    border-radius: 12px;
    display: grid;
    place-items: center;
    cursor: pointer;
    color: #fff;
    background: var(--zyl-dark);
}

.zyl-ai-send:disabled { cursor: not-allowed; opacity: .45; }
.zyl-ai-send svg { width: 18px; height: 18px; }

.zyl-ai-footer {
    flex: 0 0 auto;
    padding: 5px 12px 8px;
    color: #a0a0a0;
    background: #fff;
    font-size: 9px;
    text-align: center;
}

.zyl-ai-shortcode-mount { min-height: 1px; }

@media (max-width: 640px) {
    #zyl-ai-root { right: 14px; bottom: 14px; }

    .zyl-ai-launcher {
        width: 56px;
        min-width: 56px;
        height: 56px;
        padding: 0;
        border-radius: 50%;
    }

    .zyl-ai-launcher-label { display: none; }

    .zyl-ai-window {
        position: fixed;
        right: 8px;
        bottom: 8px;
        left: 8px;
        width: auto;
        height: min(720px, calc(100dvh - 16px));
        min-height: 0;
        border-radius: 18px;
        transform-origin: bottom center;
    }

    .zyl-ai-message { max-width: 88%; }
}

@media (max-width: 380px) {
    #zyl-ai-root { right: 10px; bottom: 10px; }

    .zyl-ai-window {
        right: 5px;
        bottom: 5px;
        left: 5px;
        height: calc(100dvh - 10px);
    }

    .zyl-ai-header { min-height: 66px; padding-left: 12px; }
    .zyl-ai-avatar { width: 38px; height: 38px; flex-basis: 38px; }
    .zyl-ai-title { max-width: 155px; font-size: 13px; }
    .zyl-ai-icon-button { width: 33px; height: 33px; }
}

@media (prefers-reduced-motion: reduce) {
    .zyl-ai-launcher, .zyl-ai-window { transition: none; }
    .zyl-ai-typing span { animation: none; }
}
