/* The conversations screen: a list beside the open conversation, stacked on a phone. */
.cv-intro{margin:2px 0 14px}
.cv-top{display:flex;flex-wrap:wrap;gap:10px;align-items:center}
.cv-search{flex:1;display:flex;gap:8px;min-width:240px;margin:0}
.cv-search input{flex:1;min-width:0;min-height:42px;box-sizing:border-box;border:1px solid #8080804a;border-radius:12px;padding:0 14px;background:transparent;color:inherit;font:inherit}
.cv-search input:focus-visible{outline:2px solid #128c7e;outline-offset:1px;border-color:#128c7e}
.cv-filters{display:flex;gap:8px;margin:14px 0;overflow-x:auto;scrollbar-width:thin;padding-bottom:2px}
.cv-filter{flex:none;border:1px solid #8080803a;background:transparent;color:inherit;border-radius:999px;padding:6px 12px;font-size:13px;cursor:pointer;white-space:nowrap}
.cv-filter:hover{border-color:#128c7e}
.cv-filter span{display:inline-block;min-width:20px;margin-inline-start:4px;padding:0 6px;border-radius:999px;background:#8080801f;font-size:11px}
.cv-filter.is-active{background:#128c7e;border-color:#128c7e;color:#fff}.cv-filter.is-active span{background:#ffffff33}

/* Both columns take the screen's height: the list scrolls by itself and the messages fill the conversation. */
.cv-layout{display:grid;grid-template-columns:minmax(270px,360px) minmax(0,1fr);gap:16px;height:calc(100vh - 250px);min-height:540px}
.cv-list{display:flex;flex-direction:column;gap:6px;overflow:auto;padding-inline-end:4px;scrollbar-width:thin}
.cv-detail{min-width:0;min-height:0;display:flex;flex-direction:column}

.cv-avatar{display:grid;place-items:center;flex:none;width:40px;height:40px;border-radius:50%;background:#128c7e;color:#fff;font-weight:800;font-size:16px;line-height:1}
.cv-ch-telegram{background:#229ed9}.cv-ch-messenger{background:#0866ff}.cv-ch-instagram{background:linear-gradient(35deg,#f8a33b,#e1306c,#8a3ab9)}

.cv-row{display:grid;grid-template-columns:40px minmax(0,1fr);gap:10px;align-items:start;text-align:start;width:100%;border:1px solid #8080802e;border-radius:14px;padding:10px 12px;background:transparent;color:inherit;cursor:pointer;font:inherit;transition:background .15s,border-color .15s}
.cv-row:hover{border-color:#128c7e80;background:#128c7e0a}
.cv-row.is-active{border-color:#128c7e;background:#128c7e14;box-shadow:inset -3px 0 0 #128c7e}
.cv-row-body{display:grid;gap:3px;min-width:0}
.cv-row-head{display:flex;justify-content:space-between;align-items:center;gap:8px}
.cv-row-head strong{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.cv-row-head time{font-size:11px;opacity:.7;white-space:nowrap}
.cv-row-sub{font-size:12px;opacity:.7}.cv-row-last{font-size:12px;opacity:.85;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.cv-row-tags{display:flex;gap:6px;flex-wrap:wrap;margin-top:2px}
.cv-state{font-size:11px;border-radius:999px;padding:2px 9px;background:#8080801f;white-space:nowrap}
.cv-state-ai{background:#128c7e1f;color:#0b6b60}.cv-state-waiting{background:#d977061f;color:#9a5300}.cv-state-human{background:#2563eb1f;color:#1d4ed8}.cv-state-paused{background:#6b72801f}
.cv-needs{font-size:11px;border-radius:999px;padding:2px 8px;background:#dc26261a;color:#b91c1c;font-weight:700}
.cv-more{width:100%}

/* The open conversation: one card, its header, who answers, the orders, the messages, then the reply box. */
.cv-pane{flex:1;min-height:0;display:flex;flex-direction:column;border:1px solid #8080802e;border-radius:16px;overflow:hidden;background:#8080800a}
.cv-pane-head{display:flex;align-items:center;gap:12px;padding:12px 16px;border-bottom:1px solid #80808024}
.cv-pane-head .cv-avatar{width:44px;height:44px;font-size:18px}
.cv-pane-who{flex:1;min-width:0;display:grid;gap:2px}
.cv-pane-who strong{font-size:16px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.cv-pane-who span{font-size:12px;opacity:.7}
.cv-pane-head .cv-state{font-size:12px;padding:4px 12px}
.cv-paused{margin:0;padding:8px 16px;font-size:13px;background:#d977061a;color:#9a5300;border-bottom:1px solid #80808024}
.cv-orders{display:flex;align-items:center;gap:8px;flex-wrap:wrap;padding:8px 16px;border-bottom:1px solid #80808024;font-size:12px}
.cv-orders-label{font-weight:700;opacity:.8}.cv-orders-none{opacity:.6}
.cv-order{display:inline-flex;align-items:center;gap:6px;border:1px solid #8080803a;border-radius:999px;padding:3px 10px;background:transparent;color:inherit;font:inherit;font-size:12px;cursor:pointer}
.cv-order:hover{border-color:#128c7e;background:#128c7e14}.cv-order span{opacity:.8}.cv-order span+span::before{content:'· ';opacity:.6}
.cv-pane-chat{flex:1;min-height:0;display:flex;flex-direction:column}
.cv-older{align-self:center;margin:8px 0;font-size:12px;padding:4px 14px}
/* The shared chat renderer brings its own header and key: the card above already says who this is. */
.cv-pane .business-chat{flex:1;min-height:0;display:flex;flex-direction:column;margin:0;border:0;border-radius:0;box-shadow:none}
.cv-pane .business-chat .bc-header,.cv-pane .business-chat .bc-key{display:none}
.cv-pane .bc-timeline{flex:1;max-height:none;min-height:260px}
.cv-pane-foot{padding:10px 16px;border-top:1px solid #80808024}
.cv-empty{flex:1;display:grid;place-content:center;justify-items:center;gap:6px;text-align:center;border:1px dashed #8080804a;border-radius:16px;padding:30px}
.cv-empty>span{font-size:34px}.cv-empty p{margin:0}
[data-theme=dark] .cv-state-ai{color:#5eead4}[data-theme=dark] .cv-state-waiting{color:#fbbf24}[data-theme=dark] .cv-state-human{color:#93c5fd}[data-theme=dark] .cv-needs{color:#fca5a5}[data-theme=dark] .cv-paused{color:#fbbf24}

/* Handoff: who answers, the actions, the reply box (business-conversation-actions.js). */
.cva{margin:0;padding:10px 16px;border-bottom:1px solid #80808024;background:#128c7e0d;display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:10px}
.cva-head{font-size:13px;display:flex;align-items:center;gap:6px}
.cva-head::before{content:'';width:8px;height:8px;border-radius:50%;background:#128c7e;flex:none}
.cva-buttons{display:flex;flex-wrap:wrap;gap:8px;align-items:center}
.cva-buttons button{min-height:36px;padding:6px 14px;font-size:13px}
.cva-transfer,.cva-pause{display:inline-flex;gap:6px;align-items:center;flex-wrap:wrap}
.cva-transfer select,.cva-pause select{max-width:100%;min-height:36px;border:1px solid #8080805a;border-radius:10px;padding:4px 8px;background:transparent;color:inherit;font:inherit;font-size:13px}
.cva-warn{flex-basis:100%;margin:0;padding:8px 10px;border-radius:8px;background:#d977061a;color:#9a5300;font-size:13px}
.cva-retries{flex-basis:100%}.cva-retries h4{font-size:13px;margin:0 0 6px}
.cva-retry{display:flex;justify-content:space-between;align-items:center;gap:8px;flex-wrap:wrap;font-size:13px;padding:6px 0;border-bottom:1px solid #80808020}
.cva-reply{display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:end;gap:10px;margin:0}
.cva-reply .field{grid-column:auto;margin:0;font-size:12px;display:grid;gap:4px}
.cva-reply textarea{width:100%;box-sizing:border-box;resize:vertical;min-height:44px;max-height:180px;border-radius:12px;padding:10px 12px;font:inherit;font-size:14px}
.cva-reply button{min-height:44px;padding:0 22px}
.cva button:disabled,.cva-reply button:disabled{opacity:.6;cursor:progress}
[data-theme=dark] .cva-warn{color:#fbbf24}

/* Unread and new messages: the count beside a conversation and on the navigation, and a mark on what just arrived. */
.cv-row-meta{display:inline-flex;align-items:center;gap:6px}
.cv-unread,.cv-nav-badge{display:inline-flex;align-items:center;justify-content:center;min-width:20px;height:20px;padding:0 6px;border-radius:999px;background:#dc2626;color:#fff;font-size:11px;font-weight:700;line-height:1}
.cv-nav-badge{margin-inline-start:auto}
.cv-row.is-new{border-color:#dc2626;background:#dc26260d;box-shadow:inset 3px 0 0 #dc2626}
.cv-row.is-new .cv-row-head strong::after{content:' • جديد';color:#dc2626;font-size:11px;font-weight:700}
.cv-mute{white-space:nowrap;font-size:13px;padding:6px 12px;min-height:42px}
@media (prefers-reduced-motion:no-preference){.cv-row.is-new{animation:cv-arrive .6s ease-out 2}}
@keyframes cv-arrive{50%{background:#dc26261f}}
[data-theme=dark] .cv-row.is-new .cv-row-head strong::after{color:#fca5a5}

/* A phone: the list, then the conversation under it, each with its own height. */
@media (max-width:820px){
  .cv-layout{grid-template-columns:1fr;height:auto;min-height:0}
  .cv-list{max-height:46vh}
  .cv-pane{min-height:70vh}
  .cv-pane .bc-timeline{max-height:55vh}
  .cv-pane-head{padding:10px 12px}.cva,.cv-orders,.cv-pane-foot{padding-inline:12px}
  .cv-search{min-width:0;flex-basis:100%}.cv-mute{flex:1}
}
.cv-admin-tools{display:flex;justify-content:space-between;align-items:center;gap:12px;padding:10px 16px;border-bottom:1px solid var(--border,#dce4ee);font-size:12px}.cv-admin-tools>span{opacity:.7}.cv-admin-tools .cv-delete{color:#b42332;border:1px solid #c841512e;background:#c841510a;min-height:38px;padding:7px 13px;border-radius:10px}.cv-admin-tools .cv-delete:hover{background:#c8415117}.cv-admin-tools .cv-delete:focus-visible{outline:2px solid #c84151;outline-offset:3px}[data-theme=dark] .cv-admin-tools .cv-delete{color:#ffadb7}
