/* === Design Tokens (from landing page) === */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --bg: #06060a;
  --surface: #0d0d14;
  --surface-hover: #12121e;
  --border: #1a1a2e;
  --border-light: #252540;
  --text: #e8e8ed;
  --text-dim: #8888a0;
  --text-muted: #555570;
  --accent: #6c5ce7;
  --accent-hover: #7d6ff0;
  --accent-light: #a29bfe;
  --accent-dim: rgba(108, 92, 231, 0.12);
  --green: #00d2a0;
  --green-dim: rgba(0, 210, 160, 0.12);
  --yellow: #ffd166;
  --yellow-dim: rgba(255, 209, 102, 0.12);
  --red: #ff6b6b;
  --red-dim: rgba(255, 107, 107, 0.12);
  --blue: #4ecdc4;
  --blue-dim: rgba(78, 205, 196, 0.12);
  --radius: 12px;
  --radius-sm: 8px;
  --radius-xs: 6px;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
}

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

h1, h2, h3, h4 { font-family: 'Space Grotesk', sans-serif; font-weight: 600; line-height: 1.2; }
a { color: var(--accent-light); text-decoration: none; }
a:hover { color: var(--accent); }

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

/* === Nav === */
nav {
  padding: 20px 0;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: rgba(6, 6, 10, 0.92);
  backdrop-filter: blur(12px);
  z-index: 100;
}
.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.logo {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.5px;
  color: var(--text);
  text-decoration: none;
}
.logo span { color: var(--accent-light); }

/* === Buttons === */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
  white-space: nowrap;
}
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.btn-primary {
  background: var(--accent);
  color: white;
}
.btn-primary:hover:not(:disabled) {
  background: var(--accent-hover);
  transform: translateY(-1px);
}
.btn-ghost {
  background: transparent;
  color: var(--text-dim);
  border: 1px solid var(--border);
}
.btn-ghost:hover:not(:disabled) {
  background: var(--surface-hover);
  color: var(--text);
  border-color: var(--border-light);
}
.btn-green {
  background: var(--green);
  color: #06060a;
}
.btn-green:hover:not(:disabled) {
  background: #00e6b0;
  transform: translateY(-1px);
}
.btn-sm {
  padding: 6px 14px;
  font-size: 0.8rem;
}
.btn-icon {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  padding: 4px;
  border-radius: var(--radius-xs);
  display: flex;
  align-items: center;
  justify-content: center;
}
.btn-icon:hover { color: var(--text); background: var(--surface-hover); }

/* === Status Badges === */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: 20px;
}
.badge-new { color: var(--text-dim); background: var(--surface-hover); }
.badge-researching, .badge-generating { color: var(--yellow); background: var(--yellow-dim); }
.badge-researched { color: var(--blue); background: var(--blue-dim); }
.badge-sequenced { color: var(--green); background: var(--green-dim); }
.badge-error { color: var(--red); background: var(--red-dim); }

.badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}
.badge-researching .badge-dot, .badge-generating .badge-dot {
  animation: pulse-dot 1.2s infinite;
}
@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

/* === Main Content === */
main { padding: 40px 0 80px; }

/* === Empty State === */
.empty-state {
  text-align: center;
  padding: 100px 24px;
}
.empty-icon {
  width: 80px;
  height: 80px;
  margin: 0 auto 24px;
  border-radius: 50%;
  background: var(--accent-dim);
  display: flex;
  align-items: center;
  justify-content: center;
}
.empty-state h2 {
  font-size: 1.5rem;
  margin-bottom: 8px;
}
.empty-state p {
  color: var(--text-dim);
  max-width: 400px;
  margin: 0 auto 28px;
  font-size: 0.95rem;
}

/* === Prospect Grid === */
.prospects-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}
.prospects-header h2 {
  font-size: 1.25rem;
}
.prospect-count {
  color: var(--text-dim);
  font-size: 0.875rem;
}

.prospect-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}

