/* =====================================================================
   CONNECTO.v2 — Chat UI  /shared/css/chat.css
   ===================================================================== */

/* ── Variables ────────────────────────────────────────────────────── */
:root {
  --nav-bg:           #0E5F56;
  --nav-hover:        rgba(255,255,255,.12);
  --nav-active:       rgba(255,255,255,.22);
  --nav-width:        60px;
  --list-width:       400px;
  --filter-width:     44px;
  --panel-width:      400px;

  --primary:          #10B981;
  --primary-dark:     #059669;
  --primary-light:    #D1FAE5;
  --danger:           #EF4444;
  --warning:          #F59E0B;
  --info:             #3B82F6;
  --muted:            #6B7280;
  --border:           #E5E7EB;
  --bg-page:          #F8FAFC;
  --bg-card:          #FFFFFF;

  --msg-out-bg:       #DCF8C6;
  --msg-in-bg:        #FFFFFF;
  --msg-radius:       12px;

  --font:             'Inter', system-ui, sans-serif;
  --text-main:        #111827;
  --text-secondary:   #6B7280;
  --text-light:       #9CA3AF;

  --shadow-sm:        0 1px 2px rgba(0,0,0,.08);
  --shadow-md:        0 2px 8px rgba(0,0,0,.12);
  --shadow-lg:        0 4px 16px rgba(0,0,0,.16);

  --radius-sm:        4px;
  --radius-md:        8px;
  --radius-lg:        16px;

  --z-dropdown:       200;
  --z-modal:          500;
  --z-toast:          900;
}

