:root {
  --bg: #111111;
  --panel: #1a1a1a;
  --panel-2: #232323;
  --panel-3: #2b2b2b;
  --text: #f4f4f4;
  --muted: #9c9c9c;
  --border: #343434;
  --accent: #ff6b35;
  --accent-soft: rgba(255,107,53,.14);
  --green: #24c875;
  --red: #ff5f6d;
  --yellow: #f3bd4a;
  --blue: #5ca8ff;
  --sidebar: 260px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--text); }
body { min-height: 100vh; overflow: hidden; }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
input, textarea, select {
  width: 100%; color: var(--text); background: #171717; border: 1px solid var(--border);
  border-radius: 7px; padding: 9px 10px; outline: none;
}
input:focus, textarea:focus, select:focus { border-color: #686868; box-shadow: 0 0 0 2px rgba(255,255,255,.04); }
textarea { resize: vertical; min-height: 92px; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.badge { border: 1px solid var(--border); border-radius: 999px; padding: 3px 8px; font-size: 11px; color: var(--muted); }
.badge.active { color: var(--green); border-color: rgba(36,200,117,.35); background: rgba(36,200,117,.08); }
.badge.draft { color: var(--yellow); border-color: rgba(243,189,74,.35); background: rgba(243,189,74,.08); }
.badge.inactive { color: #b8b8b8; }
.btn { border: 1px solid var(--border); background: #242424; color: var(--text); border-radius: 7px; padding: 8px 12px; }
.btn:hover { background: #2d2d2d; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #111; font-weight: 650; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; }
.btn.danger { color: #ff9aa4; border-color: rgba(255,95,109,.35); }
.btn.icon { width: 34px; height: 34px; padding: 0; display: inline-grid; place-items: center; }
.row { display: flex; align-items: center; gap: 8px; }
.row.between { justify-content: space-between; }
.stack { display: grid; gap: 12px; }

.login-page { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: radial-gradient(circle at 50% 20%, #24201d 0, #111 45%); }
.login-card { width: min(420px, 100%); border: 1px solid var(--border); background: rgba(25,25,25,.96); border-radius: 14px; padding: 28px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 750; letter-spacing: -.02em; }
.brand-mark { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; background: var(--accent); color: #111; font-weight: 900; }
.login-card h1 { font-size: 24px; margin: 24px 0 6px; }
.login-error { color: #ff9aa4; min-height: 20px; font-size: 13px; }

.shell { height: 100vh; display: grid; grid-template-columns: var(--sidebar) 1fr; }
.sidebar { background: #161616; border-right: 1px solid var(--border); min-width: 0; display: flex; flex-direction: column; }
.sidebar-top { padding: 15px 14px 12px; border-bottom: 1px solid var(--border); }
.sidebar-nav { padding: 10px; display: grid; gap: 4px; }
.nav-item { display: flex; align-items: center; gap: 10px; border: 0; background: transparent; color: #d8d8d8; border-radius: 7px; padding: 9px 10px; text-align: left; }
.nav-item:hover, .nav-item.active { background: #242424; color: #fff; }
.nav-icon { width: 20px; color: var(--muted); text-align: center; }
.sidebar-section { padding: 12px 10px 4px; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: #777; }
.workspace-list { overflow: auto; padding: 0 10px 12px; flex: 1; }
.workspace-button { width: 100%; text-align: left; color: #d4d4d4; border: 0; background: transparent; border-radius: 7px; padding: 8px 10px; display: grid; gap: 2px; }
.workspace-button:hover, .workspace-button.active { background: #242424; }
.workspace-owner { font-size: 11px; color: #777; }
.sidebar-footer { padding: 10px; border-top: 1px solid var(--border); }
.user-chip { display: flex; gap: 9px; align-items: center; min-width: 0; }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: #363636; display: grid; place-items: center; font-size: 12px; }
.user-meta { min-width: 0; flex: 1; }
.user-meta strong, .user-meta span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.content { min-width: 0; display: flex; flex-direction: column; height: 100vh; }
.topbar { height: 54px; display: flex; align-items: center; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--border); background: #191919; padding: 0 16px; }
.breadcrumb { display: flex; gap: 8px; min-width: 0; align-items: center; font-size: 13px; }
.breadcrumb span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.main { flex: 1; min-height: 0; overflow: auto; }
.page { padding: 24px; max-width: 1180px; margin: 0 auto; }
.page h1 { margin: 0; font-size: 24px; letter-spacing: -.03em; }
.page-head { display: flex; justify-content: space-between; gap: 16px; align-items: center; margin-bottom: 22px; }
.card-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.card { border: 1px solid var(--border); background: var(--panel); border-radius: 10px; padding: 15px; }
.card.clickable:hover { border-color: #555; background: #202020; cursor: pointer; }
.card h3 { margin: 0 0 6px; font-size: 15px; }
.card p { margin: 0; color: var(--muted); font-size: 13px; }
.empty { border: 1px dashed #3c3c3c; border-radius: 10px; padding: 34px; text-align: center; color: var(--muted); }

.workflow-shell { height: calc(100vh - 54px); display: flex; flex-direction: column; min-height: 0; }
.workflow-toolbar { height: 52px; flex: 0 0 auto; background: #1b1b1b; border-bottom: 1px solid var(--border); padding: 0 12px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.workflow-tabs { height: 40px; display: flex; align-items: end; justify-content: center; background: #1b1b1b; border-bottom: 1px solid var(--border); }
.workflow-tab { border: 0; border-radius: 6px 6px 0 0; background: transparent; color: #aaa; padding: 9px 16px; }
.workflow-tab.active { background: #292929; color: #fff; }
.editor-area { flex: 1; min-height: 0; display: grid; grid-template-columns: 1fr 0; transition: grid-template-columns .15s ease; }
.editor-area.inspector-open { grid-template-columns: 1fr 330px; }
.canvas-wrap { position: relative; min-width: 0; overflow: hidden; background-color: #151515; background-image: radial-gradient(#3b3b3b 1px, transparent 1px); background-size: 20px 20px; }
.canvas { position: absolute; inset: 0; overflow: auto; }
.canvas-stage { position: relative; width: 2400px; height: 1600px; }
.edges { position: absolute; inset: 0; pointer-events: none; width: 2400px; height: 1600px; overflow: visible; }
.edge { stroke: #555; stroke-width: 1.6; fill: none; }
.edge.succeeded { stroke: var(--green); stroke-width: 2.2; }
.edge.failed { stroke: var(--red); }
.node { width: 160px; position: absolute; user-select: none; }
.node-box { position: relative; min-height: 88px; border: 1px solid #4b4b4b; border-radius: 12px; background: #292929; display: grid; place-items: center; padding: 15px; cursor: grab; }
.node-box:active { cursor: grabbing; }
.node.selected .node-box { border-color: #8a8a8a; box-shadow: 0 0 0 2px rgba(255,255,255,.06); }
.node.running .node-box { border-color: var(--yellow); box-shadow: 0 0 0 2px rgba(243,189,74,.11); }
.node.succeeded .node-box { border-color: var(--green); box-shadow: 0 0 0 2px rgba(36,200,117,.09); }
.node.failed .node-box { border-color: var(--red); box-shadow: 0 0 0 2px rgba(255,95,109,.09); }
.node.skipped { opacity: .48; }
.node-icon { font-size: 30px; line-height: 1; }
.node-title { text-align: center; margin-top: 8px; font-size: 13px; font-weight: 650; line-height: 1.2; }
.node-subtitle { text-align: center; color: var(--muted); font-size: 11px; margin-top: 3px; }
.port { position: absolute; width: 12px; height: 12px; border-radius: 50%; border: 1px solid #666; background: #222; top: 50%; transform: translateY(-50%); }
.port.in { left: -7px; }
.port.out { right: -7px; }
.node-add { position: absolute; right: -34px; top: calc(50% - 11px); width: 22px; height: 22px; border-radius: 5px; border: 1px solid var(--border); background: #303030; color: #ddd; display: grid; place-items: center; padding: 0; }
.node-add:hover { background: #444; }
.node.if .node-add { top: calc(50% - 11px); }
.route-tag { position: absolute; right: -30px; font-size: 10px; color: var(--muted); }
.route-tag.true { top: 18px; }
.route-tag.false { bottom: 18px; }
.canvas-controls { position: absolute; left: 14px; bottom: 14px; display: flex; gap: 6px; z-index: 4; }
.inspector { background: #1d1d1d; border-left: 1px solid var(--border); overflow: auto; padding: 16px; }
.inspector h3 { margin: 0; font-size: 15px; }
.field { display: grid; gap: 6px; margin: 14px 0; }
.field label { font-size: 12px; color: #bcbcbc; }
.inspector-actions { border-top: 1px solid var(--border); margin-top: 18px; padding-top: 14px; display: flex; gap: 8px; }

.executions-layout { flex: 1; min-height: 0; display: grid; grid-template-columns: 290px 1fr; }
.execution-list { border-right: 1px solid var(--border); background: #1a1a1a; overflow: auto; }
.execution-list-head { padding: 14px; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: #1a1a1a; z-index: 2; }
.execution-item { padding: 12px 14px; border-bottom: 1px solid #292929; cursor: pointer; }
.execution-item:hover, .execution-item.active { background: #292929; }
.execution-status { font-size: 12px; }
.execution-status.succeeded { color: var(--green); }
.execution-status.failed { color: var(--red); }
.execution-status.running, .execution-status.queued { color: var(--yellow); }
.execution-status.cancelled { color: #d9a15e; }
.execution-detail { min-width: 0; display: flex; flex-direction: column; }
.execution-meta { min-height: 60px; padding: 10px 18px; border-bottom: 1px solid var(--border); background: #181818; }
.execution-canvas { flex: 1; position: relative; background-color: #151515; background-image: linear-gradient(135deg, rgba(255,255,255,.018) 25%, transparent 25%, transparent 50%, rgba(255,255,255,.018) 50%, rgba(255,255,255,.018) 75%, transparent 75%); background-size: 28px 28px; overflow: auto; }

.table-wrap { border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 11px 12px; text-align: left; border-bottom: 1px solid #303030; font-size: 13px; }
th { color: #a7a7a7; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; background: #1e1e1e; }
tr:last-child td { border-bottom: 0; }

.modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.62); display: grid; place-items: center; z-index: 30; padding: 20px; }
.modal { width: min(560px, 100%); max-height: 80vh; overflow: auto; border: 1px solid #494949; border-radius: 12px; background: #202020; padding: 16px; }
.modal h2 { font-size: 18px; margin: 0 0 14px; }
.node-picker { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.picker-item { display: flex; align-items: center; gap: 10px; border: 1px solid var(--border); background: #282828; color: var(--text); border-radius: 9px; padding: 12px; text-align: left; }
.picker-item:hover { border-color: #666; background: #303030; }
.toast-wrap { position: fixed; right: 16px; bottom: 16px; z-index: 50; display: grid; gap: 8px; }
.toast { min-width: 260px; max-width: 420px; padding: 11px 13px; background: #292929; border: 1px solid #4a4a4a; border-radius: 8px; font-size: 13px; }
.toast.error { border-color: rgba(255,95,109,.55); }
.toast.success { border-color: rgba(36,200,117,.55); }

@media (max-width: 900px) {
  :root { --sidebar: 210px; }
  .editor-area.inspector-open { grid-template-columns: 1fr 280px; }
  .executions-layout { grid-template-columns: 240px 1fr; }
}
@media (max-width: 700px) {
  body { overflow: auto; }
  .shell { grid-template-columns: 1fr; height: auto; min-height: 100vh; }
  .sidebar { display: none; }
  .content { height: 100vh; }
  .topbar { padding: 0 10px; }
  .workflow-toolbar .row .btn:not(.primary) { display: none; }
  .editor-area.inspector-open { grid-template-columns: 1fr; }
  .inspector { position: absolute; right: 0; top: 146px; bottom: 0; width: min(92vw, 340px); z-index: 10; box-shadow: -10px 0 30px rgba(0,0,0,.3); }
  .executions-layout { grid-template-columns: 1fr; }
  .execution-list { display: none; }
  .page { padding: 16px; }
  .node-picker { grid-template-columns: 1fr; }
}

/* FlowForge workflow editor v0.2 - n8n-inspired interaction model */
.editor-area { grid-template-columns: minmax(0, 1fr); }
.editor-area.inspector-open { grid-template-columns: minmax(0, 1fr) 430px; }
.editor-area.library-open { grid-template-columns: minmax(0, 1fr) 370px; }

.node { width: 150px; }
.node-box {
  width: 96px;
  min-height: 96px;
  height: 96px;
  margin: 0 auto;
  border-radius: 16px;
  background: #292929;
  border: 1px solid #505050;
  box-shadow: 0 5px 16px rgba(0,0,0,.18);
}
.node-icon { font-size: 34px; color: #f0f0f0; }
.node-http_request .node-icon { color: #8e85ff; }
.node-wait .node-icon { color: #f28caf; }
.node-if .node-icon { color: #65afff; }
.node-webhook_trigger .node-icon, .node-manual_trigger .node-icon { color: #eaeaea; }
.node-email_webhook .node-icon { color: #8bd6ff; }
.node-set .node-icon { color: #efca6c; }
.node-title { font-size: 14px; margin-top: 9px; font-weight: 700; }
.node-subtitle { font-size: 11px; max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.node.selected .node-box, .node.log-selected .node-box { box-shadow: 0 0 0 2px rgba(255,255,255,.18), 0 6px 18px rgba(0,0,0,.25); }
.node.running .node-box { border-color: var(--yellow); box-shadow: 0 0 0 2px rgba(243,189,74,.2), 0 0 24px rgba(243,189,74,.08); }
.node.succeeded .node-box { border-color: var(--green); box-shadow: 0 0 0 2px rgba(36,200,117,.12); }
.node.failed .node-box { border-color: var(--red); box-shadow: 0 0 0 2px rgba(255,95,109,.14); }
.node-status-mark { position: absolute; right: 6px; bottom: 6px; width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 800; background: #1d1d1d; }
.node-status-mark.success { color: var(--green); border: 1px solid var(--green); }
.node-status-mark.failed { color: var(--red); border: 1px solid var(--red); }
.node-status-mark.running { color: var(--yellow); border: 1px solid var(--yellow); }
.port { width: 14px; height: 14px; background: #242424; border-color: #696969; }
.node-box .port.in { left: -8px; }
.node-box .port.out { right: -8px; }
.route-out.true { top: 35%; }
.route-out.false { top: 65%; }
.node-add { right: -1px; top: 37px; width: 24px; height: 24px; border-radius: 6px; z-index: 3; }
.route-tag { right: -4px; }
.route-tag.true { top: 18px; }
.route-tag.false { bottom: 30px; }

.edge { stroke: #555; stroke-width: 1.8; }
.edge.running { stroke: var(--green); stroke-width: 2.3; stroke-dasharray: 8 6; animation: flow-dash .55s linear infinite; }
.edge.succeeded { stroke: var(--green); stroke-width: 2.4; }
.edge.failed { stroke: var(--red); stroke-width: 2.4; }
.edge.cancelled { stroke: #d28b3e; stroke-width: 2.4; }
.edge-label { fill: #d9d9d9; font-size: 11px; text-anchor: middle; paint-order: stroke; stroke: #151515; stroke-width: 5px; stroke-linejoin: round; }
@keyframes flow-dash { to { stroke-dashoffset: -14; } }

.spinner { width: 13px; height: 13px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; display: inline-block; vertical-align: -2px; animation: spin .75s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.execute-top.running { color: var(--yellow); }
.execute-floating {
  position: absolute; left: 50%; bottom: 18px; transform: translateX(-50%); z-index: 8;
  border: 0; border-radius: 7px; padding: 10px 18px; background: var(--accent); color: #111; font-weight: 750;
  box-shadow: 0 8px 22px rgba(0,0,0,.32);
}
.execute-floating:hover { filter: brightness(1.08); }
.execute-floating.running { background: #303030; color: var(--yellow); border: 1px solid #555; }

.node-library { min-width: 0; background: #202020; border-left: 1px solid var(--border); overflow: auto; display: flex; flex-direction: column; }
.node-library-head { display: flex; justify-content: space-between; gap: 10px; padding: 18px 16px 12px; border-bottom: 1px solid var(--border); }
.node-library-head h3 { margin: 0 0 4px; font-size: 18px; }
.node-search { margin: 12px; border: 1px solid #6c42a2; border-radius: 6px; display: flex; align-items: center; gap: 7px; padding: 0 10px; background: #181818; }
.node-search input { border: 0; background: transparent; box-shadow: none; padding-left: 2px; }
.node-category { padding: 4px 8px 10px; }
.node-category-title { padding: 8px 8px 6px; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: #8d8d8d; }
.library-node { width: 100%; border: 0; background: transparent; color: var(--text); display: grid; grid-template-columns: 36px 1fr 20px; gap: 10px; align-items: center; text-align: left; padding: 10px 8px; border-radius: 7px; }
.library-node:hover { background: #2a2a2a; }
.library-node-icon { width: 34px; height: 34px; border-radius: 9px; border: 1px solid #474747; background: #282828; display: grid; place-items: center; font-size: 19px; }
.library-node strong { display: block; font-size: 13px; }
.library-node small { display: block; color: var(--muted); margin-top: 2px; font-size: 11px; }
.library-chevron { color: #999; font-size: 22px; }
.empty-library { color: var(--muted); text-align: center; padding: 28px 16px; }

.inspector { padding: 0; display: flex; flex-direction: column; }
.inspector-header { padding: 12px 14px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; gap: 10px; align-items: center; }
.inspector-tabs { height: 38px; border-bottom: 1px solid var(--border); display: flex; gap: 18px; padding: 0 15px; align-items: end; }
.inspector-tabs span { color: var(--muted); padding: 8px 0; font-size: 12px; }
.inspector-tabs span.active { color: #fff; border-bottom: 2px solid var(--accent); }
.inspector-scroll { overflow: auto; padding: 0 15px 16px; }
.execute-step { background: var(--accent); border-color: var(--accent); color: #111; font-weight: 700; white-space: nowrap; }
.node-mini-icon { width: 30px; height: 30px; border-radius: 8px; border: 1px solid #494949; display: grid; place-items: center; background: #292929; }
.node-data-section { margin-top: 18px; border-top: 1px solid var(--border); padding-top: 14px; }
.node-data-grid { display: grid; grid-template-columns: 1fr; gap: 8px; }
.node-data-grid > div > span { font-size: 11px; color: var(--muted); }
.node-data-grid pre, .node-log-body pre, .run-detail-grid pre { margin: 5px 0 0; max-height: 220px; overflow: auto; border: 1px solid #333; border-radius: 7px; background: #151515; padding: 10px; color: #d9d9d9; font: 11px/1.45 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; white-space: pre-wrap; word-break: break-word; }
.payload-title { color: #b8d7ff; letter-spacing: .22em; font-size: 10px; font-weight: 750; }

.node-log-drawer { position: absolute; left: 0; right: 0; bottom: 0; min-height: 190px; max-height: 36%; z-index: 7; background: #171717; border-top: 1px solid var(--border); box-shadow: 0 -10px 30px rgba(0,0,0,.28); display: flex; flex-direction: column; }
.editor-area .node-log-drawer + .execute-floating { bottom: 210px; }
.node-log-head { display: flex; align-items: center; justify-content: space-between; padding: 8px 12px; border-bottom: 1px solid var(--border); }
.node-log-body { min-height: 0; overflow: auto; display: grid; grid-template-columns: 1fr 1fr; gap: 0; }
.node-log-body > div { min-width: 0; padding: 10px 12px; border-right: 1px solid var(--border); }
.node-log-body > div:last-child { border-right: 0; }
.small-btn { padding: 5px 8px; font-size: 11px; }
.execution-detail > .node-log-drawer { position: relative; min-height: 200px; max-height: 300px; }

.modal-backdrop { backdrop-filter: blur(2px); }
.modal { padding: 0; overflow: hidden; }
.modal-form { width: min(540px, 100%); }
.modal-compact { width: min(440px, 100%); }
.modal-wide { width: min(820px, 100%); }
.modal-title { min-height: 62px; padding: 15px 17px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.modal-title h2 { margin: 0 0 4px; }
.modal-title p { margin: 0; font-size: 12px; }
.modal form, .modal > .stack, .modal > .table-wrap, .modal > .form-grid, .modal > .modal-actions, .run-detail-grid { margin-left: 16px; margin-right: 16px; }
.modal form { padding: 4px 0 16px; }
.modal-actions { padding: 14px 0 16px; display: flex; justify-content: flex-end; gap: 8px; }
.modal .field { margin: 10px 0; }
.info-box { border: 1px solid #3d4a55; background: #192128; color: #c5d7e5; border-radius: 7px; padding: 10px 12px; font-size: 12px; line-height: 1.45; }
.form-error { color: #ff9aa4; font-size: 12px; min-height: 18px; }
.check-row { display: flex; gap: 9px; align-items: center; color: #d1d1d1; font-size: 13px; }
.check-row input { width: auto; }
.form-grid.two { display: grid; grid-template-columns: 1fr 180px; gap: 12px; }
.route-choice { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; }
.route-choice.true { color: var(--green); border: 1px solid rgba(36,200,117,.5); }
.route-choice.false { color: var(--red); border: 1px solid rgba(255,95,109,.5); }
.btn.danger.solid { background: #6d2730; color: #fff; border-color: #963944; }
.run-detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; padding: 16px 0; }

@media (max-width: 900px) {
  .editor-area.inspector-open, .editor-area.library-open { grid-template-columns: minmax(0,1fr) minmax(280px, 40vw); }
}
@media (max-width: 700px) {
  .editor-area.inspector-open, .editor-area.library-open { grid-template-columns: 1fr; }
  .node-library, .inspector { position: absolute; right: 0; top: 146px; bottom: 0; width: min(94vw, 390px); z-index: 12; box-shadow: -12px 0 32px rgba(0,0,0,.35); }
  .node-log-body, .run-detail-grid { grid-template-columns: 1fr; }
  .form-grid.two { grid-template-columns: 1fr; }
  .execute-floating { bottom: 12px; }
}

/* FlowForge workflow editor v0.3 - execution controls and n8n-style node modal */
.node.cancelled .node-box { border-color: #d28b3e; box-shadow: 0 0 0 2px rgba(210,139,62,.13); }
.node-status-mark.cancelled { color: #d9a15e; border: 1px solid #d9a15e; }

.stop-execution,
.floating-stop,
.trigger-stop-button {
  border-color: #8d4545 !important;
  color: #ff9b9b !important;
  background: #301d1d !important;
  font-weight: 750;
}
.stop-execution:hover,
.floating-stop:hover,
.trigger-stop-button:hover { background: #482323 !important; }

.execute-floating-group {
  position: absolute;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  z-index: 8;
  display: flex;
  align-items: center;
  gap: 8px;
}
.execute-floating-group .execute-floating {
  position: static;
  left: auto;
  bottom: auto;
  transform: none;
}
.floating-stop {
  width: 40px;
  height: 40px;
  border: 1px solid #8d4545;
  border-radius: 7px;
  cursor: pointer;
}
.execute-floating-group.with-log { bottom: 210px; }

.trigger-run-control {
  position: absolute;
  right: calc(100% - 18px);
  top: 28px;
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  z-index: 5;
}
.trigger-run-button,
.trigger-stop-button {
  min-height: 36px;
  border-radius: 7px;
  border: 1px solid #ff6a2c;
  padding: 0 12px;
  background: #ff6a2c;
  color: #111;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}
.trigger-run-button.running {
  border-color: #555;
  background: #303030;
  color: var(--yellow);
}
.trigger-stop-button { width: 36px; min-width: 36px; padding: 0; }

.node-modal-backdrop { padding: 16px; }
.node-properties-modal {
  width: min(1780px, calc(100vw - 32px));
  height: min(820px, calc(100vh - 32px));
  max-height: calc(100vh - 32px);
  display: grid;
  grid-template-rows: 58px minmax(0, 1fr);
  border-radius: 9px;
  background: #202020;
}
.node-modal-title {
  min-width: 0;
  padding: 9px 12px 9px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.node-modal-icon {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  border: 1px solid #4a4a4a;
  background: #282828;
  display: grid;
  place-items: center;
  font-size: 20px;
}
.node-modal-grid {
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(360px, .95fr) minmax(260px, .9fr);
}
.node-modal-data,
.node-modal-parameters {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: #1d1d1d;
}
.node-modal-parameters {
  border-left: 1px solid var(--border);
  border-right: 1px solid var(--border);
  background: #222;
}
.node-panel-head {
  min-height: 42px;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border-bottom: 1px solid #303030;
  letter-spacing: .12em;
  font-size: 11px;
}
.node-panel-tabs,
.node-parameters-tabs {
  min-height: 38px;
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  gap: 14px;
  padding: 0 12px;
  border-bottom: 1px solid #303030;
  color: #9e9e9e;
  font-size: 11px;
}
.node-parameters-tabs { justify-content: flex-start; }
.node-panel-tabs span,
.node-parameters-tabs span { padding: 10px 0 8px; }
.node-panel-tabs .active,
.node-parameters-tabs .active { color: #fff; border-bottom: 2px solid var(--accent); }
.node-modal-data > pre {
  flex: 1;
  min-height: 0;
  margin: 0;
  padding: 16px;
  overflow: auto;
  background: #171717;
  color: #d8d8d8;
  font: 12px/1.55 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  white-space: pre-wrap;
  word-break: break-word;
}
.node-parameters-scroll {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 8px 16px 18px;
}
.node-parameters-scroll .field { margin: 12px 0; }
.node-parameters-scroll textarea { min-height: 110px; }
.node-modal-actions {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}
.execute-step.running { color: var(--yellow); background: #303030; border-color: #555; }
.table-actions { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }

@media (max-width: 1050px) {
  .node-modal-grid { grid-template-columns: minmax(230px, .85fr) minmax(330px, 1.15fr); }
  .node-modal-output { display: none; }
}
@media (max-width: 760px) {
  .node-modal-backdrop { padding: 0; }
  .node-properties-modal { width: 100vw; height: 100vh; max-height: 100vh; border-radius: 0; }
  .node-modal-title { align-items: flex-start; }
  .node-modal-grid { grid-template-columns: 1fr; overflow: auto; }
  .node-modal-input { display: none; }
  .node-modal-parameters { border: 0; min-height: 100%; }
  .trigger-run-control { right: auto; left: 50%; top: -48px; transform: translateX(-50%); }
  .execute-floating-group { bottom: 12px; }
  .execute-floating-group.with-log { bottom: 210px; }
}

/* FlowForge workflow editor v0.4 - draggable references, edge actions and middle-mouse pan */
.canvas.panning,
.canvas.panning * { cursor: grabbing !important; user-select: none !important; }

.edges.interactive { pointer-events: auto; }
.edges.interactive .edge { pointer-events: none; }
.edge-group { pointer-events: stroke; }
.edge-hit {
  fill: none;
  stroke: transparent;
  stroke-width: 18;
  pointer-events: stroke;
  cursor: pointer;
}
.edge-group:hover .edge:not(.running):not(.succeeded):not(.failed):not(.cancelled) { stroke: #858585; }
.edge-actions {
  opacity: 0;
  pointer-events: none;
  transition: opacity .12s ease;
  filter: drop-shadow(0 4px 8px rgba(0,0,0,.45));
}
.edge-group:hover .edge-actions,
.edge-actions:hover { opacity: 1; pointer-events: all; }
.edge-action { cursor: pointer; pointer-events: all; }
.edge-action rect { fill: #2e2e2e; stroke: #5a5a5a; stroke-width: 1; }
.edge-action text {
  fill: #f1f1f1;
  text-anchor: middle;
  font-size: 17px;
  font-weight: 700;
  pointer-events: none;
}
.edge-action-add:hover rect { fill: #3a3a3a; stroke: var(--accent); }
.edge-action-add:hover text { fill: var(--accent); }
.edge-action-delete:hover rect { fill: #46272b; stroke: var(--red); }
.edge-action-delete:hover text { fill: #ff9ca5; }

.json-reference-view {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 12px 8px 18px;
  background: #171717;
  color: #d8d8d8;
  font: 12px/1.55 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.json-ref-row {
  min-height: 23px;
  padding: 2px 8px 2px calc(8px + (var(--json-depth, 0) * 18px));
  border: 1px solid transparent;
  border-radius: 5px;
  white-space: nowrap;
  position: relative;
  display: flex;
  align-items: baseline;
}
.json-ref-row[draggable="true"] { cursor: grab; }
.json-ref-row[draggable="true"]:hover {
  background: #22272b;
  border-color: #39434b;
}
.json-ref-row[draggable="true"]:active { cursor: grabbing; }
.json-ref-row.dragging-reference { opacity: .5; background: #26333b; border-color: #4a7894; }
.ref-drag-handle {
  width: 20px;
  flex: 0 0 20px;
  opacity: 0;
  color: #86bff1;
  font-size: 10px;
  letter-spacing: -2px;
  transform: translateX(-3px);
}
.json-ref-row[draggable="true"]:hover .ref-drag-handle { opacity: 1; }
.ref-drag-handle.ghost { visibility: hidden; }
.json-key { color: #d9d9d9; }
.json-punct { color: #aeb5bb; }
.json-string { color: #bd9cff; }
.json-number { color: #50d890; }
.json-boolean { color: #ffb86c; }
.json-null { color: #8c97a2; }
.ref-path-preview {
  margin-left: auto;
  padding-left: 16px;
  color: #68c996;
  opacity: 0;
  font-size: 10px;
}
.json-ref-row[draggable="true"]:hover .ref-path-preview { opacity: .85; }

.reference-drop-target { transition: border-color .12s ease, box-shadow .12s ease, background .12s ease; }
.reference-drop-target.reference-drag-over {
  border-color: #68c996 !important;
  box-shadow: 0 0 0 2px rgba(104,201,150,.18) !important;
  background: #18261f !important;
}
.node-parameters-scroll .field:has(.reference-drop-target)::after {
  content: 'Arraste propriedades do INPUT/OUTPUT para este campo';
  display: none;
  color: #6f8f7f;
  font-size: 9px;
  margin-top: -2px;
}
.node-parameters-scroll .field:has(.reference-drop-target:hover)::after { display: block; }

@media (max-width: 760px) {
  .edge-actions { opacity: 1; }
  .ref-path-preview { display: none; }
}
.reference-hint { margin-left: auto; color: #6f9f86; font-size: 9px; letter-spacing: normal; white-space: nowrap; }
@media (max-width: 1100px) { .reference-hint { display: none; } }

/* FlowForge workflow editor v0.4.1 - drag-to-connect nodes */
.connection-port { cursor: crosshair; transition: transform .12s ease, border-color .12s ease, background .12s ease, box-shadow .12s ease; z-index: 6; }
.connection-port:hover,
.connection-source-active { transform: translateY(-50%) scale(1.28); border-color: #f3f3f3; background: #343434; box-shadow: 0 0 0 4px rgba(255,255,255,.08); }
.connection-target-candidate { border-color: #777; box-shadow: 0 0 0 3px rgba(255,255,255,.04); }
.connection-target-active { transform: translateY(-50%) scale(1.38) !important; border-color: var(--green) !important; background: #173827 !important; box-shadow: 0 0 0 6px rgba(36,200,117,.16) !important; }
.connection-preview { fill: none; stroke: var(--green); stroke-width: 2.2; pointer-events: none; }
.connection-preview-end { fill: var(--green); stroke: #151515; stroke-width: 2; pointer-events: none; }
.canvas-stage.connection-dragging .node-box { cursor: default; }
.canvas-stage.connection-dragging [data-connection-input] { cursor: crosshair; }
