/* Narrowcast App UI — dashboard styles, same design tokens as landing */

/* ---- App Shell ---- */
.app-shell {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background: var(--bg);
}

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

.app-brand {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--fg);
  letter-spacing: -0.02em;
}

.app-brand span {
  color: var(--accent);
}

#app-nav {
  display: flex;
  gap: 4px;
}

.nav-btn {
  background: none;
  border: none;
  color: var(--fg-muted);
  font-family: var(--font-body);
  font-size: 0.9rem;
  padding: 8px 16px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s;
}

.nav-btn:hover {
  background: rgba(255,255,255,0.05);
  color: var(--fg);
}

.nav-btn.active {
  background: rgba(99, 102, 241, 0.15);
  color: var(--accent);
}

.app-content {
  flex: 1;
  padding: 32px;
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
}

/* ---- Page header ---- */
.page-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 32px;
}

.page-header h2 {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  flex: 1;
}

/* ---- Buttons ---- */
.btn-primary {
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 10px 20px;
  border-radius: 8px;
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: opacity 0.15s;
}

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

.btn-outline {
  background: none;
  color: var(--fg);
  border: 1px solid var(--border);
  padding: 10px 20px;
  border-radius: 8px;
  font-family: var(--font-body);
  font-size: 0.9rem;
  cursor: pointer;
  transition: border-color 0.15s;
}

.btn-outline:hover { border-color: rgba(255,255,255,0.2); }

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

.btn-accent {
  background: rgba(99,102,241,0.15);
  color: var(--accent);
  border: 1px solid rgba(99,102,241,0.3);
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 0.8rem;
  cursor: pointer;
  transition: background 0.15s;
}

.btn-accent:hover { background: rgba(99,102,241,0.25); }

.btn-back {
  background: none;
  border: none;
  color: var(--fg-muted);
  font-size: 0.9rem;
  cursor: pointer;
  padding: 0;
}

.btn-back:hover { color: var(--fg); }

/* ---- Stats grid ---- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 16px;
  margin-bottom: 40px;
}

.stat-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  text-align: center;
}

.stat-card.accent {
  border-color: rgba(99,102,241,0.2);
  background: linear-gradient(135deg, rgba(99,102,241,0.08), rgba(99,102,241,0.02));
}

.stat-card-num {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 700;
  color: var(--fg);
}

.stat-card.accent .stat-card-num { color: var(--accent); }

.stat-card-label {
  font-size: 0.8rem;
  color: var(--fg-muted);
  margin-top: 4px;
}

/* ---- Activity / tables ---- */
.activity-section {
  margin-bottom: 40px;
}

.activity-section h3 {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 16px;
  color: var(--fg-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 0.8rem;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.data-table th {
  text-align: left;
  padding: 8px 16px;
  color: var(--fg-muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 500;
  border-bottom: 1px solid var(--border);
}

.data-table td {
  padding: 12px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.03);
}

.data-table tr:hover td { background: rgba(255,255,255,0.02); }

/* ---- Badges ---- */
.badge {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 500;
  padding: 3px 10px;
  border-radius: 100px;
  font-family: var(--font-display);
}

.badge-green  { background: rgba(34,197,94,0.15); color: var(--green); }
.badge-blue   { background: rgba(99,102,241,0.15); color: var(--accent); }
.badge-yellow { background: rgba(234,179,8,0.15);  color: #eab308; }
.badge-red    { background: rgba(239,68,68,0.15);   color: var(--red); }
.badge-gray   { background: rgba(255,255,255,0.06); color: var(--fg-muted); }

/* ---- Campaign list ---- */
.campaign-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.campaign-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  cursor: pointer;
  transition: border-color 0.15s;
}

.campaign-card:hover { border-color: rgba(99,102,241,0.3); }

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

.campaign-name {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 600;
}

.campaign-icp {
  color: var(--fg-muted);
  font-size: 0.9rem;
  margin-bottom: 12px;
}

.campaign-stats {
  display: flex;
  gap: 20px;
  font-size: 0.85rem;
  color: var(--fg-muted);
}

/* ---- Campaign detail ---- */
.icp-box {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px 20px;
  margin-bottom: 24px;
  font-size: 0.9rem;
  color: var(--fg-muted);
}

.icp-label {
  font-family: var(--font-display);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  margin-right: 12px;
}

.launch-panel {
  background: linear-gradient(135deg, rgba(99,102,241,0.08), rgba(99,102,241,0.02));
  border: 1px solid rgba(99,102,241,0.2);
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 32px;
}

.launch-panel h3 {
  font-family: var(--font-display);
  font-weight: 600;
  margin-bottom: 8px;
}

.launch-controls {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 16px;
}

.launch-controls label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.9rem;
  color: var(--fg-muted);
}

.launch-controls select {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--fg);
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 0.9rem;
}

