/* Editor visual do workflow (Drawflow MIT 0.0.60, servido localmente). Paleta e painel recolhíveis. */
.wf-main { padding:0; display:flex; flex-direction:column; min-height:0; }
.wf { display:flex; flex-direction:column; height:calc(100vh - 57px); min-height:420px; background:var(--bg); }
.with-banner .wf { height:calc(100vh - 57px - 38px); }
.wf-bar { display:flex; align-items:center; gap:6px; padding:8px 12px; background:var(--surface); border-bottom:1px solid var(--border); flex-wrap:wrap; }
.wf-bar .nome { font-weight:650; font-size:14px; border:1px solid transparent; background:transparent; height:32px; padding:0 8px; border-radius:8px; color:var(--text); font-family:inherit; width:220px; max-width:40vw; }
.wf-bar .nome:hover { border-color:var(--border); } .wf-bar .nome:focus { outline:none; border-color:var(--accent); box-shadow:var(--ring); }
.wf-bar .estado { font-size:12px; color:var(--muted); white-space:nowrap; }
.wf-bar .sep { width:1px; height:22px; background:var(--border); margin:0 2px; }
.wf-bar .btn[aria-pressed="true"] { background:var(--accent-soft); color:var(--accent-text); border-color:var(--accent); }
.wf-body { flex:1; min-height:0; display:grid; grid-template-columns:190px minmax(0,1fr) 340px; }
.wf-body.pal-rail { grid-template-columns:56px minmax(0,1fr) 340px; }
.wf-body.sem-painel { grid-template-columns:190px minmax(0,1fr) 0; }
.wf-body.pal-rail.sem-painel { grid-template-columns:56px minmax(0,1fr) 0; }
.wf-body.sem-painel .wf-panel { display:none; }

.wf-pal { background:var(--surface); border-right:1px solid var(--border); overflow-y:auto; padding:10px 8px; }
.wf-pal h2 { margin:4px 6px 8px; font-size:11px; font-weight:600; text-transform:uppercase; letter-spacing:.06em; color:var(--faint); }
.pal-it { display:flex; align-items:center; gap:9px; width:100%; padding:7px 8px; border-radius:9px; border:1px solid var(--border); background:var(--surface); margin-bottom:6px; font:inherit; font-size:13px; font-weight:600; color:var(--text-2); cursor:grab; text-align:left; }
.pal-it:hover, .pal-it:focus-visible { border-color:var(--c); background:var(--surface-2); }
.pal-it .ic { width:26px; height:26px; border-radius:7px; display:flex; align-items:center; justify-content:center; background:color-mix(in srgb, var(--c) 14%, transparent); color:var(--c); flex:none; }
.pal-it .ic .i { width:15px; height:15px; }
.pal-it small { display:block; font-weight:500; color:var(--muted); font-size:11px; }
.pal-rail .wf-pal { padding:10px 6px; } .pal-rail .wf-pal h2, .pal-rail .pal-it .tx { display:none; }
.pal-rail .pal-it { justify-content:center; padding:6px 0; }

.vp { position:relative; overflow:hidden; background-color:var(--bg); background-image:radial-gradient(var(--border-strong) 1px, transparent 1.2px); background-size:20px 20px; min-width:0; }
.vp #drawflow { position:absolute; inset:0; }
.vp-tools { position:absolute; right:12px; bottom:12px; display:flex; flex-direction:column; gap:4px; background:var(--surface); border:1px solid var(--border); border-radius:10px; padding:4px; box-shadow:var(--shadow-1); z-index:5; }
.vp-tools .btn { width:32px; height:32px; padding:0; }
.vp-zoom { font-size:11px; text-align:center; color:var(--muted); font-weight:600; font-variant-numeric:tabular-nums; }
.vp-hint { position:absolute; left:12px; bottom:12px; z-index:5; font-size:11.5px; color:var(--muted); background:var(--surface); border:1px solid var(--border); border-radius:8px; padding:4px 8px; max-width:calc(100% - 260px); }
.vp-aviso { position:absolute; left:12px; right:12px; top:12px; z-index:5; display:none; }
.minimapa { position:absolute; right:60px; bottom:12px; width:168px; height:108px; background:var(--surface); border:1px solid var(--border); border-radius:10px; box-shadow:var(--shadow-1); z-index:5; cursor:pointer; }
.minimapa rect.n { fill:var(--border-strong); } .minimapa rect.n.sel { fill:var(--accent); } .minimapa rect.vista { fill:color-mix(in srgb, var(--accent) 10%, transparent); stroke:var(--accent); stroke-width:1.5; }
.minimapa.hidden { display:none; }

