:root {
  --bg: #eef2f4; --card: #fff; --text: #333; --muted: #828b95; --line: #e1e5ea;
  --primary: #2fc6f6; --primary-d: #11a9d9; --ok: #9dcf00; --ok-d: #7fae00;
  --warn: #ffa900; --err: #ff5752; --wa: #dcf8c6; --radius: 8px;
}
* { box-sizing: border-box; }
body { margin: 0; font: 14px/1.45 "Open Sans", "Helvetica Neue", Arial, sans-serif; background: var(--bg); color: var(--text); }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12px; }

.topbar { display: flex; align-items: center; gap: 24px; background: #fff; padding: 10px 20px; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.brand { font-weight: 600; font-size: 16px; }
.tabs { display: flex; gap: 4px; flex: 1; }
.tabs button { border: 0; background: none; padding: 8px 14px; border-radius: 20px; cursor: pointer; color: #535c69; font-weight: 600; }
.tabs button.active { background: #e5f9ff; color: var(--primary-d); }

main { max-width: 1100px; margin: 0 auto; padding: 16px 20px 40px; }
.card { background: var(--card); border-radius: var(--radius); padding: 18px 20px; margin-bottom: 14px; box-shadow: 0 1px 2px rgba(0,0,0,.04); }
h2 { font-size: 15px; margin: 0 0 14px; display: flex; align-items: center; gap: 8px; }
.step { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--primary); color: #fff; font-size: 12px; }

label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: #535c69; font-weight: 600; margin-bottom: 10px; }
.label { font-size: 12px; color: #535c69; font-weight: 600; margin-bottom: 4px; }
select, input, textarea { font: inherit; padding: 8px 10px; border: 1px solid #c6cdd3; border-radius: 4px; background: #fff; color: var(--text); width: 100%; }
select:focus, input:focus { outline: none; border-color: var(--primary); }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.grid2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }

.btn { border: 0; border-radius: 4px; padding: 9px 18px; font-weight: 600; cursor: pointer; font-size: 13px; }
.btn.primary { background: var(--ok); color: #fff; }
.btn.primary:hover { background: var(--ok-d); }
.btn.ghost { background: #fff; border: 1px solid #c6cdd3; color: #535c69; }
.btn.danger { background: #fff; border: 1px solid var(--err); color: var(--err); }
.btn.sm { padding: 4px 10px; font-size: 12px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.alert { max-width: 1100px; margin: 12px auto 0; padding: 10px 14px; border-radius: 6px; background: #fff3f3; color: #c4312d; border: 1px solid #ffd1cf; }
.alert.info { background: #e5f9ff; color: #0b7da3; border-color: #bfefff; }

.tpl-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-top: 6px; }
.wa-bubble { background: var(--wa); border-radius: 8px; padding: 10px 12px; white-space: pre-wrap; min-height: 80px; font-size: 13px; }
.wa-bubble .h { font-weight: 700; margin-bottom: 6px; }
.wa-bubble .f { color: #6b7a6b; font-size: 12px; margin-top: 6px; }
.wa-bubble .media { background: #c8e6b0; border-radius: 6px; padding: 18px; text-align: center; color: #557; margin-bottom: 6px; }
.wa-bubble .btns { margin-top: 8px; display: flex; flex-direction: column; gap: 4px; }
.wa-bubble .btns span { background: #fff; border-radius: 6px; text-align: center; padding: 5px; color: #0b7da3; font-size: 12px; }
.wa-bubble mark { background: #fff59d; border-radius: 3px; padding: 0 2px; }
.tokens { margin-top: 10px; font-size: 12px; color: var(--muted); }
.tokens code { background: #eef2f4; padding: 2px 6px; border-radius: 4px; cursor: pointer; margin: 2px; display: inline-block; color: #535c69; }
.tokens code:hover { background: #dfe6ea; }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; font-size: 11px; text-transform: uppercase; color: var(--muted); font-weight: 600; padding: 6px 8px; border-bottom: 1px solid var(--line); }
td { padding: 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
a.deal { color: var(--primary-d); cursor: pointer; text-decoration: none; }

.badge { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 11px; font-weight: 600; background: #eef2f4; color: #535c69; white-space: nowrap; }
.badge.rodando, .badge.montando { background: #e5f9ff; color: #0b7da3; }
.badge.concluida, .badge.enviado { background: #f1fbd0; color: #5a7a00; }
.badge.pausada, .badge.enviado_sem_mover, .badge.verificar { background: #fff4d6; color: #a06d00; }
.badge.erro, .badge.cancelada { background: #ffe8e7; color: #c4312d; }
.badge.sem_telefone, .badge.ignorado, .badge.cancelado { background: #eef2f4; color: #6a737f; }

.progress { height: 6px; background: #eef2f4; border-radius: 3px; overflow: hidden; margin: 4px 0; min-width: 120px; display: flex; }
.progress i { display: block; height: 100%; }
.progress .ok { background: var(--ok); } .progress .er { background: var(--err); } .progress .sk { background: #c6cdd3; }
.counts { font-size: 11px; color: var(--muted); }

.modal { position: fixed; inset: 0; background: rgba(0,0,0,.35); display: grid; place-items: center; z-index: 20; padding: 20px; }
.modal-box { background: #fff; border-radius: 10px; width: min(900px, 100%); max-height: 90vh; overflow: auto; padding: 18px 20px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; }
.modal-head h3 { margin: 0; font-size: 16px; }
.x { border: 0; background: none; font-size: 22px; cursor: pointer; color: var(--muted); }
.summary { display: grid; grid-template-columns: 180px 1fr; gap: 6px 12px; margin: 12px 0; }
.summary div:nth-child(odd) { color: var(--muted); }

@media (max-width: 800px) { .grid3, .grid2, .tpl-grid { grid-template-columns: 1fr; } .topbar { flex-wrap: wrap; } }

/* Cadastro guiado de conta BM */
.guided { display: grid; gap: 14px; margin-bottom: 12px; }
.guided-step { display: grid; grid-template-columns: 26px 1fr; gap: 10px; align-items: start; }
.guided-step .num {
  width: 24px; height: 24px; border-radius: 50%; background: var(--brand, #2f6fed); color: #fff;
  display: grid; place-items: center; font-size: 12px; font-weight: 600; margin-top: 2px;
}
.guided-body { min-width: 0; display: grid; gap: 8px; }
.guided-body .actions { margin: 0; }
details.help { border: 1px solid #e3e8ec; border-radius: 8px; padding: 8px 10px; background: #fafcfd; }
details.help > summary { cursor: pointer; color: var(--muted); font-size: 12px; }
details.help[open] > summary { margin-bottom: 8px; }
details.help ol { margin: 0; padding-left: 18px; }
details.help li { margin-bottom: 5px; }
details.help code { background: #eef2f4; padding: 1px 4px; border-radius: 3px; font-size: 11px; }
