/* ── Root & Typography ──────────────────────────────────────────────────── */
:root {
  --sidebar-width: 240px;
  --sidebar-bg: #ffffff;
  --sidebar-border: #e9ecef;
  --topbar-height: 60px;
  --primary: #3b6ff0;
  --primary-light: #eef1fd;
  --success: #22c55e;
  --warning: #f59e0b;
  --danger: #ef4444;
  --info: #06b6d4;
  --orange: #f97316;
  --body-bg: #f4f6fb;
  --card-bg: #ffffff;
  --text-main: #1e293b;
  --text-muted: #64748b;
  --border-color: #e2e8f0;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--body-bg);
  color: var(--text-main);
  font-size: 14px;
}

/* ── Sidebar ────────────────────────────────────────────────────────────── */
#sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--sidebar-border);
  z-index: 100;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sidebar-logo {
  height: var(--topbar-height);
  display: flex;
  align-items: center;
  padding: 0 20px;
  border-bottom: 1px solid var(--border-color);
  gap: 10px;
  flex-shrink: 0;
}

.sidebar-logo .logo-icon {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, var(--primary), #6366f1);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 16px;
}

.sidebar-logo .logo-text {
  font-weight: 700;
  font-size: 15px;
  color: var(--text-main);
  letter-spacing: -0.3px;
}

.sidebar-logo .logo-text span {
  color: var(--primary);
}

.sidebar-nav {
  flex: 1;
  padding: 16px 12px;
  overflow-y: auto;
}

.nav-section-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
  padding: 8px 8px 4px;
  margin-top: 8px;
}

.nav-item-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 8px;
  color: var(--text-muted);
  text-decoration: none;
  font-weight: 500;
  font-size: 13.5px;
  transition: all 0.15s;
  margin-bottom: 2px;
  position: relative;
}

.nav-item-link:hover {
  background: var(--body-bg);
  color: var(--text-main);
}

.nav-item-link.active {
  background: var(--primary-light);
  color: var(--primary);
}

.nav-item-link .nav-icon {
  width: 18px;
  text-align: center;
  font-size: 15px;
  flex-shrink: 0;
}

.nav-badge {
  margin-left: auto;
  background: var(--danger);
  color: white;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 10px;
  min-width: 18px;
  text-align: center;
}

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid var(--border-color);
  flex-shrink: 0;
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
}

.sidebar-user .avatar {
  width: 34px;
  height: 34px;
  background: linear-gradient(135deg, var(--primary), #6366f1);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
}

.sidebar-user .user-info {
  flex: 1;
  min-width: 0;
}

.sidebar-user .user-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user .user-role {
  font-size: 11px;
  color: var(--text-muted);
}

/* ── Main layout ────────────────────────────────────────────────────────── */
#main-content {
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  height: var(--topbar-height);
  background: var(--card-bg);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  padding: 0 28px;
  gap: 16px;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 50;
}

.topbar-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-main);
  flex: 1;
}

.page-body {
  flex: 1;
  padding: 28px;
}

/* ── Cards ──────────────────────────────────────────────────────────────── */
.card {
  border: 1px solid var(--border-color);
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
  background: var(--card-bg);
}

.card-header {
  background: transparent;
  border-bottom: 1px solid var(--border-color);
  padding: 16px 20px;
  font-weight: 600;
  font-size: 14px;
}

.card-body {
  padding: 20px;
}

/* ── Stat cards ─────────────────────────────────────────────────────────── */
.stat-card {
  border-radius: 12px;
  padding: 20px;
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
  transition: box-shadow 0.2s;
}

.stat-card:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.stat-card .stat-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  margin-bottom: 12px;
}

.stat-card .stat-value {
  font-size: 28px;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1;
  margin-bottom: 4px;
}

.stat-card .stat-label {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}

.stat-card .stat-sub {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 8px;
}

