/* ─── Reset & Base ─────────────────────────────────────────────────────────── */
* { margin: 0; padding: 0; box-sizing: border-box; }
:root {
  --primary: #667eea;
  --primary-dark: #5a6fd6;
  --sidebar-bg: #1e1e2e;
  --sidebar-hover: #2a2a3e;
  --sidebar-active: #3730a3;
  --chat-bg: #f8fafc;
  --white: #ffffff;
  --border: #e5e7eb;
  --text-dark: #111827;
  --text-mid: #374151;
  --text-light: #6b7280;
  --text-xs: #9ca3af;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --wa-green: #25D366;
  --ig-gradient: linear-gradient(135deg, #833ab4, #fd1d1d, #fcb045);
  --fb-blue: #1877F2;
  --msg-out-bg: #667eea;
  --msg-in-bg: #ffffff;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
  --shadow-lg: 0 10px 30px rgba(0,0,0,0.15);
  --radius: 12px;
}
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--chat-bg);
  color: var(--text-dark);
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* ─── Trial Banner ──────────────────────────────────────────────────────────── */
#trialBanner {
  flex-shrink: 0;
  background: linear-gradient(90deg, #667eea, #764ba2);
  color: #fff;
  text-align: center;
  padding: 10px 16px;
  font-size: 13px;
  z-index: 100;
}
#trialBanner.danger { background: #dc2626; }

/* ─── Layout ────────────────────────────────────────────────────────────────── */
#app {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* ─── Sidebar Nav ───────────────────────────────────────────────────────────── */
.nav-sidebar {
  width: 64px;
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 16px 0;
  gap: 4px;
  flex-shrink: 0;
  z-index: 10;
}
.nav-logo {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, var(--primary) 0%, #764ba2 100%);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
}
.nav-logo svg { width: 22px; height: 22px; fill: white; }
.nav-btn {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  border: none;
  background: transparent;
  color: #94a3b8;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  position: relative;
}
.nav-btn:hover { background: var(--sidebar-hover); color: white; }
.nav-btn.active { background: var(--sidebar-active); color: white; }
.nav-btn svg { width: 20px; height: 20px; }
.nav-badge {
  position: absolute;
  top: 6px;
  right: 6px;
  min-width: 16px;
  height: 16px;
  background: var(--danger);
  border-radius: 8px;
  font-size: 10px;
  font-weight: 700;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 3px;
}
.nav-spacer { flex: 1; }
.nav-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #4b5563;
  border: 2px solid #374151;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 13px;
  font-weight: 600;
  margin-top: 8px;
  position: relative;
}
.nav-status-dot {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--success);
  border: 2px solid var(--sidebar-bg);
}

/* ─── Conversations Panel ───────────────────────────────────────────────────── */
.conv-panel {
  width: 320px;
  background: white;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}