.prospect-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
}
.prospect-card:hover {
  border-color: var(--border-light);
  background: var(--surface-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}
.prospect-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 12px;
}
.prospect-card h3 {
  font-size: 1.05rem;
  font-weight: 600;
}
.prospect-card-url {
  color: var(--text-dim);
  font-size: 0.8rem;
  margin-top: 2px;
}
.prospect-card-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
  font-size: 0.8rem;
  color: var(--text-muted);
}
.prospect-card-industry {
  color: var(--text-dim);
}
.prospect-card-summary {
  color: var(--text-dim);
  font-size: 0.85rem;
  margin-top: 10px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* === Detail View === */
.detail-view {
  animation: fadeIn 0.2s ease;
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
.detail-back {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text-dim);
  font-size: 0.875rem;
  cursor: pointer;
  margin-bottom: 24px;
  background: none;
  border: none;
  font-family: inherit;
  padding: 6px 0;
}
.detail-back:hover { color: var(--text); }

.detail-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 32px;
  gap: 16px;
  flex-wrap: wrap;
}
.detail-header-info h1 {
  font-size: 1.75rem;
  margin-bottom: 4px;
}
.detail-header-url {
  color: var(--text-dim);
  font-size: 0.9rem;
}
.detail-header-actions {
  display: flex;
  gap: 10px;
  flex-shrink: 0;
}

/* === Section Cards === */
.section-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 20px;
  overflow: hidden;
}
.section-header {
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
}
.section-header h3 {
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  gap: 10px;
}
.section-body {
  padding: 20px;
}

/* Research Grid */
.research-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.research-item label {
  display: block;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}
.research-item p {
  font-size: 0.9rem;
  color: var(--text);
}
.research-full {
  grid-column: 1 / -1;
}
.research-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}
.research-tag {
  font-size: 0.78rem;
  padding: 3px 10px;
  border-radius: 20px;
  background: var(--accent-dim);
  color: var(--accent-light);
}

/* Contact Cards */
.contacts-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 4px;
}
.contact-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  min-width: 180px;
}
.contact-name { font-weight: 600; font-size: 0.875rem; }
.contact-title { color: var(--text-dim); font-size: 0.8rem; }

/* === Email Cards === */
.email-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
}
.email-card:last-child { margin-bottom: 0; }
.email-card-header {
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
}
.email-card-header:hover { background: var(--surface-hover); }
.email-card-title {
  display: flex;
  align-items: center;
  gap: 10px;
}
.email-number {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--accent-dim);
  color: var(--accent-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 600;
  flex-shrink: 0;
}
.email-subject {
  font-weight: 500;
  font-size: 0.9rem;
}
.email-type-label {
  font-size: 0.75rem;
  color: var(--text-muted);
}
.email-card-body {
  padding: 16px;
  white-space: pre-wrap;
  font-size: 0.875rem;
  line-height: 1.7;
  color: var(--text-dim);
  display: none;
}
.email-card-body.open { display: block; }
.email-copy-btn {
  font-size: 0.75rem;
  padding: 4px 10px;
}

/* === Loading States === */
.loading-spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  display: inline-block;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}
.loading-text {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text-dim);
  font-size: 0.875rem;
}
.skeleton {
  background: linear-gradient(90deg, var(--surface) 25%, var(--surface-hover) 50%, var(--surface) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}
@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* === Modal === */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 24px;
}
.modal-overlay.open {
  display: flex;
}
.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: 100%;
  max-width: 460px;
  animation: modalIn 0.2s ease;
}
@keyframes modalIn {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
}
.modal-header h3 {
  font-size: 1.1rem;
}

/* === Forms === */
.form-group {
  padding: 0 24px;
  margin-top: 20px;
}
.form-group label {
  display: block;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-dim);
  margin-bottom: 6px;
}
.label-dim { color: var(--text-muted); font-weight: 400; }
.form-group input {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: inherit;
  font-size: 0.9rem;
  transition: border-color 0.2s;
}
.form-group input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}
.form-group input::placeholder {
  color: var(--text-muted);
}
.form-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  padding: 20px 24px;
}

/* === Toast === */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.toast {
  padding: 12px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  box-shadow: var(--shadow);
  animation: toastIn 0.3s ease;
  max-width: 360px;
}
.toast-success { border-left: 3px solid var(--green); }
.toast-error { border-left: 3px solid var(--red); }
@keyframes toastIn {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: translateX(0); }
}

/* === Delete Confirm === */
.delete-zone {
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  margin-top: 20px;
}
.btn-danger {
  background: var(--red-dim);
  color: var(--red);
  border: 1px solid transparent;
}
.btn-danger:hover:not(:disabled) {
  background: var(--red);
  color: white;
}

/* === Responsive === */
@media (max-width: 640px) {
  .research-grid { grid-template-columns: 1fr; }
  .prospect-grid { grid-template-columns: 1fr; }
  .detail-header { flex-direction: column; }
  .detail-header-actions { width: 100%; }
  .detail-header-actions .btn { flex: 1; justify-content: center; }
}
