*{box-sizing:border-box;margin:0;padding:0}
body{font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,sans-serif;background:#f1f5f9;height:100vh;overflow:hidden}
.chat-container{display:flex;flex-direction:column;height:100vh;max-width:900px;margin:0 auto;background:#fff;box-shadow:0 0 40px rgba(0,0,0,.08)}
.chat-header{background:linear-gradient(135deg,#10a37f,#0d8c6c);color:#fff;padding:16px 20px;display:flex;align-items:center;gap:12px;flex-shrink:0}
.chat-header .avatar{width:44px;height:44px;border-radius:50%;background:rgba(255,255,255,.25);display:flex;align-items:center;justify-content:center;font-size:22px;flex-shrink:0}
.chat-header .info{flex:1;min-width:0}
.chat-header h1{font-size:16px;font-weight:600;color:#fff}
.chat-header p{font-size:12px;opacity:.9;color:#fff;margin-top:2px}
.chat-header .status{display:inline-block;width:8px;height:8px;background:#4ade80;border-radius:50%;margin-right:4px}
.chat-header .close-btn{background:rgba(255,255,255,.15);border:none;color:#fff;font-size:22px;width:36px;height:36px;border-radius:50%;cursor:pointer;display:flex;align-items:center;justify-content:center;line-height:1}
.chat-header .close-btn:hover{background:rgba(255,255,255,.3)}
#chat-body{flex:1;overflow-y:auto;padding:20px;background:#f7f8fa;display:flex;flex-direction:column;gap:12px}
#chat-body::-webkit-scrollbar{width:8px}
#chat-body::-webkit-scrollbar-thumb{background:#cbd5e1;border-radius:4px}
.msg{max-width:75%;padding:10px 14px;border-radius:14px;font-size:14px;line-height:1.55;word-wrap:break-word;white-space:pre-wrap;animation:fadeIn .25s ease}
@keyframes fadeIn{from{opacity:0;transform:translateY(6px)}to{opacity:1;transform:none}}
.msg.user{align-self:flex-end;background:#10a37f;color:#fff;border-bottom-right-radius:4px}
.msg.bot,.msg.agent{align-self:flex-start;background:#fff;color:#1e293b;border-bottom-left-radius:4px;box-shadow:0 1px 2px rgba(0,0,0,.06)}
.msg.agent{border-left:3px solid #10a37f}
.msg.system{align-self:center;background:#fef3c7;color:#92400e;font-size:12px;padding:6px 12px;border-radius:10px;text-align:center;max-width:90%}
.msg a{color:#10a37f;font-weight:600}
.msg .img{max-width:100%;max-height:260px;border-radius:10px;margin-top:6px;cursor:pointer;display:block}
.msg .file{display:flex;align-items:center;gap:10px;background:rgba(0,0,0,.05);padding:10px 12px;border-radius:10px;margin-top:6px;text-decoration:none;color:inherit}
.msg.user .file{background:rgba(255,255,255,.2)}
.msg .file-icon{width:32px;height:32px;flex-shrink:0;display:flex;align-items:center;justify-content:center;background:#10a37f;border-radius:6px;color:#fff;font-size:16px}
.msg .file-info{flex:1;min-width:0}
.msg .file-name{font-size:13px;font-weight:600;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.msg .file-size{font-size:11px;opacity:.7;margin-top:2px}
.upload-progress{align-self:flex-end;background:#10a37f;color:#fff;padding:10px 14px;border-radius:14px;font-size:13px}
.typing{align-self:flex-start;background:#fff;padding:12px 16px;border-radius:14px;display:flex;gap:4px;box-shadow:0 1px 2px rgba(0,0,0,.06)}
.typing span{width:7px;height:7px;background:#94a3b8;border-radius:50%;animation:bounce 1.2s infinite}
.typing span:nth-child(2){animation-delay:.2s}
.typing span:nth-child(3){animation-delay:.4s}
@keyframes bounce{0%,60%,100%{transform:translateY(0);opacity:.5}30%{transform:translateY(-6px);opacity:1}}
#canned-bar{display:flex;flex-wrap:wrap;gap:6px;padding:0 16px 8px;background:#fff;border-top:1px solid #f1f5f9}
#canned-bar:empty{display:none}
.canned-btn{background:#f1f5f9;border:1px solid #e2e8f0;color:#475569;padding:5px 10px;border-radius:14px;font-size:12px;font-weight:500;cursor:pointer}
.canned-btn:hover{background:#10a37f;color:#fff;border-color:#10a37f}
#chat-form{display:flex;padding:12px 16px;background:#fff;border-top:1px solid #e5e7eb;gap:8px;align-items:center;flex-shrink:0}
#attach-btn{width:42px;height:42px;border-radius:50%;background:#f1f5f9;border:none;cursor:pointer;display:flex;align-items:center;justify-content:center;flex-shrink:0}
#attach-btn:hover{background:#e2e8f0}
#attach-btn svg{width:20px;height:20px;fill:#64748b}
#file-input{display:none}
#chat-input{flex:1;border:1px solid #e5e7eb;border-radius:22px;padding:10px 16px;font-size:14px;outline:none;color:#1e293b;font-family:inherit;background:#fff}
#chat-input:focus{border-color:#10a37f}
#send-btn{width:42px;height:42px;border-radius:50%;background:#10a37f;border:none;cursor:pointer;display:flex;align-items:center;justify-content:center;padding:0;flex-shrink:0}
#send-btn:disabled{background:#cbd5e1;cursor:not-allowed}
#send-btn svg{width:18px;height:18px;fill:#fff}
.chat-footer{text-align:center;padding:6px;font-size:11px;color:#94a3b8;background:#fff;border-top:1px solid #f1f5f9;flex-shrink:0}
@media (max-width:480px){
  .chat-header{padding:12px 16px}
  .chat-header h1{font-size:15px}
  #chat-body{padding:14px}
  .msg{max-width:85%}
}