:root {
  --bg: #0f1117;
  --surface: #1a1d27;
  --surface-2: #222633;
  --border: #2a2f3d;
  --text: #e8eaed;
  --muted: #9aa0a6;
  --accent: #4f8cff;
  --accent-hover: #3d7ae8;
  --success: #34a853;
  --danger: #ea4335;
  --warning: #fbbc04;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
}
a { color: var(--accent); }
header {
  border-bottom: 1px solid var(--border);
  padding: 1rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface);
}
header h1 { font-size: 1.25rem; font-weight: 600; }
header .logo { color: var(--text); text-decoration: none; }
header .version { color: var(--muted); font-size: 0.875rem; }
nav {
  display: flex;
  gap: 1.5rem;
  padding: 0 2rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
nav a {
  color: var(--muted);
  text-decoration: none;
  padding: 0.75rem 0;
  font-size: 0.875rem;
  border-bottom: 2px solid transparent;
}
nav a:hover, nav a.active { color: var(--text); border-bottom-color: var(--accent); }
nav a.disabled { opacity: 0.4; pointer-events: none; }
main { padding: 2rem; max-width: 1100px; margin: 0 auto; }
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  gap: 1rem;
  flex-wrap: wrap;
}
.page-header h2 { font-size: 1.5rem; font-weight: 600; }
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.25rem;
}
.stat-card .label {
  color: var(--muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.stat-card .value { font-size: 1.75rem; font-weight: 700; margin-top: 0.25rem; }
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}
.card h3 { font-size: 1rem; margin-bottom: 1rem; }
table { width: 100%; border-collapse: collapse; }
th, td {
  text-align: left;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.875rem;
}
th { color: var(--muted); font-weight: 500; }
tr:hover td { background: var(--surface-2); }
.badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.badge-draft { background: #2a2f3d; color: var(--muted); }
.badge-running { background: #1a3a2a; color: var(--success); }
.badge-scheduled { background: #1a2a3a; color: var(--accent); }
.badge-paused { background: #3a2a1a; color: var(--warning); }
.badge-completed { background: #1a2a2a; color: #81c995; }
.badge-cancelled { background: #2a1a1a; color: #f28b82; }
.badge-pending { background: #2a2f3d; color: var(--muted); }
.badge-sent { background: #1a3a2a; color: var(--success); }
.badge-failed { background: #3a1a1a; color: #f28b82; }
.badge-skipped { background: #3a2f1a; color: #fdd663; }
.badge-recipient { text-transform: none; letter-spacing: 0; }
.progress-block {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem 1.25rem;
  margin-bottom: 1.5rem;
}
.progress-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  font-size: 0.875rem;
  margin-bottom: 0.6rem;
}
.progress-label { color: var(--muted); }
.progress-bar {
  height: 8px;
  background: var(--surface-2);
  border-radius: 4px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #2a6a3a, var(--success));
  border-radius: 4px;
  transition: width 0.3s ease;
}
.progress-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-top: 0.75rem;
  font-size: 0.8rem;
  color: var(--muted);
}
.legend-item { display: inline-flex; align-items: center; gap: 0.35rem; }
.legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}
.legend-sent { background: var(--success); }
.legend-not-sent { background: var(--muted); }
.legend-failed { background: var(--danger); }
.legend-skipped { background: var(--warning); }
.recipient-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
  align-items: center;
}
.filter-input {
  padding: 0.45rem 0.65rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 0.875rem;
}
.filter-input:focus { outline: none; border-color: var(--accent); }
.table-wrap { overflow-x: auto; }
.recipients-table .recipient-row-sent td { background: rgba(52, 168, 83, 0.06); }
.recipients-table .recipient-row-sent:hover td { background: rgba(52, 168, 83, 0.12); }
.recipients-table .recipient-row-pending td,
.recipients-table .recipient-row-scheduled td { background: rgba(79, 140, 255, 0.04); }
.recipients-table .recipient-row-pending:hover td,
.recipients-table .recipient-row-scheduled:hover td { background: rgba(79, 140, 255, 0.1); }
.recipients-table .recipient-row-failed td { background: rgba(234, 67, 53, 0.06); }
.recipients-table .recipient-row-failed:hover td { background: rgba(234, 67, 53, 0.12); }
.recipients-table .recipient-row-skipped td { background: rgba(251, 188, 4, 0.05); }
.recipients-table .recipient-row-skipped:hover td { background: rgba(251, 188, 4, 0.1); }
.pagination {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 1rem;
  flex-wrap: wrap;
}
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  font-size: 0.875rem;
  font-weight: 500;
  text-decoration: none;
  border: none;
  cursor: pointer;
  line-height: 1.4;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-secondary:hover { border-color: var(--muted); }
.btn-danger { background: #5c1a1a; color: #f28b82; border: 1px solid #8a2a2a; }
.btn-danger:hover { background: #7a2020; }
.btn-sm { padding: 0.3rem 0.65rem; font-size: 0.8rem; }
.actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.empty {
  color: var(--muted);
  padding: 3rem 2rem;
  text-align: center;
  border: 1px dashed var(--border);
  border-radius: 8px;
}
.form-group { margin-bottom: 1.25rem; }
.form-group label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 0.4rem;
}
.form-group .hint {
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 0.35rem;
}
.form-group input[type="text"],
.form-group textarea {
  width: 100%;
  padding: 0.65rem 0.75rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 0.9rem;
  font-family: inherit;
}
.form-group textarea { min-height: 180px; resize: vertical; font-family: ui-monospace, monospace; }
.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--accent);
}
.alert {
  padding: 0.75rem 1rem;
  border-radius: 6px;
  margin-bottom: 1rem;
  font-size: 0.875rem;
}
.alert-error {
  background: #3a1a1a;
  border: 1px solid #8a2a2a;
  color: #f28b82;
}
.alert-warning {
  background: #3a2f1a;
  border: 1px solid #8a6a2a;
  color: #fdd663;
}
.alert ul { margin: 0.5rem 0 0 1.25rem; }
.hints {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1rem;
  font-size: 0.85rem;
  color: var(--muted);
}
.hints code {
  background: var(--bg);
  padding: 0.1rem 0.35rem;
  border-radius: 3px;
  color: var(--accent);
  font-size: 0.8rem;
}
.preview-box {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1rem;
  margin-top: 0.75rem;
  white-space: pre-wrap;
  font-size: 0.875rem;
}
.preview-item {
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border);
}
.preview-item:last-child { border-bottom: none; }
.meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.meta-item .label { color: var(--muted); font-size: 0.75rem; }
.meta-item .value { font-size: 1.1rem; font-weight: 600; margin-top: 0.15rem; }
.template-block {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1rem;
  white-space: pre-wrap;
  font-family: ui-monospace, monospace;
  font-size: 0.85rem;
  margin-top: 0.5rem;
}
