/* ═══════════════════════════════════════════════
   LeadForge AI — Dark Mode Glassmorphism Design
   ═══════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&family=JetBrains+Mono:wght@400;500&display=swap');

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

:root {
  /* Core palette */
  --bg:            #080c14;
  --bg-2:          #0d1220;
  --bg-3:          #111827;
  --glass:         rgba(255,255,255,0.04);
  --glass-hover:   rgba(255,255,255,0.07);
  --glass-strong:  rgba(255,255,255,0.10);
  --border:        rgba(255,255,255,0.08);
  --border-bright: rgba(255,255,255,0.14);

  /* Brand accent — violet/cyan */
  --accent:        #7c3aed;
  --accent-2:      #6d28d9;
  --accent-glow:   rgba(124,58,237,0.35);
  --cyan:          #06b6d4;
  --cyan-glow:     rgba(6,182,212,0.25);
  --emerald:       #10b981;
  --emerald-glow:  rgba(16,185,129,0.25);
  --rose:          #f43f5e;
  --rose-glow:     rgba(244,63,94,0.25);
  --amber:         #f59e0b;
  --amber-glow:    rgba(245,158,11,0.25);

  /* Text */
  --ink:           #f1f5f9;
  --ink-2:         #94a3b8;
  --ink-3:         #64748b;

  /* Gradients */
  --grad-sidebar:  linear-gradient(180deg, #0f0c29 0%, #1a1040 50%, #0d1220 100%);
  --grad-accent:   linear-gradient(135deg, #7c3aed 0%, #06b6d4 100%);
  --grad-card:     linear-gradient(145deg, rgba(255,255,255,0.06) 0%, rgba(255,255,255,0.02) 100%);
  --grad-hero:     linear-gradient(135deg, rgba(124,58,237,0.15) 0%, rgba(6,182,212,0.08) 100%);

  /* Layout */
  --sidebar: 260px;
  --radius:  12px;
  --radius-lg: 18px;
  --font: 'Inter', ui-sans-serif, system-ui, sans-serif;
  --mono: 'JetBrains Mono', monospace;

  /* Shadows */
  --shadow-sm:  0 2px 8px rgba(0,0,0,0.3);
  --shadow-md:  0 8px 32px rgba(0,0,0,0.4);
  --shadow-lg:  0 20px 60px rgba(0,0,0,0.5);
  --shadow-glow: 0 0 30px var(--accent-glow);
}

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-bright); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: var(--ink-3); }

/* ══════════════════════════════════
   LAYOUT
══════════════════════════════════ */
.app { display: flex; min-height: 100vh; }

/* ── Sidebar ── */
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar);
  background: var(--grad-sidebar);
  border-right: 1px solid var(--border);
  padding: 20px 16px 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 30;
  overflow-y: auto;
}

/* Subtle purple glow top-left */
.sidebar::before {
  content: '';
  position: absolute;
  top: -40px; left: -40px;
  width: 200px; height: 200px;
  background: radial-gradient(circle, rgba(124,58,237,0.2) 0%, transparent 70%);
  pointer-events: none;
}

/* ── Brand ── */
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 6px 20px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 8px;
}

.brand-mark {
  width: 40px; height: 40px;
  border-radius: 10px;
  background: var(--grad-accent);
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 0.9rem;
  color: white;
  box-shadow: 0 0 20px var(--accent-glow);
  flex-shrink: 0;
}

.brand-name {
  font-weight: 800;
  font-size: 1rem;
  background: var(--grad-accent);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.brand-subtitle { color: var(--ink-3); font-size: 0.75rem; margin-top: 2px; }

/* ── Nav ── */
.nav { display: flex; flex-direction: column; gap: 3px; flex: 1; }

.nav-section-label {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-3);
  padding: 12px 10px 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 40px;
  padding: 0 12px;
  border-radius: 10px;
  color: var(--ink-2);
  font-weight: 500;
  font-size: 0.875rem;
  transition: all 0.2s ease;
  border: 1px solid transparent;
  position: relative;
  overflow: hidden;
}

