/* Редактор стейт-машины: палитра, холст, узлы, связи, инспектор. */

.fx {
  display: grid;
  grid-template-columns: 214px minmax(0, 1fr) 330px;
  height: 100%;
  min-height: 0;
}
.fx--wide { grid-template-columns: 0 minmax(0, 1fr) 0; }
.fx--wide > * { display: none; }

.fx__palette {
  border-right: 1px solid var(--line);
  background: var(--bg-1);
  padding: 14px 12px;
  overflow-y: auto;
}
.fx__palette-title { font-size: 11px; font-weight: 650; letter-spacing: .06em; text-transform: uppercase; color: var(--text-3); margin: 2px 2px 10px; }

.fx__palette-item {
  display: flex; align-items: flex-start; gap: 9px;
  width: 100%; text-align: left;
  padding: 9px 10px; margin-bottom: 6px;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--bg-2); color: var(--text);
  font: inherit; cursor: grab;
  transition: border-color .12s, background .12s;
}
.fx__palette-item:hover { background: var(--bg-3); border-color: var(--line-2); }
.fx__palette-item:active { cursor: grabbing; }
.fx__palette-item b { display: block; font-size: 12.5px; font-weight: 600; }
.fx__palette-item small { display: block; font-size: 11px; color: var(--text-3); margin-top: 1px; line-height: 1.4; }

.fx__palette-dot { width: 9px; height: 9px; border-radius: 50%; margin-top: 4px; flex: 0 0 9px; }

.fx__palette-hint { font-size: 11px; color: var(--text-3); line-height: 1.55; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.fx__palette-hint + .fx__palette-hint { border-top: none; padding-top: 8px; margin-top: 8px; }

.fx__main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }

.fx__stage {
  position: relative;
  flex: 1;
  overflow: hidden;
  background:
    radial-gradient(circle at 1px 1px, #1f2a42 1px, transparent 0) 0 0 / 22px 22px,
    var(--bg);
  cursor: grab;
  outline: none;
}
.fx__stage.is-panning { cursor: grabbing; }

.fx__world, .fx__svg { position: absolute; top: 0; left: 0; transform-origin: 0 0; }
.fx__svg { pointer-events: none; overflow: visible; z-index: 0; }
.fx__world { z-index: 1; }
.fx__edges { position: absolute; top: 0; left: 0; overflow: visible; }

.fx__nodes { position: absolute; top: 0; left: 0; }

.fx__node {
  position: absolute;
  width: 218px;
  background: var(--bg-2);
  border: 1px solid var(--line-2);
  border-left: 3px solid var(--node-color, var(--accent));
  border-radius: 10px;
  padding: 10px 12px 11px;
  cursor: grab;
  user-select: none;
  box-shadow: 0 3px 10px rgba(0, 0, 0, .3);
  transition: border-color .12s, box-shadow .12s;
}
.fx__node:hover { box-shadow: 0 6px 18px rgba(0, 0, 0, .45); }
.fx__node.is-selected { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft), 0 6px 18px rgba(0, 0, 0, .5); }
.fx__node.is-link-target { border-color: var(--ok); box-shadow: 0 0 0 2px rgba(34, 197, 94, .25); }

.fx__node--start { border-left-color: #22c55e; }
.fx__node--handoff { border-left-color: #f59e0b; }
.fx__node--done { border-left-color: #ef4444; }

.fx__node-head { display: flex; align-items: center; gap: 7px; margin-bottom: 3px; }
.fx__node-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--node-color, var(--accent)); flex: 0 0 7px; }
.fx__node-title { font-size: 12.5px; font-weight: 620; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fx__node-type { font-size: 10.5px; color: var(--text-3); text-transform: uppercase; letter-spacing: .05em; display: flex; align-items: center; gap: 6px; }
.fx__node-count { background: var(--bg-3); border-radius: 10px; padding: 0 6px; letter-spacing: 0; }
.fx__node-prompt {
  font-size: 11px; color: var(--text-3); line-height: 1.45; margin-top: 7px;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.fx__node-say {
  font-size: 10.5px; color: var(--accent-2); margin-top: 6px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.fx__node-badges { display: flex; gap: 4px; margin-top: 7px; }
.fx__badge { font-size: 11px; opacity: .75; }

.fx__port {
  position: absolute; width: 13px; height: 13px;
  border-radius: 50%; background: var(--bg-3);
  border: 2px solid var(--line-2);
  top: 50%; transform: translateY(-50%);
}
.fx__port--in { left: -8px; }
.fx__port--out {
  right: -8px; cursor: crosshair;
  border-color: var(--accent);
  background: var(--accent);
}
.fx__port--out:hover { background: var(--accent-2); transform: translateY(-50%) scale(1.25); }

.fx__edge { fill: none; stroke: #4a5b80; stroke-width: 1.8; }
.fx__edge.is-selected { stroke: var(--accent-2); stroke-width: 2.6; }
.fx__edge.is-default { stroke: #3f5a52; stroke-dasharray: 6 5; }
.fx__edge.is-uncond { stroke: #6b5a2f; stroke-dasharray: 2 4; }
.fx__edge-hit { fill: none; stroke: transparent; stroke-width: 11; pointer-events: stroke; cursor: pointer; }

.fx__edge-label {
  font-family: var(--sans); font-size: 10.5px;
  fill: var(--text-3); text-anchor: middle;
  paint-order: stroke; stroke: var(--bg); stroke-width: 4px; stroke-linejoin: round;
  cursor: pointer; pointer-events: auto;
}
.fx__edge-label.is-selected { fill: var(--accent-2); }

.fx__ghost { fill: none; stroke: var(--accent-2); stroke-width: 2; stroke-dasharray: 5 4; pointer-events: none; }

.fx__status {
  flex: 0 0 auto;
  border-top: 1px solid var(--line);
  background: var(--bg-1);
  padding: 9px 16px;
  display: flex; align-items: center; gap: 9px;
  min-height: 42px;
  overflow-x: auto; white-space: nowrap;
}

.fx__inspector {
  border-left: 1px solid var(--line);
  background: var(--bg-1);
  padding: 16px;
  overflow-y: auto;
  min-width: 0;
}
.fx__inspector-empty { color: var(--text-3); font-size: 12.5px; line-height: 1.7; padding-top: 10px; }
.fx__insp-head { display: flex; align-items: center; gap: 9px; margin-bottom: 16px; }
.fx__insp-title { font-size: 13px; font-weight: 650; }
.fx__flow-route { display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--text-2); margin-bottom: 14px; flex-wrap: wrap; }
.fx__flow-route span:nth-child(2) { color: var(--text-3); }

.fx__out-row {
  display: flex; gap: 9px; padding: 9px 10px;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  margin-bottom: 6px; cursor: pointer; background: var(--bg);
}
.fx__out-row:hover { border-color: var(--line-2); background: var(--bg-2); }
.fx__out-row.is-selected { border-color: var(--accent); background: var(--accent-soft); }
.fx__out-arrow { color: var(--accent-2); flex: 0 0 auto; }
.fx__out-cond { margin-top: 2px; line-height: 1.4; }

.fx__cond-row { display: grid; grid-template-columns: 1fr 1.1fr auto; gap: 6px; margin-bottom: 6px; align-items: center; }
.fx__cond-empty { font-size: 11.5px; color: var(--text-3); }
.fx__common-slots { font-size: 11.5px; color: var(--text-3); margin-top: 8px; }

@media (max-width: 1200px) {
  .fx { grid-template-columns: 180px minmax(0, 1fr) 300px; }
}