/* ────────────────────────────────────────────────────────────
   WhatsApp Panel — Premium Dark Theme CSS
   ──────────────────────────────────────────────────────────── */

:root {
  --bg-primary: #0a0f1e;
  --bg-secondary: #0f1629;
  --bg-card: #131d35;
  --bg-card-hover: #192240;
  --bg-input: #0d1526;
  --bg-sidebar: #080d1a;
  --bg-message-in: #1a2540;
  --bg-message-out: #1a3a2f;

  --border: rgba(255,255,255,0.07);
  --border-active: rgba(37,211,102,0.4);

  --accent-green: #25d366;
  --accent-green-dark: #1da851;
  --accent-green-glow: rgba(37,211,102,0.15);
  --accent-blue: #4f8ef7;
  --accent-purple: #8b5cf6;
  --accent-orange: #f59e0b;
  --accent-teal: #14b8a6;
  --accent-red: #ef4444;

  --text-primary: #e8edf8;
  --text-secondary: #8694b5;
  --text-muted: #4a5a7a;
  --text-link: #4f8ef7;

  --sidebar-width: 240px;
  --topbar-height: 64px;
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --shadow: 0 4px 24px rgba(0,0,0,0.4);
  --shadow-lg: 0 8px 48px rgba(0,0,0,0.6);

  --transition: 0.2s ease;
  --transition-slow: 0.35s cubic-bezier(0.4,0,0.2,1);
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; }
body {
  font-family: 'Inter', -apple-system, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.5;
  overflow: hidden;
  height: 100vh;
}
button { cursor: pointer; border: none; outline: none; background: none; font-family: inherit; }
input, textarea, select { font-family: inherit; outline: none; }
a { color: var(--text-link); text-decoration: none; }

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.2); }

/* ── Layout ── */
#app {
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr;
  height: 100vh;
  overflow: hidden;
  transition: grid-template-columns var(--transition-slow);
}
#app.sidebar-collapsed {
  grid-template-columns: 64px 1fr;
}

/* ────────────────── SIDEBAR ──────────────────────────────── */
.sidebar {
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
  z-index: 10;
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 16px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  overflow: hidden;
}
.logo-icon { font-size: 24px; flex-shrink: 0; }
.logo-text {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  white-space: nowrap;
  opacity: 1;
  transition: opacity var(--transition);
}
#app.sidebar-collapsed .logo-text { opacity: 0; }
.logo-name { font-size: 15px; font-weight: 700; color: var(--accent-green); }
.logo-sub { font-size: 11px; color: var(--text-muted); }

.sidebar-toggle {
  color: var(--text-secondary);
  padding: 6px;
  border-radius: var(--radius-sm);
  transition: background var(--transition), color var(--transition);
  flex-shrink: 0;
}
.sidebar-toggle:hover { background: rgba(255,255,255,0.06); color: var(--text-primary); }

/* Nav */
.sidebar-nav {
  flex: 1;
  padding: 12px 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow-y: auto;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  transition: all var(--transition);
  position: relative;
  white-space: nowrap;
  overflow: hidden;
}
.nav-item:hover {
  background: rgba(255,255,255,0.04);
  color: var(--text-primary);
}
.nav-item.active {
  background: var(--accent-green-glow);
  color: var(--accent-green);
  border: 1px solid var(--border-active);
}
.nav-item.active .nav-icon { color: var(--accent-green); }
.nav-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  transition: color var(--transition);
}
.nav-item span:not(.nav-badge) {
  opacity: 1;
  transition: opacity var(--transition);
}
#app.sidebar-collapsed .nav-item span:not(.nav-badge) { opacity: 0; }
#app.sidebar-collapsed .nav-badge { display: none !important; }

.nav-badge {
  margin-left: auto;
  background: var(--accent-green);
  color: #000;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 20px;
  flex-shrink: 0;
}

.sidebar-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.connection-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
}
.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
  flex-shrink: 0;
  animation: pulse 2s infinite;
}
.status-dot.connected { background: var(--accent-green); }
.status-dot.error { background: var(--accent-red); }
#app.sidebar-collapsed .status-text { opacity: 0; }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* ────────────────── MAIN ──────────────────────────────────── */
.main {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg-primary);
}

