/* ============ FLINT APP SHELL ============ */
:root {
  --bg: #0a0a0c;
  --bg-elevated: #121215;
  --bg-card: #18181c;
  --fg: #e8e6e3;
  --fg-muted: #8a8a8e;
  --accent: #e87a1e;
  --accent-glow: rgba(232, 122, 30, 0.15);
  --accent-bright: #ff922b;
  --border: rgba(255,255,255,0.06);
  --font-heading: 'Space Grotesk', sans-serif;
  --font-body: 'DM Sans', sans-serif;
  --sidebar-w: 220px;
  --success: #22c55e;
  --danger: #ef4444;
  --warning: #f59e0b;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

/* ============ LAYOUT ============ */
.app-layout {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-w);
  background: var(--bg-elevated);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
}

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

.sidebar-logo a {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.2rem;
  color: var(--fg);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 8px;
}

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

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

.nav-section-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-muted);
  padding: 12px 20px 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  color: var(--fg-muted);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: color 0.15s, background 0.15s;
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}

.nav-item:hover { color: var(--fg); background: rgba(255,255,255,0.04); }
.nav-item.active { color: var(--accent); background: var(--accent-glow); }
.nav-icon { font-size: 16px; width: 20px; text-align: center; }

.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-height: 100vh;
  padding: 0;
}

/* ============ HEADER ============ */
.page-header {
  padding: 28px 32px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
}

.page-title {
  font-family: var(--font-heading);
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

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

.page-body { padding: 0 32px 48px; }

/* ============ BUTTONS ============ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: 8px;
  font-family: var(--font-heading);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.15s;
  text-decoration: none;
}

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

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

.btn-danger { background: var(--danger); color: #fff; }
.btn-sm { padding: 6px 12px; font-size: 12px; }

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

/* ============ CARDS ============ */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
}

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

.card-title {
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: 600;
}

/* ============ STAT GRID ============ */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 28px;
}

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

.stat-label {
  font-size: 12px;
  color: var(--fg-muted);
  font-weight: 500;
  letter-spacing: 0.03em;
  margin-bottom: 8px;
}

.stat-value {
  font-family: var(--font-heading);
  font-size: 2rem;
  font-weight: 700;
  color: var(--accent-bright);
  line-height: 1;
}

/* ============ TABLES ============ */
.table-wrap { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

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

td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(255,255,255,0.02); }

/* ============ STATUS BADGES ============ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 100px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.03em;
}

.badge-draft    { background: rgba(255,255,255,0.06); color: var(--fg-muted); }
.badge-active   { background: rgba(34,197,94,0.12); color: var(--success); }
.badge-pending  { background: rgba(245,158,11,0.12); color: var(--warning); }
.badge-contacted { background: rgba(99,102,241,0.15); color: #a5b4fc; }
.badge-interested { background: rgba(34,197,94,0.12); color: var(--success); }
.badge-not_interested { background: rgba(239,68,68,0.12); color: var(--danger); }
.badge-engaged  { background: rgba(232,122,30,0.15); color: var(--accent-bright); }
.badge-unsubscribed { background: rgba(239,68,68,0.08); color: var(--fg-muted); }
.badge-error    { background: rgba(239,68,68,0.12); color: var(--danger); }
.badge-proposed { background: rgba(99,102,241,0.15); color: #a5b4fc; }
.badge-confirmed { background: rgba(34,197,94,0.12); color: var(--success); }

/* ============ FORMS ============ */
.form-group { margin-bottom: 20px; }

label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--fg-muted);
  margin-bottom: 7px;
  letter-spacing: 0.02em;
}

input[type="text"],
input[type="email"],
input[type="number"],
textarea,
select {
  width: 100%;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 11px 14px;
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 14px;
  transition: border-color 0.15s;
  outline: none;
}

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

textarea { resize: vertical; min-height: 100px; }

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

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

.modal-title {
  font-family: var(--font-heading);
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 24px;
}

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

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

.empty-icon { font-size: 3rem; margin-bottom: 16px; opacity: 0.4; }
.empty-state h3 { font-family: var(--font-heading); font-size: 1.1rem; color: var(--fg); margin-bottom: 8px; }
.empty-state p { font-size: 14px; line-height: 1.6; }

/* ============ TOAST ============ */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 500;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 18px;
  font-size: 13px;
  font-weight: 500;
  min-width: 260px;
  max-width: 360px;
  animation: slideIn 0.2s ease;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
}

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

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

/* ============ LOADING ============ */
.spinner {
  display: inline-block;
  width: 16px; height: 16px;
  border: 2px solid rgba(255,255,255,0.2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

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

/* ============ CAMPAIGN DETAIL ============ */
.prospect-row td:first-child { font-weight: 500; }

.email-thread {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.email-bubble {
  padding: 16px;
  border-radius: 10px;
  font-size: 13px;
  line-height: 1.65;
  max-width: 90%;
}

.email-bubble-out {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  align-self: flex-start;
}

.email-bubble-in {
  background: rgba(232,122,30,0.08);
  border: 1px solid rgba(232,122,30,0.2);
  align-self: flex-end;
}

.email-meta {
  font-size: 11px;
  color: var(--fg-muted);
  margin-bottom: 6px;
}

/* ============ INBOX ============ */
.reply-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 18px 20px;
  margin-bottom: 12px;
  display: flex;
  gap: 16px;
  align-items: flex-start;
}

.reply-card-body { flex: 1; min-width: 0; }
.reply-card-from { font-weight: 600; font-size: 14px; margin-bottom: 3px; }
.reply-card-sub  { font-size: 12px; color: var(--fg-muted); margin-bottom: 8px; }
.reply-card-preview {
  font-size: 13px;
  color: var(--fg-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ============ BACK LINK ============ */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--fg-muted);
  font-size: 13px;
  text-decoration: none;
  margin-bottom: 20px;
  cursor: pointer;
}
.back-link:hover { color: var(--fg); }

/* ============ RESPONSIVE ============ */
@media (max-width: 900px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .sidebar { width: 60px; }
  .sidebar-logo a span, .nav-item span, .nav-section-label { display: none; }
  .main-content { margin-left: 60px; }
  .page-header, .page-body { padding-left: 20px; padding-right: 20px; }
}