.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; opacity: 0.7; transition: opacity 0.2s; }

.nav-item:hover {
  background: var(--glass-hover);
  color: var(--ink);
  border-color: var(--border);
}

.nav-item:hover svg { opacity: 1; }

.nav-item.active {
  background: linear-gradient(135deg, rgba(124,58,237,0.2), rgba(6,182,212,0.1));
  color: white;
  border-color: rgba(124,58,237,0.4);
  box-shadow: inset 0 0 20px rgba(124,58,237,0.1);
}

.nav-item.active svg { opacity: 1; }

.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0; top: 20%; bottom: 20%;
  width: 3px;
  background: var(--grad-accent);
  border-radius: 0 4px 4px 0;
}

/* ── Mode pill ── */
.mode-pill {
  margin-top: 8px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--ink-3);
  font-size: 0.78rem;
  background: var(--glass);
  display: flex;
  align-items: center;
  gap: 7px;
  font-family: var(--mono);
}

.mode-pill::before {
  content: '';
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--ink-3);
  flex-shrink: 0;
  animation: pulse-dot 2s ease infinite;
}

.mode-pill.live::before { background: var(--emerald); box-shadow: 0 0 8px var(--emerald-glow); }
.mode-pill.demo::before { background: var(--amber); box-shadow: 0 0 8px var(--amber-glow); }

@keyframes pulse-dot {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.3); opacity: 0.7; }
}

/* ── Main ── */
.main {
  margin-left: var(--sidebar);
  width: calc(100% - var(--sidebar));
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── Topbar ── */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(8,12,20,0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  padding: 20px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.topbar h1 { font-size: 1.4rem; font-weight: 700; line-height: 1.2; }
.topbar p { color: var(--ink-2); font-size: 0.875rem; margin-top: 3px; }

.topbar-right { display: flex; align-items: center; gap: 10px; }

/* ── Content ── */
.content { padding: 28px 32px 48px; flex: 1; }

/* ══════════════════════════════════
   BUTTONS
══════════════════════════════════ */
.btn {
  border: 1px solid transparent;
  border-radius: 10px;
  min-height: 38px;
  padding: 0 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--ink);
  background: var(--glass);
  transition: all 0.2s ease;
  white-space: nowrap;
  position: relative;
  overflow: hidden;
}

.btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: white;
  opacity: 0;
  transition: opacity 0.2s;
}

.btn:hover::after { opacity: 0.04; }
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

.btn-primary {
  background: var(--grad-accent);
  color: white;
  border-color: transparent;
  box-shadow: 0 4px 20px var(--accent-glow);
}

.btn-primary:hover { box-shadow: 0 8px 32px var(--accent-glow); }

.btn-secondary {
  border-color: var(--border-bright);
  color: var(--ink);
  background: var(--glass);
}

.btn-secondary:hover { border-color: rgba(124,58,237,0.5); color: white; }

.btn-ghost { border-color: transparent; color: var(--ink-2); }
.btn-ghost:hover { color: var(--ink); background: var(--glass); }

.btn-danger {
  border-color: rgba(244,63,94,0.3);
  color: var(--rose);
  background: rgba(244,63,94,0.08);
}

.btn-danger:hover { background: rgba(244,63,94,0.15); box-shadow: 0 0 20px var(--rose-glow); }

.btn-sm { min-height: 32px; padding: 0 12px; font-size: 0.8rem; border-radius: 8px; }
.btn-xs { min-height: 26px; padding: 0 8px; font-size: 0.75rem; border-radius: 6px; }
.btn-icon { width: 36px; min-height: 36px; padding: 0; }
.btn-icon-sm { width: 30px; min-height: 30px; padding: 0; }

.btn svg { width: 16px; height: 16px; }
.btn-sm svg { width: 14px; height: 14px; }

.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; box-shadow: none; }

