:root {
  --bg: #f6f7f9;
  --panel: #ffffff;
  --ink: #111827;
  --ink-2: #374151;
  --muted: #6b7280;
  --line: #e5e7eb;
  --accent: #1f4fd6;
  --accent-ink: #ffffff;
  --ok: #0f7b4b;
  --ok-bg: #e7f6ee;
  --warn: #8a5a00;
  --warn-bg: #fff6e0;
  --err: #b42318;
  --err-bg: #fdecea;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16,24,40,.05);
  font-synthesis: none;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, Helvetica, Arial, sans-serif; color: var(--ink); background: var(--bg); }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 22px; margin: 0; letter-spacing: -.01em; }
h2 { font-size: 15px; margin: 0 0 12px; }
h3 { font-size: 13px; margin: 0 0 8px; color: var(--ink-2); text-transform: uppercase; letter-spacing: .04em; }
code { font: 12px ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; background: #f1f2f4; padding: 1px 5px; border-radius: 4px; }

.shell { display: grid; grid-template-columns: 220px 1fr; min-height: 100vh; background: linear-gradient(to right, #0f1729 220px, var(--bg) 220px); }
.side { background: #0f1729; color: #cbd5e1; padding: 20px 12px; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; }
.brand { color: #fff; font-weight: 700; font-size: 16px; padding: 4px 10px 20px; letter-spacing: -.01em; }
.brand small { display: block; font-weight: 400; color: #8391a7; font-size: 11px; }
.nav a { display: flex; align-items: center; gap: 10px; color: #cbd5e1; padding: 8px 10px; border-radius: 8px; font-weight: 500; }
.nav a:hover { background: #1b2640; text-decoration: none; color: #fff; }
.nav a.on { background: #24324f; color: #fff; }
.nav svg { width: 16px; height: 16px; opacity: .85; }
.side .foot { margin-top: auto; padding: 10px; font-size: 12px; color: #8391a7; }
.side .foot button { background: none; border: 0; color: #cbd5e1; padding: 0; cursor: pointer; font: inherit; }

main { padding: 28px 32px 60px; max-width: 1280px; width: 100%; }
.head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.head .sub { color: var(--muted); margin-top: 2px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; }
.card + .card, .grid + .card, .card + .grid, .grid + .grid, form + .card, .card + form, p + .grid { margin-top: 16px; }
.grid > .card, .grid > form.card, .grid > div > .card:first-child { margin-top: 0; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-side { grid-template-columns: minmax(0, 1fr) 360px; }
@media (max-width: 1100px) { .g4 { grid-template-columns: repeat(2, 1fr); } .g-side { grid-template-columns: 1fr; } }
@media (max-width: 760px) { .shell { grid-template-columns: 1fr; background: var(--bg); } .side { position: static; height: auto; } .g2, .g3, .g4 { grid-template-columns: 1fr; } main { padding: 18px; } }

.stat .label { color: var(--muted); font-size: 12px; font-weight: 500; }
.stat .value { font-size: 26px; font-weight: 650; letter-spacing: -.02em; margin-top: 2px; font-variant-numeric: tabular-nums; }
.stat .note { color: var(--muted); font-size: 12px; margin-top: 2px; }
.stat.good .value { color: var(--ok); }
.stat.bad .value { color: var(--err); }

.meter { height: 8px; background: #eef0f3; border-radius: 99px; overflow: hidden; margin-top: 8px; }
.meter > span { display: block; height: 100%; background: var(--accent); border-radius: 99px; }

.chart { display: flex; align-items: flex-end; gap: 3px; height: 140px; padding-top: 8px; }
.chart .bar { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; height: 100%; position: relative; }
.chart .bar i { display: block; background: #c9d6f7; border-radius: 3px 3px 0 0; min-height: 1px; }
.chart .bar i.o { background: var(--accent); border-radius: 0; position: absolute; bottom: 0; left: 0; right: 0; }
.chart-x { display: flex; justify-content: space-between; color: var(--muted); font-size: 11px; margin-top: 6px; }
.legend { display: flex; gap: 14px; color: var(--muted); font-size: 12px; }
.legend span::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; vertical-align: -1px; background: #c9d6f7; }
.legend span.o::before { background: var(--accent); }

table.t { width: 100%; border-collapse: collapse; }
.t th { text-align: left; font-weight: 600; color: var(--muted); font-size: 12px; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.t td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.t tr:last-child td { border-bottom: 0; }
.t td.num, .t th.num { text-align: right; font-variant-numeric: tabular-nums; }
.t .dim { color: var(--muted); font-size: 12px; }
.wrap { overflow-x: auto; }
.trunc { max-width: 420px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.pill { display: inline-block; padding: 2px 8px; border-radius: 99px; font-size: 12px; font-weight: 600; background: #eef0f3; color: var(--ink-2); white-space: nowrap; }
.pill.subscribed, .pill.sent, .pill.ok { background: var(--ok-bg); color: var(--ok); }
.pill.sending, .pill.scheduled { background: #e8efff; color: var(--accent); }
.pill.paused, .pill.unsubscribed, .pill.warn { background: var(--warn-bg); color: var(--warn); }
.pill.bounced, .pill.complained, .pill.failed, .pill.canceled, .pill.error { background: var(--err-bg); color: var(--err); }

.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: #fff; color: var(--ink); padding: 8px 14px; border-radius: 8px; font: 600 13px/1.2 inherit; font-family: inherit; cursor: pointer; text-decoration: none; }
.btn:hover { background: #f8f9fb; text-decoration: none; }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.primary:hover { filter: brightness(1.07); }
.btn.danger { color: var(--err); }
.btn.small { padding: 5px 10px; font-size: 12px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
form.inline { display: inline; }

label { display: block; font-weight: 600; font-size: 13px; margin: 0 0 6px; color: var(--ink-2); }
.field { margin-bottom: 14px; }
.hint { color: var(--muted); font-size: 12px; font-weight: 400; margin-top: 4px; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=datetime-local], input[type=search], select, textarea {
  width: 100%; border: 1px solid #d1d5db; border-radius: 8px; padding: 8px 10px; font: inherit; background: #fff; color: var(--ink); }
input:focus, select:focus, textarea:focus { outline: 2px solid #c7d6fb; border-color: var(--accent); }
textarea { min-height: 90px; resize: vertical; }
textarea.code { font: 12px/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; min-height: 520px; white-space: pre; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 500; margin: 6px 0; }
.check input { width: auto; }
.checks { max-height: 260px; overflow: auto; border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; }
.row { display: flex; gap: 12px; }
.row > * { flex: 1; }

.flash { padding: 10px 14px; border-radius: 8px; margin-bottom: 12px; font-weight: 500; border: 1px solid transparent; }
.flash.ok { background: var(--ok-bg); color: var(--ok); border-color: #c4ead5; }
.flash.warn { background: var(--warn-bg); color: var(--warn); border-color: #f3dfaa; }
.flash.error { background: var(--err-bg); color: var(--err); border-color: #f6c9c3; }

.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.filters input, .filters select { width: auto; min-width: 150px; }
.pager { display: flex; justify-content: space-between; align-items: center; margin-top: 12px; color: var(--muted); }

.preview { width: 100%; height: 640px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.kv { display: grid; grid-template-columns: 140px 1fr; gap: 6px 12px; }
.kv div:nth-child(odd) { color: var(--muted); }
.empty { text-align: center; color: var(--muted); padding: 30px 10px; }
details summary { cursor: pointer; font-weight: 600; }
.login { max-width: 380px; margin: 12vh auto; }
.login .brand { color: var(--ink); padding: 0 0 16px; font-size: 20px; }
.split { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.mt { margin-top: 16px; }
.muted { color: var(--muted); }
.big-count { font-size: 30px; font-weight: 700; letter-spacing: -.02em; }
