:root {
  --fundo: #f4f5f8; --cartao: #fff; --texto: #1d2129; --suave: #646b78; --borda: #dfe2e8;
  --cor: #5b3df5; --cor-escura: #4428d6; --ok: #138a4a; --erro: #c62d2d; --amarelo: #fff4d6;
  --raio: 12px; --sombra: 0 1px 3px rgba(20, 24, 40, .08);
}
@media (prefers-color-scheme: dark) {
  :root { --fundo: #14161b; --cartao: #1e2128; --texto: #e9ebf0; --suave: #9aa1ad; --borda: #333843;
          --amarelo: #3a3216; --sombra: none; }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
       background: var(--fundo); color: var(--texto); }
.topo { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between;
        gap: 12px; padding: 10px 16px; background: var(--cartao); border-bottom: 1px solid var(--borda); }
.marca { font-weight: 700; color: var(--texto); text-decoration: none; }
nav { display: flex; gap: 14px; align-items: center; }
nav a { color: var(--suave); text-decoration: none; font-size: 15px; }
main { max-width: 860px; margin: 0 auto; padding: 16px 16px 120px; }
h1 { font-size: 22px; margin: 6px 0 14px; }
h2 { font-size: 17px; margin: 0 0 10px; }
.cartao { background: var(--cartao); border: 1px solid var(--borda); border-radius: var(--raio);
          padding: 14px; margin-bottom: 12px; box-shadow: var(--sombra); }
.linha { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.entre { justify-content: space-between; }
.suave { color: var(--suave); font-size: 14px; }
label { display: block; font-size: 14px; color: var(--suave); margin: 10px 0 4px; }
input[type=text], input[type=password], input[type=number], input[type=url], textarea, select {
  width: 100%; padding: 10px 12px; border: 1px solid var(--borda); border-radius: 10px; font: inherit;
  background: var(--cartao); color: var(--texto); }
textarea { min-height: 90px; resize: vertical; }
.marcar { display: flex; flex-wrap: wrap; gap: 8px; }
.marcar label { display: flex; align-items: center; gap: 6px; margin: 0; padding: 8px 10px; border: 1px solid var(--borda);
                border-radius: 999px; color: var(--texto); cursor: pointer; }
button { font: inherit; cursor: pointer; border-radius: 10px; border: 1px solid var(--borda); padding: 9px 14px;
         background: var(--cartao); color: var(--texto); }
button.primario { background: var(--cor); border-color: var(--cor); color: #fff; font-weight: 600; }
button.primario:hover { background: var(--cor-escura); }
button.perigo { color: var(--erro); }
button.link { border: 0; background: none; padding: 0; color: var(--suave); }
button.mini { padding: 5px 9px; font-size: 14px; }
.chip { display: inline-block; font-size: 13px; padding: 2px 9px; border-radius: 999px; background: var(--fundo);
        border: 1px solid var(--borda); margin: 2px 4px 2px 0; }
.chip.ok { color: var(--ok); } .chip.erro { color: var(--erro); }
.erros { background: var(--amarelo); border: 1px solid #e7c55a; border-radius: var(--raio); padding: 10px 14px; margin-bottom: 12px; }
.erros li { margin: 3px 0; }
.passo { border-left: 4px solid var(--cor); }
.passo[data-tipo=pausa] { border-left-color: #e0a100; }
.passo[data-tipo=condicao_segue] { border-left-color: #1f8fd6; }
.passo[data-tipo=ir_para] { border-left-color: #8a8f99; }
.passo .titulo { font-weight: 600; }
.inicio { font-size: 12px; background: var(--cor); color: #fff; border-radius: 999px; padding: 1px 8px; }
.botao-msg { border: 1px dashed var(--borda); border-radius: 10px; padding: 8px 10px; margin-top: 8px; }
.rodape { position: fixed; left: 0; right: 0; bottom: 0; z-index: 4; background: var(--cartao);
          border-top: 1px solid var(--borda); padding: 10px 16px; }
.rodape .dentro { max-width: 860px; margin: 0 auto; display: flex; gap: 10px; justify-content: space-between; flex-wrap: wrap; }
.alternar { display: inline-flex; border: 1px solid var(--borda); border-radius: 10px; overflow: hidden; }
.alternar button { border: 0; border-radius: 0; }
.alternar button.ativo { background: var(--cor); color: #fff; }
.chave { position: relative; width: 48px; height: 28px; flex: none; }
.chave input { opacity: 0; width: 0; height: 0; }
.chave span { position: absolute; inset: 0; background: #b8bdc7; border-radius: 999px; transition: .2s; }
.chave span::before { content: ""; position: absolute; width: 22px; height: 22px; left: 3px; top: 3px;
                      background: #fff; border-radius: 50%; transition: .2s; }
.chave input:checked + span { background: var(--ok); }
.chave input:checked + span::before { transform: translateX(20px); }
.aviso { position: fixed; left: 50%; bottom: 84px; transform: translateX(-50%); z-index: 9; background: #222;
         color: #fff; padding: 10px 16px; border-radius: 10px; max-width: 90vw; }
.modal { position: fixed; inset: 0; z-index: 8; background: rgba(0, 0, 0, .45); display: flex; align-items: flex-end;
         justify-content: center; }
.modal .caixa { background: var(--cartao); width: 100%; max-width: 620px; max-height: 88vh; overflow: auto;
                border-radius: 16px 16px 0 0; padding: 16px; }
@media (min-width: 700px) { .modal { align-items: center; } .modal .caixa { border-radius: 16px; } }
.conversa p { background: var(--fundo); border-radius: 12px; padding: 8px 12px; margin: 6px 0; white-space: pre-wrap; }
.centro { max-width: 380px; margin: 40px auto; }
.carregando { color: var(--suave); }
#quadro { height: 70vh; border: 1px solid var(--borda); border-radius: var(--raio); background: var(--cartao); }

/* ---- quadro com blocos ---- */
.bl-barra { margin-bottom: 10px; }
#quadro .drawflow-node { width: 230px; padding: 0; border-radius: 12px; border: 1px solid var(--borda);
                         background: var(--cartao); color: var(--texto); box-shadow: var(--sombra); }
#quadro .drawflow-node.selected { border-color: var(--cor); }
#quadro .drawflow-node.bl-inicio { border-color: var(--ok); }
#quadro .drawflow-node.bl-mensagem { border-top: 4px solid var(--cor); }
#quadro .drawflow-node.bl-pausa { border-top: 4px solid #e0a100; }
#quadro .drawflow-node.bl-condicao_segue { border-top: 4px solid #1f8fd6; }
#quadro .drawflow-node.bl-ir_para { border-top: 4px solid #8a8f99; }
#quadro .bl { padding: 8px 10px; font-size: 13px; }
#quadro .bl-tit { font-weight: 700; margin-bottom: 4px; }
#quadro .bl-texto { white-space: pre-wrap; max-height: 90px; overflow: hidden; }
#quadro .bl-botao { margin-top: 4px; padding: 3px 6px; border: 1px dashed var(--borda); border-radius: 8px; }
#quadro .bl-saidas { margin-top: 6px; color: var(--suave); font-size: 11px; }
#quadro .drawflow .connection .main-path { stroke: var(--cor); stroke-width: 3px; }
#quadro .drawflow-node .input, #quadro .drawflow-node .output { width: 16px; height: 16px; border: 2px solid var(--cor); background: var(--cartao); }

.post { display: flex !important; align-items: center; gap: 10px; padding: 8px; border: 1px solid var(--borda);
        border-radius: 10px; margin: 6px 0 !important; color: var(--texto) !important; }
.post img { width: 48px; height: 64px; object-fit: cover; border-radius: 6px; flex: none; }