/* ══════════════════════════════════
   CARDS & GLASS
══════════════════════════════════ */
.card {
  background: var(--grad-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  backdrop-filter: blur(12px);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.card:hover { border-color: var(--border-bright); }

.card-glow { box-shadow: var(--shadow-glow); border-color: rgba(124,58,237,0.3); }

/* ══════════════════════════════════
   GRID SYSTEM
══════════════════════════════════ */
.grid { display: grid; gap: 16px; }

.stats-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 24px;
}

.two-col {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(300px, 0.7fr);
  gap: 16px;
}

/* ══════════════════════════════════
   STAT CARDS
══════════════════════════════════ */
.stat-card {
  background: var(--grad-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 22px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: relative;
  overflow: hidden;
  transition: all 0.3s ease;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0; right: 0;
  width: 120px; height: 120px;
  border-radius: 50%;
  opacity: 0.06;
  transition: opacity 0.3s;
}

.stat-card:nth-child(1)::before { background: var(--accent); top: -30px; right: -30px; }
.stat-card:nth-child(2)::before { background: var(--cyan); top: -30px; right: -30px; }
.stat-card:nth-child(3)::before { background: var(--emerald); top: -30px; right: -30px; }
.stat-card:nth-child(4)::before { background: var(--amber); top: -30px; right: -30px; }

.stat-card:hover { border-color: var(--border-bright); transform: translateY(-2px); box-shadow: var(--shadow-md); }
.stat-card:hover::before { opacity: 0.12; }

.stat-icon {
  width: 36px; height: 36px;
  border-radius: 9px;
  display: grid;
  place-items: center;
}

.stat-icon svg { width: 18px; height: 18px; }
.stat-icon-purple { background: rgba(124,58,237,0.15); color: var(--accent); }
.stat-icon-cyan { background: rgba(6,182,212,0.12); color: var(--cyan); }
.stat-icon-emerald { background: rgba(16,185,129,0.12); color: var(--emerald); }
.stat-icon-amber { background: rgba(245,158,11,0.12); color: var(--amber); }

.stat-label { color: var(--ink-3); font-size: 0.75rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; }
.stat-value { font-size: 2rem; font-weight: 800; line-height: 1; letter-spacing: -0.02em; }
.stat-note { color: var(--ink-2); font-size: 0.8rem; display: flex; align-items: center; gap: 4px; }

.stat-trend { font-size: 0.75rem; font-weight: 600; display: inline-flex; align-items: center; gap: 2px; }
.stat-trend-up { color: var(--emerald); }
.stat-trend-down { color: var(--rose); }

/* ══════════════════════════════════
   SECTION
══════════════════════════════════ */
.section { }
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  gap: 12px;
  flex-wrap: wrap;
}

.section-title { font-size: 1rem; font-weight: 700; color: var(--ink); }

/* ══════════════════════════════════
   PIPELINE / KANBAN
══════════════════════════════════ */
.pipeline {
  display: grid;
  grid-template-columns: repeat(6, minmax(170px, 1fr));
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 8px;
}

.pipeline-col {
  background: var(--glass);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  min-width: 170px;
}

.pipeline-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.pipeline-head-title { font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-3); }

.pipeline-head-count {
  font-size: 0.72rem;
  font-weight: 700;
  background: var(--glass-strong);
  color: var(--ink-2);
  padding: 1px 7px;
  border-radius: 99px;
  border: 1px solid var(--border);
}

.pipeline-card {
  margin-top: 8px;
  background: var(--glass-hover);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.pipeline-card:hover {
  border-color: rgba(124,58,237,0.4);
  box-shadow: 0 0 16px rgba(124,58,237,0.12);
  background: var(--glass-strong);
}

.pipeline-name { font-size: 0.83rem; font-weight: 600; color: var(--ink); }
.pipeline-company { font-size: 0.75rem; color: var(--ink-3); margin-top: 3px; }

.pipeline-empty { font-size: 0.78rem; color: var(--ink-3); padding: 12px 2px; text-align: center; }

/* ══════════════════════════════════
   ACTIVITY
══════════════════════════════════ */
.activity-list { display: grid; gap: 2px; }

.activity-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 9px;
  transition: background 0.15s;
}

