/* mailraft — monochrome admin UI */
:root {
  --bg: #ffffff;
  --fg: #0a0a0a;
  --muted: #6e6e6e;
  --faint: #a3a3a3;
  --line: #e7e7e7;
  --soft: #f6f6f6;
  --hover: #f0f0f0;
  --ink: #0a0a0a;
  --on-ink: #ffffff;
  --radius: 8px;
  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b0b0b;
    --fg: #ededed;
    --muted: #9a9a9a;
    --faint: #5c5c5c;
    --line: #242424;
    --soft: #131313;
    --hover: #1a1a1a;
    --ink: #f2f2f2;
    --on-ink: #0b0b0b;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--fg);
  font: 14px/1.55 var(--sans); -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration-color: var(--faint); text-underline-offset: 3px; }
a:hover { text-decoration-color: var(--fg); }
code, pre, .mono { font-family: var(--mono); font-size: 12.5px; }
h1 { font-size: 22px; font-weight: 600; letter-spacing: -0.01em; margin: 0; }
h2 { font-size: 15px; font-weight: 600; margin: 0 0 12px; }
h3 { font-size: 13px; font-weight: 600; margin: 0 0 8px; }
p { margin: 0 0 12px; }
hr { border: 0; border-top: 1px solid var(--line); margin: 24px 0; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.grow { flex: 1; }

/* top bar */
.top {
  position: sticky; top: 0; z-index: 10; background: var(--bg);
  border-bottom: 1px solid var(--line);
}
.top-in { max-width: 1180px; margin: 0 auto; padding: 0 24px; display: flex; align-items: center; gap: 28px; height: 54px; }
.brand { font-family: var(--mono); font-weight: 700; font-size: 14px; letter-spacing: -0.02em; text-decoration: none; display: flex; align-items: center; gap: 8px; }
.brand i { width: 14px; height: 14px; background: var(--ink); display: inline-block; border-radius: 3px; transform: rotate(45deg) scale(.8); }
.nav { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; }
.nav a { text-decoration: none; color: var(--muted); padding: 6px 10px; border-radius: 6px; white-space: nowrap; }
.nav a:hover { color: var(--fg); background: var(--hover); }
.nav a.on { color: var(--fg); background: var(--soft); font-weight: 500; }
.who { margin-left: auto; display: flex; gap: 10px; align-items: center; color: var(--muted); white-space: nowrap; }
.who form { margin: 0; }

main { max-width: 1180px; margin: 0 auto; padding: 32px 24px 80px; }
.head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.head .sub { color: var(--muted); margin-top: 4px; }
.crumbs { color: var(--muted); font-size: 12.5px; margin-bottom: 6px; }
.crumbs a { text-decoration: none; }
.crumbs a:hover { color: var(--fg); }

/* cards & grids */
.card { border: 1px solid var(--line); border-radius: 12px; padding: 20px; background: var(--bg); }
.card + .card, .card + .stack, .stack + .card { margin-top: 20px; }
.card.flush { padding: 0; overflow: hidden; }
.card.flush > h2, .card .pad { padding: 18px 20px 0; }
.stack > * + * { margin-top: 20px; }
.grid { display: grid; gap: 20px; }
.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)); }
.g6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
@media (max-width: 900px) { .g3, .g4, .g6 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g2 { grid-template-columns: 1fr; } }
@media (max-width: 520px) { .g3, .g4, .g6 { grid-template-columns: 1fr; } main { padding: 20px 16px 60px; } .top-in { padding: 0 16px; gap: 14px; } }

.stat { border: 1px solid var(--line); border-radius: 12px; padding: 16px 18px; }
.stat .k { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .06em; }
.stat .v { font-size: 26px; font-weight: 600; letter-spacing: -0.02em; margin-top: 6px; font-variant-numeric: tabular-nums; }
.stat .d { color: var(--muted); font-size: 12.5px; margin-top: 2px; }

