/* ── APP LAYOUT ── */
.app-wrap {
  display: flex;
  min-height: 100vh;
  background: var(--bg);
}

/* ── SIDEBAR ── */
.sidebar {
  width: 220px;
  flex-shrink: 0;
  background: var(--bg-raised);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 0;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  z-index: 100;
}

.sidebar-brand {
  padding: 24px 20px 20px;
  border-bottom: 1px solid var(--border);
}

.sidebar-logo {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
  color: var(--accent);
  text-decoration: none;
  letter-spacing: -0.5px;
}

.sidebar-logo span {
  color: var(--fg);
}

.sidebar-nav {
  padding: 16px 0;
  flex: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  color: var(--fg-muted);
  text-decoration: none;
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 500;
  border-left: 2px solid transparent;
  cursor: pointer;
  transition: all 0.15s;
  user-select: none;
}

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

.nav-item.active {
  color: var(--accent);
  border-left-color: var(--accent);
  background: var(--accent-dim);
}

.nav-icon {
  font-size: 16px;
  width: 20px;
  text-align: center;
}

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border);
}

.sidebar-footer a {
  font-size: 13px;
  color: var(--fg-muted);
  text-decoration: none;
}
.sidebar-footer a:hover { color: var(--accent); }

/* ── MAIN CONTENT ── */
.main-content {
  margin-left: 220px;
  flex: 1;
  padding: 40px;
  max-width: 1100px;
}

.page {
  display: none;
}
.page.active {
  display: block;
}

/* ── PAGE HEADERS ── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 32px;
}

.page-title {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.5px;
  color: var(--fg);
}

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

/* ── BUTTONS ── */
.btn {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 600;
  padding: 10px 20px;
  border-radius: 8px;
  cursor: pointer;
  border: none;
  transition: all 0.15s;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
}

.btn-primary {
  background: var(--accent);
  color: #0a0a0f;
}
.btn-primary:hover {
  background: #d4ff1a;
  transform: translateY(-1px);
}

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

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

.btn-danger {
  background: rgba(255,70,70,0.12);
  color: #ff6464;
  border: 1px solid rgba(255,70,70,0.2);
}
.btn-danger:hover {
  background: rgba(255,70,70,0.2);
}

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

/* ── STATS ROW ── */
.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 40px;
}

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

.stat-tile-value {
  font-family: var(--font-display);
  font-size: 36px;
  font-weight: 700;
  color: var(--accent);
  line-height: 1;
  margin-bottom: 8px;
}

.stat-tile-label {
  font-size: 13px;
  color: var(--fg-muted);
  letter-spacing: 0.3px;
}

/* ── CARDS / TABLES ── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 24px;
}

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

.card-title {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 600;
  color: var(--fg);
}

.card-body {
  padding: 24px;
}

.table-wrap {
  overflow-x: auto;
}

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

th {
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1px;
  color: var(--fg-muted);
  text-transform: uppercase;
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

td {
  padding: 14px 16px;
  font-size: 14px;
  color: var(--fg);
  border-bottom: 1px solid rgba(34,34,46,0.5);
  vertical-align: top;
}

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

tr:hover td {
  background: rgba(255,255,255,0.02);
}

.td-muted {
  color: var(--fg-muted);
  font-size: 13px;
}

.td-strong {
  font-weight: 600;
  font-family: var(--font-display);
}

/* ── STATUS BADGES ── */
.badge {
  display: inline-block;
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.5px;
  padding: 3px 9px;
  border-radius: 100px;
  text-transform: uppercase;
}

.badge-active { background: rgba(200,255,0,0.12); color: var(--accent); }
.badge-sent { background: rgba(80,200,120,0.12); color: #50c878; }
.badge-queued { background: rgba(100,160,255,0.12); color: #64a0ff; }
.badge-draft { background: rgba(136,136,160,0.12); color: var(--fg-muted); }
.badge-new { background: rgba(200,255,0,0.08); color: var(--fg-muted); }

/* ── MODAL ── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 500;
  align-items: center;
  justify-content: center;
}

.modal-overlay.open {
  display: flex;
}

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

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

/* ── FORM ── */
.form-group {
  margin-bottom: 20px;
}

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

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

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--accent);
}

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

.form-select {
  appearance: none;
  cursor: pointer;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

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

/* ── EMAIL PREVIEW ── */
.email-preview {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 20px;
  margin-top: 12px;
}

.email-subject {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 600;
  color: var(--fg);
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.email-body {
  font-size: 14px;
  color: var(--fg-muted);
  line-height: 1.7;
  white-space: pre-wrap;
}

/* ── LOADING / EMPTY STATES ── */
.loading-text {
  color: var(--fg-muted);
  font-size: 14px;
  padding: 32px;
  text-align: center;
}

.empty-state {
  text-align: center;
  padding: 60px 24px;
}

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

.empty-title {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 600;
  color: var(--fg);
  margin-bottom: 8px;
}

.empty-sub {
  color: var(--fg-muted);
  font-size: 14px;
  margin-bottom: 24px;
}

/* ── TOAST ── */
.toast {
  position: fixed;
  bottom: 32px;
  right: 32px;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 20px;
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 500;
  color: var(--fg);
  z-index: 1000;
  transform: translateY(80px);
  opacity: 0;
  transition: all 0.25s;
  max-width: 360px;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

.toast.success { border-left: 3px solid var(--accent); }
.toast.error { border-left: 3px solid #ff6464; }

/* ── RUN INDICATOR ── */
.run-progress {
  display: none;
  align-items: center;
  gap: 12px;
  padding: 16px 24px;
  background: var(--accent-dim);
  border: 1px solid rgba(200,255,0,0.2);
  border-radius: 10px;
  margin-bottom: 24px;
}

.run-progress.visible {
  display: flex;
}

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

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

.run-text {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 500;
  color: var(--accent);
}

/* ── PROSPECT DETAIL PANEL ── */
.detail-panel {
  display: none;
  position: fixed;
  top: 0;
  right: 0;
  width: 440px;
  height: 100vh;
  background: var(--bg-raised);
  border-left: 1px solid var(--border);
  z-index: 200;
  overflow-y: auto;
  padding: 32px 28px;
}

.detail-panel.open {
  display: block;
}

.detail-close {
  position: absolute;
  top: 20px;
  right: 20px;
  background: none;
  border: none;
  color: var(--fg-muted);
  font-size: 20px;
  cursor: pointer;
  padding: 4px;
}
.detail-close:hover { color: var(--fg); }

.detail-company {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  color: var(--fg);
  margin-bottom: 4px;
}

.detail-role {
  font-size: 14px;
  color: var(--fg-muted);
  margin-bottom: 20px;
}

.detail-section {
  margin-bottom: 24px;
}

.detail-section-label {
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1px;
  color: var(--fg-muted);
  text-transform: uppercase;
  margin-bottom: 8px;
}

.detail-section-body {
  font-size: 14px;
  color: var(--fg);
  line-height: 1.65;
}

/* ── RESPONSIVE ── */
@media (max-width: 900px) {
  .stats-row {
    grid-template-columns: repeat(2, 1fr);
  }
  .main-content {
    padding: 24px 20px;
  }
}

@media (max-width: 640px) {
  .sidebar {
    display: none;
  }
  .main-content {
    margin-left: 0;
  }
  .stats-row {
    grid-template-columns: 1fr 1fr;
  }
  .form-row {
    grid-template-columns: 1fr;
  }
  .detail-panel {
    width: 100%;
  }
}
