/* === APP SHELL === */
.app-shell {
  display: flex;
  min-height: 100vh;
  background: var(--bg);
}

/* === SIDEBAR === */
.sidebar {
  width: 220px;
  flex-shrink: 0;
  background: var(--bg-elevated);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 28px 0;
}

.sidebar-logo {
  padding: 0 20px 28px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
}

.logo-link {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--fg);
  text-decoration: none;
  letter-spacing: -0.02em;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 0 10px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--fg-muted);
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}

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

.nav-item svg {
  opacity: 0.6;
}

.nav-item.active svg {
  opacity: 1;
  color: var(--accent);
}

/* === MAIN === */
.app-main {
  flex: 1;
  padding: 40px 48px;
  max-width: 1200px;
  overflow-y: auto;
}

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

.app-title {
  font-family: var(--font-display);
  font-size: 1.8rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--fg);
  margin-bottom: 6px;
}

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

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

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

.btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: transparent;
  color: var(--fg-muted);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 9px 16px;
  font-family: var(--font-display);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}

.btn-ghost:hover { color: var(--fg); border-color: rgba(232,164,53,0.3); }
.btn-ghost:disabled { opacity: 0.5; cursor: not-allowed; }

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

/* === CAMPAIGNS GRID === */
.campaigns-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 20px;
}

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

.campaign-card:hover {
  border-color: rgba(232,164,53,0.3);
  transform: translateY(-1px);
}

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

.campaign-card-title {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--fg);
  line-height: 1.3;
  flex: 1;
  margin-right: 12px;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 100px;
  font-size: 0.72rem;
  font-weight: 600;
  font-family: var(--font-display);
  letter-spacing: 0.5px;
  text-transform: uppercase;
  white-space: nowrap;
  flex-shrink: 0;
}

.badge-draft     { background: rgba(138,135,154,0.12); color: var(--fg-muted); }
.badge-researching { background: rgba(232,164,53,0.12); color: var(--accent); border: 1px solid rgba(232,164,53,0.2); }
.badge-generating_emails { background: rgba(100,160,220,0.12); color: #64a0dc; }
.badge-ready     { background: rgba(80,200,120,0.12); color: #50c878; border: 1px solid rgba(80,200,120,0.2); }
.badge-error     { background: rgba(220,60,60,0.12); color: #dc3c3c; }

.campaign-card-topic {
  font-size: 0.875rem;
  color: var(--fg-muted);
  line-height: 1.5;
  margin-bottom: 20px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.campaign-pipeline {
  display: flex;
  gap: 16px;
}

.pipeline-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.pipeline-stat-num {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--fg);
  letter-spacing: -0.03em;
}

.pipeline-stat-label {
  font-size: 0.72rem;
  color: var(--fg-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 2px;
}

.pipeline-stat-label.sent   { color: #64a0dc; }
.pipeline-stat-label.replied { color: var(--accent); }
.pipeline-stat-label.confirmed { color: #50c878; }

.campaign-card-date {
  margin-top: 16px;
  font-size: 0.78rem;
  color: var(--fg-muted);
  border-top: 1px solid var(--border);
  padding-top: 12px;
}

/* === EMPTY / LOADING STATE === */
.loading-state {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--fg-muted);
  font-size: 0.9rem;
  padding: 24px 0;
  grid-column: 1/-1;
}

.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  flex-shrink: 0;
}

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

.empty-state {
  grid-column: 1/-1;
  text-align: center;
  padding: 80px 24px;
  color: var(--fg-muted);
}

.empty-state-icon {
  font-size: 2.5rem;
  margin-bottom: 16px;
  opacity: 0.4;
}

.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;
  max-width: 320px;
  margin: 0 auto 24px;
  line-height: 1.6;
}

/* === MODAL === */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(12,11,15,0.85);
  backdrop-filter: blur(6px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 16px;
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
}

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

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 24px 28px;
  border-bottom: 1px solid var(--border);
}

.modal-header h2 {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.modal-close {
  background: none;
  border: none;
  color: var(--fg-muted);
  font-size: 1.4rem;
  cursor: pointer;
  line-height: 1;
  padding: 0 4px;
  transition: color 0.15s;
}

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

.modal-body {
  padding: 24px 28px;
  overflow-y: auto;
  flex: 1;
}

.modal-hint {
  font-size: 0.875rem;
  color: var(--fg-muted);
  margin-bottom: 20px;
  line-height: 1.6;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 20px 28px;
  border-top: 1px solid var(--border);
}

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

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

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

.form-input:focus, .form-textarea:focus {
  border-color: rgba(232,164,53,0.4);
}

.form-input::placeholder, .form-textarea::placeholder {
  color: rgba(138,135,154,0.6);
}

.form-textarea {
  min-height: 80px;
  resize: vertical;
  line-height: 1.55;
}

/* === DETAIL OVERLAY === */
.detail-overlay {
  position: fixed;
  inset: 0;
  background: rgba(12,11,15,0.5);
  backdrop-filter: blur(4px);
  z-index: 90;
  display: flex;
  justify-content: flex-end;
}

.detail-panel {
  width: min(900px, 100vw);
  background: var(--bg-elevated);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: slideIn 0.2s ease;
}

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

.detail-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 28px 32px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.detail-header h2 {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  margin-bottom: 6px;
}

.detail-status {
  font-size: 0.8rem;
  color: var(--fg-muted);
}

/* === PIPELINE STATS === */
.pipeline-stats {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.ps-item {
  flex: 1;
  padding: 20px 24px;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
}

.ps-item:last-child { border-right: none; }

.ps-num {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--fg);
}

.ps-label {
  font-size: 0.75rem;
  color: var(--fg-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-top: 4px;
}

/* === SPEAKERS TABLE === */
.speakers-section {
  flex: 1;
  overflow-y: auto;
  padding: 24px 32px;
}

.speakers-heading {
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--fg-muted);
  margin-bottom: 16px;
}

.speakers-table {
  width: 100%;
  border-collapse: collapse;
}

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

.speakers-table td {
  padding: 14px 12px;
  border-bottom: 1px solid rgba(42,40,51,0.6);
  vertical-align: top;
}

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

.speaker-name {
  font-family: var(--font-display);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--fg);
  margin-bottom: 3px;
}

.speaker-title-text {
  font-size: 0.78rem;
  color: var(--fg-muted);
}

.speaker-expertise {
  font-size: 0.8rem;
  color: var(--fg-muted);
  max-width: 200px;
}

.status-select {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--fg);
  font-size: 0.8rem;
  padding: 4px 8px;
  cursor: pointer;
  outline: none;
  font-family: var(--font-body);
}

.status-select:focus { border-color: rgba(232,164,53,0.4); }

.action-btns {
  display: flex;
  gap: 6px;
  align-items: center;
}

.btn-icon {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--fg-muted);
  padding: 5px 8px;
  cursor: pointer;
  font-size: 0.8rem;
  transition: color 0.15s, border-color 0.15s;
  white-space: nowrap;
}

