/* צומת — עיצוב. טוקנים בלבד, בלי ערכים קשיחים ברכיבים */
:root {
  --bg: #F2F3F9;
  --surface: #FFFFFF;
  --surface-2: #F8F9FD;
  --sunken: #E9EBF4;
  --border: #DDE0EC;
  --border-strong: #C5CADC;
  --text: #171A2C;
  --text-muted: #5A6077;
  --text-faint: #8A8FA6;
  --accent: #4F46E5;
  --accent-hover: #4338CA;
  --accent-soft: #E7E7FD;
  --on-accent: #FFFFFF;
  --trigger: #D9661F;
  --trigger-soft: #FDEBDD;
  --success: #2C7A4B;
  --success-soft: #DDF0E3;
  --danger: #B23B2A;
  --danger-soft: #F7E0DB;
  --warning: #9A6A12;
  --warning-soft: #F8EDD3;
  --edge: #A6ABC2;
  --edge-active: #4F46E5;
  --dot: #CED2E2;
  --canvas: #F2F3F9;
  --shadow-sm: 0 1px 2px rgb(30 25 15 / .06);
  --shadow: 0 1px 2px rgb(30 25 15 / .05), 0 8px 24px -12px rgb(30 25 15 / .18);
  --shadow-lg: 0 2px 6px rgb(30 25 15 / .06), 0 24px 60px -20px rgb(30 25 15 / .30);
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 18px;
  --font: 'Heebo', system-ui, -apple-system, 'Segoe UI', Arial, sans-serif;
  --font-display: 'Rubik', 'Heebo', system-ui, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, 'Cascadia Mono', Consolas, monospace;
  --ease: cubic-bezier(.22, 1, .36, 1);
  --nav-w: 232px;
  --rail: #0D1030;
  --rail-2: rgb(255 255 255 / .08);
  --rail-text: #E4E5F7;
  --rail-muted: #A3A7CF;
  --signal: #FFB547;
  --grad-brand: linear-gradient(135deg, #0EA5A4 0%, #4F46E5 52%, #A855F7 100%);
  --grad-signal: linear-gradient(135deg, #FFB547 0%, #FF6B6B 55%, #F43F8E 100%);
  --grad-rail: radial-gradient(420px 320px at 100% 0%, rgb(14 165 164 / .32), transparent 70%), radial-gradient(380px 380px at 0% 100%, rgb(168 85 247 / .34), transparent 70%), linear-gradient(180deg, #0D1030 0%, #151338 55%, #1E1246 100%);
  --grad-page: radial-gradient(900px 340px at 85% -120px, rgb(79 70 229 / .10), transparent 70%), radial-gradient(700px 300px at 0% -80px, rgb(14 165 164 / .08), transparent 70%);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0D0F1E; --rail: #090B1C; --surface: #161A2E; --surface-2: #12152A; --sunken: #0A0C19; --border: #262A45; --border-strong: #363B5C;
    --text: #E9EAF5; --text-muted: #A6AAC6; --text-faint: #747A9C; --accent: #8F8CFF; --accent-hover: #A9A6FF; --accent-soft: #24224C; --on-accent: #FFFFFF;
    --trigger: #FF9A57; --trigger-soft: #3A2215; --success: #5CC184; --success-soft: #16301F; --danger: #F07C68; --danger-soft: #3B1C16; --warning: #E5B451; --warning-soft: #33280F;
    --edge: #4A4F72; --edge-active: #8F8CFF; --dot: #252945; --canvas: #0E1022; --grad-page: radial-gradient(900px 340px at 85% -120px, rgb(143 140 255 / .14), transparent 70%), radial-gradient(700px 300px at 0% -80px, rgb(14 165 164 / .10), transparent 70%); color-scheme: dark;
    --shadow: 0 1px 2px rgb(0 0 0 / .3), 0 8px 24px -12px rgb(0 0 0 / .6); --shadow-lg: 0 24px 60px -20px rgb(0 0 0 / .7);
  }
}
:root[data-theme="dark"] {
  --bg: #0D0F1E; --rail: #090B1C; --surface: #161A2E; --surface-2: #12152A; --sunken: #0A0C19; --border: #262A45; --border-strong: #363B5C;
  --text: #E9EAF5; --text-muted: #A6AAC6; --text-faint: #747A9C; --accent: #8F8CFF; --accent-hover: #A9A6FF; --accent-soft: #24224C; --on-accent: #FFFFFF;
  --trigger: #FF9A57; --trigger-soft: #3A2215; --success: #5CC184; --success-soft: #16301F; --danger: #F07C68; --danger-soft: #3B1C16; --warning: #E5B451; --warning-soft: #33280F;
  --edge: #4A4F72; --edge-active: #8F8CFF; --dot: #252945; --canvas: #0E1022; --grad-page: radial-gradient(900px 340px at 85% -120px, rgb(143 140 255 / .14), transparent 70%), radial-gradient(700px 300px at 0% -80px, rgb(14 165 164 / .10), transparent 70%); color-scheme: dark;
  --shadow: 0 1px 2px rgb(0 0 0 / .3), 0 8px 24px -12px rgb(0 0 0 / .6); --shadow-lg: 0 24px 60px -20px rgb(0 0 0 / .7);
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.55 var(--font); -webkit-font-smoothing: antialiased; overflow: hidden; }
button, input, select, textarea { font: inherit; color: inherit; }
::selection { background: color-mix(in oklab, var(--accent) 28%, transparent); }
input, textarea { caret-color: var(--accent); }
* { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 99px; border: 3px solid transparent; background-clip: padding-box; }
table, .meta, .chip, .ed-state, .mono { font-variant-numeric: tabular-nums; }
h1, h2, h3 { text-wrap: balance; }
a { color: var(--accent); }
.ic { width: 1.15em; height: 1.15em; flex: none; vertical-align: -0.2em; }
.ltr { direction: ltr; text-align: left; unicode-bidi: plaintext; }
.mono { font-family: var(--mono); font-size: 13px; }
.muted { color: var(--text-muted); }
.faint { color: var(--text-faint); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.spin { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; } }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- shell ---------- */
#app { height: 100%; }
.shell { display: grid; grid-template-columns: var(--nav-w) 1fr; height: 100%; }
.nav { background: var(--rail); color: var(--rail-text); display: flex; flex-direction: column; padding: 18px 14px 14px; gap: 2px; min-height: 0; overflow: auto; }
.brand { display: flex; align-items: center; gap: 11px; text-decoration: none; color: #fff; padding: 2px 8px 22px; }
.brand .mark { width: 38px; height: 38px; border-radius: 12px; background: var(--signal); color: var(--rail); display: grid; place-items: center; flex: none; box-shadow: 0 6px 18px -8px var(--signal); }
.brand svg { width: 23px; height: 23px; }
.brand b { font: 700 21px/1 var(--font-display); letter-spacing: -.01em; display: block; }
.brand small { display: block; font-size: 12px; color: var(--rail-muted); margin-top: 4px; }
.nav a.item { display: flex; align-items: center; gap: 12px; height: 44px; padding: 0 12px; border-radius: 12px; color: var(--rail-muted); text-decoration: none; position: relative; transition: background .15s, color .15s; font-weight: 500; font-size: 15px; }
.nav a.item:hover { background: var(--rail-2); color: #fff; }
.nav a.item.on { background: var(--rail-2); color: #fff; }
.nav a.item.on::after { content: ''; position: absolute; inset-inline-end: 12px; width: 7px; height: 7px; border-radius: 50%; background: var(--signal); box-shadow: 0 0 0 4px color-mix(in oklab, var(--signal) 22%, transparent); }
.nav a.item .ic { width: 21px; height: 21px; }
.nav .grow { flex: 1; min-height: 16px; }
.nav .foot { border-top: 1px solid var(--rail-2); padding-top: 12px; display: grid; gap: 2px; }
.nav .mode { font-size: 12px; color: var(--rail-muted); padding: 6px 12px 2px; display: flex; align-items: center; gap: 7px; }
.nav .mode .dot { background: var(--signal); }
.nav .mode .dot.ok { background: #5CC184; }
.nav button.item { all: unset; box-sizing: border-box; display: flex; align-items: center; gap: 12px; height: 40px; padding: 0 12px; border-radius: 12px; color: var(--rail-muted); cursor: pointer; font-size: 14px; }
.nav button.item:hover { background: var(--rail-2); color: #fff; }
.nav button.item:focus-visible, .nav a.item:focus-visible { outline: 2px solid var(--signal); outline-offset: 1px; }
.main { min-width: 0; overflow: auto; position: relative; }
.page { max-width: 1120px; margin: 0 auto; padding: 40px 36px 80px; animation: enter .28s var(--ease); }
@keyframes enter { from { opacity: 0; transform: translateY(8px); } }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head h1 { font: 600 32px/1.15 var(--font-display); margin: 0; letter-spacing: -.015em; }
.page-head p { margin: 8px 0 0; color: var(--text-muted); max-width: 62ch; font-size: 15.5px; }
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.spacer { flex: 1; }

/* ---------- controls ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 38px; padding: 0 15px; border-radius: 999px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); font-weight: 500; cursor: pointer; transition: background .15s, border-color .15s, transform .1s; white-space: nowrap; text-decoration: none; font-size: 14.5px; }
.btn:hover { background: var(--surface-2); border-color: var(--text-faint); }
.btn:active { transform: scale(.97); }
.btn:focus-visible { outline: none; box-shadow: 0 0 0 3px color-mix(in oklab, var(--accent) 40%, transparent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); box-shadow: 0 6px 16px -10px var(--accent); }
.btn.primary:hover { background: var(--accent-hover); }
.btn.run { background: var(--trigger); border-color: var(--trigger); color: #fff; box-shadow: 0 8px 20px -10px var(--trigger); }
.btn.run:hover { filter: brightness(.95); }
.btn.danger { color: var(--danger); }
.btn.danger.solid { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--sunken); }
.btn.sm { height: 32px; padding: 0 12px; font-size: 13.5px; }
.btn.icon { width: 38px; padding: 0; }
.btn.icon.sm { width: 32px; }
.btn[disabled] { opacity: .5; pointer-events: none; }
.input, .select, .textarea { width: 100%; min-height: 40px; border-radius: 10px; border: 1px solid var(--border-strong); background: var(--surface); padding: 8px 12px; transition: border-color .15s, box-shadow .15s; }
.textarea { resize: vertical; min-height: 84px; line-height: 1.5; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in oklab, var(--accent) 22%, transparent); }
.select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--text-muted) 50%), linear-gradient(135deg, var(--text-muted) 50%, transparent 50%); background-position: 14px 52%, 19px 52%; background-size: 5px 5px; background-repeat: no-repeat; padding-inline-start: 34px; }
.input.sm, .select.sm { min-height: 34px; padding-top: 5px; padding-bottom: 5px; font-size: 14px; }
.field { margin-bottom: 16px; }
.field > label, .label { display: flex; align-items: center; gap: 6px; font-weight: 500; font-size: 14px; margin-bottom: 6px; color: var(--text); }
.hint { font-size: 12.5px; color: var(--text-muted); margin-top: 5px; }
.switch { position: relative; width: 40px; height: 23px; flex: none; }
.switch input { opacity: 0; width: 100%; height: 100%; margin: 0; position: absolute; cursor: pointer; z-index: 1; }
.switch span { position: absolute; inset: 0; background: var(--border-strong); border-radius: 99px; transition: .2s var(--ease); }
.switch span::after { content: ''; position: absolute; top: 3px; inset-inline-start: 3px; width: 17px; height: 17px; border-radius: 50%; background: #fff; box-shadow: var(--shadow-sm); transition: .2s var(--ease); }
.switch input:checked + span { background: var(--success); }
.switch input:checked + span::after { inset-inline-start: 20px; }
.switch input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.chip { display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 9px; border-radius: 99px; font-size: 12.5px; font-weight: 500; background: var(--sunken); color: var(--text-muted); white-space: nowrap; }
.chip.ok { background: var(--success-soft); color: var(--success); }
.chip.err { background: var(--danger-soft); color: var(--danger); }
.chip.warn { background: var(--warning-soft); color: var(--warning); }
.chip.acc { background: var(--accent-soft); color: var(--accent); }
.chip.trig { background: var(--trigger-soft); color: var(--trigger); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-faint); display: inline-block; }
.dot.ok { background: var(--success); } .dot.err { background: var(--danger); } .dot.run { background: var(--trigger); }
.seg { display: inline-flex; background: var(--sunken); border-radius: 99px; padding: 3px; gap: 2px; }
.seg button { border: 0; background: transparent; height: 28px; padding: 0 12px; border-radius: 99px; cursor: pointer; font-size: 13.5px; color: var(--text-muted); }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); }

/* ---------- lists ---------- */
.list { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; }
.list-row { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 16px; padding: 14px 18px; border-bottom: 1px solid var(--border); cursor: pointer; transition: background .12s; }
.list-row:last-child { border-bottom: 0; }
.list-row:hover { background: var(--surface-2); }
.list-row .lead { width: 42px; height: 42px; border-radius: 13px; display: grid; place-items: center; background: var(--sunken); color: var(--text-muted); }
.list-row .lead.on { background: var(--accent-soft); color: var(--accent); }
.list-row .lead .ic { width: 21px; height: 21px; }
.list-row .title { font-weight: 600; font-size: 15.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-row .meta { display: flex; align-items: center; gap: 10px; color: var(--text-muted); font-size: 13px; margin-top: 3px; flex-wrap: wrap; }
.toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 14px; flex-wrap: wrap; }
.search { position: relative; flex: 1; min-width: 200px; max-width: 360px; }
.search .ic { position: absolute; inset-inline-start: 12px; top: 50%; transform: translateY(-50%); color: var(--text-faint); }
.search .input { padding-inline-start: 36px; }
.empty { text-align: center; padding: 64px 24px; color: var(--text-muted); }
.empty .art { width: 64px; height: 64px; border-radius: 20px; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; margin: 0 auto 16px; }
.empty .art .ic { width: 30px; height: 30px; }
.empty h3 { color: var(--text); font: 600 19px var(--font-display); margin: 0 0 6px; }
.empty p { margin: 0 auto 20px; max-width: 440px; }
table.grid { width: 100%; border-collapse: collapse; font-size: 14px; }
table.grid th { text-align: start; font-weight: 500; color: var(--text-muted); font-size: 12.5px; padding: 10px 12px; border-bottom: 1px solid var(--border); background: var(--surface-2); position: sticky; top: 0; z-index: 1; white-space: nowrap; }
table.grid td { padding: 9px 12px; border-bottom: 1px solid var(--border); vertical-align: top; max-width: 320px; overflow: hidden; text-overflow: ellipsis; }
table.grid tr:hover td { background: var(--surface-2); }
table.grid tr.click { cursor: pointer; }

/* ---------- modal / toast / menu ---------- */
.overlay { position: fixed; inset: 0; background: rgb(15 20 18 / .42); display: grid; place-items: center; z-index: 100; padding: 16px; animation: fade .18s var(--ease); }
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(10px) scale(.99); } }
.modal { background: var(--surface); border-radius: 20px; box-shadow: var(--shadow-lg); width: min(560px, 100%); max-height: calc(100vh - 32px); display: flex; flex-direction: column; animation: rise .22s var(--ease); }
.modal.wide { width: min(860px, 100%); }
.modal-head { display: flex; align-items: center; gap: 10px; padding: 18px 22px 8px; }
.modal-head h2 { font: 600 19px var(--font-display); margin: 0; flex: 1; }
.modal-body { padding: 10px 22px 6px; overflow: auto; }
.modal-foot { display: flex; gap: 10px; justify-content: flex-start; padding: 14px 22px 18px; flex-wrap: wrap; }
#toasts { position: fixed; bottom: 104px; inset-inline-start: 50%; transform: translateX(50%); display: flex; flex-direction: column-reverse; gap: 8px; z-index: 300; align-items: center; pointer-events: none; }
[dir="rtl"] #toasts { transform: translateX(50%); }
.toast { background: var(--text); color: var(--bg); padding: 11px 18px; border-radius: 14px; font-weight: 500; box-shadow: var(--shadow-lg); display: flex; gap: 9px; align-items: center; max-width: min(560px, 92vw); pointer-events: auto; animation: rise .2s var(--ease); font-size: 14px; }
.toast.err { background: var(--danger); color: #fff; }
.toast.ok .ic { color: var(--success-soft); }
.menu { position: fixed; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-lg); padding: 5px; min-width: 190px; z-index: 200; animation: rise .14s var(--ease); }
.menu button { display: flex; align-items: center; gap: 9px; width: 100%; border: 0; background: none; padding: 8px 10px; border-radius: 8px; cursor: pointer; text-align: start; font-size: 14px; }
.menu button:hover, .menu button:focus-visible { background: var(--sunken); outline: none; }
.menu button.danger { color: var(--danger); }
.menu hr { border: 0; border-top: 1px solid var(--border); margin: 4px 0; }
.menu .kbd { margin-inline-start: auto; color: var(--text-faint); font-size: 12px; font-family: var(--mono); }

/* ---------- editor ---------- */
.editor { position: absolute; inset: 0; display: flex; flex-direction: column; }
.ed-top { height: 58px; flex: none; display: flex; align-items: center; gap: 10px; padding: 0 14px; background: var(--surface); border-bottom: 1px solid var(--border); z-index: 20; }
.ed-name { font: 600 17px var(--font-display); border: 1px solid transparent; background: transparent; border-radius: 8px; padding: 4px 8px; min-width: 120px; max-width: 420px; }
.ed-name:hover { border-color: var(--border); }
.ed-name:focus { outline: none; border-color: var(--accent); background: var(--surface); }
.ed-state { font-size: 13px; color: var(--text-muted); display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.ed-tabs { display: flex; gap: 2px; background: var(--sunken); padding: 3px; border-radius: 99px; }
.ed-tabs a { padding: 5px 14px; border-radius: 99px; color: var(--text-muted); text-decoration: none; font-size: 13.5px; }
.ed-tabs a.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.ed-body { flex: 1; position: relative; min-height: 0; display: flex; }
.canvas { flex: 1; position: relative; overflow: hidden; background-color: var(--canvas); background-image: radial-gradient(var(--dot) 1.2px, transparent 1.2px); background-size: 22px 22px; touch-action: none; cursor: default; user-select: none; }
.canvas.panning { cursor: grabbing; }
.world { position: absolute; top: 0; left: 0; transform-origin: 0 0; }
.edges { position: absolute; top: 0; left: 0; overflow: visible; pointer-events: none; }
.edges path.e { fill: none; stroke: var(--edge); stroke-width: 2; pointer-events: stroke; cursor: pointer; transition: stroke .12s; }
.edges path.hit { fill: none; stroke: transparent; stroke-width: 14; pointer-events: stroke; cursor: pointer; }
.edges g:hover path.e, .edges g.sel path.e { stroke: var(--edge-active); stroke-width: 2.6; }
.edges path.e.sub { stroke-dasharray: 5 5; }
.edges path.e.ran { stroke: var(--success); stroke-width: 2.4; }
.edges path.e.live { stroke: var(--trigger); stroke-dasharray: 7 7; animation: flow .6s linear infinite; }
@keyframes flow { to { stroke-dashoffset: -14; } }
.edges path.temp { fill: none; stroke: var(--accent); stroke-width: 2.4; stroke-dasharray: 6 5; }
.edges text { font: 600 12px var(--font); fill: var(--text-muted); paint-order: stroke; stroke: var(--canvas); stroke-width: 4px; }
.edges text.ok { fill: var(--success); }
.edge-del { position: absolute; width: 26px; height: 26px; border-radius: 50%; border: 1px solid var(--border-strong); background: var(--surface); display: grid; place-items: center; cursor: pointer; transform: translate(-50%, -50%); box-shadow: var(--shadow); color: var(--danger); z-index: 5; }
.node { position: absolute; width: 196px; height: 66px; background: var(--surface); border: 1.5px solid var(--border); border-radius: 16px; box-shadow: 0 1px 2px rgb(20 30 25 / .06), 0 10px 24px -14px rgb(20 30 25 / .28); display: flex; align-items: center; gap: 11px; padding: 0 12px; cursor: grab; transition: border-color .15s, box-shadow .15s; }
.node:hover { border-color: var(--text-faint); }
.node.sel { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in oklab, var(--accent) 25%, transparent), var(--shadow); }
.node.trigger { border-radius: 16px 34px 34px 16px; }
.node.disabled { opacity: .55; }
.node.disabled .nm { text-decoration: line-through; }
.node.unknown { border-style: dashed; border-color: var(--warning); }
.node.st-success { border-color: var(--success); }
.node.st-error { border-color: var(--danger); background: color-mix(in oklab, var(--danger-soft) 45%, var(--surface)); }
.node.st-running { border-color: var(--trigger); }
.node.trigger::before { content: ''; position: absolute; inset-inline-start: -5px; top: 50%; width: 10px; height: 10px; margin-top: -5px; border-radius: 50%; background: var(--trigger); box-shadow: 0 0 0 4px color-mix(in oklab, var(--trigger) 20%, transparent); }
.node.st-running::after { content: ''; position: absolute; inset: -5px; border-radius: inherit; border: 2px solid var(--trigger); opacity: .6; animation: pulse 1.1s var(--ease) infinite; }
@keyframes pulse { 50% { opacity: .15; } }
.node .tile, .pick .tile, .panel-head .tile, .tpl .tile { background: color-mix(in oklab, var(--c, #8A7A55) 15%, var(--surface)); color: color-mix(in oklab, var(--c, #8A7A55) 78%, var(--text)); box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--c, #8A7A55) 22%, transparent); }
.node .tile { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; flex: none; }
.node .tile .ic { width: 21px; height: 21px; }
.node .txt { min-width: 0; flex: 1; line-height: 1.25; }
.node .nm { font-weight: 600; font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.node .sub { font-size: 12px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.node .badge { position: absolute; top: -9px; inset-inline-start: -9px; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-size: 12px; box-shadow: var(--shadow-sm); }
.node .badge.ok { background: var(--success); }
.node .badge.err { background: var(--danger); }
.node .badge.pin { background: var(--accent); inset-inline-start: auto; inset-inline-end: 20px; }
.node .flag { position: absolute; bottom: -9px; inset-inline-end: 12px; font-size: 11px; background: var(--warning-soft); color: var(--warning); padding: 0 7px; border-radius: 99px; height: 18px; line-height: 18px; }
.port { position: absolute; width: 14px; height: 14px; border-radius: 50%; background: var(--surface); border: 2px solid var(--edge); top: 50%; margin-top: -7px; cursor: crosshair; z-index: 2; transition: transform .12s, border-color .12s; }
.port:hover, .port.hot { transform: scale(1.35); border-color: var(--accent); }
.port.in { right: -8px; }
.port.out { left: -8px; background: var(--edge); }
.port .lbl { position: absolute; left: 18px; top: -4px; font-size: 11.5px; color: var(--text-muted); white-space: nowrap; pointer-events: none; }
.port.out .plus { position: absolute; right: 22px; top: -6px; }
.add-handle { position: absolute; width: 24px; height: 24px; border-radius: 7px; border: 1.5px dashed var(--border-strong); background: var(--surface); display: grid; place-items: center; color: var(--text-muted); cursor: pointer; transform: translate(-100%, -50%); z-index: 2; }
.add-handle:hover { border-color: var(--accent); color: var(--accent); }
.sport { position: absolute; bottom: -8px; width: 13px; height: 13px; margin-left: -6.5px; transform: rotate(45deg); background: var(--surface); border: 2px solid var(--edge); cursor: crosshair; z-index: 2; }
.sport .lbl { position: absolute; top: 14px; left: 50%; transform: rotate(-45deg) translate(-30%, 0); font-size: 11px; color: var(--text-muted); white-space: nowrap; pointer-events: none; }
.node.subnode { width: 74px; height: 74px; border-radius: 50%; flex-direction: column; justify-content: center; padding: 0; gap: 0; }
.node.subnode .txt { position: absolute; top: 80px; width: 140px; text-align: center; left: -33px; }
.node.subnode .nm { font-size: 12.5px; }
.node.subnode .sub { display: none; }
.node.subnode .port.out { left: 50%; top: -8px; margin: 0 0 0 -7px; }
.sticky { position: absolute; background: #FBEFC2; border: 1px solid #EBD889; border-radius: 12px; padding: 12px 14px; color: #3D3418; font-size: 13.5px; overflow: hidden; box-shadow: var(--shadow-sm); cursor: grab; white-space: pre-wrap; line-height: 1.5; }
.sticky.sel { outline: 2px solid var(--accent); }
.sticky h1, .sticky h2, .sticky h3 { margin: 0 0 6px; font: 600 15px var(--font-display); }
.sticky .rs { position: absolute; left: 0; bottom: 0; width: 16px; height: 16px; cursor: nesw-resize; }
:root[data-theme="dark"] .sticky { background: #3B3416; border-color: #5A4F21; color: #F1E6BD; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .sticky { background: #3B3416; border-color: #5A4F21; color: #F1E6BD; } }
.marquee { position: absolute; border: 1.5px dashed var(--accent); background: color-mix(in oklab, var(--accent) 10%, transparent); pointer-events: none; }
.cv-ctrl { position: absolute; bottom: 16px; inset-inline-end: 16px; display: flex; gap: 6px; z-index: 10; }
.cv-ctrl .btn { background: var(--surface); box-shadow: var(--shadow); }
.cv-run { position: absolute; bottom: 16px; left: 50%; transform: translateX(-50%); display: flex; gap: 8px; z-index: 10; }
.cv-run .btn { height: 48px; padding: 0 24px; font-size: 15.5px; }
.cv-run .btn.icon { width: 48px; padding: 0; background: var(--surface); box-shadow: var(--shadow); }
.cv-hint { position: absolute; top: 14px; inset-inline-start: 66px; z-index: 9; display: flex; gap: 6px; flex-wrap: wrap; align-items: center; max-width: calc(100% - 140px); }
.cv-hint span { background: color-mix(in oklab, var(--surface) 88%, transparent); border: 1px solid var(--border); border-radius: 99px; padding: 5px 11px; font-size: 12.5px; color: var(--text-muted); display: inline-flex; gap: 6px; align-items: center; box-shadow: var(--shadow-sm); }
.cv-hint kbd { font: 600 11px var(--mono); background: var(--sunken); border-radius: 5px; padding: 1px 5px; color: var(--text); }
.cv-empty { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; z-index: 3; }
.cv-empty .box { pointer-events: auto; text-align: center; }
.cv-empty button.big { width: 104px; height: 104px; border-radius: 26px; border: 2px dashed var(--border-strong); background: var(--surface); display: grid; place-items: center; margin: 0 auto 12px; cursor: pointer; color: var(--text-muted); transition: .15s; }
.cv-empty button.big:hover { border-color: var(--accent); color: var(--accent); }
.cv-empty button.big .ic { width: 36px; height: 36px; }
.banner { position: absolute; top: 14px; left: 50%; transform: translateX(-50%); background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 10px 14px; box-shadow: var(--shadow-lg); display: flex; align-items: center; gap: 12px; z-index: 15; max-width: calc(100% - 32px); animation: rise .2s var(--ease); }
.banner code { background: var(--sunken); padding: 3px 8px; border-radius: 6px; font-family: var(--mono); font-size: 12.5px; direction: ltr; display: inline-block; max-width: 420px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: middle; }
.logs { position: absolute; bottom: 0; left: 0; right: 0; max-height: 34%; background: var(--surface); border-top: 1px solid var(--border); z-index: 12; display: flex; flex-direction: column; }
.logs .lh { display: flex; align-items: center; gap: 8px; padding: 6px 12px; border-bottom: 1px solid var(--border); font-size: 13px; }
.logs pre { margin: 0; overflow: auto; padding: 8px 12px; font: 12.5px/1.6 var(--mono); direction: ltr; text-align: left; }

/* ---------- node picker ---------- */
.picker { position: absolute; top: 0; bottom: 0; inset-inline-end: 0; width: min(380px, 100%); background: var(--surface); border-inline-start: 1px solid var(--border); box-shadow: var(--shadow-lg); z-index: 30; display: flex; flex-direction: column; animation: slide .22s var(--ease); }
@keyframes slide { from { transform: translateX(-24px); opacity: 0; } }
.picker-head { padding: 16px 16px 10px; border-bottom: 1px solid var(--border); }
.picker-head h3 { margin: 0 0 10px; font: 600 17px var(--font-display); display: flex; align-items: center; }
.picker-list { overflow: auto; padding: 8px 10px 20px; flex: 1; }
.picker-group { font-size: 12.5px; color: var(--text-faint); font-weight: 500; margin: 14px 8px 6px; }
.pick { display: flex; gap: 12px; align-items: center; width: 100%; text-align: start; border: 0; background: transparent; padding: 9px 8px; border-radius: 12px; cursor: pointer; }
.pick:hover, .pick:focus-visible, .pick.hl { background: var(--sunken); outline: none; }
.pick .tile { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; flex: none; }
.pick b { display: block; font-weight: 600; font-size: 14.5px; }
.pick small { display: block; color: var(--text-muted); font-size: 12.5px; line-height: 1.35; }

/* ---------- node panel ---------- */
.panel-wrap { position: fixed; inset: 0; z-index: 90; background: rgb(15 20 18 / .38); display: flex; padding: 22px; animation: fade .15s var(--ease); }
.panel { flex: 1; background: var(--surface); border-radius: 20px; box-shadow: var(--shadow-lg); display: flex; flex-direction: column; min-height: 0; overflow: hidden; animation: rise .2s var(--ease); }
.panel-head { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.panel-head .tile { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; }
.panel-head input { font: 600 17px var(--font-display); border: 1px solid transparent; background: transparent; border-radius: 8px; padding: 3px 8px; flex: 1; min-width: 0; max-width: 420px; }
.panel-head input:focus { outline: none; border-color: var(--accent); }
.panel-cols { flex: 1; display: grid; grid-template-columns: minmax(0, 1fr) minmax(360px, 1.15fr) minmax(0, 1fr); min-height: 0; }
.pcol { min-height: 0; display: flex; flex-direction: column; border-inline-start: 1px solid var(--border); }
.pcol:first-child { border-inline-start: 0; }
.pcol-head { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-bottom: 1px solid var(--border); min-height: 50px; background: var(--surface-2); }
.pcol-head h4 { margin: 0; font-size: 14px; font-weight: 600; color: var(--text); display: flex; align-items: center; gap: 7px; }
.pcol-head h4 .ic { color: var(--text-faint); }
.pcol-head h4 small { font-weight: 400; color: var(--text-muted); font-size: 12.5px; }
.pcol-body { overflow: auto; padding: 14px; flex: 1; min-height: 0; }
.pcol.params .pcol-body { padding: 18px 20px 40px; }
.data-empty { color: var(--text-muted); text-align: center; padding: 40px 16px; font-size: 14px; }
.data-empty .ic { width: 28px; height: 28px; display: block; margin: 0 auto 10px; color: var(--text-faint); }
.json { font: 12.5px/1.6 var(--mono); direction: ltr; text-align: left; white-space: pre-wrap; word-break: break-word; margin: 0; }
.json .k { color: var(--accent); cursor: pointer; }
.json .k:hover { text-decoration: underline; }
.json .s { color: #8A5A16; } .json .n { color: #2F5DA8; } .json .b { color: #8A2F7A; } .json .z { color: var(--text-faint); }
:root[data-theme="dark"] .json .s { color: #E5B86B; } :root[data-theme="dark"] .json .n { color: #8FB4F2; }
.dtable { font-size: 12.5px; border-collapse: collapse; width: 100%; direction: ltr; }
.dtable th { position: sticky; top: -14px; background: var(--surface-2); font-weight: 600; text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--border); white-space: nowrap; cursor: pointer; color: var(--accent); }
.dtable td { padding: 6px 8px; border-bottom: 1px solid var(--border); max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: var(--mono); font-size: 12px; unicode-bidi: plaintext; }
.item-sep { font-size: 11.5px; color: var(--text-faint); margin: 10px 0 4px; direction: rtl; text-align: right; }
.err-box { background: var(--danger-soft); color: var(--danger); border-radius: 12px; padding: 12px 14px; font-size: 14px; white-space: pre-wrap; word-break: break-word; }
.warn-box { background: var(--warning-soft); color: var(--warning); border-radius: 12px; padding: 11px 14px; font-size: 13.5px; margin-bottom: 14px; }
.info-box { background: var(--accent-soft); color: var(--accent); border-radius: 12px; padding: 11px 14px; font-size: 13.5px; margin-bottom: 14px; }
.ptabs { display: flex; gap: 4px; margin-bottom: 18px; border-bottom: 1px solid var(--border); }
.ptabs button { border: 0; background: none; padding: 8px 12px; cursor: pointer; color: var(--text-muted); border-bottom: 2px solid transparent; margin-bottom: -1px; font-weight: 500; }
.ptabs button.on { color: var(--accent); border-color: var(--accent); }
.pf { margin-bottom: 18px; }
.pf-label { display: flex; align-items: center; gap: 6px; font-weight: 500; font-size: 13.5px; margin-bottom: 6px; }
.pf-label .fx { margin-inline-start: auto; }
.fx { border: 1px solid var(--border); background: var(--surface); border-radius: 7px; height: 24px; padding: 0 7px; font: 600 11.5px var(--mono); color: var(--text-muted); cursor: pointer; }
.fx.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.expr { font-family: var(--mono); font-size: 13px; direction: ltr; text-align: left; background: color-mix(in oklab, var(--accent-soft) 40%, var(--surface)); min-height: 40px; }
.preview { font: 12px/1.5 var(--mono); direction: ltr; text-align: left; background: var(--sunken); border-radius: 8px; padding: 6px 9px; margin-top: 5px; color: var(--text-muted); white-space: pre-wrap; word-break: break-all; max-height: 120px; overflow: auto; }
.preview.err { color: var(--danger); }
.code { font: 13px/1.6 var(--mono); direction: ltr; text-align: left; tab-size: 2; min-height: 280px; white-space: pre; background: var(--surface-2); }
.rows { display: flex; flex-direction: column; gap: 8px; }
.rowline { display: grid; gap: 6px; align-items: start; }
.cellx .input, .cellx .textarea { padding-left: 38px; }
.rowline.kv { grid-template-columns: 1fr 1.4fr 32px; }
.rowline.cond { grid-template-columns: 1fr 150px 1fr 32px; }
.rowline.assign { grid-template-columns: 1fr 96px 1.4fr 32px; }
.rowline.tf { grid-template-columns: 1fr 96px 1fr 32px; }
.rule-box { border: 1px solid var(--border); border-radius: 12px; padding: 12px; background: var(--surface-2); }
.sched { border: 1px solid var(--border); border-radius: 12px; padding: 12px; background: var(--surface-2); display: grid; gap: 10px; }
.days { display: flex; gap: 5px; flex-wrap: wrap; }
.days label { display: inline-flex; align-items: center; gap: 4px; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 3px 8px; font-size: 13px; cursor: pointer; }
.cred-row { display: flex; gap: 8px; align-items: center; }
details.adv summary { cursor: pointer; color: var(--text-muted); font-size: 13.5px; padding: 6px 0; }

/* ---------- misc pages ---------- */
.status-line { display: flex; gap: 8px; flex-wrap: wrap; margin: -6px 0 26px; }
.status-line .chip { height: 30px; padding: 0 12px; font-size: 13.5px; background: var(--surface); border: 1px solid var(--border); color: var(--text); }
.status-line .chip b { font-weight: 700; }
.sec-title { font: 600 19px var(--font-display); margin: 40px 0 6px; display: flex; align-items: center; gap: 10px; }
.sec-sub { color: var(--text-muted); margin: 0 0 16px; font-size: 14.5px; }
.tpls { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; }
.tpl { text-align: start; font: inherit; color: inherit; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 16px 16px 14px; cursor: pointer; display: flex; flex-direction: column; gap: 10px; transition: border-color .18s, transform .18s var(--ease), box-shadow .18s; }
.tpl:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: var(--shadow); }
.tpl:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.tpl .flow { display: flex; align-items: center; gap: 4px; }
.tpl .tile { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; }
.tpl .tile .ic { width: 18px; height: 18px; }
.tpl .flow > .ic { color: var(--text-faint); width: 14px; height: 14px; }
.tpl b { font-size: 15.5px; }
.tpl small { color: var(--text-muted); font-size: 13px; line-height: 1.45; }
.tpl .go { margin-top: auto; color: var(--accent); font-size: 13.5px; font-weight: 600; display: flex; align-items: center; gap: 4px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.cred-card { padding: 16px; display: flex; gap: 12px; align-items: flex-start; cursor: pointer; transition: border-color .15s, transform .15s; }
.cred-card:hover { border-color: var(--border-strong); transform: translateY(-1px); }
.cred-card .tile { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); flex: none; }
.login { min-height: 100%; display: grid; place-items: center; padding: 20px; background: radial-gradient(1200px 500px at 70% -10%, var(--accent-soft), transparent), var(--bg); }
.login .card { width: min(400px, 100%); padding: 30px 28px; }
.login h1 { font: 700 26px var(--font-display); margin: 14px 0 4px; }
.report { display: grid; gap: 12px; }
.report .sec { border: 1px solid var(--border); border-radius: 14px; padding: 12px 14px; }
.report .sec h4 { margin: 0 0 8px; font-size: 14px; display: flex; align-items: center; gap: 7px; }
.report ul { margin: 0; padding-inline-start: 18px; font-size: 13.5px; }
.report li { margin: 3px 0; }
.chk { display: flex; align-items: center; gap: 9px; padding: 7px 4px; border-bottom: 1px solid var(--border); font-size: 14px; }
.chk:last-child { border-bottom: 0; }
.kbd-list { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; font-size: 14px; }
.kbd-list kbd { font: 12px var(--mono); background: var(--sunken); border: 1px solid var(--border); border-radius: 6px; padding: 2px 7px; direction: ltr; }

@media (max-width: 1100px) {
  :root { --nav-w: 76px; }
  .nav { padding: 14px 10px; align-items: center; }
  .brand { padding: 2px 0 18px; } .brand .txt, .nav a.item span, .nav button.item span, .nav .mode { display: none; }
  .nav a.item, .nav button.item { width: 48px; justify-content: center; padding: 0; }
  .nav a.item.on::after { inset-inline-end: 4px; top: 6px; width: 6px; height: 6px; }
  .panel-cols { grid-template-columns: 1fr; grid-template-rows: auto; overflow: auto; }
  .pcol { border-inline-start: 0; border-top: 1px solid var(--border); min-height: 280px; }
  .pcol.params { order: -1; }
}
@media (max-width: 720px) {
  .shell { grid-template-columns: 1fr; grid-template-rows: 1fr 64px; }
  .nav { flex-direction: row; justify-content: space-around; padding: 0 6px; order: 2; overflow: visible; }
  .nav .brand, .nav .grow, .nav .foot { display: none; }
  .nav a.item { flex-direction: column; gap: 2px; height: 54px; width: auto; flex: 1; font-size: 11px; }
  .nav a.item span { display: block; }
  .nav a.item.on::after { display: none; }
  .cv-hint { display: none; }
  .list-row { grid-template-columns: 1fr auto; } .list-row .lead { display: none; }
  .page { padding: 22px 16px 60px; }
  .page-head h1 { font-size: 23px; }
  .ed-top { gap: 6px; padding: 0 8px; }
  .ed-name { min-width: 0; max-width: 140px; font-size: 15px; }
  .ed-top .hide-m { display: none; }
  .cv-ctrl .btn:not(:first-child) { display: none; }
  .cv-ctrl { bottom: 76px; }
  .panel-wrap { padding: 0; }
  .panel { border-radius: 0; }
  .rowline.cond, .rowline.assign, .rowline.tf { grid-template-columns: 1fr 1fr 32px; }
  .rowline.cond > :nth-child(3), .rowline.assign > :nth-child(3), .rowline.tf > :nth-child(3) { grid-column: 1 / 3; }
  .list-row { padding: 12px 14px; }
  .cv-run .btn { height: 42px; padding: 0 16px; }
}

@media (max-width: 720px) { #toasts { bottom: 150px; } }

/* ---------- gradients ---------- */
.nav { background: var(--grad-rail); }
.brand .mark { background: var(--grad-signal); color: #fff; box-shadow: 0 8px 22px -8px #FF6B6B; }
.nav a.item.on { background: linear-gradient(90deg, rgb(255 255 255 / .04), rgb(255 255 255 / .14)); box-shadow: inset 0 0 0 1px rgb(255 255 255 / .10); }
.nav a.item.on::after { background: var(--grad-signal); box-shadow: 0 0 10px 1px rgb(255 107 107 / .55); }
.nav a.item.on .ic { color: #FFB547; }
.main { background: var(--grad-page), var(--bg); }
.btn.primary { background: var(--grad-brand); border-color: transparent; color: #fff; box-shadow: 0 8px 22px -10px #4F46E5; background-size: 140% 100%; background-position: 0% 0; transition: background-position .3s var(--ease), box-shadow .2s, transform .15s; }
.btn.primary:hover { background: var(--grad-brand); background-size: 140% 100%; background-position: 100% 0; box-shadow: 0 10px 26px -10px #7C3AED; }
.btn.run { background: var(--grad-signal); border-color: transparent; color: #fff; box-shadow: 0 10px 26px -10px #FF6B6B; background-size: 140% 100%; transition: background-position .3s var(--ease), box-shadow .2s; }
.btn.run:hover { filter: none; background-position: 100% 0; box-shadow: 0 12px 30px -10px #F43F8E; }
.switch input:checked + span { background: var(--grad-brand); }
.list-row .lead.on { background: var(--grad-brand); color: #fff; box-shadow: 0 6px 16px -8px #4F46E5; }
.node.trigger::before { background: var(--grad-signal); }
.status-line .chip .dot.ok { background: linear-gradient(135deg, #34D399, #0EA5A4); }
.tpl { position: relative; isolation: isolate; }
.tpl::before { content: ''; position: absolute; inset: -1px; border-radius: inherit; padding: 1.5px; background: var(--grad-brand); -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask-composite: exclude; opacity: 0; transition: opacity .2s; pointer-events: none; }
.tpl:hover { border-color: transparent; box-shadow: 0 14px 34px -18px #4F46E5; }
.tpl:hover::before, .tpl:focus-visible::before { opacity: 1; }
.tpl .go { color: var(--accent); }
.login { background: radial-gradient(700px 480px at 85% 0%, rgb(14 165 164 / .30), transparent 65%), radial-gradient(700px 520px at 10% 100%, rgb(168 85 247 / .32), transparent 65%), radial-gradient(500px 400px at 60% 60%, rgb(255 107 107 / .14), transparent 70%), var(--bg); }
.login .brand { width: 52px; height: 52px; border-radius: 16px; background: var(--grad-signal); color: #fff; display: grid; place-items: center; box-shadow: 0 10px 26px -10px #FF6B6B; }
.login .brand svg { width: 28px; height: 28px; }
.page-head h1::after { content: ''; display: block; width: 46px; height: 4px; border-radius: 4px; margin-top: 10px; background: var(--grad-signal); }
.edges path.e.live { stroke: #FF6B6B; }
.node.sel { border-color: #7C6CF2; }
@media (max-width: 720px) { .nav { background: linear-gradient(90deg, #0D1030, #1E1246); } }
