:root {
  color-scheme: light;
  --bg: #f7f5f3;
  --panel: #ffffff;
  --panel-2: #f7f7f9;
  --hover: #f1f1f3;
  --active: #ececef;
  --line: #e2e2e5;
  --line-soft: #f0f0f2;
  --text: #2d2e33;
  --muted: #7d7f87;
  --label: #55575e;
  --node-border: #c3c4c9;
  --edge: #b5b7bd;
  --dot: #d9d3cd;
  --port: #a9abb1;
  --input-bg: #ffffff;
  --ok: #29a568;
  --err: #e4483d;
  --warn: #f0a020;
  --run: #e8322c;
  --accent: #171313;
  --accent-ink: #ffffff;
  --expr: #1f9b72;
  --expr-bg: #f3fbf7;
  --expr-line: #bfe6d3;
  --expr-ink: #19583f;
  --j-k: #b5466b; --j-s: #1f7a55; --j-n: #2c5ad6; --j-b: #a3630a;
  --chip-ok: #eef7f1; --chip-err: #fdeceb; --chip-off: #f0f0f2;
  --new-row: #fff4f2;
  --desc-bg: #f4f1ee; --desc-line: #e6dfd8;
  --st-yellow: #fff5d6; --st-yellow-ink: #3a3420;
  --st-blue: #e3effd; --st-blue-ink: #1f3352;
  --st-gray: #ededef; --st-gray-ink: #44454b;
  --st-green: #e2f6ea; --st-green-ink: #1d4630;
  --ic-ink: #3f4046; --ic-wait: #8f1d45; --ic-http: #4459d1;
  --about-bg: #f4f1ee; --about-ink: #171313; --about-soft: #6b6260;
  --step-bg: #ffffff; --step-line: #e4ded8; --step-ink: #5a5250;
  --real-bg: #171313; --real-ink: #f4f1ee;
  --btn-alt: #171313; --btn-alt-ink: #ffffff;
  --shadow: rgba(0, 0, 0, .08);
  --backdrop: rgba(20, 20, 26, .45);
  --pf-red: #e8322c;
  --mono: 'JetBrains Mono', ui-monospace, Consolas, monospace;
  --sans: 'Instrument Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  --display: 'Bricolage Grotesque', 'Arial Narrow', sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #141212; --panel: #1d1b1b; --panel-2: #191717; --hover: #262323; --active: #2d2929;
    --line: #332e2e; --line-soft: #282424; --text: #ece8e4; --muted: #9b938e; --label: #c4bdb8;
    --node-border: #4b4545; --edge: #5c5554; --dot: #2f2a2a; --port: #6c6564; --input-bg: #161414;
    --ok: #3cc07f; --err: #ff6b5f; --warn: #f5b041; --run: #ff5a4f;
    --accent: #f4f1ee; --accent-ink: #171313; --expr: #4fd39b; --expr-bg: #10251c; --expr-line: #1f4a37; --expr-ink: #8fe0bb;
    --j-k: #ff8fb0; --j-s: #7fd9ad; --j-n: #8fb4ff; --j-b: #f0b35a;
    --chip-ok: #143222; --chip-err: #3a1816; --chip-off: #2a2626; --new-row: #2c1a18;
    --desc-bg: #241f1d; --desc-line: #3a322e;
    --st-yellow: #39321e; --st-yellow-ink: #f1e3b5; --st-blue: #1c2838; --st-blue-ink: #c9dbf5;
    --st-gray: #262323; --st-gray-ink: #d2ccc8; --st-green: #17301f; --st-green-ink: #bfe6cb;
    --ic-ink: #e2ddd8; --ic-wait: #e2557f; --ic-http: #7d8cff;
    --about-bg: #171313; --about-ink: #f4f1ee; --about-soft: #b3a9a5;
    --step-bg: #211c1c; --step-line: #3a3232; --step-ink: #bdb3ae;
    --real-bg: #f4f1ee; --real-ink: #171313; --btn-alt: #f4f1ee; --btn-alt-ink: #171313;
    --shadow: rgba(0, 0, 0, .35); --backdrop: rgba(0, 0, 0, .6);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #141212; --panel: #1d1b1b; --panel-2: #191717; --hover: #262323; --active: #2d2929;
  --line: #332e2e; --line-soft: #282424; --text: #ece8e4; --muted: #9b938e; --label: #c4bdb8;
  --node-border: #4b4545; --edge: #5c5554; --dot: #2f2a2a; --port: #6c6564; --input-bg: #161414;
  --ok: #3cc07f; --err: #ff6b5f; --warn: #f5b041; --run: #ff5a4f;
  --accent: #f4f1ee; --accent-ink: #171313; --expr: #4fd39b; --expr-bg: #10251c; --expr-line: #1f4a37; --expr-ink: #8fe0bb;
  --j-k: #ff8fb0; --j-s: #7fd9ad; --j-n: #8fb4ff; --j-b: #f0b35a;
  --chip-ok: #143222; --chip-err: #3a1816; --chip-off: #2a2626; --new-row: #2c1a18;
  --desc-bg: #241f1d; --desc-line: #3a322e;
  --st-yellow: #39321e; --st-yellow-ink: #f1e3b5; --st-blue: #1c2838; --st-blue-ink: #c9dbf5;
  --st-gray: #262323; --st-gray-ink: #d2ccc8; --st-green: #17301f; --st-green-ink: #bfe6cb;
  --ic-ink: #e2ddd8; --ic-wait: #e2557f; --ic-http: #7d8cff;
  --about-bg: #171313; --about-ink: #f4f1ee; --about-soft: #b3a9a5;
  --step-bg: #211c1c; --step-line: #3a3232; --step-ink: #bdb3ae;
  --real-bg: #f4f1ee; --real-ink: #171313; --btn-alt: #f4f1ee; --btn-alt-ink: #171313;
  --shadow: rgba(0, 0, 0, .35); --backdrop: rgba(0, 0, 0, .6);
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { background: var(--bg); color: var(--text); font: 14px/1.45 var(--sans); overflow: hidden; }
button, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
.muted { color: var(--muted); }
.pad { padding: 14px 16px; margin: 0; }
[hidden] { display: none !important; }

.app { display: flex; height: 100dvh; }

.sidebar { width: 230px; flex: none; background: var(--panel); border-right: 1px solid var(--line); display: flex; flex-direction: column; padding: 12px 8px; gap: 2px; z-index: 30; }
.brand { display: flex; align-items: center; gap: 8px; padding: 4px 8px 14px; font-weight: 700; }
.brand .jf { font: 800 20px var(--display); color: var(--text); }
.brand .jf i { color: var(--pf-red); font-style: normal; }
.brand em { font-style: normal; font-size: 11px; background: var(--accent); color: var(--accent-ink); padding: 1px 6px; border-radius: 4px; margin-left: 2px; }
.side-label { font-size: 12px; color: var(--muted); padding: 14px 10px 4px; }
.side-item { display: flex; align-items: center; gap: 8px; width: 100%; text-align: left; border: 0; background: none; padding: 7px 10px; border-radius: 6px; font-size: 13.5px; text-decoration: none; }
.side-item:hover { background: var(--hover); }
.side-item.active { background: var(--active); font-weight: 600; }
.side-item .ico { width: 16px; text-align: center; color: var(--muted); }
.side-foot { margin-top: auto; }
.side-foot p { font-size: 12px; color: var(--muted); padding: 10px; margin: 0 0 6px; border: 1px dashed var(--line); border-radius: 8px; }
.side-foot .credit { border-style: solid; border-left: 3px solid var(--pf-red); }

.main { flex: 1; display: flex; flex-direction: column; min-width: 0; position: relative; }
.topbar { height: 50px; flex: none; display: flex; align-items: center; gap: 12px; padding: 0 16px; background: var(--panel); border-bottom: 1px solid var(--line); position: relative; }
.crumbs { display: flex; gap: 8px; align-items: center; white-space: nowrap; overflow: hidden; min-width: 0; }
.tabs { position: absolute; left: 50%; top: 100%; transform: translate(-50%, 8px); display: flex; background: var(--line-soft); border: 1px solid var(--line); border-radius: 7px; padding: 3px; z-index: 12; }
.tab { border: 0; background: none; padding: 4px 12px; border-radius: 5px; font-size: 13px; color: var(--muted); display: flex; gap: 6px; align-items: center; }
.tab.active { background: var(--panel); color: var(--text); box-shadow: 0 1px 2px var(--shadow); }
.tab .count { background: var(--run); color: #fff; font-size: 11px; border-radius: 9px; padding: 0 6px; }
.prefs { margin-left: auto; display: flex; align-items: center; gap: 8px; flex: none; }
.pf-btn { display: inline-flex; align-items: center; gap: 4px; height: 30px; padding: 0 12px; border-radius: 16px; background: var(--pf-red); color: #fff; font-size: 12.5px; font-weight: 700; text-decoration: none; white-space: nowrap; }
.pf-btn:hover { filter: brightness(1.08); }
.lang-switch { display: flex; border: 1px solid var(--line); border-radius: 7px; overflow: hidden; }
.lang-btn { border: 0; background: var(--panel); padding: 5px 9px; font-size: 12px; font-weight: 700; color: var(--muted); letter-spacing: .04em; }
.lang-btn[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }
.top-right { display: flex; gap: 8px; }
.pill { background: var(--panel); cursor: pointer; display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: 6px; padding: 4px 10px; font-size: 13px; color: var(--muted); }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); display: inline-block; animation: pulse 2s infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 4px rgba(41, 165, 104, .2); } }
.live-dot { color: var(--ok); }
.icon-btn { width: 32px; height: 32px; display: grid; place-items: center; border: 1px solid var(--line); background: var(--panel); border-radius: 6px; font-size: 16px; }
.icon-btn:hover { background: var(--hover); }
.menu-btn { display: none; }