/* Top bar */
.topbar {
  height: var(--topbar-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  background: var(--bg-secondary);
}
.topbar-left { display: flex; align-items: center; gap: 16px; }
.page-title { font-size: 20px; font-weight: 700; }
.topbar-right { display: flex; align-items: center; gap: 16px; }
.topbar-time { font-size: 13px; color: var(--text-secondary); font-variant-numeric: tabular-nums; }

/* Views */
.view-container { flex: 1; overflow: hidden; position: relative; }
.view { display: none; height: 100%; overflow-y: auto; padding: 24px; animation: fadeIn 0.2s ease; }
.view.active { display: block; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  transition: all var(--transition);
  white-space: nowrap;
}
.btn-primary {
  background: var(--accent-green);
  color: #000;
}
.btn-primary:hover { background: var(--accent-green-dark); transform: translateY(-1px); box-shadow: 0 4px 16px rgba(37,211,102,0.3); }
.btn-ghost {
  background: rgba(255,255,255,0.05);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
.btn-ghost:hover { background: rgba(255,255,255,0.1); color: var(--text-primary); }
.btn-danger { background: rgba(239,68,68,0.15); color: var(--accent-red); border: 1px solid rgba(239,68,68,0.3); }
.btn-danger:hover { background: rgba(239,68,68,0.25); }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-icon { padding: 8px; border-radius: var(--radius-sm); }

/* ── Stats Grid ── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  transition: all var(--transition);
}
.stat-card:hover { background: var(--bg-card-hover); transform: translateY(-2px); border-color: rgba(255,255,255,0.12); }

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.stat-icon svg { width: 22px; height: 22px; }
.stat-icon--green { background: rgba(37,211,102,0.12); color: var(--accent-green); }
.stat-icon--blue { background: rgba(79,142,247,0.12); color: var(--accent-blue); }
.stat-icon--purple { background: rgba(139,92,246,0.12); color: var(--accent-purple); }
.stat-icon--orange { background: rgba(245,158,11,0.12); color: var(--accent-orange); }
.stat-icon--teal { background: rgba(20,184,166,0.12); color: var(--accent-teal); }
.stat-icon--red { background: rgba(239,68,68,0.12); color: var(--accent-red); }

.stat-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.stat-value { font-size: 26px; font-weight: 800; line-height: 1; }
.stat-label { font-size: 12px; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ── Dashboard Grid ── */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

/* ── Cards ── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.card-title { font-size: 15px; font-weight: 600; }

/* ── Sessions Grid ── */
.sessions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.session-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
}
.session-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--text-muted);
  transition: background var(--transition);
}
.session-card.connected::before { background: var(--accent-green); }
.session-card.qr::before { background: var(--accent-orange); }
.session-card.authenticated::before { background: var(--accent-blue); }
.session-card:hover { border-color: rgba(255,255,255,0.12); transform: translateY(-2px); box-shadow: var(--shadow); }

.session-card-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}
.session-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--accent-green-glow);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  border: 2px solid var(--border-active);
  flex-shrink: 0;
}
.session-info { flex: 1; min-width: 0; }
.session-name { font-size: 15px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.session-phone { font-size: 12px; color: var(--text-muted); }

.session-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.session-status-badge.connected { background: rgba(37,211,102,0.12); color: var(--accent-green); }
.session-status-badge.disconnected { background: rgba(239,68,68,0.12); color: var(--accent-red); }
.session-status-badge.qr { background: rgba(245,158,11,0.12); color: var(--accent-orange); }
.session-status-badge.authenticated, .session-status-badge.initializing {
  background: rgba(79,142,247,0.12); color: var(--accent-blue);
}

.session-card-footer {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  flex-wrap: wrap;
}

/* Sessions list (dashboard) */
.sessions-list { padding: 8px 0; }
.session-list-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  transition: background var(--transition);
}
.session-list-item:hover { background: rgba(255,255,255,0.03); }
.session-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.session-dot.connected { background: var(--accent-green); }
.session-dot.disconnected { background: var(--accent-red); }
.session-dot.qr { background: var(--accent-orange); }