/* ── Reset / Base ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  font-family: var(--font);
  font-size: 13px;
  color: var(--text-main);
  background: var(--bg-page);
  -webkit-font-smoothing: antialiased;
}

/* ── Root layout ──────────────────────────────────────────────────── */
.chat-root {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* =====================================================================
   LEFT NAV SIDEBAR
   ===================================================================== */
.nav-sidebar {
  flex: 0 0 var(--nav-width);
  width: var(--nav-width);
  background: var(--nav-bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 8px 0;
  z-index: 10;
  overflow: hidden;
}

.nav-logo {
  width: 38px;
  height: 38px;
  background: rgba(255,255,255,.18);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 10px;
  flex-shrink: 0;
  cursor: pointer;
}
.nav-logo i { color: #fff; font-size: 18px; }

.nav-items-top,
.nav-items-bottom {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  width: 100%;
}
.nav-items-top   { flex: 1; padding-top: 4px; }
.nav-items-bottom { padding-bottom: 6px; }

.nav-item {
  position: relative;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  cursor: pointer;
  color: rgba(255,255,255,.7);
  transition: background .15s, color .15s;
  flex-shrink: 0;
}
.nav-item:hover  { background: var(--nav-hover); color: #fff; }
.nav-item.active { background: var(--nav-active); color: #fff; }
.nav-item i      { font-size: 17px; }

/* Badge on nav item */
.nav-badge {
  position: absolute;
  top: 5px; right: 4px;
  background: #F59E0B;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  min-width: 16px;
  height: 16px;
  border-radius: 8px;
  padding: 0 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

/* User avatar at bottom of nav */
.nav-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #F59E0B;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  margin-top: 4px;
  border: 2px solid rgba(255,255,255,.3);
  letter-spacing: .5px;
}

/* Tooltip on hover */
.nav-item[data-tip]:hover::after {
  content: attr(data-tip);
  position: absolute;
  left: calc(100% + 10px);
  top: 50%;
  transform: translateY(-50%);
  background: rgba(0,0,0,.8);
  color: #fff;
  font-size: 11px;
  white-space: nowrap;
  padding: 4px 8px;
  border-radius: 4px;
  pointer-events: none;
  z-index: 999;
}

/* =====================================================================
   CHAT LIST PANEL
   ===================================================================== */
.chat-list-panel {
  flex: 0 0 var(--list-width);
  width: var(--list-width);
  min-width: 400px;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border);
  background: var(--bg-card);
  overflow: hidden;
}

/* Header */
.cls-header {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 12px 8px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.cls-header-title {
  font-size: 13px;
  font-weight: 600;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text-main);
}
.cls-header-actions {
  display: flex;
  gap: 4px;
  align-items: center;
}
.cls-header-btn {
  width: 28px; height: 28px;
  border: none;
  background: none;
  color: var(--muted);
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  transition: background .15s, color .15s;
}
.cls-header-btn:hover { background: var(--bg-page); color: var(--text-main); }

/* Search bar */
.cls-search {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.cls-search input {
  flex: 1;
  border: none;
  background: var(--bg-page);
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 12px;
  color: var(--text-main);
  outline: none;
}
.cls-search input::placeholder { color: var(--text-light); }
.cls-search-actions {
  display: flex;
  gap: 2px;
}
.cls-search-btn {
  width: 26px; height: 26px;
  border: none;
  background: none;
  color: var(--muted);
  border-radius: 5px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
}
.cls-search-btn:hover { background: var(--bg-page); }

/* Body = filter sidebar + chat items */
.cls-body {
  flex: 1;
  display: flex;
  overflow: hidden;
}

/* ── Filter sidebar ── */
.cls-filter-bar {
  flex: 0 0 var(--filter-width);
  width: var(--filter-width);
  display: flex;
  flex-direction: column;
  align-items: center;
  background: #F8FAFC;
  border-right: 1px solid var(--border);
  overflow-y: auto;
  padding: 6px 0;
  gap: 2px;
}
.cls-filter-bar::-webkit-scrollbar { width: 2px; }
.cls-filter-bar::-webkit-scrollbar-thumb { background: #CBD5E1; border-radius: 2px; }

.cls-filter-item {
  width: 36px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 5px 0;
  cursor: pointer;
  border-radius: 6px;
  border-left: 3px solid transparent;
  transition: background .15s, border-color .15s;
  font-size: 9px;
  color: var(--muted);
  text-align: center;
}
.cls-filter-item:hover { background: #EFF1F3; }
.cls-filter-item.active {
  border-left-color: var(--primary);
  color: var(--primary);
  background: var(--primary-light);
}
.cls-filter-item i { font-size: 14px; }
.cls-filter-item .flt-label { font-size: 8px; font-weight: 500; line-height: 1.2; }
.cls-filter-item .flt-count {
  background: var(--primary);
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  border-radius: 8px;
  min-width: 16px;
  height: 14px;
  padding: 0 3px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.cls-filter-item.active .flt-count { background: var(--primary-dark); }

.cls-filter-separator {
  width: 28px;
  height: 1px;
  background: var(--border);
  margin: 4px 0;
}

/* ── Chat items list ── */
.cls-items {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}
.cls-items::-webkit-scrollbar { width: 3px; }
.cls-items::-webkit-scrollbar-thumb { background: #CBD5E1; border-radius: 3px; }

.cls-group-header {
  padding: 8px 10px 4px;
  font-size: 10px;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: .5px;
  background: var(--bg-card);
  position: sticky;
  top: 0;
  z-index: 2;
}

.cls-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 9px 10px;
  cursor: pointer;
  border-bottom: 1px solid rgba(0,0,0,.04);
  transition: background .12s;
  position: relative;
}
.cls-item:hover     { background: #F3F4F6; }
.cls-item.active    { background: #EFF6FF; }
.cls-item.unread    {}

.cls-item-avatar {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  background: #6366F1;
  position: relative;
}
/* Channel badge on avatar */
.cls-item-avatar .ch-badge {
  position: absolute;
  bottom: -2px; right: -2px;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: #25D366;
  border: 2px solid #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 7px;
  color: #fff;
}

.cls-item-body { flex: 1; min-width: 0; }
.cls-item-row1 {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 2px;
}
.cls-item-name {
  flex: 1;
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text-main);
}
.cls-item-time {
  font-size: 10px;
  color: var(--text-light);
  flex-shrink: 0;
  white-space: nowrap;
}
.cls-item-row2 {
  display: flex;
  align-items: center;
  gap: 4px;
}
.cls-item-preview {
  flex: 1;
  font-size: 11.5px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cls-item-badge {
  flex-shrink: 0;
  background: var(--primary);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  padding: 0 5px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ── Footer of chat list ── */
.cls-footer {
  border-top: 1px solid var(--border);
  padding: 8px 10px;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.cls-footer label {
  font-size: 11px;
  color: var(--text-secondary);
  white-space: nowrap;
}
.cls-footer select {
  flex: 1;
  font-size: 11px;
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 4px 6px;
  background: var(--bg-card);
  color: var(--text-main);
  outline: none;
}

/* =====================================================================
   MAIN CHAT AREA
   ===================================================================== */
.chat-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--bg-page);
  overflow: hidden;
}

/* ── Chat header ── */
.cm-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  position: relative;
}
.cm-header-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #0D9488;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  position: relative;
}
.cm-header-avatar .online-dot {
  position: absolute;
  bottom: 1px; right: 1px;
  width: 9px; height: 9px;
  border-radius: 50%;
  background: var(--primary);
  border: 2px solid #fff;
}
.cm-header-info { flex: 1; min-width: 0; }
.cm-header-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.3;
}
.cm-header-sub {
  font-size: 11px;
  color: var(--text-secondary);
}

.cm-header-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}
.cm-btn {
  height: 32px;
  padding: 0 12px;
  border: none;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: background .15s;
}
.cm-btn-resolve {
  background: var(--primary);
  color: #fff;
}
.cm-btn-resolve:hover { background: var(--primary-dark); }
.cm-btn-split {
  width: 28px; height: 32px;
  padding: 0;
  background: var(--primary);
  color: #fff;
  border-left: 1px solid rgba(255,255,255,.3);
  border-radius: 0 6px 6px 0;
  margin-left: 1px;
}
.cm-btn-icon {
  width: 32px; height: 32px;
  border: none;
  border-radius: 6px;
  background: none;
  color: var(--muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  transition: background .15s, color .15s;
}
.cm-btn-icon:hover { background: var(--bg-page); color: var(--text-main); }
.cm-btn-reassign {
  background: #F3F4F6;
  color: var(--text-main);
  font-size: 12px;
  font-weight: 500;
}
.cm-btn-reassign:hover { background: #E5E7EB; }

/* ── Dropdown menus ── */
.cm-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  right: 10px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  min-width: 200px;
  z-index: var(--z-dropdown);
  overflow: hidden;
  display: none;
}
.cm-dropdown.open { display: block; }
.cm-dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 14px;
  font-size: 12.5px;
  color: var(--text-main);
  cursor: pointer;
  transition: background .12s;
}
.cm-dropdown-item:hover { background: var(--bg-page); }
.cm-dropdown-item i { width: 14px; color: var(--muted); font-size: 13px; }
.cm-dropdown-item.danger { color: var(--danger); }
.cm-dropdown-item.danger i { color: var(--danger); }
.cm-dropdown-sep { height: 1px; background: var(--border); margin: 2px 0; }

/* ── Message thread ── */
.cm-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.cm-messages::-webkit-scrollbar { width: 4px; }
.cm-messages::-webkit-scrollbar-thumb { background: #CBD5E1; border-radius: 4px; }

.msg-date-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 10px 0 4px;
}
.msg-date-divider::before,
.msg-date-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}
.msg-date-text {
  font-size: 11px;
  color: var(--text-secondary);
  white-space: nowrap;
  padding: 3px 10px;
  background: rgba(0,0,0,.05);
  border-radius: 10px;
}

/* Message row */
.msg-row {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  max-width: 100%;
  animation: msgIn .2s ease-out;
}
.msg-row.out {
  flex-direction: row-reverse;
  align-self: flex-end;
}
.msg-row.in {
  align-self: flex-start;
}

@keyframes msgIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: none; }
}

.msg-avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: #6366F1;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-bottom: 2px;
}

.msg-bubble {
  max-width: min(480px, 72%);
  padding: 8px 12px;
  border-radius: var(--msg-radius);
  font-size: 13px;
  line-height: 1.5;
  position: relative;
  word-break: break-word;
}
.msg-row.in  .msg-bubble {
  background: var(--msg-in-bg);
  box-shadow: var(--shadow-sm);
  border-bottom-left-radius: 3px;
  color: var(--text-main);
}
.msg-row.out .msg-bubble {
  background: var(--msg-out-bg);
  border-bottom-right-radius: 3px;
  color: var(--text-main);
}
.msg-bubble a { color: var(--info); }

/* Meta: time + status */
.msg-meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  margin-top: 3px;
}
.msg-time {
  font-size: 10px;
  color: var(--text-light);
}
.msg-status { font-size: 11px; color: var(--info); }
.msg-status.read { color: #34D399; }

/* ── Input area ── */
.cm-input-area {
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

/* Tabs */
.cm-input-tabs {
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--border);
  padding: 0 12px;
}
.cm-input-tab {
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color .15s, border-color .15s;
  display: flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}
.cm-input-tab:hover { color: var(--text-main); }
.cm-input-tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}
.cm-input-tab .tab-ai-badge {
  background: linear-gradient(135deg, #8B5CF6, #EC4899);
  color: #fff;
  font-size: 9px;
  border-radius: 3px;
  padding: 1px 4px;
}
.cm-input-tab-spacer { flex: 1; }
.cm-input-settings-btn {
  width: 28px; height: 28px;
  border: none;
  background: none;
  color: var(--muted);
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
}

/* Suggestion panel (canned responses) */
.cm-suggestions {
  padding: 6px 12px;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 3px;
  max-height: 80px;
  overflow-y: auto;
}
.cm-suggestion-item {
  display: flex;
  align-items: baseline;
  gap: 6px;
  cursor: pointer;
  padding: 3px 4px;
  border-radius: 4px;
}
.cm-suggestion-item:hover { background: var(--bg-page); }
.cm-suggestion-shortcut {
  font-size: 11px;
  font-weight: 700;
  color: var(--primary);
  flex-shrink: 0;
}
.cm-suggestion-preview {
  font-size: 11px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Typing indicator */
.cm-typing-status {
  padding: 3px 14px;
  font-size: 11px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 20px;
}
.typing-dots {
  display: flex;
  gap: 3px;
  align-items: center;
}
.typing-dot {
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--primary);
  animation: typingBounce 1.2s infinite ease-in-out;
}
.typing-dot:nth-child(2) { animation-delay: .2s; }
.typing-dot:nth-child(3) { animation-delay: .4s; }
@keyframes typingBounce {
  0%,80%,100% { transform: scale(.7); opacity: .5; }
  40%          { transform: scale(1.1); opacity: 1; }
}

/* Text input row */
.cm-input-row {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px 8px;
}
.cm-input-btn {
  width: 30px; height: 30px;
  border: none;
  background: none;
  color: var(--muted);
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
  transition: background .15s, color .15s;
}
.cm-input-btn:hover { background: var(--bg-page); color: var(--text-main); }
.cm-textarea-wrap {
  flex: 1;
  min-width: 0;
  background: var(--bg-page);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  display: flex;
  align-items: flex-end;
}
.cm-textarea {
  flex: 1;
  border: none;
  background: none;
  padding: 8px 10px;
  font-size: 13px;
  font-family: var(--font);
  resize: none;
  outline: none;
  color: var(--text-main);
  min-height: 36px;
  max-height: 120px;
  line-height: 1.5;
}
.cm-textarea::placeholder { color: var(--text-light); }
.cm-send-btn {
  width: 36px; height: 36px;
  border: none;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background .15s, transform .1s;
  margin-left: 4px;
}
.cm-send-btn:hover  { background: var(--primary-dark); }
.cm-send-btn:active { transform: scale(.92); }

/* =====================================================================
   RIGHT INFO PANEL
   ===================================================================== */
.info-panel {
  flex: 0 0 var(--panel-width);
  width: var(--panel-width);
  min-width: 400px;
  display: flex;
  flex-direction: column;
  border-left: 1px solid var(--border);
  background: var(--bg-card);
  overflow-y: auto;
}
.info-panel::-webkit-scrollbar { width: 3px; }
.info-panel::-webkit-scrollbar-thumb { background: #CBD5E1; border-radius: 3px; }

/* Contact card */
.ip-contact-card {
  padding: 16px 14px 12px;
  border-bottom: 1px solid var(--border);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.ip-avatar {
  width: 52px; height: 52px;
  border-radius: 50%;
  background: #0D9488;
  color: #fff;
  font-size: 18px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.ip-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-main);
}
.ip-phone {
  font-size: 11.5px;
  color: var(--text-secondary);
}
.ip-edit-btn {
  padding: 5px 14px;
  border: none;
  border-radius: 6px;
  background: var(--primary-light);
  color: var(--primary-dark);
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s;
}
.ip-edit-btn:hover { background: #A7F3D0; }

/* Info section */
.ip-section {
  border-bottom: 1px solid var(--border);
  overflow: hidden;
}
.ip-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 14px 7px;
  cursor: pointer;
  user-select: none;
}
.ip-section-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: .4px;
}
.ip-section-toggle {
  color: var(--text-light);
  font-size: 11px;
  transition: transform .2s;
}
.ip-section.collapsed .ip-section-toggle { transform: rotate(-90deg); }
.ip-section-body {
  padding: 4px 14px 12px;
}
.ip-section.collapsed .ip-section-body { display: none; }

/* Info rows */
.ip-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 4px 0;
  font-size: 12px;
  color: var(--text-main);
}
.ip-row-icon {
  width: 14px;
  flex-shrink: 0;
  color: var(--text-secondary);
  font-size: 12px;
  text-align: center;
}
.ip-row-label { color: var(--text-secondary); min-width: 0; }
.ip-row-value { color: var(--text-main); font-weight: 500; flex: 1; text-align: right; }
.ip-row-value a { color: var(--info); text-decoration: none; }
.ip-row-value a:hover { text-decoration: underline; }

.ip-status-dot {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--primary);
  margin-right: 4px;
}

