:root {
  --fg: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --bg: #f8fafc;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --green: #16a34a;
  --red: #dc2626;
  --amber: #d97706;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  color: var(--fg);
  background: var(--bg);
  line-height: 1.5;
}
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  background: white;
  border-bottom: 1px solid var(--line);
}
.brand { font-weight: 700; font-size: 18px; }
nav a {
  color: var(--muted);
  text-decoration: none;
  margin-left: 18px;
  font-size: 14px;
}
nav a.active, nav a:hover { color: var(--fg); }

.container {
  max-width: 1080px;
  margin: 32px auto;
  padding: 0 24px;
}

h1 { margin: 0 0 24px; font-size: 24px; }
.muted { color: var(--muted); font-size: 14px; }

table { width: 100%; border-collapse: collapse; background: white; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
th, td { padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--line); font-size: 14px; }
th { background: #f1f5f9; font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
tr:last-child td { border-bottom: none; }
a { color: var(--primary); }

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  background: #e2e8f0;
  color: var(--fg);
  text-transform: capitalize;
}
.badge.sending { background: #dbeafe; color: #1e40af; }
.badge.completed { background: #dcfce7; color: #166534; }
.badge.paused { background: #fef3c7; color: #92400e; }
.badge.draft { background: #f1f5f9; color: var(--muted); }
.badge.suppression { background: #fee2e2; color: #991b1b; }
.badge.unsubscribe { background: #fef3c7; color: #92400e; }

.empty {
  text-align: center;
  padding: 60px;
  background: white;
  border: 1px dashed var(--line);
  border-radius: 12px;
  color: var(--muted);
}

form .grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}
form label { display: block; }
form label.full { grid-column: 1 / -1; }
form label > span { display: block; font-size: 13px; font-weight: 500; margin-bottom: 6px; color: var(--fg); }
input[type="text"], input[type="email"], input[type="number"], input:not([type]), textarea, select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  font: inherit;
  background: white;
}
textarea { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; }
fieldset.body-type { border: 1px solid var(--line); border-radius: 6px; padding: 12px 16px; margin: 16px 0; }
fieldset.body-type legend { font-size: 13px; font-weight: 500; padding: 0 6px; color: var(--muted); }
label.radio { display: inline-flex; align-items: center; margin-right: 20px; font-size: 14px; }
label.radio input { margin-right: 6px; }

.actions { display: flex; align-items: center; gap: 16px; margin-top: 16px; }
button.primary, button {
  padding: 10px 18px;
  border: 1px solid var(--line);
  background: white;
  border-radius: 6px;
  font: inherit;
  cursor: pointer;
}
button.primary { background: var(--primary); color: white; border-color: var(--primary); font-weight: 500; }
button.primary:hover { background: var(--primary-dark); }
button:hover { background: #f1f5f9; }
.inline { display: inline-flex; align-items: center; font-size: 14px; }
.inline input { margin-right: 6px; }

.msg { margin-top: 16px; font-size: 14px; }
.msg.ok { color: var(--green); }
.msg.err { color: var(--red); }

.preview { margin: 24px 0; padding: 16px; background: white; border: 1px solid var(--line); border-radius: 8px; }
.preview h3 { margin: 0 0 8px; font-size: 14px; }
.preview table { margin-top: 8px; font-size: 12px; }

.campaign-head { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.campaign-head h1 { margin: 0; }
.meta { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 24px; background: white; border: 1px solid var(--line); border-radius: 8px; padding: 14px 16px; margin-bottom: 20px; font-size: 14px; }
.meta > div span { display: inline-block; min-width: 80px; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; }

.progress { background: white; border: 1px solid var(--line); border-radius: 8px; padding: 14px 16px; margin-bottom: 20px; position: relative; height: 36px; overflow: hidden; }
.progress .bar { position: absolute; top: 0; left: 0; bottom: 0; background: #dbeafe; transition: width 0.5s; }
.progress-text { position: relative; line-height: 36px; padding: 0 8px; font-size: 14px; font-weight: 500; }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 24px; }
.stats > div { background: white; border: 1px solid var(--line); border-radius: 8px; padding: 14px 16px; }
.stats strong { display: block; font-size: 22px; }
.stats span { display: block; font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; margin-top: 4px; }

.add-form { display: flex; gap: 8px; margin: 16px 0; }
.add-form input { flex: 1; }

.back { display: inline-block; margin-bottom: 16px; font-size: 14px; color: var(--muted); text-decoration: none; }
.back:hover { color: var(--fg); }
