:root {
  /* Backgrounds */
  --bg-deep: #0a0e1a;
  --bg-primary: #0a0e1a;
  --bg-surface: #0f1421;
  --bg-secondary: #0f1421;
  --bg-card: #0f1421;
  --bg-raised: #1a2032;
  --bg-hover: #1a2032;
  --bg-input: #131826;
  --bg-tertiary: #131826;

  /* Borders */
  --border: rgba(255, 255, 255, 0.08);
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-hover: rgba(168, 85, 247, 0.4);
  --border-strong: rgba(255, 255, 255, 0.15);

  /* Text */
  --text-primary: #f8fafc;
  --text: #f8fafc;
  --text-secondary: #cbd5e1;
  --text-muted: #64748b;
  --text-disabled: #475569;

  /* Accents */
  --accent: #a855f7;
  --accent-hover: #9333ea;
  --accent-2: #ec4899;
  --accent-cyan: #06b6d4;
  --purple: #a855f7;

  /* Gradients */
  --gradient-primary: linear-gradient(135deg, #a855f7 0%, #ec4899 100%);
  --gradient-cyan: linear-gradient(135deg, #06b6d4 0%, #3b82f6 100%);
  --gradient-success: linear-gradient(135deg, #22c55e 0%, #10b981 100%);
  --gradient-warm: linear-gradient(135deg, #f59e0b 0%, #ef4444 100%);
  --gradient-cool: linear-gradient(135deg, #6366f1 0%, #06b6d4 100%);

  /* Status */
  --success: #22c55e;
  --green: #22c55e;
  --green-bg: rgba(34, 197, 94, 0.12);
  --warning: #f59e0b;
  --yellow: #f59e0b;
  --yellow-bg: rgba(245, 158, 11, 0.12);
  --danger: #f43f5e;
  --red: #f43f5e;
  --red-bg: rgba(244, 63, 94, 0.12);
  --info: #06b6d4;
  --orange: #f97316;

  /* WhatsApp brand */
  --whatsapp: #25d366;
  --whatsapp-hover: #128c7e;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 12px 48px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 40px rgba(168, 85, 247, 0.25);
  --shadow-glow-cyan: 0 0 40px rgba(6, 182, 212, 0.25);
  --shadow-glow-success: 0 0 40px rgba(34, 197, 94, 0.25);
  --shadow-glow-warm: 0 0 40px rgba(245, 158, 11, 0.3);
  --shadow-glow-danger: 0 0 30px rgba(244, 63, 94, 0.35);

  /* Radius */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-pill: 999px;

  /* Transitions */
  --transition: 200ms cubic-bezier(0.4, 0, 0.2, 1);

  /* Sidebar */
  --sidebar-width: 260px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body { background: var(--bg-deep); }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background:
    radial-gradient(ellipse 90% 60% at 15% 0%, rgba(168, 85, 247, 0.08), transparent 60%),
    radial-gradient(ellipse 80% 50% at 85% 100%, rgba(236, 72, 153, 0.06), transparent 60%),
    var(--bg-deep);
  background-attachment: fixed;
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  font-feature-settings: "cv02", "cv03", "cv04", "cv11";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ====== Utility classes ====== */
.gradient-text {
  background: var(--gradient-primary);
  background-clip: text;
  -webkit-background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
}
.gradient-text-cyan {
  background: var(--gradient-cyan);
  background-clip: text;
  -webkit-background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
}
.gradient-text-success {
  background: var(--gradient-success);
  background-clip: text;
  -webkit-background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
}
.gradient-text-warm {
  background: var(--gradient-warm);
  background-clip: text;
  -webkit-background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
}

.glass {
  background: rgba(15, 20, 33, 0.7);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-subtle);
}

.muted { color: var(--text-muted); }
.small { font-size: 12px; }

/* ====== Animations ====== */
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}
@keyframes pulse-glow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(168, 85, 247, 0.45); }
  50% { box-shadow: 0 0 0 8px rgba(168, 85, 247, 0); }
}
@keyframes shimmer {
  0% { background-position: -1000px 0; }
  100% { background-position: 1000px 0; }
}
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}
@keyframes ai-spin {
  to { transform: rotate(360deg); }
}
@keyframes blob-float {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(40px, -30px) scale(1.05); }
  66% { transform: translate(-30px, 30px) scale(0.95); }
}
@keyframes campaignPulse {
  0%, 100% { border-color: rgba(168, 85, 247, 0.4); box-shadow: 0 0 24px rgba(168, 85, 247, 0.15); }
  50% { border-color: rgba(236, 72, 153, 0.55); box-shadow: 0 0 36px rgba(236, 72, 153, 0.25); }
}

/* Skeleton shimmer */
.skeleton {
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.04) 0%,
    rgba(255, 255, 255, 0.10) 50%,
    rgba(255, 255, 255, 0.04) 100%
  );
  background-size: 1000px 100%;
  animation: shimmer 1.6s linear infinite;
  border-radius: var(--radius-md);
}
.skeleton.text { height: 14px; margin: 6px 0; }
.skeleton.title { height: 22px; width: 60%; margin: 8px 0; }
.skeleton.card { height: 80px; width: 100%; }

/* ====== Layout ====== */
.app { display: flex; min-height: 100vh; }