.activity-item:hover { background: var(--glass); }

.activity-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--ink-3);
}

.activity-dot-created { background: var(--accent); box-shadow: 0 0 6px var(--accent-glow); }
.activity-dot-sent { background: var(--cyan); box-shadow: 0 0 6px var(--cyan-glow); }
.activity-dot-replied { background: var(--emerald); box-shadow: 0 0 6px var(--emerald-glow); }
.activity-dot-meeting { background: var(--amber); box-shadow: 0 0 6px var(--amber-glow); }

.activity-text { font-size: 0.85rem; color: var(--ink-2); flex: 1; line-height: 1.4; }
.activity-text strong { color: var(--ink); font-weight: 600; }
.activity-time { font-size: 0.75rem; color: var(--ink-3); white-space: nowrap; font-family: var(--mono); }

/* ══════════════════════════════════
   FORM ELEMENTS
══════════════════════════════════ */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.form-group { display: grid; gap: 7px; margin-bottom: 16px; }

.form-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--ink-2);
  letter-spacing: 0.01em;
}

.form-input, .form-textarea, .form-select {
  width: 100%;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  border-radius: 9px;
  color: var(--ink);
  padding: 10px 13px;
  outline: none;
  transition: all 0.2s ease;
  font-size: 0.875rem;
}

.form-input::placeholder, .form-textarea::placeholder { color: var(--ink-3); }

.form-input:focus, .form-textarea:focus, .form-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
  background: rgba(124,58,237,0.05);
}

.form-textarea { min-height: 120px; resize: vertical; line-height: 1.55; }

.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
  cursor: pointer;
}

.form-select option { background: var(--bg-3); color: var(--ink); }

.help { color: var(--ink-3); font-size: 0.8rem; line-height: 1.55; }

/* ══════════════════════════════════
   RESEARCH LAYOUT
══════════════════════════════════ */
.research-layout {
  display: grid;
  grid-template-columns: minmax(300px, 420px) 1fr;
  gap: 20px;
  align-items: start;
}

.research-tip {
  background: linear-gradient(135deg, rgba(124,58,237,0.1), rgba(6,182,212,0.06));
  border: 1px solid rgba(124,58,237,0.2);
  border-radius: 9px;
  padding: 12px 14px;
  font-size: 0.8rem;
  color: var(--ink-2);
  line-height: 1.5;
  margin-top: 14px;
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.research-tip svg { width: 16px; height: 16px; color: var(--accent); flex-shrink: 0; margin-top: 2px; }

.insight-banner {
  background: linear-gradient(135deg, rgba(6,182,212,0.08), rgba(124,58,237,0.06));
  border: 1px solid rgba(6,182,212,0.2);
  border-radius: var(--radius);
  padding: 14px 16px;
  font-size: 0.85rem;
  color: var(--ink-2);
  line-height: 1.6;
  margin-bottom: 14px;
  display: flex;
  gap: 10px;
}

.insight-banner svg { width: 18px; height: 18px; color: var(--cyan); flex-shrink: 0; margin-top: 1px; }

/* ══════════════════════════════════
   LEAD CARDS
══════════════════════════════════ */
.lead-list { display: grid; gap: 10px; }

.lead-card {
  background: var(--grad-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  display: grid;
  grid-template-columns: 46px 1fr auto;
  gap: 14px;
  align-items: start;
  transition: all 0.25s ease;
}

.lead-card:hover {
  border-color: rgba(124,58,237,0.35);
  box-shadow: 0 0 20px rgba(124,58,237,0.08);
  transform: translateY(-1px);
}

.avatar {
  width: 46px; height: 46px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--accent), var(--cyan));
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 0.85rem;
  color: white;
  flex-shrink: 0;
}