/* ── Chat Layout ── */
.view#view-chats { padding: 0; }
.chat-layout { display: grid; grid-template-columns: 320px 1fr; height: 100%; }
.chat-sidebar {
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg-secondary);
}
.chat-sidebar-header {
  padding: 12px;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.chat-list { flex: 1; overflow-y: auto; }

.chat-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  cursor: pointer;
  transition: background var(--transition);
  border-bottom: 1px solid rgba(255,255,255,0.03);
}
.chat-item:hover { background: rgba(255,255,255,0.04); }
.chat-item.active { background: var(--accent-green-glow); }

.chat-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--bg-card);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
  border: 1px solid var(--border);
}
.chat-item-info { flex: 1; min-width: 0; }
.chat-item-name { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-item-preview { font-size: 12px; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-item-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.chat-item-time { font-size: 11px; color: var(--text-muted); }
.chat-unread {
  background: var(--accent-green);
  color: #000;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 20px;
}

/* Chat main */
.chat-main {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg-primary);
}
.chat-placeholder {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: var(--text-muted);
}
.placeholder-icon { font-size: 56px; }
.chat-placeholder h3 { font-size: 18px; color: var(--text-secondary); }
.chat-placeholder p { font-size: 14px; }

.chat-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-secondary);
  flex-shrink: 0;
}
.chat-header-info { flex: 1; }
.chat-header-name { font-size: 15px; font-weight: 600; }
.chat-header-status { font-size: 12px; color: var(--text-muted); }

.messages-container {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.message-bubble {
  max-width: 70%;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.5;
  position: relative;
  word-break: break-word;
}
.message-bubble.incoming {
  background: var(--bg-message-in);
  border-radius: 4px 12px 12px 12px;
  align-self: flex-start;
}
.message-bubble.outgoing {
  background: var(--bg-message-out);
  border-radius: 12px 4px 12px 12px;
  align-self: flex-end;
}
.message-time {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 4px;
  display: block;
  text-align: right;
}

.chat-input-area {
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  background: var(--bg-secondary);
  display: flex;
  gap: 10px;
  align-items: flex-end;
}
.chat-input {
  flex: 1;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 10px 18px;
  color: var(--text-primary);
  font-size: 14px;
  resize: none;
  max-height: 120px;
  transition: border-color var(--transition);
  line-height: 1.5;
}
.chat-input:focus { border-color: var(--accent-green); }
.chat-send-btn {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--accent-green);
  color: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all var(--transition);
}
.chat-send-btn:hover { background: var(--accent-green-dark); transform: scale(1.05); }

/* ── Contacts Grid ── */
.contacts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}
.contact-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 10px;
  transition: all var(--transition);
}
.contact-card:hover { border-color: rgba(255,255,255,0.12); transform: translateY(-2px); }
.contact-avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--accent-green-glow);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  border: 2px solid var(--border-active);
}
.contact-name { font-size: 14px; font-weight: 600; }
.contact-phone { font-size: 12px; color: var(--text-muted); }
.contact-badge {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 20px;
  background: rgba(139,92,246,0.12);
  color: var(--accent-purple);
}

/* ── Scheduled List ── */
.scheduled-list { display: flex; flex-direction: column; gap: 12px; }
.scheduled-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  display: flex;
  align-items: flex-start;
  gap: 16px;
  transition: border-color var(--transition);
}
.scheduled-item:hover { border-color: rgba(255,255,255,0.12); }
.scheduled-time {
  font-size: 13px;
  font-weight: 600;
  color: var(--accent-orange);
  white-space: nowrap;
  min-width: 120px;
}
.scheduled-body { flex: 1; }
.scheduled-chat { font-size: 12px; color: var(--text-muted); margin-bottom: 4px; }
.scheduled-message { font-size: 14px; }

/* ── Quick Replies ── */
.quick-replies-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}
.quick-reply-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  transition: all var(--transition);
}
.quick-reply-card:hover { border-color: rgba(255,255,255,0.12); }
.quick-reply-keyword {
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  background: rgba(37,211,102,0.12);
  color: var(--accent-green);
  padding: 3px 10px;
  border-radius: 20px;
  margin-bottom: 8px;
  font-family: 'Courier New', monospace;
}
.quick-reply-response { font-size: 14px; color: var(--text-secondary); margin-bottom: 12px; }
.quick-reply-footer { display: flex; justify-content: flex-end; }

