#ai-bubble {
    position: fixed; bottom: 24px; left: 20px; z-index: 3000;
    width: 56px; height: 56px; border-radius: 50%; border: none; cursor: pointer;
    background: linear-gradient(135deg,#2563eb,#1d4ed8);
    box-shadow: 0 4px 20px rgba(37,99,235,0.45);
    display: flex; align-items: center; justify-content: center;
    transition: transform .2s, box-shadow .2s;
}
#ai-bubble:hover { transform: scale(1.08); box-shadow: 0 6px 28px rgba(37,99,235,0.55); }
#ai-bubble:active { transform: scale(0.95); }
#ai-bubble svg { width: 26px; height: 26px; }
#ai-badge {
    position:absolute; top:6px; right:6px; width:10px; height:10px;
    background:#22c55e; border-radius:50%; border:2px solid #1e3a8a; display:none;
}
#ai-chat {
    position: fixed; bottom: 88px; left: 16px; z-index: 2999;
    width: min(360px, calc(100vw - 32px));
    width: 340px; max-height: 520px; border-radius: 16px; overflow: hidden;
    display: none; flex-direction: column;
    background: var(--card, #1e293b);
    box-shadow: 0 8px 40px rgba(0,0,0,0.45);
    border: 1px solid var(--border, #334155);
    animation: chatIn 0.25s cubic-bezier(0.34,1.56,0.64,1);
}
#ai-chat.open { display: flex; }
@keyframes chatIn {
    from { opacity:0; transform:translateY(16px) scale(0.96); }
    to   { opacity:1; transform:translateY(0)   scale(1); }
}
#ai-header {
    display:flex; align-items:center; gap:10px; padding:12px 14px;
    background: linear-gradient(135deg,#2563eb,#1d4ed8); flex-shrink:0;
}
#ai-header svg { width:22px; height:22px; flex-shrink:0; }
.ai-header-text { flex:1; }
.ai-header-title { font-size:0.9rem; font-weight:800; color:white; line-height:1; }
.ai-header-sub   { font-size:0.65rem; color:rgba(255,255,255,0.75); font-weight:600; margin-top:2px; }
#ai-close {
    background:rgba(255,255,255,0.15); border:none; color:white; cursor:pointer;
    width:24px; height:24px; border-radius:50%; font-size:0.75rem; display:flex;
    align-items:center; justify-content:center; transition:background .15s;
}
#ai-close:hover { background:rgba(255,255,255,0.3); }
#ai-messages {
    flex:1; overflow-y:auto; padding:12px 12px 4px; display:flex;
    flex-direction:column; gap:8px; scroll-behavior:smooth;
}
#ai-messages::-webkit-scrollbar { width:4px; }
#ai-messages::-webkit-scrollbar-track { background:transparent; }
#ai-messages::-webkit-scrollbar-thumb { background:var(--border,#334155); border-radius:4px; }
.ai-msg {
    max-width:88%; padding:9px 12px; border-radius:12px; font-size:0.82rem;
    line-height:1.5; word-break:break-word; animation:msgIn .18s ease;
}
@keyframes msgIn { from{opacity:0;transform:translateY(6px)} to{opacity:1;transform:none} }
.ai-msg.user {
    align-self:flex-end; background:#2563eb; color:white; border-bottom-right-radius:4px;
}
.ai-msg.bot {
    align-self:flex-start; background:var(--hover,#273548); color:var(--text,#e2e8f0);
    border-bottom-left-radius:4px;
}
.ai-msg.bot ul  { margin:4px 0 4px 0; padding-left:18px; }
.ai-msg.bot li  { margin:2px 0; }
.ai-msg.bot p   { margin:4px 0; }
.ai-msg.bot strong { color:#93c5fd; }
.ai-msg.bot h3  { font-size:0.85rem; font-weight:700; margin:6px 0 2px; color:#93c5fd; }
.ai-msg.bot a   { color:#60a5fa; }
.ai-msg.bot.typing {
    display:flex; gap:5px; align-items:center; padding:10px 14px;
}
.ai-dot {
    width:7px; height:7px; background:var(--muted,#64748b); border-radius:50%;
    animation:dot .9s infinite ease-in-out;
}
.ai-dot:nth-child(2){animation-delay:.18s}
.ai-dot:nth-child(3){animation-delay:.36s}
@keyframes dot { 0%,80%,100%{transform:scale(0.7);opacity:.5} 40%{transform:scale(1);opacity:1} }
#ai-suggestions {
    display:flex; gap:6px; flex-wrap:wrap; padding:6px 10px 2px; flex-shrink:0;
}
.ai-chip {
    background:var(--hover,#273548); border:1px solid var(--border,#334155);
    color:var(--text,#e2e8f0); border-radius:20px; padding:4px 10px; font-size:0.72rem;
    cursor:pointer; transition:background .15s, transform .1s; white-space:nowrap;
}
.ai-chip:hover { background:var(--border,#334155); transform:scale(1.04); }
#ai-input-area {
    display:flex; gap:6px; padding:10px; border-top:1px solid var(--border,#334155);
    flex-shrink:0; background:var(--card,#1e293b);
}
#ai-input {
    flex:1; background:var(--hover,#273548); border:1px solid var(--border,#334155);
    border-radius:10px; padding:8px 12px; color:var(--text,#e2e8f0); font-size:0.83rem;
    resize:none; outline:none; line-height:1.4; max-height:80px; overflow-y:auto; font-family:inherit;
}
#ai-input:focus { border-color:#2563eb; }
#ai-send {
    width:36px; height:36px; border-radius:10px; border:none; background:#2563eb;
    cursor:pointer; display:flex; align-items:center; justify-content:center;
    transition:background .15s, transform .1s; flex-shrink:0; align-self:flex-end;
}
#ai-send:hover { background:#1d4ed8; transform:scale(1.05); }
#ai-send:disabled { background:var(--border,#334155); cursor:not-allowed; transform:none; }
#ai-send svg { width:16px; fill:white; }
