:root{font-family:-apple-system,BlinkMacSystemFont,"PingFang SC","Microsoft YaHei","Helvetica Neue",Arial,sans-serif;font-size:13px;color:#20374e;background:#f3f6fa}
*{box-sizing:border-box}[hidden]{display:none!important}
.tag.claimed{background:#fde8e8;color:#b42318}.info .claim.warn{color:#b42318}table.claims{width:100%;border-collapse:collapse;font-size:12px}table.claims td{padding:4px 6px;border-bottom:1px solid #eef1f5;vertical-align:top}html,body{height:100%;margin:0}body{display:flex;flex-direction:column}
button{font:inherit;cursor:pointer;border:1px solid #cedce9;background:#fff;color:#355776;border-radius:6px;padding:6px 10px}button:hover{background:#f0f6fd}button.primary{background:#2379da;border-color:#2379da;color:#fff;white-space:nowrap}button.primary:hover{background:#1967bf}button.danger{color:#b4443f}button.text{border:0;background:transparent;color:#3b6fa0;padding:4px 6px}button.text:hover{background:transparent;color:#1968be}button:disabled{opacity:.45;cursor:not-allowed}
input,textarea,select{font:inherit;border:1px solid #cfdae5;border-radius:7px;padding:8px 10px;width:100%;background:#fafcfe;color:inherit}textarea{resize:vertical}
.muted{color:#7d8d9e;font-size:12px}.error{color:#b4443f;min-height:1em;font-size:12px}
dialog{border:0;border-radius:14px;padding:28px 30px;width:380px;box-shadow:0 20px 60px #0004}dialog::backdrop{background:#0f2746aa}dialog h1{margin:0 0 6px;font-size:22px}dialog h1 span{color:#2379da}dialog label{display:block;margin:12px 0 0}dialog label span{display:block;font-size:12px;color:#60778f;margin-bottom:4px}dialog .primary{width:100%;margin-top:14px;padding:10px}
header.top{display:flex;align-items:center;justify-content:space-between;gap:16px;padding:0 16px;height:52px;background:#102b45;color:#fff;flex:0 0 auto}
.brand{font-size:19px;font-weight:850}.brand>span{color:#63d6df}.brand small{font-size:12px;font-weight:500;color:#d4e1ed;margin-left:9px}
nav .tab{background:transparent;border:0;color:#c7d9e9;padding:8px 14px;border-radius:8px}nav .tab.active{background:#ffffff1f;color:#fff}
.me{display:flex;align-items:center;gap:10px}.me .text{color:#c7d9e9}.pill{font-size:11px;background:#ffffff1f;padding:3px 9px;border-radius:999px}
.me #soundToggle.off,.me #jumpToggle.off{opacity:.55}
.list-tools{padding:6px 10px;border-bottom:1px solid #e1e8ef;background:#fff}.list-tools .text{color:#b23b3b}#delConv{color:#b23b3b}
.pill.auto{cursor:pointer;border:0;color:#fff;font-weight:600}.pill.auto.on{background:#2e9e5b}.pill.auto.off{background:#8a6d3b}.pill.auto:hover{filter:brightness(1.1)}
.view{flex:1;min-height:0}
#view-chat{display:grid;grid-template-columns:var(--left,300px) 6px 1fr 6px var(--right,280px)}
.gutter{cursor:col-resize;background:#eef2f6;position:relative;z-index:1;touch-action:none}.gutter:hover,.gutter.active{background:#9fc1e8}body.resizing{user-select:none;cursor:col-resize}
.list{border-right:1px solid #e1e8ef;background:#fff;display:flex;flex-direction:column;min-height:0}
.filters{display:flex;gap:4px;padding:10px}.filters .f{flex:1;padding:6px 4px;font-size:12px;border-radius:999px}.filters .f.active{background:#2379da;border-color:#2379da;color:#fff}
.conv-list{overflow-y:auto;flex:1}.conv{padding:10px 12px;border-bottom:1px solid #eef2f6;cursor:pointer;display:flex;flex-direction:column;gap:3px}.conv:hover{background:#f6f9fc}.conv.active{background:#eaf3ff}
.conv .l1{display:flex;justify-content:space-between;gap:8px}.conv .l1 strong{font-size:13px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.conv .l1 time{font-size:11px;color:#8a97a5;flex:0 0 auto}
.conv .l2{display:flex;justify-content:space-between;gap:8px;font-size:12px;color:#60778f}.conv .l2 span{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.badge{background:#e5484d;color:#fff;font-size:10px;font-weight:700;border-radius:999px;padding:1px 6px;flex:0 0 auto}
.tag{font-size:10px;padding:1px 6px;border-radius:4px;background:#eef2f6;color:#60778f}.tag.waiting{background:#fff1e0;color:#9a5b00}.tag.active{background:#e6f6ee;color:#1d7a4c}.tag.bot{background:#eaf3ff;color:#2666b4}
.thread{display:flex;flex-direction:column;min-height:0;background:#f7f9fb}
.thread-head{display:flex;align-items:center;justify-content:space-between;padding:10px 16px;background:#fff;border-bottom:1px solid #e1e8ef}.thread-head .who{display:flex;flex-direction:column;gap:2px}.thread-head .acts{display:flex;gap:6px}
.messages{flex:1;overflow-y:auto;padding:16px;display:flex;flex-direction:column;gap:10px}.empty{color:#8a97a5;text-align:center;margin-top:40px}
.m{max-width:70%;display:flex;flex-direction:column;gap:3px}.m.visitor{align-self:flex-start}.m.agent,.m.bot{align-self:flex-end;align-items:flex-end}.m.system{align-self:center}
.m .b{padding:9px 12px;border-radius:14px;background:#fff;border:1px solid #e1e8ef;white-space:pre-wrap;overflow-wrap:anywhere;line-height:1.55}.m.agent .b{background:#2379da;color:#fff;border-color:#2379da}.m.bot .b{background:#e8f1fd;border-color:#cfe0f7}.m.system .b{background:transparent;border:0;color:#8a97a5;font-size:12px}
.m .b img{max-width:260px;max-height:260px;border-radius:10px;display:block}.m .t{font-size:10px;color:#8a97a5;padding:0 4px}
.composer{background:#fff;border-top:1px solid #e1e8ef;padding:8px 12px 12px}.composer .row{display:flex;gap:8px;align-items:flex-end}.attach{cursor:pointer;font-size:20px;padding:6px 4px}
.quick-row{display:flex;gap:6px;flex-wrap:wrap;margin-bottom:8px}.quick-row button{display:flex;align-items:center;gap:6px;padding:4px 8px;font-size:12px;border-radius:999px}.quick-row img{width:22px;height:22px;object-fit:cover;border-radius:4px}.quick-row .n{background:#eef2f6;border-radius:999px;padding:0 6px;font-size:10px}
.assist{border-left:1px solid #e1e8ef;background:#fff;padding:12px 14px;overflow-y:auto;min-height:0}.assist h2{font-size:12px;color:#60778f;margin:14px 0 8px;text-transform:none}.assist .row{display:flex;align-items:center;justify-content:space-between}.assist .row h2{margin:0}
.decision{margin:6px 0 10px;padding:8px 10px;border-radius:8px;font-size:12px;line-height:1.5;background:#fff4e5;color:#8a5a2b;border:1px solid #f3dcbf}.decision.auto,.decision.would,.decision.siteoff{background:#e6f6ee;color:#1d7a4c;border-color:#bfe6cf}.decision.human{background:#fde8e8;color:#a33;border-color:#f3c5c5}.decision.ai{background:#eaf3ff;color:#2666b4;border-color:#cfe0f7}
.sug{border:1px solid #dde6ef;border-radius:10px;padding:10px;margin-bottom:10px}.sug h3{font-size:12px;color:#60778f;margin:0 0 6px;font-weight:600}.sug .txt{white-space:pre-wrap;line-height:1.55;margin:0 0 8px}.sug .f{font-size:11px;color:#8a97a5;margin:0 0 8px}.sug .acts{display:flex;gap:6px;justify-content:flex-end}.sug .acts button{font-size:12px;padding:5px 10px}.sug.ref{opacity:.85}
.info{font-size:11.5px;line-height:1.5;color:#4a5e73}.info b{color:#20374e}.info>div{margin:2px 0;overflow-wrap:anywhere}
.info details.more{margin-top:6px;border-top:1px dashed #e1e8ef;padding-top:4px}.info details.more summary{cursor:pointer;color:#60778f;font-size:11px;list-style:none}.info details.more summary::before{content:'▸ '}.info details.more[open] summary::before{content:'▾ '}
#view-admin{overflow:auto;padding:16px}.admin-grid{display:grid;grid-template-columns:1fr 1fr;gap:16px;max-width:1200px;margin:0 auto}.card{background:#fff;border:1px solid #e1e8ef;border-radius:12px;padding:16px 18px}.card h2{margin:0 0 10px;font-size:14px}
.stats{display:grid;grid-template-columns:repeat(4,1fr);gap:10px}.stat{background:#f6f9fc;border-radius:10px;padding:10px 12px}.stat b{display:block;font-size:22px;color:#2379da}.stat span{font-size:11px;color:#60778f}
.site{border:1px solid #e1e8ef;border-radius:10px;padding:10px 12px;margin-bottom:10px}.site .l1{display:flex;justify-content:space-between;align-items:center}.site code{display:block;background:#f3f6fa;padding:8px;border-radius:6px;font-size:11px;white-space:pre-wrap;overflow-wrap:anywhere;margin:6px 0}
fieldset.tg{border:1px solid #dde6ef;border-radius:10px;padding:8px 12px 10px;margin:12px 0}fieldset.tg legend{font-size:12px;color:#60778f;padding:0 4px}.m .push{font-size:10px;color:#3b6fa0;cursor:pointer;margin-left:6px}.m .push.done{color:#1d7a4c;cursor:default}
#siteForm label{display:block;margin:8px 0}#siteForm label>span{display:block;font-size:12px;color:#60778f;margin-bottom:3px}.two{display:grid;grid-template-columns:1fr 1fr;gap:10px}.check{display:flex;align-items:center;gap:6px}.check input{width:auto}.acts{display:flex;gap:8px;margin-top:10px}
.toast{position:fixed;left:50%;bottom:24px;transform:translateX(-50%);background:#102b45;color:#fff;padding:10px 16px;border-radius:10px;font-size:13px;box-shadow:0 10px 30px #0004;margin:0}
#view-history{overflow:auto;padding:16px}.history-wrap{max-width:1400px;margin:0 auto;background:#fff;border:1px solid #e1e8ef;border-radius:12px;padding:16px 18px}.history-wrap .row{display:flex;justify-content:space-between;align-items:center}.history-wrap h2{margin:0;font-size:15px}.history-wrap select{width:auto;display:inline-block;padding:5px 8px}.table-wrap{overflow:auto;margin-top:10px}
#histTable{width:100%;border-collapse:collapse;font-size:12px}#histTable th,#histTable td{border-bottom:1px solid #eef2f6;padding:8px 8px;text-align:left;vertical-align:top}#histTable th{background:#f6f9fc;color:#60778f;font-weight:600;white-space:nowrap}#histTable td small{display:block;color:#8a97a5}#histTable tr:hover td{background:#f9fbfd}#histTable .open-conv{color:#2379da;cursor:pointer;text-decoration:underline}
.info .trail{margin:2px 0 0 0;padding-left:14px;max-height:90px;overflow:auto}.info .trail li{overflow-wrap:anywhere}.info a{color:#2379da;overflow-wrap:anywhere}
@media(max-width:1000px){#view-chat{grid-template-columns:240px 6px 1fr}.assist,.gutter[data-side=right]{display:none}.admin-grid{grid-template-columns:1fr}}
/* recall / edit of the agent's own lines */
.m .act{font-size:10px;color:#3b6fa0;cursor:pointer;margin-left:8px;opacity:.35}.m:hover .act,.m .act:focus{opacity:1}.m .act:hover{text-decoration:underline}.m .t .edited{color:#9aa6b3}
.m.recalled .b{background:transparent;border:0;color:#8a97a5;font-size:12px;padding:2px 8px;text-align:center}.m.recalled .b .orig{font-size:11px;color:#a3aeb9;margin-top:2px;max-width:420px;white-space:pre-wrap}.m.recalled .b .orig img{max-width:120px;max-height:120px;border-radius:8px;display:block;margin:4px auto 0;opacity:.7}
.m textarea.editbox{width:min(520px,60vw);min-height:64px;padding:9px 12px;border-radius:14px;border:1px solid #2379da;font:inherit;line-height:1.55;resize:vertical}.m .editrow{display:flex;gap:6px;justify-content:flex-end}.m .editrow button{font-size:12px;padding:4px 10px;border-radius:8px;border:1px solid #cfd8e3;background:#fff;cursor:pointer}.m .editrow button.primary{background:#2379da;color:#fff;border-color:#2379da}
/* unread conversations stand out like a chat app: tinted row, red bar, bold name, larger red count; read but unanswered = orange tag */
.conv.unread{background:#fff1f1;box-shadow:inset 4px 0 0 #e5484d}.conv.unread:hover{background:#ffe6e6}.conv.unread .l1 strong{font-weight:800;color:#1f2d3d}.conv.unread .l2>span:first-child{color:#1f2d3d;font-weight:600}
.conv .badge{font-size:12px;min-width:20px;height:20px;line-height:20px;padding:0 6px;text-align:center;box-shadow:0 0 0 2px #fff}
.conv.wait{box-shadow:inset 4px 0 0 #f5a524}.tag.waitreply{background:#fff1e0;color:#9a5b00;font-weight:600}

/* list items like a chat app: avatar with a red count at its corner and an online dot */
.conv{flex-direction:row;align-items:center;gap:10px}.conv .cb{flex:1;min-width:0;display:flex;flex-direction:column;gap:3px}
.conv .av{position:relative;width:40px;height:40px;border-radius:8px;color:#fff;font-weight:700;font-size:17px;display:flex;align-items:center;justify-content:center;flex:0 0 auto;background:#7d93ab}
.conv .av .badge,.pop .av .badge{position:absolute;top:-8px;right:-10px;min-width:22px;height:22px;line-height:22px;padding:0 6px;font-size:13px;font-weight:700;border-radius:11px;text-align:center;background:#f43530;color:#fff;box-shadow:0 0 0 2px #fff}
.conv .av .dot{position:absolute;right:-3px;bottom:-3px;width:12px;height:12px;border-radius:50%;box-shadow:0 0 0 2px #fff}.conv .av .dot.on{background:#21b45a}.conv .av .dot.off{background:#b8c2cc}
.nav-badge{display:inline-block;margin-left:6px;min-width:20px;height:20px;line-height:20px;padding:0 6px;border-radius:10px;background:#f43530;color:#fff;font-size:12px;font-weight:700;text-align:center;vertical-align:1px}
.list-tools .text:disabled{color:#a9b4bf;cursor:default}
/* read marks under our own lines */
.m .t .rd{margin-left:8px;color:#e5484d}.m .t .rd.ok{color:#21b45a}
/* pasted picture waiting to be sent */
.paste-preview{display:flex;align-items:center;gap:10px;padding:6px 8px;margin-bottom:6px;border:1px dashed #9cc2ec;border-radius:10px;background:#f3f8ff;font-size:13px}.paste-preview img{max-height:90px;max-width:160px;border-radius:6px;display:block}.paste-preview span{flex:1;color:#60778f}
/* pop-up alerts at the bottom-right (like Telegram) */
.popups{position:fixed;right:18px;bottom:104px;display:flex;flex-direction:column;gap:10px;z-index:1000;width:320px;max-width:calc(100vw - 36px)}
.pop{display:flex;gap:10px;align-items:flex-start;background:#fff;border-radius:12px;padding:12px 12px 12px 14px;box-shadow:0 12px 36px #0d223a40;border-left:4px solid #2379da;cursor:pointer;animation:pop-in .22s ease-out}
.pop:hover{background:#f6faff}.pop .av{position:relative;width:38px;height:38px;border-radius:50%;color:#fff;font-weight:700;display:flex;align-items:center;justify-content:center;flex:0 0 auto}
.pop .pb{flex:1;min-width:0}.pop .ph{display:flex;gap:8px;align-items:center}.pop .ph strong{font-size:14px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.pop .pk{font-size:11px;padding:1px 6px;border-radius:6px;background:#e8f1fd;color:#2379da;flex:0 0 auto}.pop .pk.new{background:#fff1e0;color:#b25e00}
.pop .pt{font-size:13px;color:#1f2d3d;margin-top:3px;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;overflow-wrap:anywhere}.pop .ps{font-size:11px;color:#8a97a5;margin-top:3px}
.pop .px{border:0;background:transparent;font-size:18px;line-height:1;color:#8a97a5;cursor:pointer;padding:0 2px}.pop .px:hover{color:#1f2d3d}
@keyframes pop-in{from{transform:translateY(16px);opacity:0}to{transform:none;opacity:1}}
/* administrator */
.pill.role{background:#f5a524;color:#1f2d3d;font-weight:700}.pill.auto.sched{background:#5f7d95}.pill.auto.locked{cursor:default}
.perm-list{display:flex;flex-direction:column;gap:6px;margin:8px 0}.perm-list label{font-size:13px}#adminCard h3{font-size:14px;margin:16px 0 4px}#adminPwForm label{display:block;margin:6px 0}#adminPwForm label>span{display:block;font-size:12px;color:#60778f;margin-bottom:3px}
/* history report figures */
.hist-summary{display:flex;flex-wrap:wrap;gap:10px;margin:6px 0 12px}.hist-summary .hs{background:#f3f8ff;border:1px solid #d6e6f8;border-radius:10px;padding:8px 12px;display:flex;flex-direction:column;gap:2px;min-width:150px}.hist-summary .hs b{font-size:15px;color:#1f2d3d}.hist-summary .hs span{font-size:12px;color:#60778f}
#histKind,#histFrom,#histTo{font:inherit;padding:4px 6px;border:1px solid #cfd9e3;border-radius:6px}
.history-wrap .row>div{display:flex;gap:6px;align-items:center;flex-wrap:wrap;justify-content:flex-end}#histFrom,#histTo,#histKind,#histStatus{width:auto}
/* history report: clickable cards and breakdowns */
.hist-summary{display:flex;flex-direction:column;gap:10px;margin:6px 0 12px}.hs-cards{display:flex;flex-wrap:wrap;gap:10px}
.hist-summary .hs{background:#f3f8ff;border:1px solid #d6e6f8;border-radius:10px;padding:8px 12px;display:flex;flex-direction:column;gap:2px;min-width:170px;text-align:left;cursor:pointer;font:inherit}
.hist-summary .hs:hover{border-color:#2379da}.hist-summary .hs.on{background:#2379da;border-color:#2379da}.hist-summary .hs.on b,.hist-summary .hs.on span,.hist-summary .hs.on small{color:#fff}
.hist-summary .hs small{font-size:11px;color:#60778f}.hs-filter{display:flex;gap:8px;align-items:center}.hs-filter .chip{background:#fff1e0;color:#9a5b00;border-radius:999px;padding:3px 10px;font-size:12px}
.bd-grid{display:grid;grid-template-columns:1fr 1fr;gap:12px}.bd{border:1px solid #e1e8ef;border-radius:10px;padding:8px 12px;min-width:0}.bd h3{font-size:13px;margin:2px 0 6px}
.bd-scroll{max-height:220px;overflow:auto}.bd table{width:100%;border-collapse:collapse;font-size:12.5px}.bd th,.bd td{text-align:left;padding:5px 6px;border-bottom:1px solid #eef2f6;white-space:nowrap}.bd th{color:#60778f;font-weight:500;position:sticky;top:0;background:#fff}
.bd tr.on td{background:#fff7ec}.bd .lnk{color:#2379da;cursor:pointer}.bd .lnk:hover{text-decoration:underline}.bd .num{font-variant-numeric:tabular-nums}.hs-tip{margin:0;font-size:12px}
@media(max-width:900px){.bd-grid{grid-template-columns:1fr}}
.stat.click{cursor:pointer}.stat.click:hover{outline:2px solid #2379da}
/* guided-menu editor */
.card.wide{grid-column:1/-1}.menu-list{display:flex;flex-direction:column;gap:10px;margin-top:10px}
.mi{border:1px solid #d6e2ee;border-radius:10px;padding:10px;background:#fbfdff;display:flex;flex-direction:column;gap:6px}.mi.child{background:#fff;border-style:dashed}
.mi-head{display:flex;gap:6px;align-items:center}.mi-head input{flex:1;min-width:0;font:inherit;font-weight:600;padding:5px 8px;border:1px solid #cfd9e3;border-radius:6px}
.mi-num{min-width:26px;font-size:12px;color:#2379da;font-weight:700}.mi textarea{font:inherit;padding:6px 8px;border:1px solid #cfd9e3;border-radius:6px;resize:vertical;width:100%;box-sizing:border-box}
.mi-pics{display:flex;flex-wrap:wrap;gap:6px;align-items:center;font-size:12px}.mi-pics .chip{border:1px solid #d6e2ee;border-radius:999px;padding:2px 8px;cursor:pointer}
.mi-kids{display:flex;flex-direction:column;gap:8px;padding-left:22px;border-left:3px solid #e1ecf8}.mi-head .danger{color:#b23b3b}
