/* ── Design tokens (matches landing page) ── */
:root {
  --bg: #0a0a0f;
  --bg-raised: #12121a;
  --bg-card: #1a1a26;
  --bg-input: #0e0e18;
  --fg: #e8e8ed;
  --fg-muted: #8888a0;
  --fg-subtle: #5555708;
  --accent: #00e87b;
  --accent-dim: rgba(0, 232, 123, 0.12);
  --accent-glow: rgba(0, 232, 123, 0.25);
  --border: rgba(255, 255, 255, 0.06);
  --border-hover: rgba(255, 255, 255, 0.12);
  --radius: 12px;
  --radius-sm: 8px;
  --font-display: 'Space Grotesk', sans-serif;
  --font-body: 'DM Sans', sans-serif;

  /* Status colors */
  --status-new: #8888a0;
  --status-contacted: #4f9cf9;
  --status-replied: #a78bfa;
  --status-meeting: #00e87b;
  --status-closed: #22c55e;
  --status-not-interested: #ef4444;
}

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

body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Shared Components ── */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-family: var(--font-display);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: opacity 0.15s, transform 0.1s;
  text-decoration: none;
}
.btn:hover { opacity: 0.88; transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }

.btn-primary { background: var(--accent); color: #000; }
.btn-secondary {
  background: transparent;
  color: var(--fg);
  border: 1px solid var(--border-hover);
}
.btn-secondary:hover { border-color: var(--accent); color: var(--accent); }
.btn-full { width: 100%; justify-content: center; }
.btn-large { padding: 14px 28px; font-size: 1rem; }
.btn-link { background: none; border: none; color: var(--accent); cursor: pointer; font-family: var(--font-body); font-size: inherit; padding: 0; }

.alert { padding: 12px 16px; border-radius: var(--radius-sm); margin-bottom: 20px; font-size: 0.875rem; }
.alert-error { background: rgba(239,68,68,0.12); border: 1px solid rgba(239,68,68,0.3); color: #fca5a5; }

.logo-text {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--fg);
  letter-spacing: -0.02em;
}
.logo-text span { color: var(--accent); }

/* ── Auth Page ── */

.auth-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; }

.auth-container {
  width: 100%;
  max-width: 440px;
  padding: 24px;
}

.auth-logo {
  text-align: center;
  margin-bottom: 32px;
}

.auth-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 40px;
}

.auth-card h1 {
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: 8px;
  letter-spacing: -0.02em;
}

.auth-subtitle { color: var(--fg-muted); margin-bottom: 32px; }

.auth-form { display: flex; flex-direction: column; gap: 20px; }

.auth-note { margin-top: 16px; font-size: 0.75rem; color: var(--fg-muted); text-align: center; }

/* ── Onboarding Page ── */

.onboarding-page { min-height: 100vh; background: var(--bg); }

.onboarding-container { max-width: 600px; margin: 0 auto; padding: 40px 24px; }

.onboarding-header { margin-bottom: 40px; }

.onboarding-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 48px;
}

.onboarding-step {
  font-family: var(--font-display);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  color: var(--accent);
  margin-bottom: 12px;
}

.onboarding-card h1 {
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: 8px;
  letter-spacing: -0.02em;
}

.onboarding-subtitle { color: var(--fg-muted); margin-bottom: 36px; }

.onboarding-form { display: flex; flex-direction: column; gap: 24px; }

/* ── Form Fields ── */

.field-group { display: flex; flex-direction: column; gap: 6px; }
.field-group label { font-size: 0.875rem; font-weight: 500; color: var(--fg); }
.field-hint { font-size: 0.75rem; color: var(--fg-muted); }

input[type="text"],
input[type="email"],
textarea,
select {
  background: var(--bg-input);
  border: 1px solid var(--border-hover);
  border-radius: var(--radius-sm);
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 0.9375rem;
  padding: 12px 16px;
  width: 100%;
  outline: none;
  transition: border-color 0.15s;
}
input:focus, textarea:focus, select:focus { border-color: var(--accent); }
input::placeholder, textarea::placeholder { color: var(--fg-muted); }

