/* แชทภายในองค์กร */
.ch-wrap { display: grid; grid-template-columns: 330px minmax(0, 1fr); height: calc(calc(100vh / var(--z, 1)) - var(--tb-h, 60px) - 51px); min-height: 480px; background: var(--card, #fff); border: 1px solid var(--border); border-radius: 16px; overflow: hidden; box-shadow: var(--shadow-sm, 0 2px 10px rgba(40,30,25,.06)); }
.ch-wrap *, .ch-wrap *::before, .ch-wrap *::after { box-sizing: border-box; }
.ch-side { display: flex; flex-direction: column; min-height: 0; border-right: 1px solid var(--border); background: #fff; }
.ch-sh { display: flex; align-items: center; justify-content: space-between; padding: 14px 14px 8px; } .ch-sh h2 { margin: 0; font-size: 17px; font-weight: 600; } .ch-sh > div { display: flex; gap: 2px; }
.ch-ib { width: 34px; height: 34px; border: 0; border-radius: 10px; background: transparent; color: var(--text-2); cursor: pointer; display: grid; place-items: center; padding: 0; }
.ch-ib:hover { background: var(--primary-l); color: var(--primary); } .ch-ib .ms { font-size: 21px; }
.ch-search { display: flex; align-items: center; gap: 7px; height: 34px; margin: 0 14px 8px; padding: 0 11px; border-radius: 10px; background: #f3f0ee; color: var(--text-3); }
.ch-search:focus-within { background: #fff; box-shadow: inset 0 0 0 1.5px #ee9a85; } .ch-search .ms { font-size: 18px; }
.ch-search input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font: inherit; font-size: 12.5px; color: var(--text); height: 100%; }
.ch-list { flex: 1; overflow-y: auto; }
.ch-ci { display: flex; align-items: center; gap: 11px; padding: 10px 14px; cursor: pointer; } .ch-ci:hover { background: #faf8f7; } .ch-ci.on { background: var(--primary-l); }
.ch-av { width: 38px; height: 38px; border-radius: 50%; flex: none; display: inline-grid; place-items: center; background: var(--c, #6b7280); color: #fff; font-weight: 600; font-size: 15px; }
.ch-av0 { width: 34px; flex: none; }
.ch-cb { flex: 1; min-width: 0; } .ch-cn { display: flex; align-items: baseline; gap: 5px; } .ch-cn b { font-size: 13.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .ch-cn small { color: var(--text-4); font-size: 11px; flex: none; }
.ch-cp { margin-top: 2px; font-size: 12px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .ch-cp i { font-style: italic; color: var(--text-4); }
.ch-cm { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex: none; font-size: 10.5px; color: var(--text-4); }
.ch-cm em { font-style: normal; min-width: 19px; height: 19px; padding: 0 6px; border-radius: 999px; background: #e0573a; color: #fff; font-size: 11px; font-weight: 600; display: grid; place-items: center; }
.ch-none { padding: 34px 18px; text-align: center; color: var(--text-4); font-size: 12.5px; } .ch-none .ms { font-size: 16px; vertical-align: -3px; }
.ch-main { position: relative; display: flex; flex-direction: column; min-width: 0; min-height: 0; background: #f6f4f2; }
.ch-blank { margin: auto; text-align: center; max-width: 380px; color: var(--text-3); padding: 20px; } .ch-blank > .ms { font-size: 64px; color: #b7c4d4; } .ch-blank b { display: block; font-size: 16px; color: var(--text-2); margin: 6px 0; } .ch-blank p { font-size: 12.5px; line-height: 1.7; margin: 0; } .ch-blank p .ms { font-size: 16px; vertical-align: -3px; }
.ch-th { display: flex; align-items: center; gap: 11px; padding: 10px 16px; background: #fff; border-bottom: 1px solid var(--border); } .ch-th b { display: block; font-size: 14px; font-weight: 600; } .ch-th small { font-size: 11px; color: var(--text-3); }
.ch-msgs { flex: 1; overflow-y: auto; padding: 14px 18px 10px; display: flex; flex-direction: column; gap: 3px; } .ch-msgs.drop { outline: 3px dashed #ee9a85; outline-offset: -8px; background: #eef3f8; }
.ch-day { text-align: center; margin: 10px 0 6px; } .ch-day span { display: inline-block; padding: 2px 12px; border-radius: 999px; background: rgba(60,80,110,.22); color: #fff; font-size: 11px; }
.ch-more { text-align: center; margin-bottom: 6px; } .ch-more button { border: 0; border-radius: 999px; padding: 4px 14px; background: rgba(255,255,255,.8); font: inherit; font-size: 11.5px; color: var(--text-2); cursor: pointer; }
.ch-row { display: flex; align-items: flex-start; gap: 8px; max-width: 100%; } .ch-row.me { justify-content: flex-end; }
.ch-bw { max-width: min(70%, 560px); min-width: 0; } .ch-name { font-size: 11px; color: var(--text-3); margin: 0 0 2px 2px; }
.ch-bl { display: flex; align-items: flex-end; gap: 6px; } .ch-row.me .ch-bl { justify-content: flex-end; }
.ch-meta { display: flex; flex-direction: column; align-items: flex-end; font-size: 10px; color: #6a7a8e; flex: none; line-height: 1.3; } .ch-row:not(.me) .ch-meta { align-items: flex-start; }
.ch-b { position: relative; border-radius: 18px; background: #fff; box-shadow: 0 1px 2px rgba(40,60,90,.12); min-width: 0; max-width: 100%; }
.ch-b.mine { background: var(--primary-l, #fdeae5); border: 1px solid #f1c6bb; box-shadow: none; border-radius: 10px; } .ch-b { border-radius: 10px; } .ch-b.text { padding: 8px 13px; } .ch-b.image { padding: 3px; border-radius: 14px; } .ch-b.file { padding: 10px 12px; min-width: 230px; }
.ch-txt { font-size: 13.5px; line-height: 1.55; overflow-wrap: anywhere; word-break: break-word; } .ch-txt u { text-decoration: underline; cursor: default; }
.ch-img { display: block; max-width: 280px; max-height: 300px; min-width: 120px; min-height: 80px; border-radius: 12px; cursor: zoom-in; object-fit: cover; background: #eef2f6; }
.ch-file { display: flex; gap: 10px; align-items: flex-start; } .ch-file > .ms { font-size: 34px; flex: none; } .ch-file b { display: block; font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 240px; } .ch-file small { color: var(--text-3); font-size: 11px; }
.ch-fa { display: flex; gap: 6px; margin-top: 6px; } .ch-fa button { height: 25px; padding: 0 11px; border: 1px solid rgba(0,0,0,.14); border-radius: 8px; background: rgba(255,255,255,.7); font: inherit; font-size: 11.5px; cursor: pointer; } .ch-fa button:hover { background: #fff; color: var(--primary); }
.ch-undo { position: absolute; left: -30px; top: 50%; transform: translateY(-50%); width: 26px; height: 26px; border: 0; border-radius: 50%; background: rgba(255,255,255,.9); color: var(--text-3); cursor: pointer; display: none; place-items: center; padding: 0; box-shadow: 0 1px 4px rgba(0,0,0,.18); } .ch-undo .ms { font-size: 16px; }
.ch-b:hover .ch-undo { display: grid; } .ch-undo:hover { color: #dc2626; }
.ch-gone { margin: 3px auto; padding: 3px 14px; border-radius: 999px; background: rgba(60,80,110,.16); color: #5a6b80; font-size: 11.5px; } .ch-row.me:has(.ch-gone) { justify-content: center; } .ch-row:has(.ch-gone) { justify-content: center; }
.ch-newpill { position: absolute; left: 50%; bottom: 84px; transform: translateX(-50%); z-index: 3; display: inline-flex; align-items: center; gap: 4px; height: 28px; padding: 0 14px; border: 0; border-radius: 999px; background: #fff; color: var(--primary); font: inherit; font-size: 12px; box-shadow: 0 3px 12px rgba(0,0,0,.2); cursor: pointer; } .ch-newpill[hidden] { display: none; } .ch-newpill .ms { font-size: 16px; }
.ch-pend { display: flex; gap: 8px; padding: 8px 14px; overflow-x: auto; background: #f4f7fa; border-top: 1px solid var(--border); } .ch-pend[hidden] { display: none; }
.ch-pi { position: relative; display: flex; align-items: center; gap: 8px; flex: none; max-width: 230px; padding: 6px 28px 6px 6px; border: 1px solid var(--border); border-radius: 10px; background: #fff; }
.ch-pi img { width: 42px; height: 42px; object-fit: cover; border-radius: 7px; } .ch-pi > .ms { width: 42px; height: 42px; display: grid; place-items: center; font-size: 26px; color: var(--text-3); }
.ch-pi b { display: block; font-size: 12px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 130px; } .ch-pi small { font-size: 10.5px; color: var(--text-3); }
.ch-pi button { position: absolute; top: 3px; right: 4px; width: 20px; height: 20px; border: 0; border-radius: 50%; background: transparent; color: var(--text-3); font-size: 15px; cursor: pointer; padding: 0; } .ch-pi button:hover { background: #f1e3df; color: #dc2626; }
.ch-comp { display: flex; align-items: flex-end; gap: 6px; padding: 10px 12px; background: #fff; border-top: 1px solid var(--border); }
.ch-comp textarea { flex: 1; min-width: 0; resize: none; border: 1px solid var(--border); border-radius: 18px; padding: 8px 14px; font: inherit; font-size: 13.5px; line-height: 1.5; max-height: 130px; background: #f6f4f2; outline: 0; }
.ch-comp textarea:focus { background: #fff; border-color: #ee9a85; box-shadow: 0 0 0 3px rgba(208,50,14,.1); }
.ch-send { width: 38px; height: 38px; border: 0; border-radius: 50%; background: var(--primary-grad, var(--primary)); color: #fff; cursor: pointer; display: grid; place-items: center; padding: 0; flex: none; } .ch-send:disabled { opacity: .5; cursor: default; } .ch-send .ms { font-size: 19px; }
.ch-zoom { position: fixed; inset: 0; z-index: 10000; display: flex; align-items: center; justify-content: center; background: rgba(15,15,20,.88); } .ch-zoom img { max-width: 92vw; max-height: 84vh; border-radius: 8px; }
.ch-zbar { position: absolute; top: 0; left: 0; right: 0; display: flex; align-items: center; gap: 8px; padding: 12px 18px; color: #fff; font-size: 13px; } .ch-zbar span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ch-zbar button { display: inline-flex; align-items: center; gap: 4px; height: 32px; padding: 0 12px; border: 0; border-radius: 9px; background: rgba(255,255,255,.18); color: #fff; font: inherit; font-size: 12px; cursor: pointer; } .ch-zbar button:hover { background: rgba(255,255,255,.3); }
.ch-pl { max-height: 320px; overflow-y: auto; border: 1px solid var(--border); border-radius: 10px; }
.ch-pu { display: flex; align-items: center; gap: 10px; padding: 8px 12px; cursor: pointer; font-size: 13px; } .ch-pu:hover { background: #faf8f7; } .ch-pu.on { background: var(--primary-l); } .ch-pu .ch-ck { margin-left: auto; color: var(--text-4); } .ch-pu.on .ch-ck { color: var(--primary); }
.ch-pk .field { margin-bottom: 10px; }
@media (max-width: 860px) { .ch-wrap { grid-template-columns: 250px minmax(0, 1fr); } .ch-bw { max-width: 82%; } }
.ch-prog { height: 4px; margin-top: 4px; border-radius: 3px; background: #eadfda; overflow: hidden; } .ch-prog i { display: block; height: 100%; background: var(--primary); transition: width .2s; }

.ch-comp { position: relative; }
.ch-emo-btn { font-size: 20px; line-height: 1; }
.ch-emo { position: absolute; left: 8px; bottom: 100%; margin-bottom: 6px; width: 320px; max-height: 280px; overflow-y: auto; background: #fff; border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 8px 28px rgba(0,0,0,.18); padding: 8px 10px; z-index: 30; }
.ch-emo-h { font-size: 11.5px; color: var(--text-muted, #7a8794); margin: 6px 0 2px; }
.ch-emo-g { display: flex; flex-wrap: wrap; }
.ch-emo-g button { border: 0; background: none; font-size: 22px; width: 36px; height: 36px; border-radius: 8px; cursor: pointer; padding: 0; }
.ch-emo-g button:hover { background: #eef3f8; }
