/* ── App shell ──────────────────────────────────────── */
.app-shell {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.app-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 2rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-brand {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--fg);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.nav-brand .brand-dot {
  width: 8px;
  height: 8px;
  background: var(--accent);
  border-radius: 50%;
  display: inline-block;
}

.nav-links {
  display: flex;
  gap: 0.25rem;
}

.nav-link {
  padding: 0.5rem 1rem;
  border-radius: 8px;
  color: var(--fg-muted);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  transition: color 0.15s, background 0.15s;
}

.nav-link:hover,
.nav-link.active {
  color: var(--fg);
  background: var(--bg-elevated);
}

.nav-link.active {
  color: var(--accent-light);
}

/* ── Buttons ─────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1.2rem;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  border: none;
  text-decoration: none;
  transition: all 0.15s;
  white-space: nowrap;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-primary:hover:not(:disabled) {
  background: var(--accent-light);
  transform: translateY(-1px);
}

.btn-ghost {
  background: transparent;
  color: var(--fg-muted);
  border: 1px solid var(--border);
}

.btn-ghost:hover:not(:disabled) {
  background: var(--bg-elevated);
  color: var(--fg);
}

.btn-sm {
  padding: 0.35rem 0.75rem;
  font-size: 0.8rem;
}

.btn-danger {
  background: transparent;
  color: #f87171;
  border: 1px solid rgba(248, 113, 113, 0.3);
}

.btn-danger:hover:not(:disabled) {
  background: rgba(248, 113, 113, 0.1);
}

/* ── Page layout ─────────────────────────────────────── */
.page {
  max-width: 1100px;
  margin: 0 auto;
  padding: 2.5rem 2rem;
  width: 100%;
  display: none;
}

.page.active {
  display: block;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 2rem;
}

.page-title {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

/* ── Cards ───────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem;
}

.card + .card {
  margin-top: 1rem;
}

/* ── Form elements ───────────────────────────────────── */
.form-row {
  display: flex;
  gap: 1rem;
  align-items: flex-end;
  margin-bottom: 1rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  flex: 1;
}

.form-group label {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--fg-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.form-input {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--fg);
  font-size: 0.9rem;
  padding: 0.6rem 0.9rem;
  outline: none;
  font-family: var(--font-body);
  transition: border-color 0.15s;
}

.form-input:focus {
  border-color: rgba(232, 122, 46, 0.5);
}

/* ── Status badges ────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem 0.6rem;
  border-radius: 100px;
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.02em;
}

.badge-pending {
  background: rgba(255, 255, 255, 0.07);
  color: var(--fg-muted);
}

.badge-researching {
  background: rgba(59, 130, 246, 0.15);
  color: #93c5fd;
}

.badge-done {
  background: rgba(34, 197, 94, 0.15);
  color: #86efac;
}

.badge-failed {
  background: rgba(239, 68, 68, 0.15);
  color: #fca5a5;
}

.badge-sent {
  background: rgba(34, 197, 94, 0.15);
  color: #86efac;
}

/* ── Prospect list ────────────────────────────────────── */
.prospect-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.prospect-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.25rem 1.5rem;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.prospect-item:hover {
  border-color: rgba(232, 122, 46, 0.2);
}

.prospect-info {
  flex: 1;
  min-width: 0;
}

.prospect-domain {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 0.3rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.prospect-meta {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.prospect-meta-item {
  font-size: 0.8rem;
  color: var(--fg-muted);
}

.prospect-meta-item .label {
  opacity: 0.7;
  margin-right: 0.2rem;
}

.prospect-actions {
  display: flex;
  gap: 0.5rem;
  flex-shrink: 0;
}

/* ── Email queue list ─────────────────────────────────── */
.email-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.email-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.25rem 1.5rem;
}

.email-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.5rem;
}

.email-subject {
  font-weight: 600;
  font-size: 0.95rem;
  flex: 1;
}

.email-to {
  font-size: 0.8rem;
  color: var(--fg-muted);
  margin-bottom: 0.75rem;
}

.email-preview {
  font-size: 0.85rem;
  color: var(--fg-muted);
  line-height: 1.6;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ── Stats bar ───────────────────────────────────────── */
.stats-bar {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.25rem;
}

.stat-value {
  font-family: var(--font-display);
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--accent);
  line-height: 1;
  margin-bottom: 0.4rem;
}

.stat-label {
  font-size: 0.8rem;
  color: var(--fg-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ── Settings ────────────────────────────────────────── */
.settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  align-items: start;
}

/* ── Toast ───────────────────────────────────────────── */
.toast-container {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.toast {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.9rem 1.25rem;
  font-size: 0.875rem;
  min-width: 280px;
  animation: slideIn 0.2s ease;
}

.toast.success { border-color: rgba(34, 197, 94, 0.4); }
.toast.error   { border-color: rgba(239, 68, 68, 0.4); color: #fca5a5; }

@keyframes slideIn {
  from { transform: translateX(20px); opacity: 0; }
  to   { transform: translateX(0); opacity: 1; }
}

/* ── Spinner ─────────────────────────────────────────── */
.spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ── Empty states ─────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 4rem 2rem;
  color: var(--fg-muted);
}

.empty-state .empty-icon {
  font-size: 2.5rem;
  margin-bottom: 1rem;
  opacity: 0.5;
}

.empty-state p {
  font-size: 0.95rem;
}

/* ── Modal (for email preview) ───────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

.modal-overlay.hidden { display: none; }

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  max-width: 640px;
  width: 100%;
  max-height: 80vh;
  overflow-y: auto;
  padding: 2rem;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.modal-title {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 600;
}

.modal-body {
  font-size: 0.9rem;
  line-height: 1.7;
  color: var(--fg-muted);
  white-space: pre-wrap;
}

.modal-footer {
  margin-top: 1.5rem;
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
}

/* ── Landing page hero CTA ───────────────────────────── */
.hero-cta {
  margin-top: 2.5rem;
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

.btn-hero {
  padding: 0.85rem 2rem;
  border-radius: 10px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  text-decoration: none;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-hero-primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 0 30px var(--accent-glow);
}

.btn-hero-primary:hover {
  background: var(--accent-light);
  transform: translateY(-2px);
  box-shadow: 0 0 40px rgba(232, 122, 46, 0.3);
}

.btn-hero-ghost {
  background: transparent;
  color: var(--fg-muted);
  border: 1px solid var(--border);
}

.btn-hero-ghost:hover {
  background: var(--bg-elevated);
  color: var(--fg);
}

/* ── Responsive ──────────────────────────────────────── */
@media (max-width: 768px) {
  .stats-bar { grid-template-columns: repeat(2, 1fr); }
  .settings-grid { grid-template-columns: 1fr; }
  .prospect-item { flex-direction: column; }
  .form-row { flex-direction: column; }
  .app-nav { padding: 0.75rem 1rem; }
  .page { padding: 1.5rem 1rem; }
  .nav-links { gap: 0; }
  .nav-link { padding: 0.5rem 0.6rem; font-size: 0.82rem; }
}

@media (max-width: 480px) {
  .stats-bar { grid-template-columns: 1fr 1fr; gap: 0.75rem; }
  .stat-value { font-size: 1.4rem; }
}
