/* מסך שיחות · שלב 1 · קריאה בלבד · עיצוב v5 בתוך מעטפת Ranx הקיימת. כל המחלקות מתחילות ב-cx- */
#cx-root{display:none;padding:14px}
body.cx-on #cx-root{display:block}
body.cx-on .wrap,body.cx-on .pn-bar,body.cx-on .pn-undo{display:none!important}
.cx-wrap{display:grid;grid-template-columns:340px minmax(0,1fr);border:1px solid var(--line);border-radius:var(--r);background:#fff;overflow:hidden;height:calc(100vh - 150px);min-height:520px;max-width:1280px;margin:0 auto}
.cx-list{border-inline-end:1px solid var(--line);display:flex;flex-direction:column;min-height:0;background:#fff}
.cx-lh{padding:10px 12px;border-bottom:1px solid var(--line);display:flex;flex-direction:column;gap:8px}
.cx-lh input{border:0;background:#f1f3f3;border-radius:20px;padding:9px 14px;font:inherit;font-size:14px;width:100%;box-sizing:border-box}
.cx-tabs{display:flex;gap:6px;flex-wrap:wrap}
.cx-tabs button{border:0;background:#f1f3f3;border-radius:16px;padding:5px 12px;font:inherit;font-size:12.5px;cursor:pointer;color:var(--dim)}
.cx-tabs button.on{background:#f5ecda;color:#8a6322;font-weight:700}
.cx-tabs b{font-variant-numeric:tabular-nums;margin-inline-start:4px}
.cx-rows{overflow-y:auto;flex:1;min-height:0}
.cx-row{display:flex;gap:10px;padding:10px 12px;border-bottom:1px solid #eff2f2;cursor:pointer;align-items:center;width:100%;background:none;border-inline:0;border-top:0;font:inherit;text-align:start;color:inherit}
.cx-row:hover{background:#f8faf9}.cx-row.on{background:#f5ecda}
.cx-av{flex:0 0 42px;height:42px;border-radius:50%;background:#dde5e4;color:#3d5150;display:grid;place-items:center;font-weight:700;font-size:16px}
.cx-mid{flex:1;min-width:0}
.cx-top,.cx-bt{display:flex;justify-content:space-between;gap:6px;align-items:baseline}
.cx-bt{align-items:center;margin-top:2px}
.cx-nm{font-weight:700;font-size:14.5px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.cx-tm{font-size:11.5px;color:var(--dim);flex:none}
.cx-pv{font-size:13px;color:var(--dim);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.cx-row.unr .cx-pv{color:var(--ink);font-weight:700}
.cx-badge{background:#25d366;color:#fff;border-radius:11px;min-width:20px;height:20px;display:grid;place-items:center;font-size:11.5px;font-weight:700;padding:0 6px;flex:none}
.cx-tag{font-size:10.5px;border-radius:8px;padding:1px 7px;background:#e8efed;color:#40605a;flex:none;white-space:nowrap}
.cx-tag.new{background:#e1f1e6;color:#2f6a43;font-weight:700}
.cx-tag.man{background:#f5ecda;color:#8a6322}
.cx-thread{display:flex;flex-direction:column;min-width:0;min-height:0;background:#efeae2}
.cx-th{display:flex;align-items:center;gap:10px;padding:8px 14px;background:#f6f7f7;border-bottom:1px solid var(--line)}
.cx-th .cx-nm{font-size:15px}.cx-th .cx-sb{font-size:12.5px;color:var(--dim)}
.cx-grow{flex:1;min-width:0}
.cx-back{display:none;border:0;background:none;font-size:22px;cursor:pointer;color:var(--ink);padding:4px 8px}
.cx-btn{border:1px solid var(--line);background:#fff;border-radius:9px;padding:6px 12px;font:inherit;font-size:13px;font-weight:700;cursor:pointer;color:var(--ink);text-decoration:none;display:inline-block}
.cx-btn.gold{background:var(--gold);border-color:var(--gold);color:#fff}
.cx-btn[disabled]{opacity:.5;cursor:not-allowed}
.cx-st{display:flex;flex-wrap:wrap;gap:8px;align-items:center;padding:7px 14px;background:#fff;border-bottom:1px solid var(--line);font-size:13px}
.cx-st.bot{background:#eaf2ff}.cx-st.man{background:#e8f7ef}.cx-st.warn{background:#fff6dc}
.cx-msgs{flex:1;min-height:0;overflow-y:auto;padding:14px 8% 10px;display:flex;flex-direction:column;gap:3px;background-image:radial-gradient(#e3ddd2 1px,transparent 1px);background-size:18px 18px}
.cx-dsep{align-self:center;background:#fff;border-radius:8px;padding:3px 11px;font-size:11.5px;color:var(--dim);margin:8px 0;box-shadow:0 1px 1px rgba(0,0,0,.06)}
.cx-bub{max-width:68%;padding:6px 10px 4px;border-radius:9px;font-size:14.5px;line-height:1.45;box-shadow:0 1px 1px rgba(0,0,0,.08);word-break:break-word;white-space:pre-wrap}
.cx-bub.in{align-self:flex-start;background:#fff;border-top-right-radius:2px}
.cx-bub.out{align-self:flex-end;background:#d9fdd3;border-top-left-radius:2px}
.cx-bub.botnote{align-self:flex-end;background:#e6f0ff;color:#1456b8;font-weight:700;font-size:13px}
.cx-meta{font-size:10.5px;color:#7a8a99;text-align:end;margin-top:1px}
.cx-media{display:block;font-size:13px;font-weight:700;color:#40605a;background:#f1f3f3;border-radius:7px;padding:6px 9px;margin-bottom:3px}
.cx-media.wait{color:#7a5a00;background:#fff6dc}
.cx-media.bad{color:#9a2a1a;background:#fde9e5}
.cx-sz{font-weight:400;color:#6a7b78;white-space:nowrap}
.cx-file{display:flex;align-items:center;gap:7px;flex-wrap:wrap;text-decoration:none;color:#1456b8;cursor:pointer}.cx-fn{word-break:break-all}.cx-file:hover{text-decoration:underline}
.cx-img{display:block;max-width:100%;max-height:300px;border-radius:7px;margin-bottom:3px;background:#eef0f0;min-width:80px;min-height:60px;object-fit:contain}
.cx-aud{display:block;width:100%;min-width:220px;max-width:280px;margin-bottom:3px}
.cx-vid{display:block;max-width:100%;max-height:300px;border-radius:7px;margin-bottom:3px;background:#000}
.cx-newchip{align-self:center;position:sticky;bottom:6px;border:0;background:var(--dark);color:#fff;border-radius:16px;padding:5px 14px;font:inherit;font-size:12.5px;cursor:pointer}
.cx-comp{display:flex;gap:8px;align-items:center;padding:8px 12px;background:#f6f7f7;border-top:1px solid var(--line)}
.cx-comp textarea{flex:1;border:0;border-radius:20px;padding:9px 14px;font:inherit;font-size:14px;resize:none;height:40px;background:#ecefef;color:var(--dim)}
.cx-comp small{font-size:12px;color:var(--dim)}
.cx-empty{flex:1;display:grid;place-items:center;color:var(--dim);text-align:center;padding:30px;line-height:1.7}
.cx-toast{position:fixed;inset-inline:0;bottom:18px;margin:auto;width:max-content;max-width:92vw;background:var(--dark);color:#fff;border-radius:11px;padding:10px 14px;z-index:80;display:flex;gap:12px;align-items:center;font-size:14px;font-weight:700}
.cx-toast button{border:0;background:var(--gold);color:#fff;border-radius:8px;padding:5px 12px;font:inherit;font-weight:700;cursor:pointer}
.cx-badge-nav{background:#25d366;color:#fff!important;border-radius:10px;min-width:18px;padding:0 6px;text-align:center;font-size:11.5px}
@media (max-width:820px){
 #cx-root{padding:0}
 .cx-wrap{display:block;height:calc(100dvh - 64px);min-height:0;border:0;border-radius:0}
 .cx-wrap .cx-list,.cx-wrap .cx-thread{height:100%}
 .cx-wrap.open .cx-list{display:none}
 .cx-wrap:not(.open) .cx-thread{display:none}
 .cx-back{display:block}
 .cx-msgs{padding:12px 10px 8px}.cx-bub{max-width:86%;font-size:15px}
 .cx-th{flex-wrap:wrap}
}

.sitem[hidden],.cx-btn[hidden]{display:none!important}
.cx-tx{unicode-bidi:plaintext;display:block}
/* 28.10 · הרכבה בתוך ה-CRM החדש (js/crm-chat.js → __cx.mount) */
.cx-embedded{--line:var(--border);--dim:var(--text-2);--ink:var(--text);--r:var(--r-card);--gold:#B8862E}
.cx-embedded #cx-root{display:block;padding:0}
.cx-embedded .cx-wrap{height:calc(100vh - 210px);min-height:420px}

.cx-botbadge{display:inline-block;font-size:11px;font-weight:600;opacity:.75;margin-block-end:2px}

/* 28.10 · בועת שליחה מיידית */
.cx-bub.loc.sending{opacity:.75}
.cx-bub.loc.failed{background:#fde8e8;box-shadow:inset 0 0 0 1px #e5a3a3}
.cx-bub.loc.unknown{background:#fff4d6;box-shadow:inset 0 0 0 1px #e0c068}
.cx-ls{font-size:11px;margin-inline-start:4px}
.cx-ls.failed{color:#b3261e}.cx-ls.unknown{color:#8a5a00}.cx-ls.accepted{color:#667781}

/* 28.10 · שיחה אחת לכל טלפון: גוף = [עמודה ראשית | פניות הלקוח] */
.cx-body{flex:1;display:flex;min-height:0}
.cx-main{flex:1;display:flex;flex-direction:column;min-width:0;min-height:0}
.cx-leads{width:300px;flex:none;border-inline-start:1px solid var(--line);background:#fff;overflow:auto;padding:10px;display:flex;flex-direction:column;gap:8px}
.cx-lt{font-weight:700;font-size:13.5px;color:var(--dim)}
.cx-lc{border:1px solid var(--line);border-radius:8px;padding:8px 10px;display:flex;flex-direction:column;gap:5px;background:#fafafa}
.cx-lc.on{border-color:#25a244;background:#f1fbf4}.cx-lc.closed{opacity:.7}
.cx-lc-h{display:flex;align-items:center;gap:6px;flex-wrap:wrap}.cx-lc-d{font-size:12px;color:var(--dim);margin-inline-start:auto}
.cx-lc-s{font-size:12.5px;color:#333}.cx-lc-a{display:flex;gap:6px;flex-wrap:wrap}.cx-lc-a .cx-btn{font-size:12px;padding:3px 8px}
.cx-lsep{align-self:center;font-size:11.5px;background:#e9edef;color:#54656f;border-radius:6px;padding:2px 10px;margin:4px 0}
@media (max-width:1100px){.cx-body{flex-direction:column}.cx-leads{width:auto;border-inline-start:0;border-top:1px solid var(--line);max-height:34%;order:-1;flex-direction:row;overflow-x:auto}.cx-lc{min-width:230px}}
.cx-bub.pv{opacity:.75;font-style:italic;border:1px dashed #9aa4b2}

/* 02.11 · P0 מובייל: אין overflow אופקי; ההודעות וה-composer תמיד נראים; פס הפניות קומפקטי; אזהרות סטטוס בגובה מוגבל עם גלילה פנימית */
.cx-sts{display:contents}
#cx-root,.cx-wrap,.cx-thread,.cx-body,.cx-main{max-width:100%;min-width:0}
@media (max-width:820px){
 .cx-embedded .cx-wrap{min-height:360px}
 .cx-thread{display:flex;flex-direction:column;overflow:hidden}
 .cx-body{flex:1 1 auto;min-height:0;flex-direction:column;overflow:hidden}
 .cx-sts{display:block;flex:none;max-height:26dvh;overflow-y:auto;overscroll-behavior:contain}
 .cx-st{font-size:12.5px;padding:6px 10px;line-height:1.45}
 .cx-main{flex:1 1 0;min-height:0}
 .cx-msgs{flex:1 1 0;min-height:140px;overflow-y:auto}
 .cx-comp{flex:none;position:sticky;bottom:0;padding:6px 8px}
 .cx-leads{flex:none;max-height:none;width:100%;max-width:100%;box-sizing:border-box;padding:6px 8px;gap:6px;overflow-x:auto;overflow-y:hidden;flex-direction:row;align-items:stretch;border-top:0;border-bottom:1px solid var(--line)}
 .cx-lt{flex:none;align-self:center;font-size:12px;white-space:nowrap}
 .cx-lc{flex:none;min-width:190px;max-width:70vw;padding:5px 8px;gap:3px}
 .cx-lc-s{display:-webkit-box;-webkit-line-clamp:1;-webkit-box-orient:vertical;overflow:hidden}
 .cx-th{flex-wrap:nowrap}
}

/* 06.11 · «פעולות CRM» בתוך מסך השיחה · Desktop: פאנל בעמודה הימנית · ≤1100: כפתור + bottom sheet · בלי overflow אופקי */
.cxa{border:1px solid var(--line);border-radius:10px;background:#f8fafc;padding:8px;display:flex;flex-direction:column;gap:8px;flex:none;max-width:100%;box-sizing:border-box}
.cxa-h b{font-size:13.5px}.cxa-tg{font-size:12px;color:var(--dim);margin-top:2px;overflow-wrap:anywhere;word-break:break-word}
.cxa-sec{display:flex;flex-direction:column;gap:5px}.cxa-k{font-size:12px;color:var(--dim)}.cxa-k b{color:var(--ink)}
.cxa-g{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:6px}
.cxa-b,.cxa-sel{border:1px solid var(--line);background:#fff;border-radius:9px;padding:7px 8px;font:inherit;font-size:12.5px;font-weight:700;cursor:pointer;color:var(--ink);min-height:36px;min-width:0;overflow-wrap:anywhere;line-height:1.25;box-sizing:border-box;width:100%}
.cxa-sel{grid-column:1/-1;font-weight:600}
.cxa-b.on{background:#e8f0fe;border-color:#7aa2f7}.cxa-b.ok{background:#ecfdf3;border-color:#6ce9a6}
.cxa-b[disabled],.cxa-sel[disabled]{opacity:.5;cursor:not-allowed}
.cxa-note{font-size:12px;padding:6px 8px;border-radius:8px;background:#eef2f6;overflow-wrap:anywhere}.cxa-note.warn{background:#fff7e6}
.cx-actbar{flex:none;padding:6px 8px;border-top:1px solid var(--line);background:#fff}
.cx-actbtn{display:flex;align-items:center;justify-content:space-between;gap:8px;width:100%;min-height:44px;box-sizing:border-box;border:1px solid #3b6fe0;background:#3b6fe0;color:#fff;border-radius:10px;padding:8px 12px;font:inherit;font-size:14px;cursor:pointer}
.cx-actbtn span{font-size:11.5px;opacity:.92;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;max-width:62%}
.cxa-bg{position:fixed;inset:0;background:rgba(16,24,40,.38);z-index:39}
.cxa-sheet{position:fixed;inset-inline:0;bottom:0;max-height:84dvh;overflow-y:auto;overscroll-behavior:contain;background:#fff;border-radius:16px 16px 0 0;box-shadow:0 -10px 30px rgba(16,24,40,.2);z-index:40;padding:10px 12px 16px;box-sizing:border-box;display:flex;flex-direction:column;gap:8px;max-width:100vw}
.cxa-sheet[hidden],.cxa-bg[hidden]{display:none}
.cxa-sh-top{display:flex;align-items:center;justify-content:space-between;gap:8px}.cxa-sh-top .cxa-b{width:auto;padding:6px 14px}
.cxa-sh-b{display:flex;flex-direction:column;gap:8px}
.cxa-sh-b .cxa-h{padding-bottom:2px}
@media (min-width:1101px){.cx-actbar{display:none}}

.cxa-ht{display:flex;align-items:center;justify-content:space-between;gap:8px}
.cxa-tgl{border:1px solid var(--line);background:#fff;border-radius:8px;padding:2px 10px;font:inherit;font-size:12px;font-weight:700;cursor:pointer;min-height:26px}
.cxa-heat{grid-template-columns:repeat(4,minmax(0,1fr))}.cxa-heat .cxa-b{padding:7px 2px}
.cxa-sh-b .cxa-ht:empty{display:none}