/* ====== Sidebar ====== */
.sidebar {
  width: var(--sidebar-width);
  background: linear-gradient(180deg, rgba(15, 20, 33, 0.92), rgba(10, 14, 26, 0.92));
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  z-index: 100;
}
.sidebar-header {
  padding: 22px 20px 18px;
  border-bottom: 1px solid var(--border-subtle);
}
.sidebar-header h1 {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.025em;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 10px;
}
.sidebar-header h1 svg {
  background: var(--gradient-primary);
  padding: 5px;
  border-radius: 8px;
  color: white;
  width: 28px;
  height: 28px;
  box-shadow: var(--shadow-glow);
}
.sidebar-header .subtitle {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 6px;
  letter-spacing: 0.02em;
}
.sidebar-nav { flex: 1; padding: 14px 12px; overflow-y: auto; }
.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 3px;
}
.nav-item svg {
  flex-shrink: 0;
  transition: transform var(--transition);
}
.nav-item:hover {
  background: rgba(168, 85, 247, 0.08);
  color: var(--text-primary);
}
.nav-item:hover svg { transform: scale(1.1); }
.nav-item.active {
  background: linear-gradient(135deg, rgba(168, 85, 247, 0.18), rgba(236, 72, 153, 0.10));
  color: var(--text-primary);
  font-weight: 600;
}
.nav-item.active::before {
  content: '';
  position: absolute;
  left: -12px;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 22px;
  background: var(--gradient-primary);
  border-radius: 0 3px 3px 0;
  box-shadow: 0 0 12px rgba(168, 85, 247, 0.6);
}
.nav-item .badge {
  margin-left: auto;
  background: var(--gradient-primary);
  color: white;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  font-weight: 600;
  box-shadow: 0 2px 6px rgba(168, 85, 247, 0.35);
}
.sidebar-footer {
  padding: 14px;
  border-top: 1px solid var(--border-subtle);
}
.wa-status {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  border-radius: var(--radius-md);
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  font-size: 13px;
  color: var(--text-secondary);
}
.wa-status .dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--danger);
  box-shadow: 0 0 0 3px rgba(244, 63, 94, 0.15);
}
.wa-status .dot.connected {
  background: var(--whatsapp);
  box-shadow: 0 0 0 3px rgba(37, 211, 102, 0.2), 0 0 12px rgba(37, 211, 102, 0.4);
}
.wa-status .dot.connecting {
  background: var(--warning);
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.2);
  animation: pulse 1s infinite;
}

/* ====== Main content ====== */
.main {
  margin-left: var(--sidebar-width);
  flex: 1;
  min-width: 0;
  padding: 28px;
  min-height: 100vh;
}
.page { display: none; animation: fadeInUp 300ms cubic-bezier(0.4, 0, 0.2, 1); }
.page.active { display: block; }

/* ====== Header ====== */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
  flex-wrap: wrap;
  gap: 12px;
}
.page-header h2 {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.025em;
}
.page-header .btn-group { flex-wrap: wrap; }

/* ====== Stats cards ====== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 18px;
  margin-bottom: 24px;
}
.stat-card {
  position: relative;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 24px;
  transition: all var(--transition);
  overflow: hidden;
}
.stat-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(168, 85, 247, 0.04), transparent 70%);
  opacity: 0;
  transition: opacity var(--transition);
  pointer-events: none;
}
.stat-card:hover {
  border-color: var(--border-hover);
  box-shadow: var(--shadow-glow);
  transform: translateY(-2px);
}
.stat-card:hover::before { opacity: 1; }
.stat-card .label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
}
.stat-card .value {
  font-size: 36px;
  font-weight: 700;
  margin-top: 8px;
  letter-spacing: -0.03em;
  line-height: 1.05;
  color: var(--text-primary);
}
.stat-card .sub {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 6px;
}
.stat-card.accent .value {
  background: var(--gradient-primary);
  background-clip: text;
  -webkit-background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
}
.stat-card.green .value {
  background: var(--gradient-success);
  background-clip: text;
  -webkit-background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
}
.stat-card.yellow .value {
  background: var(--gradient-warm);
  background-clip: text;
  -webkit-background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
}
.stat-card.whatsapp .value {
  background: linear-gradient(135deg, #25d366, #128c7e);
  background-clip: text;
  -webkit-background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
}

/* ====== Buttons ====== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  background: transparent;
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
  letter-spacing: -0.005em;
  white-space: nowrap;
}
.btn:hover {
  background: rgba(168, 85, 247, 0.10);
  border-color: var(--border-hover);
  color: var(--text-primary);
}
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn:disabled:hover { background: transparent; transform: none; }

.btn-primary {
  background: var(--gradient-primary);
  border-color: transparent;
  color: white;
  box-shadow: var(--shadow-md);
  font-weight: 600;
}
.btn-primary:hover {
  background: var(--gradient-primary);
  border-color: transparent;
  color: white;
  transform: translateY(-1px);
  box-shadow: var(--shadow-glow);
}

.btn-success {
  background: var(--gradient-success);
  border-color: transparent;
  color: white;
  box-shadow: var(--shadow-md);
  font-weight: 600;
}
.btn-success:hover {
  background: var(--gradient-success);
  border-color: transparent;
  color: white;
  transform: translateY(-1px);
  box-shadow: var(--shadow-glow-success);
}

.btn-danger {
  background: var(--danger);
  border-color: transparent;
  color: white;
  font-weight: 600;
}
.btn-danger:hover {
  background: #dc2638;
  border-color: transparent;
  color: white;
  transform: translateY(-1px);
  box-shadow: var(--shadow-glow-danger);
}

.btn-sm { padding: 6px 12px; font-size: 12px; border-radius: 8px; }
.btn-lg { padding: 14px 24px; font-size: 15px; }
.btn-group { display: flex; gap: 8px; }

/* ====== Filters bar ====== */
.filters-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.search-input {
  flex: 1;
  min-width: 200px;
  padding: 11px 14px 11px 38px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 13px;
  font-family: inherit;
  outline: none;
  transition: all var(--transition);
}
.search-input::placeholder { color: var(--text-muted); }
.search-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(168, 85, 247, 0.15);
  background: var(--bg-raised);
}
.search-wrapper { position: relative; flex: 1; min-width: 200px; }
.search-wrapper svg {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  color: var(--text-muted); width: 16px; height: 16px;
  pointer-events: none;
}
select {
  padding: 10px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 13px;
  font-family: inherit;
  outline: none;
  cursor: pointer;
  transition: all var(--transition);
}
select:hover { border-color: var(--border-strong); }
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(168, 85, 247, 0.15);
}

