/* v3.4.0: Chat nội bộ */
.mwrap.ch{max-width:1320px}
.ch-split{display:grid;grid-template-columns:340px 1fr;gap:12px;height:calc(100vh - 190px);min-height:420px}
.ch-left{overflow:auto;border:1px solid var(--line);border-radius:var(--r2);background:var(--surface)}
.ch-pane{min-width:0;border:1px solid var(--line);border-radius:var(--r2);background:var(--surface);display:flex;flex-direction:column;overflow:hidden}
.ch-empty{margin:auto;padding:24px;text-align:center}
.ch-list{display:flex;flex-direction:column}
.ch-item{display:flex;gap:10px;align-items:center;padding:10px 12px;border-bottom:1px solid var(--line);color:var(--fg);text-decoration:none;min-height:60px}
.ch-item:hover{background:var(--soft)}.ch-item.on{background:var(--brand-soft)}
.ch-item.unread b{font-weight:800}
.ch-av{flex:0 0 38px;height:38px;border-radius:50%;display:flex;align-items:center;justify-content:center;background:var(--brand-soft);color:var(--brand-ink);font-weight:700}
.ch-av.grp{background:var(--info-soft);color:var(--info)}.ch-av.ref{background:var(--warn-soft);color:var(--warn)}
.ch-it{min-width:0;display:flex;flex-direction:column}
.ch-it b,.ch-it small{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.ch-it small{color:var(--muted)}
.ch-meta{display:flex;flex-direction:column;align-items:flex-end;gap:4px;color:var(--muted)}
.ch-n{min-width:22px;height:22px;padding:0 6px;border-radius:11px;background:var(--brand);color:#fff;font-size:12px;font-weight:700;display:inline-flex;align-items:center;justify-content:center}
.ch-pill{margin-left:6px;font-size:11px;vertical-align:middle}
.ch-conv{display:flex;flex-direction:column;height:100%;min-height:0}
.ch-head{display:flex;gap:8px;align-items:center;padding:10px 12px;border-bottom:1px solid var(--line)}
.ch-head .grow{min-width:0;display:flex;flex-direction:column}
.ch-head .grow b{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.ch-head .ch-back{display:none;font-size:22px;line-height:1}
.ch-msgs{flex:1;overflow:auto;padding:12px;display:flex;flex-direction:column;gap:6px;background:var(--bg)}
.ch-more{align-self:center}
.ch-m{display:flex;flex-direction:column;align-items:flex-start;max-width:78%}
.ch-m.mine{align-self:flex-end;align-items:flex-end}
.ch-who{font-size:12px;color:var(--muted);margin:2px 8px}
.ch-bub{background:var(--surface);border:1px solid var(--line);border-radius:14px;padding:8px 12px;max-width:100%;overflow-wrap:anywhere}
.ch-m.mine .ch-bub{background:var(--brand-soft);border-color:transparent}
.ch-m.urgent .ch-bub{border:2px solid var(--bad)}
.ch-text{white-space:pre-wrap}
.ch-foot{font-size:11px;color:var(--muted);margin:2px 8px;display:flex;gap:6px;align-items:center;flex-wrap:wrap}
.ch-act{background:none;border:0;padding:0 2px;color:var(--brand);cursor:pointer;font:inherit;font-size:12px;min-height:24px}
.ch-img img{display:block;max-width:240px;max-height:240px;border-radius:10px;margin-top:4px}
.ch-file{display:flex;gap:8px;align-items:center;margin-top:4px;color:var(--fg);text-decoration:none}
.ch-file span{display:flex;flex-direction:column}.ch-file small{color:var(--muted)}
.ch-comp{border-top:1px solid var(--line);padding:8px 10px;display:flex;flex-direction:column;gap:6px;background:var(--surface)}
.ch-crow{display:flex;gap:8px;align-items:flex-end}
.ch-crow textarea{flex:1;resize:none;min-height:44px;max-height:160px;font:inherit;padding:10px 12px;border:1px solid var(--line3);border-radius:12px}
.ch-att{min-width:44px;font-size:22px;padding:0}
.ch-send{min-width:72px}
.ch-ftag{display:flex;gap:8px;align-items:center;font-size:13px;background:var(--soft);border-radius:8px;padding:4px 8px}
.ch-urg{font-size:13px;display:flex;gap:6px;align-items:center;color:var(--bad)}
.ch-people{display:flex;flex-direction:column;gap:4px;max-height:50vh;overflow:auto;margin-top:6px}
.ch-person{display:flex;flex-direction:column;align-items:flex-start;text-align:left;border:1px solid var(--line);border-radius:10px;padding:8px 12px;background:var(--surface);cursor:pointer;font:inherit;color:var(--fg);min-height:48px}
.ch-person.on{border-color:var(--brand);background:var(--brand-soft)}
.ch-person small{color:var(--muted)}
div.ch-person{cursor:default;flex-direction:row;flex-wrap:wrap;align-items:center;gap:6px}div.ch-person small{flex-basis:100%}
.ch-picked{display:flex;flex-wrap:wrap;gap:6px;margin:6px 0}
.ch-tb{display:flex;flex-wrap:wrap;gap:8px}.ch-tb input{flex:2;min-width:180px}.ch-tb select{flex:1;min-width:130px}
/* v4.3.2: đổi tên nhóm tại chỗ, màn hình Thành viên nhóm */
.ch-rn{cursor:text;border-bottom:1px dashed transparent}.ch-rn:hover,.ch-rn:focus-visible{border-bottom-color:var(--line3);outline:none}
.ch-rn-in{font:inherit;font-weight:700;width:100%;max-width:420px;min-height:34px;padding:4px 8px;border:1px solid var(--brand);border-radius:8px}
.ch-mb{display:flex;flex-direction:column;gap:12px;min-width:min(620px,86vw)}
.ch-mb-h{display:flex;flex-direction:column;gap:2px}.ch-mb-name{font-size:17px}
.ch-mbs{border-top:1px solid var(--line);padding-top:10px;display:flex;flex-direction:column;gap:6px}
.ch-mbs-t{display:flex;flex-wrap:wrap;gap:10px;align-items:center}.ch-mbs-t b{margin-right:auto}
.ch-mbs .ch-people{max-height:34vh;margin-top:0}.ch-mbs .ch-people>*{flex-shrink:0}
.ch-person.ch-mrow{flex-direction:row;align-items:center;gap:8px;cursor:default}.ch-person.ch-mrow .grow{display:flex;flex-direction:column;min-width:0}
label.ch-person.ch-mrow{cursor:pointer}.ch-mrow input[type=checkbox]{width:18px;height:18px;flex:0 0 auto}
.ch-person.dim{opacity:.55;cursor:default}
.ch-mb-f{display:flex;flex-wrap:wrap;gap:8px;align-items:center;justify-content:space-between}
.ch-mb-acts{border-top:1px solid var(--line);padding-top:10px}
.ch-mem .ch-n{margin-left:6px}
.ch-chks{display:grid;grid-template-columns:repeat(auto-fill,minmax(230px,1fr));gap:6px}
.ch .card{margin-bottom:12px}.ch .card h3{margin:0 0 8px}
.ch-acc{display:flex;flex-direction:column;gap:10px}.ch-accc{display:flex;flex-direction:column;gap:6px}
.ch-accr .card{margin-top:10px}.ch-arow{border-top:1px solid var(--line);padding:6px 0}
.ch-edit{border-left:3px solid var(--line3);padding:4px 10px;margin:6px 0}.ch-edit.now{border-left-color:var(--brand)}
.ch-fab{position:fixed;right:18px;bottom:22px;z-index:60;display:flex;gap:8px;align-items:center;min-height:48px;padding:0 16px;border-radius:24px;border:0;background:var(--brand);color:#fff;font:inherit;font-weight:700;box-shadow:0 4px 14px rgba(0,0,0,.2);cursor:pointer}
.ch-fab b{background:#fff;color:var(--brand);border-radius:11px;min-width:22px;height:22px;padding:0 6px;display:inline-flex;align-items:center;justify-content:center;font-size:12px}
.ch-fab.has b{background:var(--bad);color:#fff}
/* v4.3.7: kéo thả nút Trao đổi */
.ch-fab{user-select:none;-webkit-user-select:none}.ch-fab.drag{opacity:.85;box-shadow:0 8px 24px rgba(0,0,0,.3);cursor:grabbing;transition:none}
.ch-fab.moved{transition:left .15s,right .15s}.ch-fab.moved.drag{transition:none}
.ch-drawer-bg{position:fixed;inset:0;z-index:80;background:rgba(0,0,0,.25);display:flex;justify-content:flex-end}
.ch-drawer{width:min(480px,100%);height:100%;background:var(--surface);display:flex;flex-direction:column;box-shadow:-4px 0 18px rgba(0,0,0,.18)}
.ch-dh{display:flex;gap:8px;align-items:center;padding:10px 12px;border-bottom:1px solid var(--line)}
.ch-dh .x{background:none;border:0;font-size:26px;line-height:1;cursor:pointer;min-width:40px;min-height:40px;color:var(--fg)}
.ch-dbox{flex:1;min-height:0;display:flex;flex-direction:column}

/* ===== v3.7.0: giao diện Chat mới (tìm, lọc, nút +, trả lời mẫu, phản hồi nhanh, Đã xem, khung chat nổi) ===== */
.ch-left{display:flex;flex-direction:column;overflow:hidden}
.ch-left .ch-list{flex:1;overflow:auto}
.ch-tools{padding:12px 12px 8px;display:flex;flex-direction:column;gap:8px;border-bottom:1px solid var(--line)}
.ch-search{display:flex;align-items:center;gap:8px;height:40px;padding:0 12px;border:1px solid var(--line);border-radius:10px;background:var(--soft);color:var(--muted)}
.ch-search input,.ch-search input[type=search]{border:0!important;background:transparent!important;outline:none!important;box-shadow:none!important;font:inherit;flex:1;min-width:0;width:auto;color:var(--fg);height:38px;min-height:0;padding:0!important;margin:0;border-radius:0}
.ch-search:focus-within{border-color:var(--brand);background:var(--surface)}
.ch-chips{display:flex;gap:4px;flex-wrap:wrap}
.ch-chip{height:30px;padding:0 10px;border-radius:15px;border:1px solid transparent;background:var(--bg);color:var(--fg);font:inherit;font-size:13px;cursor:pointer;display:inline-flex;align-items:center;gap:6px}
.ch-chip b{color:var(--brand);font-weight:700}
.ch-chip.on{background:var(--fg);color:#fff}.ch-chip.on b{color:#FFD9B8}
.ch-item{border-left:3px solid transparent}
.ch-item.on{border-left-color:var(--brand)}
.ch-av{flex:0 0 40px;height:40px}
.ch-av.ref{border-radius:10px}
.ch-msgs{padding:16px 18px;gap:10px}
.ch-m{position:relative}
.ch-bub{border-radius:4px 14px 14px 14px;line-height:1.5;padding:9px 13px}
.ch-m.mine .ch-bub{border-radius:14px 4px 14px 14px;background:var(--brand-soft);border:1px solid #F3D3B3}
.ch-who{font-size:12px}
/* Thanh phản hồi nhanh */
.ch-rbar{position:absolute;top:-22px;left:8px;z-index:3;display:none;gap:2px;padding:3px;background:var(--surface);border:1px solid var(--line);border-radius:22px;box-shadow:0 6px 18px rgba(29,32,36,.14)}
.ch-m.mine .ch-rbar{left:auto;right:8px}
@media (hover:hover){/* v4.2.1: không tự bật khi rê chuột; chỉ hiện khi .rb-open */}
.ch-m.rb-open>.ch-rbar{display:flex}
.ch-rb{width:34px;height:34px;border-radius:50%;border:0;background:transparent;cursor:pointer;display:inline-flex;align-items:center;justify-content:center;padding:0}
.ch-rb:hover,.ch-rb:focus-visible{background:var(--soft)}
.ch-rb.on{background:var(--brand-soft)}
.t-ok{color:var(--ok)}.t-info{color:var(--info)}.t-warn{color:var(--warn)}.t-done{color:var(--ok)}.t-mut{color:var(--muted)}.t-bad{color:var(--bad)}.t-brand{color:var(--brand-ink)}.t-run{color:var(--run)}
.ch-rx{display:flex;gap:6px;flex-wrap:wrap;align-items:center;margin:4px 6px 0}
.ch-rc{display:inline-flex;align-items:center;gap:4px;height:26px;padding:0 9px;border-radius:13px;border:1px solid transparent;font:inherit;font-size:12px;cursor:pointer;background:var(--soft)}
.ch-rc b{font-weight:700}
.ch-rc.t-ok,.ch-rc.t-done{background:var(--ok-soft)}.ch-rc.t-info{background:var(--info-soft)}.ch-rc.t-warn{background:var(--warn-soft)}.ch-rc.t-bad{background:var(--bad-soft)}.ch-rc.t-brand{background:var(--brand-soft)}.ch-rc.t-run{background:var(--run-soft)}
.ch-rc.on{border-color:currentColor}
.ch-seen{display:inline-flex;align-items:center;gap:3px;border:0;background:none;padding:0 2px;font:inherit;font-size:11px;color:var(--muted);cursor:pointer;min-height:24px}
.ch-seen.on{color:var(--info)}
.ch-ri{margin-bottom:12px}.ch-ri h4{margin:0 0 6px;display:flex;align-items:center;gap:6px;font-size:14px}
.ch-rn{display:flex;flex-wrap:wrap;gap:6px}
/* Ô soạn tin */
.ch-comp{position:relative;padding:10px 12px 12px;gap:8px}
.ch-crow{gap:8px;align-items:flex-end}
.ch-plus{flex:0 0 44px;width:44px;height:44px;border-radius:12px;border:0;background:var(--brand);color:#fff;cursor:pointer;display:inline-flex;align-items:center;justify-content:center}
.ch-plus:hover{background:var(--brand-h)}
.ch-plus .ic{transition:transform .15s}.ch-plus.on .ic{transform:rotate(45deg)}
.ch-inp{flex:1;min-width:0;display:flex;align-items:flex-end;gap:4px;border:1px solid var(--line3);border-radius:12px;background:var(--surface);padding:0 4px 0 0}
.ch-inp:focus-within{border-color:var(--brand);box-shadow:0 0 0 3px var(--brand-soft)}
.ch-crow .ch-inp textarea{border:0;outline:none;box-shadow:none;border-radius:12px;min-height:42px}
.ch-bolt{flex:0 0 36px;width:36px;height:36px;margin-bottom:3px;border:0;border-radius:8px;background:transparent;color:var(--muted);cursor:pointer;display:inline-flex;align-items:center;justify-content:center}
.ch-bolt.on{color:var(--brand)}.ch-bolt:hover{background:var(--soft)}
.ch-send{display:inline-flex;align-items:center;gap:6px;min-height:44px}
.ch-quick{display:flex;gap:6px;flex-wrap:wrap}
.ch-qr{height:30px;padding:0 12px;border-radius:15px;border:1px solid var(--line);background:var(--soft);color:var(--fg);font:inherit;font-size:13px;cursor:pointer}
.ch-qr:hover{border-color:var(--brand);background:var(--brand-soft)}
.ch-qr.ed{background:transparent;color:var(--muted);border-style:dashed}
.ch-ftags{display:flex;gap:6px;flex-wrap:wrap}
.ch-ftag{display:inline-flex;align-items:center;gap:6px;font-size:13px;background:var(--soft);border:1px solid var(--line);border-radius:10px;padding:4px 6px 4px 4px;max-width:100%}
.ch-ftag img{width:34px;height:34px;object-fit:cover;border-radius:7px}
.ch-ftag .nm{max-width:170px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.ch-ftag small{color:var(--muted)}
.ch-menu{position:absolute;left:12px;bottom:calc(100% - 4px);z-index:20;width:300px;background:var(--surface);border:1px solid var(--line);border-radius:14px;box-shadow:0 12px 32px rgba(29,32,36,.16);padding:6px}
.ch-mh{display:none}
.ch-mlist{display:flex;flex-direction:column}
.ch-mi{display:flex;align-items:center;gap:12px;padding:9px 10px;border:0;border-radius:10px;background:transparent;text-align:left;color:var(--fg);font:inherit;cursor:pointer;width:100%}
.ch-mi:hover,.ch-mi:focus-visible{background:var(--soft)}
.ch-mic{flex:0 0 36px;width:36px;height:36px;border-radius:10px;display:inline-flex;align-items:center;justify-content:center}
.ch-mi.k-cam .ch-mic{background:var(--brand);color:#fff}.ch-mi.k-img .ch-mic{background:var(--info-soft);color:var(--info)}
.ch-mi.k-doc .ch-mic{background:var(--ok-soft);color:var(--ok)}.ch-mi.k-gap .ch-mic{background:var(--bad-soft);color:var(--bad)}
.ch-mt{display:flex;flex-direction:column;line-height:1.3}.ch-mt small{color:var(--muted);font-size:12px}
.ch-urg{font-size:12px}
/* Khung chat nổi (máy tính) */
.ch-dock{position:fixed;right:24px;bottom:0;z-index:55;display:flex;align-items:flex-end;gap:16px;pointer-events:none}
.ch-dock>*{pointer-events:auto}
.chd-rail{display:flex;flex-direction:column;align-items:center;gap:12px;padding-bottom:24px}
.chd-launch{position:relative;width:56px;height:56px;border-radius:50%;border:0;background:var(--brand);color:#fff;cursor:pointer;box-shadow:0 6px 18px rgba(180,83,10,.4);display:inline-flex;align-items:center;justify-content:center}
.chd-launch:hover,.chd-launch.on{background:var(--brand-h)}
.chd-n{position:absolute;top:-4px;right:-4px;min-width:22px;height:22px;padding:0 6px;border-radius:11px;background:#D9480F;color:#fff;font-size:11px;font-weight:700;border:2px solid #fff;display:inline-flex;align-items:center;justify-content:center}
.chd-mins{display:flex;flex-direction:column;gap:10px;align-items:center}
.chd-mb{position:relative}
.chd-mbtn{width:48px;height:48px;border-radius:50%;border:2px solid #fff;background:var(--brand-soft);color:var(--brand-ink);font:inherit;font-weight:700;font-size:16px;cursor:pointer;box-shadow:0 4px 14px rgba(29,32,36,.18);display:inline-flex;align-items:center;justify-content:center}
.chd-mbtn.k-group{background:var(--info-soft);color:var(--info)}.chd-mbtn.k-ref{background:var(--warn-soft);color:var(--warn);border-radius:14px}
.chd-mx{position:absolute;top:-4px;right:-4px;width:20px;height:20px;border-radius:50%;border:0;background:var(--fg);color:#fff;cursor:pointer;display:none;align-items:center;justify-content:center;padding:0}
.chd-mb:hover .chd-mx,.chd-mx:focus-visible{display:inline-flex}
.chd-win,.chd-panel{width:380px;height:min(560px,calc(100vh - 90px));background:var(--surface);border:1px solid var(--line);border-bottom:0;border-radius:14px 14px 0 0;box-shadow:0 -8px 32px rgba(29,32,36,.18);display:flex;flex-direction:column;overflow:hidden}
.chd-panel{width:360px}
.chd-wh{display:flex;align-items:center;gap:10px;min-height:56px;padding:0 8px 0 12px;background:var(--brand);color:#fff}
.chd-wh .ch-av{flex-basis:34px;height:34px;font-size:14px}
.chd-tt{min-width:0;display:flex;flex-direction:column;line-height:1.25}
.chd-tt b,.chd-tt small{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.chd-tt small{opacity:.9;font-size:12px}
.chd-ib{width:34px;height:34px;flex:none;border:0;border-radius:8px;background:transparent;color:inherit;cursor:pointer;display:inline-flex;align-items:center;justify-content:center;text-decoration:none}
.chd-wh .chd-ib:hover{background:rgba(255,255,255,.18)}
.chd-h .chd-ib{color:var(--fg)}.chd-h .chd-ib:hover{background:var(--soft)}
.chd-body{flex:1;min-height:0;display:flex;flex-direction:column}
.chd-body .ch-conv{height:100%}
.chd-body .ch-head{display:none}
.chd-body .ch-msgs{padding:12px}
.chd-body .ch-m{max-width:88%}
.chd-body .ch-send .lbl{display:none}.chd-body .ch-send{min-width:44px;padding:0 10px}
.chd-body .ch-menu{width:280px}
.chd-body .ch-quick{flex-wrap:nowrap;overflow-x:auto;scrollbar-width:thin}.chd-body .ch-qr{flex:none}
.chd-h{display:flex;align-items:center;gap:4px;padding:10px 8px 6px 14px}
.chd-h b{font-size:16px}
.chd-list{flex:1;overflow:auto}
.chd-load{padding:16px}
.chd-toasts{position:fixed;right:24px;top:76px;z-index:58;display:flex;flex-direction:column;gap:8px;width:340px;pointer-events:none}
.chd-toast{pointer-events:auto;display:flex;gap:10px;align-items:flex-start;background:var(--surface);border:1px solid var(--line);border-radius:12px;box-shadow:0 8px 24px rgba(29,32,36,.14);padding:12px}
.chd-tb{min-width:0;display:flex;flex-direction:column;gap:2px}
.chd-tb>span{font-size:13px;color:var(--muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.chd-ta{display:flex;gap:6px;margin-top:6px}
.chd-toast .chd-ib{color:var(--muted)}
body.has-chdock .ch-fab:not(.moved){right:96px}
@media print{.ch-dock,.chd-toasts{display:none!important}}
/* ===== v3.7.0 (đợt 2, nhóm A): thao tác trên tin, trích dẫn, @nhắc tên, ghim, biểu quyết, thẻ phiếu, bảng tin ===== */
.ch-rbar{flex-wrap:nowrap}
.ch-rsep{flex:none;width:1px;height:22px;align-self:center;background:var(--line);margin:0 3px}
.ch-ra{color:var(--fg)}
.ch-quote{display:block;width:100%;text-align:left;border:0;border-left:3px solid var(--brand);background:rgba(29,32,36,.05);border-radius:6px;padding:4px 8px;margin:0 0 6px;font:inherit;font-size:12.5px;cursor:pointer;color:var(--fg)}
.ch-quote b{display:block;font-size:12px;color:var(--brand-ink)}.ch-quote span{display:block;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;color:var(--muted)}
.ch-fwd{font-size:12px;color:var(--muted);display:flex;gap:4px;align-items:center;margin-bottom:4px}
mark.ch-at{background:var(--info-soft);color:var(--info);border-radius:4px;padding:0 2px;font-weight:600}mark.ch-at.me{background:var(--warn-soft);color:var(--warn)}
.ch-m.at-me .ch-bub{box-shadow:inset 3px 0 0 var(--warn)}
.ch-m.flash .ch-bub{animation:chflash 1.6s}
@keyframes chflash{0%,60%{box-shadow:0 0 0 3px var(--warn)}100%{box-shadow:none}}
.ch-refs{display:flex;flex-direction:column;gap:6px;margin-top:6px}
.ch-pinf{color:var(--warn);display:inline-flex;margin-right:2px;vertical-align:-1px}
.ch-pins{display:flex;align-items:center;gap:8px;padding:6px 12px;background:var(--warn-soft);color:var(--warn);border-bottom:1px solid var(--line);font-size:13px}
.ch-pin-t{flex:1;min-width:0;border:0;background:none;text-align:left;font:inherit;font-size:13px;color:var(--fg);cursor:pointer;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;display:block;text-decoration:none;padding:0}
.ch-pinlist{display:flex;flex-direction:column;gap:6px;max-height:60vh;overflow:auto}
.ch-pinrow{display:flex;gap:8px;align-items:center;padding:8px;border:1px solid var(--line);border-radius:10px;background:var(--surface);text-align:left;width:100%;font:inherit;color:inherit}
.ch-pinrow .ch-pin-t,.ch-pinrow.ch-pin-t{display:flex;flex-direction:column;white-space:normal;gap:2px}
.ch-pinrow .ch-card{flex:1}
.ch-typing{min-height:18px;padding:0 16px;font-size:12px;color:var(--muted)}
.ch-dots{display:inline-flex;gap:2px;margin-right:6px;vertical-align:middle}.ch-dots b{width:4px;height:4px;border-radius:50%;background:currentColor;animation:chdot 1s infinite}
.ch-dots b:nth-child(2){animation-delay:.2s}.ch-dots b:nth-child(3){animation-delay:.4s}
@keyframes chdot{0%,80%,100%{opacity:.2}40%{opacity:1}}
@media (prefers-reduced-motion:reduce){.ch-dots b,.ch-m.flash .ch-bub{animation:none}}
.ch-replybar{display:flex;gap:8px;align-items:center;padding:6px 10px;border-left:3px solid var(--brand);background:var(--soft);border-radius:8px;font-size:13px}
.ch-replybar .grow{min-width:0;display:flex;flex-direction:column}.ch-replybar span{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;color:var(--muted)}
.ch-atbox{position:absolute;left:60px;bottom:calc(100% - 4px);z-index:21;width:300px;max-height:280px;overflow:auto;background:var(--surface);border:1px solid var(--line);border-radius:12px;box-shadow:0 12px 32px rgba(29,32,36,.16);padding:4px}
.ch-ato{display:flex;gap:10px;align-items:center;width:100%;padding:6px 8px;border:0;border-radius:8px;background:transparent;text-align:left;font:inherit;cursor:pointer;color:var(--fg)}
.ch-ato.on,.ch-ato:hover{background:var(--brand-soft)}.ch-ato>span:last-child{display:flex;flex-direction:column;min-width:0}.ch-ato small{color:var(--muted);font-size:12px}
.ch-av.sm{flex:0 0 28px;height:28px;font-size:12px}
.ch-av.brd{background:var(--run-soft);color:var(--run);border-radius:10px}
.ch-menu{max-height:calc(100vh - 170px);overflow:auto}
.ch-msec{font-size:11px;font-weight:700;letter-spacing:.04em;text-transform:uppercase;color:var(--muted);padding:8px 10px 2px}
.ch-mi.k-shot .ch-mic{background:var(--run-soft);color:var(--run)}.ch-mi.k-link .ch-mic{background:var(--warn-soft);color:var(--warn)}
.ch-mi.k-poll .ch-mic{background:var(--info-soft);color:var(--info)}.ch-mi.k-ack .ch-mic{background:var(--ok-soft);color:var(--ok)}
.ch-mi.k-task-gv .ch-mic{background:var(--brand-soft);color:var(--brand-ink)}.ch-mi.k-task-sv .ch-mic{background:var(--bad-soft);color:var(--bad)}
.ch-mi.k-task-yc .ch-mic{background:var(--info-soft);color:var(--info)}.ch-mi.k-task-room .ch-mic{background:var(--run-soft);color:var(--run)}
.ch-poll{min-width:240px}
.ch-poll-h{display:flex;flex-direction:column;gap:2px;margin-bottom:8px}.ch-poll-h small{color:var(--muted);font-size:12px}.ch-poll-h svg{color:var(--info)}
.ch-poll-o{display:flex;flex-direction:column;gap:6px}
.ch-po{position:relative;display:flex;align-items:center;gap:8px;min-height:36px;padding:6px 10px;border:1px solid var(--line);border-radius:10px;background:var(--surface);font:inherit;font-size:13px;text-align:left;cursor:pointer;overflow:hidden;color:var(--fg)}
.ch-po-bar{position:absolute;left:0;top:0;bottom:0;background:var(--info-soft)}.ch-po-t,.ch-po b{position:relative}.ch-po-t{flex:1;display:flex;gap:4px;align-items:center}
.ch-po.on{border-color:var(--info)}.ch-po:disabled{cursor:default}
.ch-poll-f{display:flex;gap:10px;margin-top:6px}
.ch-popts{display:flex;flex-direction:column;gap:6px;margin-bottom:6px}.ch-popt{display:flex;gap:6px;align-items:center}.ch-popt input{flex:1}
.ch-fwdlist{max-height:300px;overflow:auto;display:flex;flex-direction:column;gap:2px;border:1px solid var(--line);border-radius:10px;padding:4px}
.ch-fwdi{display:flex;gap:10px;align-items:center;padding:6px;border-radius:8px;cursor:pointer}.ch-fwdi:hover{background:var(--soft)}.ch-fwdi .grow{display:flex;flex-direction:column;min-width:0}
.ch-fwdprev{background:var(--soft);border-radius:8px;padding:8px}
.ch-info{margin-top:10px;max-height:60vh;overflow:auto}
.ch-igrid{display:grid;grid-template-columns:repeat(auto-fill,minmax(96px,1fr));gap:6px}.ch-igrid img{width:100%;aspect-ratio:1;object-fit:cover;border-radius:8px;display:block}
.ch-crop{position:relative;max-height:65vh;overflow:auto;user-select:none}
.ch-crop-c{display:block;max-width:100%;height:auto;cursor:crosshair;touch-action:none}
.ch-crop-sel{position:absolute;border:2px solid var(--brand);background:rgba(180,83,10,.12);pointer-events:none}
.ch-card{border:1px solid var(--line);border-radius:12px;background:var(--surface);padding:8px 10px;display:flex;flex-direction:column;gap:4px;min-width:220px;font-size:13px;color:var(--fg);text-align:left}
.ch-card.loading{opacity:.75}
.ch-card-h{display:flex;align-items:center;gap:6px;text-decoration:none;color:var(--fg);flex-wrap:wrap}.ch-card-h svg{color:var(--warn)}.ch-card-h small{color:var(--muted);margin-left:auto;font-size:12px}
.ch-card-t{font-weight:600}.ch-card-l{color:var(--muted);font-size:12px}
.ch-card-a{display:flex;gap:6px;flex-wrap:wrap;margin-top:4px}
.ch-refcard{padding:8px 12px;border-bottom:1px solid var(--line);background:var(--soft)}.ch-refcard .ch-card{min-width:0}
.ch-hb{min-width:36px;padding:0 8px}
.ch-ackrow{margin:4px 0 0}.ch-m.mine .ch-ackrow{align-self:flex-end}
.ch-ackb{display:inline-flex;gap:6px;align-items:center}
.ch-ackb.own{border:1px solid var(--line);background:var(--soft);border-radius:14px;padding:3px 10px;font:inherit;font-size:12px;cursor:pointer;color:var(--fg)}
.ch-ackb.done{font-size:12px;color:var(--ok)}
.ch-board-ro{display:flex;gap:8px;align-items:flex-start;color:var(--muted)}
.chd-body .ch-rbar{flex-wrap:wrap;max-width:290px;top:-8px}.chd-body .ch-rsep{flex-basis:100%;width:auto;height:1px;margin:2px 6px}.chd-body .ch-card{min-width:0}.chd-body .ch-atbox{left:8px;width:auto;right:8px}
@media (max-width:899px){
  .ch-split{grid-template-columns:1fr;height:calc(100vh - 210px)}
  .ch.ch-has .ch-left{display:none}
  .ch:not(.ch-has) .ch-pane{display:none}
  .ch-head .ch-back{display:inline-flex}
  .ch-m{max-width:88%}
  .ch .mhead{flex-wrap:wrap}.ch .mhead>.row-acts{width:100%}.ch .mhead>.grow{min-width:100%}
  .ch-fab:not(.moved){bottom:78px;right:12px}
  /* v3.7.0: điện thoại – đang mở cuộc trò chuyện: ẩn tiêu đề trang (đã có nút quay lại), khung chat cao hết màn hình */
  .ch.ch-has>.mhead{display:none}
  .ch.ch-has .ch-split{height:calc(100vh - 150px);height:calc(100dvh - 150px)}
  /* v3.7.0: điện thoại – bảng gửi kèm trượt từ dưới lên, lưới 3 cột */
  .ch-menu{position:fixed;left:0;right:0;bottom:0;width:auto;border-radius:20px 20px 0 0;padding:10px 16px calc(20px + env(safe-area-inset-bottom,0px));z-index:120;box-shadow:0 0 0 100vmax rgba(29,32,36,.35)}
  .ch-mh{display:flex;align-items:center;justify-content:space-between;padding:4px 2px 10px}.ch-mh b{font-size:16px}
  .ch-mlist{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:10px}
  .ch-mi{flex-direction:column;gap:8px;padding:12px 4px;border:1px solid var(--line2);border-radius:14px;text-align:center}
  .ch-mic{width:48px;height:48px;flex-basis:48px;border-radius:14px}
  .ch-mt small{display:none}
  .ch-msgs{padding:12px}
  .ch-send .lbl{display:none}.ch-send{min-width:48px;padding:0 12px}
  .ch-quick{flex-wrap:nowrap;overflow-x:auto;scrollbar-width:none;margin:0 -2px;padding:0 2px}.ch-quick::-webkit-scrollbar{display:none}.ch-qr{flex:none}
  .ch-m.rb-open>.ch-rbar{position:static;flex-wrap:nowrap;gap:0;margin:2px 0 4px;align-self:flex-start}.ch-m.mine.rb-open>.ch-rbar{align-self:flex-end}
  .ch-rb{width:32px;height:32px}
  .ch-m.rb-open>.ch-rbar{flex-wrap:wrap;max-width:100%}.ch-rsep{flex-basis:100%;width:auto;height:1px;margin:2px 6px}
  .ch-atbox{left:8px;right:8px;width:auto}
  .ch-card{min-width:0}
  .ch-head .ch-hb{padding:0 6px}
}
@media (max-width:599px){
  .ch-head .ch-mem{display:none}

}
/* v3.8.0: tin của Phần mềm (tự nhắn quá hạn, nhóm cuộc họp) */
.ch-m.ch-sys{align-self:center;align-items:center;max-width:92%}
.ch-sysb{background:var(--warn-soft,#FFF4E5);border:1px solid #F3D3B3;border-radius:12px;padding:8px 12px;font-size:13px;color:var(--fg);display:flex;flex-direction:column;gap:2px;text-align:left}
.ch-sysb>b{font-size:11px;letter-spacing:.04em;color:var(--brand-ink,#8A3F06);text-transform:uppercase}
.ch-bub{-webkit-touch-callout:none}
@media (hover:none){.ch-bub{-webkit-user-select:none;user-select:none}}
.ch-rtog{display:inline-flex;align-items:center;color:var(--muted);padding:0 3px}
.ch-rtog:hover,.ch-rtog:focus-visible{color:var(--brand)}
.ch-ctx{position:fixed;z-index:200;min-width:200px;background:var(--surface);border:1px solid var(--line);border-radius:12px;box-shadow:0 12px 32px rgba(29,32,36,.2);padding:6px}
.ch-ctxb{display:flex;align-items:center;gap:10px;width:100%;min-height:40px;padding:6px 12px;border:0;border-radius:8px;background:transparent;color:var(--fg);font:inherit;cursor:pointer;text-align:left}
.ch-ctxb:hover,.ch-ctxb:focus-visible{background:var(--soft)}
@media (hover:none){.ch-ctxb{min-height:46px}}

/* v4.3.8: nút Chat nội bộ nổi (máy tính) kéo di chuyển được; hình cầu 3D màu xanh ngọc khác màu thương hiệu để dễ nhận ra; không chạy hiệu ứng nổi liên tục (nút đứng yên, dễ bấm) */
.chd-win,.chd-panel{height:min(560px,calc(100vh - 90px - var(--chd-b,0px)))}
.chd-launch{width:64px;height:64px;border:0;cursor:grab;touch-action:none;user-select:none;-webkit-user-select:none;color:#fff;
  background:radial-gradient(circle at 34% 24%,#9CF0FF 0,#2BC0DE 30%,#0E7FB8 62%,#0A4F8C 100%);
  box-shadow:0 16px 22px -4px rgba(8,63,115,.5),0 4px 0 #083F73,inset 0 -8px 12px rgba(0,25,70,.5),inset 0 6px 9px rgba(255,255,255,.6);
  transition:transform .15s,box-shadow .15s,filter .15s}
.chd-launch::before{content:"";position:absolute;left:12px;top:6px;width:30px;height:15px;border-radius:50%;background:linear-gradient(180deg,rgba(255,255,255,.85),rgba(255,255,255,0));pointer-events:none}
.chd-launch .ico{position:relative;filter:drop-shadow(0 2px 2px rgba(0,30,80,.55))}
.chd-launch:hover{background:radial-gradient(circle at 34% 24%,#B5F5FF 0,#3CCDE9 30%,#1288C4 62%,#0B5799 100%);transform:translateY(-3px) scale(1.06);filter:saturate(1.1)}
.chd-launch:active,.chd-launch.on{transform:translateY(2px) scale(.97);box-shadow:0 8px 12px -4px rgba(8,63,115,.5),0 1px 0 #083F73,inset 0 -5px 9px rgba(0,25,70,.5),inset 0 4px 7px rgba(255,255,255,.5)}
.chd-launch.drag{cursor:grabbing;transform:scale(1.1);filter:brightness(1.06)}
.chd-launch.has::after{content:"";position:absolute;inset:-4px;border-radius:50%;border:3px solid rgba(43,192,222,.75);animation:chdRing 1.6s ease-out infinite;pointer-events:none}
@keyframes chdRing{0%{transform:scale(.92);opacity:.9}100%{transform:scale(1.45);opacity:0}}
@media (prefers-reduced-motion:reduce){.chd-launch.has::after{animation:none!important}}
/* v4.4.0: điện thoại – vùng chạm nút lọc, trả lời nhanh, biểu tượng thanh soạn tin tối thiểu 40 px */
@media (max-width:899px){
  .ch-chip,.ch-qr{height:40px;padding:0 14px}
  .ch-rb,.chd-ib{width:40px;height:40px}
  .ch-bolt,.ch-mic{flex-basis:44px;width:44px;height:44px}
  .ch-rc{height:34px}
}
