/* ==========================================================================
   Servidor de E-mail — visual monocromático (claro e escuro)
   ========================================================================== */

:root {
  --bg: #ffffff;
  --bg-side: #fafafa;
  --surface: #ffffff;
  --surface-2: #f5f5f5;
  --hover: #f0f0f0;
  --text: #0a0a0a;
  --text-2: #3d3d3d;
  --muted: #737373;
  --line: #e5e5e5;
  --line-2: #d4d4d4;
  --primary: #0a0a0a;
  --primary-text: #ffffff;
  --primary-hover: #262626;
  --danger: #b42318;
  --danger-bg: #fef3f2;
  --ok: #067647;
  --focus: #0a0a0a;
  --shadow: 0 1px 2px rgba(0, 0, 0, .04);
  --shadow-pop: 0 12px 32px -8px rgba(0, 0, 0, .18), 0 2px 6px rgba(0, 0, 0, .06);
  --radius: 6px;
  --side-w: 236px;
  --font: 'Geist', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --mono: 'Geist Mono', ui-monospace, 'SFMono-Regular', Consolas, monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0a0a0a;
    --bg-side: #0d0d0d;
    --surface: #111111;
    --surface-2: #161616;
    --hover: #1a1a1a;
    --text: #ededed;
    --text-2: #c7c7c7;
    --muted: #8b8b8b;
    --line: #232323;
    --line-2: #333333;
    --primary: #ededed;
    --primary-text: #0a0a0a;
    --primary-hover: #ffffff;
    --danger: #ff6b5e;
    --danger-bg: #2a1210;
    --ok: #4ade80;
    --focus: #ededed;
    --shadow: none;
    --shadow-pop: 0 16px 40px -8px rgba(0, 0, 0, .7);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0a0a0a;
  --bg-side: #0d0d0d;
  --surface: #111111;
  --surface-2: #161616;
  --hover: #1a1a1a;
  --text: #ededed;
  --text-2: #c7c7c7;
  --muted: #8b8b8b;
  --line: #232323;
  --line-2: #333333;
  --primary: #ededed;
  --primary-text: #0a0a0a;
  --primary-hover: #ffffff;
  --danger: #ff6b5e;
  --danger-bg: #2a1210;
  --ok: #4ade80;
  --focus: #ededed;
  --shadow: none;
  --shadow-pop: 0 16px 40px -8px rgba(0, 0, 0, .7);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
  font-feature-settings: 'tnum' 1;
}
h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -0.01em; }
h1 { font-size: 22px; line-height: 1.25; }
h2 { font-size: 16px; }
h3 { font-size: 14px; }
p { margin: 0; }
a { color: inherit; text-decoration: underline; text-underline-offset: 2px; text-decoration-color: var(--line-2); }
a:hover { text-decoration-color: currentColor; }
code, .mono { font-family: var(--mono); font-size: 12.5px; }
code { background: var(--surface-2); border: 1px solid var(--line); border-radius: 4px; padding: 1px 5px; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.strong { font-weight: 600; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.center { text-align: center; }
.grow { flex: 1; min-width: 0; }
.ellipsis { max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
svg.i { width: 16px; height: 16px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Estrutura ---------- */
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--side-w);
  background: var(--bg-side); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; z-index: 30; overflow-y: auto;
}
.side-top { padding: 18px 18px 14px; }
.wordmark { display: inline-flex; align-items: center; gap: 10px; font-weight: 600; text-decoration: none; letter-spacing: -0.01em; color: var(--text); }
.wordmark .mark { width: 18px; height: 18px; border-radius: 4px; background: var(--text); flex: none; }
.wordmark.small { font-size: 14px; }

.side-account { padding: 0 14px 14px; border-bottom: 1px solid var(--line); }
.side-label { display: block; font-size: 11.5px; color: var(--muted); margin: 0 2px 6px; }
.side-account select { min-height: 34px; font-size: 13px; }

.side-nav { padding: 12px 10px; display: flex; flex-direction: column; gap: 1px; }
.side-nav a {
  display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: var(--radius);
  color: var(--text-2); text-decoration: none; font-weight: 500;
}
.side-nav a:hover { background: var(--hover); color: var(--text); }
.side-nav a.active { background: var(--hover); color: var(--text); }
.side-nav a .i, .side-btn .i { color: var(--muted); }
.side-nav a.active .i { color: var(--text); }

.side-bottom { margin-top: auto; padding: 10px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 1px; }
.side-btn {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 7px 10px; border: 0; background: none;
  border-radius: var(--radius); color: var(--text-2); font: inherit; font-weight: 500; cursor: pointer; text-align: left;
}
.side-btn:hover { background: var(--hover); color: var(--text); }
.side-user { display: flex; align-items: center; gap: 8px; padding: 10px 10px 4px; margin-top: 6px; border-top: 1px solid var(--line); }
.side-user-email { flex: 1; min-width: 0; font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.link-btn { border: 0; background: none; padding: 0; font: inherit; font-size: 12.5px; color: var(--text); cursor: pointer; text-decoration: underline; text-underline-offset: 2px; text-decoration-color: var(--line-2); }
.link-btn:hover { text-decoration-color: currentColor; }

.view { padding: 36px 44px 64px; margin-left: var(--side-w); max-width: calc(1160px + var(--side-w)); }
body.public .view { margin-left: 0; max-width: none; padding: 0; }

.mobile-bar { display: none; }
.scrim { position: fixed; inset: 0; background: rgba(0, 0, 0, .4); z-index: 25; }
.icon-btn { width: 34px; height: 34px; display: grid; place-items: center; border: 1px solid var(--line); background: var(--surface); color: var(--text); border-radius: var(--radius); cursor: pointer; }

@media (max-width: 880px) {
  .sidebar { transform: translateX(-100%); transition: transform .18s ease; }
  .sidebar.open { transform: none; box-shadow: var(--shadow-pop); }
  .mobile-bar:not([hidden]) {
    display: flex; align-items: center; gap: 12px; position: sticky; top: 0; z-index: 20;
    padding: 10px 16px; background: var(--bg); border-bottom: 1px solid var(--line);
  }
  .view { margin-left: 0; padding: 24px 16px 56px; }
}

/* ---------- Cabeçalho de página ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.page-head h1 { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.page-head p { margin-top: 4px; color: var(--muted); }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.back { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); text-decoration: none; font-size: 13px; margin-bottom: 10px; }
.back:hover { color: var(--text); }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin: 28px 0 12px; }
.section-head p { color: var(--muted); font-size: 13px; margin-top: 2px; }

/* ---------- Botões ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 34px; padding: 0 14px; border-radius: var(--radius);
  border: 1px solid var(--line-2); background: var(--surface); color: var(--text);
  font: inherit; font-weight: 500; cursor: pointer; white-space: nowrap; text-decoration: none;
  transition: background .12s, border-color .12s;
}
.btn:hover { background: var(--hover); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--primary-text); }
.btn.primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--hover); }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.danger-ghost { color: var(--danger); }
.btn.danger-ghost:hover { background: var(--danger-bg); border-color: var(--danger); }
.btn.small { height: 28px; padding: 0 10px; font-size: 13px; }
.btn.tiny { height: 24px; padding: 0 8px; font-size: 12px; gap: 4px; }
.btn.block { width: 100%; }
.btn .i { width: 15px; height: 15px; }
.btn.is-busy { position: relative; color: transparent !important; }
.btn.is-busy .i { opacity: 0; }
.btn.is-busy::after {
  content: ''; position: absolute; width: 14px; height: 14px; border-radius: 50%;
  border: 1.5px solid var(--text); border-right-color: transparent; animation: spin .7s linear infinite;
}
.btn.primary.is-busy::after { border-color: var(--primary-text); border-right-color: transparent; }
@keyframes spin { to { transform: rotate(360deg); } }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.link { background: none; border: 0; padding: 0; font: inherit; color: var(--text); text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }

/* ---------- Formulários ---------- */
input, select, textarea {
  width: 100%; min-height: 36px; padding: 7px 10px;
  border: 1px solid var(--line-2); border-radius: var(--radius);
  background: var(--surface); color: var(--text); font: inherit;
}
input:hover, select:hover, textarea:hover { border-color: var(--muted); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--text); box-shadow: 0 0 0 1px var(--text); }
textarea { resize: vertical; line-height: 1.55; }
input[type="checkbox"], input[type="radio"] { width: 16px; min-height: 0; height: 16px; accent-color: var(--text); margin: 0; flex: none; }
input[type="color"] { padding: 3px; cursor: pointer; }
input:disabled, select:disabled { opacity: .55; cursor: not-allowed; }
select {
  appearance: none; padding-right: 30px;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 15px) 52%, calc(100% - 10px) 52%; background-size: 5px 5px; background-repeat: no-repeat;
}
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.field > span { font-weight: 500; font-size: 13px; }
.field > small { color: var(--muted); font-size: 12.5px; }
.field.inline { margin: 0; }
.field.inline > span { font-size: 12px; color: var(--muted); font-weight: 500; }
.check { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; margin-bottom: 14px; }
.check input { margin-top: 2px; }
.check small { display: block; color: var(--muted); font-size: 12.5px; }
.form-error { color: var(--danger); margin: 0 0 10px; font-size: 13px; }
.form-error:empty { display: none; }
.row { display: flex; gap: 12px; }
.row > * { flex: 1; min-width: 0; }
.row.wrap { flex-wrap: wrap; }
.row.wrap > * { flex: 1 1 200px; }
.inline-form { display: flex; gap: 8px; flex-wrap: wrap; }
.inline-form input { flex: 1 1 200px; width: auto; }
.quick { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: -8px 0 16px; }
.color-input { height: 36px; }

/* Escolha em cartões */
.choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 8px; }
.choice {
  display: flex; flex-direction: column; gap: 4px; padding: 12px 14px; border: 1px solid var(--line-2);
  border-radius: var(--radius); background: var(--surface); cursor: pointer; text-align: left; font: inherit; color: var(--text);
}
.choice:hover { border-color: var(--muted); }
.choice strong { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.choice span { color: var(--muted); font-size: 12.5px; }
.choice[aria-pressed="true"] { border-color: var(--text); box-shadow: inset 0 0 0 1px var(--text); }

/* ---------- Superfícies ---------- */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.panel + .panel { margin-top: 16px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.panel-head p { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.panel-body { padding: 18px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); margin-bottom: 16px; }
.card h3 { margin-bottom: 10px; }

/* ---------- Tabelas ---------- */
.table-wrap { border: 1px solid var(--line); border-radius: var(--radius); overflow-x: auto; background: var(--surface); }
.table { width: 100%; border-collapse: collapse; }
.table th {
  text-align: left; font-weight: 500; font-size: 12px; color: var(--muted);
  padding: 9px 14px; border-bottom: 1px solid var(--line); background: var(--surface-2); white-space: nowrap;
}
.table td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tr.clickable { cursor: pointer; }
.table tr.clickable:hover td { background: var(--hover); }
.table a.row-link { text-decoration: none; font-weight: 500; }
.table.compact td, .table.compact th { padding: 6px 10px; }
.table-wrap.scroll { max-height: 320px; overflow: auto; }
.error-cell { color: var(--danger); font-size: 12.5px; max-width: 320px; }
.sub { display: block; color: var(--muted); font-size: 12.5px; }

/* ---------- Status ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 8px;
  border: 1px solid var(--line-2); border-radius: 999px; font-size: 12px; font-weight: 500; color: var(--text-2); white-space: nowrap;
}
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--muted); }
.badge.ok::before { background: var(--ok); }
.badge.bad { color: var(--danger); }
.badge.bad::before { background: var(--danger); }
.badge.wait::before { background: transparent; border: 1.5px solid var(--text-2); width: 7px; height: 7px; }
.badge.info::before { background: var(--text); animation: pulse 1.6s ease-in-out infinite; }
.badge.muted { color: var(--muted); }
@keyframes pulse { 50% { opacity: .3; } }

/* ---------- Vazio, carregando, erro ---------- */
.empty { padding: 56px 24px; text-align: center; border: 1px dashed var(--line-2); border-radius: var(--radius); }
.empty h3 { font-size: 15px; }
.empty p { color: var(--muted); max-width: 460px; margin: 6px auto 18px; }
.loading { display: flex; align-items: center; gap: 10px; color: var(--muted); padding: 40px 0; }
.spinner { width: 14px; height: 14px; border: 1.5px solid var(--muted); border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
.error-box { border: 1px solid var(--danger); background: var(--danger-bg); border-radius: var(--radius); padding: 18px; }
.error-box p { margin: 6px 0 14px; }
.notice { padding: 12px 14px; border: 1px solid var(--line-2); border-radius: var(--radius); background: var(--surface-2); font-size: 13px; margin-bottom: 16px; }
.notice.warn { border-color: var(--danger); background: var(--danger-bg); }

/* ---------- Abas ---------- */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; }
.tabs a, .tabs button {
  padding: 8px 12px; color: var(--muted); text-decoration: none; font: inherit; font-weight: 500; border: 0; background: none;
  border-bottom: 1.5px solid transparent; margin-bottom: -1px; cursor: pointer; white-space: nowrap;
}
.tabs a:hover, .tabs button:hover { color: var(--text); }
.tabs a.active, .tabs button.active { color: var(--text); border-bottom-color: var(--text); }

/* ---------- Modal ---------- */
.backdrop { position: fixed; inset: 0; background: rgba(0, 0, 0, .45); display: grid; place-items: center; padding: 16px; z-index: 50; animation: fade .12s ease; }
.modal {
  width: min(500px, 100%); max-height: calc(100vh - 32px); overflow: auto;
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow-pop); padding: 22px;
}
.modal.wide { width: min(780px, 100%); }
.modal h2 { margin-bottom: 14px; }
.modal-body > p { margin-bottom: 12px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }
@keyframes fade { from { opacity: 0; } }

/* ---------- Avisos ---------- */
.toasts { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 60; max-width: min(380px, calc(100vw - 32px)); }
.toast { padding: 11px 14px; border-radius: var(--radius); background: var(--text); color: var(--bg); box-shadow: var(--shadow-pop); font-size: 13px; animation: fade .15s ease; transition: opacity .3s, transform .3s; }
.toast.error { background: var(--danger); color: #fff; }
.toast.out { opacity: 0; transform: translateY(6px); }

/* ---------- Login ---------- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.login-card { width: min(360px, 100%); }
.login-card .wordmark { margin-bottom: 32px; }
.login-card h1 { font-size: 20px; margin-bottom: 4px; }
.login-card > p { color: var(--muted); margin-bottom: 24px; }

/* ---------- Contas ---------- */
.accounts { display: grid; gap: 12px; }
.account-row { display: flex; gap: 16px; align-items: flex-start; padding: 16px 18px; flex-wrap: wrap; }
.avatar { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; font-weight: 600; border: 1px solid var(--line-2); background: var(--surface-2); flex: none; }
.meta { display: flex; gap: 20px; margin: 8px 0 0; flex-wrap: wrap; }
.meta div { display: flex; gap: 6px; }
.meta dt { color: var(--muted); font-size: 12.5px; }
.meta dd { margin: 0; font-size: 12.5px; }
.meter { height: 3px; background: var(--line); border-radius: 2px; overflow: hidden; margin-top: 10px; max-width: 280px; }
.meter span { display: block; height: 100%; background: var(--text); }
.checklist { list-style: none; padding: 0; margin: 0 0 16px; display: grid; gap: 10px; }
.checklist li { display: flex; gap: 10px; align-items: flex-start; }
.checklist .mark { width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; flex: none; border: 1px solid var(--line-2); }
.checklist li.ok .mark { background: var(--text); color: var(--bg); border-color: var(--text); }
.checklist li.bad .mark { color: var(--danger); border-color: var(--danger); }
.steps { margin: 0 0 14px; padding-left: 20px; display: grid; gap: 8px; }
.guide-title { margin: 18px 0 8px; }

/* ---------- Webhook ---------- */
.url-box { display: flex; gap: 8px; }
.url-box input { font-family: var(--mono); font-size: 12.5px; }
.code { position: relative; margin: 10px 0; }
.code pre { margin: 0; padding: 14px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius); overflow: auto; font: 12.5px/1.55 var(--mono); max-height: 320px; }
.code .btn { position: absolute; top: 8px; right: 8px; }
.howto { padding-left: 18px; display: grid; gap: 6px; margin: 0 0 12px; }
details.payload summary { cursor: pointer; color: var(--muted); font-size: 12.5px; }
details.payload pre { font: 12px/1.5 var(--mono); background: var(--surface-2); padding: 8px; border-radius: 4px; max-width: 420px; overflow: auto; }

/* ---------- Fila: editor de sequência ---------- */
.queue-grid { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 24px; align-items: start; }
.queue-side { position: sticky; top: 20px; display: grid; gap: 16px; }
@media (max-width: 1180px) { .queue-grid { grid-template-columns: 1fr; } .queue-side { position: static; } }
.title-input { font-size: 22px; font-weight: 600; letter-spacing: -0.01em; border-color: transparent; padding: 2px 8px; margin-left: -9px; min-height: 0; background: transparent; max-width: 560px; }
.title-input:hover { border-color: var(--line-2); }

.seq { list-style: none; margin: 0; padding: 0; }
.seq-item { position: relative; padding-left: 38px; }
.seq-item::before { content: ''; position: absolute; left: 13px; top: 0; bottom: 0; width: 1px; background: var(--line-2); }
.seq-item:first-child::before { top: 20px; }
.seq-item.last::before { bottom: auto; height: 20px; }
.seq-dot {
  position: absolute; left: 3px; top: 11px; width: 21px; height: 21px; border-radius: 50%;
  display: grid; place-items: center; background: var(--bg); border: 1px solid var(--line-2); font-size: 11px; font-weight: 600; color: var(--text-2);
}
.seq-dot .i { width: 12px; height: 12px; }
.seq-item.start .seq-dot { background: var(--text); border-color: var(--text); color: var(--bg); }
.seq-item.wait .seq-dot { border-style: dashed; color: var(--muted); }
.step { margin-bottom: 10px; }
.step-head { display: flex; align-items: center; gap: 10px; padding: 10px 10px 10px 14px; cursor: pointer; border-radius: var(--radius); }
.step-head:hover { background: var(--hover); }
.step.open .step-head { border-radius: var(--radius) var(--radius) 0 0; }
.step-head .grow strong { display: block; font-weight: 600; }
.step-head .grow span { display: block; color: var(--muted); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.step-tools { display: flex; gap: 2px; }
.step-tools .btn { width: 28px; padding: 0; }
.step-body { padding: 18px 16px 16px; border-top: 1px solid var(--line); }
.wait-row { display: flex; align-items: center; gap: 10px; padding: 8px 10px 8px 14px; margin-bottom: 10px; flex-wrap: wrap; }
.wait-row input { width: 84px; }
.wait-row select { width: 130px; }
.add-row { display: flex; gap: 8px; padding: 2px 0 14px; flex-wrap: wrap; }
.step.has-error, .wait-row.has-error { border-color: var(--danger); }
.error-list { margin: 0; padding-left: 18px; color: var(--danger); font-size: 13px; display: grid; gap: 4px; }
.savebar { display: flex; align-items: center; gap: 10px; }
.dirty-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--text); }