.canvas { flex: 1; position: relative; overflow: hidden; background-color: var(--bg); background-image: radial-gradient(var(--dot) 1.2px, transparent 1.2px); background-size: 20px 20px; touch-action: none; cursor: grab; user-select: none; }
.canvas.dragging { cursor: grabbing; }
.world { position: absolute; left: 0; top: 0; transform-origin: 0 0; }
.edges { position: absolute; left: 0; top: 0; overflow: visible; pointer-events: none; }
.edge { fill: none; stroke: var(--edge); stroke-width: 2; stroke-linejoin: round; transition: stroke .3s; }
.edge.running { stroke: var(--run); stroke-dasharray: 6 6; stroke-linecap: round; animation: flow .5s linear infinite; }
.edge.done { stroke: var(--ok); }
@keyframes flow { to { stroke-dashoffset: -12; } }
.edge-label { font: 600 12px var(--sans); fill: var(--ok); paint-order: stroke; stroke: var(--bg); stroke-width: 5px; }
.port-label { font: 11px var(--sans); fill: var(--muted); }
.port-in { fill: var(--port); }
.port-out { fill: var(--panel); stroke: var(--port); stroke-width: 2; }
.stub { stroke: var(--edge); stroke-width: 2; }
.stub-plus { fill: var(--panel); stroke: var(--edge); }
.stub-text { font-size: 13px; fill: var(--muted); }