/* chart */
.chart { display: flex; align-items: flex-end; gap: 6px; height: 120px; padding: 8px 0 0; }
.chart .col { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; height: 100%; position: relative; }
.chart .bar { background: var(--ink); border-radius: 3px 3px 0 0; min-height: 1px; }
.chart .bar.zero { background: var(--line); }
.chart .col:hover .tip { display: block; }
.chart .tip { display: none; position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%); background: var(--ink); color: var(--on-ink); padding: 6px 8px; border-radius: 6px; font-size: 11.5px; white-space: nowrap; z-index: 2; margin-bottom: 4px; }
.axis { display: flex; gap: 6px; margin-top: 6px; }
.axis span { flex: 1; text-align: center; font-size: 10.5px; color: var(--faint); white-space: nowrap; overflow: hidden; }

/* tables */
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-weight: 500; color: var(--muted); font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 11px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: var(--soft); }
.card.flush table th:first-child, .card.flush table td:first-child { padding-left: 20px; }
.card.flush table th:last-child, .card.flush table td:last-child { padding-right: 20px; }
td.clip { max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rowlink { text-decoration: none; display: block; }
.tablewrap { overflow-x: auto; }

/* badges */
.b { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 500; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--fg); white-space: nowrap; line-height: 1.5; }
.b::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.b.pass, .b.delivered, .b.active { background: var(--ink); color: var(--on-ink); border-color: var(--ink); }
.b.fail, .b.bounced { border-color: var(--fg); background: transparent; }
.b.fail::before, .b.bounced::before { background: transparent; border: 1.5px solid currentColor; width: 5px; height: 5px; }
.b.warn, .b.deferred, .b.next, .b.retiring { border-style: dashed; }
.b.pending, .b.queued, .b.sending, .b.info, .b.dropped, .b.cancelled, .b.retired { border-color: var(--line); color: var(--muted); background: var(--soft); }
.b.plain::before { display: none; }