/* ---- Prospects ---- */
.prospects-section h3 {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 16px;
}

.prospect-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.prospect-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
}

.prospect-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.prospect-name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1rem;
}

.prospect-title { font-size: 0.9rem; }

.prospect-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.prospect-company {
  font-size: 0.9rem;
  color: var(--fg);
  margin-bottom: 4px;
  font-weight: 500;
}

.prospect-email { font-size: 0.85rem; margin-bottom: 8px; }

.prospect-research {
  font-size: 0.9rem;
  color: var(--fg-muted);
  margin: 12px 0 8px;
  line-height: 1.6;
}

.signals {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.signal-chip {
  font-size: 0.78rem;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  border-radius: 100px;
  padding: 3px 12px;
  color: var(--fg-muted);
}

.email-preview {
  margin-top: 16px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
}

.email-subject {
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 12px;
  color: var(--fg-muted);
}

.email-body {
  font-family: var(--font-body);
  font-size: 0.88rem;
  white-space: pre-wrap;
  line-height: 1.7;
  color: var(--fg);
}

/* ---- Replies ---- */
.replies-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.reply-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
}

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

.reply-from {
  font-family: var(--font-display);
  font-weight: 600;
}

.reply-meta {
  display: flex;
  align-items: center;
  gap: 12px;
}

.reply-subject { font-size: 0.85rem; margin-bottom: 8px; }

.reply-body {
  font-size: 0.9rem;
  line-height: 1.65;
  color: var(--fg-muted);
  margin: 0 0 8px;
}

.classification-reason {
  font-size: 0.8rem;
  font-style: italic;
  margin-bottom: 12px;
}

.followup-panel {
  background: var(--bg);
  border: 1px solid rgba(99,102,241,0.2);
  border-radius: 8px;
  padding: 16px;
  margin-top: 12px;
}

.followup-label {
  font-family: var(--font-display);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  margin-bottom: 10px;
}

.followup-body {
  font-family: var(--font-body);
  font-size: 0.88rem;
  white-space: pre-wrap;
  line-height: 1.7;
  color: var(--fg);
  margin-bottom: 12px;
}

/* ---- Forms ---- */
.form-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 32px;
  max-width: 640px;
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--fg-muted);
  margin-bottom: 8px;
}

.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--fg);
  padding: 10px 14px;
  border-radius: 8px;
  font-family: var(--font-body);
  font-size: 0.9rem;
  transition: border-color 0.15s;
  resize: vertical;
}

.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: rgba(99,102,241,0.4);
}

.form-hint {
  font-size: 0.8rem;
  color: var(--fg-muted);
  margin-top: 6px;
  line-height: 1.5;
}

.form-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 8px;
}

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

.modal.hidden { display: none; }

.modal-content {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 32px;
  width: 100%;
  max-width: 540px;
}

.modal-content h3 {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 24px;
}

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

/* ---- Loading overlay ---- */
#loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 300;
  flex-direction: column;
  gap: 16px;
}

#loading-overlay.hidden { display: none; }

.loading-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.loading-msg {
  color: var(--fg-muted);
  font-size: 0.9rem;
}

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

/* ---- Toasts ---- */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 400;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 360px;
}

.toast {
  padding: 12px 18px;
  border-radius: 10px;
  font-size: 0.88rem;
  animation: slideIn 0.2s ease;
}

.toast-success { background: rgba(34,197,94,0.15); color: var(--green); border: 1px solid rgba(34,197,94,0.25); }
.toast-error   { background: rgba(239,68,68,0.15);  color: var(--red);   border: 1px solid rgba(239,68,68,0.25); }
.toast-info    { background: rgba(99,102,241,0.15);  color: var(--accent); border: 1px solid rgba(99,102,241,0.25); }

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

/* ---- Misc ---- */
.text-muted { color: var(--fg-muted); }
.empty-state { color: var(--fg-muted); font-size: 0.9rem; padding: 16px 0; }
.empty-state-large { text-align: center; padding: 60px 0; color: var(--fg-muted); }
.mt-16 { margin-top: 16px; }

/* ---- Landing page CTA nav ---- */
.hero-cta {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1rem;
  padding: 14px 32px;
  border-radius: 100px;
  text-decoration: none;
  transition: opacity 0.15s;
  margin-top: 32px;
}

.hero-cta:hover { opacity: 0.85; }

/* ---- Responsive ---- */
@media (max-width: 768px) {
  .app-content { padding: 20px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .page-header { flex-wrap: wrap; }
  .launch-controls { flex-direction: column; align-items: flex-start; }
}
