@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  --bg:        #0f1117;
  --surface:   #16191f;
  --surface2:  #1e2229;
  --surface3:  #252a33;
  --border:    #2a2f3a;
  --border2:   #333844;
  --text:      #e8eaf0;
  --text2:     #9ba3b2;
  --text3:     #5c6475;
  --accent:    #6366f1;
  --accent2:   #818cf8;
  --accent-bg: rgba(99,102,241,0.12);
  --success:   #10b981;
  --warning:   #f59e0b;
  --danger:    #ef4444;
  --info:      #3b82f6;
  --radius:    8px;
  --radius-lg: 12px;
  --shadow:    0 1px 3px rgba(0,0,0,0.4), 0 4px 16px rgba(0,0,0,0.2);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.4);
  --font:      'Plus Jakarta Sans', sans-serif;
  --mono:      'JetBrains Mono', monospace;
  --sidebar-w: 240px;
}

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

html { font-size: 14px; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ── SCROLLBAR ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--surface); }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 3px; }

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

.sidebar {
  width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  z-index: 100;
  overflow-y: auto;
}

.main {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 28px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
}

.page-content {
  padding: 28px;
  flex: 1;
}

/* ── SIDEBAR BRAND ── */
.sidebar-brand {
  padding: 20px 18px 16px;
  border-bottom: 1px solid var(--border);
}
.sidebar-brand .brand-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.3px;
}
.sidebar-brand .brand-sub {
  font-size: 11px;
  color: var(--text3);
  margin-top: 2px;
  font-family: var(--mono);
}

/* ── SIDEBAR NAV ── */
.sidebar-nav { padding: 12px 10px; flex: 1; }
.nav-section-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--text3);
  letter-spacing: 1.2px;
  text-transform: uppercase;
  padding: 8px 8px 4px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: var(--radius);
  color: var(--text2);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 500;
  transition: all 0.15s;
  margin-bottom: 2px;
}
.nav-item:hover { background: var(--surface2); color: var(--text); }
.nav-item.active { background: var(--accent-bg); color: var(--accent2); }
.nav-item svg { width: 16px; height: 16px; flex-shrink: 0; opacity: 0.8; }
.nav-item.active svg { opacity: 1; }

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

/* ── TOPBAR ── */
.topbar-title { font-size: 15px; font-weight: 600; color: var(--text); }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.topbar-user {
  font-size: 12.5px;
  color: var(--text2);
  display: flex;
  align-items: center;
  gap: 8px;
}
.avatar {
  width: 30px; height: 30px;
  background: var(--accent-bg);
  border: 1px solid var(--accent);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--accent2);
}

/* ── STAT CARDS ── */
.stats-grid { display: grid; grid-template-columns: repeat(4,1fr); gap: 16px; margin-bottom: 24px; }
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  position: relative;
  overflow: hidden;
}
.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
}
.stat-label { font-size: 11px; font-weight: 600; color: var(--text3); letter-spacing: 0.8px; text-transform: uppercase; }
.stat-value { font-size: 28px; font-weight: 700; color: var(--text); margin: 6px 0 2px; letter-spacing: -1px; }
.stat-sub   { font-size: 11.5px; color: var(--text2); }
.stat-icon  {
  position: absolute;
  top: 18px; right: 18px;
  width: 36px; height: 36px;
  background: var(--accent-bg);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent2);
}
.stat-icon svg { width: 18px; height: 18px; }

/* ── CARDS ── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.card-title { font-size: 14px; font-weight: 600; color: var(--text); }
.card-body  { padding: 20px; }

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

/* ── BADGES ── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
}
.badge-blue   { background: rgba(59,130,246,0.15);  color: #60a5fa; }
.badge-orange { background: rgba(245,158,11,0.15);  color: #fbbf24; }
.badge-green  { background: rgba(16,185,129,0.15);  color: #34d399; }
.badge-red    { background: rgba(239,68,68,0.15);   color: #f87171; }
.badge-purple { background: rgba(168,85,247,0.15);  color: #c084fc; }
.badge-gray   { background: rgba(107,114,128,0.15); color: #9ca3af; }
.badge-yellow { background: rgba(245,158,11,0.15);  color: #fcd34d; }
.badge-indigo { background: rgba(99,102,241,0.15);  color: #a5b4fc; }

/* ── BUTTONS ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 16px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  border: none;
  text-decoration: none;
  transition: all 0.15s;
  white-space: nowrap;
}
.btn svg { width: 15px; height: 15px; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: #5558e8; }
.btn-secondary { background: var(--surface2); color: var(--text); border: 1px solid var(--border2); }
.btn-secondary:hover { background: var(--surface3); }
.btn-danger { background: rgba(239,68,68,0.15); color: #f87171; border: 1px solid rgba(239,68,68,0.3); }
.btn-danger:hover { background: rgba(239,68,68,0.25); }
.btn-success { background: rgba(16,185,129,0.15); color: #34d399; border: 1px solid rgba(16,185,129,0.3); }
.btn-success:hover { background: rgba(16,185,129,0.25); }
.btn-sm { padding: 5px 11px; font-size: 12px; }
.btn-icon { padding: 7px; }

/* ── FORMS ── */
.form-group { margin-bottom: 18px; }
.form-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text2);
  margin-bottom: 6px;
  letter-spacing: 0.3px;
}
.form-control {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  padding: 9px 12px;
  font-size: 13.5px;
  font-family: var(--font);
  color: var(--text);
  transition: border-color 0.15s;
  outline: none;
}
.form-control:focus { border-color: var(--accent); }
.form-control::placeholder { color: var(--text3); }
select.form-control { cursor: pointer; }
textarea.form-control { resize: vertical; min-height: 90px; }
.form-hint { font-size: 11.5px; color: var(--text3); margin-top: 4px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }

