/* ============================================================
   DealPilot App UI — dark theme, matches landing page tokens
   ============================================================ */

/* === App shell === */
.app-body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  min-height: 100vh;
}

/* === Nav === */
.app-nav {
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.app-nav-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
  height: 60px;
  display: flex;
  align-items: center;
  gap: 32px;
}

.app-logo {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 20px;
  color: var(--fg);
  text-decoration: none;
  letter-spacing: -0.5px;
}
.app-logo span { color: var(--accent); }

.app-nav-links {
  display: flex;
  gap: 4px;
  flex: 1;
}

.app-nav-link {
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 14px;
  color: var(--fg-muted);
  text-decoration: none;
  transition: all 0.15s;
}
.app-nav-link:hover { background: var(--bg-card); color: var(--fg); }
.app-nav-link.active { background: var(--bg-card); color: var(--fg); font-weight: 500; }

.btn-sm {
  padding: 6px 14px;
  font-size: 13px;
}

/* === Main === */
.app-main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 40px 24px;
}

.app-page-header {
  margin-bottom: 32px;
}
.app-page-title {
  font-family: var(--font-heading);
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.5px;
  margin-bottom: 6px;
}
.app-page-sub { color: var(--fg-muted); font-size: 15px; }

/* === Buttons === */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  text-decoration: none;
  border: none;
}
.btn-primary {
  background: var(--accent);
  color: #0a0a0c;
}
.btn-primary:hover { background: var(--accent-bright); }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }

.btn-outline {
  background: transparent;
  color: var(--fg);
  border: 1px solid var(--border);
}
.btn-outline:hover { border-color: rgba(255,255,255,0.15); background: var(--bg-card); }

.btn-lg { padding: 14px 28px; font-size: 15px; }

/* === Stats row === */
.stat-row {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 32px;
}
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px 24px;
  flex: 1;
  min-width: 120px;
}
.stat-card-num {
  font-family: var(--font-heading);
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -1px;
  line-height: 1;
  margin-bottom: 6px;
}
.stat-card-num.accent { color: var(--accent); }
.stat-card-label { font-size: 13px; color: var(--fg-muted); }

/* === Quick actions === */
.quick-actions {
  display: flex;
  gap: 12px;
  margin-bottom: 40px;
}

/* === Section blocks === */
.section-block {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 24px;
}
.section-block-title {
  font-family: var(--font-heading);
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 20px;
}

/* === Data table === */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.data-table th {
  text-align: left;
  padding: 8px 12px;
  color: var(--fg-muted);
  font-weight: 500;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border);
}
.data-table td {
  padding: 12px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.data-table tr:last-child td { border-bottom: none; }
.fw-medium { font-weight: 500; }
.muted { color: var(--fg-muted); }
.table-link { color: var(--accent); background: none; border: none; cursor: pointer; font-size: 13px; padding: 0; margin-right: 8px; }
.accent-link { color: var(--accent-bright); }

/* === Status badges === */
.status-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.status-draft { background: rgba(255,255,255,0.08); color: var(--fg-muted); }
.status-sent { background: rgba(212,148,58,0.15); color: var(--accent); }
.status-new { background: rgba(255,255,255,0.06); color: var(--fg-muted); }
.status-contacted { background: rgba(212,148,58,0.12); color: var(--accent); }

/* === Search form === */
.search-form-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 28px;
  margin-bottom: 32px;
}
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-label { font-size: 13px; font-weight: 500; color: var(--fg-muted); }
.form-input {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 14px;
  transition: border-color 0.15s;
}
.form-input:focus { outline: none; border-color: var(--accent); }
.form-input option { background: var(--bg-elevated); }

/* === Prospect cards === */
.search-results { margin-top: 8px; }
.results-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.prospects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}
.prospect-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  transition: border-color 0.15s;
}
.prospect-card:hover { border-color: rgba(212,148,58,0.25); }
.prospect-card-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}
.prospect-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--accent-glow);
  border: 1px solid rgba(212,148,58,0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-heading);
  font-weight: 700;
  color: var(--accent);
  flex-shrink: 0;
}
.prospect-name { font-weight: 600; font-size: 15px; }
.prospect-role { font-size: 13px; color: var(--fg-muted); }
.prospect-company { font-weight: 500; margin-bottom: 10px; }
.prospect-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.prospect-tag {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px 8px;
  font-size: 11px;
  color: var(--fg-muted);
}
.prospect-context { font-size: 13px; color: var(--fg-muted); line-height: 1.5; margin-bottom: 10px; }
.prospect-email { font-size: 12px; color: var(--accent); }

/* === Campaign blocks === */
.campaigns-list { display: flex; flex-direction: column; gap: 12px; }
.campaign-block {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}
.campaign-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  cursor: pointer;
  transition: background 0.15s;
}
.campaign-header:hover { background: var(--bg-elevated); }
.campaign-info { display: flex; align-items: center; gap: 12px; }
.campaign-name { font-weight: 600; font-size: 15px; }
.campaign-stats { display: flex; align-items: center; gap: 16px; font-size: 13px; color: var(--fg-muted); }
.accent-text { color: var(--accent); }
.expand-icon { color: var(--fg-muted); font-size: 12px; }
.campaign-emails { padding: 0 20px 20px; }

/* === Modal === */
.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.7);
}
.modal-content {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  width: 100%;
  max-width: 600px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
}
.modal-header h3 { font-family: var(--font-heading); font-size: 16px; font-weight: 600; }
.modal-close { background: none; border: none; color: var(--fg-muted); font-size: 20px; cursor: pointer; line-height: 1; }
.modal-body { padding: 20px 24px; overflow-y: auto; flex: 1; }
.email-preview-meta { margin-bottom: 16px; font-size: 14px; display: flex; flex-direction: column; gap: 4px; color: var(--fg-muted); }
.email-preview-body { font-size: 14px; line-height: 1.7; white-space: pre-wrap; color: var(--fg); }
.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 24px;
  border-top: 1px solid var(--border);
}

/* === States === */
.hidden { display: none !important; }
.empty-state { padding: 24px; color: var(--fg-muted); font-size: 14px; }
.empty-state a { color: var(--accent); }
.empty-state-lg {
  text-align: center;
  padding: 80px 24px;
  color: var(--fg-muted);
}
.empty-icon { font-size: 48px; margin-bottom: 16px; }
.empty-state-lg h2 { font-family: var(--font-heading); font-size: 20px; color: var(--fg); margin-bottom: 10px; }
.empty-state-lg p { margin-bottom: 24px; }
.empty-inline { padding: 16px; color: var(--fg-muted); font-size: 13px; }
.error-banner {
  background: rgba(220,38,38,0.1);
  border: 1px solid rgba(220,38,38,0.3);
  border-radius: 8px;
  padding: 12px 16px;
  color: #f87171;
  font-size: 14px;
  margin-top: 12px;
}
.error-inline { color: #f87171; font-size: 13px; padding: 12px; }
.loading-spinner { color: var(--fg-muted); font-size: 13px; padding: 16px; }
