:root{
  --wf-node-width:220px;
  --wf-node-radius:18px;
  --wf-panel-radius:20px;
  --wf-shadow:0 18px 40px rgba(0,0,0,.22);
}

.builder-shell{
  display:grid;
  grid-template-columns:280px minmax(0,1fr) 320px;
  gap:18px;
  min-height:calc(100vh - 220px);
}

.builder-panel,
.builder-canvas-wrap{
  border:1px solid var(--line);
  border-radius:var(--wf-panel-radius);
  background:rgba(255,255,255,.03);
  overflow:hidden;
}

.builder-panel{
  padding:18px;
}

.builder-panel h2{
  margin:0 0 14px;
  font-size:20px;
}

.builder-panel h3{
  margin:18px 0 10px;
  font-size:16px;
}

.builder-panel .micro{
  display:block;
  margin-top:6px;
}

.builder-actions{
  display:grid;
  gap:10px;
  margin-top:14px;
}

.builder-actions .btn{
  width:100%;
  justify-content:center;
}

.builder-field{
  display:grid;
  gap:8px;
  margin-bottom:14px;
}

.builder-field span{
  font-size:13px;
  color:var(--muted);
}

.builder-field input,
.builder-field textarea,
.builder-field select{
  width:100%;
  padding:12px 14px;
  border-radius:14px;
  border:1px solid var(--line);
  background:rgba(255,255,255,.03);
  color:var(--text);
  font:inherit;
}

.builder-field textarea{
  min-height:120px;
  resize:vertical;
}

.builder-canvas-wrap{
  position:relative;
  min-height:700px;
}

.wf-canvas-pan{
  position:relative;
  width:100%;
  height:100%;
  min-height:700px;
  overflow:hidden;
  cursor:grab;
  background:
    linear-gradient(rgba(255,255,255,.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.04) 1px, transparent 1px);
  background-size:32px 32px;
  background-position:center center;
}

.wf-canvas-pan:active{
  cursor:grabbing;
}

.wf-canvas-viewport{
  position:absolute;
  inset:0;
  transform-origin:top left;
}

.wf-canvas-edges,
.wf-canvas-nodes{
  position:absolute;
  inset:0;
}

.wf-canvas-nodes{
  pointer-events:none;
}

.wf-node{
  position:absolute;
  width:var(--wf-node-width);
  min-height:112px;
  border-radius:var(--wf-node-radius);
  border:1px solid var(--line);
  background:rgba(10,18,31,.92);
  box-shadow:var(--wf-shadow);
  pointer-events:auto;
  transition:border-color .18s ease, box-shadow .18s ease, transform .18s ease;
}

.wf-node:hover{
  border-color:rgba(127,211,255,.28);
}

.wf-node.is-selected{
  border-color:rgba(127,211,255,.65);
  box-shadow:0 18px 42px rgba(127,211,255,.12);
}

.wf-node-head{
  display:flex;
  justify-content:space-between;
  gap:12px;
  align-items:center;
  padding:14px 16px 10px;
  border-bottom:1px solid var(--line);
  cursor:move;
}

.wf-node-head strong{
  font-size:15px;
  line-height:1.3;
}

.wf-node-type{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-height:24px;
  padding:4px 10px;
  border-radius:999px;
  border:1px solid var(--line);
  font-size:11px;
  color:var(--muted);
  background:rgba(255,255,255,.03);
  white-space:nowrap;
}

.wf-node-body{
  padding:12px 16px 16px;
  display:grid;
  gap:6px;
}

.wf-node-meta{
  font-size:12px;
  color:var(--muted);
}

.wf-edges-svg{
  width:2400px;
  height:1600px;
  overflow:visible;
}

.wf-edge-line{
  fill:none;
  stroke:rgba(127,211,255,.55);
  stroke-width:3;
  stroke-linecap:round;
}

.wf-edge-hit{
  fill:none;
  stroke:transparent;
  stroke-width:14;
  cursor:pointer;
}

.wf-empty{
  position:absolute;
  inset:0;
  display:grid;
  place-items:center;
  text-align:center;
  color:var(--muted);
  pointer-events:none;
  padding:20px;
}

.workflow-sidebar{
  display:grid;
  gap:14px;
}

.workflow-sidebar h3{
  margin:0;
  font-size:20px;
}

.wf-sidebar-actions{
  display:flex;
  flex-wrap:wrap;
  gap:10px;
}

.wf-sidebar-block{
  display:grid;
  gap:10px;
}

.wf-side-title{
  font-size:13px;
  color:var(--muted);
}

.wf-field{
  display:grid;
  gap:8px;
}

.wf-field span{
  font-size:13px;
  color:var(--muted);
}

.wf-field input,
.wf-field textarea{
  width:100%;
  padding:12px 14px;
  border-radius:14px;
  border:1px solid var(--line);
  background:rgba(255,255,255,.03);
  color:var(--text);
  font:inherit;
}

.wf-field textarea{
  resize:vertical;
}

.btn.btn-small{
  min-height:36px;
  padding:8px 12px;
  font-size:12px;
}

.builder-status{
  margin-top:12px;
  padding:12px 14px;
  border:1px solid var(--line);
  border-radius:14px;
  background:rgba(255,255,255,.02);
  font-size:13px;
  color:var(--muted);
}

.builder-json{
  max-height:260px;
  overflow:auto;
  white-space:pre-wrap;
  font-family:ui-monospace,SFMono-Regular,Menlo,monospace;
  font-size:12px;
  color:var(--muted);
  background:rgba(0,0,0,.18);
  border:1px solid var(--line);
  border-radius:16px;
  padding:14px;
}

.node-library-list{
  display:grid;
  gap:10px;
}

.node-library-item{
  padding:14px;
  border-radius:16px;
  border:1px solid var(--line);
  background:rgba(255,255,255,.03);
  display:grid;
  gap:8px;
}

.node-library-item strong{
  font-size:14px;
}

.node-library-item .micro{
  margin:0;
}

.node-library-actions{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
}

@media(max-width:1260px){
  .builder-shell{
    grid-template-columns:1fr;
  }

  .builder-canvas-wrap{
    order:1;
  }
}