/* ====== Table ====== */
.table-container {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
  overflow-x: auto;
}
table { width: 100%; min-width: 1050px; border-collapse: collapse; }
thead {
  background: var(--bg-raised);
  position: sticky;
  top: 0;
  z-index: 5;
}
th {
  padding: 14px 18px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  border-bottom: 1px solid var(--border-subtle);
}
td {
  padding: 14px 18px;
  font-size: 13px;
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: middle;
  color: var(--text-secondary);
}
tbody tr { transition: background var(--transition); }
tbody tr:hover { background: rgba(168, 85, 247, 0.05); }
tr:last-child td { border-bottom: none; }

/* ====== Status badges ====== */
.status-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  font-size: 11px;
  font-weight: 500;
  text-transform: capitalize;
  letter-spacing: 0.01em;
}
.status-new { background: rgba(6, 182, 212, 0.15); color: var(--accent-cyan); border: 1px solid rgba(6, 182, 212, 0.3); }
.status-to_contact { background: rgba(168, 85, 247, 0.15); color: var(--accent); border: 1px solid rgba(168, 85, 247, 0.3); }
.status-message_sent { background: rgba(168, 85, 247, 0.18); color: #c084fc; border: 1px solid rgba(168, 85, 247, 0.35); }
.status-replied { background: rgba(34, 197, 94, 0.15); color: var(--success); border: 1px solid rgba(34, 197, 94, 0.3); }
.status-interested { background: var(--gradient-warm); color: white; border: none; box-shadow: 0 0 16px rgba(245, 158, 11, 0.25); }
.status-not_interested { background: rgba(244, 63, 94, 0.12); color: var(--danger); border: 1px solid rgba(244, 63, 94, 0.25); }
.status-converted { background: var(--gradient-success); color: white; border: none; box-shadow: 0 0 16px rgba(34, 197, 94, 0.25); }
.status-blocked { background: rgba(100, 116, 139, 0.15); color: var(--text-muted); border: 1px solid rgba(100, 116, 139, 0.25); }

.source-badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: var(--radius-sm);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.source-safti { background: rgba(244, 63, 94, 0.15); color: #f87171; border: 1px solid rgba(244, 63, 94, 0.3); }
.source-iad { background: rgba(59, 130, 246, 0.15); color: #60a5fa; border: 1px solid rgba(59, 130, 246, 0.3); }
.source-manual { background: rgba(168, 85, 247, 0.15); color: var(--accent); border: 1px solid rgba(168, 85, 247, 0.3); }

/* Status select inside table */
.status-select {
  padding: 4px 10px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 11px;
  cursor: pointer;
}

/* ====== Campaign Banner ====== */
.campaign-banner {
  background: linear-gradient(135deg, rgba(168, 85, 247, 0.15), rgba(236, 72, 153, 0.12));
  border: 1px solid rgba(168, 85, 247, 0.4);
  border-radius: var(--radius-lg);
  padding: 14px 22px;
  margin: 0 0 18px 0;
  animation: campaignPulse 2.5s ease-in-out infinite;
}
.campaign-banner-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.campaign-banner-info {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-primary);
  font-weight: 600;
  font-size: 14px;
}
.campaign-banner-info svg { color: var(--accent); }
.campaign-banner-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}
.campaign-banner-progress {
  color: var(--text-secondary);
  font-size: 13px;
}

/* ====== Lead name cell ====== */
.lead-name {
  display: flex;
  align-items: center;
  gap: 12px;
}
.lead-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--gradient-primary);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 600; color: white;
  overflow: hidden;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(168, 85, 247, 0.25);
}
.lead-avatar img { width: 100%; height: 100%; object-fit: cover; }
.lead-info .name { font-weight: 500; color: var(--text-primary); }
.lead-info .location { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

/* ====== Pagination ====== */
.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px;
  background: var(--bg-raised);
  border-top: 1px solid var(--border-subtle);
}
.pagination-info { font-size: 13px; color: var(--text-secondary); }
.pagination-btns { display: flex; gap: 4px; }
.page-btn {
  width: 34px; height: 34px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  background: transparent;
  color: var(--text-secondary);
  font-size: 13px;
  cursor: pointer;
  transition: all var(--transition);
}
.page-btn:hover {
  background: rgba(168, 85, 247, 0.1);
  border-color: var(--border-hover);
  color: var(--text-primary);
}
.page-btn.active {
  background: var(--gradient-primary);
  color: white;
  border-color: transparent;
  box-shadow: var(--shadow-glow);
}
.page-btn:disabled { opacity: 0.3; cursor: not-allowed; }
.page-btn:disabled:hover { background: transparent; border-color: var(--border-subtle); color: var(--text-secondary); }

/* ====== Modal ====== */
.modal-overlay {
  display: none;
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 200;
  align-items: center;
  justify-content: center;
  animation: fadeInUp 200ms ease-out;
}
.modal-overlay.active { display: flex; }
.modal {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  width: 90%;
  max-width: 600px;
  max-height: 85vh;
  overflow-y: auto;
  padding: 28px;
  box-shadow: var(--shadow-lg), var(--shadow-glow);
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 22px;
}
.modal-header h3 {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.modal-close {
  width: 34px; height: 34px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 18px;
  transition: all var(--transition);
}
.modal-close:hover {
  background: rgba(244, 63, 94, 0.12);
  border-color: rgba(244, 63, 94, 0.3);
  color: var(--danger);
}

/* ====== Form ====== */
.form-group { margin-bottom: 16px; }
.form-group label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 11px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 13px;
  font-family: inherit;
  outline: none;
  transition: all var(--transition);
}
.form-group input::placeholder,
.form-group textarea::placeholder { color: var(--text-muted); }
.form-group textarea { min-height: 120px; resize: vertical; line-height: 1.5; }
.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(168, 85, 247, 0.15);
  background: var(--bg-raised);
}