.btn-icon:hover { color: var(--accent); border-color: rgba(232,164,53,0.3); }
.btn-icon:disabled { opacity: 0.5; cursor: not-allowed; }

/* === EMAIL PREVIEW === */
.email-subject {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1rem;
  color: var(--fg);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
}

.email-body {
  font-size: 0.9375rem;
  color: var(--fg);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  white-space: pre-wrap;
  line-height: 1.7;
  max-height: 360px;
  overflow-y: auto;
}

/* === TOAST === */
.toast {
  position: fixed;
  bottom: 28px;
  right: 28px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 20px;
  font-size: 0.875rem;
  color: var(--fg);
  z-index: 200;
  animation: toastIn 0.25s ease;
  max-width: 360px;
}

.toast.success { border-color: rgba(80,200,120,0.4); }
.toast.error   { border-color: rgba(220,60,60,0.4); color: #dc7070; }

@keyframes toastIn {
  from { transform: translateY(12px); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}

/* === RESEARCHING BANNER === */
.researching-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(232,164,53,0.06);
  border: 1px solid rgba(232,164,53,0.2);
  border-radius: 10px;
  padding: 14px 18px;
  margin-bottom: 20px;
  font-size: 0.875rem;
  color: var(--accent);
}

/* === RESPONSIVE === */
@media (max-width: 768px) {
  .sidebar { display: none; }
  .app-main { padding: 24px 20px; }
  .app-header { flex-direction: column; gap: 16px; align-items: flex-start; }
  .campaigns-grid { grid-template-columns: 1fr; }
  .detail-panel { width: 100vw; }
  .pipeline-stats { flex-wrap: wrap; }
  .ps-item { flex: 1 0 50%; }
}

/* === HERO CTA on landing === */
.hero-cta-row {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.btn-hero {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--accent);
  color: #0c0b0f;
  border: none;
  border-radius: 10px;
  padding: 14px 28px;
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  transition: opacity 0.15s;
  letter-spacing: -0.01em;
}

.btn-hero:hover { opacity: 0.88; }
