#baige-ai-support {
    --ai-accent: #2563eb;
    --ai-accent-dark: #1d4ed8;
    --ai-surface: #ffffff;
    --ai-border: #e2e8f0;
    --ai-muted: #64748b;
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 2147483000;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
    color: #0f172a;
}

#baige-ai-support[hidden] { display: none !important; }

.baige-ai-launcher {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    min-height: 48px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--ai-accent), #4f46e5);
    color: #fff;
    box-shadow: 0 12px 28px rgba(37, 99, 235, .28);
    cursor: pointer;
    transition: transform .18s ease, box-shadow .18s ease;
}
.baige-ai-launcher:hover { transform: translateY(-2px); box-shadow: 0 16px 32px rgba(37, 99, 235, .34); }
.baige-ai-launcher:focus-visible, .baige-ai-close:focus-visible, .baige-ai-send:focus-visible,
.baige-ai-recommendation:focus-visible, .baige-ai-feedback button:focus-visible { outline: 3px solid rgba(37, 99, 235, .32); outline-offset: 2px; }
.baige-ai-launcher svg { width: 20px; height: 20px; fill: currentColor; }

.baige-ai-panel {
    display: none;
    flex-direction: column;
    box-sizing: border-box;
    width: min(390px, calc(100vw - 32px));
    height: min(650px, calc(100vh - 48px));
    max-height: calc(100dvh - 48px);
    margin-bottom: 12px;
    overflow: hidden;
    border: 1px solid rgba(226, 232, 240, .92);
    border-radius: 18px;
    background: var(--ai-surface);
    box-shadow: 0 24px 70px rgba(15, 23, 42, .22);
}
.baige-ai-panel.is-open { display: flex; animation: baige-ai-rise .18s ease-out both; }
@keyframes baige-ai-rise { from { opacity: 0; transform: translateY(10px) scale(.98); } to { opacity: 1; transform: none; } }

.baige-ai-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 15px 16px; color: #fff; background: linear-gradient(135deg, #1e3a8a, var(--ai-accent)); }
.baige-ai-header-copy { min-width: 0; }
.baige-ai-title { margin: 0; font-size: 15px; font-weight: 700; }
.baige-ai-subtitle { margin: 3px 0 0; color: rgba(255,255,255,.78); font-size: 12px; }
.baige-ai-close { width: 32px; height: 32px; flex: 0 0 auto; border: 0; border-radius: 9px; background: rgba(255,255,255,.12); color: #fff; cursor: pointer; font-size: 21px; line-height: 1; }

.baige-ai-messages { flex: 1; min-height: 0; overflow-y: auto; padding: 16px; background: #f8fafc; }
.baige-ai-message { display: flex; margin-bottom: 12px; }
.baige-ai-message.user { justify-content: flex-end; }
.baige-ai-bubble { max-width: 84%; padding: 10px 12px; border-radius: 13px 13px 13px 4px; background: #fff; border: 1px solid var(--ai-border); color: #1e293b; font-size: 13px; line-height: 1.62; white-space: pre-wrap; overflow-wrap: anywhere; }
.baige-ai-message.user .baige-ai-bubble { border: 0; border-radius: 13px 13px 4px 13px; background: var(--ai-accent); color: #fff; }
.baige-ai-error .baige-ai-bubble { border-color: #fecaca; background: #fff7f7; color: #b91c1c; }
.baige-ai-citations { margin-top: 10px; padding-top: 9px; border-top: 1px solid var(--ai-border); }
.baige-ai-citations-title { color: var(--ai-muted); font-size: 11px; font-weight: 700; }
.baige-ai-citation { margin-top: 5px; color: #334155; font-size: 11px; }
.baige-ai-citation strong { color: #0f172a; }
.baige-ai-details { margin-top: 9px; color: var(--ai-muted); font-size: 11px; }
.baige-ai-details summary { cursor: pointer; }
.baige-ai-feedback { display: flex; gap: 6px; margin-top: 9px; }
.baige-ai-feedback button { padding: 3px 7px; border: 1px solid var(--ai-border); border-radius: 7px; background: #fff; color: var(--ai-muted); cursor: pointer; font-size: 11px; }
.baige-ai-feedback button.is-selected { border-color: #93c5fd; background: #eff6ff; color: var(--ai-accent-dark); }

.baige-ai-recommendations { padding: 0 16px 12px; background: #f8fafc; }
.baige-ai-recommendation { display: block; width: 100%; margin-top: 6px; padding: 8px 10px; border: 1px solid #bfdbfe; border-radius: 9px; background: #eff6ff; color: #1d4ed8; text-align: left; cursor: pointer; font-size: 12px; }
.baige-ai-recommendation:hover { background: #dbeafe; }

.baige-ai-composer { display: flex; align-items: flex-end; gap: 8px; padding: 11px; border-top: 1px solid var(--ai-border); background: #fff; }
.baige-ai-input { flex: 1; min-height: 38px; max-height: 100px; resize: none; padding: 10px 11px; border: 1px solid var(--ai-border); border-radius: 10px; color: #0f172a; font: inherit; font-size: 13px; line-height: 1.4; }
.baige-ai-input:focus { border-color: #93c5fd; outline: 2px solid rgba(37,99,235,.12); }
.baige-ai-send { width: 40px; height: 40px; flex: 0 0 auto; border: 0; border-radius: 10px; background: var(--ai-accent); color: #fff; cursor: pointer; font-size: 17px; }
.baige-ai-send:disabled { opacity: .55; cursor: wait; }
.baige-ai-status { min-height: 15px; padding: 0 16px 8px; color: var(--ai-muted); background: #fff; font-size: 11px; }

@media (max-width: 520px) {
    #baige-ai-support { right: 12px; bottom: max(12px, env(safe-area-inset-bottom)); }
    .baige-ai-panel {
        width: calc(100vw - 24px);
        height: min(720px, calc(100dvh - 24px));
        max-height: calc(100dvh - 24px);
        margin-bottom: 8px;
        border-radius: 16px;
    }
    .baige-ai-launcher { width: 44px; height: 44px; min-height: 44px; }
}
@media (prefers-reduced-motion: reduce) {
    .baige-ai-panel.is-open, .baige-ai-launcher { animation: none; transition: none; }
}