/* ====== Lead detail panel ====== */
.lead-detail-panel {
  position: fixed;
  top: 0; right: -480px;
  width: 480px; height: 100vh;
  background: var(--bg-surface);
  border-left: 1px solid var(--border-subtle);
  z-index: 150;
  transition: right 320ms cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
}
.lead-detail-panel.open { right: 0; }
.panel-header {
  padding: 22px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-raised);
}
.panel-body { flex: 1; overflow-y: auto; padding: 22px; display: flex; flex-direction: column; }
.detail-section { margin-bottom: 22px; }
.detail-section h4 {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
  margin-bottom: 12px;
}
.detail-row {
  display: flex;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 13px;
}
.detail-row:last-child { border-bottom: none; }
.detail-row .label { color: var(--text-muted); }
.detail-row .value { color: var(--text-primary); font-weight: 500; text-align: right; }

/* ====== Chat (WhatsApp-style) ====== */
.chat-container {
  background: #0b141a;
  background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M30 5 L35 15 L30 12 L25 15Z' fill='%23ffffff' opacity='0.02'/%3E%3Ccircle cx='10' cy='40' r='1.5' fill='%23ffffff' opacity='0.03'/%3E%3Ccircle cx='50' cy='30' r='1' fill='%23ffffff' opacity='0.02'/%3E%3C/svg%3E");
  border-radius: var(--radius-md);
  padding: 16px 12px;
  flex: 1;
  min-height: 250px;
  max-height: 50vh;
  overflow-y: auto;
  margin-bottom: 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  scroll-behavior: smooth;
  border: 1px solid var(--border-subtle);
}
.chat-date-separator {
  text-align: center;
  margin: 12px 0 8px;
  font-size: 11px;
  color: var(--text-muted);
}
.chat-date-separator span {
  background: rgba(255,255,255,0.08);
  padding: 4px 12px;
  border-radius: var(--radius-sm);
}
.chat-message {
  max-width: 80%;
  padding: 7px 11px 5px;
  border-radius: 8px;
  margin-bottom: 2px;
  font-size: 13px;
  line-height: 1.45;
  position: relative;
  word-wrap: break-word;
  white-space: pre-wrap;
}
.chat-message.outgoing {
  background: #005c4b;
  color: #e9edef;
  margin-left: auto;
  border-top-right-radius: 0;
}
.chat-message.outgoing:first-of-type,
.chat-message.outgoing + .chat-message.incoming + .chat-message.outgoing {
  border-top-right-radius: 8px;
}
.chat-message.incoming {
  background: #202c33;
  color: #e9edef;
  border-top-left-radius: 0;
}
.chat-message.incoming:first-of-type,
.chat-message.incoming + .chat-message.outgoing + .chat-message.incoming {
  border-top-left-radius: 8px;
}
.chat-message .time {
  font-size: 10px;
  color: rgba(255,255,255,0.45);
  margin-top: 2px;
  text-align: right;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 4px;
}
.chat-message .time .status-icon { font-size: 12px; }
.chat-message .time .status-sent { color: rgba(255,255,255,0.45); }
.chat-message .time .status-delivered { color: rgba(255,255,255,0.45); }
.chat-message .time .status-read { color: #53bdeb; }
.chat-message .time .status-pending { color: var(--warning); }
.chat-message .time .status-failed { color: var(--danger); }
.chat-message .retry-btn {
  background: none; border: none; color: #53bdeb; cursor: pointer;
  font-size: 11px; text-decoration: underline; padding: 0; margin-left: 4px;
}
.chat-empty {
  text-align: center; color: var(--text-muted); font-size: 13px;
  margin: auto; padding: 40px 20px;
}
.chat-empty svg { width: 48px; height: 48px; margin-bottom: 12px; opacity: 0.3; }
.chat-input-area {
  display: flex;
  gap: 8px;
  align-items: flex-end;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 8px;
}
.chat-input-area textarea {
  flex: 1;
  padding: 9px 14px;
  background: var(--bg-raised);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-pill);
  color: var(--text-primary);
  font-size: 13px;
  resize: none;
  min-height: 38px;
  max-height: 100px;
  font-family: inherit;
  outline: none;
  line-height: 1.4;
  transition: all var(--transition);
}
.chat-input-area textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(168, 85, 247, 0.15);
}
.chat-input-area .btn-send {
  width: 38px; height: 38px;
  border-radius: 50%;
  background: var(--gradient-success);
  border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: all var(--transition);
  box-shadow: 0 2px 8px rgba(34, 197, 94, 0.3);
}
.chat-input-area .btn-send:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-glow-success);
}
.chat-input-area .btn-send svg { width: 18px; height: 18px; fill: white; }

/* ====== Scraper ====== */
.scraper-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 18px;
  transition: all var(--transition);
}
.scraper-card:hover {
  border-color: var(--border-hover);
  box-shadow: var(--shadow-glow);
  transform: translateY(-2px);
}
.scraper-card h3 {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.015em;
}
.progress-bar {
  width: 100%;
  height: 8px;
  background: var(--bg-input);
  border-radius: var(--radius-pill);
  overflow: hidden;
  margin-top: 14px;
}
.progress-bar .fill {
  height: 100%;
  background: var(--gradient-primary);
  border-radius: var(--radius-pill);
  transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 0 12px rgba(168, 85, 247, 0.5);
}