/* forms */
label { display: block; font-weight: 500; margin-bottom: 6px; }
.hint { color: var(--muted); font-size: 12.5px; margin-top: 6px; font-weight: 400; }
input[type=text], input[type=email], input[type=password], input[type=url], input[type=number], input[type=date], input[type=search], select, textarea {
  width: 100%; font: inherit; color: var(--fg); background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 11px; outline: none; transition: border-color .12s;
}
textarea { font-family: var(--mono); font-size: 12.5px; line-height: 1.5; min-height: 120px; resize: vertical; }
textarea.tall { min-height: 360px; }
input:focus, select:focus, textarea:focus { border-color: var(--fg); }
.field { margin-bottom: 18px; }
.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; cursor: pointer; }
.check input { margin-top: 3px; accent-color: var(--fg); }
.inline { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.inline .field { margin-bottom: 0; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 16px; }
.filters > * { flex: 0 1 auto; }
.filters input[type=search] { min-width: 240px; }
form.inline-form { display: inline; margin: 0; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; font: inherit; font-weight: 500; text-decoration: none; cursor: pointer; border-radius: var(--radius); padding: 8px 14px; border: 1px solid var(--ink); background: var(--ink); color: var(--on-ink); white-space: nowrap; line-height: 1.3; }
.btn:hover { opacity: .88; }
.btn.ghost { background: transparent; color: var(--fg); border-color: var(--line); }
.btn.ghost:hover { border-color: var(--fg); opacity: 1; }
.btn.danger { background: transparent; color: var(--fg); border-color: var(--fg); }
.btn.danger:hover { background: var(--ink); color: var(--on-ink); }
.btn.sm { padding: 4px 10px; font-size: 12.5px; }
.btn.link { background: none; border: 0; padding: 0; color: var(--muted); text-decoration: underline; text-underline-offset: 3px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* flash & notes */
.flash { border: 1px solid var(--fg); border-radius: 10px; padding: 12px 16px; margin-bottom: 24px; display: flex; gap: 10px; align-items: flex-start; }
.flash.ok { background: var(--ink); color: var(--on-ink); border-color: var(--ink); }
.flash.err { border-width: 1.5px; }
.note { background: var(--soft); border-radius: 10px; padding: 14px 16px; color: var(--fg); }
.note p:last-child { margin: 0; }
.note.outline { background: transparent; border: 1px dashed var(--faint); }

/* DNS records */
.rec { border-top: 1px solid var(--line); padding: 16px 20px; display: grid; grid-template-columns: 110px minmax(0, 1fr) 140px; gap: 16px; }
.rec:first-of-type { border-top: 0; }
.rec .type { font-family: var(--mono); font-weight: 600; font-size: 12.5px; }
.rec .kv { display: grid; grid-template-columns: 56px minmax(0, 1fr); gap: 6px 10px; align-items: start; margin-top: 8px; }
.rec .kv span { color: var(--muted); font-size: 12px; padding-top: 5px; }
.copy { display: flex; align-items: stretch; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; background: var(--soft); }
.copy code { flex: 1; padding: 5px 9px; word-break: break-all; white-space: pre-wrap; }
.copy button { border: 0; border-left: 1px solid var(--line); background: var(--bg); color: var(--muted); font: inherit; font-size: 11.5px; padding: 0 10px; cursor: pointer; }
.copy button:hover { color: var(--fg); }
.copy button.done { color: var(--fg); font-weight: 600; }
.rec .status { text-align: right; }
.rec .detail { grid-column: 2 / 4; color: var(--muted); font-size: 12.5px; margin-top: -4px; }
@media (max-width: 760px) { .rec { grid-template-columns: 1fr; } .rec .status { text-align: left; } .rec .detail { grid-column: 1; } }

/* misc */
.kvlist { display: grid; grid-template-columns: 170px minmax(0, 1fr); gap: 8px 16px; }
.kvlist dt { color: var(--muted); }
.kvlist dd { margin: 0; word-break: break-word; }
@media (max-width: 600px) { .kvlist { grid-template-columns: 1fr; } .kvlist dd { margin-bottom: 8px; } }
pre.block { background: var(--soft); border-radius: 10px; padding: 14px 16px; overflow: auto; margin: 0; white-space: pre-wrap; word-break: break-word; max-height: 520px; }
.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { display: grid; grid-template-columns: 150px 120px minmax(0, 1fr); gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.timeline li:last-child { border-bottom: 0; }
@media (max-width: 700px) { .timeline li { grid-template-columns: 1fr; gap: 4px; } }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 20px; overflow-x: auto; }
.tabs a { text-decoration: none; padding: 9px 12px; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs a.on { color: var(--fg); border-bottom-color: var(--fg); font-weight: 500; }
.tabs a .count { color: var(--faint); margin-left: 4px; font-variant-numeric: tabular-nums; }
.checklist { list-style: none; margin: 0; padding: 0; }
.checklist li { display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--line); align-items: start; }
.checklist li:last-child { border-bottom: 0; }
.dot { width: 14px; height: 14px; border-radius: 50%; border: 1.5px solid var(--fg); margin-top: 3px; }
.dot.pass { background: var(--ink); border-color: var(--ink); }
.dot.warn { border-style: dashed; }
.dot.pending, .dot.info { border-color: var(--faint); }
iframe.preview { width: 100%; height: 560px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.keybox { font-family: var(--mono); font-size: 13px; padding: 12px 14px; border: 1.5px solid var(--fg); border-radius: 10px; word-break: break-all; display: flex; gap: 12px; align-items: center; justify-content: space-between; }
.pager { display: flex; justify-content: space-between; margin-top: 16px; }
.empty { text-align: center; color: var(--muted); padding: 48px 20px; }
.empty b { color: var(--fg); display: block; font-size: 15px; margin-bottom: 6px; }
details summary { cursor: pointer; color: var(--muted); }
details[open] summary { margin-bottom: 10px; }
.scopes { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; margin-top: 8px; }

/* auth pages */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.auth .box { width: 100%; max-width: 360px; }
.auth .brand { justify-content: center; margin-bottom: 28px; font-size: 16px; }
.auth .btn { width: 100%; padding: 10px; }
