/* ===== APP SHELL ===== */
.app-body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

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

.nav-brand {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--accent);
  text-decoration: none;
  letter-spacing: -0.01em;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 24px;
}

.nav-link {
  font-size: 0.9rem;
  color: var(--fg-muted);
  text-decoration: none;
  transition: color 0.15s;
}

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

.app-main {
  flex: 1;
  padding: 40px 32px;
  max-width: 1100px;
  width: 100%;
  margin: 0 auto;
}

/* ===== PAGE LAYOUT ===== */
.app-page {}

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 32px;
  gap: 16px;
}

.page-title {
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--fg);
}

.page-sub {
  font-size: 0.9rem;
  color: var(--fg-muted);
  margin-top: 4px;
}

.breadcrumb {
  font-size: 0.8rem;
  color: var(--fg-muted);
  margin-bottom: 6px;
}

.breadcrumb a {
  color: var(--accent);
  text-decoration: none;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

/* ===== BUTTONS ===== */
.btn-primary {
  background: var(--accent);
  color: #0a0a0c;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.875rem;
  padding: 10px 20px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: opacity 0.15s;
}

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

.btn-accent {
  background: rgba(212,168,83,0.15);
  color: var(--accent);
  border: 1px solid rgba(212,168,83,0.3);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.875rem;
  padding: 10px 20px;
  border-radius: 8px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s;
}

.btn-accent:hover { background: rgba(212,168,83,0.25); }
.btn-accent:disabled, .btn-accent.btn-loading { opacity: 0.6; cursor: not-allowed; }

.btn-ghost {
  background: transparent;
  color: var(--fg-muted);
  border: 1px solid var(--border);
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 0.875rem;
  padding: 10px 20px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-ghost:hover { color: var(--fg); border-color: rgba(255,255,255,0.15); }
.btn-ghost:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-send {
  background: #1a3a1a;
  color: #4ade80;
  border: 1px solid rgba(74,222,128,0.2);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.875rem;
  padding: 10px 20px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-send:hover { background: #1f4a1f; }

.btn-sm { padding: 6px 12px; font-size: 0.8rem; }

/* ===== STATUS BADGES ===== */
.status-badge {
  display: inline-block;
  font-family: var(--font-display);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 6px;
}

.status-draft      { background: rgba(255,255,255,0.06); color: var(--fg-muted); }
.status-pending    { background: rgba(255,255,255,0.06); color: var(--fg-muted); }
.status-processing { background: rgba(212,168,83,0.15); color: var(--accent); }
.status-drafted    { background: rgba(59,130,246,0.15); color: #93c5fd; }
.status-sent       { background: rgba(74,222,128,0.12); color: #4ade80; }
.status-failed     { background: rgba(239,68,68,0.12); color: #f87171; }
.status-active     { background: rgba(74,222,128,0.12); color: #4ade80; }

/* ===== CAMPAIGN GRID ===== */
.campaign-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.campaign-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  text-decoration: none;
  display: block;
  transition: border-color 0.15s, transform 0.1s;
}

.campaign-card:hover {
  border-color: rgba(212,168,83,0.3);
  transform: translateY(-1px);
}

.campaign-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.campaign-name {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 600;
  color: var(--fg);
  line-height: 1.3;
}

.campaign-stats {
  display: flex;
  gap: 20px;
  margin-bottom: 12px;
}

.campaign-stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.stat-n {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--accent);
}

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

.campaign-date {
  font-size: 0.78rem;
  color: var(--fg-muted);
}

/* ===== TABS ===== */
.tab-nav {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 28px;
}

.tab-btn {
  background: none;
  border: none;
  color: var(--fg-muted);
  font-family: var(--font-display);
  font-size: 0.9rem;
  font-weight: 500;
  padding: 10px 16px;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: all 0.15s;
}

.tab-btn.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.tab-btn:hover:not(.active) { color: var(--fg); }

/* ===== UPLOAD SECTION ===== */
.upload-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  margin-bottom: 28px;
}

.section-title {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 600;
  color: var(--fg);
  margin-bottom: 6px;
}

.section-sub {
  font-size: 0.85rem;
  color: var(--fg-muted);
  margin-bottom: 20px;
}

.upload-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

.csv-input {
  width: 100%;
  height: 140px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--fg);
  font-family: 'Courier New', monospace;
  font-size: 0.8rem;
  padding: 12px;
  resize: vertical;
  margin-bottom: 12px;
}

.csv-input:focus {
  outline: none;
  border-color: rgba(212,168,83,0.4);
}

.upload-actions {
  display: flex;
  gap: 10px;
  margin-bottom: 10px;
}

.csv-preview { font-size: 0.85rem; margin-top: 8px; }
.parse-ok { color: #4ade80; }
.parse-error { color: #f87171; }

.manual-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.form-section-title {
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--fg-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 4px;
}

/* ===== FORM ELEMENTS ===== */
.form-group { margin-bottom: 16px; }

.form-label {
  display: block;
  font-family: var(--font-display);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--fg-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 6px;
}

.form-input {
  width: 100%;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 0.9rem;
  padding: 10px 14px;
}

.form-input:focus {
  outline: none;
  border-color: rgba(212,168,83,0.4);
}

.form-textarea {
  width: 100%;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 0.9rem;
  padding: 10px 14px;
  resize: vertical;
  line-height: 1.7;
}

.form-textarea:focus {
  outline: none;
  border-color: rgba(212,168,83,0.4);
}

/* ===== DATA TABLE ===== */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.data-table th {
  font-family: var(--font-display);
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--fg-muted);
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  text-align: left;
}

.data-table td {
  padding: 12px;
  border-bottom: 1px solid var(--border);
  color: var(--fg-muted);
}

.data-table tr:last-child td { border-bottom: none; }

.td-name { color: var(--fg); font-weight: 500; }
.td-email { color: var(--accent); }

/* ===== DRAFT GRID ===== */
.draft-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}

.draft-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  transition: border-color 0.15s;
}

.draft-card:hover { border-color: rgba(212,168,83,0.25); }
.draft-sent { border-color: rgba(74,222,128,0.15); }

.draft-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.draft-to {
  font-family: var(--font-display);
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--fg);
}

.draft-subject {
  font-size: 0.875rem;
  color: var(--fg);
  margin-bottom: 8px;
  font-style: italic;
}

.draft-preview {
  font-size: 0.8rem;
  color: var(--fg-muted);
  line-height: 1.5;
  margin-bottom: 14px;
}

/* ===== MODAL ===== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 24px;
}

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

.modal-wide { max-width: 680px; }

.modal-title {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--fg);
  margin-bottom: 20px;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 20px;
}

.draft-prospect-name {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--fg);
}

.draft-company {
  font-size: 0.85rem;
  color: var(--fg-muted);
  margin-top: 2px;
}

.modal-close {
  background: none;
  border: none;
  color: var(--fg-muted);
  cursor: pointer;
  font-size: 1rem;
  padding: 4px;
  flex-shrink: 0;
}

.modal-close:hover { color: var(--fg); }

.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 20px;
}

.research-notes {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px;
  margin: 16px 0;
}

.research-notes-label {
  font-family: var(--font-display);
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent);
  margin-bottom: 8px;
}

.research-notes-text {
  font-size: 0.82rem;
  color: var(--fg-muted);
  line-height: 1.65;
  white-space: pre-wrap;
}

/* ===== STATES ===== */
.empty-state {
  text-align: center;
  padding: 64px 24px;
  color: var(--fg-muted);
}

.empty-icon {
  font-size: 2rem;
  color: var(--accent);
  margin-bottom: 16px;
  opacity: 0.5;
}

.empty-state h3 {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--fg);
  margin-bottom: 8px;
}

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

.loading-state {
  text-align: center;
  padding: 40px;
  color: var(--fg-muted);
  font-size: 0.9rem;
}

/* ===== MOBILE ===== */
@media (max-width: 768px) {
  .app-main { padding: 24px 16px; }
  .app-nav { padding: 0 16px; }
  .page-header { flex-direction: column; align-items: flex-start; }
  .upload-grid { grid-template-columns: 1fr; }
  .draft-grid { grid-template-columns: 1fr; }
  .campaign-grid { grid-template-columns: 1fr; }
  .modal { padding: 20px; }
}