.lead-name { font-weight: 700; font-size: 0.95rem; }
.lead-position { color: var(--ink-2); font-size: 0.82rem; margin-top: 2px; }
.lead-meta { color: var(--ink-3); font-size: 0.78rem; margin-top: 5px; display: flex; flex-wrap: wrap; gap: 6px; }
.lead-meta-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--glass);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 2px 7px;
  font-size: 0.72rem;
  color: var(--ink-3);
}

.lead-meta-chip svg { width: 11px; height: 11px; }

.lead-note {
  margin-top: 10px;
  padding: 8px 10px;
  background: rgba(124,58,237,0.06);
  border-left: 2px solid var(--accent);
  border-radius: 0 6px 6px 0;
  font-size: 0.8rem;
  color: var(--ink-2);
  line-height: 1.45;
}

.lead-actions { display: flex; gap: 7px; flex-shrink: 0; align-items: flex-start; }

/* Score badge */
.lead-score {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 6px;
  margin-top: 6px;
}

.lead-score-high { background: rgba(16,185,129,0.15); color: var(--emerald); }
.lead-score-med  { background: rgba(245,158,11,0.12); color: var(--amber); }
.lead-score-low  { background: rgba(244,63,94,0.12);  color: var(--rose); }

/* ══════════════════════════════════
   TABLE
══════════════════════════════════ */
.table-wrap {
  background: var(--glass);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: auto;
}

.table {
  width: 100%;
  border-collapse: collapse;
  min-width: 700px;
}

.table th {
  background: rgba(255,255,255,0.03);
  color: var(--ink-3);
  text-align: left;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  font-weight: 700;
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.table td {
  padding: 13px 16px;
  border-top: 1px solid rgba(255,255,255,0.04);
  font-size: 0.875rem;
  vertical-align: middle;
  color: var(--ink-2);
}

.table td strong { color: var(--ink); font-weight: 600; }

.table tr { transition: background 0.15s; }
.table tr:hover td { background: rgba(255,255,255,0.03); }

.table-checkbox { width: 20px; height: 20px; accent-color: var(--accent); cursor: pointer; }

/* ══════════════════════════════════
   BADGES
══════════════════════════════════ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 22px;
  padding: 0 9px;
  border-radius: 6px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.badge-new          { background: rgba(100,116,139,0.15); color: var(--ink-2); border: 1px solid rgba(100,116,139,0.2); }
.badge-researched   { background: rgba(124,58,237,0.15);  color: #a78bfa;       border: 1px solid rgba(124,58,237,0.25); }
.badge-contacted    { background: rgba(6,182,212,0.12);   color: var(--cyan);   border: 1px solid rgba(6,182,212,0.2); }
.badge-following_up { background: rgba(245,158,11,0.12);  color: var(--amber);  border: 1px solid rgba(245,158,11,0.2); }
.badge-replied      { background: rgba(16,185,129,0.12);  color: var(--emerald);border: 1px solid rgba(16,185,129,0.2); }
.badge-meeting      { background: rgba(16,185,129,0.2);   color: var(--emerald);border: 1px solid rgba(16,185,129,0.3); }
.badge-closed       { background: rgba(100,116,139,0.1);  color: var(--ink-3);  border: 1px solid rgba(100,116,139,0.15);}
.badge-sent         { background: rgba(6,182,212,0.12);   color: var(--cyan);   border: 1px solid rgba(6,182,212,0.2); }
.badge-draft        { background: rgba(100,116,139,0.1);  color: var(--ink-3);  border: 1px solid rgba(100,116,139,0.15);}

/* ══════════════════════════════════
   EMAIL PREVIEW
══════════════════════════════════ */
.email-preview {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: rgba(255,255,255,0.03);
}

.email-preview-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  background: rgba(255,255,255,0.02);
}

.email-to { color: var(--ink-3); font-size: 0.82rem; }
.email-to strong { color: var(--ink); }

