/* ============================================================
   Resend Mailer — multi-page app · light + dark themes
   Plus Jakarta Sans + JetBrains Mono · slate · green send
   ============================================================ */

:root {
  color-scheme: dark;

  --bg:        #0b0f17;
  --surface:   #111725;
  --surface-2: #161d2e;
  --elev:      #1b2436;
  --border:    #232c40;
  --border-2:  #2e3950;
  --text:      #eef2f9;
  --muted:     #9aa6bd;
  --faint:     #6b7790;

  --brand:     #22c55e;
  --brand-600: #16a34a;
  --brand-700: #15803d;
  --amber:     #f59e0b;
  --red:       #ef4444;
  --link:      #4ade80;

  /* semantic (text + soft bg + border) */
  --ok-text:   #86efac; --ok-bg:   rgba(34,197,94,.12);  --ok-border:   rgba(34,197,94,.32);
  --warn-text: #fcd34d; --warn-bg: rgba(245,158,11,.12); --warn-border: rgba(245,158,11,.32);
  --fail-text: #fca5a5; --fail-bg: rgba(239,68,68,.12);  --fail-border: rgba(239,68,68,.32);
  --soft-green: rgba(34,197,94,.12);

  --code-bg:   #0c111c;
  --code-text: #c8d3e6;
  --bar-bg:    rgba(11,15,23,.6);

  --radius:    14px;
  --radius-sm: 9px;
  --sans: "Plus Jakarta Sans", system-ui, -apple-system, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --shadow:    0 8px 30px rgba(0,0,0,.35);
  --shadow-sm: 0 2px 10px rgba(0,0,0,.25);
  --nav-w: 244px;
}

html[data-theme="light"] {
  color-scheme: light;

  --bg:        #f4f6fb;
  --surface:   #ffffff;
  --surface-2: #f4f6fb;
  --elev:      #eef2f8;
  --border:    #e2e8f0;
  --border-2:  #cbd5e1;
  --text:      #0f172a;
  --muted:     #475569;
  --faint:     #64748b;

  --link:      #15803d;

  --ok-text:   #15803d; --ok-bg:   #dcfce7; --ok-border:   #bbf7d0;
  --warn-text: #b45309; --warn-bg: #fef3c7; --warn-border: #fde68a;
  --fail-text: #b91c1c; --fail-bg: #fee2e2; --fail-border: #fecaca;
  --soft-green:#dcfce7;

  --code-bg:   #f8fafc;
  --code-text: #1e293b;
  --bar-bg:    rgba(255,255,255,.72);

  --shadow:    0 10px 30px rgba(2,6,23,.10);
  --shadow-sm: 0 1px 3px rgba(2,6,23,.08);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }
html { font-size: 16px; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  height: 100vh;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  transition: background-color .25s, color .25s;
}
.muted { color: var(--muted); }
::selection { background: rgba(34,197,94,.3); }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 8px; border: 3px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: var(--faint); }

/* ============================================================
   App shell
   ============================================================ */
.app { display: grid; grid-template-columns: var(--nav-w) 1fr; height: 100vh; }

.nav {
  display: flex; flex-direction: column; gap: 6px; padding: 18px 14px;
  border-right: 1px solid var(--border);
  background: radial-gradient(420px 300px at 0% 0%, rgba(34,197,94,.06), transparent 70%), var(--surface);
  transition: background-color .25s, border-color .25s;
}
.nav-brand { display: flex; align-items: center; gap: 10px; padding: 6px 8px 18px; }
.brand-mark {
  display: grid; place-items: center; width: 32px; height: 32px; border-radius: 9px;
  background: linear-gradient(135deg, var(--brand), var(--brand-700)); color: #fff;
  box-shadow: 0 4px 14px rgba(34,197,94,.35); flex-shrink: 0;
}
.brand-name { font-weight: 800; font-size: 1.02rem; letter-spacing: -0.02em; }
.brand-name span { color: var(--brand); }

