:root {
    --bg: #f4f6fa; --card: #fff; --ink: #1f2937; --muted: #6b7280; --line: #e5e7eb;
    --brand: #2563eb; --brand-d: #1d4ed8; --ok: #15803d; --warn: #b45309; --err: #b91c1c;
}
* { box-sizing: border-box; }
body { margin: 0; font: 14px/1.5 -apple-system, "Segoe UI", Roboto, Arial, sans-serif; background: var(--bg); color: var(--ink); display: flex; min-height: 100vh; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
.side { width: 220px; background: #111827; color: #d1d5db; display: flex; flex-direction: column; flex-shrink: 0; position: sticky; top: 0; height: 100vh; }
.brand { padding: 18px 20px; font-weight: 700; color: #fff; font-size: 16px; }
.side nav { flex: 1; }
.side nav a { display: block; padding: 10px 20px; color: #d1d5db; border-left: 3px solid transparent; }
.side nav a:hover { background: #1f2937; text-decoration: none; }
.side nav a.on { background: #1f2937; color: #fff; border-left-color: var(--brand); }
.who { padding: 16px 20px; font-size: 12px; border-top: 1px solid #1f2937; }
.who a { color: #9ca3af; }
main { flex: 1; padding: 24px 32px 48px; min-width: 0; max-width: 1200px; }
h1 { margin: 0 0 18px; font-size: 22px; }
h2 { font-size: 16px; margin: 0 0 12px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 18px 20px; margin-bottom: 18px; }
.grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); margin-bottom: 18px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; }
.stat b { display: block; font-size: 24px; line-height: 1.2; }
.stat span { color: var(--muted); font-size: 12px; }
table { width: 100%; border-collapse: collapse; background: var(--card); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
th, td { padding: 9px 12px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { background: #f9fafb; font-size: 12px; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; }
.table-wrap { overflow-x: auto; margin-bottom: 14px; }
label { display: block; font-weight: 600; margin: 12px 0 4px; }
label small { font-weight: 400; color: var(--muted); }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=search], input[type=file], select, textarea {
    width: 100%; padding: 8px 10px; border: 1px solid #d1d5db; border-radius: 6px; font: inherit; background: #fff; color: inherit;
}
textarea { min-height: 120px; font-family: Consolas, monospace; font-size: 13px; }
input:focus, select:focus, textarea:focus { outline: 2px solid #bfdbfe; border-color: var(--brand); }
.row { display: flex; gap: 14px; flex-wrap: wrap; }
.row > * { flex: 1 1 200px; }
.inline { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.inline > input, .inline > select { width: auto; flex: 1 1 160px; }
.btn, button { display: inline-block; background: var(--brand); color: #fff; border: 0; border-radius: 6px; padding: 8px 14px; font: inherit; cursor: pointer; font-weight: 600; }
.btn:hover, button:hover { background: var(--brand-d); text-decoration: none; }
.btn.ghost, button.ghost { background: #fff; color: var(--ink); border: 1px solid #d1d5db; }
.btn.ghost:hover, button.ghost:hover { background: #f3f4f6; }
.btn.danger, button.danger { background: var(--err); }
.btn.sm, button.sm { padding: 4px 10px; font-size: 12px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.actions form { margin: 0; }
.alert { padding: 10px 14px; border-radius: 8px; margin-bottom: 14px; border: 1px solid; }
.alert.ok { background: #f0fdf4; border-color: #bbf7d0; color: var(--ok); }
.alert.err { background: #fef2f2; border-color: #fecaca; color: var(--err); }
.alert.warn { background: #fffbeb; border-color: #fde68a; color: var(--warn); }
.badge { display: inline-block; padding: 2px 8px; border-radius: 99px; font-size: 12px; font-weight: 600; background: #e5e7eb; color: #374151; }
.badge.active, .badge.done, .badge.sent { background: #dcfce7; color: var(--ok); }
.badge.sending, .badge.pending { background: #dbeafe; color: var(--brand-d); }
.badge.paused, .badge.draft, .badge.skipped { background: #fef3c7; color: var(--warn); }
.badge.unsubscribed, .badge.bounced, .badge.failed { background: #fee2e2; color: var(--err); }
.muted { color: var(--muted); }
.pager { display: flex; gap: 6px; align-items: center; margin: 12px 0; }
.pager a { padding: 4px 10px; border: 1px solid var(--line); border-radius: 6px; background: #fff; }
.pager a.on { background: var(--brand); color: #fff; border-color: var(--brand); }
.bar { height: 10px; background: #e5e7eb; border-radius: 99px; overflow: hidden; min-width: 80px; }
.bar > i { display: block; height: 100%; background: var(--brand); }
.bar.ok > i { background: #16a34a; }
.chart { display: flex; align-items: flex-end; gap: 3px; height: 110px; padding-top: 8px; }
.chart > div { flex: 1; max-width: 36px; background: var(--brand); border-radius: 3px 3px 0 0; min-height: 2px; position: relative; }
.chart-x { display: flex; gap: 3px; font-size: 10px; color: var(--muted); }
.chart-x > span { flex: 1; text-align: center; overflow: hidden; }
.checks { display: flex; flex-wrap: wrap; gap: 6px 18px; }
.checks label { font-weight: 400; margin: 0; display: flex; gap: 6px; align-items: center; }
iframe.preview { width: 100%; height: 480px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
code, pre { background: #f3f4f6; padding: 2px 6px; border-radius: 4px; font-size: 13px; }
pre { padding: 10px 12px; overflow-x: auto; }
.center-box { max-width: 420px; margin: 8vh auto; width: 100%; padding: 0 16px; }
.center-box h1 { text-align: center; }
body.plain { display: block; }
@media (max-width: 800px) {
    body { flex-direction: column; }
    .side { width: 100%; height: auto; position: static; }
    .side nav { display: flex; flex-wrap: wrap; }
    .side nav a { border-left: 0; padding: 8px 12px; }
    main { padding: 16px; }
}