/* ====== WhatsApp page ====== */
.qr-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 40px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
}
.qr-container h3 { font-size: 18px; font-weight: 600; letter-spacing: -0.015em; }
.qr-container canvas,
.qr-container img {
  border-radius: var(--radius-md);
  margin: 20px 0;
}
.qr-instructions {
  text-align: center;
  max-width: 400px;
}
.qr-instructions p { font-size: 14px; color: var(--text-secondary); margin-bottom: 8px; }
.qr-instructions ol { text-align: left; font-size: 13px; color: var(--text-secondary); padding-left: 20px; }
.qr-instructions li { margin-bottom: 6px; }

/* ====== Templates ====== */
.template-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  margin-bottom: 12px;
  cursor: pointer;
  transition: all var(--transition);
}
.template-card:hover {
  border-color: var(--border-hover);
  box-shadow: var(--shadow-glow);
  transform: translateY(-2px);
}
.template-card.selected {
  border-color: var(--accent);
  background: linear-gradient(135deg, rgba(168, 85, 247, 0.06), transparent);
}
.template-card .name { font-weight: 600; margin-bottom: 4px; color: var(--text-primary); }
.template-card .category { font-size: 11px; color: var(--text-muted); margin-bottom: 8px; text-transform: uppercase; letter-spacing: 0.05em; }
.template-card .preview { font-size: 12px; color: var(--text-secondary); line-height: 1.5; white-space: pre-wrap; }

/* ====== Checkbox ====== */
.checkbox-cell { width: 40px; text-align: center; }
input[type="checkbox"] {
  width: 16px; height: 16px; cursor: pointer;
  accent-color: var(--accent);
}

/* ====== Toast ====== */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.toast {
  padding: 14px 22px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 500;
  animation: slideIn 0.3s ease;
  min-width: 280px;
  max-width: 380px;
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(15, 20, 33, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
  border-left-width: 3px;
  box-shadow: var(--shadow-lg);
}
.toast.success { border-left-color: var(--success); }
.toast.error { border-left-color: var(--danger); }
.toast.info { border-left-color: var(--accent-cyan); }
.toast.warning { border-left-color: var(--warning); }

/* ====== Empty state ====== */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}
.empty-state svg { margin-bottom: 16px; opacity: 0.5; }
.empty-state h3 { font-size: 16px; color: var(--text-secondary); margin-bottom: 8px; }
.empty-state p { font-size: 13px; }

/* ====== Mobile Header ====== */
.mobile-header {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 56px;
  background: rgba(15, 20, 33, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-subtle);
  z-index: 110;
  align-items: center;
  padding: 0 16px;
  gap: 12px;
}
.hamburger-btn {
  background: none;
  border: none;
  color: var(--text-primary);
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
}
.mobile-title {
  font-weight: 700;
  font-size: 16px;
  background: var(--gradient-primary);
  background-clip: text;
  -webkit-background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
}
.mobile-page-title {
  margin-left: auto;
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 500;
}
.sidebar-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 99;
}
.sidebar-overlay.active { display: block; }

/* ====== Daily counter ====== */
.daily-counter {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  margin-bottom: 18px;
}
.daily-counter .counter-bar {
  flex: 1;
  height: 8px;
  background: var(--bg-input);
  border-radius: var(--radius-pill);
  overflow: hidden;
}
.daily-counter .counter-fill {
  height: 100%;
  background: var(--gradient-success);
  border-radius: var(--radius-pill);
  transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 0 12px rgba(34, 197, 94, 0.4);
}
.daily-counter .counter-text {
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  color: var(--text-primary);
}

/* ====== Score badges ====== */
.score-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 38px;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.score-low { background: rgba(100, 116, 139, 0.15); color: var(--text-muted); border: 1px solid rgba(100, 116, 139, 0.25); }
.score-medium { background: rgba(245, 158, 11, 0.15); color: var(--warning); border: 1px solid rgba(245, 158, 11, 0.3); }
.score-high { background: var(--gradient-warm); color: white; border: none; box-shadow: 0 0 12px rgba(245, 158, 11, 0.3); }

/* ====== Sequence cards ====== */
.sequence-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 14px;
  transition: all var(--transition);
}
.sequence-card:hover {
  border-color: var(--border-hover);
  box-shadow: var(--shadow-glow);
  transform: translateY(-2px);
}
.sequence-header {
  display: flex;
  justify-content: space-between;
  align-items: start;
  margin-bottom: 12px;
}
.sequence-header .name { font-weight: 600; font-size: 16px; letter-spacing: -0.015em; }
.sequence-header .desc { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.sequence-meta { font-size: 12px; color: var(--text-secondary); margin-bottom: 14px; }

.sequence-timeline {
  display: flex;
  align-items: center;
  gap: 0;
  padding: 8px 0;
  overflow-x: auto;
}
.timeline-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 100px;
  text-align: center;
}
.timeline-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--gradient-primary);
  border: 3px solid var(--bg-surface);
  z-index: 1;
  box-shadow: 0 0 12px rgba(168, 85, 247, 0.4);
}
.timeline-label {
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 8px;
  max-width: 100px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.timeline-delay {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 2px;
}
.timeline-connector {
  flex: 1;
  height: 2px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  opacity: 0.4;
  min-width: 30px;
  margin-top: -22px;
}

.step-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  padding: 10px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
}
.step-row select, .step-row input {
  padding: 6px 8px;
  font-size: 12px;
}
.step-row .step-num {
  font-size: 12px;
  font-weight: 700;
  color: var(--accent);
  min-width: 22px;
}