.email-subject {
  margin-top: 6px;
  font-weight: 700;
  font-size: 1.05rem;
  outline: none;
  color: var(--ink);
  border-radius: 6px;
  padding: 4px 6px;
  margin-left: -6px;
  transition: background 0.2s;
}

.email-subject:focus { background: var(--glass); }

.email-body {
  padding: 20px;
  white-space: pre-wrap;
  line-height: 1.7;
  outline: none;
  min-height: 260px;
  color: var(--ink-2);
  border-radius: 6px;
  font-size: 0.9rem;
  transition: background 0.2s;
}

.email-body:focus { background: rgba(255,255,255,0.02); }

.email-type-tabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.email-type-tab {
  padding: 5px 12px;
  border-radius: 8px;
  font-size: 0.78rem;
  font-weight: 600;
  border: 1px solid var(--border);
  background: var(--glass);
  color: var(--ink-2);
  cursor: pointer;
  transition: all 0.2s;
}

.email-type-tab.active {
  background: linear-gradient(135deg, rgba(124,58,237,0.2), rgba(6,182,212,0.1));
  border-color: rgba(124,58,237,0.4);
  color: white;
}

.ab-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 14px;
}

.ab-option {
  background: var(--glass);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 10px 13px;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 0.85rem;
  color: var(--ink-2);
}

.ab-option:hover, .ab-option.selected {
  border-color: rgba(124,58,237,0.4);
  background: rgba(124,58,237,0.08);
  color: var(--ink);
}

.ab-option-label { font-size: 0.68rem; font-weight: 700; text-transform: uppercase; color: var(--accent); margin-bottom: 4px; }

/* ══════════════════════════════════
   EMPTY STATE
══════════════════════════════════ */
.empty-state {
  border: 1px dashed rgba(255,255,255,0.1);
  border-radius: var(--radius-lg);
  padding: 48px 24px;
  text-align: center;
  color: var(--ink-3);
  background: rgba(255,255,255,0.015);
}

.empty-state-icon {
  width: 56px; height: 56px;
  border-radius: 16px;
  background: var(--glass);
  display: grid;
  place-items: center;
  margin: 0 auto 16px;
}

.empty-state-icon svg { width: 26px; height: 26px; opacity: 0.5; }

.empty-state strong { display: block; color: var(--ink); font-size: 1.05rem; margin-bottom: 6px; font-weight: 700; }
.empty-state p { font-size: 0.875rem; line-height: 1.5; max-width: 360px; margin: 0 auto; }
.empty-state-action { margin-top: 20px; }

/* ══════════════════════════════════
   LOADING / SKELETON
══════════════════════════════════ */
.spinner {
  width: 32px; height: 32px;
  border: 2px solid rgba(255,255,255,0.1);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
  margin: 40px auto 14px;
}

.loading-text { text-align: center; color: var(--ink-3); font-size: 0.875rem; }

.skeleton {
  background: linear-gradient(90deg, var(--glass) 25%, var(--glass-hover) 50%, var(--glass) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 6px;
  display: block;
}

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* ══════════════════════════════════
   TOAST
══════════════════════════════════ */
.toast-container {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 100;
  display: grid;
  gap: 8px;
  pointer-events: none;
}

.toast {
  background: rgba(17,24,39,0.95);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-bright);
  color: var(--ink);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  padding: 12px 16px;
  min-width: 260px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.875rem;
  animation: toastIn 0.3s cubic-bezier(0.34,1.56,0.64,1);
  pointer-events: auto;
}

.toast-icon { width: 20px; height: 20px; flex-shrink: 0; }
.toast-success { border-left: 3px solid var(--emerald); }
.toast-error   { border-left: 3px solid var(--rose); }
.toast-info    { border-left: 3px solid var(--cyan); }
.toast-warning { border-left: 3px solid var(--amber); }

@keyframes toastIn {
  from { transform: translateX(40px) scale(0.95); opacity: 0; }
  to   { transform: translateX(0) scale(1); opacity: 1; }
}

