.builder-legacy-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 17px;
}
.builder-runtime-actions {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 3px;
  padding: 3px;
  border: 1px solid var(--graphite-hairline, #ffffff1a);
  border-radius: 12px;
  background: var(--graphite-stage, #202124);
}
.builder-runtime-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 36px;
  padding: 7px 10px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--graphite-accent, #dfe2e6);
  font-size: 12px;
  font-weight: 720;
  transition: background-color .18s, border-color .18s, color .18s;
}
.builder-runtime-button:hover, .builder-runtime-button:focus-visible {
  border-color: #686b72;
  background: var(--graphite-raised, #2d2f33);
  color: var(--graphite-ink, #f3f4f4);
}
.builder-runtime-button .icon { width: 15px; height: 15px; }
.builder-runtime-button i, .runtime-status > i { flex: none; width: 7px; height: 7px; border-radius: 50%; background: #858991; }
.builder-runtime-button i.is-connected, .runtime-status > i.is-connected { background: #8cdaab; box-shadow: 0 0 0 3px #8cdaab20; }
.builder-runtime-button i.is-unverified { background: #d3b284; }
.builder-runtime-test.is-running {
  border-color: #3e6654;
  background: #263c32;
  color: #b0e1c4;
}
.runtime-backdrop[hidden] { display: none; }
.runtime-backdrop {
  position: fixed;
  inset: 0;
  z-index: 35;
  display: flex;
  justify-content: flex-end;
  overflow: hidden;
  padding: 12px;
  background: #090a0cb8;
  backdrop-filter: blur(6px);
  animation: runtime-backdrop-enter .2s ease-out both;
}
.runtime-drawer {
  width: min(475px, 100%);
  min-width: 0;
  overflow: auto;
  overscroll-behavior: contain;
  padding: 26px 26px 32px;
  border: 1px solid var(--graphite-line, #414349);
  border-radius: 16px;
  background: var(--graphite-stage, #202124);
  box-shadow: -16px 21px 64px #08090ac9;
  scrollbar-color: #686b74 transparent;
  animation: runtime-drawer-enter .32s var(--graphite-ease, cubic-bezier(.22, 1, .36, 1)) both;
}
@keyframes runtime-backdrop-enter { from { opacity: 0; } to { opacity: 1; } }
@keyframes runtime-drawer-enter { from { opacity: .7; transform: translateX(24px); } to { opacity: 1; transform: none; } }
.runtime-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 22px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--graphite-hairline, #ffffff1a);
}
.runtime-heading h2 {
  margin-top: 6px;
  color: var(--graphite-ink, #f3f4f4);
  font-size: clamp(26px, 5vw, 34px);
  line-height: 1.15;
  letter-spacing: -.042em;
}
.runtime-heading p, .runtime-help { margin-top: 8px; color: var(--graphite-muted, #b0b3b8); font-size: 12px; line-height: 1.65; }
.runtime-heading button { flex: none; border: 1px solid var(--graphite-hairline, #ffffff1a); background: var(--graphite-panel, #25272a); color: var(--graphite-accent, #dfe2e6); }
.runtime-heading button:hover, .runtime-heading button:focus-visible { background: var(--graphite-raised, #2d2f33); color: white; }
.runtime-kicker {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--graphite-muted, #b0b3b8);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .12em;
}
.runtime-status {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--graphite-hairline, #ffffff1a);
  border-radius: 11px;
  background: var(--graphite-panel, #25272a);
}
.runtime-status > div { min-width: 0; flex: 1; display: grid; gap: 4px; }
.runtime-status strong { font-size: 13px; }
.runtime-status small { font-size: 11px; color: var(--graphite-muted, #b0b3b8); }
.runtime-help a { color: var(--graphite-accent, #dfe2e6); text-decoration: underline; text-underline-offset: 3px; }
.runtime-unsaved, .runtime-saved {
  margin-bottom: 18px;
  padding: 13px 15px;
  border: 1px solid #d5bd8b38;
  border-radius: 12px;
  background: #d7ba7810;
  color: #e5d7b6;
  font-size: 11px;
  line-height: 1.6;
}
.runtime-unsaved strong { font-size: 12px; }
.runtime-unsaved p { margin: 5px 0 10px; }
.runtime-saved { border-color: var(--graphite-hairline, #ffffff1a); background: var(--graphite-panel, #25272a); color: var(--graphite-muted, #b0b3b8); }
.runtime-live .section-title h2 { font-size: 17px; }
.runtime-live .section-title p { color: var(--graphite-muted, #b0b3b8); line-height: 1.55; }
.runtime-live .live-mast {
  gap: 12px;
  border-color: var(--graphite-line, #414349);
  background: var(--graphite-stage, #202124);
}
.runtime-live .live-timer {
  color: var(--graphite-ink, #f3f4f4);
  font-size: clamp(25px, 6vw, 31px);
  text-shadow: none;
}
.runtime-live .live-log { background: var(--graphite-bg, #17181a); color: var(--graphite-accent, #dfe2e6); }
.runtime-live .live-log span { color: var(--graphite-muted, #b0b3b8); }
.runtime-live > form { margin-top: 16px; }
.runtime-live .help-note { overflow-wrap: anywhere; }
.runtime-live .live-controls { flex-wrap: wrap; }
.runtime-guild {
  display: flex;
  align-items: center;
  gap: 7px 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
  padding: 10px 12px;
  border: 1px solid var(--graphite-hairline);
  border-radius: 9px;
  color: var(--graphite-muted);
  font-size: 11px;
}
.runtime-guild span { display: inline-flex; gap: 6px; align-items: center; }
.runtime-guild .icon { width: 15px; height: 15px; }
.runtime-guild strong { color: var(--graphite-ink); overflow-wrap: anywhere; }
.live-controls .runtime-guild { margin-bottom: 0; }
.runtime-guild-error { margin-bottom: 12px; }
.runtime-quota {
  display: grid;
  gap: 8px;
  margin: 12px 0 16px;
  padding: 11px 12px;
  border: 1px solid var(--graphite-hairline);
  border-radius: 10px;
  background: var(--graphite-bg);
}
.runtime-quota-head, .runtime-quota-meter, .runtime-quota-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.runtime-quota-head strong { font-size: 12px; }
.runtime-quota-meter progress { min-width: 0; flex: 1; height: 6px; accent-color: #bd9ce9; }
.runtime-quota-meter span, .runtime-quota-foot { color: var(--graphite-muted); font-size: 10px; }
.runtime-quota-meter b { font-variant-numeric: tabular-nums; color: var(--graphite-ink); }
.runtime-quota-foot a { display: inline-flex; gap: 4px; align-items: center; color: #e0c3f6; font-weight: 750; }
.runtime-quota-foot a .icon { width: 12px; height: 12px; }
.runtime-quota-exhausted { color: #e2bf9e; font-size: 11px; }
.runtime-details, .runtime-managed {
  margin-top: 20px;
  padding: 14px 15px;
  border: 1px solid var(--graphite-hairline, #ffffff1a);
  border-radius: 11px;
  background: var(--graphite-panel, #25272a);
}
.runtime-details summary { cursor: pointer; color: var(--graphite-accent, #dfe2e6); font-size: 13px; font-weight: 700; }
.runtime-details form { margin-top: 15px; }
.runtime-details .muted-copy { margin: 0 0 10px; }
.runtime-managed h2 { font-size: 15px; }
.runtime-managed .muted-copy { margin-top: 6px; }
.runtime-managed .managed-item { align-items: flex-start; flex-wrap: wrap; overflow-wrap: anywhere; }

/* Classic workflows share the editor's canvas and action colors. */
.shell :is(.events-panel,.builder-panel) {
  border-color: var(--graphite-hairline, #ffffff1a);
  border-radius: 14px;
  background: var(--graphite-stage, #202124);
}
.shell .events-panel .event-row {
  border-color: var(--graphite-hairline, #ffffff1a);
  background: var(--graphite-panel, #25272a);
  transition: background-color .18s, border-color .18s;
}
.shell .events-panel .event-row:hover, .shell .events-panel .event-row:focus-visible { border-color: #71747a; background: var(--graphite-raised, #2d2f33); }
.shell .events-panel .event-row.selected { border-color: #a89bb8; background: var(--graphite-raised, #2d2f33); }
.shell .builder-panel .canvas {
  background-color: #17191c;
  background-image: radial-gradient(circle at center, #c0c6d241 1px, transparent 1.25px);
  background-size: 26px 26px;
}
.shell .builder-node {
  border-color: #53565e;
  background: var(--graphite-panel, #25272a);
  box-shadow: 0 14px 26px #090a0d79;
}
.shell .builder-line { background: #c2addf94; }
.shell .builder-line::after { background: var(--graphite-panel, #25272a); border-color: #c2addf94; color: #d1bfeb; }
.shell .builder-node-head small { color: var(--graphite-muted, #b0b3b8); }

/* Modal chrome only. Discord's example surfaces keep their native colors. */
body :is(.embed-editor-backdrop,.component-editor-backdrop,.variables-backdrop) {
  background: #090a0cc7;
  backdrop-filter: blur(6px);
}
body :is(.embed-editor,.component-editor,.variables-dialog) {
  border-color: var(--graphite-line, #414349);
  border-radius: 16px;
  background: var(--graphite-stage, #202124);
  box-shadow: 0 24px 70px #08090bbf;
  animation: runtime-modal-enter .25s var(--graphite-ease, ease) both;
}
body :is(.embed-preview-wrap,.component-editor aside,.embed-editor-actions,.variables-footer) { background: var(--graphite-panel, #25272a); }
body :is(.embed-primary,.component-save) { background: var(--graphite-ink, #f3f4f4); color: var(--graphite-bg, #17181a); }
body :is(.embed-primary:hover,.component-save:hover) { background: #fff; }
body :is(.embed-editor-header,.component-editor header) { background: transparent; }
body :is(.embed-editor-kicker,.component-kicker,.variables-eyebrow,.embed-editor-header p,.embed-editor-hint,.component-editor header p,.component-editor aside > p,.variables-header p,.variables-key,.variables-empty) { color: var(--graphite-muted, #b0b3b8); }
body :is(.embed-editor-fields input:not([type=color]),.embed-editor-fields textarea,.embed-color-field,.component-item input,.component-item select,.component-item textarea,.variables-value) {
  border-color: var(--graphite-line, #414349);
  background: var(--graphite-bg, #17181a);
  color: var(--graphite-ink, #f3f4f4);
}
body :is(.embed-editor-fields,.component-item) :is(input,textarea)::placeholder { color: var(--graphite-muted, #b0b3b8); }
body :is(.embed-editor,.component-editor,.variables-dialog) :is(input,select,textarea):focus { border-color: #9da2aa; box-shadow: none; }
body :is(.embed-editor,.component-editor,.variables-dialog) :is(button,input,select,textarea):focus-visible { outline: 2px solid var(--graphite-accent, #dfe2e6); outline-offset: 2px; }
body :is(.component-item,.component-empty,.variables-notice,.variables-row) {
  border-color: var(--graphite-hairline, #ffffff1a);
  background: var(--graphite-panel, #25272a);
  color: var(--graphite-accent, #dfe2e6);
}
body :is(.component-add button,.variables-type,.variables-close,.variables-footer button) {
  border-color: var(--graphite-line, #414349);
  background: var(--graphite-raised, #2d2f33);
  color: var(--graphite-accent, #dfe2e6);
}
body :is(.component-add button,.variables-close,.variables-footer button):not(:disabled):hover { background: #3c3e44; color: var(--graphite-ink, #f3f4f4); }
@keyframes runtime-modal-enter { from { opacity: 0; transform: translateY(7px); } to { opacity: 1; transform: none; } }

@media (max-width: 700px) {
  .builder-legacy-toolbar { align-items: flex-start; margin-bottom: 13px; }
  .builder-runtime-actions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    width: 100%;
  }
  .builder-runtime-button {
    min-width: 0;
    height: 100%;
    min-height: 41px;
    gap: 4px;
    padding-inline: 5px;
    font-size: 11px;
  }
  .builder-runtime-button .icon { flex: 0 0 13px; width: 13px; height: 13px; }
  .builder-runtime-button span { min-width: 0; overflow-wrap: anywhere; }
  .runtime-backdrop { padding: 7px; }
  .runtime-drawer { padding: 20px 16px 26px; border-radius: 15px; }
}
@media (max-width: 365px) {
  .runtime-live .live-mast { padding: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  .builder-runtime-button, .shell .events-panel .event-row { transition: none; }
  .runtime-backdrop, .runtime-drawer,
  body :is(.embed-editor,.component-editor,.variables-dialog) { animation: none; }
}