.node { position: absolute; width: 100px; cursor: pointer; }
.node .box { width: 100px; height: 100px; background: var(--panel); border: 2px solid var(--node-border); border-radius: 8px; display: grid; place-items: center; position: relative; transition: border-color .25s, box-shadow .25s, transform .15s; }
.node:hover .box { box-shadow: 0 4px 14px var(--shadow); transform: translateY(-1px); }
.node.trigger .box { border-radius: 50px 8px 8px 50px; }
.node .icon { width: 48px; height: 48px; display: grid; place-items: center; }
.node .icon svg { width: 100%; height: 100%; }
.node .bolt { position: absolute; left: -24px; top: 40px; color: var(--text); font-size: 16px; }
.node .label { position: absolute; top: 106px; left: 50%; transform: translateX(-50%); width: 170px; text-align: center; font-weight: 600; font-size: 13px; line-height: 1.2; }
.node .sub { display: block; font-weight: 400; font-size: 11px; color: var(--muted); margin-top: 2px; }
.node .live { display: block; font-weight: 600; font-size: 11px; color: var(--run); margin-top: 3px; }
.node .badge { position: absolute; right: 5px; bottom: 4px; font-size: 13px; display: none; }
.node.running .box { border-color: var(--run); animation: pulse-run 1.1s ease-in-out infinite; }
.node.running .box::before { content: ''; position: absolute; top: 7px; right: 7px; width: 14px; height: 14px; border-radius: 50%; border: 2.5px solid rgba(232, 50, 44, .2); border-top-color: var(--run); animation: spin .8s linear infinite; }
@keyframes pulse-run { 0%, 100% { box-shadow: 0 0 0 0 rgba(232, 50, 44, .28); } 50% { box-shadow: 0 0 0 7px rgba(232, 50, 44, 0); } }
.node.success .box { border-color: var(--ok); }
.node.success .badge { display: block; color: var(--ok); }
.node.warn .box { border-color: var(--warn); }
.node.warn .badge { color: var(--warn); }
.node.error .box { border-color: var(--err); }
.node.error .badge { display: block; color: var(--err); }
@keyframes spin { to { transform: rotate(360deg); } }