/* nós (Drawflow) no visual do app */
.vp .drawflow .drawflow-node { display:block; width:230px; min-height:0; padding:0; background:var(--surface); color:var(--text); border:1px solid var(--border-strong); border-radius:12px; box-shadow:var(--shadow-1); font-size:12.5px; }
.vp .drawflow .drawflow-node:hover { cursor:move; }
.vp .drawflow .drawflow-node.selected { background:var(--surface); border-color:var(--accent); box-shadow:var(--ring), var(--shadow-2); }
.vp .drawflow .drawflow-node.ativo { border-color:#22c55e; box-shadow:0 0 0 4px rgba(34,197,94,.3), var(--shadow-2); }
.vp .drawflow .drawflow-node.trilha { border-color:#22c55e; }
.vp .drawflow .drawflow-node.err { border-color:var(--bad); box-shadow:0 0 0 3px color-mix(in srgb, var(--bad) 25%, transparent); }
.vp .drawflow .drawflow-node .drawflow_content_node { width:100%; }
.vp .drawflow .drawflow-node .inputs { position:absolute; left:-8px; top:13px; width:auto; z-index:3; }
.vp .drawflow .drawflow-node .outputs { position:absolute; right:-8px; bottom:8px; width:auto; z-index:3; display:flex; flex-direction:column; gap:8px; }
.vp .drawflow .drawflow-node .input, .vp .drawflow .drawflow-node .output { box-sizing:border-box; width:14px; min-width:14px; max-width:14px; height:14px; padding:0; box-shadow:none; margin:0; left:0; right:0; top:0; background:var(--surface); border:2px solid var(--faint); border-radius:50%; }
.vp .drawflow .drawflow-node .input:hover, .vp .drawflow .drawflow-node .output:hover { border-color:var(--accent); background:var(--accent-soft); }
.vp .drawflow .drawflow-node .output.falta { border-color:var(--bad); }
.vp .drawflow .connection .main-path { stroke:var(--faint); stroke-width:2px; }
.vp .drawflow .connection .main-path:hover { stroke:var(--accent); }
.vp .drawflow .connection .main-path.selected { stroke:var(--accent); stroke-width:3px; }
.vp .drawflow .connection.trilha .main-path { stroke:#22c55e; stroke-width:3px; }
.vp .drawflow-delete { width:24px; height:24px; line-height:20px; font-size:13px; background:var(--bad); color:#fff; border:2px solid var(--surface); }
.vp .parent-node .drawflow-delete { right:-12px; top:-12px; }
.vp .drawflow > .drawflow-delete { margin-left:-12px; margin-top:12px; }

.cn-hd { display:flex; align-items:center; gap:7px; padding:8px 10px; border-bottom:1px solid var(--border); border-radius:12px 12px 0 0; background:color-mix(in srgb, var(--c) 9%, var(--surface)); }
.cn-hd .ic { width:22px; height:22px; border-radius:6px; background:var(--c); color:#fff; display:flex; align-items:center; justify-content:center; flex:none; }
.cn-hd .ic .i { width:13px; height:13px; stroke-width:2.2; }
.cn-hd b { font-size:10.5px; text-transform:uppercase; letter-spacing:.05em; color:var(--c); }
.cn-hd .ttl { font-weight:650; color:var(--text); font-size:12px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.cn-bd { padding:8px 10px; color:var(--text-2); line-height:1.4; }
.cn-bd .sum { display:-webkit-box; -webkit-line-clamp:3; -webkit-box-orient:vertical; overflow:hidden; word-break:break-word; }
.cn-bd .sem { color:var(--faint); font-style:italic; }
.cn-outs { border-top:1px dashed var(--border); padding:4px 0; }
.cn-outs div { height:22px; display:flex; align-items:center; justify-content:flex-end; padding:0 16px 0 10px; font-size:11px; font-weight:600; color:var(--muted); white-space:nowrap; overflow:hidden; }
.cn-outs div.obrig { color:var(--text-2); }

.wf-panel { background:var(--surface); border-left:1px solid var(--border); display:flex; flex-direction:column; min-height:0; min-width:0; }
.wf-panel .tabs { padding:0 6px; flex:none; }
.wf-panel .pn { flex:1; min-height:0; overflow-y:auto; }
.props { padding:14px; display:flex; flex-direction:column; gap:12px; }
.props h3 { font-size:14px; }
.opt-row { display:flex; gap:6px; align-items:center; }
.opt-row .k { width:46px; text-align:center; flex:none; }
.opt-row .input { min-width:0; }
.regra { border:1px solid var(--border); border-radius:var(--r); padding:8px; display:flex; flex-direction:column; gap:6px; background:var(--surface-2); }
.sim { display:flex; flex-direction:column; height:100%; }
.sim .msgs { background:var(--chat-bg); flex:1; min-height:220px; padding:12px; overflow-y:auto; display:flex; flex-direction:column; gap:6px; }
.sim .bubble { font-size:13px; max-width:86%; white-space:pre-wrap; }
.sim-bar { display:flex; gap:6px; align-items:center; padding:8px 10px; border-bottom:1px solid var(--border); flex-wrap:wrap; }
.sim-vars { padding:8px 12px; border-top:1px solid var(--border); font-size:12px; background:var(--surface-2); word-break:break-word; }
.sim-vars code { font-family:var(--mono); font-size:11.5px; }
.sim form { display:flex; gap:6px; padding:10px; border-top:1px solid var(--border); }
.sim form .input { min-width:0; }
.exec { padding:10px 14px; border-bottom:1px solid var(--border); cursor:pointer; display:block; width:100%; text-align:left; background:none; border-left:0; border-right:0; border-top:0; font:inherit; color:inherit; }
.exec:hover { background:var(--surface-2); } .exec[aria-pressed="true"] { background:var(--accent-soft); }
.vres { padding:14px; display:flex; flex-direction:column; gap:8px; }
.vres li button { background:none; border:0; padding:0; font:inherit; color:inherit; text-align:left; cursor:pointer; text-decoration:underline dotted; }
.menu-pop { position:absolute; top:100%; right:0; z-index:30; width:290px; background:var(--surface); border:1px solid var(--border); border-radius:12px; box-shadow:var(--shadow-2); padding:6px; margin-top:4px; }
.menu-pop button { display:block; width:100%; text-align:left; padding:9px 10px; border:0; background:none; border-radius:8px; font:inherit; color:var(--text); cursor:pointer; }
.menu-pop button:hover { background:var(--surface-2); }
.menu-pop small { display:block; color:var(--muted); font-size:11.5px; }
.rel { position:relative; }
.mob-bar { display:none; }
.wf-fluxos .card { overflow:hidden; }

@media (max-width:1180px){ .wf-body { grid-template-columns:56px minmax(0,1fr) 320px; } .wf-body .wf-pal h2, .wf-body .pal-it .tx { display:none; } .wf-body .pal-it { justify-content:center; padding:6px 0; } .wf-body.sem-painel { grid-template-columns:56px minmax(0,1fr) 0; } }
@media (max-width:760px){
  .wf { height:calc(100vh - 57px - 64px); }
  .wf-bar { padding:6px 8px; gap:4px; }
  .wf-bar .lbl, .wf-bar .sep, .wf-bar .so-pc { display:none; }
  .wf-bar .nome { width:110px; }
  .wf-body, .wf-body.pal-rail, .wf-body.sem-painel, .wf-body.pal-rail.sem-painel { grid-template-columns:1fr; position:relative; }
  .wf-pal, .wf-panel, .wf-body.sem-painel .wf-panel { position:fixed; left:0; right:0; bottom:120px; z-index:45; max-height:58vh; border:1px solid var(--border); border-radius:16px 16px 0 0; box-shadow:var(--shadow-2); display:none; }
  .wf-pal.open { display:block; } .wf-panel.open { display:flex; height:58vh; }
  .wf-body .wf-pal h2, .wf-body .pal-it .tx { display:block; } .wf-body .pal-it { justify-content:flex-start; padding:7px 8px; }
  .vp-aviso { display:block; }
  .vp-hint, .minimapa { display:none; }
  .vp-tools { bottom:64px; }
  .mob-bar { display:flex; position:fixed; left:0; right:0; bottom:calc(64px + env(safe-area-inset-bottom, 0px)); height:56px; z-index:46; background:var(--surface); border-top:1px solid var(--border); padding:8px; gap:6px; }
  .mob-bar .btn { flex:1; padding:0 6px; font-size:12px; }
  .mob-bar .btn[aria-pressed="true"] { background:var(--accent-soft); color:var(--accent-text); border-color:var(--accent); }
}