/* ── Activity Feed ── */
.activity-feed { padding: 8px 0; max-height: 300px; overflow-y: auto; }
.activity-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 20px;
  font-size: 13px;
  border-bottom: 1px solid rgba(255,255,255,0.03);
}
.activity-icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  flex-shrink: 0;
  background: var(--bg-input);
}
.activity-text { flex: 1; color: var(--text-secondary); }
.activity-time { font-size: 11px; color: var(--text-muted); white-space: nowrap; }

/* ── Data Table ── */
.activity-table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th {
  text-align: left;
  padding: 12px 16px;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  border-bottom: 1px solid var(--border);
}
.data-table td {
  padding: 12px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  color: var(--text-secondary);
  vertical-align: top;
}
.data-table tr:hover td { background: rgba(255,255,255,0.02); }
.empty-cell { text-align: center; color: var(--text-muted); padding: 40px; }

/* ── Forms ── */
.form-group { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.form-label { font-size: 13px; font-weight: 600; color: var(--text-secondary); }
.form-input {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  color: var(--text-primary);
  font-size: 14px;
  transition: border-color var(--transition);
  width: 100%;
}
.form-input:focus { border-color: var(--accent-green); }
.form-hint { font-size: 12px; color: var(--text-muted); }

.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
}
.search-box svg { width: 16px; height: 16px; color: var(--text-muted); flex-shrink: 0; }
.search-box input {
  flex: 1;
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 14px;
}
.search-box input::placeholder { color: var(--text-muted); }

.select-input {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  color: var(--text-primary);
  font-size: 13px;
  cursor: pointer;
  width: 100%;
}
.select-input option { background: var(--bg-card); }

.view-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.view-toolbar .search-box { flex: 1; min-width: 200px; }

/* ── Modals ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition);
}
.modal-overlay.open { opacity: 1; pointer-events: all; }

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: 90%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  transform: translateY(20px) scale(0.97);
  transition: transform var(--transition-slow);
}
.modal-overlay.open .modal { transform: translateY(0) scale(1); }
.modal--center { max-width: 380px; }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border);
}
.modal-header h3 { font-size: 17px; font-weight: 700; }
.modal-close {
  color: var(--text-muted);
  font-size: 18px;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  transition: all var(--transition);
}
.modal-close:hover { background: rgba(255,255,255,0.08); color: var(--text-primary); }

.modal-body { padding: 20px 24px; }
.modal-footer {
  padding: 16px 24px 20px;
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  border-top: 1px solid var(--border);
}

/* ── QR Code ── */
.qr-container {
  margin: 20px auto;
  width: 240px;
  height: 240px;
  border-radius: var(--radius);
  overflow: hidden;
  border: 3px solid var(--border-active);
  display: flex;
  align-items: center;
  justify-content: center;
  background: white;
}
.qr-container img { width: 100%; height: 100%; object-fit: contain; }
.qr-loading { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.qr-loading p { font-size: 13px; color: var(--text-muted); }
.qr-status { font-size: 14px; font-weight: 600; padding: 8px; }
.qr-status.success { color: var(--accent-green); }
.qr-status.error { color: var(--accent-red); }

/* ── Spinner ── */
.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid rgba(37,211,102,0.2);
  border-top-color: var(--accent-green);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Toast ── */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 2000;
}
.toast {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 18px;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 280px;
  box-shadow: var(--shadow-lg);
  animation: slideIn 0.3s ease;
}
.toast.success { border-left: 4px solid var(--accent-green); }
.toast.error { border-left: 4px solid var(--accent-red); }
.toast.info { border-left: 4px solid var(--accent-blue); }
.toast.warning { border-left: 4px solid var(--accent-orange); }

@keyframes slideIn {
  from { opacity: 0; transform: translateX(100%); }
  to { opacity: 1; transform: translateX(0); }
}

/* ── Empty States ── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 40px 20px;
  color: var(--text-muted);
}
.empty-state span { font-size: 40px; }
.empty-state p { font-size: 14px; }
.empty-state.full { min-height: 300px; }

/* ── Chip/Tag ── */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 20px;
  font-weight: 600;
}

/* ── Responsive ── */
@media (max-width: 900px) {
  .dashboard-grid { grid-template-columns: 1fr; }
  .chat-layout { grid-template-columns: 1fr; }
  .chat-sidebar { display: none; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}
