.xxj-ai-root {
    --xxj-ai-primary: #0A3D62;
    --xxj-ai-teal: #1A7B8C;
    --xxj-ai-gold: #D4A54A;
    --xxj-ai-bg: #F5F7FA;
    --xxj-ai-text: #1A2A3A;
    position: fixed;
    right: 22px;
    bottom: 22px;
    z-index: 2200;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
    color: var(--xxj-ai-text);
    line-height: 1.5;
}

.xxj-ai-launcher {
    min-width: 132px;
    height: 52px;
    padding: 0 20px;
    border: 0;
    border-radius: 28px;
    background: linear-gradient(135deg, var(--xxj-ai-primary), var(--xxj-ai-teal));
    color: #fff;
    box-shadow: 0 10px 30px rgba(10, 61, 98, 0.28);
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: transform .2s ease, box-shadow .2s ease;
}

.xxj-ai-launcher:hover { transform: translateY(-2px); box-shadow: 0 14px 34px rgba(10, 61, 98, 0.34); }
.xxj-ai-launcher:focus-visible, .xxj-ai-send:focus-visible, .xxj-ai-quick:focus-visible, .xxj-ai-close:focus-visible, .xxj-ai-human:focus-visible { outline: 3px solid rgba(212, 165, 74, .55); outline-offset: 2px; }
.xxj-ai-launcher-icon { font-size: 20px; line-height: 1; }

.xxj-ai-badge {
    display: none;
    position: absolute;
    top: -5px;
    right: -3px;
    width: 19px;
    height: 19px;
    border-radius: 50%;
    background: #D94C4C;
    color: #fff;
    border: 2px solid #fff;
    font-size: 11px;
    align-items: center;
    justify-content: center;
}
.xxj-ai-badge.show { display: flex; }

.xxj-ai-panel {
    display: none;
    width: min(390px, calc(100vw - 28px));
    height: min(630px, calc(100vh - 105px));
    background: #fff;
    border: 1px solid rgba(10, 61, 98, .1);
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 22px 60px rgba(10, 35, 55, .22);
    flex-direction: column;
}
.xxj-ai-panel.open { display: flex; }
.xxj-ai-root.panel-open .xxj-ai-launcher { display: none; }

