/* PureReach — app styles (px units only) */
:root {
  --brand: #0e9f6e;
  --brand-dark: #057a55;
  --brand-soft: #e6f6f0;
  --ink: #111827;
  --muted: #6b7280;
  --line: #e5e7eb;
  --bg: #f6f7f9;
  --card: #ffffff;
  --side: #0f1b2d;
  --side-ink: #c7d0dd;
  --red: #dc2626;
  --red-soft: #fdecec;
  --amber: #d97706;
  --amber-soft: #fef5e6;
  --blue: #2563eb;
  --blue-soft: #e8effd;
  --gray-soft: #f1f2f4;
  --radius: 10px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, Helvetica, Arial, sans-serif;
  font-size: 14px;
  line-height: 22px;
  color: var(--ink);
  background: var(--bg);
}
a { color: var(--brand-dark); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 24px; line-height: 32px; margin: 0; font-weight: 700; }
h2 { font-size: 18px; line-height: 26px; margin: 0 0 12px; font-weight: 650; }
h3 { font-size: 15px; line-height: 22px; margin: 0 0 8px; font-weight: 650; }
p { margin: 0 0 12px; }
code { background: var(--gray-soft); padding: 1px 6px; border-radius: 4px; font-size: 13px; }

/* ---------- Shell ---------- */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: 232px; flex: 0 0 232px; background: var(--side); color: var(--side-ink);
  padding: 20px 14px; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column;
}
.logo { display: flex; align-items: center; gap: 10px; color: #fff; font-weight: 750; font-size: 19px; padding: 4px 10px 22px; }
.logo-mark {
  width: 32px; height: 32px; border-radius: 9px; background: linear-gradient(135deg, #34d399, #0e9f6e);
  display: grid; place-items: center; color: #fff; font-size: 16px; font-weight: 800;
}
.nav a {
  display: flex; align-items: center; gap: 10px; color: var(--side-ink); padding: 9px 12px; border-radius: 8px;
  margin-bottom: 2px; font-weight: 500;
}
.nav a:hover { background: rgba(255,255,255,0.06); color: #fff; text-decoration: none; }
.nav a.active { background: rgba(52,211,153,0.16); color: #fff; }
.nav svg { width: 18px; height: 18px; flex: 0 0 18px; opacity: 0.9; }
.nav-sep { height: 1px; background: rgba(255,255,255,0.08); margin: 12px 8px; }
.sidebar-foot { margin-top: auto; padding: 10px 12px; font-size: 12px; color: #8391a7; }
.sidebar-foot a { color: #8391a7; }

.main { flex: 1; min-width: 0; padding: 28px 36px 60px; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head .sub { color: var(--muted); margin-top: 2px; }
.crumbs { font-size: 13px; color: var(--muted); margin-bottom: 4px; }

/* ---------- Cards ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin-bottom: 20px; }
.card-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; gap: 12px; flex-wrap: wrap; }
.card-head h2 { margin: 0; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
@media (max-width: 1100px) { .grid-4, .grid-5 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .grid-3 { grid-template-columns: 1fr; } }

.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; }
.stat .label { color: var(--muted); font-size: 13px; display: flex; align-items: center; gap: 6px; }
.stat .value { font-size: 26px; line-height: 34px; font-weight: 700; margin-top: 4px; }
.stat .meta { font-size: 12px; color: var(--muted); }
.stat.green .value { color: var(--brand-dark); }
.stat.red .value { color: var(--red); }
.stat.amber .value { color: var(--amber); }
.stat.blue .value { color: var(--blue); }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.dot.green { background: var(--brand); } .dot.red { background: var(--red); } .dot.amber { background: var(--amber); } .dot.gray { background: #9ca3af; } .dot.blue { background: var(--blue); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--line); background: #fff; color: var(--ink);
  padding: 8px 14px; border-radius: 8px; font-size: 14px; font-weight: 550; cursor: pointer; line-height: 20px;
  font-family: inherit; white-space: nowrap;
}
.btn:hover { background: #f9fafb; text-decoration: none; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); }
.btn-danger { color: var(--red); }
.btn-danger:hover { background: var(--red-soft); }
.btn-sm { padding: 5px 10px; font-size: 13px; }
.btn-link { background: none; border: none; color: var(--brand-dark); padding: 0; cursor: pointer; font: inherit; }
.btn-link.danger { color: var(--red); }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
form.inline { display: inline; }

/* ---------- Forms ---------- */
.field { margin-bottom: 16px; }
.field label, .label-text { display: block; font-weight: 600; margin-bottom: 6px; font-size: 14px; }
.field .hint { color: var(--muted); font-size: 13px; margin-top: 4px; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=url], input[type=datetime-local], select, textarea {
  width: 100%; border: 1px solid #d1d5db; border-radius: 8px; padding: 9px 12px; font: inherit; color: var(--ink); background: #fff;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(14,159,110,0.15); }
textarea { min-height: 120px; resize: vertical; }
textarea.code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; line-height: 20px; }
.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 500; margin-bottom: 10px; cursor: pointer; }
.check input { margin-top: 4px; }
.radio-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.radio-card { border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; cursor: pointer; display: flex; gap: 10px; align-items: flex-start; }
.radio-card:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); }
.radio-card strong { display: block; }
.radio-card span { color: var(--muted); font-size: 13px; }
.dropzone {
  border: 2px dashed #cbd5e1; border-radius: var(--radius); padding: 34px; text-align: center; background: #fbfcfd; cursor: pointer;
}
.dropzone.drag { border-color: var(--brand); background: var(--brand-soft); }
.dropzone strong { display: block; font-size: 15px; margin-bottom: 4px; }
.dropzone .muted { font-size: 13px; }
.form-narrow { max-width: 720px; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: 0.4px; color: var(--muted); font-weight: 600; padding: 10px 12px; border-bottom: 1px solid var(--line); background: #fafbfc; }
td { padding: 11px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: #fcfcfd; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.empty { text-align: center; padding: 48px 20px; color: var(--muted); }
.empty h3 { color: var(--ink); }

/* ---------- Badges ---------- */
.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; text-transform: capitalize; background: var(--gray-soft); color: #374151; }
.badge-valid, .badge-ready, .badge-sent, .badge-delivered, .badge-verified, .badge-active { background: var(--brand-soft); color: var(--brand-dark); }
.badge-invalid, .badge-failed, .badge-bounced, .badge-complained, .badge-suspended, .badge-expired { background: var(--red-soft); color: var(--red); }
.badge-risky, .badge-paused, .badge-scheduled { background: var(--amber-soft); color: var(--amber); }
.badge-unknown, .badge-draft { background: var(--gray-soft); color: #4b5563; }
.badge-verifying, .badge-sending, .badge-pending, .badge-queued { background: var(--blue-soft); color: var(--blue); }
.badge-dnd { background: #f1ecfe; color: #6d28d9; }
.badge-html { background: #e9f3fb; color: #0369a1; }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 14px; flex-wrap: wrap; }
.tabs a { padding: 8px 12px; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; font-weight: 550; }
.tabs a:hover { color: var(--ink); text-decoration: none; }
.tabs a.active { color: var(--brand-dark); border-bottom-color: var(--brand); }
.tabs .count { font-size: 12px; background: var(--gray-soft); border-radius: 999px; padding: 0 7px; margin-left: 4px; }

/* ---------- Flash ---------- */
.flash { padding: 12px 16px; border-radius: 8px; margin-bottom: 18px; font-weight: 500; }
.flash-success { background: var(--brand-soft); color: var(--brand-dark); border: 1px solid #b7e6d3; }
.flash-error { background: var(--red-soft); color: var(--red); border: 1px solid #f6c6c6; }
.notice { padding: 12px 16px; border-radius: 8px; background: var(--amber-soft); color: #92400e; border: 1px solid #f6dfb5; margin-bottom: 18px; }
.notice-info { background: var(--blue-soft); color: #1e40af; border-color: #c9d8fb; }
.notice-ok { background: var(--brand-soft); color: var(--brand-dark); border-color: #b7e4d2; }
.notice-error { background: var(--red-soft); color: #991b1b; border-color: #f6c6c6; }

/* ---------- Progress ---------- */
.progress { height: 10px; background: var(--gray-soft); border-radius: 999px; overflow: hidden; }
.progress > div { height: 100%; background: var(--brand); transition: width 0.4s; }
.bar-split { display: flex; height: 12px; border-radius: 999px; overflow: hidden; background: var(--gray-soft); }
.bar-split > div { height: 100%; }

/* ---------- Pager ---------- */
.pager { display: flex; justify-content: space-between; align-items: center; margin-top: 14px; color: var(--muted); font-size: 13px; }

/* ---------- Templates ---------- */
.tpl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 18px; }
.tpl-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; }
.tpl-thumb { height: 260px; overflow: hidden; background: #f3f4f6; position: relative; border-bottom: 1px solid var(--line); }
.tpl-thumb iframe { width: 800px; height: 1040px; border: 0; transform: scale(0.3125); transform-origin: 0 0; pointer-events: none; background: #fff; }
.tpl-body { padding: 14px 16px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.tpl-body .name { font-weight: 650; }
.tpl-actions { display: flex; gap: 12px; margin-top: auto; font-size: 13px; }

.editor-bar {
  display: flex; align-items: center; gap: 12px; padding: 10px 16px; background: #fff; border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 20;
}
.editor-bar input[type=text] { max-width: 340px; }
.editor-bar .spacer { flex: 1; }
.editor-full { height: calc(100vh - 58px); }
.html-editor { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); height: calc(100vh - 58px); }
.html-editor textarea { height: 100%; border: 0; border-right: 1px solid var(--line); border-radius: 0; resize: none; padding: 16px; min-height: 0; }
.html-editor iframe { width: 100%; height: 100%; border: 0; background: #fff; }
.merge-tags { font-size: 12px; color: var(--muted); }
.merge-tags code { cursor: pointer; }

/* ---------- Auth ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr); place-items: center; background: linear-gradient(160deg, #0f1b2d, #133b33); padding: 20px; }
.auth-admin { background: linear-gradient(160deg, #1a1230, #2e1065); }
.auth-card { width: 400px; max-width: 100%; background: #fff; border-radius: 14px; padding: 32px; box-shadow: 0 20px 50px rgba(0,0,0,0.25); }
.auth-card .logo { color: var(--ink); padding: 0 0 18px; }
.logo-img { display: block; height: 26px; width: auto; }
.auth-card .logo-img, .public-card .logo-img { height: 32px; }
.logo-admin { flex-direction: column; align-items: flex-start; gap: 8px; }
.logo-admin .admin-tag { margin-left: 0; }

/* ---------- Report ---------- */
.funnel { display: grid; gap: 10px; }
.funnel-row { display: grid; grid-template-columns: 140px 1fr 110px; align-items: center; gap: 12px; }
.funnel-row .bar { height: 14px; background: var(--gray-soft); border-radius: 999px; overflow: hidden; }
.funnel-row .bar > div { height: 100%; border-radius: 999px; }
.chart { width: 100%; height: 220px; }
.legend { display: flex; gap: 16px; font-size: 13px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.tip { font-size: 13px; color: var(--muted); }
.kv { display: grid; grid-template-columns: 160px 1fr; gap: 6px 16px; font-size: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.link-url { max-width: 520px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }
.public-page { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: var(--bg); }
.public-card { width: 460px; max-width: 100%; background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 32px; text-align: center; }

/* ---------- SaaS bits ---------- */
.acct-name { color: #fff; font-weight: 600; font-size: 13px; }
.impersonate-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; background: #fff7e6; border: 1px solid #f6dfb5;
  color: #92400e; padding: 10px 16px; border-radius: 8px; margin-bottom: 18px;
}
.sidebar.admin { background: #1a1230; }
.sidebar.admin .nav a.active { background: rgba(167,139,250,0.2); }
.admin-tag { font-size: 11px; background: #7c3aed; color: #fff; padding: 1px 7px; border-radius: 999px; margin-left: 4px; font-weight: 700; letter-spacing: 0.3px; }
.usage { display: grid; gap: 4px; }
.usage .row { display: flex; justify-content: space-between; font-size: 13px; }
.usage .progress { height: 7px; }
.usage .progress.warn > div { background: var(--amber); }
.usage .progress.full > div { background: var(--red); }
.plan-card { border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; background: #fff; }
.plan-card .price { font-size: 26px; font-weight: 700; margin: 6px 0 10px; }
.plan-card .price span { font-size: 14px; color: var(--muted); font-weight: 500; }
.plan-card ul { margin: 0 0 14px; padding-left: 18px; color: #374151; }

/* ---------- Sender domains ---------- */
.dns-record { border: 1px solid var(--line); border-radius: 10px; padding: 16px; margin-bottom: 12px; }
.dns-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 6px; }
.dns-grid { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 8px 12px; align-items: start; }
.dns-label { color: var(--muted); font-size: 13px; padding-top: 3px; }
.dns-copy { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; min-width: 0; }
.dns-copy code { word-break: break-all; }
.dns-value { display: block; flex: 1 1 320px; padding: 8px 10px; font-size: 12px; line-height: 18px; max-height: 120px; overflow: auto; }

/* ---------- Subscription ---------- */
.sub-line { display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 0 0 14px; color: var(--muted); font-size: 13px; }
.sub-line strong { color: var(--ink); font-weight: 600; }
.quick-dates { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