.nav-links { display: flex; flex-direction: column; gap: 3px; flex: 1; }
.nav-link {
  display: flex; align-items: center; gap: 11px; padding: 10px 12px; border-radius: var(--radius-sm);
  color: var(--muted); text-decoration: none; font-weight: 600; font-size: 0.9rem; cursor: pointer;
  transition: background .15s, color .15s;
}
.nav-link svg { flex-shrink: 0; color: var(--faint); transition: color .15s; }
.nav-link:hover { background: var(--surface-2); color: var(--text); }
.nav-link:hover svg { color: var(--muted); }
.nav-link.is-active { background: var(--elev); color: var(--text); }
.nav-link.is-active svg { color: var(--brand); }
.nav-badge {
  margin-left: auto; font-family: var(--mono); font-size: 0.72rem; font-weight: 500;
  background: var(--soft-green); color: var(--ok-text); padding: 1px 8px; border-radius: 999px;
}

.nav-theme {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px; margin-bottom: 2px;
  border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2);
  color: var(--muted); font-family: var(--sans); font-weight: 600; font-size: 0.84rem; cursor: pointer;
  transition: border-color .15s, color .15s, background .15s;
}
.nav-theme:hover { color: var(--text); border-color: var(--border-2); background: var(--elev); }
.nav-theme svg { flex-shrink: 0; }
.theme-moon { display: none; }
html[data-theme="light"] .theme-sun { display: none; }
html[data-theme="light"] .theme-moon { display: inline; }

.nav-status {
  display: flex; align-items: center; gap: 10px; padding: 11px 12px;
  border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2);
  cursor: pointer; text-align: left; color: var(--text);
  transition: border-color .15s, background .15s;
}
.nav-status:hover { border-color: var(--border-2); background: var(--elev); }
.status-meta { display: flex; flex-direction: column; min-width: 0; }
.status-meta strong { font-size: 0.82rem; font-weight: 600; }
.status-meta .muted { font-size: 0.72rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.status-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--faint); box-shadow: 0 0 0 3px rgba(127,127,127,.08); flex-shrink: 0; }
.status-dot[data-state="on"]  { background: var(--brand); box-shadow: 0 0 0 3px var(--soft-green), 0 0 10px rgba(34,197,94,.6); }
.status-dot[data-state="warn"]{ background: var(--amber); box-shadow: 0 0 0 3px var(--warn-bg); }
.status-dot[data-state="off"] { background: var(--faint); }

/* ============================================================
   Content + pages
   ============================================================ */
.content { min-width: 0; min-height: 0; display: flex; flex-direction: column; }
.page { flex: 1; min-height: 0; display: flex; flex-direction: column; }

.page-bar {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 16px;
  padding: 22px 32px; border-bottom: 1px solid var(--border);
  background: var(--bar-bg); backdrop-filter: blur(8px); transition: background-color .25s, border-color .25s;
}
.page-title { font-size: 1.3rem; font-weight: 800; letter-spacing: -0.02em; }
.page-sub { font-size: 0.86rem; color: var(--muted); margin-top: 3px; }
.page-bar-actions { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }

.page-narrow .page-inner { flex: 1; min-height: 0; overflow-y: auto; padding: 28px 32px; }
.page-inner { width: 100%; max-width: 720px; margin: 0 auto; display: flex; flex-direction: column; gap: 18px; }

/* ============================================================
   Cards / fields / buttons
   ============================================================ */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px; box-shadow: var(--shadow-sm); transition: background-color .25s, border-color .25s;
}
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.card-title { font-size: 0.95rem; font-weight: 700; letter-spacing: -0.01em; }
.card-link { font-size: 0.78rem; color: var(--link); text-decoration: none; font-weight: 600; }
.card-link:hover { text-decoration: underline; }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field:last-child { margin-bottom: 0; }
.field label { font-size: 0.74rem; font-weight: 600; letter-spacing: 0.02em; color: var(--muted); text-transform: uppercase; }
.field label .opt { text-transform: none; color: var(--faint); font-weight: 500; letter-spacing: 0; }

