#cps-chatbot{position:fixed;right:18px;bottom:18px;z-index:99999;font-family:Arial,sans-serif;--cps-primary:#e53935;--cps-panel-bg:#fff;--cps-header-bg:#111;--cps-header-text:#fff;--cps-quick-bg:#0f131b;--cps-quick-text:#e8ecf5}
#cps-chat-toggle{background:var(--cps-header-bg);color:var(--cps-header-text);border:none;border-radius:999px;padding:12px 16px;cursor:pointer}
#cps-chat-panel{width:360px;height:min(76vh,560px);background:var(--cps-panel-bg);border:1px solid #ddd;border-radius:12px;box-shadow:0 10px 30px rgba(0,0,0,.2);display:flex;flex-direction:column;overflow:hidden;margin-top:8px}
#cps-chat-panel.hidden{display:none}
#cps-chat-head{background:var(--cps-header-bg);color:var(--cps-header-text);padding:10px 12px;font-weight:700;display:flex;justify-content:space-between;align-items:center}
#cps-chat-reset{background:#2f2f2f;color:#fff;border:none;border-radius:6px;padding:4px 8px;cursor:pointer}
#cps-chat-quick{display:flex;gap:6px;flex-wrap:wrap;padding:8px;border-bottom:1px solid #1e2430;background:var(--cps-quick-bg)}
.cps-chip{border:1px solid #2a2f3a;background:#161a22;color:var(--cps-quick-text);border-radius:999px;padding:6px 11px;font-size:12px;cursor:pointer;font-weight:600;opacity:1}
.cps-chip:hover{background:#202736;border-color:#3a4354;color:#fff}
#cps-chat-body{flex:1;padding:10px;overflow:auto;background:#fafafa}
#cps-chat-body .msg{margin:8px 0;padding:8px 10px;border-radius:10px;max-width:94%}
#cps-chat-body .u{background:#e8f0ff;margin-left:auto}
#cps-chat-body .b{background:#fff;border:1px solid #eee}
#cps-chat-body .typing{font-style:italic;color:#666}
#cps-chat-body .ts{font-size:10px;color:#8a8a8a;margin-top:4px;text-align:right}
#cps-chat-actions{display:grid;grid-template-columns:1fr;gap:8px;padding:8px;border-top:1px solid #eee;background:#fff}
#cps-chat-actions a{display:flex;align-items:center;justify-content:center;background:var(--cps-header-bg);color:var(--cps-header-text);text-decoration:none;padding:9px 10px;border-radius:8px;font-size:12px;font-weight:600;min-height:36px}
#cps-chat-input-wrap{display:flex;gap:6px;padding:8px;border-top:1px solid #eee;background:#fff;position:sticky;bottom:0}
#cps-chat-input{flex:1;padding:8px}
#cps-chat-send,#cps-lead-submit{padding:8px 10px;background:var(--cps-primary);color:#fff;border:none;border-radius:8px;cursor:pointer}
#cps-lead-form input{width:100%;margin:4px 0;padding:8px;border:1px solid #ddd;border-radius:6px}
#cps-lead-form textarea{width:100%;margin:4px 0;padding:8px;border:1px solid #ddd;border-radius:6px;min-height:84px;resize:vertical}
.cps-label{font-size:12px;color:#444;display:block;margin-top:6px}
.cps-hint{font-size:11px;color:#d93025;min-height:14px}
@media (max-width:640px){
  #cps-chatbot{right:10px;left:10px;bottom:10px}
  #cps-chat-toggle{width:100%}
  #cps-chat-panel{width:auto;height:72vh}
  #cps-chat-actions{grid-template-columns:1fr}
  #cps-chat-actions a{font-size:12px;padding:8px 8px}
}

#cps-chat-body .typing{display:flex;align-items:center;gap:8px;font-style:normal;color:#666}
#cps-chat-body .typing .typing-label{font-size:12px}
#cps-chat-body .typing-dots{display:inline-flex;gap:4px;align-items:center}
#cps-chat-body .typing-dots span{width:6px;height:6px;border-radius:50%;background:#999;display:inline-block;animation:cpsTypingBounce 1.2s infinite ease-in-out}
#cps-chat-body .typing-dots span:nth-child(2){animation-delay:.15s}
#cps-chat-body .typing-dots span:nth-child(3){animation-delay:.3s}
@keyframes cpsTypingBounce{0%,80%,100%{transform:translateY(0);opacity:.45}40%{transform:translateY(-4px);opacity:1}}


/* v0.5.1 overflow/wrapping hardening */
#cps-chatbot, #cps-chatbot *{box-sizing:border-box}
#cps-chat-panel{width:min(380px, calc(100vw - 24px));max-width:100%;overflow:hidden}
#cps-chat-body{overflow-y:auto;overflow-x:hidden;word-wrap:break-word;overflow-wrap:anywhere}
#cps-chat-body .msg{max-width:100%;min-width:0;overflow:hidden}
#cps-chat-body .msg .txt{white-space:pre-wrap;word-break:break-word;overflow-wrap:anywhere}
#cps-chat-body .msg a{word-break:break-all;overflow-wrap:anywhere}
#cps-chat-input-wrap{width:100%;align-items:center}
#cps-chat-input{min-width:0;width:100%}
#cps-chat-send{flex:0 0 auto}
#cps-chat-quick{overflow-x:auto;overflow-y:hidden;white-space:nowrap}
#cps-chat-quick .cps-chip{flex:0 0 auto}
@media (max-width:640px){
  #cps-chatbot{right:10px;left:10px;bottom:10px}
  #cps-chat-panel{width:100%;max-width:100%;height:min(78vh,640px)}
  #cps-chat-input-wrap{padding:8px}
}
