.chat-fab{position:fixed;right:24px;bottom:92px;z-index:80;display:none;align-items:center;gap:8px;padding:11px 16px;border-radius:999px;background:var(--primary);color:#fff;font-size:12px;box-shadow:0 10px 28px #f4774930;transition:transform .15s,background .15s}
.chat-fab:hover{background:var(--primary-hover);transform:translateY(-1px)}
.chat-fab svg{width:16px;height:16px}
.chat-panel{position:fixed;right:24px;bottom:24px;width:390px;max-width:calc(100vw - 32px);height:min(620px,calc(100vh - 140px));display:none;flex-direction:column;background:var(--panel);border:1px solid var(--border);border-radius:14px;box-shadow:0 24px 70px #0000001f;z-index:90;overflow:hidden}
.chat-panel.open{display:flex}
.chat-head{display:flex;align-items:center;gap:10px;padding:14px 16px;border-bottom:1px solid var(--border);background:var(--panel-alt)}
.chat-head strong{font-size:13px;letter-spacing:-.2px}
.chat-head small{display:block;font-size:9px;color:var(--muted);margin-top:2px}
.chat-head .chat-model{margin-left:auto;font-size:10px;padding:5px 7px;border-radius:6px;max-width:150px;background:var(--panel);border:1px solid var(--border);color:var(--text)}
.chat-close{width:26px;height:26px;display:grid;place-items:center;border-radius:6px;color:var(--muted)}
.chat-close:hover{background:var(--panel);color:var(--text)}
.chat-body{flex:1;overflow-y:auto;padding:16px;display:flex;flex-direction:column;gap:12px;background:var(--bg)}
.chat-empty{margin:auto;text-align:center;color:var(--muted);font-size:11px;line-height:1.9;max-width:250px}
.chat-empty b{display:block;color:var(--text);font-size:12px;margin-bottom:6px}
.chat-msg{max-width:86%;padding:10px 13px;border-radius:11px;font-size:12px;line-height:1.75;white-space:pre-wrap;word-break:break-word}
.chat-msg.user{align-self:flex-end;background:var(--primary);color:#fff;border-bottom-right-radius:4px}
.chat-msg.assistant{align-self:flex-start;background:var(--panel);border:1px solid var(--border);border-bottom-left-radius:4px}
.chat-msg.error{align-self:flex-start;background:#bf665c14;border:1px solid #bf665c44;color:#bf665c}
.chat-msg.pending{align-self:flex-start;background:var(--panel);border:1px solid var(--border);color:var(--muted);font-size:11px}
.chat-foot{border-top:1px solid var(--border);padding:11px 13px 12px;background:var(--panel)}
.chat-input{display:flex;align-items:flex-end;gap:8px}
.chat-input textarea{flex:1;min-height:40px;max-height:120px;resize:none;font-size:12px;line-height:1.6;padding:10px 11px;border-radius:9px;background:var(--panel-alt);border:1px solid var(--border)}
.chat-send{width:36px;height:36px;display:grid;place-items:center;border-radius:9px;background:var(--primary);color:#fff;flex-shrink:0}
.chat-send:disabled{background:var(--border);color:var(--muted)}
.chat-meta{display:flex;align-items:center;justify-content:space-between;margin-top:7px;font-size:9px;color:var(--muted)}
.chat-meta a{color:var(--primary)}
@media(max-width:600px){
  .chat-fab{right:15px;bottom:80px;padding:10px 13px;font-size:11px}
  .chat-panel{right:0;bottom:0;width:100%;height:min(78vh,640px);border-radius:14px 14px 0 0}
}
