#board{position:absolute;inset:0;width:100%;height:100%;display:block;touch-action:none;cursor:grab}
#board,#board text{-webkit-user-select:none;user-select:none;-webkit-touch-callout:none}
#board.panning{cursor:grabbing}
#grid-bg{fill:url(#grid)}
#grid-bg-major{pointer-events:none}
.node{cursor:grab}
.node:active{cursor:grabbing}
.node-card{fill:var(--card);stroke:var(--line-strong);stroke-width:1.4;filter:drop-shadow(0 2px 5px rgba(15,23,42,.10))}
.node:hover .node-card{stroke:var(--line-strong)}
.node.selected .node-card{stroke:var(--select);stroke-width:2.2;filter:drop-shadow(0 3px 10px rgba(37,99,235,.35))}
.node text{font-family:var(--font);pointer-events:none}
.node-label{font-size:12px;font-weight:600;fill:var(--ink);text-anchor:middle}
.node-sub{font-size:9.5px;font-weight:500;fill:var(--faint);text-anchor:middle;letter-spacing:.04em;text-transform:uppercase}

.stage-empty{position:absolute;inset:0;display:grid;place-items:center;pointer-events:none}
.stage-empty.hidden{display:none}
.empty-card{text-align:center;background:rgba(250,251,253,.94);border:1px dashed var(--line-strong);border-radius:16px;padding:30px 44px;box-shadow:var(--shadow)}
.empty-icon{font-size:34px}
.empty-card h3{font-size:16px;margin:8px 0 6px}
.empty-card p{font-size:13px;color:var(--muted);line-height:1.55}
.stage-hint{position:absolute;left:50%;bottom:14px;transform:translateX(-50%);font-size:11.5px;color:var(--muted);background:rgba(250,251,253,.94);border:1px solid var(--line);border-radius:99px;padding:5px 14px;pointer-events:none;white-space:nowrap;max-width:94%;overflow:hidden;text-overflow:ellipsis}
/* ── Barra lateral de ferramentas (tools.js) ── */
.tool-rail{position:absolute;left:12px;top:12px;z-index:20;display:flex;flex-direction:column;gap:3px;padding:5px;background:rgba(250,251,253,.96);border:1px solid var(--line);border-radius:12px;box-shadow:var(--shadow)}
.rail-btn{display:grid;place-items:center;width:34px;height:34px;border:1px solid transparent;border-radius:8px;background:transparent;color:var(--muted);cursor:pointer}
.rail-btn svg{width:19px;height:19px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
.rail-btn:hover:not(:disabled){background:var(--panel-2);color:var(--ink)}
.rail-btn:focus-visible{outline:2px solid var(--select);outline-offset:1px}
.rail-btn[aria-pressed="true"]{background:var(--accent-soft);border-color:#fcd34d;color:var(--accent-ink)}
.rail-toggle[aria-pressed="true"]{background:transparent;border-color:transparent;color:#b45309}
.rail-toggle[aria-pressed="false"]{color:#a3aebd}
.rail-btn:disabled{opacity:.35;cursor:default}
.rail-sep{height:1px;margin:3px 4px;background:var(--line)}
#board.tool-select{cursor:crosshair}
#board.space-pan,#board.space-pan .node{cursor:grab}
.stage-zoom{position:absolute;right:14px;bottom:14px;display:flex;gap:6px}
.stage-zoom button{width:34px;height:34px;border-radius:10px;border:1px solid var(--line);background:var(--card);font-size:17px;font-weight:700;color:var(--muted);box-shadow:var(--shadow);line-height:1}
.stage-zoom button:hover{border-color:var(--accent);color:var(--accent-ink)}

.toast-stack{position:absolute;top:14px;left:50%;transform:translateX(-50%);width:max-content;max-width:90%;display:flex;flex-direction:column;gap:8px;z-index:60;align-items:center;pointer-events:none}
.toast{background:#0f172a;color:#fff;font-size:13px;padding:9px 16px;border-radius:10px;box-shadow:var(--shadow-lg);animation:toast-in .2s ease;max-width:min(480px,90vw);text-align:center}
.toast.warn{background:#92400e}
.toast.has-action{max-width:min(620px,90vw);display:flex;align-items:center;gap:14px;pointer-events:auto}
.toast-action{border:0;background:none;color:#fcd34d;font:inherit;font-weight:700;cursor:pointer;padding:2px 4px;border-radius:6px}
.toast-action:hover,.toast-action:focus-visible{background:rgba(255,255,255,.12);outline:none}
@keyframes toast-in{from{opacity:0;transform:translateY(-8px)}to{opacity:1;transform:none}}
.toast.out{opacity:0;transition:opacity .3s}
.marquee{position:absolute;z-index:30;border:1.5px dashed var(--accent);background:rgba(245,158,11,.12);border-radius:4px;pointer-events:none}
/* ── Conexões ── */
.node .ports{display:none}
/* Bloco de rótulos ajustável (item selecionado) */
.node-labels-hit{fill:transparent;stroke:none}
.node.selected .node-labels{cursor:move}
#layer-handles .lbl-box{fill:none;stroke:var(--select);pointer-events:none;opacity:.8}
#layer-handles .h-lbl{fill:#fff;stroke:var(--select);cursor:nwse-resize}
#layer-handles .h-lbl:hover{fill:#dbeafe}
/* Alças do item selecionado (tamanho e giro) */
.sel-handles .h-size{fill:#fff;stroke:var(--select);cursor:nwse-resize}
.sel-handles .h-rot{cursor:grab}
.sel-handles .h-rot circle{fill:#fff;stroke:var(--select);stroke-width:2}
.sel-handles .h-rot path{fill:none;stroke:var(--select);stroke-width:1.6;stroke-linecap:round;stroke-linejoin:round}
.sel-handles .h-size:hover,.sel-handles .h-rot:hover circle{fill:#dbeafe}
body.presenting #layer-handles{display:none}
.handle-readout{position:absolute;z-index:40;pointer-events:none;background:#0f172a;color:#fff;font-size:12px;font-weight:700;padding:3px 8px;border-radius:6px;font-variant-numeric:tabular-nums}
.node.selected .ports,.node.hovered .ports,#board.connecting .node .ports{display:block}
.port{fill:#fff;stroke:#0ea5e9;stroke-width:2;cursor:crosshair}
.port:hover{fill:#0ea5e9}
#board.connecting,#board.connecting .node{cursor:crosshair}
.node.drop-target .node-card{stroke:#0ea5e9;stroke-width:2.5}
.port.drop-target{fill:#0ea5e9;stroke:#075985}
.wire-hit{stroke:rgba(0,0,0,0);stroke-width:14;fill:none;pointer-events:stroke;cursor:pointer}
.wire-line{fill:none;stroke-linecap:round;pointer-events:none}
.wire.selected .wire-line{stroke:var(--select);filter:drop-shadow(0 1px 4px rgba(37,99,235,.65))}
.wire-label{font-family:var(--font);font-size:11px;font-weight:700;fill:#fff;stroke:#0f172a;stroke-width:3px;paint-order:stroke;text-anchor:middle;pointer-events:auto;cursor:grab}
.wire-temp{fill:none;stroke:#0ea5e9;stroke-width:2.5;stroke-dasharray:7 5;pointer-events:none}
.wire-pt{fill:#fff;stroke:#f59e0b;stroke-width:2;cursor:move}
.wire-pt:hover{fill:#f59e0b}
.wire-end{fill:#0ea5e9;stroke:#fff;stroke-width:2;cursor:crosshair}
.wire-end:hover{fill:#075985}
/* ── Exportar / apresentação ── */
.sheet-overlay{position:fixed;inset:0;background:rgba(15,23,42,.45);z-index:200;display:grid;place-items:center;padding:16px}
.sheet{background:var(--card);border-radius:16px;padding:22px 24px;width:min(430px,94vw);box-shadow:var(--shadow-lg)}
.sheet h3{font-size:16px}
.sheet .sub{font-size:12.5px;color:var(--muted);margin:3px 0 14px}
.sheet fieldset{border:1px solid var(--line);border-radius:10px;padding:6px 14px 10px;margin-bottom:12px}
.sheet legend{font-size:11px;font-weight:700;text-transform:uppercase;letter-spacing:.06em;color:var(--muted);padding:0 6px}
.sheet label.row{display:flex;align-items:center;gap:9px;padding:6px 0;font-size:13.5px;cursor:pointer}
.sheet label.row input{accent-color:var(--accent)}
.sheet-actions{display:flex;justify-content:flex-end;gap:10px;margin-top:4px}
.sheet-actions .tbtn{border:1px solid var(--line);border-radius:9px;padding:9px 18px;font-weight:600}
.exit-present{position:absolute;top:14px;right:14px;z-index:70;font-size:13px;font-weight:600;color:#fff;background:rgba(15,23,42,.85);border:1px solid rgba(255,255,255,.25);border-radius:99px;padding:8px 16px;box-shadow:var(--shadow-lg)}
.exit-present:hover{background:#0f172a}
body.presenting .toolbar,body.presenting .library,body.presenting .props,body.presenting .statusbar{display:none}
body.presenting .workspace{grid-template-columns:minmax(0,1fr)}
body.presenting .stage-hint,body.presenting .tool-rail{display:none}
body.presenting .node .ports{display:none!important}
/* ── Anotações (texto / área) ── */
.area-frame{pointer-events:none}
.area-hit{fill:none;stroke:rgba(0,0,0,0);stroke-width:14;pointer-events:stroke}
.area-hit-title{fill:rgba(0,0,0,0);stroke:none;pointer-events:all}
.area-handle{display:none;fill:#fff;stroke:var(--select);stroke-width:2;cursor:nwse-resize}
.node.is-area:hover .area-frame{stroke-width:2.6}
.node.is-area.selected .area-frame{stroke:var(--select);stroke-width:2.6}
.node.is-area.selected .area-handle{display:block}
.text-hit{fill:rgba(0,0,0,0);stroke:none;pointer-events:all}
.node.is-text:hover .text-hit{stroke:var(--line-strong);stroke-width:1;stroke-dasharray:4 3}
.table-hit{fill:transparent;stroke:none;cursor:move}
.node.is-table.selected .table-hit{stroke:var(--select);stroke-width:2;stroke-dasharray:6 4}
.node.is-text.selected .text-hit{stroke:var(--select);stroke-width:1.6;stroke-dasharray:4 3}
body.presenting .area-handle,body.presenting .text-hit{display:none!important}
@media (max-width:860px){
  .tool-rail{flex-direction:row;left:8px;top:8px;max-width:calc(100% - 16px);overflow-x:auto;scrollbar-width:none}
  .rail-sep{width:1px;height:auto;margin:4px 3px}
  #tool-minimap{display:none}
}
.guide-line{stroke:#db2777;stroke-width:1.2;stroke-dasharray:5 4;vector-effect:non-scaling-stroke;pointer-events:none}
/* Itens travados (posição fixa) */
.lock-badge{pointer-events:none}
.lock-badge circle{fill:#fff;stroke:#b45309;stroke-width:1.4}
.lock-badge path,.lock-badge rect{fill:none;stroke:#b45309;stroke-width:1.5;stroke-linecap:round;stroke-linejoin:round}
.node.locked{cursor:default}
body.presenting .lock-badge{display:none}
.present-logo{position:absolute;left:18px;bottom:16px;z-index:30;max-width:170px;max-height:58px;padding:6px 10px;background:rgba(255,255,255,.88);border-radius:10px;box-shadow:0 2px 10px rgba(15,23,42,.12);object-fit:contain;pointer-events:none}
/* ── Menu de contexto (contextmenu.js) ── */
/* Painel de atalhos (?) */
.sc-dialog{margin:auto;width:min(760px,calc(100vw - 32px));max-height:calc(100dvh - 32px);overflow:auto;padding:22px 24px;border:1px solid var(--line);border-radius:16px;background:var(--panel);color:var(--ink);box-shadow:var(--shadow-lg)}
.sc-dialog::backdrop{background:rgba(15,23,42,.5)}
.sc-head{display:flex;align-items:center;justify-content:space-between;margin-bottom:14px}
.sc-head h2{margin:0;font-size:19px;text-transform:none;letter-spacing:0;color:var(--ink)}
.sc-close{border:0;background:none;font-size:24px;line-height:1;color:var(--muted);cursor:pointer;padding:2px 8px;border-radius:8px}
.sc-close:hover{background:var(--panel-2);color:var(--ink)}
.sc-grid{columns:2 300px;column-gap:28px}
.sc-group{break-inside:avoid;margin-bottom:16px}
.sc-group h3{margin:0 0 6px;font-size:12px;text-transform:uppercase;letter-spacing:.06em;color:var(--muted)}
.sc-group dl{display:grid;grid-template-columns:auto 1fr;gap:5px 14px;margin:0;font-size:13px;align-items:center}
.sc-group dt{white-space:nowrap;color:var(--muted)}
.sc-group dt.sc-gesture{display:none}
.sc-group dt.sc-gesture+dd{grid-column:1/-1}
.sc-group dd{margin:0}
.sc-group kbd{display:inline-block;min-width:22px;padding:2px 6px;border:1px solid var(--line-strong);border-bottom-width:2px;border-radius:6px;background:#fff;font:600 11.5px/1.3 ui-monospace,SFMono-Regular,Menlo,monospace;color:var(--ink);text-align:center}
.sc-foot{display:flex;justify-content:flex-end;margin-top:4px}
.sc-replay{border:1px solid #fcd34d;background:#fffbeb;color:#92400e;font:inherit;font-size:13px;font-weight:700;padding:7px 14px;border-radius:9px;cursor:pointer}
.sc-replay:hover{border-color:#f59e0b}
/* Tour rápido (1º acesso) */
.tour-block{position:fixed;inset:0;z-index:500}
.tour-spot{position:fixed;z-index:501;border-radius:14px;box-shadow:0 0 0 9999px rgba(15,23,42,.55),0 0 0 3px #fbbf24;pointer-events:none;transition:left .25s,top .25s,width .25s,height .25s}
.tour-card{position:fixed;z-index:502;width:300px;padding:16px 18px 14px;background:#fff;border-radius:14px;box-shadow:var(--shadow-lg);color:var(--ink)}
.tour-count{font-size:11px;font-weight:800;letter-spacing:.06em;text-transform:uppercase;color:#b45309}
.tour-card h2{margin:4px 0 6px;font-size:16.5px;text-transform:none;letter-spacing:0;color:var(--ink)}
.tour-text{margin:0;font-size:13.5px;line-height:1.55;color:var(--muted)}
.tour-actions{display:flex;justify-content:space-between;align-items:center;margin-top:14px}
.tour-skip{border:0;background:none;color:var(--muted);font:inherit;font-size:13px;cursor:pointer;padding:6px 4px;text-decoration:underline;text-underline-offset:3px}
.tour-next{border:0;background:linear-gradient(135deg,#fcd34d,#fb923c);color:#431407;font:inherit;font-size:13.5px;font-weight:800;padding:9px 16px;border-radius:10px;cursor:pointer}
.tour-next:focus-visible,.tour-skip:focus-visible{outline:3px solid #2563eb;outline-offset:2px}
.node.tour-ports .ports{display:block}
@media (prefers-reduced-motion:reduce){.tour-spot{transition:none}}
/* Adicionar pela porta: busca rápida */
.quick-add{position:absolute;z-index:45;width:260px;padding:6px;background:var(--card);border:1px solid var(--line);border-radius:12px;box-shadow:var(--shadow-lg);font-size:13px}
.quick-add-input{width:100%;padding:8px 10px;border:1px solid var(--line-strong);border-radius:8px;font:inherit;background:#fff;color:var(--ink)}
.quick-add-input:focus{outline:2px solid var(--select);outline-offset:0;border-color:transparent}
.quick-add-list{display:flex;flex-direction:column;gap:1px;margin-top:5px;max-height:300px;overflow:auto}
.quick-add-item{display:flex;align-items:center;gap:10px;width:100%;padding:5px 8px;border:0;border-radius:7px;background:transparent;color:var(--ink);font:inherit;text-align:left;cursor:pointer}
.quick-add-item.is-active{background:var(--accent-soft);color:var(--accent-ink)}
.quick-add-ico{display:inline-flex;width:28px;height:28px;flex:none}
.quick-add-ico svg{width:100%;height:100%}
.quick-add-empty{margin:8px;color:var(--muted)}
.ctx-menu{position:fixed;z-index:400;min-width:210px;padding:5px;background:var(--card);border:1px solid var(--line);border-radius:10px;box-shadow:var(--shadow-lg);font-size:13px}
.ctx-item{display:flex;align-items:center;justify-content:space-between;gap:18px;width:100%;padding:7px 10px;border:0;border-radius:6px;background:transparent;color:var(--ink);text-align:left;cursor:pointer;font:inherit}
.ctx-item:hover:not(:disabled),.ctx-item:focus-visible{background:var(--accent-soft);color:var(--accent-ink);outline:none}
.ctx-item:disabled{color:var(--faint);opacity:.55;cursor:default}
.ctx-hint{color:var(--faint);font-size:11.5px;white-space:nowrap}
.ctx-danger{color:#b91c1c}
.ctx-danger:hover:not(:disabled),.ctx-danger:focus-visible{background:#fee2e2;color:#991b1b}
.ctx-sep{height:1px;margin:4px 6px;background:var(--line)}
/* ── Minimapa (minimap.js) ── */
.minimap{position:absolute;right:14px;bottom:58px;z-index:15;width:190px;height:122px;padding:4px;background:rgba(250,251,253,.94);border:1px solid var(--line);border-radius:10px;box-shadow:var(--shadow);cursor:pointer;touch-action:none}
.minimap svg{display:block;width:100%;height:100%}
.minimap.off,.minimap.empty{display:none}
.mm-item{opacity:.85}
.mm-text{fill:#cbd5e1}
.mm-area{fill:rgba(100,116,139,.08);stroke:#94a3b8;stroke-width:1;stroke-dasharray:4 3;vector-effect:non-scaling-stroke}
.mm-wire{fill:none;stroke:#64748b;stroke-width:1;vector-effect:non-scaling-stroke;opacity:.7}
.mm-view{fill:rgba(37,99,235,.08);stroke:var(--select);stroke-width:1.5;vector-effect:non-scaling-stroke}
body.presenting .minimap,html[data-embed] .minimap{display:none}
@media (max-width:860px){.minimap{display:none}}
/* ── Estilos de desenho (shapes.js): ilustrado e unifilar ── */
.node-hit{fill:rgba(0,0,0,0);stroke:none}
.node-outline{fill:none;stroke:none;pointer-events:none;vector-effect:non-scaling-stroke}
.node-illustrated:hover .node-outline,.node-schematic:hover .node-outline{stroke:var(--line-strong);stroke-width:1;stroke-dasharray:4 3}
.node-illustrated.selected .node-outline,.node-schematic.selected .node-outline{stroke:var(--select);stroke-width:1.8;stroke-dasharray:5 4}
.node-illustrated.drop-target .node-outline,.node-schematic.drop-target .node-outline{stroke:#0ea5e9;stroke-width:2.5;stroke-dasharray:none}
.node-illustrated.selected .node-illu{filter:drop-shadow(0 3px 8px rgba(37,99,235,.35))}
.node-schematic .node-sym text{pointer-events:none}
.node-illustrated .node-label,.node-schematic .node-label,.node-illustrated .node-sub,.node-schematic .node-sub{text-transform:none}
/* Seletor de estilo do desenho (tools.js) */
.style-pop{position:fixed;z-index:420;display:grid;gap:4px;width:250px;padding:10px;background:var(--card);border:1px solid var(--line);border-radius:12px;box-shadow:var(--shadow-lg)}
.style-pop>strong{font-size:11.5px;text-transform:uppercase;letter-spacing:.06em;color:var(--muted);padding:2px 4px 4px}
.style-opt{display:flex;align-items:center;gap:10px;padding:8px;border:1px solid transparent;border-radius:9px;background:transparent;text-align:left;font:inherit;color:var(--ink);cursor:pointer}
.style-opt:hover,.style-opt:focus-visible{background:var(--panel-2);outline:none}
.style-opt[aria-checked=true]{border-color:#fcd34d;background:var(--accent-soft)}
.style-thumb{flex:none;width:76px;height:32px;display:grid;place-items:center;background:#fff;border:1px solid var(--line);border-radius:6px}
.style-thumb svg{width:72px;height:30px}
.style-opt b{display:block;font-size:13.5px}
.style-opt small{display:block;font-size:12px;color:var(--muted)}
/* Etiqueta de custo acima do nó (botão Mostrar custos) */
.node-price{pointer-events:none}
.node-price rect{fill:#fef3c7;stroke:#d97706;stroke-width:1}
.node-price text{font-size:11px;font-weight:700;fill:#92400e;font-variant-numeric:tabular-nums}