input[type="text"], input[type="email"], input[type="url"],
input[type="password"], input[type="number"], select, textarea {
  width: 100%; background: var(--surface-2); border: 1px solid var(--border); color: var(--text);
  font-family: var(--sans); font-size: 0.9rem; padding: 10px 12px; border-radius: var(--radius-sm);
  outline: none; transition: border-color .15s, box-shadow .15s, background .15s;
}
input::placeholder, textarea::placeholder { color: var(--faint); }
input:focus, select:focus, textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--soft-green); background: var(--surface); }
html[data-theme="dark"] input:focus, html[data-theme="dark"] select:focus, html[data-theme="dark"] textarea:focus { background: var(--elev); }
input:hover:not(:focus), textarea:hover:not(:focus), select:hover:not(:focus) { border-color: var(--border-2); }

.hint { font-size: 0.76rem; color: var(--faint); line-height: 1.55; }
code { font-family: var(--mono); font-size: 0.78em; background: var(--elev); padding: 1px 5px; border-radius: 5px; color: var(--muted); }

.input-with-action { position: relative; }
.input-with-action input { padding-right: 42px; }
.reveal {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%); background: none; border: none;
  color: var(--faint); cursor: pointer; padding: 6px; border-radius: 6px; display: grid; place-items: center;
  transition: color .15s, background .15s;
}
.reveal:hover { color: var(--text); background: var(--elev); }
.domain-select { margin-bottom: 8px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-family: var(--sans); font-weight: 600; font-size: 0.88rem; border: 1px solid transparent;
  border-radius: var(--radius-sm); padding: 10px 16px; cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background .15s, border-color .15s, color .15s, transform .06s, box-shadow .15s, filter .15s;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-block { width: 100%; }
.btn-sm { padding: 7px 13px; font-size: 0.8rem; }
.btn-ghost { background: var(--surface-2); border-color: var(--border); color: var(--muted); }
.btn-ghost:hover:not(:disabled) { color: var(--text); border-color: var(--border-2); background: var(--elev); }
.btn-primary { background: var(--elev); border-color: var(--border-2); color: var(--text); }
.btn-primary:hover:not(:disabled) { border-color: var(--brand); color: var(--brand); }
.btn-send {
  background: linear-gradient(135deg, var(--brand), var(--brand-600)); color: #052e16; font-weight: 700;
  padding: 13px 24px; box-shadow: 0 6px 18px rgba(34,197,94,.28);
}
.btn-send:hover:not(:disabled) { box-shadow: 0 8px 22px rgba(34,197,94,.42); filter: brightness(1.05); }
.btn-send:disabled { background: var(--elev); color: var(--faint); box-shadow: none; }

/* callouts / pills */
.callout { font-size: 0.82rem; padding: 11px 13px; border-radius: var(--radius-sm); line-height: 1.5; border: 1px solid var(--border); margin-top: 12px; }
.callout:first-child { margin-top: 0; }
.callout.ok   { background: var(--ok-bg);   border-color: var(--ok-border);   color: var(--ok-text); }
.callout.warn { background: var(--warn-bg); border-color: var(--warn-border); color: var(--warn-text); }
.callout.fail { background: var(--fail-bg); border-color: var(--fail-border); color: var(--fail-text); }
.callout strong { display: block; margin-bottom: 2px; }

.pill { font-size: 0.66rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; padding: 3px 8px; border-radius: 999px; }
.pill-amber { background: var(--warn-bg); color: var(--warn-text); }
.pill-green { background: var(--ok-bg); color: var(--ok-text); }
.pill-red   { background: var(--fail-bg); color: var(--fail-text); }

.counter { font-family: var(--mono); font-size: 0.82rem; font-weight: 500; color: var(--ok-text); background: var(--soft-green); padding: 2px 10px; border-radius: 999px; min-width: 30px; text-align: center; }

/* ============================================================
   Compose page
   ============================================================ */
.compose-grid { flex: 1; min-height: 0; display: grid; grid-template-columns: 320px 1fr; gap: 20px; padding: 24px 32px; }
.compose-meta { display: flex; flex-direction: column; gap: 18px; overflow-y: auto; padding-right: 4px; }

.deliv-card .deliv-body { display: flex; align-items: center; gap: 14px; margin-bottom: 12px; }
.deliv-gauge { position: relative; flex-shrink: 0; line-height: 0; }
.deliv-gauge svg { transform: rotate(-90deg); }
.gauge-track { fill: none; stroke: var(--border); stroke-width: 3; }
.gauge-fill { fill: none; stroke: var(--brand); stroke-width: 3; stroke-linecap: round; stroke-dasharray: 97.4; stroke-dashoffset: 97.4; transition: stroke-dashoffset .5s ease, stroke .3s; }
.gauge-num { position: absolute; inset: 0; display: grid; place-items: center; font-family: var(--mono); font-size: 0.95rem; font-weight: 500; }
.deliv-rating-wrap { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.deliv-rating-wrap strong { font-size: 0.95rem; }
.deliv-rating-wrap .muted { font-size: 0.8rem; }

.deliv-issues { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.deliv-issues:empty { display: none; }
.deliv-issues li { display: flex; gap: 9px; align-items: flex-start; font-size: 0.8rem; color: var(--muted); line-height: 1.45; }
.deliv-issues li::before { content: ""; width: 7px; height: 7px; border-radius: 50%; margin-top: 6px; flex-shrink: 0; background: var(--faint); }
.deliv-issues li.high::before   { background: var(--red); }
.deliv-issues li.medium::before { background: var(--amber); }
.deliv-issues li.low::before    { background: var(--faint); }
.deliv-issues li.ok { color: var(--ok-text); }
.deliv-issues li.ok::before { background: var(--brand); }

.compose-editor { display: flex; flex-direction: column; padding: 0; overflow: hidden; min-height: 0; }
.subject-bar { display: flex; align-items: center; gap: 14px; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.subject-label { font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.subject-bar input { flex: 1; background: transparent; border: none; font-size: 1.02rem; font-weight: 600; padding: 4px 0; }
.subject-bar input:focus { box-shadow: none; background: transparent; }
.subject-len { font-family: var(--mono); font-size: 0.76rem; color: var(--faint); }

.editor-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 18px; border-bottom: 1px solid var(--border); }
.tabs { display: flex; gap: 2px; }
.tab { background: none; border: none; border-bottom: 2px solid transparent; color: var(--muted); font-family: var(--sans); font-weight: 600; font-size: 0.82rem; padding: 12px 14px; cursor: pointer; transition: color .15s, border-color .15s; }
.tab:hover { color: var(--text); }
.tab.is-active { color: var(--text); border-bottom-color: var(--brand); }
.editor-hint { font-size: 0.72rem; }
.editor-hint code { font-size: 0.72rem; }

.editor-body { flex: 1; display: flex; min-height: 0; }
.pane { flex: 1; min-height: 0; display: flex; }
#html-input { flex: 1; background: var(--code-bg); border: none; border-radius: 0; color: var(--code-text); font-family: var(--mono); font-size: 0.82rem; line-height: 1.75; padding: 18px 20px; resize: none; tab-size: 2; transition: background-color .25s, color .25s; }
#html-input:focus { box-shadow: none; }
.pane-preview { background: #fff; }
#preview-frame { flex: 1; border: none; background: #fff; }

/* ============================================================
   Recipients page
   ============================================================ */
.recipients { min-height: 200px; font-family: var(--mono); font-size: 0.82rem; line-height: 1.7; resize: vertical; }
.stat-row { margin-top: 10px; font-size: 0.78rem; color: var(--faint); display: flex; gap: 16px; flex-wrap: wrap; }
.stat-row .ok { color: var(--ok-text); }
.stat-row .bad { color: var(--fail-text); }
.chip-list { display: flex; flex-wrap: wrap; gap: 7px; }
.chip { font-family: var(--mono); font-size: 0.74rem; color: var(--fail-text); background: var(--fail-bg); border: 1px solid var(--fail-border); padding: 3px 9px; border-radius: 999px; }

/* ============================================================
   Review & Send page
   ============================================================ */
.summary { display: flex; flex-direction: column; gap: 1px; }
.summary .row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 11px 0; border-bottom: 1px solid var(--border); }
.summary .row:last-child { border-bottom: none; }
.summary dt { font-size: 0.82rem; color: var(--muted); }
.summary dd { font-size: 0.88rem; font-weight: 600; text-align: right; overflow: hidden; text-overflow: ellipsis; }
.summary dd.warn { color: var(--warn-text); }
.summary dd.ok { color: var(--ok-text); }
.summary dd .mono { font-family: var(--mono); font-weight: 500; }

.send-row { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.throttle { display: flex; align-items: center; gap: 8px; }
.throttle label { font-size: 0.78rem; font-weight: 600; color: var(--muted); }
.throttle input { width: 90px; text-align: center; font-family: var(--mono); }
.throttle .unit { font-size: 0.76rem; color: var(--faint); }

.test-send { display: flex; gap: 10px; align-items: center; margin-top: 14px; padding-top: 14px; border-top: 1px dashed var(--border); flex-wrap: wrap; }
.test-send input { flex: 1; min-width: 180px; }
.test-send .hint { width: 100%; }

.progress { margin-top: 14px; display: flex; align-items: center; gap: 12px; }
.progress-track { flex: 1; height: 6px; background: var(--elev); border-radius: 999px; overflow: hidden; }
.progress-fill { height: 100%; width: 0%; border-radius: 999px; background: linear-gradient(90deg, var(--brand-700), var(--brand)); transition: width .3s ease; }
.progress-text { font-family: var(--mono); font-size: 0.78rem; color: var(--muted); white-space: nowrap; }

.log { padding-bottom: 8px; }
.log-list { list-style: none; max-height: 280px; overflow-y: auto; margin: 0 -6px; }
.log-item { display: flex; align-items: center; gap: 11px; padding: 8px 6px; font-size: 0.8rem; border-bottom: 1px solid var(--border); animation: logIn .2s ease; }
.log-item:last-child { border-bottom: none; }
@keyframes logIn { from { opacity: 0; transform: translateX(-6px); } to { opacity: 1; transform: none; } }
.log-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.log-dot.sent { background: var(--brand); }
.log-dot.failed { background: var(--red); }
.log-dot.sending { background: var(--amber); animation: pulse 1s infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.3; } }
.log-email { flex: 1; font-family: var(--mono); font-size: 0.78rem; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.log-status { font-size: 0.74rem; color: var(--faint); }
.log-status.sent { color: var(--ok-text); }
.log-status.failed { color: var(--fail-text); }

/* settings: domains + deliverability */
.domains-list { display: flex; flex-direction: column; gap: 8px; }
.empty-state { font-size: 0.84rem; color: var(--faint); line-height: 1.6; }
.domain-item { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 13px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); }
.domain-item .name { font-family: var(--mono); font-size: 0.84rem; font-weight: 500; }
.auth-badges { display: flex; gap: 6px; margin-top: 7px; flex-wrap: wrap; }
.auth-badge { font-size: 0.66rem; font-weight: 600; padding: 2px 8px; border-radius: 6px; letter-spacing: .02em; border: 1px solid transparent; }
.auth-badge.ab-ok { background: var(--ok-bg); color: var(--ok-text); border-color: var(--ok-border); }
.auth-badge.ab-warn { background: var(--warn-bg); color: var(--warn-text); border-color: var(--warn-border); }
.auth-badge.ab-missing { background: var(--fail-bg); color: var(--fail-text); border-color: var(--fail-border); }

.checklist { list-style: none; display: flex; flex-direction: column; gap: 12px; }
.checklist li { display: flex; gap: 11px; font-size: 0.85rem; line-height: 1.5; color: var(--muted); }
.checklist li strong { color: var(--text); font-weight: 600; }
.checklist .num { flex-shrink: 0; width: 22px; height: 22px; border-radius: 7px; display: grid; place-items: center; font-size: 0.72rem; font-weight: 700; background: var(--soft-green); color: var(--ok-text); }
.checklist a { color: var(--link); text-decoration: none; font-weight: 600; }
.checklist a:hover { text-decoration: underline; }

/* toasts */
.toast-wrap { position: fixed; bottom: 20px; right: 20px; display: flex; flex-direction: column; gap: 10px; z-index: 60; }
.toast { background: var(--surface); border: 1px solid var(--border-2); border-left: 3px solid var(--brand); border-radius: var(--radius-sm); padding: 12px 16px; font-size: 0.85rem; color: var(--text); box-shadow: var(--shadow); max-width: 340px; animation: toastIn .25s cubic-bezier(.2,.8,.2,1); }
.toast.fail { border-left-color: var(--red); }
.toast.warn { border-left-color: var(--amber); }
@keyframes toastIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 1040px) {
  .compose-grid { grid-template-columns: 1fr; overflow-y: auto; }
  .compose-meta { overflow: visible; }
  .compose-editor { min-height: 460px; }
}
@media (max-width: 760px) {
  body { height: auto; overflow: visible; }
  .app { grid-template-columns: 1fr; height: auto; min-height: 100vh; }
  .nav { flex-direction: row; align-items: center; gap: 4px; border-right: none; border-bottom: 1px solid var(--border); overflow-x: auto; padding: 10px; }
  .nav-brand { display: none; }
  .nav-links { flex-direction: row; flex: 1; }
  .nav-link span:not(.nav-badge) { display: none; }
  .nav-link { padding: 10px 12px; }
  .nav-theme { padding: 10px; margin: 0; }
  .nav-theme .theme-text { display: none; }
  .nav-status { padding: 8px 10px; }
  .nav-status .status-meta { display: none; }
  .page { height: auto; }
  .page-bar { padding: 16px; flex-direction: column; align-items: flex-start; }
  .page-narrow .page-inner, .compose-grid { padding: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

/* ============================================================
   Pro features — preheader, tables, modal, campaigns, suppression
   ============================================================ */
.head-actions { display: flex; align-items: center; gap: 8px; }

.preheader-bar { padding-top: 10px; padding-bottom: 10px; }
.preheader-bar input { font-size: 0.9rem; font-weight: 500; color: var(--muted); }

/* data table (imported contacts) */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); max-height: 280px; overflow-y: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 0.8rem; }
.data-table th {
  text-align: left; font-family: var(--sans); font-weight: 600; color: var(--muted);
  padding: 9px 12px; border-bottom: 1px solid var(--border); background: var(--surface-2);
  position: sticky; top: 0; white-space: nowrap;
}
.data-table td { padding: 8px 12px; border-bottom: 1px solid var(--border); font-family: var(--mono); color: var(--text); white-space: nowrap; }
.data-table tr:last-child td { border-bottom: none; }
.data-table .more-row td { font-family: var(--sans); color: var(--faint); text-align: center; }

/* modal */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(2,6,23,.62); backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center; z-index: 80; padding: 20px; animation: fadeIn .15s;
}
.modal {
  background: var(--surface); border: 1px solid var(--border-2); border-radius: var(--radius);
  width: 100%; max-width: 640px; max-height: 85vh; display: flex; flex-direction: column;
  box-shadow: var(--shadow); animation: modalIn .2s cubic-bezier(.2,.8,.2,1);
}
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.modal-head h2 { font-size: 1.05rem; font-weight: 700; }
.modal-close { background: none; border: none; color: var(--muted); cursor: pointer; padding: 6px; border-radius: 8px; display: grid; place-items: center; transition: background .15s, color .15s; }
.modal-close:hover { background: var(--elev); color: var(--text); }
.modal-body { padding: 18px 20px; overflow-y: auto; display: flex; flex-direction: column; gap: 18px; }
.tmpl-section h3 { font-size: 0.72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: 10px; }
.tmpl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
.tmpl-card { position: relative; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 13px; background: var(--surface-2); cursor: pointer; transition: border-color .15s, background .15s; }
.tmpl-card:hover { border-color: var(--brand); background: var(--elev); }
.tmpl-card .t-name { font-weight: 600; font-size: 0.88rem; margin-bottom: 3px; }
.tmpl-card .t-sub { font-size: 0.74rem; color: var(--faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tmpl-card .t-del { position: absolute; top: 6px; right: 6px; background: none; border: none; color: var(--faint); cursor: pointer; padding: 3px; border-radius: 5px; opacity: 0; transition: opacity .15s, color .15s; line-height: 0; }
.tmpl-card:hover .t-del { opacity: 1; }
.tmpl-card .t-del:hover { color: var(--red); }
.tmpl-empty { font-size: 0.8rem; color: var(--faint); }
.tmpl-save { display: flex; gap: 10px; padding-top: 14px; border-top: 1px solid var(--border); }
.tmpl-save input { flex: 1; }
.card-builder-section { border-top: 1px solid var(--border); padding-top: 16px; }
.cb-note { font-size: 0.78rem; color: var(--faint); margin: -4px 0 12px; line-height: 1.5; }
.card-builder { display: flex; flex-direction: column; gap: 10px; }
.card-builder textarea { min-height: 80px; resize: vertical; font-size: 0.88rem; line-height: 1.6; }
.cb-row { display: flex; gap: 10px; }
.cb-row input { flex: 1; min-width: 0; }
@media (max-width: 520px) { .cb-row { flex-direction: column; } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes modalIn { from { opacity: 0; transform: translateY(10px) scale(.98); } to { opacity: 1; transform: none; } }

/* campaigns */
.campaign-row { display: flex; align-items: center; gap: 14px; padding: 14px 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 10px; cursor: pointer; transition: border-color .15s, background .15s; }
.campaign-row:hover { border-color: var(--border-2); background: var(--surface-2); }
.campaign-row .c-main { flex: 1; min-width: 0; }
.campaign-row .c-subject { font-weight: 600; font-size: 0.92rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.campaign-row .c-meta { font-size: 0.76rem; color: var(--faint); margin-top: 2px; }
.stat-chips { display: flex; gap: 6px; flex-shrink: 0; flex-wrap: wrap; justify-content: flex-end; }
.stat-chip { font-size: 0.72rem; font-weight: 600; padding: 3px 9px; border-radius: 999px; background: var(--elev); color: var(--muted); white-space: nowrap; }
.stat-chip.ok { background: var(--ok-bg); color: var(--ok-text); }
.stat-chip.bad { background: var(--fail-bg); color: var(--fail-text); }
.stat-chip.warn { background: var(--warn-bg); color: var(--warn-text); }

.detail-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.detail-head .d-title { font-size: 1.05rem; font-weight: 700; }
.detail-head .d-meta { font-size: 0.78rem; color: var(--faint); margin-top: 3px; }
.detail-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.result-list { list-style: none; max-height: 50vh; overflow-y: auto; }
.result-item { display: flex; align-items: center; gap: 11px; padding: 9px 2px; border-bottom: 1px solid var(--border); font-size: 0.8rem; }
.result-item:last-child { border-bottom: none; }
.result-item .r-email { flex: 1; font-family: var(--mono); font-size: 0.78rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.event-badge { font-size: 0.68rem; font-weight: 600; padding: 2px 9px; border-radius: 6px; white-space: nowrap; text-transform: capitalize; }
.event-delivered { background: var(--ok-bg); color: var(--ok-text); }
.event-sent, .event-unknown { background: var(--elev); color: var(--muted); }
.event-bounced, .event-complained, .event-failed { background: var(--fail-bg); color: var(--fail-text); }
.event-delivery_delayed { background: var(--warn-bg); color: var(--warn-text); }

/* suppression */
.suppress-list { display: flex; flex-direction: column; gap: 6px; }
.suppress-item { display: flex; align-items: center; gap: 10px; padding: 9px 12px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); }
.suppress-item .s-email { flex: 1; font-family: var(--mono); font-size: 0.8rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.suppress-item .s-reason { font-size: 0.7rem; color: var(--faint); text-transform: uppercase; letter-spacing: .03em; }
.suppress-item .s-del { background: none; border: none; color: var(--faint); cursor: pointer; padding: 4px; border-radius: 5px; line-height: 0; transition: color .15s, background .15s; }
.suppress-item .s-del:hover { color: var(--red); background: var(--elev); }
.empty-pad { font-size: 0.84rem; color: var(--faint); padding: 6px 0; }

/* scheduling */
.schedule-row { display: flex; align-items: center; gap: 12px; margin-top: 14px; padding-top: 14px; border-top: 1px dashed var(--border); flex-wrap: wrap; }
.check { display: flex; align-items: center; gap: 8px; font-size: 0.84rem; color: var(--muted); cursor: pointer; user-select: none; }
.check input { width: auto; }
.schedule-row input[type="datetime-local"] { width: auto; min-width: 200px; }
.schedule-row .hint { width: 100%; }

.sched-head { font-size: 0.72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: 10px; }
.sched-item { display: flex; align-items: center; gap: 12px; padding: 13px 16px; background: var(--surface); border: 1px dashed var(--border-2); border-radius: var(--radius); margin-bottom: 10px; }
.sched-item .s-main { flex: 1; min-width: 0; }
.sched-item .s-subject { font-weight: 600; font-size: 0.9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sched-item .s-when { font-size: 0.76rem; color: var(--warn-text); margin-top: 2px; }
.sched-item .s-when.failed { color: var(--fail-text); }

/* ============================================================
   Auth gate
   ============================================================ */
.auth-gate {
  position: fixed; inset: 0; z-index: 90;
  display: flex; align-items: center; justify-content: center; padding: 20px;
  background:
    radial-gradient(700px 420px at 50% -10%, rgba(34,197,94,.10), transparent 60%),
    var(--bg);
}
.auth-card {
  width: 100%; max-width: 380px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 28px 26px; box-shadow: var(--shadow);
}
.auth-brand { display: flex; align-items: center; justify-content: center; gap: 11px; margin-bottom: 6px; }
.auth-brand .brand-mark { width: 36px; height: 36px; border-radius: 10px; }
.auth-brand .brand-name { font-size: 1.15rem; font-weight: 800; letter-spacing: -0.02em; }
.auth-sub { text-align: center; font-size: 0.85rem; color: var(--muted); margin-bottom: 20px; }
.auth-tabs { display: flex; gap: 4px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 4px; margin-bottom: 18px; }
.auth-tab {
  flex: 1; padding: 9px; border: none; border-radius: 7px; background: none;
  color: var(--muted); font-family: var(--sans); font-weight: 600; font-size: 0.86rem; cursor: pointer;
  transition: background .15s, color .15s;
}
.auth-tab:hover { color: var(--text); }
.auth-tab.is-active { background: var(--elev); color: var(--text); box-shadow: var(--shadow-sm); }
#auth-form { display: flex; flex-direction: column; gap: 14px; }
#auth-submit { width: 100%; margin-top: 4px; }
.auth-card .callout { margin-top: 0; }

.account-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.account-row .mono { font-family: var(--mono); font-size: 0.85rem; color: var(--text); overflow: hidden; text-overflow: ellipsis; }