/* ── ALERTS / FLASH ── */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 13.5px;
  margin-bottom: 20px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.alert-success { background: rgba(16,185,129,0.12); border: 1px solid rgba(16,185,129,0.3); color: #6ee7b7; }
.alert-error   { background: rgba(239,68,68,0.12);  border: 1px solid rgba(239,68,68,0.3);  color: #fca5a5; }
.alert-warning { background: rgba(245,158,11,0.12); border: 1px solid rgba(245,158,11,0.3); color: #fde68a; }
.alert-info    { background: rgba(99,102,241,0.12); border: 1px solid rgba(99,102,241,0.3); color: #a5b4fc; }

/* ── EMPTY STATE ── */
.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--text3);
}
.empty-state svg { width: 40px; height: 40px; margin: 0 auto 12px; opacity: 0.4; }
.empty-state h3  { font-size: 14px; font-weight: 600; color: var(--text2); margin-bottom: 6px; }
.empty-state p   { font-size: 13px; }

/* ── MODAL ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  backdrop-filter: blur(4px);
}
.modal {
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 520px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.modal-header {
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-title { font-size: 15px; font-weight: 600; }
.modal-body { padding: 20px; }
.modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* ── CAMPAIGN COMPOSER STEPS ── */
.steps {
  display: flex;
  align-items: center;
  gap: 0;
  margin-bottom: 28px;
}
.step {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text3);
}
.step-num {
  width: 26px; height: 26px;
  border-radius: 50%;
  background: var(--surface2);
  border: 1px solid var(--border2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
}
.step.active .step-num { background: var(--accent); border-color: var(--accent); color: #fff; }
.step.active { color: var(--text); }
.step.done .step-num { background: var(--success); border-color: var(--success); color: #fff; }
.step-line { flex: 1; height: 1px; background: var(--border); margin: 0 10px; min-width: 30px; }

/* ── PREVIEW PANEL ── */
.composer-layout { display: grid; grid-template-columns: 1fr 420px; gap: 20px; align-items: start; }
.preview-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  position: sticky;
  top: 76px;
}
.preview-header {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  font-weight: 600;
  color: var(--text2);
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.preview-header svg { width: 14px; height: 14px; }
.preview-frame {
  width: 100%;
  height: 580px;
  border: none;
  background: #fff;
}
.preview-empty {
  height: 580px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text3);
  gap: 10px;
}
.preview-empty svg { width: 32px; height: 32px; opacity: 0.3; }

/* ── PROGRESS BAR ── */
.progress-bar-wrap {
  height: 6px;
  background: var(--surface3);
  border-radius: 3px;
  overflow: hidden;
}
.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  border-radius: 3px;
  transition: width 0.3s;
}

/* ── LOG TABLE STATUS ── */
.status-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 6px;
}
.status-dot.sent    { background: var(--success); }
.status-dot.failed  { background: var(--danger); }
.status-dot.skipped { background: var(--warning); }

/* ── DIVIDER ── */
.divider { height: 1px; background: var(--border); margin: 20px 0; }

/* ── MISC ── */
.text-muted  { color: var(--text2); }
.text-small  { font-size: 12px; }
.text-mono   { font-family: var(--mono); font-size: 12.5px; }
.flex        { display: flex; }
.flex-center { display: flex; align-items: center; }
.flex-between{ display: flex; align-items: center; justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.mt-1  { margin-top: 6px; }
.mt-2  { margin-top: 12px; }
.mt-3  { margin-top: 20px; }
.mb-2  { margin-bottom: 12px; }
.mb-3  { margin-bottom: 20px; }
.w-full { width: 100%; }
.hidden { display: none; }

/* ── LOGIN PAGE ── */
.login-bg {
  min-height: 100vh;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background-image: radial-gradient(ellipse at 20% 50%, rgba(99,102,241,0.08) 0%, transparent 60%),
                    radial-gradient(ellipse at 80% 20%, rgba(129,140,248,0.06) 0%, transparent 50%);
}
.login-card {
  width: 100%;
  max-width: 400px;
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: var(--radius-lg);
  padding: 36px;
  box-shadow: var(--shadow-lg);
}
.login-logo { text-align: center; margin-bottom: 28px; }
.login-logo .logo-mark {
  width: 48px; height: 48px;
  background: var(--accent-bg);
  border: 1px solid var(--accent);
  border-radius: var(--radius-lg);
  margin: 0 auto 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent2);
}
.login-logo .logo-mark svg { width: 24px; height: 24px; }
.login-logo h1 { font-size: 18px; font-weight: 700; color: var(--text); }
.login-logo p  { font-size: 12.5px; color: var(--text3); margin-top: 3px; }