.sticky { position: absolute; border-radius: 8px; padding: 12px 14px; font-size: 13px; line-height: 1.45; border: 1px solid var(--line-soft); overflow: hidden; }
.sticky h2 { font: 700 16px var(--sans); margin: 0 0 6px; }
.sticky p { margin: 0 0 6px; }
.sticky code { font: 12px var(--mono); background: rgba(127, 127, 127, .16); padding: 0 4px; border-radius: 3px; }
.sticky.yellow { background: var(--st-yellow); color: var(--st-yellow-ink); }
.sticky.blue { background: var(--st-blue); color: var(--st-blue-ink); }
.sticky.gray { background: var(--st-gray); color: var(--st-gray-ink); }
.sticky.green { background: var(--st-green); color: var(--st-green-ink); }

.zoom-ctl { position: absolute; left: 16px; bottom: 16px; display: flex; gap: 6px; z-index: 5; }
.run-ctl { position: absolute; left: 50%; bottom: 16px; transform: translateX(-50%); display: flex; gap: 8px; align-items: center; z-index: 5; }
.scenario { display: flex; align-items: center; gap: 6px; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 0 6px 0 10px; height: 38px; font-size: 12px; color: var(--muted); }
.scenario select { border: 0; background: var(--panel); font-size: 13px; color: var(--text); padding: 6px 2px; cursor: pointer; }
.exec-btn { height: 38px; border: 0; border-radius: 8px; background: var(--accent); color: var(--accent-ink); font-weight: 600; padding: 0 18px; display: flex; gap: 8px; align-items: center; box-shadow: 0 4px 14px var(--shadow); white-space: nowrap; }
.exec-btn:hover { filter: brightness(1.06); }
.exec-btn:disabled { opacity: .75; cursor: progress; }
.ghost-btn { height: 38px; border: 1px solid var(--line); background: var(--panel); border-radius: 8px; padding: 0 14px; font-weight: 600; white-space: nowrap; }
.ghost-btn:hover { background: var(--hover); }

.exec-view { position: absolute; inset: 0; background: var(--bg); z-index: 8; overflow: auto; padding: 60px 16px 80px; }
.exec-list { max-width: 760px; margin: 0 auto; display: flex; flex-direction: column; gap: 8px; }
.exec-row { display: grid; grid-template-columns: auto 1fr auto auto; gap: 14px; align-items: center; background: var(--panel); border: 1px solid var(--line); border-left: 4px solid var(--ok); border-radius: 8px; padding: 12px 14px; text-align: left; }
.exec-row.warn { border-left-color: var(--warn); }
.exec-row:hover { box-shadow: 0 3px 12px var(--shadow); }
.empty { text-align: center; color: var(--muted); padding: 60px 0; }

.logs { flex: none; background: var(--panel); border-top: 1px solid var(--line); display: flex; flex-direction: column; max-height: 42vh; }
.logs-bar { display: flex; align-items: center; gap: 12px; border: 0; background: none; padding: 7px 16px; text-align: left; font-size: 13px; }
.logs-bar .chev { margin-left: auto; transition: transform .2s; }
.logs.open .chev { transform: rotate(180deg); }
.logs-body { display: none; overflow: auto; border-top: 1px solid var(--line); }
.logs.open .logs-body { display: block; }
.log-row { display: grid; grid-template-columns: 22px 28px 1fr auto auto; gap: 10px; align-items: center; padding: 6px 16px; border: 0; border-bottom: 1px solid var(--line-soft); width: 100%; background: none; text-align: left; font-size: 13px; }
.log-row:hover { background: var(--panel-2); }
.log-row .mini { width: 22px; height: 22px; }
.log-row .mini svg { width: 100%; height: 100%; }
.log-row .ms { font: 12px var(--mono); color: var(--muted); }