/* ══════════════════════════════════
   MODAL
══════════════════════════════════ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.65);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 80;
  animation: fadeIn 0.2s ease;
}

.modal-overlay.active { display: flex; }

.modal {
  width: min(740px, 100%);
  max-height: 88vh;
  overflow-y: auto;
  background: var(--bg-3);
  border: 1px solid var(--border-bright);
  border-radius: var(--radius-lg);
  box-shadow: 0 40px 100px rgba(0,0,0,0.6), 0 0 40px rgba(124,58,237,0.1);
  animation: modalIn 0.3s cubic-bezier(0.34,1.56,0.64,1);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--bg-3);
  z-index: 1;
}

.modal-header h2 { font-size: 1.1rem; font-weight: 700; }
.modal-body { padding: 22px; }
.modal-footer {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  margin-top: 16px;
}

.icon-btn {
  border: 1px solid var(--border);
  background: var(--glass);
  border-radius: 8px;
  width: 32px; height: 32px;
  color: var(--ink-2);
  font-size: 1.2rem;
  display: grid;
  place-items: center;
  transition: all 0.2s;
}

.icon-btn:hover { background: var(--glass-hover); color: var(--ink); }

@keyframes fadeIn  { from { opacity: 0; } to { opacity: 1; } }
@keyframes modalIn { from { transform: scale(0.93) translateY(16px); opacity: 0; } to { transform: scale(1) translateY(0); opacity: 1; } }

/* ══════════════════════════════════
   SETTINGS
══════════════════════════════════ */
.settings-grid { display: grid; gap: 16px; max-width: 800px; }

.settings-section-title {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-3);
  margin-bottom: 10px;
}

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.toggle-row:last-child { border-bottom: none; }

.toggle-info-label { font-weight: 600; font-size: 0.875rem; }
.toggle-info-sub { font-size: 0.78rem; color: var(--ink-3); margin-top: 2px; }

.toggle {
  position: relative;
  width: 42px; height: 24px;
  cursor: pointer;
  flex-shrink: 0;
}

.toggle input { opacity: 0; width: 0; height: 0; }

.toggle-slider {
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0.1);
  border: 1px solid var(--border);
  border-radius: 99px;
  transition: 0.2s;
}

.toggle-slider::before {
  content: '';
  position: absolute;
  width: 18px; height: 18px;
  left: 2px; top: 2px;
  background: var(--ink-3);
  border-radius: 50%;
  transition: 0.2s;
}

.toggle input:checked + .toggle-slider { background: var(--accent); border-color: var(--accent); }
.toggle input:checked + .toggle-slider::before { transform: translateX(18px); background: white; }

/* ══════════════════════════════════
   CSV IMPORT
══════════════════════════════════ */
.drop-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius-lg);
  padding: 40px 24px;
  text-align: center;
  cursor: pointer;
  transition: all 0.25s ease;
  background: rgba(255,255,255,0.02);
  position: relative;
}

.drop-zone:hover, .drop-zone.drag-over {
  border-color: var(--accent);
  background: rgba(124,58,237,0.06);
  box-shadow: 0 0 24px var(--accent-glow);
}

.drop-zone-icon {
  width: 52px; height: 52px;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(124,58,237,0.15), rgba(6,182,212,0.1));
  display: grid;
  place-items: center;
  margin: 0 auto 14px;
}

.drop-zone-icon svg { width: 24px; height: 24px; color: var(--accent); }
.drop-zone h3 { font-size: 0.95rem; font-weight: 700; margin-bottom: 6px; }
.drop-zone p { font-size: 0.82rem; color: var(--ink-3); }

.drop-zone input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

.import-preview {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: auto;
  max-height: 280px;
  margin-top: 16px;
}

.import-preview table { min-width: 100%; }

/* ══════════════════════════════════
   CHARTS
══════════════════════════════════ */
.chart-wrap {
  position: relative;
  height: 200px;
  padding-top: 8px;
}

