:root {
  --bg: #0f1216;
  --panel: #171b21;
  --panel-2: #1e242c;
  --line: #2a323d;
  --text: #e6e9ee;
  --muted: #8b95a3;
  --accent: #4c8dff;
  --ok: #37c47a;
  --warn: #e2a33c;
  --bad: #e5575b;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.55 -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.topbar {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 0 20px;
  height: 56px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand { font-weight: 700; font-size: 17px; color: var(--text); }
.brand:hover { text-decoration: none; }

.topbar nav { display: flex; gap: 4px; flex: 1; flex-wrap: wrap; }
.topbar nav a {
  padding: 6px 12px;
  border-radius: 6px;
  color: var(--muted);
  font-size: 14px;
}
.topbar nav a:hover { background: var(--panel-2); color: var(--text); text-decoration: none; }
.topbar nav a.on { background: var(--accent); color: #fff; }

.logout button {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--muted);
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
}
.logout button:hover { color: var(--text); border-color: var(--muted); }

main { padding: 24px; max-width: 1280px; margin: 0 auto; }

h1 { font-size: 22px; margin: 0 0 18px; font-weight: 650; }
h2 { font-size: 17px; margin: 24px 0 12px; font-weight: 600; }

.flash {
  background: #16261d;
  border: 1px solid #2c5138;
  color: #b7f0cd;
  padding: 10px 14px;
  border-radius: 8px;
  margin-bottom: 18px;
}
.flash.error {
  background: #2a181a;
  border-color: #5b2a2d;
  color: #f3bcbe;
}

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-bottom: 24px; }
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 16px;
}
.card .label { color: var(--muted); font-size: 13px; margin-bottom: 6px; }
.card .value { font-size: 26px; font-weight: 650; }

table { width: 100%; border-collapse: collapse; background: var(--panel); border-radius: 10px; overflow: hidden; }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--line); font-size: 14px; vertical-align: top; }
th { color: var(--muted); font-weight: 550; font-size: 13px; background: var(--panel-2); }
tr:last-child td { border-bottom: none; }
td.num { text-align: right; font-variant-numeric: tabular-nums; }

.badge { display: inline-block; padding: 2px 8px; border-radius: 20px; font-size: 12px; font-weight: 550; }
.badge.new { background: #1c2b45; color: #8ab6ff; }
.badge.queued { background: #33280f; color: #e6c268; }
.badge.draft { background: #2a1f3a; color: #c2a3f0; }
.badge.published { background: #162e21; color: #74d79b; }
.badge.failed { background: #331a1c; color: #ef9296; }
.badge.skipped { background: #262a30; color: #98a2b0; }
.badge.pending { background: #33280f; color: #e6c268; }
.badge.sent { background: #162e21; color: #74d79b; }
.badge.cancelled { background: #262a30; color: #98a2b0; }

form.inline { display: inline; }
input, select, textarea {
  background: var(--panel-2);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 6px;
  padding: 7px 10px;
  font: inherit;
  font-size: 14px;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); }
textarea { width: 100%; resize: vertical; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; }

button, .btn {
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 7px 14px;
  border-radius: 6px;
  cursor: pointer;
  font: inherit;
  font-size: 14px;
  display: inline-block;
}
button:hover, .btn:hover { filter: brightness(1.1); text-decoration: none; }
button.ghost { background: transparent; border: 1px solid var(--line); color: var(--muted); }
button.ghost:hover { color: var(--text); }
button.danger { background: var(--bad); }
button.small { padding: 4px 9px; font-size: 13px; }

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 18px; margin-bottom: 20px; }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 900px) { .grid2 { grid-template-columns: 1fr; } }

.field { margin-bottom: 12px; }
.field label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 5px; }
.field input, .field select, .field textarea { width: 100%; }

.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.muted { color: var(--muted); font-size: 13px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; }
pre.body { white-space: pre-wrap; background: var(--panel-2); padding: 14px; border-radius: 8px; border: 1px solid var(--line); font-size: 13px; max-height: 420px; overflow: auto; }

.login-wrap { max-width: 380px; margin: 12vh auto; }
.login-wrap h1 { text-align: center; }