.bg-primary-soft { background: #eef1fd; }
.bg-success-soft { background: #dcfce7; }
.bg-warning-soft { background: #fef3c7; }
.bg-danger-soft  { background: #fee2e2; }
.bg-info-soft    { background: #cffafe; }
.text-primary-icon { color: var(--primary); }
.text-success-icon { color: var(--success); }
.text-warning-icon { color: var(--warning); }
.text-danger-icon  { color: var(--danger); }
.text-info-icon    { color: var(--info); }

/* ── Status badges ──────────────────────────────────────────────────────── */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.status-badge::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

.badge-active     { background: #dcfce7; color: #15803d; }
.badge-active::before { background: #22c55e; }

.badge-warmup     { background: #dbeafe; color: #1d4ed8; }
.badge-warmup::before { background: #3b82f6; animation: pulse-dot 1.5s infinite; }

.badge-flood_wait { background: #fef9c3; color: #a16207; }
.badge-flood_wait::before { background: #eab308; animation: pulse-dot 1s infinite; }

.badge-peer_flood { background: #ffedd5; color: #c2410c; }
.badge-peer_flood::before { background: #f97316; }

.badge-spam_block { background: #fee2e2; color: #b91c1c; }
.badge-spam_block::before { background: #ef4444; }

.badge-banned     { background: #f1f5f9; color: #475569; }
.badge-banned::before { background: #94a3b8; }

.badge-inactive   { background: #f1f5f9; color: #64748b; }
.badge-inactive::before { background: #cbd5e1; }

/* Campaign status */
.badge-running  { background: #dcfce7; color: #15803d; }
.badge-running::before { background: #22c55e; animation: pulse-dot 1.5s infinite; }
.badge-paused   { background: #fef9c3; color: #a16207; }
.badge-paused::before { background: #eab308; }
.badge-pending  { background: #f1f5f9; color: #64748b; }
.badge-pending::before { background: #cbd5e1; }
.badge-finished { background: #dbeafe; color: #1d4ed8; }
.badge-finished::before { background: #3b82f6; }

/* Lead status */
.badge-new        { background: #fee2e2; color: #b91c1c; }
.badge-new::before { background: #ef4444; animation: pulse-dot 1s infinite; }
.badge-in_progress { background: #dbeafe; color: #1d4ed8; }
.badge-in_progress::before { background: #3b82f6; }
.badge-closed     { background: #f1f5f9; color: #64748b; }
.badge-closed::before { background: #94a3b8; }

@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

/* ── Tables ─────────────────────────────────────────────────────────────── */
.table-panel {
  width: 100%;
  border-collapse: collapse;
}

.table-panel th {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  padding: 10px 16px;
  background: #f8fafc;
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
}

.table-panel td {
  padding: 13px 16px;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: middle;
  font-size: 13.5px;
}

.table-panel tr:last-child td {
  border-bottom: none;
}

.table-panel tbody tr:hover td {
  background: #fafbff;
}

/* ── Progress bars ──────────────────────────────────────────────────────── */
.progress-thin {
  height: 6px;
  border-radius: 3px;
  background: #f1f5f9;
}

.progress-thin .progress-bar {
  border-radius: 3px;
}

/* ── Buttons ────────────────────────────────────────────────────────────── */
.btn-primary {
  background: var(--primary);
  border-color: var(--primary);
  font-weight: 600;
  font-size: 13.5px;
  border-radius: 8px;
  padding: 8px 18px;
}

.btn-primary:hover {
  background: #2d5ce6;
  border-color: #2d5ce6;
}

.btn-outline-secondary {
  border-radius: 8px;
  font-size: 13.5px;
  font-weight: 500;
}

.btn-sm {
  padding: 5px 12px;
  font-size: 12px;
  border-radius: 6px;
}

.btn-icon {
  width: 30px;
  height: 30px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  font-size: 14px;
  border: 1px solid var(--border-color);
  background: white;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s;
}

.btn-icon:hover {
  background: var(--body-bg);
  color: var(--text-main);
}

/* ── Forms ──────────────────────────────────────────────────────────────── */
.form-control, .form-select {
  border-radius: 8px;
  border-color: var(--border-color);
  font-size: 13.5px;
  padding: 8px 12px;
}

.form-control:focus, .form-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(59, 111, 240, 0.12);
}

.form-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 6px;
}

textarea.form-control {
  resize: vertical;
}

/* ── Login page ─────────────────────────────────────────────────────────── */
.login-wrapper {
  min-height: 100vh;
  display: flex;
  background: var(--body-bg);
}

.login-left {
  flex: 1;
  background: linear-gradient(145deg, #3b6ff0 0%, #6366f1 50%, #8b5cf6 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 60px;
  position: relative;
  overflow: hidden;
}

.login-left::before {
  content: '';
  position: absolute;
  top: -40%;
  right: -20%;
  width: 500px;
  height: 500px;
  border-radius: 50%;
  background: rgba(255,255,255,0.06);
}

.login-left::after {
  content: '';
  position: absolute;
  bottom: -30%;
  left: -10%;
  width: 400px;
  height: 400px;
  border-radius: 50%;
  background: rgba(255,255,255,0.06);
}

.login-left-content {
  position: relative;
  z-index: 1;
  color: white;
  max-width: 380px;
}

.login-left-content .brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 48px;
}

.login-left-content .brand-icon {
  width: 44px;
  height: 44px;
  background: rgba(255,255,255,0.2);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
}

.login-left-content h1 {
  font-size: 32px;
  font-weight: 800;
  margin-bottom: 12px;
  line-height: 1.2;
}

.login-left-content p {
  font-size: 15px;
  opacity: 0.8;
  line-height: 1.6;
}

.login-feature {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 16px;
  font-size: 14px;
  opacity: 0.9;
}

.login-feature-icon {
  width: 28px;
  height: 28px;
  background: rgba(255,255,255,0.15);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
}

.login-right {
  width: 480px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 60px 60px;
  background: white;
}

.login-form-wrap {
  width: 100%;
  max-width: 340px;
}

.login-form-wrap h2 {
  font-size: 24px;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 6px;
}

.login-form-wrap .subtitle {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 32px;
}

/* ── Leads chat ─────────────────────────────────────────────────────────── */
.leads-layout {
  display: flex;
  height: calc(100vh - var(--topbar-height) - 56px);
  gap: 0;
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  overflow: hidden;
}

.leads-list {
  width: 300px;
  flex-shrink: 0;
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.leads-list-header {
  padding: 16px;
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
}

.leads-list-header h6 {
  font-weight: 700;
  margin: 0 0 10px;
  font-size: 14px;
}

.leads-scroll {
  flex: 1;
  overflow-y: auto;
}

.lead-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  cursor: pointer;
  transition: background 0.15s;
  text-decoration: none;
  border-bottom: 1px solid #f8fafc;
}

.lead-item:hover { background: var(--body-bg); }
.lead-item.active { background: var(--primary-light); }

.lead-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), #6366f1);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 700;
  font-size: 14px;
  flex-shrink: 0;
  position: relative;
}

.lead-avatar .unread-dot {
  position: absolute;
  top: -1px;
  right: -1px;
  width: 14px;
  height: 14px;
  background: var(--danger);
  border-radius: 50%;
  border: 2px solid white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 8px;
  color: white;
  font-weight: 700;
}

.lead-info { flex: 1; min-width: 0; }

.lead-name {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lead-preview {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}

.lead-meta {
  text-align: right;
  flex-shrink: 0;
}

.lead-time {
  font-size: 11px;
  color: var(--text-muted);
}

.lead-unread {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  background: var(--danger);
  border-radius: 50%;
  color: white;
  font-size: 10px;
  font-weight: 700;
  margin-top: 4px;
}

/* ── Chat panel ─────────────────────────────────────────────────────────── */
.chat-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.chat-header {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.chat-header-info { flex: 1; }

.chat-header-name {
  font-size: 14px;
  font-weight: 700;
}

.chat-header-sub {
  font-size: 12px;
  color: var(--text-muted);
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  background: #f8fafc;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.message-bubble {
  max-width: 68%;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 13.5px;
  line-height: 1.5;
  position: relative;
}

.message-bubble.outgoing {
  background: var(--primary);
  color: white;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}

.message-bubble.incoming {
  background: white;
  color: var(--text-main);
  align-self: flex-start;
  border-bottom-left-radius: 4px;
  border: 1px solid var(--border-color);
}

.message-time {
  font-size: 10px;
  opacity: 0.65;
  margin-top: 4px;
  text-align: right;
}

.chat-input-area {
  padding: 14px 16px;
  border-top: 1px solid var(--border-color);
  background: white;
  flex-shrink: 0;
}

.chat-input-row {
  display: flex;
  gap: 10px;
  align-items: flex-end;
}

.chat-input-row textarea {
  flex: 1;
  resize: none;
  border-radius: 10px;
  border: 1px solid var(--border-color);
  padding: 10px 14px;
  font-size: 13.5px;
  max-height: 120px;
  min-height: 42px;
  font-family: inherit;
}

.chat-input-row textarea:focus {
  border-color: var(--primary);
  outline: none;
  box-shadow: 0 0 0 3px rgba(59, 111, 240, 0.1);
}

.btn-send {
  width: 42px;
  height: 42px;
  background: var(--primary);
  border: none;
  border-radius: 10px;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s;
}

.btn-send:hover { background: #2d5ce6; }

/* ── Campaign cards ─────────────────────────────────────────────────────── */
.campaign-card {
  border: 1px solid var(--border-color);
  border-radius: 12px;
  background: white;
  padding: 20px;
  transition: box-shadow 0.2s;
}

.campaign-card:hover {
  box-shadow: 0 4px 16px rgba(0,0,0,0.08);
}

.campaign-card .campaign-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 8px;
}

.campaign-stats {
  display: flex;
  gap: 20px;
  margin: 14px 0;
}

.campaign-stats .stat {
  text-align: center;
}

.campaign-stats .stat-num {
  font-size: 20px;
  font-weight: 800;
  color: var(--text-main);
}

.campaign-stats .stat-lbl {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 500;
}

/* ── Account add tabs ───────────────────────────────────────────────────── */
.add-method-tabs {
  display: flex;
  gap: 0;
  border: 1px solid var(--border-color);
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 24px;
}

.add-method-tab {
  flex: 1;
  padding: 14px;
  text-align: center;
  cursor: pointer;
  border: none;
  background: white;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-muted);
  transition: all 0.15s;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.add-method-tab:first-child {
  border-right: 1px solid var(--border-color);
}

.add-method-tab.active {
  background: var(--primary-light);
  color: var(--primary);
}

.add-method-tab .tab-icon {
  font-size: 22px;
}

/* ── Upload zone ─────────────────────────────────────────────────────────── */
.upload-zone {
  border: 2px dashed var(--border-color);
  border-radius: 12px;
  padding: 40px 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.15s;
  background: #fafbff;
}

.upload-zone:hover, .upload-zone.drag-over {
  border-color: var(--primary);
  background: var(--primary-light);
}

.upload-zone .upload-icon {
  font-size: 40px;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.upload-zone p {
  font-size: 14px;
  color: var(--text-muted);
  margin: 0;
}

.upload-zone span {
  color: var(--primary);
  font-weight: 600;
}

/* ── Scrollbar ──────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* ── Misc ───────────────────────────────────────────────────────────────── */
.text-muted-sm { font-size: 12px; color: var(--text-muted); }
.fw-600 { font-weight: 600; }
.gap-2 { gap: 8px; }
.rounded-10 { border-radius: 10px; }

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.empty-state .empty-icon {
  font-size: 48px;
  margin-bottom: 12px;
  opacity: 0.4;
}

.empty-state p {
  font-size: 14px;
}

.account-phone-tag {
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 12.5px;
  background: #f1f5f9;
  padding: 2px 8px;
  border-radius: 4px;
  color: var(--text-main);
}

.spintax-hint {
  background: #f8fafc;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 12px 14px;
  font-size: 12.5px;
  color: var(--text-muted);
}

.spintax-hint code {
  background: var(--primary-light);
  color: var(--primary);
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 12px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   MOBILE & RESPONSIVE
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Hamburger button (visible only on mobile) ──────────────────────────── */
.hamburger-btn {
  display: none;
  width: 36px;
  height: 36px;
  border: 1px solid var(--border-color);
  background: white;
  border-radius: 8px;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 18px;
  color: var(--text-main);
  flex-shrink: 0;
}

/* ── Sidebar overlay (mobile backdrop) ──────────────────────────────────── */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 99;
  opacity: 0;
  transition: opacity 0.25s;
}
.sidebar-overlay.active {
  opacity: 1;
}

/* ── Bottom nav bar (mobile only) ───────────────────────────────────────── */
.bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 58px;
  background: white;
  border-top: 1px solid var(--border-color);
  z-index: 98;
  padding: 0 4px;
  align-items: center;
  justify-content: space-around;
}

.bottom-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 12px;
  border-radius: 10px;
  text-decoration: none;
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 600;
  transition: all 0.15s;
  min-width: 52px;
  position: relative;
}

.bottom-nav-item i {
  font-size: 20px;
}

.bottom-nav-item.active {
  color: var(--primary);
}

.bottom-nav-item .bnav-badge {
  position: absolute;
  top: 3px;
  right: 10px;
  width: 16px;
  height: 16px;
  background: var(--danger);
  color: white;
  font-size: 9px;
  font-weight: 700;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid white;
}

/* ── Mobile leads: fullscreen chat ──────────────────────────────────────── */
.mobile-back-btn {
  display: none;
}

/* ── Breakpoint: tablet ─────────────────────────────────────────────────── */
@media (max-width: 991px) {
  /* Sidebar becomes a drawer */
  #sidebar {
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    z-index: 100;
  }
  #sidebar.open {
    transform: translateX(0);
    box-shadow: 4px 0 24px rgba(0,0,0,0.15);
  }

  /* Main content takes full width */
  #main-content {
    margin-left: 0;
  }

  /* Show hamburger */
  .hamburger-btn {
    display: flex;
  }

  /* Show overlay when sidebar open */
  .sidebar-overlay {
    display: block;
    pointer-events: none;
  }
  .sidebar-overlay.active {
    pointer-events: auto;
  }

  /* Page body padding adjustments */
  .page-body {
    padding: 16px;
  }

  /* Topbar */
  .topbar {
    padding: 0 16px;
    gap: 10px;
  }

  .topbar-title {
    font-size: 14px;
  }

  /* Stat cards: 2 per row */
  .stat-card {
    padding: 14px;
  }
  .stat-card .stat-value {
    font-size: 22px;
  }
}

/* ── Breakpoint: mobile ─────────────────────────────────────────────────── */
@media (max-width: 767px) {
  /* Show bottom nav, hide desktop sidebar nav section labels */
  .bottom-nav { display: flex; }

  /* Extra bottom padding for bottom nav */
  .page-body { padding-bottom: 74px; }

  /* Tables: horizontal scroll */
  .card .card-body:has(.table-panel) {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .table-panel {
    min-width: 600px;
  }

  /* Campaign cards */
  .campaign-card {
    padding: 14px;
  }
  .campaign-stats {
    gap: 12px;
    flex-wrap: wrap;
  }
  .campaign-stats .stat-num {
    font-size: 16px;
  }

  /* Topbar actions: wrap or hide label text */
  .topbar .btn span { display: none; }
  .topbar .btn i { margin: 0 !important; }

  /* Login: single column */
  .login-left { display: none !important; }
  .login-right {
    width: 100%;
    padding: 32px 24px;
    min-height: 100vh;
    align-items: flex-start;
    padding-top: 60px;
  }
  .login-form-wrap {
    max-width: 100%;
  }

  /* Leads layout: single column, full screen chat */
  .leads-layout {
    height: calc(100vh - 60px - 58px);
    flex-direction: column;
  }

  .leads-list {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--border-color);
    max-height: calc(100vh - 60px - 58px);
  }

  /* When chat is open on mobile: hide list, show chat fullscreen */
  .leads-layout.chat-open .leads-list {
    display: none;
  }
  .leads-layout.chat-open .chat-panel {
    display: flex;
    height: 100%;
  }

  /* Mobile back button in chat header */
  .mobile-back-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: white;
    cursor: pointer;
    font-size: 16px;
    color: var(--text-main);
    flex-shrink: 0;
    margin-right: 4px;
  }

  /* Admin user table: stack on mobile */
  #users-table th:nth-child(n+4),
  #users-table td:nth-child(n+4) {
    display: none;
  }

  /* Accounts table: show only key columns */
  .table-panel th:nth-child(n+5),
  .table-panel td:nth-child(n+5) {
    display: none;
  }

  /* Forms */
  .row.g-4 > .col-lg-5,
  .row.g-4 > .col-lg-7 {
    margin-bottom: 0;
  }

  /* Remove sticky preview on mobile */
  .col-lg-5 .card[style*="sticky"] {
    position: static !important;
  }

  /* Stat cards: 2 per row forced */
  .col-xl-3 { flex: 0 0 50%; max-width: 50%; }

  /* Page body */
  .page-body { padding: 12px 12px 74px; }

  /* Topbar title truncate */
  .topbar-title {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 160px;
  }
}

/* ── Extra small: 360px phones ──────────────────────────────────────────── */
@media (max-width: 400px) {
  .topbar { padding: 0 10px; gap: 8px; }
  .page-body { padding: 10px 10px 74px; }
  .stat-card .stat-value { font-size: 20px; }
  .col-xl-3 { flex: 0 0 50%; max-width: 50%; }
}
