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

:root {
  --bg: #0a0a0f;
  --surface: #12121a;
  --surface-hover: #181824;
  --border: #1e1e2e;
  --text: #e8e8ed;
  --muted: #8888a0;
  --accent: #6366f1;
  --accent-hover: #5558e6;
  --accent-glow: rgba(99, 102, 241, 0.15);
  --green: #22c55e;
  --green-bg: rgba(34, 197, 94, 0.08);
  --orange: #f59e0b;
  --orange-bg: rgba(245, 158, 11, 0.08);
  --red: #ef4444;
  --red-bg: rgba(239, 68, 68, 0.08);
  --blue: #3b82f6;
  --blue-bg: rgba(59, 130, 246, 0.08);
}

body {
  font-family: 'Inter', -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

h1, h2, h3, h4 { font-family: 'Space Grotesk', sans-serif; }

.container { max-width: 1100px; margin: 0 auto; padding: 0 24px; }

/* ─── Nav ──────────────────────────────── */
nav {
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 100;
}
.nav-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.logo {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -0.5px;
}
.logo span { color: var(--accent); }
.nav-links { display: flex; gap: 8px; }
.nav-link {
  font-size: 0.85rem;
  color: var(--muted);
  text-decoration: none;
  padding: 8px 16px;
  border-radius: 8px;
  transition: all 0.15s;
  font-weight: 500;
}
.nav-link:hover { color: var(--text); background: var(--surface); }
.nav-link.active { color: var(--text); background: var(--accent-glow); }
.nav-upgrade {
  font-size: 0.8rem;
  font-weight: 600;
  color: #fff;
  background: var(--accent);
  text-decoration: none;
  padding: 7px 16px;
  border-radius: 8px;
  transition: background 0.15s;
  margin-left: 8px;
}
.nav-upgrade:hover { background: var(--accent-hover); }

/* ─── Main Content ─────────────────────── */
main { padding: 32px 24px 80px; }

/* ─── Stats Row ────────────────────────── */
.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 32px;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
}
.stat-card .label {
  font-size: 0.75rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 8px;
}
.stat-card .value {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.8rem;
  font-weight: 700;
}
.stat-card .value.accent { color: var(--accent); }
.stat-card .value.green { color: var(--green); }
.stat-card .value.orange { color: var(--orange); }

/* ─── Cards ────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  transition: border-color 0.15s;
}
.card:hover { border-color: #2a2a3e; }
.card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 16px;
}
.card-title {
  font-size: 1.1rem;
  font-weight: 600;
}
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 16px;
  margin-top: 24px;
}

/* ─── Badges ───────────────────────────── */
.badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 100px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.badge-draft { color: var(--muted); background: var(--surface); border: 1px solid var(--border); }
.badge-active { color: var(--green); background: var(--green-bg); border: 1px solid rgba(34,197,94,0.2); }
.badge-sent { color: var(--blue); background: var(--blue-bg); border: 1px solid rgba(59,130,246,0.2); }
.badge-opened { color: var(--orange); background: var(--orange-bg); border: 1px solid rgba(245,158,11,0.2); }
.badge-replied { color: var(--green); background: var(--green-bg); border: 1px solid rgba(34,197,94,0.2); }
.badge-new { color: var(--muted); background: var(--surface); border: 1px solid var(--border); }
.badge-contacted { color: var(--blue); background: var(--blue-bg); border: 1px solid rgba(59,130,246,0.2); }

/* ─── Buttons ──────────────────────────── */
.btn {
  font-family: 'Inter', sans-serif;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 10px 20px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  transition: all 0.15s;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
}
.btn-primary {
  background: var(--accent);
  color: #fff;
}
.btn-primary:hover { background: var(--accent-hover); }
.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--surface-hover); }
.btn-ghost {
  background: transparent;
  color: var(--muted);
  padding: 8px 12px;
}
.btn-ghost:hover { color: var(--text); }
.btn-danger {
  background: var(--red-bg);
  color: var(--red);
  border: 1px solid rgba(239,68,68,0.2);
}
.btn-danger:hover { background: rgba(239,68,68,0.15); }
.btn-sm { font-size: 0.75rem; padding: 6px 12px; }
.btn-group { display: flex; gap: 8px; }