/* Contact grid */
.ip-contact-grid {
  display: grid;
  grid-template-columns: 90px 1fr;
  gap: 6px 8px;
  font-size: 12px;
}
.ip-contact-grid .grid-label { color: var(--text-secondary); }
.ip-contact-grid .grid-value { color: var(--text-main); font-weight: 500; word-break: break-word; }

/* Campaign row */
.ip-campaign-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 0;
  font-size: 12px;
}
.ip-campaign-icon {
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--primary-light);
  color: var(--primary-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  flex-shrink: 0;
}
.ip-campaign-info { flex: 1; min-width: 0; }
.ip-campaign-name { font-weight: 600; }
.ip-campaign-time { color: var(--text-secondary); font-size: 11px; }

.ip-add-link {
  font-size: 12px;
  color: var(--info);
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  padding: 2px 0;
}
.ip-add-link:hover { text-decoration: underline; }

/* =====================================================================
   MISCELLANEOUS
   ===================================================================== */

/* Empty state */
.chat-empty-state {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: var(--text-secondary);
  padding: 40px;
}
.chat-empty-state i { font-size: 48px; color: var(--text-light); }
.chat-empty-state h3 { font-size: 16px; font-weight: 600; }
.chat-empty-state p  { font-size: 13px; text-align: center; line-height: 1.6; }