.chart-wrap-sm { height: 140px; }

/* ══════════════════════════════════
   BULK ACTIONS BAR
══════════════════════════════════ */
.bulk-bar {
  display: none;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: linear-gradient(135deg, rgba(124,58,237,0.15), rgba(6,182,212,0.08));
  border: 1px solid rgba(124,58,237,0.3);
  border-radius: var(--radius);
  margin-bottom: 12px;
  animation: slideDown 0.2s ease;
}

.bulk-bar.visible { display: flex; }
.bulk-count { font-size: 0.875rem; font-weight: 700; color: var(--accent); margin-right: 4px; }
@keyframes slideDown { from { transform: translateY(-8px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* ══════════════════════════════════
   SEARCH BAR
══════════════════════════════════ */
.search-bar {
  position: relative;
  max-width: 420px;
}

.search-bar svg {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px; height: 16px;
  color: var(--ink-3);
  pointer-events: none;
}

.search-bar input { padding-left: 38px; }

/* ══════════════════════════════════
   DIVIDER
══════════════════════════════════ */
.divider {
  height: 1px;
  background: var(--border);
  margin: 16px 0;
}

/* ══════════════════════════════════
   LANG SELECTOR
══════════════════════════════════ */
.lang-tabs {
  display: flex;
  gap: 5px;
  background: var(--glass);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 3px;
  margin-bottom: 14px;
}

.lang-tab {
  flex: 1;
  padding: 5px 10px;
  border-radius: 7px;
  font-size: 0.78rem;
  font-weight: 700;
  text-align: center;
  cursor: pointer;
  color: var(--ink-3);
  transition: all 0.2s;
  border: 1px solid transparent;
}

.lang-tab.active {
  background: var(--grad-accent);
  color: white;
  border-color: transparent;
}

/* ══════════════════════════════════
   TOOLTIP
══════════════════════════════════ */
[data-tooltip] { position: relative; }
[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%) scale(0.92);
  background: var(--bg-3);
  border: 1px solid var(--border-bright);
  color: var(--ink);
  font-size: 0.72rem;
  padding: 4px 9px;
  border-radius: 6px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: all 0.15s;
  z-index: 99;
}

[data-tooltip]:hover::after { opacity: 1; transform: translateX(-50%) scale(1); }

/* ══════════════════════════════════
   RESPONSIVE
══════════════════════════════════ */
@media (max-width: 1200px) {
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .two-col { grid-template-columns: 1fr; }
  .research-layout { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  :root { --sidebar: 0px; }

  .sidebar {
    position: fixed;
    bottom: 0; top: auto;
    width: 100%;
    height: auto;
    flex-direction: row;
    padding: 8px 12px;
    border-right: none;
    border-top: 1px solid var(--border);
    z-index: 50;
    background: rgba(8,12,20,0.95);
    backdrop-filter: blur(20px);
  }

  .brand, .mode-pill, .nav-section-label { display: none; }

  .nav {
    flex-direction: row;
    flex: 1;
    gap: 2px;
  }

  .nav-item {
    flex: 1;
    justify-content: center;
    height: 48px;
    font-size: 0.7rem;
    flex-direction: column;
    gap: 3px;
    padding: 0 4px;
  }

  .nav-item span.nav-label { display: block; }
  .nav-item.active::before { display: none; }

  .main { margin-left: 0; width: 100%; padding-bottom: 72px; }

  .topbar { padding: 16px 18px; }
  .content { padding: 16px 18px 32px; }

  .stats-grid, .form-grid { grid-template-columns: 1fr; }
  .pipeline { grid-template-columns: repeat(6, 170px); }
  .lead-card { grid-template-columns: 42px 1fr; }
  .lead-actions { grid-column: 1/-1; }
  .ab-options { grid-template-columns: 1fr; }
  .topbar-right .btn-primary .btn-text { display: none; }
}