/* ---------- Novo envio ---------- */
.compose { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.compose-form { margin: 0; }
.compose-preview { position: sticky; top: 20px; }
.compose-preview-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; }
.email-preview { width: 100%; height: 640px; border: 1px solid var(--line); border-radius: var(--radius); background: #f3f4f6; display: block; }
.modal .email-preview { height: 60vh; }
.compose .when, .when { border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 14px 12px; margin: 4px 0 16px; }
.when legend { font-weight: 500; font-size: 13px; padding: 0 4px; }
.radio { display: flex; align-items: center; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.radio input[type="datetime-local"] { width: auto; }
.compose-test { border-top: 1px solid var(--line); padding-top: 16px; margin-top: 4px; display: grid; gap: 8px; }
.compose-actions { display: flex; justify-content: flex-end; margin-top: 18px; }
@media (max-width: 1020px) { .compose { grid-template-columns: 1fr; } .compose-preview { position: static; } .email-preview { height: 480px; } }

/* ---------- Registros, listas e números ---------- */
.filters { margin-bottom: 16px; }
.filter-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.filter-row .field.inline { min-width: 180px; }
.toolbar { display: flex; gap: 8px; margin: 20px 0 12px; }
.toolbar input { max-width: 340px; }
.csv-row { display: flex; gap: 12px; align-items: center; margin-top: 12px; flex-wrap: wrap; }
.report { list-style: none; padding: 0; display: grid; gap: 4px; margin: 0 0 12px; }
.report li.bad { color: var(--danger); }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 24px; background: var(--surface); }
.kpi { padding: 14px 18px; border-right: 1px solid var(--line); }
.kpi:last-child { border-right: 0; }
.kpi span { display: block; color: var(--muted); font-size: 12px; }
.kpi strong { display: block; font-size: 22px; font-weight: 600; letter-spacing: -0.02em; margin-top: 2px; }

/* ---------- Editor em nós ---------- */
body.full .view { padding: 0; max-width: none; height: 100vh; }
@media (max-width: 880px) { body.full .view { height: calc(100vh - 55px); } }
.np-editor { display: flex; flex-direction: column; height: 100%; }
.np-bar { display: flex; align-items: center; gap: 10px; padding: 10px 16px; border-bottom: 1px solid var(--line); background: var(--bg); flex-wrap: wrap; }
.np-bar .title-input { width: auto; min-width: 160px; max-width: 360px; margin-left: 0; }
.np-body { flex: 1; min-height: 0; display: grid; grid-template-columns: 210px minmax(0, 1fr) 360px; }
.np-palette { border-right: 1px solid var(--line); padding: 14px 12px; overflow-y: auto; background: var(--bg-side); display: flex; flex-direction: column; gap: 6px; }
.np-palette h3 { font-size: 12px; color: var(--muted); font-weight: 500; margin: 0 2px 4px; }
.np-item { display: flex; flex-direction: column; gap: 2px; text-align: left; padding: 9px 11px; border: 1px solid var(--line-2); border-radius: var(--radius); background: var(--surface); color: var(--text); font: inherit; cursor: pointer; }
.np-item:hover { border-color: var(--text); }
.np-item small { color: var(--muted); font-size: 12px; }
.np-palette p { margin-top: 8px; }
.np-stage { position: relative; min-width: 0; overflow: hidden; background: var(--bg); }
.np-panel { border-left: 1px solid var(--line); padding: 16px; overflow-y: auto; background: var(--surface); }
.np-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 16px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.np-empty h3 { margin-bottom: 6px; }
.np-empty p, .np-empty li { color: var(--muted); font-size: 13px; }
.np-empty ul { padding-left: 18px; display: grid; gap: 4px; }
.np-zoom { position: absolute; right: 12px; bottom: 12px; display: flex; align-items: center; gap: 4px; padding: 4px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.np-zoom-label { font-size: 12px; color: var(--muted); min-width: 40px; text-align: center; }
.np-errors { position: absolute; left: 12px; top: 12px; max-width: 420px; max-height: 45%; overflow: auto; padding: 12px 14px; border: 1px solid var(--danger); border-radius: var(--radius); background: var(--surface); font-size: 13px; z-index: 2; }
.np-errors-head { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 6px; color: var(--danger); }
.np-errors ul { margin: 0; padding-left: 18px; display: grid; gap: 4px; }
@media (max-width: 1100px) { .np-body { grid-template-columns: 170px minmax(0, 1fr) 300px; } }
@media (max-width: 760px) { .np-body { grid-template-columns: 1fr; grid-template-rows: auto 55vh auto; } .np-palette { flex-direction: row; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--line); } .np-palette h3, .np-palette p { display: none; } .np-item { min-width: 150px; } .np-panel { border-left: 0; border-top: 1px solid var(--line); } }

.canvas { width: 100%; height: 100%; display: block; cursor: grab; touch-action: none; user-select: none; }
.canvas.panning { cursor: grabbing; }
.canvas.connecting { cursor: crosshair; }
.canvas-bg { fill: url(#grid); }
.grid-dot { fill: var(--line-2); }
.node { cursor: pointer; }
.node-box { fill: var(--surface); stroke: var(--line-2); stroke-width: 1; }
.node:hover .node-box { stroke: var(--muted); }
.node.selected .node-box { stroke: var(--text); stroke-width: 1.5; }
.node.has-error .node-box { stroke: var(--danger); stroke-width: 1.5; }
.node.drop-ok .node-box { stroke: var(--text); stroke-width: 2; }
.node.drop-bad .node-box { stroke: var(--danger); stroke-dasharray: 4 3; }
.node-accent { fill: var(--muted); }
.node.type-trigger .node-accent { fill: var(--text); }
.node.type-wait .node-box { stroke-dasharray: 4 3; }
.node-title { font: 600 13px var(--font); fill: var(--text); }
.node-summary { font: 12px var(--font); fill: var(--text-2); }
.node-sub { font: 11.5px var(--font); fill: var(--muted); }
.node-error-icon { font: 700 14px var(--font); fill: var(--danger); }
.port { fill: var(--bg); stroke: var(--muted); stroke-width: 1.5; }
.port.out { cursor: crosshair; }
.port.out:hover { fill: var(--text); stroke: var(--text); }
.edge-line { fill: none; stroke: var(--muted); stroke-width: 1.5; }
.edge-hit { fill: none; stroke: transparent; stroke-width: 14; cursor: pointer; }
.edge:hover .edge-line { stroke: var(--text-2); }
.edge.selected .edge-line { stroke: var(--text); stroke-width: 2; }
.edge-temp { fill: none; stroke: var(--text); stroke-width: 1.5; stroke-dasharray: 5 4; }
.marker { fill: var(--muted); }
.marker.arrow-selected, .marker.arrow-temp { fill: var(--text); }

/* Dias da semana e webhook no editor */
.days { display: flex; gap: 4px; flex-wrap: wrap; }
.day { min-width: 40px; height: 30px; padding: 0 8px; border: 1px solid var(--line-2); border-radius: var(--radius); background: var(--surface); color: var(--text-2); font: inherit; font-size: 12.5px; cursor: pointer; }
.day[aria-pressed="true"] { background: var(--text); border-color: var(--text); color: var(--bg); }
.np-hook { border-top: 1px solid var(--line); margin-top: 14px; padding-top: 14px; }
.np-palette h3 + .np-item { margin-top: 0; }
.np-palette h3:not(:first-child) { margin-top: 10px; }
.node.type-add_to_list .node-accent, .node.type-remove_from_list .node-accent { fill: var(--text-2); }
.node.type-wait_until .node-box { stroke-dasharray: 4 3; }

/* Conta que envia (barra do editor) e destinatário recolhível */
.np-account-wrap { display: flex; align-items: center; gap: 8px; }
.np-account { min-height: 30px; height: 30px; padding-top: 4px; padding-bottom: 4px; font-size: 13px; width: auto; max-width: 240px; }
details.recipient { border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; margin-bottom: 16px; }
details.recipient summary { cursor: pointer; font-size: 13px; font-weight: 500; }
details.recipient[open] summary { margin-bottom: 12px; }
details.recipient .field:last-child { margin-bottom: 0; }
.canvas:focus, .canvas:focus-visible { outline: none; }
.np-panel form > p { margin-bottom: 14px; }
