#aica-root { position: fixed; bottom: 24px; right: 24px; z-index: 99999;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; }

/* Launcher */
.aica-btn { width: 60px; height: 60px; border-radius: 50%; border: 0; cursor: pointer; padding: 0;
    display: flex; align-items: center; justify-content: center; color: #fff;
    box-shadow: 0 8px 24px rgba(0,0,0,.22); transition: transform .18s ease, box-shadow .18s ease; overflow: hidden; }
.aica-btn:hover { transform: translateY(-2px) scale(1.04); box-shadow: 0 12px 28px rgba(0,0,0,.28); }
.aica-btn:active { transform: scale(.97); }
.aica-btn svg, .aica-attach svg, .aica-send svg { display: block !important; visibility: visible !important; max-width: none !important; }
.aica-btn svg { width: 26px !important; height: 26px !important; }
.aica-btn img { width: 100%; height: 100%; object-fit: cover; }
.aica-badge { position: absolute; top: -2px; right: -2px; width: 14px; height: 14px; border-radius: 50%;
    background: #16a34a; border: 2px solid #fff; display: none; }
.aica-btn-wrap { position: relative; display: inline-block; }

/* Panel */
.aica-panel { position: fixed; bottom: 100px; right: 24px; width: 372px; max-width: calc(100vw - 32px);
    height: 540px; max-height: calc(100vh - 140px); background: #fff; border-radius: 16px;
    box-shadow: 0 18px 50px rgba(0,0,0,.24); display: none; flex-direction: column; overflow: hidden;
    opacity: 0; transform: translateY(12px); transition: opacity .18s ease, transform .18s ease; }
.aica-panel.open { display: flex; opacity: 1; transform: translateY(0); }

.aica-head { color: #fff; padding: 14px 16px; display: flex; align-items: center; gap: 10px; }
.aica-head-av { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; background: rgba(255,255,255,.25); flex: 0 0 36px; }
.aica-head-txt { flex: 1; min-width: 0; }
.aica-head-title { font-weight: 600; font-size: 15px; line-height: 1.2; }
.aica-head-sub { font-size: 12px; opacity: .9; display: flex; align-items: center; gap: 5px; }
.aica-dot { width: 7px; height: 7px; border-radius: 50%; background: #4ade80; display: inline-block; }
.aica-close { background: transparent; border: 0; color: #fff; cursor: pointer; font-size: 22px; line-height: 1;
    padding: 4px 6px; border-radius: 8px; opacity: .9; }
.aica-close:hover { background: rgba(255,255,255,.18); opacity: 1; }

.aica-body { flex: 1; overflow-y: auto; padding: 16px 14px; background: #f5f6fa; }
.aica-row { display: flex; align-items: flex-end; gap: 8px; margin-bottom: 12px; }
.aica-row.me { flex-direction: row-reverse; }
.aica-av { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; flex: 0 0 28px;
    background: #d8dbe6; display: flex; align-items: center; justify-content: center; font-size: 12px; color: #555; }
.aica-col { max-width: 78%; }
.aica-who { font-size: 11px; color: #8a8f9c; margin: 0 0 3px 4px; }
.aica-bubble { padding: 10px 13px; border-radius: 14px; font-size: 14px; line-height: 1.45;
    white-space: pre-wrap; word-wrap: break-word; background: #fff; color: #2b2f3a;
    border: 1px solid #e6e8f0; box-shadow: 0 1px 2px rgba(0,0,0,.04); }
.aica-row.me .aica-bubble { color: #fff; border: 0; }
.aica-bubble img.aica-sent { max-width: 180px; border-radius: 10px; display: block; }

/* typing */
.aica-typing { display: inline-flex; gap: 4px; align-items: center; padding: 4px 2px; }
.aica-typing span { width: 7px; height: 7px; border-radius: 50%; background: #b9bdc9; animation: aicaBlink 1.3s infinite; }
.aica-typing span:nth-child(2) { animation-delay: .18s; }
.aica-typing span:nth-child(3) { animation-delay: .36s; }
@keyframes aicaBlink { 0%,60%,100% { opacity:.28; transform: translateY(0);} 30% { opacity:1; transform: translateY(-2px);} }

/* composer */
.aica-foot { border-top: 1px solid #ecedf2; padding: 10px; background: #fff; }
.aica-preview-wrap { display: none; align-items: center; gap: 8px; margin-bottom: 8px;
    background: #f5f6fa; border: 1px solid #e6e8f0; border-radius: 10px; padding: 6px 8px; }
.aica-preview-wrap img { width: 42px; height: 42px; object-fit: cover; border-radius: 8px; }
.aica-preview-wrap .aica-pv-x { margin-left: auto; border: 0; background: transparent; cursor: pointer; font-size: 17px; color: #8a8f9c; }
.aica-inrow { display: flex; align-items: center; gap: 8px; }
.aica-attach { border: 0; background: #f0f1f6; width: 38px; height: 38px; border-radius: 10px; cursor: pointer;
    display: flex; align-items: center; justify-content: center; flex: 0 0 38px; }
.aica-attach:hover { background: #e6e8f0; }
.aica-attach svg { width: 19px !important; height: 19px !important; }
.aica-inrow input[type=text] { flex: 1; border: 1px solid #e0e2ec; border-radius: 10px; padding: 10px 12px;
    font-size: 14px; outline: none; background: #fff; }
.aica-inrow input[type=text]:focus { border-color: #c7cad6; }
.aica-send { border: 0; color: #fff; border-radius: 10px; width: 40px; height: 38px; cursor: pointer;
    display: flex; align-items: center; justify-content: center; flex: 0 0 40px; }
.aica-send svg { width: 17px !important; height: 17px !important; }
.aica-send[disabled] { opacity: .55; cursor: default; }

@media (max-width: 600px) {
    /* Full-screen sheet on phones. Pin to all four edges (small insets) so it
       fills the visible viewport — no vh math, so the mobile address bar can't
       clip the top or push the composer off-screen. */
    .aica-panel {
        top: 10px; left: 10px; right: 10px; bottom: 10px;
        width: auto; max-width: none;
        height: auto; max-height: none;
        border-radius: 14px;
    }
    #aica-root { right: 16px; bottom: 16px; }
    /* The open sheet covers the screen, so hide the floating launcher behind it. */
    .aica-panel.open ~ .aica-btn-wrap { display: none; }
    .aica-col { max-width: 84%; }
    .aica-bubble img.aica-sent { max-width: 60vw; }
}

/* Inline (shortcode) mode */
.aica-inline-host { position: static; }
.aica-inline-host .aica-panel.aica-static, .aica-panel.aica-static.open {
    position: static; width: 100%; max-width: 100%; height: var(--aica-h, 540px); max-height: 80vh;
    bottom: auto; right: auto; opacity: 1; transform: none; display: flex;
    box-shadow: 0 6px 24px rgba(0,0,0,.10); border: 1px solid #e6e8f0; margin: 0 0 20px;
}

/* Product cards */
.aica-cards { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.aica-card { display: flex; gap: 10px; background: #fff; border: 1px solid #e6e8f0; border-radius: 12px;
    padding: 8px; box-shadow: 0 1px 3px rgba(0,0,0,.05); }
.aica-card-img { width: 74px; height: 74px; flex: 0 0 74px; border-radius: 9px; overflow: hidden;
    background: #f2f3f7; display: flex; align-items: center; justify-content: center; }
.aica-card-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.aica-card-noimg { font-size: 10px; color: #9aa0ae; text-align: center; }
.aica-card-b { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.aica-card-name { font-size: 13px; font-weight: 600; color: #2b2f3a; line-height: 1.3; }
.aica-card-price { font-size: 13px; }
.aica-price { font-weight: 700; color: #16a34a; }
.aica-price-old { margin-left: 6px; color: #9aa0ae; text-decoration: line-through; font-size: 12px; }
.aica-buy { display: inline-block; align-self: flex-start; margin-top: 2px; padding: 5px 12px; border-radius: 8px;
    color: #fff !important; font-size: 12px; font-weight: 600; text-decoration: none !important; }
.aica-buy:hover { opacity: .92; }

/* Photo gallery */
.aica-gallery { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.aica-gallery img { width: 78px; height: 78px; object-fit: cover; border-radius: 8px; border: 1px solid #e6e8f0; display: block; }

/* Links & attachments */
.aica-link { color: inherit; text-decoration: underline; word-break: break-all; }
.aica-row.me .aica-link { color: #fff; }
.aica-file { display: inline-flex; align-items: center; gap: 8px; margin-top: 8px; padding: 8px 10px;
    background: #f5f6fa; border: 1px solid #e6e8f0; border-radius: 10px; text-decoration: none !important;
    color: #2b2f3a !important; max-width: 100%; }
.aica-file:hover { background: #eef0f6; }
.aica-file-ic { font-size: 10px; font-weight: 700; letter-spacing: .04em; background: #fff; border: 1px solid #e0e2ec;
    border-radius: 6px; padding: 3px 6px; color: #5b6070; flex: none; }
.aica-file-nm { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.aica-video { display: block; margin-top: 8px; max-width: 100%; border-radius: 10px; background: #000; }

/* ---- Quoted replies ---- */
.aica-reply { border: 0; background: transparent; cursor: pointer; color: #8a8f9c;
    font-size: 13px; line-height: 1; padding: 0 4px; margin-left: 4px; opacity: .7; }
.aica-reply:hover { opacity: 1; }
.aica-quote { border-left: 3px solid rgba(0,0,0,.25); background: rgba(0,0,0,.05);
    border-radius: 5px; padding: 3px 8px; margin-bottom: 5px; font-size: 12.5px; opacity: .85;
    white-space: normal; word-break: break-word; }
.aica-row.me .aica-quote { border-left-color: rgba(255,255,255,.7); background: rgba(255,255,255,.18); }
.aica-reply-bar { display: none; align-items: center; gap: 8px; margin-bottom: 8px;
    padding: 6px 10px; background: #f1f2f7; border-left: 3px solid #b9bfd0; border-radius: 6px; }
.aica-reply-bar .aica-reply-body { flex: 1 1 auto; min-width: 0; font-size: 12.5px; color: #5b6070;
    overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.aica-reply-bar .aica-reply-x { flex: 0 0 auto; border: 0; background: transparent; cursor: pointer;
    font-size: 17px; color: #8a8f9c; }