/* ====== Source bar chart ====== */
.source-bar-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}
.source-bar-row .source-name {
  font-size: 12px;
  font-weight: 700;
  min-width: 50px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.source-bar-row .bar-track {
  flex: 1;
  height: 24px;
  background: var(--bg-input);
  border-radius: var(--radius-sm);
  overflow: hidden;
  position: relative;
}
.source-bar-row .bar-fill {
  height: 100%;
  border-radius: var(--radius-sm);
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  align-items: center;
  padding-left: 10px;
  font-size: 11px;
  font-weight: 600;
  color: white;
  min-width: fit-content;
}
.source-bar-row .bar-fill.safti { background: var(--gradient-warm); }
.source-bar-row .bar-fill.iad { background: var(--gradient-cool); }
.source-bar-row .bar-count {
  font-size: 12px;
  font-weight: 600;
  min-width: 60px;
  text-align: right;
  color: var(--text-secondary);
}

/* ====== Score distribution ====== */
.score-dist-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}
.score-dist-label { min-width: 70px; }
.score-dist-bar {
  flex: 1;
  height: 20px;
  background: var(--bg-input);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.score-dist-fill {
  height: 100%;
  border-radius: var(--radius-sm);
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}
.score-dist-fill.high { background: var(--gradient-warm); box-shadow: 0 0 12px rgba(245, 158, 11, 0.3); }
.score-dist-fill.medium { background: var(--warning); }
.score-dist-fill.low { background: rgba(100, 116, 139, 0.5); }
.score-dist-count {
  font-size: 12px;
  font-weight: 600;
  min-width: 50px;
  text-align: right;
  color: var(--text-secondary);
}

/* ====== Department tag ====== */
.dept-tag {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
}
.dept-tag:hover {
  border-color: var(--border-hover);
  color: var(--text-primary);
  background: rgba(168, 85, 247, 0.08);
  transform: translateY(-1px);
}
.dept-tag .dept-count {
  font-weight: 700;
  background: var(--gradient-primary);
  background-clip: text;
  -webkit-background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
}

/* ====== Panel quick actions ====== */
.panel-quick-actions {
  display: flex;
  gap: 6px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.quick-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  background: var(--bg-input);
  color: var(--text-secondary);
  font-size: 12px;
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
}
.quick-action-btn:hover {
  background: rgba(168, 85, 247, 0.10);
  color: var(--text-primary);
  border-color: var(--border-hover);
  transform: translateY(-1px);
}
.quick-action-btn.wa { border-color: rgba(37, 211, 102, 0.4); color: var(--whatsapp); }
.quick-action-btn.wa:hover { background: rgba(37, 211, 102, 0.12); border-color: var(--whatsapp); }

/* ====== Duplicate pair ====== */
.duplicate-pair {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 14px;
  align-items: center;
  padding: 14px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  margin-bottom: 10px;
}
.duplicate-card { font-size: 12px; }
.duplicate-card .name { font-weight: 600; margin-bottom: 4px; color: var(--text-primary); }
.duplicate-card .info { color: var(--text-secondary); }
.duplicate-vs {
  font-size: 11px;
  font-weight: 700;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* ============== AI (Gemini) ============== */
.panel-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--border-subtle);
}
.panel-tab {
  background: none;
  border: none;
  color: var(--text-secondary);
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all var(--transition);
  font-family: inherit;
  position: relative;
  bottom: -1px;
}
.panel-tab:hover { color: var(--text-primary); }
.panel-tab.active {
  color: var(--text-primary);
  border-bottom: 2px solid transparent;
  background-image: linear-gradient(transparent, transparent), var(--gradient-primary);
  background-origin: border-box;
  background-clip: padding-box, border-box;
}
.panel-tab.active::after {
  content: '';
  position: absolute;
  left: 0; right: 0; bottom: -1px;
  height: 2px;
  background: var(--gradient-primary);
  border-radius: 2px;
  box-shadow: 0 0 8px rgba(168, 85, 247, 0.5);
}

.ai-panel { display: flex; flex-direction: column; gap: 14px; }
.ai-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.ai-action-btn {
  text-align: left;
  justify-content: flex-start;
  padding: 12px 16px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  border-radius: var(--radius-md);
  font-size: 13px;
  cursor: pointer;
  font-family: inherit;
  font-weight: 500;
  transition: all var(--transition);
}
.ai-action-btn:hover:not(:disabled) {
  background: rgba(168, 85, 247, 0.08);
  border-color: var(--border-hover);
  transform: translateY(-1px);
}
.ai-action-btn:disabled { opacity: 0.6; cursor: not-allowed; }

.ai-cache-meta {
  font-size: 11px;
  color: var(--text-muted);
  padding: 4px 2px;
}
.ai-result { min-height: 60px; }
.ai-empty {
  padding: 22px 14px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
  background: rgba(168, 85, 247, 0.04);
  border-radius: var(--radius-md);
  border: 1px dashed var(--border-subtle);
}
.ai-empty small { color: var(--text-muted); font-size: 11px; }

.ai-card {
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px;
}
.ai-reasoning {
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.55;
}
.ai-actions-list {
  margin-top: 12px;
  font-size: 13px;
  color: var(--text-primary);
}
.ai-actions-list ul {
  margin: 6px 0 0 18px;
  padding: 0;
  color: var(--text-secondary);
}
.ai-actions-list li { margin-bottom: 4px; }

.ai-callout {
  background: linear-gradient(135deg, rgba(168, 85, 247, 0.10), rgba(236, 72, 153, 0.06));
  border: 1px solid rgba(168, 85, 247, 0.25);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-md);
  padding: 14px 16px;
}
.ai-callout-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  background: var(--gradient-primary);
  background-clip: text;
  -webkit-background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
  margin-bottom: 8px;
  font-weight: 700;
}
.ai-callout-body {
  font-size: 13px;
  color: var(--text-primary);
  line-height: 1.55;
  white-space: pre-wrap;
}