.xxj-ai-header {
    color: #fff;
    background: linear-gradient(135deg, var(--xxj-ai-primary), var(--xxj-ai-teal));
    padding: 15px 16px;
    display: flex;
    align-items: center;
    gap: 11px;
    flex: 0 0 auto;
}
.xxj-ai-avatar {
    width: 39px;
    height: 39px;
    border-radius: 50%;
    background: rgba(255,255,255,.16);
    border: 1px solid rgba(255,255,255,.28);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 19px;
}
.xxj-ai-title { flex: 1; min-width: 0; }
.xxj-ai-title strong { display: block; font-size: 15px; }
.xxj-ai-title span { display: block; font-size: 11px; opacity: .84; margin-top: 1px; }
.xxj-ai-close { border: 0; background: rgba(255,255,255,.12); color: #fff; width: 34px; height: 34px; border-radius: 50%; cursor: pointer; font-size: 20px; }

.xxj-ai-privacy {
    flex: 0 0 auto;
    padding: 8px 14px;
    background: #FFF9EB;
    border-bottom: 1px solid #F4E7C5;
    color: #75603A;
    font-size: 11px;
}

.xxj-ai-messages {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    padding: 14px;
    background: linear-gradient(180deg, #F8FAFC 0%, #F3F7F9 100%);
    scroll-behavior: smooth;
}
.xxj-ai-row { display: flex; margin-bottom: 11px; }
.xxj-ai-row.user { justify-content: flex-end; }
.xxj-ai-bubble {
    max-width: 86%;
    padding: 10px 12px;
    border-radius: 15px;
    font-size: 13px;
    white-space: pre-wrap;
    word-break: break-word;
}
.xxj-ai-row.assistant .xxj-ai-bubble { background: #fff; border: 1px solid #E3EBEF; border-bottom-left-radius: 5px; color: #263746; }
.xxj-ai-row.user .xxj-ai-bubble { background: var(--xxj-ai-teal); color: #fff; border-bottom-right-radius: 5px; }
.xxj-ai-typing { display: inline-flex; gap: 4px; align-items: center; min-height: 18px; }
.xxj-ai-typing i { width: 6px; height: 6px; border-radius: 50%; background: #8BA0AA; animation: xxj-ai-dot 1.1s infinite ease-in-out; }
.xxj-ai-typing i:nth-child(2) { animation-delay: .15s; }
.xxj-ai-typing i:nth-child(3) { animation-delay: .3s; }
@keyframes xxj-ai-dot { 0%, 60%, 100% { transform: translateY(0); opacity: .5; } 30% { transform: translateY(-4px); opacity: 1; } }

.xxj-ai-fitments { width: 100%; margin: -3px 0 12px; }
.xxj-ai-fitment {
    background: #fff;
    border: 1px solid #DCE8EC;
    border-left: 4px solid var(--xxj-ai-teal);
    border-radius: 11px;
    padding: 10px 11px;
    margin-top: 8px;
    font-size: 12px;
    color: #425461;
}
.xxj-ai-fitment strong { display: block; color: var(--xxj-ai-primary); font-size: 13px; margin-bottom: 4px; }
.xxj-ai-fitment div { margin-top: 2px; word-break: break-word; }
.xxj-ai-fitment-label { color: #758690; }
.xxj-ai-more { display: inline-block; margin: 8px 2px 0; color: var(--xxj-ai-teal); font-size: 12px; font-weight: 700; text-decoration: none; }
.xxj-ai-feedback-link { display: block; color: #B27C16; }

.xxj-ai-human {
    margin-top: 8px;
    border: 0;
    border-radius: 16px;
    padding: 7px 13px;
    background: var(--xxj-ai-gold);
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
}
.xxj-ai-qr { display: none; text-align: center; margin-top: 9px; padding: 9px; background: #fff; border-radius: 10px; border: 1px solid #E5E8EB; }
.xxj-ai-qr.show { display: block; }
.xxj-ai-qr img { display: block; width: 150px; max-width: 100%; height: auto; margin: 0 auto 5px; border-radius: 6px; }
.xxj-ai-qr small { color: #667780; font-size: 11px; }

.xxj-ai-quick-wrap { flex: 0 0 auto; display: flex; gap: 7px; padding: 9px 12px 5px; overflow-x: auto; background: #fff; scrollbar-width: none; }
.xxj-ai-quick-wrap::-webkit-scrollbar { display: none; }
.xxj-ai-quick {
    white-space: nowrap;
    border: 1px solid #CFE0E5;
    background: #F5FAFB;
    color: var(--xxj-ai-primary);
    border-radius: 16px;
    padding: 6px 10px;
    font-size: 11px;
    cursor: pointer;
}
.xxj-ai-quick:hover { border-color: var(--xxj-ai-teal); background: #EAF6F8; }

.xxj-ai-form { flex: 0 0 auto; display: flex; align-items: flex-end; gap: 8px; padding: 9px 12px 12px; background: #fff; }
.xxj-ai-input {
    flex: 1;
    height: 42px;
    max-height: 86px;
    resize: none;
    border: 1px solid #D7E1E5;
    border-radius: 14px;
    padding: 10px 12px;
    font: inherit;
    font-size: 13px;
    line-height: 20px;
    outline: none;
}
.xxj-ai-input:focus { border-color: var(--xxj-ai-teal); box-shadow: 0 0 0 3px rgba(26,123,140,.1); }
.xxj-ai-send { width: 42px; height: 42px; flex: 0 0 42px; border: 0; border-radius: 14px; background: var(--xxj-ai-primary); color: #fff; cursor: pointer; font-size: 18px; }
.xxj-ai-send:disabled { opacity: .5; cursor: not-allowed; }

@media (max-width: 560px) {
    .xxj-ai-root { left: 10px; right: 10px; bottom: 10px; }
    .xxj-ai-panel { width: 100%; height: min(680px, calc(100dvh - 20px)); border-radius: 16px; }
    .xxj-ai-launcher { min-width: 54px; width: 54px; padding: 0; margin-left: auto; }
    .xxj-ai-launcher-text { display: none; }
}

@media (prefers-reduced-motion: reduce) {
    .xxj-ai-launcher, .xxj-ai-messages { transition: none; scroll-behavior: auto; }
    .xxj-ai-typing i { animation: none; }
}
