/* ── Reset & Base ───────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #0f1117;
  --surface: #1a1d27;
  --surface2: #22263a;
  --border: #2e3350;
  --accent: #4f8ef7;
  --accent2: #7c5cfc;
  --green: #22c55e;
  --yellow: #f59e0b;
  --red: #ef4444;
  --text: #e2e8f0;
  --text-muted: #7c85a2;
  --radius: 10px;
  --font: 'Segoe UI', system-ui, sans-serif;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  display: flex;
  min-height: 100vh;
}

/* ── Sidebar ────────────────────────────────────────────────────────── */
.sidebar {
  width: 220px;
  min-height: 100vh;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 24px 0 16px;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  height: 100vh;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px 16px 20px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}
.sidebar-logo {
  width: 172px;
  border-radius: 8px;
  background: #f4f5f7;
  padding: 8px 10px;
}

.nav-links { list-style: none; flex: 1; }
.nav-links li a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 14px;
  border-radius: 0;
  transition: background 0.15s, color 0.15s;
}
.nav-links li a:hover { background: var(--surface2); color: var(--text); }
.nav-links li a.active {
  background: linear-gradient(90deg, rgba(79,142,247,0.15), transparent);
  color: var(--accent);
  border-left: 3px solid var(--accent);
}
.nav-icon { font-size: 16px; }

.sidebar-footer {
  padding: 12px 20px 0;
  font-size: 10px;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
  text-align: center;
}

/* ── Main Content ───────────────────────────────────────────────────── */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 32px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.page-title { font-size: 22px; font-weight: 700; }
.top-actions { display: flex; gap: 10px; align-items: center; }

.page-body { padding: 28px 32px; }

