*{box-sizing:border-box;margin:0;padding:0}
body{font-family:system-ui,sans-serif;background:#f1f5f9;color:#0f172a;height:100vh;overflow:hidden}
button{cursor:pointer;font-family:inherit}
#login{height:100vh;display:flex;align-items:center;justify-content:center;background:linear-gradient(135deg,#10a37f,#0d8c6c)}
#login .box{background:#fff;padding:40px;border-radius:16px;box-shadow:0 20px 60px rgba(0,0,0,.2);width:100%;max-width:380px}
#login h2{margin-bottom:20px;color:#10a37f}
#login input{width:100%;padding:12px 16px;border:1px solid #cbd5e1;border-radius:8px;font-size:14px;margin-bottom:12px}
#login input:focus{outline:none;border-color:#10a37f}
#login button{width:100%;padding:12px;background:#10a37f;color:#fff;border:none;border-radius:8px;font-size:15px;font-weight:600}
#login .err{color:#ef4444;font-size:13px;margin-top:8px;min-height:18px}
#app{display:none;height:100vh;grid-template-columns:300px 1fr 340px}
#app.show{display:grid}
.sidebar{background:#fff;border-right:1px solid #e2e8f0;display:flex;flex-direction:column}
.sidebar-header{padding:16px;border-bottom:1px solid #e2e8f0;display:flex;align-items:center;gap:10px}
.sidebar-header h3{font-size:15px;flex:1}
.sidebar-header button{background:#f1f5f9;border:none;padding:6px 10px;border-radius:6px;font-size:12px;color:#475569}
#conv-list{flex:1;overflow-y:auto}
.conv-item{padding:14px 16px;border-bottom:1px solid #f1f5f9;cursor:pointer}
.conv-item:hover{background:#f8fafc}
.conv-item.active{background:#e0f5ee;border-left:3px solid #10a37f}
.conv-item h4{font-size:14px;margin-bottom:4px;display:flex;align-items:center;gap:6px}
.conv-item p{font-size:12px;color:#64748b;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.conv-item .time{font-size:11px;color:#94a3b8;margin-top:4px}
.pill{font-size:10px;padding:2px 6px;border-radius:10px;font-weight:600}
.pill-ai{background:#dbeafe;color:#1e40af}
.pill-human{background:#fef3c7;color:#92400e}
.pill-closed{background:#e2e8f0;color:#475569}
.chat-area{display:flex;flex-direction:column;background:#f8fafc}
.chat-header{padding:14px 20px;background:#fff;border-bottom:1px solid #e2e8f0;display:flex;align-items:center;gap:12px}
.chat-header h2{font-size:15px}
.chat-header .meta{font-size:12px;color:#64748b}
.chat-header .actions{margin-left:auto;display:flex;gap:8px}
.chat-header .actions button{border:none;padding:8px 14px;border-radius:8px;font-size:13px;font-weight:600;color:#fff}
.btn-human{background:#f59e0b}
.btn-ai{background:#10a37f}
.btn-del{background:#ef4444}
#chat-body{flex:1;overflow-y:auto;padding:20px;display:flex;flex-direction:column;gap:12px}
.msg{max-width:70%;padding:10px 14px;border-radius:14px;font-size:14px;line-height:1.5;word-wrap:break-word;white-space:pre-wrap}
.msg.user{align-self:flex-end;background:#10a37f;color:#fff;border-bottom-right-radius:4px}
.msg.ai{align-self:flex-start;background:#fff;border-bottom-left-radius:4px;box-shadow:0 1px 2px rgba(0,0,0,.05)}
.msg.agent{align-self:flex-start;background:#fef3c7;border-bottom-left-radius:4px;border-left:3px solid #f59e0b}
.msg.system{align-self:center;background:#f1f5f9;color:#64748b;font-size:12px;padding:6px 12px;border-radius:10px}
.msg .sender{font-size:10px;text-transform:uppercase;opacity:.6;display:block;margin-bottom:4px}
.msg img{max-width:220px;max-height:200px;border-radius:8px;margin-top:6px;cursor:pointer}
.msg .admin-file{display:inline-flex;align-items:center;gap:8px;background:rgba(0,0,0,.08);padding:8px 12px;border-radius:8px;margin-top:6px;text-decoration:none;color:inherit;font-size:13px}
.msg.user .admin-file{background:rgba(255,255,255,.2)}
.empty{flex:1;display:flex;align-items:center;justify-content:center;color:#94a3b8;font-size:14px}
#canned-bar{display:flex;flex-wrap:wrap;gap:6px;padding:8px 12px;background:#fff;border-top:1px solid #e2e8f0}
.canned-btn{background:#f1f5f9;border:1px solid #e2e8f0;color:#475569;padding:5px 10px;border-radius:14px;font-size:11px;font-weight:500}
.canned-btn:hover{background:#10a37f;color:#fff;border-color:#10a37f}
#reply-box{display:flex;padding:12px;gap:8px;background:#fff;border-top:1px solid #e2e8f0}
#reply-input{flex:1;padding:10px 16px;border:1px solid #e2e8f0;border-radius:22px;font-size:14px;outline:none}
#reply-input:focus{border-color:#10a37f}
#reply-send{background:#10a37f;color:#fff;border:none;border-radius:22px;padding:0 24px;font-weight:600}
.panel{background:#fff;border-left:1px solid #e2e8f0;display:flex;flex-direction:column}
.tabs{display:flex;border-bottom:1px solid #e2e8f0}
.tab{flex:1;padding:12px;border:none;background:transparent;font-size:13px;font-weight:600;color:#64748b;border-bottom:2px solid transparent}
.tab.active{color:#10a37f;border-bottom-color:#10a37f}
.tab-content{display:none;flex:1;overflow-y:auto;padding:16px}
.tab-content.active{display:block}
.tab-content h3{font-size:13px;margin-bottom:10px;color:#0f172a}
.tab-content label{display:block;font-size:11px;color:#64748b;margin:10px 0 4px;font-weight:600}
.tab-content input,.tab-content textarea,.tab-content select{width:100%;padding:8px 10px;border:1px solid #e2e8f0;border-radius:6px;font-size:13px;font-family:inherit}
.tab-content textarea{resize:vertical;min-height:80px}
.tab-content button.save{width:100%;margin-top:12px;padding:10px;background:#10a37f;color:#fff;border:none;border-radius:8px;font-weight:600;font-size:13px}
.stats{display:grid;grid-template-columns:1fr 1fr;gap:8px;margin-bottom:16px}
.stat{background:#f8fafc;padding:10px;border-radius:8px;text-align:center}
.stat .num{font-size:18px;font-weight:700;color:#10a37f}
.stat .lbl{font-size:10px;color:#64748b;margin-top:2px}
.list-item{background:#f8fafc;border:1px solid #e2e8f0;border-radius:8px;padding:10px;margin-bottom:8px;font-size:12px}
.list-item .head{display:flex;justify-content:space-between;align-items:center;margin-bottom:6px}
.list-item .head strong{color:#0f172a;font-size:13px}
.list-item .head button{background:transparent;border:none;color:#ef4444;font-size:14px;cursor:pointer;padding:0 4px}
.list-item .body{color:#64748b;font-size:11px}
.add-box{background:#f0fdf4;border:1px dashed #10a37f;border-radius:8px;padding:10px;margin-bottom:12px}
.add-box button{width:100%;margin-top:8px;padding:8px;background:#10a37f;color:#fff;border:none;border-radius:6px;font-weight:600;font-size:12px}