.conv-header {
  padding: 16px;
  border-bottom: 1px solid var(--border);
}
.conv-header h2 { font-size: 16px; font-weight: 700; color: var(--text-dark); margin-bottom: 10px; }
.search-box {
  position: relative;
}
.search-box input {
  width: 100%;
  padding: 8px 12px 8px 36px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s;
  background: #f9fafb;
}
.search-box input:focus { border-color: var(--primary); background: white; }
.search-box .search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-xs);
  pointer-events: none;
}
.filter-tabs {
  display: flex;
  gap: 4px;
  padding: 10px 16px 0;
  border-bottom: 1px solid var(--border);
}
.filter-tab {
  padding: 6px 12px;
  border-radius: 6px;
  border: none;
  background: transparent;
  font-size: 12px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  color: var(--text-light);
  transition: all 0.15s;
  display: flex;
  align-items: center;
  gap: 4px;
}
.filter-tab:hover { background: #f3f4f6; }
.filter-tab.active { background: var(--primary); color: white; }
.filter-tab .count {
  background: rgba(255,255,255,0.3);
  border-radius: 10px;
  padding: 0 5px;
  font-size: 10px;
}
.filter-tab:not(.active) .count {
  background: #e5e7eb;
  color: var(--text-light);
}
.conv-list {
  flex: 1;
  overflow-y: auto;
}
.conv-item {
  padding: 14px 16px;
  border-bottom: 1px solid #f3f4f6;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: background 0.1s;
  position: relative;
}
.conv-item:hover { background: #f8fafc; }
.conv-item.active { background: #eff6ff; border-right: 3px solid var(--primary); }
.conv-item.unread .conv-name { font-weight: 700; }
.conv-avatar {
  position: relative;
  flex-shrink: 0;
}
.conv-avatar-img {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: linear-gradient(135deg, #667eea, #764ba2);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 600;
  font-size: 15px;
}
.channel-icon {
  position: absolute;
  bottom: -2px;
  right: -2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid white;
}
.channel-icon.whatsapp { background: var(--wa-green); }
.channel-icon.instagram { background: #e1306c; }
.channel-icon.messenger { background: var(--fb-blue); }
.channel-icon svg { width: 10px; height: 10px; fill: white; }
.conv-body { flex: 1; min-width: 0; }
.conv-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-dark);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 3px;
}
.conv-preview {
  font-size: 12px;
  color: var(--text-light);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.conv-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  flex-shrink: 0;
}
.conv-time { font-size: 11px; color: var(--text-xs); }
.unread-badge {
  min-width: 18px;
  height: 18px;
  background: var(--primary);
  border-radius: 9px;
  font-size: 10px;
  font-weight: 700;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
}
.status-badge {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 500;
}
.status-open { background: #dcfce7; color: #16a34a; }
.status-waiting { background: #fef9c3; color: #a16207; }
.status-resolved { background: #f3f4f6; color: #6b7280; }

/* ─── Chat Area ─────────────────────────────────────────────────────────────── */
.chat-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--chat-bg);
}
.chat-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text-light);
  gap: 12px;
}
.chat-empty svg { width: 64px; height: 64px; color: #d1d5db; }
.chat-empty h3 { font-size: 18px; font-weight: 600; color: var(--text-mid); }
.chat-empty p { font-size: 13px; }

/* Chat header */
.chat-header {
  background: white;
  border-bottom: 1px solid var(--border);
  padding: 12px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
  box-shadow: var(--shadow-sm);
}
.chat-header-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, #667eea, #764ba2);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 600;
  font-size: 14px;
  flex-shrink: 0;
}
.chat-header-info { flex: 1; min-width: 0; }
.chat-header-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-dark);
  display: flex;
  align-items: center;
  gap: 8px;
}
.channel-label {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 20px;
  font-weight: 500;
}
.channel-label.whatsapp { background: #dcfce7; color: #15803d; }
.channel-label.instagram { background: #fce7f3; color: #be185d; }
.channel-label.messenger { background: #dbeafe; color: #1d4ed8; }
.chat-header-sub { font-size: 12px; color: var(--text-light); margin-top: 1px; }
.chat-header-actions { display: flex; gap: 6px; }
.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: 1.5px solid var(--border);
  background: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-light);
  transition: all 0.15s;
}
.icon-btn:hover { background: #f3f4f6; color: var(--text-dark); border-color: #d1d5db; }
.icon-btn svg { width: 16px; height: 16px; }
.btn-resolve {
  padding: 7px 14px;
  background: var(--success);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: opacity 0.15s;
}
.btn-resolve:hover { opacity: 0.85; }

/* Messages */
.messages-container {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.msg-date-divider {
  text-align: center;
  margin: 12px 0;
  position: relative;
}
.msg-date-divider::before {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 1px;
  background: var(--border);
}
.msg-date-divider span {
  position: relative;
  background: var(--chat-bg);
  padding: 0 12px;
  font-size: 11px;
  color: var(--text-xs);
  font-weight: 500;
}
.msg-group { display: flex; flex-direction: column; gap: 3px; margin-bottom: 6px; }
.msg-row { display: flex; align-items: flex-end; gap: 8px; }
.msg-row.outbound { flex-direction: row-reverse; }
.msg-bubble {
  max-width: 65%;
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.5;
  word-break: break-word;
  position: relative;
}
.msg-row.inbound .msg-bubble {
  background: var(--msg-in-bg);
  border-bottom-left-radius: 4px;
  box-shadow: var(--shadow-sm);
  color: var(--text-dark);
}
.msg-row.outbound .msg-bubble {
  background: var(--msg-out-bg);
  border-bottom-right-radius: 4px;
  color: white;
}
.msg-row.system .msg-bubble {
  background: #f0f9ff;
  border: 1px dashed #bae6fd;
  color: #0369a1;
  font-size: 12px;
  border-radius: 8px;
  max-width: 80%;
  text-align: center;
  margin: 0 auto;
}
.msg-transfer {
  display: flex;
  align-items: center;
  gap: 6px;
}
.msg-meta {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 4px;
}
.msg-row.outbound .msg-meta { flex-direction: row-reverse; }
.msg-time { font-size: 11px; color: var(--text-xs); }
.msg-row.outbound .msg-time { color: rgba(255,255,255,0.7); }
.msg-sender { font-size: 11px; color: var(--text-xs); font-weight: 500; }
.msg-status svg { width: 14px; height: 14px; }
.msg-status.sent { color: rgba(255,255,255,0.5); }
.msg-status.delivered { color: rgba(255,255,255,0.7); }
.msg-status.read { color: #60a5fa; }

/* Media messages */
.msg-image img {
  max-width: 220px;
  border-radius: 10px;
  display: block;
  cursor: pointer;
}
.msg-audio audio { max-width: 220px; }
.msg-document {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 0;
}
.msg-doc-icon {
  width: 36px;
  height: 36px;
  background: rgba(255,255,255,0.2);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.msg-row.inbound .msg-doc-icon { background: #f3f4f6; }
.msg-doc-info { flex: 1; min-width: 0; }
.msg-doc-name { font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.msg-doc-size { font-size: 11px; opacity: 0.7; }
.msg-doc-icon svg { width: 18px; height: 18px; }

/* Input area */
.chat-input-area {
  background: white;
  border-top: 1px solid var(--border);
  padding: 12px 20px;
  flex-shrink: 0;
}
.input-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.toolbar-btn {
  padding: 5px 10px;
  border-radius: 6px;
  border: 1.5px solid var(--border);
  background: white;
  font-size: 12px;
  color: var(--text-light);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  font-family: inherit;
  transition: all 0.15s;
}
.toolbar-btn:hover { background: #f3f4f6; color: var(--text-dark); border-color: #d1d5db; }
.toolbar-btn svg { width: 14px; height: 14px; }
.input-row {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  background: #f9fafb;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  padding: 8px 12px;
  transition: border-color 0.2s;
}
.input-row:focus-within { border-color: var(--primary); background: white; }
.attach-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-light);
  padding: 2px;
  display: flex;
  align-items: center;
  transition: color 0.15s;
  flex-shrink: 0;
}
.attach-btn:hover { color: var(--primary); }
.attach-btn svg { width: 20px; height: 20px; }
#messageInput {
  flex: 1;
  border: none;
  background: transparent;
  font-size: 14px;
  font-family: inherit;
  resize: none;
  outline: none;
  max-height: 120px;
  line-height: 1.5;
  color: var(--text-dark);
}
#messageInput::placeholder { color: var(--text-xs); }
.send-btn {
  width: 36px;
  height: 36px;
  background: var(--primary);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  flex-shrink: 0;
  transition: background 0.15s;
}
.send-btn:hover { background: var(--primary-dark); }
.send-btn:disabled { background: #d1d5db; cursor: not-allowed; }
.send-btn svg { width: 18px; height: 18px; }
.attach-options {
  display: flex;
  gap: 8px;
  padding: 8px 0;
  display: none;
}
.attach-options.show { display: flex; }
.attach-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1.5px solid var(--border);
  background: white;
  transition: all 0.15s;
  font-size: 11px;
  color: var(--text-light);
}
.attach-option:hover { border-color: var(--primary); color: var(--primary); background: #f0f4ff; }
.attach-option svg { width: 20px; height: 20px; }

/* ─── Contact Panel ─────────────────────────────────────────────────────────── */
.contact-panel {
  width: 280px;
  background: white;
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow-y: auto;
}
.contact-panel-header {
  padding: 16px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  font-weight: 700;
  color: var(--text-dark);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.contact-info-section {
  padding: 16px;
  border-bottom: 1px solid #f3f4f6;
}
.contact-avatar-lg {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: linear-gradient(135deg, #667eea, #764ba2);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 700;
  font-size: 24px;
  margin: 0 auto 12px;
}
.contact-name-lg {
  text-align: center;
  font-size: 15px;
  font-weight: 700;
  color: var(--text-dark);
  margin-bottom: 4px;
}
.contact-sub-lg { text-align: center; font-size: 12px; color: var(--text-light); }
.info-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  font-size: 13px;
  color: var(--text-mid);
}
.info-row svg { width: 16px; height: 16px; color: var(--text-xs); flex-shrink: 0; }
.info-label { font-size: 11px; color: var(--text-xs); font-weight: 500; margin-bottom: 6px; }
.panel-section { padding: 16px; border-bottom: 1px solid #f3f4f6; }
.panel-section h4 { font-size: 12px; font-weight: 700; color: var(--text-light); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 12px; }

/* Transfer & Actions */
.action-btn {
  width: 100%;
  padding: 9px 14px;
  border-radius: 8px;
  border: 1.5px solid var(--border);
  background: white;
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-mid);
  transition: all 0.15s;
  margin-bottom: 8px;
}
.action-btn:hover { background: #f3f4f6; border-color: #d1d5db; color: var(--text-dark); }
.action-btn svg { width: 16px; height: 16px; }
.action-btn.danger { color: var(--danger); border-color: #fecaca; }
.action-btn.danger:hover { background: #fef2f2; }
.agent-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-light);
  margin-bottom: 4px;
}
.agent-name { font-size: 13px; color: var(--text-dark); font-weight: 500; }
select.form-select {
  width: 100%;
  padding: 8px 10px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s;
  background: white;
  color: var(--text-dark);
  cursor: pointer;
  margin-bottom: 8px;
}
select.form-select:focus { border-color: var(--primary); }

/* ─── Modals ────────────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(2px);
}
.modal-overlay.show { display: flex; }
.modal {
  background: white;
  border-radius: 16px;
  padding: 28px;
  width: 90%;
  max-width: 480px;
  box-shadow: var(--shadow-lg);
  max-height: 90vh;
  overflow-y: auto;
}
.modal h3 { font-size: 17px; font-weight: 700; color: var(--text-dark); margin-bottom: 20px; }
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 12px; font-weight: 600; color: var(--text-mid); margin-bottom: 5px; }
.form-group input, .form-group select, .form-group textarea {
  width: 100%; padding: 9px 12px;
  border: 1.5px solid var(--border); border-radius: 8px;
  font-size: 13px; font-family: inherit; outline: none;
  transition: border-color 0.2s;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus { border-color: var(--primary); }
.modal .form-group { margin-bottom: 16px; }
.modal label { display: block; font-size: 12px; font-weight: 600; color: var(--text-mid); margin-bottom: 5px; }
.modal input, .modal select, .modal textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s;
}
.modal input:focus, .modal select:focus, .modal textarea:focus { border-color: var(--primary); }
.modal textarea { resize: vertical; min-height: 80px; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 20px; }
.btn-secondary {
  padding: 9px 18px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  background: white;
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  color: var(--text-mid);
  transition: all 0.15s;
}
.btn-secondary:hover { background: #f3f4f6; }
.btn-primary {
  padding: 9px 18px;
  border: none;
  border-radius: 8px;
  background: var(--primary);
  color: white;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: opacity 0.15s;
}
.btn-primary:hover { opacity: 0.85; }

/* ─── Settings Guide & Prereq ──────────────────────────────────────────────── */
.settings-prereq {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: var(--radius);
  padding: 14px 18px;
  font-size: 13px;
  color: #1e40af;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 20px;
  line-height: 1.6;
}
.settings-prereq a { color: #1d4ed8; font-weight: 500; }
.settings-prereq a:hover { text-decoration: underline; }
.settings-prereq code {
  background: #dbeafe;
  padding: 1px 5px;
  border-radius: 4px;
  font-family: monospace;
  font-size: 12px;
}
.prereq-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  margin-top: 1px;
  color: #1d4ed8;
}
.prereq-icon svg { width: 20px; height: 20px; }
.settings-guide {
  border-top: 1px solid var(--border);
  background: #fafafa;
  padding: 16px 20px;
}
.guide-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-mid);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.guide-steps {
  font-size: 13px;
  color: var(--text-mid);
  padding-left: 20px;
  line-height: 1.7;
  margin-bottom: 12px;
}
.guide-steps li { margin-bottom: 4px; }
.guide-steps a { color: var(--primary); font-weight: 500; }
.guide-steps a:hover { text-decoration: underline; }
.guide-steps code {
  background: #f3f4f6;
  padding: 1px 5px;
  border-radius: 4px;
  font-family: monospace;
  font-size: 12px;
  color: #be185d;
}
.guide-steps strong { color: var(--text-dark); }
.guide-url-example {
  display: inline-block;
  background: #f0f4ff;
  border: 1px solid #c7d2fe;
  border-radius: 6px;
  padding: 3px 8px;
  font-size: 12px;
  margin-top: 4px;
  color: #3730a3;
}
.guide-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.guide-links a {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 10px;
  background: white;
  border: 1.5px solid #c7d2fe;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  color: #3730a3;
  text-decoration: none;
  transition: all 0.15s;
}
.guide-links a:hover { background: #eff6ff; border-color: var(--primary); }

/* ─── Settings Panel ────────────────────────────────────────────────────────── */
.settings-panel {
  display: none;
  flex: 1;
  overflow-y: auto;
  padding: 32px;
}
.settings-panel.active { display: block; }
.settings-section {
  background: white;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  margin-bottom: 20px;
  overflow: hidden;
}
.settings-section-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
}
.settings-section-header h3 { font-size: 15px; font-weight: 700; color: var(--text-dark); }
.settings-section-header p { font-size: 12px; color: var(--text-light); margin-top: 2px; }
.settings-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.settings-icon svg { width: 18px; height: 18px; }
.settings-body { padding: 20px; }
.settings-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.settings-input-group { margin-bottom: 14px; }
.settings-input-group label { display: block; font-size: 12px; font-weight: 600; color: var(--text-mid); margin-bottom: 5px; }
.settings-input-group input {
  width: 100%;
  padding: 8px 12px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s;
}
.settings-input-group input:focus { border-color: var(--primary); }
.settings-hint { font-size: 11px; color: var(--text-xs); margin-top: 3px; }
.btn-save {
  padding: 10px 24px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: opacity 0.15s;
}
.btn-save:hover { opacity: 0.85; }

/* ─── Agents & Departments Pages ────────────────────────────────────────────── */
.admin-panel {
  display: none;
  flex: 1;
  overflow-y: auto;
  padding: 32px;
}
.admin-panel.active { display: block; }
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}
.page-header h2 { font-size: 20px; font-weight: 700; color: var(--text-dark); }
.table-card {
  background: white;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
}
table { width: 100%; border-collapse: collapse; }
th {
  padding: 12px 16px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-light);
  background: #f9fafb;
  border-bottom: 1px solid var(--border);
}
td { padding: 12px 16px; font-size: 13px; color: var(--text-mid); border-bottom: 1px solid #f3f4f6; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: #f8fafc; }
.role-badge {
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
}
.role-admin { background: #fef3c7; color: #92400e; }
.role-supervisor { background: #dbeafe; color: #1e40af; }
.role-agent { background: #f3f4f6; color: #374151; }
.online-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 4px;
}
.dot-online { background: var(--success); }
.dot-offline { background: #d1d5db; }
.dot-busy { background: var(--warning); }
.td-actions { display: flex; gap: 6px; }
.btn-icon-sm {
  padding: 4px 8px;
  border-radius: 6px;
  border: 1.5px solid var(--border);
  background: white;
  font-size: 11px;
  cursor: pointer;
  color: var(--text-light);
  font-family: inherit;
  transition: all 0.15s;
}
.btn-icon-sm:hover { background: #f3f4f6; color: var(--text-dark); }
.btn-icon-sm.danger:hover { background: #fef2f2; color: var(--danger); border-color: #fecaca; }

/* ─── Toast notifications ───────────────────────────────────────────────────── */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 9999;
}
.toast {
  background: white;
  border-radius: 10px;
  padding: 12px 16px;
  box-shadow: var(--shadow-md);
  border-left: 4px solid var(--success);
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-dark);
  min-width: 220px;
  animation: slideIn 0.3s ease;
}
.toast.error { border-color: var(--danger); }
.toast.warning { border-color: var(--warning); }
@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* ─── Scrollbar ─────────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #9ca3af; }

/* ─── Typing indicator ──────────────────────────────────────────────────────── */
.typing-indicator {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px 14px;
  background: white;
  border-radius: 16px;
  border-bottom-left-radius: 4px;
  width: fit-content;
  box-shadow: var(--shadow-sm);
}
.typing-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #9ca3af;
  animation: bounce 1.2s infinite;
}
.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes bounce {
  0%, 80%, 100% { transform: translateY(0); }
  40% { transform: translateY(-6px); }
}

/* ─── Responsive small screens ──────────────────────────────────────────────── */
@media (max-width: 1200px) {
  .contact-panel { display: none; }
}
@media (max-width: 768px) {
  .conv-panel { display: none; }
  .conv-panel.mobile-show { display: flex; position: fixed; inset: 0; z-index: 100; width: 100%; }
}