/* ── Alerts ─────────────────────────────────────────────────────────── */
.alert {
  padding: 12px 20px;
  margin: 12px 32px 0;
  border-radius: var(--radius);
  font-size: 14px;
  border-left: 4px solid;
}
.alert-success { background: rgba(34,197,94,.12); border-color: var(--green); color: #86efac; }
.alert-info    { background: rgba(79,142,247,.12); border-color: var(--accent); color: #93c5fd; }
.alert-danger  { background: rgba(239,68,68,.12);  border-color: var(--red);   color: #fca5a5; }
.alert-warning { background: rgba(245,158,11,.12); border-color: var(--yellow); color: #fcd34d; }

/* ── Cards ──────────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 20px;
}
.card-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .8px;
  margin-bottom: 16px;
}

/* ── Stat Grid ──────────────────────────────────────────────────────── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
}
.stat-value { font-size: 36px; font-weight: 800; color: var(--accent); line-height: 1; }
.stat-label { font-size: 12px; color: var(--text-muted); margin-top: 6px; }
.stat-card.green .stat-value { color: var(--green); }
.stat-card.yellow .stat-value { color: var(--yellow); }
.stat-card.purple .stat-value { color: var(--accent2); }

/* ── Tables ─────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
thead th {
  padding: 10px 14px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .6px;
  border-bottom: 1px solid var(--border);
}
tbody tr { border-bottom: 1px solid var(--border); transition: background 0.1s; }
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--surface2); }
tbody td { padding: 12px 14px; vertical-align: middle; }

/* ── Badges ─────────────────────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  text-transform: capitalize;
}
.badge-pending       { background: rgba(245,158,11,.18); color: #fcd34d; }
.badge-sent_initial  { background: rgba(79,142,247,.18); color: #93c5fd; }
.badge-sent_followup1{ background: rgba(124,92,252,.18); color: #c4b5fd; }
.badge-sent_followup2{ background: rgba(249,115,22,.18); color: #fdba74; }
.badge-reviewed      { background: rgba(34,197,94,.18);  color: #86efac; }
.badge-unsubscribed  { background: rgba(100,100,100,.18); color: #9ca3af; }
.badge-bounced       { background: rgba(239,68,68,.18);  color: #fca5a5; }
.badge-active        { background: rgba(34,197,94,.18);  color: #86efac; }
.badge-paused        { background: rgba(245,158,11,.18); color: #fcd34d; }
.badge-sent          { background: rgba(34,197,94,.18);  color: #86efac; }
.badge-failed        { background: rgba(239,68,68,.18);  color: #fca5a5; }
.badge-simulated     { background: rgba(79,142,247,.18); color: #93c5fd; }

/* ── Buttons ────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  text-decoration: none;
  transition: opacity 0.15s, transform 0.1s;
}
.btn:hover { opacity: .88; transform: translateY(-1px); }
.btn-primary  { background: var(--accent); color: #fff; }
.btn-success  { background: var(--green); color: #fff; }
.btn-warning  { background: var(--yellow); color: #000; }
.btn-danger   { background: var(--red); color: #fff; }
.btn-ghost    { background: var(--surface2); color: var(--text); border: 1px solid var(--border); }
.btn-sm       { padding: 5px 12px; font-size: 12px; }

/* ── Forms ──────────────────────────────────────────────────────────── */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.form-group { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.form-group label { font-size: 13px; color: var(--text-muted); font-weight: 500; }
.form-group input,
.form-group select,
.form-group textarea {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 14px;
  font-family: var(--font);
  transition: border-color 0.15s;
  outline: none;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus { border-color: var(--accent); }
.form-group textarea { min-height: 120px; resize: vertical; }
.form-group select option { background: var(--surface2); }

.form-section-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--accent);
  margin: 24px 0 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

/* ── Progress bar ───────────────────────────────────────────────────── */
.progress-bar-wrap {
  background: var(--surface2);
  border-radius: 20px;
  height: 8px;
  width: 100%;
  overflow: hidden;
}
.progress-bar-fill {
  height: 100%;
  border-radius: 20px;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  transition: width 0.4s;
}

/* ── Section headers ────────────────────────────────────────────────── */
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}
.section-title {
  font-size: 16px;
  font-weight: 700;
}

/* ── Empty state ────────────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}
.empty-state-icon { font-size: 48px; margin-bottom: 12px; }
.empty-state p { font-size: 14px; margin-top: 8px; }

/* ── Sequence timeline ──────────────────────────────────────────────── */
.timeline { display: flex; gap: 0; margin: 20px 0; }
.timeline-step {
  flex: 1;
  text-align: center;
  position: relative;
}
.timeline-step::after {
  content: '';
  position: absolute;
  top: 18px;
  left: 50%;
  right: -50%;
  height: 2px;
  background: var(--border);
  z-index: 0;
}
.timeline-step:last-child::after { display: none; }
.timeline-dot {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--surface2);
  border: 2px solid var(--border);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  position: relative;
  z-index: 1;
  margin-bottom: 8px;
}
.timeline-dot.done { background: var(--green); border-color: var(--green); }
.timeline-dot.active { background: var(--accent); border-color: var(--accent); }
.timeline-label { font-size: 11px; color: var(--text-muted); }
.timeline-sub { font-size: 10px; color: var(--text-muted); margin-top: 2px; }

/* ── Unsubscribe page ───────────────────────────────────────────────── */
.unsub-page {
  max-width: 500px;
  margin: 80px auto;
  text-align: center;
  padding: 0 20px;
}
.unsub-icon { font-size: 56px; margin-bottom: 16px; }
.unsub-page h1 { font-size: 24px; margin-bottom: 12px; }
.unsub-page p { color: var(--text-muted); line-height: 1.7; }

/* ── Template tabs ──────────────────────────────────────────────────── */
.tab-bar { display: flex; gap: 4px; margin-bottom: 20px; }
.tab-btn {
  padding: 8px 20px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  transition: background 0.15s, color 0.15s;
}
.tab-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ── Sidebar user block ─────────────────────────────────────────────── */
.sidebar-user {
  margin: 0 12px 12px;
  padding: 12px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 12px;
}
.sidebar-user-name { font-weight: 600; color: var(--text); margin-bottom: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user-plan { margin-bottom: 8px; }
.sidebar-logout { color: var(--text-muted); text-decoration: none; font-size: 11px; }
.sidebar-logout:hover { color: var(--red); }

/* ── Trial banner ───────────────────────────────────────────────────── */
.trial-banner {
  background: linear-gradient(90deg, rgba(245,158,11,.15), rgba(79,142,247,.1));
  border-bottom: 1px solid rgba(245,158,11,.3);
  padding: 10px 32px;
  font-size: 13px;
  color: var(--text);
  text-align: center;
}
.trial-banner strong { color: var(--yellow); }
.trial-banner a { color: var(--accent); text-decoration: none; font-weight: 600; }
.trial-banner a:hover { text-decoration: underline; }

/* ── Misc ───────────────────────────────────────────────────────────── */
.text-muted { color: var(--text-muted); font-size: 13px; }
.mt-4 { margin-top: 16px; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.pill-group { display: flex; gap: 8px; flex-wrap: wrap; }
