.ivette-ai {
    --ai-pink: var(--color-primary, #e8326e);
    --ai-ink: var(--color-text, #241c25);
    --ai-muted: var(--color-text-muted, #746b74);
    --ai-surface: var(--color-surface, #fff);
    --ai-border: color-mix(in srgb, var(--ai-ink) 13%, transparent);
    position: fixed;
    right: 22px;
    bottom: 92px;
    z-index: 2105;
    font-family: var(--font-sans);
}

.ivette-ai__trigger {
    display: flex;
    align-items: center;
    gap: .65rem;
    min-height: 54px;
    padding: .55rem 1rem .55rem .6rem;
    border: 0;
    border-radius: 999px;
    background: #211e25;
    color: #fff;
    box-shadow: 0 14px 35px rgba(30, 21, 31, .2);
    cursor: pointer;
    font: inherit;
    transition: transform .2s ease, box-shadow .2s ease;
}

.ivette-ai__trigger:hover { transform: translateY(-2px); box-shadow: 0 18px 40px rgba(30, 21, 31, .27); }
.ivette-ai__trigger-icon, .ivette-ai__avatar {
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(145deg, #ff4b8b, var(--ai-pink));
    color: #fff;
    font-size: 1.1rem;
}

.ivette-ai__trigger-copy { display: grid; text-align: left; line-height: 1.2; }
.ivette-ai__trigger-copy strong { font-size: .83rem; }
.ivette-ai__trigger-copy small { margin-top: .15rem; color: #d9d5da; font-size: .68rem; }

.ivette-ai__panel {
    position: absolute;
    right: 0;
    bottom: 0;
    display: grid;
    grid-template-rows: auto minmax(220px, 1fr) auto auto;
    width: min(390px, calc(100vw - 32px));
    height: min(650px, calc(100vh - 130px));
    overflow: hidden;
    border: 1px solid var(--ai-border);
    border-radius: 24px;
    background: var(--ai-surface);
    color: var(--ai-ink);
    box-shadow: 0 26px 75px rgba(31, 22, 31, .24);
    transform-origin: right bottom;
    animation: ivette-ai-in .22s ease-out;
}

.ivette-ai__panel[hidden] { display: none; }
.ivette-ai__header {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: 1rem;
    color: #fff;
    background: linear-gradient(120deg, #211e25, #39313c);
}
.ivette-ai__avatar { width: 42px; height: 42px; }
.ivette-ai__header > div { display: grid; flex: 1; }
.ivette-ai__header strong { font-size: .95rem; }
.ivette-ai__header small { margin-top: .12rem; color: #d9d5da; font-size: .7rem; }
.ivette-ai__header small span { display: inline-block; width: 7px; height: 7px; margin-right: .25rem; border-radius: 50%; background: #55d98b; }
.ivette-ai__header button { display: grid; place-items: center; width: 44px; height: 44px; border: 0; border-radius: 50%; background: transparent; color: #fff; cursor: pointer; }
.ivette-ai__header button:hover { background: rgba(255,255,255,.1); }

.ivette-ai__messages {
    overflow-y: auto;
    padding: 1rem;
    background: color-mix(in srgb, var(--ai-surface) 96%, var(--ai-pink));
    scrollbar-width: thin;
}
.ivette-ai__message { max-width: 88%; margin: 0 0 .75rem; }
.ivette-ai__message p { margin: 0; padding: .72rem .85rem; border-radius: 16px; background: color-mix(in srgb, var(--ai-ink) 6%, var(--ai-surface)); font-size: .82rem; line-height: 1.55; white-space: pre-wrap; }
.ivette-ai__message--user { margin-left: auto; }
.ivette-ai__message--user p { border-bottom-right-radius: 5px; background: var(--ai-pink); color: #fff; }
.ivette-ai__message--assistant p { border-bottom-left-radius: 5px; }
.ivette-ai__message--error p { border: 1px solid color-mix(in srgb, #c62828 28%, transparent); background: color-mix(in srgb, #c62828 8%, var(--ai-surface)); color: #a51d1d; }
.ivette-ai__typing p { display: flex; width: max-content; gap: 4px; padding-block: .9rem; }
.ivette-ai__typing span { width: 6px; height: 6px; border-radius: 50%; background: var(--ai-muted); animation: ivette-ai-dot 1s infinite ease-in-out; }
.ivette-ai__typing span:nth-child(2) { animation-delay: .15s; }
.ivette-ai__typing span:nth-child(3) { animation-delay: .3s; }

.ivette-ai__suggestions { display: flex; flex-wrap: wrap; gap: .45rem; margin: .3rem 0 1rem; }
.ivette-ai__suggestions button { padding: .5rem .7rem; border: 1px solid color-mix(in srgb, var(--ai-pink) 35%, transparent); border-radius: 999px; background: var(--ai-surface); color: var(--ai-ink); font: 600 .68rem/1.3 var(--font-body, "Manrope", sans-serif); cursor: pointer; }
.ivette-ai__suggestions button:hover { border-color: var(--ai-pink); color: var(--ai-pink); }
.ivette-ai__suggestions .ivette-ai__nearby { display: inline-flex; align-items: center; gap: .35rem; border-color: color-mix(in srgb, var(--ai-pink) 55%, transparent); color: var(--ai-pink); }
.ivette-ai__nearby:disabled { opacity: .6; cursor: wait; }

.ivette-ai__products { display: grid; gap: .6rem; margin: .15rem 0 1rem; }
.ivette-ai__products-title { margin: .25rem 0 -.1rem; color: var(--ai-muted); font-size: .67rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.ivette-ai__product { overflow: hidden; padding: .55rem; border: 1px solid var(--ai-border); border-radius: 14px; background: var(--ai-surface); }
.ivette-ai__product:has(.ivette-ai__product-link:hover) { border-color: color-mix(in srgb, var(--ai-pink) 55%, transparent); }
.ivette-ai__product-link { display: grid; grid-template-columns: 72px 1fr; gap: .7rem; color: inherit; text-decoration: none; }
.ivette-ai__product img { width: 72px; height: 82px; border-radius: 10px; background: #f7f4f6; object-fit: contain; }
.ivette-ai__product div { min-width: 0; }
.ivette-ai__product small { display: block; overflow: hidden; color: var(--ai-muted); font-size: .62rem; text-overflow: ellipsis; text-transform: uppercase; white-space: nowrap; }
.ivette-ai__product strong { display: -webkit-box; margin: .2rem 0; overflow: hidden; font-size: .75rem; line-height: 1.35; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.ivette-ai__product-tone { display: inline-flex; align-items: center; gap: .3rem; margin: -.05rem 0 .22rem; color: var(--ai-muted); font-size: .6rem; line-height: 1.2; }
.ivette-ai__product-tone i { width: 13px; height: 13px; flex: 0 0 13px; border: 1px solid color-mix(in srgb, var(--ai-ink) 20%, transparent); border-radius: 50%; box-shadow: 0 0 0 2px var(--ai-surface); }
.ivette-ai__product-price { color: var(--ai-ink); font-size: .8rem; font-weight: 800; }
.ivette-ai__product-status { margin-top: .18rem; color: #168343; font-size: .63rem; }
.ivette-ai__product-status--off { color: var(--ai-muted); }
.ivette-ai__add-cart { display: flex; align-items: center; justify-content: center; gap: .4rem; width: 100%; min-height: 36px; margin-top: .55rem; border: 1px solid var(--ai-pink); border-radius: 10px; background: transparent; color: var(--ai-pink); cursor: pointer; font: 700 .68rem/1.2 var(--font-body, "Manrope", sans-serif); }
.ivette-ai__add-cart:hover:not(:disabled) { background: var(--ai-pink); color: #fff; }
.ivette-ai__add-cart:disabled { border-color: var(--ai-border); color: var(--ai-muted); cursor: not-allowed; }
.ivette-ai__add-cart.is-added { border-color: #168343; background: #168343; color: #fff; }

.ivette-ai__stores { display: grid; gap: .6rem; margin: .15rem 0 1rem; }
.ivette-ai__store { display: grid; gap: .28rem; padding: .7rem; border: 1px solid var(--ai-border); border-radius: 14px; background: var(--ai-surface); }
.ivette-ai__store strong { font-size: .8rem; line-height: 1.3; }
.ivette-ai__store p { margin: 0; color: var(--ai-muted); font-size: .7rem; line-height: 1.4; }
.ivette-ai__store-status { width: fit-content; color: #168343; font-size: .69rem; font-weight: 800; }
.ivette-ai__store small { color: var(--ai-muted); font-size: .66rem; line-height: 1.35; }
.ivette-ai__store-distance { color: var(--ai-ink) !important; font-weight: 700; }
.ivette-ai__store a { display: inline-flex; align-items: center; justify-content: center; gap: .35rem; min-height: 36px; margin-top: .2rem; border: 1px solid var(--ai-pink); border-radius: 10px; color: var(--ai-pink); font: 700 .68rem/1.2 var(--font-body, "Manrope", sans-serif); text-decoration: none; }
.ivette-ai__store a:hover { background: var(--ai-pink); color: #fff; }

.ivette-ai__composer { display: grid; grid-template-columns: 1fr 44px; align-items: end; gap: .55rem; margin: .75rem .8rem .35rem; padding: .35rem .4rem .35rem .8rem; border: 1px solid var(--ai-border); border-radius: 18px; background: var(--ai-surface); }
.ivette-ai__composer:focus-within { border-color: var(--ai-pink); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ai-pink) 12%, transparent); }
.ivette-ai__composer textarea { max-height: 110px; resize: none; overflow-y: auto; padding: .55rem 0; border: 0; outline: 0; background: transparent; color: var(--ai-ink); font: .78rem/1.45 var(--font-body, "Manrope", sans-serif); }
.ivette-ai__composer textarea::placeholder { color: var(--ai-muted); }
.ivette-ai__composer button { display: grid; place-items: center; width: 44px; height: 44px; border: 0; border-radius: 50%; background: var(--ai-pink); color: #fff; cursor: pointer; }
.ivette-ai__composer button:disabled { opacity: .5; cursor: wait; }
.ivette-ai__notice { margin: 0 1rem .75rem; color: var(--ai-muted); font-size: .58rem; text-align: center; }
.ivette-ai .sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.ivette-ai :focus-visible { outline: 3px solid color-mix(in srgb, var(--ai-pink) 45%, transparent); outline-offset: 2px; }

@keyframes ivette-ai-in { from { opacity: 0; transform: translateY(10px) scale(.97); } }
@keyframes ivette-ai-dot { 0%, 60%, 100% { transform: translateY(0); opacity: .4; } 30% { transform: translateY(-4px); opacity: 1; } }
@keyframes ivette-ai-mobile-in { from { opacity: 0; transform: translateY(18px); } }

@media (max-width: 600px) {
    html.ivette-ai-open,
    body.ivette-ai-open { overflow: hidden; overscroll-behavior: none; }

    .ivette-ai {
        right: max(14px, env(safe-area-inset-right));
        bottom: max(86px, calc(env(safe-area-inset-bottom) + 76px));
    }
    .ivette-ai__trigger-copy { display: none; }
    .ivette-ai__trigger { width: 58px; min-height: 58px; height: 58px; padding: 9px; }
    .ivette-ai__trigger-icon { width: 40px; height: 40px; }
    .ivette-ai__panel {
        position: fixed;
        inset: 0;
        width: 100dvw;
        height: 100dvh;
        max-height: 100dvh;
        grid-template-rows: auto minmax(0, 1fr) auto auto;
        border: 0;
        border-radius: 0;
        animation-name: ivette-ai-mobile-in;
    }
    .ivette-ai__header {
        min-height: 70px;
        padding: max(1rem, env(safe-area-inset-top)) 1rem 1rem;
    }
    .ivette-ai__header button,
    .ivette-ai__composer button { width: 48px; height: 48px; }
    .ivette-ai__messages { padding: 1rem max(1rem, env(safe-area-inset-right)) 1rem max(1rem, env(safe-area-inset-left)); }
    .ivette-ai__message { max-width: 92%; }
    .ivette-ai__message p { padding: .8rem .9rem; font-size: .88rem; }
    .ivette-ai__suggestions button { min-height: 40px; padding: .55rem .75rem; font-size: .72rem; }
    .ivette-ai__composer {
        grid-template-columns: 1fr 48px;
        gap: .45rem;
        margin: .65rem max(.75rem, env(safe-area-inset-right)) .3rem max(.75rem, env(safe-area-inset-left));
        padding: .3rem .35rem .3rem .8rem;
    }
    .ivette-ai__composer textarea { min-height: 48px; padding-block: .72rem; font-size: 16px; }
    .ivette-ai__notice { margin: 0 1rem max(.65rem, env(safe-area-inset-bottom)); font-size: .62rem; }
    .ivette-ai__product-link { grid-template-columns: 78px 1fr; min-height: 96px; }
    .ivette-ai__product img { width: 78px; height: 88px; }
    .ivette-ai__add-cart { min-height: 44px; font-size: .75rem; }
    .ivette-ai__store a { min-height: 44px; font-size: .75rem; }
}

@media (prefers-reduced-motion: reduce) {
    .ivette-ai *, .ivette-ai *::before, .ivette-ai *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