.ai-suggestion-card {
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px;
  margin-bottom: 10px;
  transition: all var(--transition);
}
.ai-suggestion-card:hover {
  border-color: var(--border-hover);
}
.ai-suggestion-num {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent);
  margin-bottom: 6px;
  font-weight: 700;
}
.ai-suggestion-text {
  font-size: 13px;
  color: var(--text-primary);
  line-height: 1.55;
  margin-bottom: 8px;
  white-space: pre-wrap;
}

.ai-spinner {
  display: inline-block;
  width: 12px;
  height: 12px;
  border: 2px solid rgba(168, 85, 247, 0.25);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: ai-spin 0.7s linear infinite;
  vertical-align: middle;
  margin-right: 4px;
}

/* Intent badges (AI hot/warm/cold) */
.intent-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  vertical-align: middle;
}
.intent-hot {
  background: var(--gradient-warm);
  color: white;
  box-shadow: 0 0 16px rgba(245, 158, 11, 0.35);
}
.intent-warm {
  background: rgba(245, 158, 11, 0.15);
  color: var(--warning);
  border: 1px solid rgba(245, 158, 11, 0.35);
}
.intent-cold {
  background: rgba(100, 116, 139, 0.15);
  color: var(--text-muted);
  border: 1px solid rgba(100, 116, 139, 0.3);
}

/* Improve draft button */
.btn-improve {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--bg-raised);
  border: 1px solid var(--border-subtle);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all var(--transition);
  color: var(--text-primary);
  padding: 0;
}
.btn-improve:hover:not(:disabled) {
  background: rgba(168, 85, 247, 0.10);
  border-color: var(--border-hover);
  transform: translateY(-1px);
}
.btn-improve:disabled { opacity: 0.6; cursor: not-allowed; }
.btn-improve-icon { font-size: 16px; line-height: 1; }

/* Hot leads list */
.hot-lead-row {
  display: flex;
  gap: 14px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border-subtle);
  transition: background var(--transition);
}
.hot-lead-row:last-child { border-bottom: none; }
.hot-lead-row:hover { background: rgba(168, 85, 247, 0.04); }
.hot-lead-rank {
  width: 32px;
  height: 32px;
  background: var(--gradient-warm);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  flex-shrink: 0;
  box-shadow: 0 0 16px rgba(245, 158, 11, 0.3);
}
.hot-lead-body { flex: 1; min-width: 0; }
.hot-lead-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.hot-lead-reasoning {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 10px;
}
.hot-lead-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

/* ====== Login modal ====== */
.login-modal {
  position: fixed;
  inset: 0;
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(10, 14, 26, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  overflow: hidden;
}
.login-modal::before,
.login-modal::after {
  content: '';
  position: absolute;
  width: 460px;
  height: 460px;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.5;
  pointer-events: none;
}
.login-modal::before {
  background: radial-gradient(circle, rgba(168, 85, 247, 0.6), transparent 70%);
  top: -120px;
  left: -120px;
  animation: blob-float 12s ease-in-out infinite;
}
.login-modal::after {
  background: radial-gradient(circle, rgba(236, 72, 153, 0.5), transparent 70%);
  bottom: -120px;
  right: -120px;
  animation: blob-float 14s ease-in-out infinite reverse;
}
.login-card {
  position: relative;
  z-index: 1;
  background: rgba(15, 20, 33, 0.85);
  backdrop-filter: blur(40px);
  -webkit-backdrop-filter: blur(40px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: 44px 40px;
  width: 92%;
  max-width: 420px;
  box-shadow: var(--shadow-lg), var(--shadow-glow);
  animation: fadeInUp 400ms cubic-bezier(0.4, 0, 0.2, 1);
}
.login-logo { text-align: center; margin-bottom: 32px; }
.login-logo h1 {
  font-size: 36px;
  font-weight: 700;
  letter-spacing: -0.035em;
  margin-bottom: 8px;
  line-height: 1.05;
}
.login-logo p {
  font-size: 13px;
  color: var(--text-muted);
}
.login-card form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.login-card label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: -6px;
}
.login-card input[type="password"] {
  width: 100%;
  padding: 13px 16px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: all var(--transition);
}
.login-card input[type="password"]:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(168, 85, 247, 0.15);
  background: var(--bg-raised);
}
.login-card .btn-primary { padding: 13px 16px; font-size: 14px; margin-top: 4px; }
.login-card .small {
  font-size: 11px;
  color: var(--text-muted);
  text-align: center;
  margin-top: 4px;
  line-height: 1.5;
}

/* ====== Scrollbar ====== */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgba(168, 85, 247, 0.2);
  border-radius: var(--radius-pill);
}
::-webkit-scrollbar-thumb:hover { background: rgba(168, 85, 247, 0.4); }

/* ====== Code style ====== */
code {
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  font-family: 'Fira Code', 'Courier New', monospace;
  font-size: 11px;
  color: var(--accent);
}

/* ====== Responsive: Tablet (<1024px) ====== */
@media (max-width: 1024px) {
  :root { --sidebar-width: 220px; }
  .main { padding: 22px; }
  .page-header { flex-wrap: wrap; gap: 12px; }
  .page-header .btn-group { flex-wrap: wrap; }
  .stats-grid { gap: 14px; }
  .lead-detail-panel { width: 420px; right: -420px; }
  .duplicate-pair { grid-template-columns: 1fr; gap: 8px; }
  .duplicate-vs { justify-self: center; }
  .duplicate-vs .btn-group { flex-direction: row !important; }
}

