/* MailBuzz design tokens and components */
:root {
  --navy: #0D1B2A; --navy-2: #13263A; --teal: #2DD4BF; --teal-ink: #06201C;
  --brand: #0B7A6B; --brand-dark: #075E52; --brand-soft: #E3F4F1; --brand-tint: #F0FAF8;
  --ink: #101828; --ink-2: #1D2939; --muted: #5B6472; --muted-2: #475467; --line: #E4E7EC; --line-2: #EEF0F3;
  --bg: #F5F7FA; --card: #FFFFFF; --chip: #F2F4F7;
  --warn-bg: #FFF6E5; --warn-line: #F5D9A1; --warn-ink: #6B4300; --wait-bg: #FFF1D6; --wait-ink: #7A4A00;
  --danger: #B42318; --danger-bg: #FEE4E2;
  --radius: 12px; --radius-lg: 16px;
  --font: Inter, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --display: 'Space Grotesk', Inter, system-ui, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { font-family: var(--font); font-size: 14px; color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; }
a { color: var(--brand); } a:hover { color: var(--brand-dark); }
h1, h2, h3 { font-family: var(--display); letter-spacing: -0.4px; margin: 0; }
h1 { font-size: 32px; font-weight: 600; }
h2 { font-size: 20px; font-weight: 600; }
h3 { font-size: 16px; font-weight: 600; }
p { line-height: 1.55; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.mono { font-family: var(--mono); font-size: 13px; }
.hidden { display: none !important; }
.row { display: flex; align-items: center; gap: 12px; }
.row.wrap { flex-wrap: wrap; }
.spacer { flex: 1; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.stack-sm { display: flex; flex-direction: column; gap: 8px; }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px; border-radius: var(--radius);
  border: 1px solid var(--line); background: #fff; color: #344054; font: 600 14px var(--font); cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { background: #F9FAFB; color: var(--ink); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-dark); }
.btn.accent { background: var(--teal); border-color: var(--teal); color: var(--teal-ink); }
.btn.dark { background: var(--navy); border-color: var(--navy); color: #fff; }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.sm { min-height: 36px; padding: 0 12px; font-size: 13px; border-radius: 10px; }
.btn.icon { width: 44px; padding: 0; }
.btn svg { width: 18px; height: 18px; flex: 0 0 auto; }

/* forms */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 13px; font-weight: 500; color: #344054; }
.input, .field input, .field select, .field textarea {
  min-height: 44px; padding: 10px 14px; border: 1px solid var(--line); border-radius: var(--radius); font: 400 15px var(--font); color: var(--ink); background: #fff; width: 100%; }
.field textarea { min-height: 96px; resize: vertical; }
.input:focus, .field input:focus, .field select:focus, .field textarea:focus { outline: 2px solid rgba(11,122,107,.25); border-color: var(--brand); }
.hint { font-size: 12.5px; color: var(--muted); }
.error-text { color: var(--danger); font-size: 13.5px; }
.input-suffix { display: flex; align-items: stretch; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: #fff; }
.input-suffix input { border: 0; border-radius: 0; flex: 1; min-width: 0; }
.input-suffix span { display: flex; align-items: center; padding: 0 12px; background: var(--chip); color: var(--muted-2); font-size: 14px; white-space: nowrap; }

/* cards */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-lg); }
.card.pad { padding: 24px; }
.card-head { padding: 18px 24px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.card-body { padding: 20px 24px; }
.list-row { padding: 16px 24px; border-bottom: 1px solid var(--line-2); display: flex; align-items: center; gap: 12px 16px; flex-wrap: wrap; }
.list-row:last-child { border-bottom: 0; }

/* pills */
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; padding: 4px 10px; border-radius: 99px; background: var(--chip); color: #344054; white-space: nowrap; }
.pill::before { content: ''; width: 7px; height: 7px; border-radius: 99px; background: currentColor; }
.pill.ok { background: var(--brand-soft); color: var(--brand-dark); }
.pill.wait { background: var(--wait-bg); color: var(--wait-ink); }
.pill.bad { background: var(--danger-bg); color: var(--danger); }
.pill.plain::before { display: none; }
.tag { font-size: 12px; font-weight: 500; color: var(--brand-dark); background: var(--brand-soft); padding: 2px 8px; border-radius: 6px; }

/* notices */
.notice { padding: 14px 16px; border-radius: var(--radius); font-size: 13.5px; line-height: 1.5; }
.notice.warn { background: var(--warn-bg); color: var(--warn-ink); }
.notice.info { background: var(--brand-tint); color: var(--brand-dark); }
.notice.bad { background: var(--danger-bg); color: var(--danger); }

/* brand */
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: inherit; }
.brand-mark { width: 34px; height: 34px; border-radius: 10px; background: var(--teal); display: flex; align-items: center; justify-content: center; flex: 0 0 auto; }
.brand-mark svg { width: 20px; height: 20px; stroke: var(--teal-ink); }
.brand-mark.dark { background: var(--navy); } .brand-mark.dark svg { stroke: var(--teal); }
.brand-name { font-family: var(--display); font-weight: 700; font-size: 21px; letter-spacing: -0.3px; }
.brand-sub { font-weight: 500; font-size: 13px; color: #9FB0C3; margin-left: 4px; }

/* top bar (portal / admin) */
.topbar { background: #fff; border-bottom: 1px solid var(--line); padding: 0 24px; min-height: 68px; display: flex; flex-wrap: wrap; align-items: center; gap: 16px 24px; }
.topbar.dark { background: var(--navy); color: #fff; border-bottom: 0; }
.topnav { flex: 1; display: flex; flex-wrap: wrap; gap: 4px; }
.topnav a { min-height: 44px; padding: 0 16px; border-radius: 10px; display: flex; align-items: center; color: #344054; font-weight: 500; text-decoration: none; }
.topnav a.active { background: var(--brand-soft); color: var(--brand-dark); font-weight: 600; }
.topbar.dark .topnav a { color: #C9D3DF; }
.topbar.dark .topnav a.active { background: rgba(255,255,255,.12); color: #fff; }
.avatar { width: 40px; height: 40px; border-radius: 99px; background: var(--navy); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 600; flex: 0 0 auto; }
.avatar.teal { background: var(--teal); color: var(--teal-ink); }
.avatar.soft { background: var(--brand-soft); color: var(--brand-dark); }
.avatar.grey { background: var(--line-2); color: #344054; }

.page { max-width: 1240px; margin: 0 auto; padding: 32px 24px 64px; display: flex; flex-direction: column; gap: 24px; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; }
.page-head p { margin: 6px 0 0; color: var(--muted-2); font-size: 15px; max-width: 680px; }
.crumb { font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.crumb a { color: var(--muted); }

.grid-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }
.stat { padding: 20px; display: flex; flex-direction: column; gap: 6px; }
.stat .label { font-size: 13px; color: var(--muted); }
.stat .value { font-family: var(--display); font-size: 32px; font-weight: 600; letter-spacing: -0.8px; }
.stat.warn { background: var(--warn-bg); border-color: var(--warn-line); }
.stat.warn .label, .stat.warn .sub { color: var(--warn-ink); }
.split { display: flex; flex-wrap: wrap; gap: 24px; align-items: flex-start; }
.split > .main { flex: 999 1 600px; min-width: 0; }
.split > .side { flex: 1 1 300px; max-width: 420px; }

/* steps */
.steps { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 12px; }
.steps li { flex: 1 1 200px; display: flex; align-items: center; gap: 12px; padding: 14px 16px; background: #fff; border: 1px solid var(--line); border-radius: 14px; font-weight: 500; }
.steps li .n { width: 32px; height: 32px; border-radius: 99px; background: var(--line-2); color: #344054; display: flex; align-items: center; justify-content: center; font-weight: 600; flex: 0 0 auto; }
.steps li.done .n { background: var(--brand); color: #fff; }
.steps li.current { border: 2px solid var(--brand); font-weight: 600; }
.steps li.current .n { background: var(--navy); color: #fff; }
.steps li.todo { color: var(--muted); }

/* dns records */
.dns-row { padding: 18px 24px; border-bottom: 1px solid var(--line-2); display: grid; grid-template-columns: 70px minmax(120px, 170px) minmax(0, 1fr) auto auto; gap: 12px 18px; align-items: center; }
.dns-row:last-child { border-bottom: 0; }
.dns-row .lbl { font-size: 12px; color: var(--muted); }
.dns-row .val { font-family: var(--mono); font-size: 13px; overflow-wrap: anywhere; }
.dns-row .type { font-family: var(--mono); font-size: 12px; font-weight: 500; background: var(--line-2); padding: 4px 8px; border-radius: 6px; justify-self: start; }
.dns-row .help { grid-column: 2 / -1; font-size: 12.5px; color: var(--muted); margin-top: -4px; }
@media (max-width: 760px) {
  .dns-row { grid-template-columns: 1fr auto; }
  .dns-row .help { grid-column: 1 / -1; }
}
.progress { height: 8px; border-radius: 99px; background: var(--line-2); overflow: hidden; }
.progress > div { height: 100%; border-radius: 99px; background: var(--brand); transition: width .3s; }

/* tables */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-size: 12px; font-weight: 600; color: var(--muted); letter-spacing: .3px; text-transform: uppercase; padding: 12px 16px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 14px 16px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tr.click { cursor: pointer; } .table tr.click:hover td { background: #F9FAFB; }

/* chips/segmented */
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { min-height: 36px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line); background: #fff; color: #344054; font: 500 13px var(--font); cursor: pointer; display: inline-flex; align-items: center; }
.chip.active { background: var(--ink); border-color: var(--ink); color: #fff; }

/* modal */
.modal-back { position: fixed; inset: 0; background: rgba(13,27,42,.45); display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 50; }
.modal { background: #fff; border-radius: 18px; width: 100%; max-width: 520px; max-height: calc(100vh - 32px); overflow: auto; box-shadow: 0 24px 60px rgba(13,27,42,.25); }
.modal-head { padding: 20px 24px 0; display: flex; align-items: center; gap: 12px; }
.modal-body { padding: 16px 24px; display: flex; flex-direction: column; gap: 14px; }
.modal-foot { padding: 0 24px 20px; display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }

/* toast */
#toasts { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 60; width: min(92vw, 420px); }
.toast { background: var(--navy); color: #fff; padding: 12px 16px; border-radius: 12px; font-size: 14px; box-shadow: 0 10px 30px rgba(0,0,0,.2); }
.toast.bad { background: var(--danger); }

/* auth pages */
.auth-wrap { min-height: 100vh; display: flex; flex-wrap: wrap; }
.auth-side { flex: 1 1 420px; background: var(--navy); color: #C9D3DF; padding: 48px; display: flex; flex-direction: column; gap: 32px; }
.auth-side .brand-name { color: #fff; }
.auth-side h2 { color: #fff; font-size: 34px; line-height: 1.15; max-width: 460px; }
.auth-side ul { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 14px; font-size: 15px; }
.auth-side li { display: flex; gap: 10px; } .auth-side li::before { content: '✓'; color: var(--teal); font-weight: 700; }
.auth-main { flex: 1 1 420px; display: flex; align-items: center; justify-content: center; padding: 32px 20px; }
.auth-card { width: 100%; max-width: 420px; display: flex; flex-direction: column; gap: 18px; }
@media (max-width: 860px) { .auth-side { display: none; } }

footer.site { padding: 28px 24px; text-align: center; color: var(--muted); font-size: 13px; }
footer.site a { color: var(--muted); }

.empty { padding: 48px 24px; text-align: center; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 12px; }
.empty svg { width: 40px; height: 40px; stroke: #98A2B3; }
.spinner { width: 20px; height: 20px; border: 2px solid var(--line); border-top-color: var(--brand); border-radius: 99px; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading { padding: 48px; display: flex; justify-content: center; }
.topbar.dark .brand-name { color: #fff; }