/* ─── Forms ────────────────────────────── */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.form-group.full { grid-column: 1 / -1; }
.form-group label {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--muted);
}
.form-group input,
.form-group textarea,
.form-group select {
  font-family: 'Inter', sans-serif;
  font-size: 0.9rem;
  padding: 10px 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  outline: none;
  transition: border-color 0.15s;
}
.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  border-color: var(--accent);
}
.form-group textarea { resize: vertical; min-height: 80px; }
.form-group select option { background: var(--surface); }

/* ─── Prospect Table ───────────────────── */
.prospect-list { margin-top: 24px; }
.prospect-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  margin-bottom: 12px;
  overflow: hidden;
}
.prospect-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  cursor: pointer;
  transition: background 0.15s;
}
.prospect-header:hover { background: var(--surface-hover); }
.prospect-info h4 {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 2px;
}
.prospect-info p {
  font-size: 0.8rem;
  color: var(--muted);
}
.prospect-meta {
  display: flex;
  align-items: center;
  gap: 12px;
}
.prospect-emails {
  padding: 0 20px 16px;
  display: none;
}
.prospect-emails.open { display: block; }
.email-item {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 8px;
}
.email-step {
  font-size: 0.7rem;
  color: var(--accent);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 8px;
}
.email-subject {
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 8px;
}
.email-body {
  font-size: 0.85rem;
  color: var(--muted);
  line-height: 1.7;
  white-space: pre-wrap;
}
.email-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

/* ─── Research Summary ─────────────────── */
.research-box {
  background: var(--accent-glow);
  border: 1px solid rgba(99,102,241,0.2);
  border-radius: 8px;
  padding: 12px 16px;
  margin: 0 20px 16px;
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.6;
}
.research-box strong { color: var(--accent); }

/* ─── Empty State ──────────────────────── */
.empty-state {
  text-align: center;
  padding: 80px 20px;
}
.empty-state h3 {
  font-size: 1.3rem;
  margin-bottom: 12px;
}
.empty-state p {
  color: var(--muted);
  margin-bottom: 32px;
  max-width: 400px;
  margin-left: auto;
  margin-right: auto;
}

/* ─── Loading ──────────────────────────── */
.loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px;
  gap: 16px;
}
.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-text {
  font-size: 0.85rem;
  color: var(--muted);
}

/* ─── Back Link ────────────────────────── */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.85rem;
  margin-bottom: 24px;
  transition: color 0.15s;
}
.back-link:hover { color: var(--text); }

/* ─── Campaign Detail Header ───────────── */
.campaign-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 32px;
}
.campaign-header h1 {
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -0.5px;
}
.icp-summary {
  display: flex;
  gap: 16px;
  margin-top: 12px;
  flex-wrap: wrap;
}
.icp-tag {
  font-size: 0.75rem;
  color: var(--muted);
  background: var(--surface);
  padding: 4px 12px;
  border-radius: 100px;
  border: 1px solid var(--border);
}

/* ─── Section Divider ──────────────────── */
.section-title-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}
.section-title-row h2 {
  font-size: 1.1rem;
  font-weight: 600;
}

/* ─── Toast ────────────────────────────── */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 20px;
  font-size: 0.85rem;
  z-index: 1000;
  animation: slideUp 0.3s ease;
  box-shadow: 0 8px 32px rgba(0,0,0,0.3);
}
.toast.success { border-color: rgba(34,197,94,0.3); }
.toast.error { border-color: rgba(239,68,68,0.3); }
@keyframes slideUp {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* ─── Modal ────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 24px;
}
.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 32px;
  max-width: 560px;
  width: 100%;
  max-height: 80vh;
  overflow-y: auto;
}
.modal h3 {
  font-size: 1.2rem;
  margin-bottom: 20px;
}

/* ─── Responsive ───────────────────────── */
@media (max-width: 768px) {
  .stats-row { grid-template-columns: repeat(2, 1fr); }
  .form-grid { grid-template-columns: 1fr; }
  .card-grid { grid-template-columns: 1fr; }
  .campaign-header { flex-direction: column; gap: 16px; }
  .nav-links { gap: 4px; }
  .nav-link { padding: 8px 12px; font-size: 0.8rem; }
}

@media (max-width: 480px) {
  .stats-row { grid-template-columns: 1fr; }
  main { padding: 20px 16px 60px; }
}