/* ====== Responsive: Mobile (<768px) ====== */
@media (max-width: 768px) {
  .mobile-header { display: flex; }
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    z-index: 200;
    width: 280px;
  }
  .sidebar.open { transform: translateX(0); }
  .main {
    margin-left: 0;
    padding: 16px;
    padding-top: 72px;
  }
  .page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 18px;
  }
  .page-header h2 { font-size: 22px; }
  .page-header .btn-group {
    width: 100%;
    flex-wrap: wrap;
  }
  .page-header .btn-group .btn {
    flex: 1;
    min-width: 0;
    justify-content: center;
    font-size: 12px;
    padding: 9px 10px;
  }
  .stats-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 12px;
    margin-bottom: 18px;
  }
  .stat-card {
    padding: 18px;
    border-radius: var(--radius-md);
  }
  .stat-card .value { font-size: 26px; }
  .stat-card .label { font-size: 11px; }
  #page-dashboard .stats-grid[style*="1fr 1fr"] {
    grid-template-columns: 1fr !important;
  }
  .filters-bar {
    flex-direction: column;
    gap: 10px;
    align-items: stretch;
  }
  .search-wrapper { min-width: unset; width: 100%; }
  .search-input { min-width: unset; width: 100%; }
  .filters-bar select { width: 100%; }
  .daily-counter {
    flex-direction: column;
    gap: 8px;
    align-items: stretch;
    padding: 12px 16px;
  }
  .daily-counter .counter-text { text-align: center; }
  .table-container {
    border-radius: var(--radius-md);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  th, td { padding: 10px 12px; font-size: 12px; }
  .checkbox-cell { width: 32px; }
  .lead-avatar { width: 30px; height: 30px; font-size: 10px; }
  .lead-info .name { font-size: 12px; }
  .lead-info .location { font-size: 10px; }
  .pagination {
    flex-direction: column;
    gap: 10px;
    padding: 14px;
  }
  .pagination-info { font-size: 12px; }
  .page-btn { width: 30px; height: 30px; font-size: 12px; }
  .lead-detail-panel {
    width: 100%;
    right: -100%;
  }
  .lead-detail-panel.open { right: 0; }
  .panel-header { padding: 16px; }
  .panel-body { padding: 16px; }
  .panel-quick-actions { gap: 4px; }
  .quick-action-btn { font-size: 11px; padding: 6px 10px; }
  .chat-container { max-height: 40vh; min-height: 180px; padding: 10px; }
  .chat-input-area { gap: 6px; }
  .modal {
    width: 95%;
    max-width: 100%;
    max-height: 90vh;
    padding: 20px;
    border-radius: var(--radius-lg);
    margin: 0 8px;
  }
  .modal-header h3 { font-size: 18px; }
  #page-scraper .stats-grid { grid-template-columns: 1fr !important; }
  .scraper-card { padding: 18px; }
  .scraper-card h3 { font-size: 16px; }
  .scraper-card .btn { width: 100%; justify-content: center; }
  .qr-container { padding: 24px 16px; }
  .qr-container img { max-width: 200px !important; height: auto !important; }
  .qr-instructions ol { font-size: 12px; }
  #page-whatsapp .btn-group { flex-direction: column; width: 100%; }
  #page-whatsapp .btn-group .btn { width: 100%; justify-content: center; }
  .form-group input,
  .form-group textarea,
  .form-group select { font-size: 16px; }
  .template-card { padding: 16px; }
  .template-card .preview { font-size: 11px; }
  .sequence-card { padding: 16px; }
  .sequence-header { flex-direction: column; gap: 8px; }
  .sequence-header .btn-group { width: 100%; flex-wrap: wrap; }
  .sequence-header .btn-group .btn {
    flex: 1; min-width: 0; justify-content: center; font-size: 11px;
  }
  .sequence-timeline { flex-wrap: wrap; gap: 4px; }
  .timeline-step { min-width: 70px; }
  .timeline-connector { min-width: 16px; }
  .step-row { flex-wrap: wrap; gap: 6px; }
  .step-row select { flex: 1; min-width: 120px; }
  .score-dist-row { gap: 8px; }
  .score-dist-label { min-width: 50px; }
  .score-dist-count { min-width: 40px; font-size: 11px; }
  .source-bar-row { gap: 8px; }
  .source-bar-row .source-name { min-width: 40px; font-size: 11px; }
  .source-bar-row .bar-count { min-width: 45px; font-size: 11px; }
  .dept-tag { padding: 6px 12px; font-size: 11px; }
  .duplicate-pair { grid-template-columns: 1fr; gap: 8px; }
  .duplicate-vs { justify-self: center; }
  .duplicate-vs .btn-group { flex-direction: row !important; }
  .toast-container {
    bottom: 16px; right: 8px; left: 8px; top: auto;
  }
  .toast { min-width: unset; width: 100%; font-size: 12px; padding: 12px 16px; }
  .btn { font-size: 12px; padding: 9px 14px; }
  .btn-sm { font-size: 11px; padding: 5px 10px; }
  .login-card { padding: 32px 24px; }
  .login-logo h1 { font-size: 28px; }
}

/* ====== Responsive: Small phones (<480px) ====== */
@media (max-width: 480px) {
  .main { padding: 14px; padding-top: 70px; }
  .stats-grid {
    grid-template-columns: 1fr !important;
    gap: 10px;
  }
  .stat-card .value { font-size: 28px; }
  .page-header h2 { font-size: 20px; }
  .page-header .btn-group .btn { font-size: 11px; }
  .modal { padding: 16px; margin: 0 4px; }
  .panel-header { padding: 14px; }
  .panel-body { padding: 14px; }
  #panel-avatar { width: 38px !important; height: 38px !important; font-size: 12px !important; }
  #panel-lead-name { font-size: 16px; }
  th, td { padding: 8px 10px; }
}