.modal { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 16px; }
.modal-backdrop { position: absolute; inset: 0; background: var(--backdrop); backdrop-filter: blur(2px); }
.modal-card { position: relative; background: var(--panel); border-radius: 12px; width: min(1180px, 100%); max-height: calc(100dvh - 32px); display: flex; flex-direction: column; overflow: hidden; box-shadow: 0 20px 60px rgba(0, 0, 0, .3); animation: pop .2s ease-out; }
@keyframes pop { from { transform: translateY(10px) scale(.98); opacity: 0; } }
.modal-head { display: flex; align-items: center; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.modal-head h3 { margin: 0; font-size: 16px; }
.modal-head .x { margin-left: auto; }
.modal-head .head-ico { width: 30px; height: 30px; }
.modal-head .head-ico svg { width: 100%; height: 100%; }
.modal-body { overflow: auto; flex: 1; min-height: 0; }

.ndv { display: grid; grid-template-columns: 1fr 1.25fr 1fr; min-height: 0; height: min(72dvh, 680px); }
.ndv > div { overflow: auto; min-width: 0; }
.ndv .col-io { background: var(--panel-2); padding: 14px; }
.ndv .col-main { border-left: 1px solid var(--line); border-right: 1px solid var(--line); padding: 0 0 18px; }
.col-title { font-size: 11px; letter-spacing: .08em; font-weight: 700; color: var(--muted); margin: 0 0 10px; display: flex; justify-content: space-between; gap: 8px; }
.subtabs { display: flex; gap: 18px; border-bottom: 1px solid var(--line); padding: 0 18px; position: sticky; top: 0; background: var(--panel); z-index: 1; }
.subtab { border: 0; background: none; padding: 11px 0 9px; border-bottom: 2px solid transparent; color: var(--muted); font-weight: 600; }
.subtab.active { color: var(--run); border-bottom-color: var(--run); }
.desc { margin: 14px 18px 4px; padding: 10px 12px; border-radius: 8px; background: var(--desc-bg); border: 1px solid var(--desc-line); font-size: 13px; }
.param { padding: 8px 18px; }
.param label { display: block; font-size: 12px; font-weight: 600; color: var(--label); margin-bottom: 4px; }
.pval { border: 1px solid var(--line); border-radius: 6px; padding: 6px 10px; font-size: 13px; background: var(--input-bg); word-break: break-word; white-space: pre-wrap; }
.pval.expr { font-family: var(--mono); font-size: 12px; background: var(--expr-bg); border-color: var(--expr-line); color: var(--expr-ink); }
.pval.expr::before { content: 'ƒx'; font-style: italic; font-weight: 700; color: var(--expr); margin-right: 8px; }
.pval.bool { display: inline-flex; border: 0; padding: 0; background: none; }
.switch { width: 34px; height: 18px; border-radius: 9px; background: var(--node-border); position: relative; }
.switch::after { content: ''; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: #fff; transition: left .2s; }
.switch.on { background: var(--run); }
.switch.on::after { left: 18px; }
.code { margin: 8px 18px; background: #1f2128; color: #e6e6e6; border-radius: 8px; padding: 12px 14px; font: 12px/1.55 var(--mono); overflow: auto; white-space: pre; max-height: 460px; border: 1px solid var(--line); }
.code .c { color: #7f8696; font-style: italic; }
.code .s { color: #a5d6a7; }
.code .k { color: #ff9e7a; }
.code .n { color: #f5c06b; }
.json { background: var(--input-bg); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; font: 12px/1.5 var(--mono); white-space: pre-wrap; word-break: break-all; margin: 0 0 8px; }
.json .k { color: var(--j-k); }
.json .s { color: var(--j-s); }
.json .n { color: var(--j-n); }
.json .b { color: var(--j-b); }
.io-empty { text-align: center; color: var(--muted); padding: 40px 10px; font-size: 13px; }
.io-empty button { margin-top: 10px; }
.more { font-size: 12px; color: var(--muted); text-align: center; padding: 4px 0 10px; }
.out-tabs { display: flex; gap: 6px; margin-bottom: 8px; }
.out-tab { border: 1px solid var(--line); background: var(--input-bg); border-radius: 6px; padding: 2px 10px; font-size: 12px; }
.out-tab.active { border-color: var(--run); color: var(--run); }
.status-line { display: flex; gap: 8px; align-items: center; font-size: 12px; margin-bottom: 10px; color: var(--ok); font-weight: 600; }
.status-line.err { color: var(--err); }

.res-hero { padding: 22px 22px 8px; display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.res-hero .big { font: 800 30px/1 var(--display); letter-spacing: -.01em; text-transform: uppercase; }
.res-hero .big.ok { color: var(--ok); }
.res-hero .big.warn { color: var(--warn); }
.res-hero .meta { color: var(--muted); font-size: 13px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; padding: 12px 22px; }
.stat { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; }
.stat b { display: block; font: 800 28px/1.1 var(--display); }
.stat span { font-size: 12px; color: var(--muted); }
.res-tabs { display: flex; gap: 4px; padding: 0 22px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.res-tab { border: 0; background: none; padding: 10px 12px; border-bottom: 2px solid transparent; font-weight: 600; color: var(--muted); white-space: nowrap; }
.res-tab.active { color: var(--text); border-bottom-color: var(--pf-red); }
.res-pane { padding: 16px 22px 24px; }
.story { padding-left: 20px; margin: 0 0 16px; display: grid; gap: 6px; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 600; padding: 8px 10px; border-bottom: 1px solid var(--line); background: var(--panel-2); position: sticky; top: 0; }
.tbl td { padding: 7px 10px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
.tbl .mono { font: 12px var(--mono); }
.tbl .new-row { background: var(--new-row); }
.tbl .plus { color: var(--pf-red); }
.tbl-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 8px; max-height: 60dvh; }
.tbl-data td, .tbl-data th { white-space: nowrap; }
.tbl-data .mono { font-size: 11.5px; }
.tbl-wrap::-webkit-scrollbar, .modal-body::-webkit-scrollbar, .ndv > div::-webkit-scrollbar, .logs-body::-webkit-scrollbar, .exec-view::-webkit-scrollbar, .about::-webkit-scrollbar { width: 10px; height: 10px; }
.tbl-wrap::-webkit-scrollbar-thumb, .modal-body::-webkit-scrollbar-thumb, .ndv > div::-webkit-scrollbar-thumb, .logs-body::-webkit-scrollbar-thumb, .exec-view::-webkit-scrollbar-thumb, .about::-webkit-scrollbar-thumb { background: var(--node-border); border-radius: 6px; border: 3px solid transparent; background-clip: padding-box; }
.tbl-wrap::-webkit-scrollbar-thumb:hover, .modal-body::-webkit-scrollbar-thumb:hover, .ndv > div::-webkit-scrollbar-thumb:hover { background-color: var(--muted); }
.tbl-wrap::-webkit-scrollbar-track, .modal-body::-webkit-scrollbar-track, .ndv > div::-webkit-scrollbar-track, .logs-body::-webkit-scrollbar-track, .exec-view::-webkit-scrollbar-track, .about::-webkit-scrollbar-track { background: transparent; }
.tbl-wrap::-webkit-scrollbar-corner { background: transparent; }
.chip { display: inline-block; font-size: 11.5px; font-weight: 600; padding: 2px 8px; border-radius: 10px; background: var(--chip-ok); color: var(--ok); white-space: nowrap; }
.chip.err { background: var(--chip-err); color: var(--err); }
.chip.off { background: var(--chip-off); color: var(--muted); }
.timeline { display: flex; flex-direction: column; gap: 4px; }
.tl-row { display: grid; grid-template-columns: 170px 1fr 70px; gap: 10px; align-items: center; font-size: 12.5px; }
.tl-bar { height: 10px; border-radius: 5px; background: var(--line-soft); position: relative; }
.tl-bar i { position: absolute; top: 0; bottom: 0; border-radius: 5px; background: var(--ok); min-width: 3px; }
.tl-bar i.err { background: var(--err); }
.prod-thumb { width: 38px; height: 38px; border-radius: 6px; display: block; }

.dc { display: grid; grid-template-columns: 220px 1fr; background: #313338; color: #dbdee1; border-radius: 10px; overflow: hidden; min-height: 420px; font-family: 'gg sans', var(--sans); border: 1px solid var(--line); }
.dc-side { background: #2b2d31; padding: 12px 8px; display: flex; flex-direction: column; gap: 2px; }
.dc-server { font-weight: 700; color: #f2f3f5; padding: 4px 8px 12px; border-bottom: 1px solid #1f2023; margin-bottom: 8px; font-size: 14px; }
.dc-cat { font-size: 11px; text-transform: uppercase; font-weight: 700; color: #949ba4; padding: 10px 8px 4px; letter-spacing: .02em; }
.dc-ch { border: 0; background: none; color: #949ba4; text-align: left; padding: 6px 8px; border-radius: 4px; display: flex; justify-content: space-between; gap: 6px; font-size: 14px; }
.dc-ch:hover { background: #35373c; color: #dbdee1; }
.dc-ch.active { background: #404249; color: #fff; }
.dc-ch .n { background: #f23f43; color: #fff; font-size: 11px; font-weight: 700; border-radius: 8px; padding: 0 6px; }
.dc-main { display: flex; flex-direction: column; min-width: 0; }
.dc-top { padding: 12px 16px; border-bottom: 1px solid #26282c; font-weight: 700; color: #f2f3f5; }
.dc-msgs { padding: 12px 16px 18px; overflow: auto; max-height: 56dvh; display: flex; flex-direction: column; gap: 16px; }
.dc-msgs::-webkit-scrollbar { width: 12px; }
.dc-msgs::-webkit-scrollbar-track { background: #2b2d31; border-radius: 6px; border: 3px solid #313338; }
.dc-msgs::-webkit-scrollbar-thumb { background: #1a1b1e; border-radius: 6px; border: 3px solid #313338; min-height: 40px; }
.dc-msgs::-webkit-scrollbar-thumb:hover { background: #111214; }
.dc-msg { display: grid; grid-template-columns: 40px 1fr; gap: 12px; }
.dc-av { width: 40px; height: 40px; border-radius: 50%; background: #171313; display: grid; place-items: center; font-size: 20px; }
.dc-name { color: #f2f3f5; font-weight: 600; font-size: 15px; }
.dc-bot { background: #5865f2; color: #fff; font-size: 10px; font-weight: 700; border-radius: 3px; padding: 1px 4px; margin: 0 6px; vertical-align: 2px; }
.dc-time { color: #949ba4; font-size: 12px; }
.dc-mention { background: rgba(88, 101, 242, .3); color: #c9cdfb; border-radius: 3px; padding: 0 2px; }
.dc-embed { margin-top: 6px; background: #2b2d31; border-left: 4px solid #fc0000; border-radius: 4px; padding: 10px 14px 12px; max-width: 460px; font-size: 14px; }
.dc-embed .t { font-weight: 700; color: #00a8fc; margin-bottom: 6px; }
.dc-embed .t.plain { color: #f2f3f5; }
.dc-embed .d { white-space: pre-wrap; line-height: 1.4; }
.dc-embed .d a { color: #00a8fc; text-decoration: none; }
.dc-embed img { margin-top: 10px; width: 100%; max-width: 220px; border-radius: 4px; display: block; }
.dc-embed .f { margin-top: 8px; font-size: 12px; color: #b5bac1; }
.dc-edited { font-size: 10px; color: #949ba4; margin-left: 4px; }
.dc-empty { color: #949ba4; text-align: center; padding: 50px 0; }

.about { background: var(--about-bg); color: var(--about-ink); padding: 32px clamp(16px, 4vw, 44px) 32px; position: relative; overflow: auto; }
.about .x { position: absolute; right: 16px; top: 16px; }
.about .kicker { font: 500 12px var(--mono); letter-spacing: .08em; text-transform: uppercase; }
.about .kicker b { color: var(--pf-red); }
.about h1 { font: 800 clamp(38px, 7vw, 76px)/.92 var(--display); text-transform: uppercase; letter-spacing: -.02em; margin: 10px 0 14px; }
.about h1 span { color: var(--pf-red); }
.about .lead { font-size: 16px; max-width: 640px; margin: 0 0 22px; }
.steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 10px; margin-bottom: 22px; }
.step { background: var(--step-bg); border: 1px solid var(--step-line); border-radius: 12px; padding: 14px; }
.step b { font: 800 22px var(--display); color: var(--pf-red); display: block; }
.step h4 { margin: 4px 0 4px; font-size: 14px; }
.step p { margin: 0; font-size: 13px; color: var(--step-ink); }
.stack { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 22px; }
.stack span { border: 1px solid var(--about-ink); border-radius: 20px; padding: 3px 12px; font-size: 12.5px; font-weight: 600; }
.real { background: var(--real-bg); color: var(--real-ink); border-radius: 14px; padding: 16px 18px; margin: 0 0 22px; }
.real-head { font-weight: 700; font-size: 14px; margin-bottom: 12px; }
.real-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; margin-bottom: 10px; }
.real-grid b { display: block; font: 800 28px/1 var(--display); }
.real-grid span { font-size: 12px; opacity: .7; }
.real p { margin: 0; font-size: 13px; opacity: .85; }
.about .note { font-size: 12.5px; color: var(--about-soft); border-left: 3px solid var(--pf-red); padding-left: 10px; margin: 0 0 22px; }
.credits { border: 1px solid var(--step-line); background: var(--step-bg); border-radius: 14px; padding: 14px 16px; margin: 0 0 22px; }
.credits h4 { margin: 0 0 10px; font: 800 18px var(--display); text-transform: uppercase; }
.credits-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.credits p { margin: 6px 0 0; font-size: 13px; color: var(--step-ink); }
.credits .tag { display: inline-block; font: 600 11px var(--mono); text-transform: uppercase; letter-spacing: .05em; padding: 3px 8px; border-radius: 6px; }
.credits .tag.mine { background: var(--pf-red); color: #fff; }
.credits .tag.ai { border: 1px solid var(--about-ink); color: var(--about-ink); }
.about-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.legal-line { font-size: 12.5px; color: var(--about-soft); margin: -10px 0 18px; }
.link-btn { border: 0; background: none; padding: 0; color: var(--pf-red); font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }
.legal { position: relative; overflow: auto; padding: 28px clamp(16px, 4vw, 40px) 32px; }
.legal .x { position: absolute; right: 16px; top: 16px; }
.legal h2 { font: 800 30px/1 var(--display); text-transform: uppercase; margin: 0 40px 6px 0; }
.legal h4 { font-size: 14px; margin: 18px 0 4px; }
.legal p { margin: 0; font-size: 13.5px; line-height: 1.55; }
.legal p.muted { font-size: 12px; }
.legal a { color: var(--pf-red); }
.legal code { font: 12px var(--mono); background: var(--line-soft); padding: 0 4px; border-radius: 3px; }
.btn-pf { border: 0; border-radius: 24px; padding: 11px 22px; font-weight: 700; background: var(--pf-red); color: #fff; }
.btn-pf.alt { background: var(--btn-alt); color: var(--btn-alt-ink); }
.btn-pf:hover { filter: brightness(1.08); }

.toast { position: fixed; left: 50%; top: 66px; transform: translateX(-50%); background: var(--accent); color: var(--accent-ink); padding: 9px 16px; border-radius: 8px; z-index: 60; font-size: 13px; box-shadow: 0 6px 20px var(--shadow); max-width: calc(100vw - 32px); }

@media (max-width: 900px) {
  .ndv { grid-template-columns: 1fr; height: auto; }
  .ndv .col-main { border: 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); order: -1; }
  .dc { grid-template-columns: 1fr; }
  .dc-side { flex-direction: row; flex-wrap: wrap; }
  .dc-server, .dc-cat { display: none; }
}
@media (max-width: 760px) {
  .sidebar { position: fixed; inset: 0 auto 0 0; transform: translateX(-100%); transition: transform .2s; box-shadow: 0 0 30px rgba(0, 0, 0, .25); }
  .sidebar.open { transform: none; }
  .menu-btn { display: grid; }
  .top-right { display: none; }
  .topbar { padding: 0 12px; gap: 8px; }
  .crumbs .muted { display: none; }
  .crumbs { display: none; }
  .pf-btn { padding: 0 10px; }
  .run-ctl { left: 16px; right: 16px; transform: none; bottom: 60px; flex-wrap: wrap; justify-content: center; }
  .scenario { flex: 1; min-width: 0; }
  .scenario select { min-width: 0; flex: 1; }
  .exec-btn { flex: 1; justify-content: center; }
  .modal { padding: 0; }
  .modal-card { max-height: 100dvh; height: 100dvh; border-radius: 0; }
  .tl-row { grid-template-columns: 110px 1fr 56px; }
  .exec-row { grid-template-columns: auto 1fr; }
  .log-row { grid-template-columns: 22px 24px 1fr auto; }
  .log-row .ms { display: none; }
}

@supports not selector(::-webkit-scrollbar) {
  .tbl-wrap, .modal-body, .ndv > div, .logs-body, .exec-view, .about, .legal { scrollbar-width: thin; scrollbar-color: var(--node-border) transparent; }
  .dc-msgs { scrollbar-width: thin; scrollbar-color: #1a1b1e #2b2d31; }
}