textarea { resize: vertical; min-height: 100px; }

/* ── App Layout ── */

.app-page {
  display: grid;
  grid-template-columns: 220px 1fr;
  min-height: 100vh;
}

/* ── Sidebar ── */

.sidebar {
  background: var(--bg-raised);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 24px 16px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.sidebar-logo { padding: 8px 12px 24px; }

.sidebar-nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--fg-muted);
  font-size: 0.875rem;
  font-weight: 500;
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}
.nav-item:hover { background: var(--bg-card); color: var(--fg); text-decoration: none; }
.nav-item.active { background: var(--accent-dim); color: var(--accent); }

.sidebar-footer { border-top: 1px solid var(--border); padding-top: 16px; }
.sidebar-user { display: flex; flex-direction: column; gap: 4px; padding: 4px 12px; }
.user-email { font-size: 0.75rem; color: var(--fg-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── Main Content ── */

.main-content { padding: 40px 48px; overflow-y: auto; }

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 32px;
}
.page-header h1 {
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.page-subtitle { color: var(--fg-muted); font-size: 0.875rem; margin-top: 4px; }

/* ── Stats Row ── */

.stats-row {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 12px;
  margin-bottom: 32px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.stat-val {
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 700;
}
.stat-label { font-size: 0.75rem; color: var(--fg-muted); }

.stat-new { color: var(--fg-muted); }
.stat-contacted { color: var(--status-contacted); }
.stat-replied { color: var(--status-replied); }
.stat-meeting { color: var(--status-meeting); }
.stat-closed { color: var(--status-closed); }

/* ── Table Actions ── */

.table-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.table-count { color: var(--fg-muted); font-size: 0.875rem; }
.table-btns { display: flex; gap: 8px; }

/* ── Prospect Table ── */

.prospect-table-wrap {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.prospect-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.prospect-table th {
  background: var(--bg-raised);
  color: var(--fg-muted);
  font-weight: 600;
  font-size: 0.75rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.prospect-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.prospect-table tr:last-child td { border-bottom: none; }
.prospect-table tr:hover td { background: rgba(255,255,255,0.02); }

.prospect-name { font-weight: 500; color: var(--fg); }
.prospect-type { color: var(--fg-muted); font-size: 0.75rem; margin-top: 2px; }
.prospect-contact { color: var(--fg); }
.prospect-email-text { color: var(--fg-muted); font-size: 0.75rem; }

/* Status select */
.status-select {
  padding: 5px 10px;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 100px;
  cursor: pointer;
  width: auto;
}
.status-new { border-color: rgba(136,136,160,0.4); color: var(--status-new); }
.status-contacted { border-color: rgba(79,156,249,0.4); color: var(--status-contacted); }
.status-replied { border-color: rgba(167,139,250,0.4); color: var(--status-replied); }
.status-meeting_booked { border-color: rgba(0,232,123,0.4); color: var(--status-meeting); }
.status-closed { border-color: rgba(34,197,94,0.4); color: var(--status-closed); }
.status-not_interested { border-color: rgba(239,68,68,0.4); color: var(--status-not-interested); }

/* Email badge */
.email-badge {
  font-size: 0.75rem;
  color: var(--fg-muted);
  padding: 3px 8px;
  border-radius: 100px;
  border: 1px solid var(--border);
}
.email-badge.has-emails { color: var(--accent); border-color: var(--accent-dim); background: var(--accent-dim); }

/* Action buttons */
.action-btns { display: flex; gap: 6px; }
.btn-icon {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--fg-muted);
  width: 30px;
  height: 30px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.875rem;
  transition: border-color 0.15s, color 0.15s;
}
.btn-icon:hover { border-color: var(--accent); color: var(--accent); }
.btn-icon:disabled { opacity: 0.4; cursor: not-allowed; }

/* ── Empty State ── */

.empty-state {
  text-align: center;
  padding: 80px 24px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.empty-icon { font-size: 3rem; margin-bottom: 16px; }
.empty-state h2 {
  font-family: var(--font-display);
  font-size: 1.5rem;
  margin-bottom: 8px;
}
.empty-state p { color: var(--fg-muted); margin-bottom: 24px; max-width: 400px; margin-left: auto; margin-right: auto; }

/* ── Drawer ── */

.drawer { position: fixed; inset: 0; z-index: 100; pointer-events: none; }
.drawer.open { pointer-events: auto; }

.drawer-overlay {
  position: absolute; inset: 0;
  background: rgba(0,0,0,0.6);
  opacity: 0;
  transition: opacity 0.25s;
}
.drawer.open .drawer-overlay { opacity: 1; }

.drawer-panel {
  position: absolute;
  right: 0; top: 0; bottom: 0;
  width: 520px;
  background: var(--bg-raised);
  border-left: 1px solid var(--border);
  overflow-y: auto;
  padding: 32px;
  transform: translateX(100%);
  transition: transform 0.25s ease;
}
.drawer.open .drawer-panel { transform: translateX(0); }

.drawer-close {
  position: absolute; top: 20px; right: 20px;
  background: none; border: none;
  color: var(--fg-muted); font-size: 1.1rem;
  cursor: pointer; padding: 8px;
  border-radius: var(--radius-sm);
  transition: color 0.15s;
}
.drawer-close:hover { color: var(--fg); }

.drawer-prospect h2 {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 4px;
  padding-right: 40px;
}
.drawer-type { color: var(--fg-muted); margin-bottom: 24px; }

.drawer-section { margin-bottom: 28px; }
.drawer-section h3 {
  font-family: var(--font-display);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--fg-muted);
  margin-bottom: 8px;
}
.drawer-section p { color: var(--fg); font-size: 0.9375rem; line-height: 1.6; }
.detail-email a { color: var(--accent); }
.good-fit-text { color: var(--accent); font-size: 0.875rem; }

.emails-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.emails-header h3 { margin-bottom: 0; }

.email-draft {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px;
  margin-bottom: 12px;
}
.draft-subject { font-weight: 600; margin-bottom: 10px; font-size: 0.875rem; }
.draft-body {
  font-family: var(--font-body);
  font-size: 0.8125rem;
  color: var(--fg-muted);
  white-space: pre-wrap;
  line-height: 1.7;
  border-top: 1px solid var(--border);
  padding-top: 10px;
}
.draft-meta { font-size: 0.75rem; color: var(--fg-muted); margin-top: 8px; opacity: 0.6; }

.no-emails { color: var(--fg-muted); font-size: 0.875rem; }

.notes-textarea {
  min-height: 80px;
  font-size: 0.875rem;
}

.loading { color: var(--fg-muted); padding: 40px; text-align: center; }
.error-text { color: #fca5a5; padding: 16px; }

/* ── Toast ── */

.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 500;
  background: var(--bg-card);
  border: 1px solid var(--border);
  transform: translateY(20px);
  opacity: 0;
  transition: transform 0.25s, opacity 0.25s;
  pointer-events: none;
  z-index: 200;
}
.toast-show { transform: translateY(0); opacity: 1; }
.toast-success { border-color: var(--accent); color: var(--accent); }
.toast-error { border-color: rgba(239,68,68,0.4); color: #fca5a5; }

/* ── Responsive ── */

@media (max-width: 900px) {
  .stats-row { grid-template-columns: repeat(3, 1fr); }
  .main-content { padding: 24px; }
  .drawer-panel { width: 100%; }
}

@media (max-width: 640px) {
  .app-page { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .stats-row { grid-template-columns: repeat(2, 1fr); }
  .onboarding-card { padding: 24px; }
  .auth-card { padding: 28px; }
}
