.toolbar-actions{display:flex;align-items:center;gap:10px}
.delete-command{border:1px solid #65303d;background:#25141a;color:#ff8297;border-radius:8px;padding:8px 11px;cursor:pointer}
.delete-command:hover{background:#3a1923;border-color:#a54458}.delete-command:disabled{display:none}
.rail button{position:relative}.rail button.disabled{opacity:.32;cursor:not-allowed}
.rail button[data-tooltip]::after{content:attr(data-tooltip);position:absolute;left:51px;top:50%;transform:translateY(-50%) translateX(-4px);padding:7px 9px;border:1px solid #303747;border-radius:7px;background:#171b24;color:#edf0f6;font-size:11px;white-space:nowrap;pointer-events:none;opacity:0;transition:.15s;box-shadow:0 8px 24px #0008;z-index:30}
.rail button[data-tooltip]:hover::after{opacity:1;transform:translateY(-50%) translateX(0)}
#connections{position:absolute;left:0;top:0;overflow:visible;pointer-events:none;transform-origin:0 0}
.connection-visible{fill:none;stroke:#7c5cff;stroke-width:3;filter:drop-shadow(0 0 5px #7c5cff88);pointer-events:none}
.connection-hit{fill:none;stroke:transparent;stroke-width:16;pointer-events:stroke;cursor:pointer}
.connection-hit:hover+.connection-visible{stroke:#ff627d}
.connection-preview{fill:none;stroke:#aa96ff;stroke-width:3;stroke-dasharray:7 6;pointer-events:none}
.flow-node{overflow:visible}
.node-body{background:#161a22;border-radius:0 0 12px 12px}
.port{z-index:4;cursor:crosshair;transition:transform .15s,box-shadow .15s}
.port:hover,.port.connecting{transform:scale(1.45);box-shadow:0 0 0 5px #7c5cff33}
.port.in.ready{background:#55d995;box-shadow:0 0 0 5px #55d99533}
.branch-list{margin:13px -8px -6px;padding-top:8px;border-top:1px solid #2a303d}
.branch-row{position:relative;display:flex;align-items:center;min-height:34px;margin:3px 0;padding:5px 14px 5px 9px;border-radius:7px;background:#0f1218;color:#bfc6d3;font-size:11px}
.branch-row span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;max-width:155px}.branch-row .branch-output{right:-15px;top:12px}
.branch-remove{margin-left:auto;border:0;background:transparent;color:#697386;cursor:pointer}.branch-remove:hover{color:#ff7189}
.branch-add{width:100%;margin-top:7px;padding:7px;border:1px dashed #3d4658;border-radius:7px;background:transparent;color:#9382ee;cursor:pointer;font-size:11px}.branch-add:hover{background:#211d34;border-color:#745fd9}
.builder-section{margin:18px 0;padding-top:15px;border-top:1px solid #272e3a}.builder-title,.item-editor-head{display:flex;align-items:center;justify-content:space-between}.builder-title{margin-bottom:10px}.builder-title span{color:#778195;font-size:11px}
.item-editor{margin-bottom:10px;padding:11px;border:1px solid #2a3240;border-radius:10px;background:#0e1117}.item-editor-head{margin-bottom:9px}.item-editor-head button{border:0;background:transparent;color:#ff7189;cursor:pointer;font-size:10px}
.item-editor label{display:block;margin:8px 0;color:#8f99aa;font-size:10px}.item-editor input,.item-editor select{width:100%;margin-top:5px;border:1px solid #2c3442;border-radius:7px;background:#151923;color:#e8ebf2;padding:8px}
.wire-hint{color:#665b94;font-size:9px;line-height:1.4}.add-item,.add-option,.option-remove{width:100%;border:1px dashed #4b426f;border-radius:8px;background:#1c192b;color:#aa9aff;padding:9px;cursor:pointer}.option-remove{border-style:solid;border-color:#53303a;background:#25171c;color:#ff8297}.optional-box{margin-top:15px;padding:11px;border:1px solid #2c3341;border-radius:9px}
.node-drag{cursor:grab;user-select:none}.node-drag:active{cursor:grabbing}.canvas{cursor:grab}.canvas.panning{cursor:grabbing;user-select:none}
.preview-button{border:1px solid #3c4658;border-radius:9px;background:#171c25;color:#dbe1eb;padding:9px 13px;cursor:pointer}.preview-button:hover{border-color:#6955cb;color:#b9adff}
.preview-panel{width:min(720px,92vw);height:min(760px,88vh);display:flex;flex-direction:column;border:1px solid #303747;background:#11151d;border-radius:16px;box-shadow:0 30px 100px #000;overflow:hidden}.preview-context{padding:9px 18px;border-bottom:1px solid #252c38;background:#0d1016;color:#7f899b;font-size:11px}.preview-messages{flex:1;overflow:auto;padding:20px;background:#313338}.preview-row{display:flex;gap:10px;margin-bottom:16px}.preview-row.user{opacity:.8}.preview-avatar{flex:0 0 34px;height:34px;display:grid;place-items:center;border-radius:50%;background:#7c5cff;color:white;font-weight:800}.preview-row.user .preview-avatar{background:#596273}.preview-bubble{min-width:0;color:#f2f3f5;line-height:1.45}
.discord-embed{max-width:480px;margin-top:3px;padding:12px 14px;border-left:4px solid #5865f2;border-radius:4px;background:#2b2d31}.discord-embed p{margin:7px 0 0;color:#dbdee1}.discord-select{min-width:320px;padding:10px;border:1px solid #202225;border-radius:4px;background:#1e1f22;color:#dbdee1}.discord-buttons{display:flex;gap:7px;flex-wrap:wrap}.discord-buttons button,.preview-modal button{border:0;border-radius:4px;padding:8px 13px;color:white;cursor:pointer}.discord-buttons .primary,.preview-modal button{background:#5865f2}.discord-buttons .secondary{background:#4e5058}.discord-buttons .success{background:#248046}.discord-buttons .danger{background:#da373c;width:auto}
.preview-modal{width:420px;padding:16px;border-radius:8px;background:#111214}.preview-modal label{display:block;margin:12px 0;color:#b5bac1;font-size:11px}.preview-modal input{width:100%;margin-top:5px;padding:9px;border:1px solid #1e1f22;border-radius:4px;background:#1e1f22;color:#f2f3f5}.preview-action{display:block;padding:8px 10px;border:1px dashed #687185;border-radius:6px;color:#b5bac1;font-size:12px}.preview-footer{padding:12px 18px;border-top:1px solid #252c38;text-align:right}.preview-footer button{border:1px solid #394253;border-radius:7px;background:#1a1f29;color:#ced4df;padding:8px 11px;cursor:pointer}
.grid,#nodes,#groups{width:6000px;height:4000px}.grid{min-width:6000px;min-height:4000px}.canvas-help{color:#687386;font-size:10px}
.node-drag{min-height:42px;margin:-9px -8px 0;padding:9px 34px 7px 8px}.port{width:18px;height:18px;border-width:3px}.port.in{left:-10px}.port.out{right:-10px}.branch-row .branch-output{right:-19px;top:8px}.port::after{content:"";position:absolute;inset:-10px;border-radius:50%}
.node-trash{position:absolute;right:8px;top:13px;z-index:6;width:25px;height:25px;border:0;border-radius:6px;background:#25171c;color:#ff768e;cursor:pointer;opacity:.55}.flow-node:hover .node-trash{opacity:1}.node-trash:hover{background:#4a1e29}.node-trash.locked{display:none}
#groups{position:absolute;left:0;top:0;transform-origin:0 0;pointer-events:none}.flow-group{position:absolute;border:1px solid #6356a5;border-radius:14px;background:#332b5a25;box-shadow:inset 0 0 35px #6f57d20c;pointer-events:auto}.group-header{height:34px;display:flex;align-items:center;padding:0 10px;border-bottom:1px solid #51467f;background:#292342cc;border-radius:13px 13px 0 0;color:#c7bcff;cursor:move;font-size:11px;font-weight:700}.group-header span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.group-header button{margin-left:auto;border:0;background:transparent;color:#9a8fc9;cursor:pointer}.group-header button:hover{color:#ff7189}.group-draft{position:absolute;border:1px dashed #8d79ff;background:#705cff1c;pointer-events:none;z-index:8}.group-name-input{background:transparent;border:0;color:inherit;font-weight:700;outline:0;width:100%}
.delivery-choice{display:grid;grid-template-columns:1fr 1fr;gap:7px}.delivery-choice label{padding:9px;border:1px solid #303848;border-radius:8px;background:#121720;cursor:pointer}.delivery-choice input{width:auto;margin-right:6px}
.form:has(.delivery-choice) .field:has(.toggle){display:none}
.command-creator{width:min(500px,calc(100vw - 32px));border:1px solid #303747;border-radius:16px;background:#12161e;box-shadow:0 30px 100px #000;overflow:hidden}.command-creator-body{display:grid;gap:20px;padding:22px}.command-creator-body>label{display:grid;gap:8px;color:#d9deea;font-size:12px;font-weight:700}.command-creator-body small{font-weight:400;letter-spacing:0;color:#747f92}.command-name-field{display:flex;align-items:center;border:1px solid #303747;border-radius:9px;background:#0d1118;overflow:hidden}.command-name-field:focus-within{border-color:#7c5cff;box-shadow:0 0 0 3px #7c5cff18}.command-name-field span{padding:0 0 0 12px;color:#9d8cff;font-size:17px;font-weight:800}.command-name-field input,.command-creator textarea{width:100%;border:0;outline:0;background:transparent;color:#f2f4f8;padding:11px}.command-creator textarea{min-height:88px;border:1px solid #303747;border-radius:9px;background:#0d1118;resize:vertical}.command-creator textarea:focus{border-color:#7c5cff;box-shadow:0 0 0 3px #7c5cff18}.command-creator-actions{display:flex;justify-content:flex-end;gap:9px;padding:15px 22px;border-top:1px solid #282e3a;background:#0f131a}.secondary-button{border:1px solid #343c4c;border-radius:9px;background:#171c25;color:#cbd2df;padding:9px 14px;cursor:pointer}.secondary-button:hover{border-color:#586379;color:white}.toolbar input:disabled{opacity:.35;cursor:not-allowed}
.add-node-top{border:1px solid #6752d7;border-radius:8px;background:#251f42;color:#b9adff;padding:8px 12px;cursor:pointer;font-weight:700}.add-node-top:hover{background:#302657;border-color:#8c77ff}.fab{z-index:15;box-shadow:0 10px 30px #000b}
.preview-panel.emulator{width:96vw;height:93vh;max-width:1680px;display:flex;flex-direction:column;background:#111318;border:1px solid #343b49;border-radius:14px;overflow:hidden}.emulator-head{height:62px;display:flex;align-items:center;gap:14px;padding:0 18px;border-bottom:1px solid #282e39;background:#0e1117}.emulator-head h2{margin:3px 0 0}.emulator-head>div:first-child{margin-right:auto}.emulator-head>button{border:1px solid #343c4b;border-radius:7px;background:#181d26;color:#cbd2de;padding:8px 11px;cursor:pointer}.emulator-head>button:last-child{font-size:19px;padding:4px 10px}.emulator-status{color:#7f899b;font-size:11px}.emulator-status i{display:inline-block;width:7px;height:7px;margin-right:6px;border-radius:50%;background:#55d995;box-shadow:0 0 10px #55d995}.emulator-body{min-height:0;flex:1;display:grid;grid-template-columns:240px minmax(420px,1fr) 300px}.emulator-channels{display:flex;flex-direction:column;background:#2b2d31;border-right:1px solid #1e1f22;color:#949ba4}.emulator-server{display:flex;align-items:center;gap:10px;padding:15px;border-bottom:1px solid #202225;color:#f2f3f5}.emulator-server small{display:block;margin-top:3px;font-size:8px}.channel-section{padding:16px 8px 5px}.channel-section>span{padding:0 8px;font-size:9px;font-weight:800}.preview-channel{display:flex;align-items:center;gap:7px;margin-top:4px;padding:7px 9px;border-radius:5px;cursor:pointer;color:#949ba4}.preview-channel:hover{background:#35373c;color:#dbdee1}.preview-channel.active{background:#404249;color:white}.preview-channel.closed{text-decoration:line-through;opacity:.5}.preview-channel .channel-badge{margin-left:auto;border-radius:8px;background:#5865f2;color:white;padding:1px 5px;font-size:8px}.emulator-chat{position:relative;min-width:0;display:flex;flex-direction:column;background:#313338}.emulator-channel-head{height:52px;display:flex;align-items:center;justify-content:space-between;padding:0 16px;border-bottom:1px solid #242529;box-shadow:0 1px 2px #0005;color:#f2f3f5}.emulator-channel-head b{margin-right:12px}.emulator-channel-head span{color:#949ba4;font-size:11px}.preview-messages{min-height:0;flex:1;padding:18px;overflow:auto}.preview-composer{display:flex;align-items:center;gap:9px;margin:0 16px 16px;padding:10px 12px;border-radius:8px;background:#383a40}.preview-composer button{border:0;background:#b5bac1;color:#383a40;border-radius:50%;width:22px;height:22px}.preview-composer input{flex:1;border:0;outline:0;background:transparent;color:#f2f3f5}.preview-composer>span{color:#72767d;font-size:9px}.command-suggestions{position:absolute;left:16px;right:16px;bottom:70px;max-height:240px;overflow:auto;border:1px solid #202225;border-radius:8px;background:#111214;box-shadow:0 12px 35px #0009;z-index:4}.command-suggestion{display:flex;justify-content:space-between;padding:10px 12px;color:#dbdee1;cursor:pointer}.command-suggestion:hover{background:#35373c}.command-suggestion span{color:#949ba4;font-size:10px}.emulator-debug{min-width:0;overflow:auto;border-left:1px solid #202225;background:#1e1f22;color:#b5bac1}.debug-section{padding:16px;border-bottom:1px solid #2b2d31}.debug-section>label{display:block;margin-top:12px;color:#949ba4;font-size:10px}.debug-section input,.debug-section select{width:100%;margin-top:5px;padding:8px;border:1px solid #111214;border-radius:5px;background:#111214;color:#dbdee1}.debug-section select{min-height:90px}.debug-section.variables>div{display:flex;justify-content:space-between}.debug-section button{border:0;background:transparent;color:#8ea1e1;cursor:pointer;font-size:10px}.debug-section pre{max-height:180px;overflow:auto;color:#8bd5ca;font:10px/1.5 ui-monospace,monospace;white-space:pre-wrap}.event-section{min-height:220px}.preview-event{position:relative;margin-top:12px;padding-left:14px;color:#9da4ae;font-size:10px;line-height:1.4}.preview-event::before{content:"";position:absolute;left:0;top:4px;width:6px;height:6px;border-radius:50%;background:#7c5cff}.preview-event b{display:block;color:#d2d6dc}.targeted-badge{display:inline-block;margin-bottom:5px;padding:2px 6px;border-radius:8px;background:#5865f244;color:#aeb8ff;font-size:9px}.preview-system{padding:10px 12px;border-left:3px solid #f0a84b;background:#25272d;color:#c9cdd3;font-size:11px}.emulator-debug .brand-mark{box-shadow:none}@media(max-width:1000px){.emulator-body{grid-template-columns:190px 1fr}.emulator-debug{display:none}}@media(max-width:700px){.emulator-body{grid-template-columns:1fr}.emulator-channels{display:none}.preview-panel.emulator{width:100vw;height:100vh;border-radius:0}}
/* The builder behaves like a desktop visual editor: dragging modules, groups
   and the canvas must not start native browser text selection. */
html,
body,
#app,
.modal,
.flow-node,
.sidebar,
.toolbar,
.inspector,
button,
label,
span,
small,
b,
p,
code {
  -webkit-user-select: none;
  user-select: none;
}

input,
textarea,
[contenteditable="true"],
.allow-text-selection {
  -webkit-user-select: text;
  user-select: text;
}

/* Hard guard for browsers that start native selection on descendants while
   the pointer crosses multiple nodes. Editable controls are the only opt-out. */
body,
body * {
  -webkit-user-select: none !important;
  user-select: none !important;
}

body input,
body textarea,
body [contenteditable="true"],
body .allow-text-selection,
body .allow-text-selection * {
  -webkit-user-select: text !important;
  user-select: text !important;
}