/* System message */
.msg-system {
  align-self: center;
  font-size: 11px;
  color: var(--text-secondary);
  background: rgba(0,0,0,.05);
  border-radius: 10px;
  padding: 3px 12px;
  margin: 4px 0;
}

/* Loading spinner */
.spinner {
  width: 20px; height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Toast notifications */
.toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: var(--z-toast);
}
.toast {
  background: var(--text-main);
  color: #fff;
  padding: 10px 16px;
  border-radius: var(--radius-md);
  font-size: 13px;
  box-shadow: var(--shadow-lg);
  animation: toastIn .25s ease-out;
  display: flex;
  align-items: center;
  gap: 8px;
}
.toast.success { background: var(--primary-dark); }
.toast.error   { background: var(--danger); }
@keyframes toastIn {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: none; }
}

/* Modal backdrop */
.modal-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  z-index: var(--z-modal);
  align-items: center;
  justify-content: center;
}
.modal-backdrop.open { display: flex; }
.modal-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 480px;
  overflow: hidden;
}
.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-title  { font-size: 15px; font-weight: 700; }
.modal-close  { border: none; background: none; cursor: pointer; font-size: 16px; color: var(--muted); }
.modal-body   { padding: 20px; }
.modal-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* Buttons (generic) */
.btn {
  padding: 8px 16px;
  border: none;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, opacity .15s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary { background: var(--bg-page); color: var(--text-main); border: 1px solid var(--border); }
.btn-secondary:hover { background: #E5E7EB; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { opacity: .88; }

/* Form controls */
.form-group { margin-bottom: 14px; }
.form-label { display: block; font-size: 12px; font-weight: 600; margin-bottom: 4px; color: var(--text-main); }
.form-control {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  font-family: var(--font);
  color: var(--text-main);
  background: var(--bg-card);
  outline: none;
  transition: border-color .15s;
}
.form-control:focus { border-color: var(--primary); }
.form-control::placeholder { color: var(--text-light); }

/* Divider */
.divider { height: 1px; background: var(--border); margin: 8px 0; }

/* Responsive: hide right panel on small screens */
@media (max-width: 1100px) { .info-panel    { display: none; } }
@media (max-width:  780px) { .chat-list-panel{ display: none; } }
@media (max-width:  500px) { .nav-sidebar   { display: none; } }

/* ── Column resizer handles ────────────────────────────────────────── */
.col-resizer {
  flex: 0 0 4px;
  width: 4px;
  cursor: col-resize;
  background: var(--border);
  position: relative;
  z-index: 20;
  transition: background 0.15s;
  user-select: none;
}
.col-resizer:hover,
.col-resizer.is-dragging {
  background: var(--primary);
}
.col-resizer::after {
  content: '';
  position: absolute;
  top: 0; bottom: 0;
  left: -5px; right: -5px;
}
