.ce-editor {
  --ce-accent: var(--accent, #397fe5);
  --ce-ink: var(--ink, #1b2437);
  --ce-muted: var(--muted, #64748b);
  --ce-line: var(--line, #e8eaf3);
  --ce-background: var(--bg, #f6f7fc);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  height: calc(100dvh - var(--top));
  min-height: 590px;
  position: relative;
  overflow: hidden;
  color: var(--ce-ink);
  background: #fff;
}
.ce-editor [hidden] { display: none !important; }
.ce-editor button,
.ce-editor input,
.ce-editor textarea,
.ce-editor select { font: inherit; }
.ce-editor button { cursor: pointer; }
.ce-editor button:disabled { cursor: default; opacity: .58; }
.ce-editor button:focus-visible { outline: 2px solid var(--ce-accent); outline-offset: 3px; }
.ce-editor svg { flex-shrink: 0; }
.ce-header {
  min-height: 66px;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--ce-line);
  z-index: 2;
}
.ce-title { min-width: 0; flex: 1; }
.ce-title > span { color: var(--ce-muted); font-size: 11px; font-weight: 600; display: block; }
.ce-title input {
  width: 100%;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--ce-ink);
  padding: 3px 0;
  font-size: 19px;
  font-weight: 750;
  outline: none;
}
.ce-title input:focus { box-shadow: 0 2px var(--ce-accent); }
.ce-header-actions { display: flex; align-items: center; gap: 8px; }
.ce-save-state { color: var(--ce-muted); font-size: 11px; white-space: nowrap; margin-right: 4px; }
.ce-button,
.ce-icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--ce-ink);
  background: #fff;
  border: 1px solid var(--ce-line);
  border-radius: 8px;
  padding: 8px 11px;
  min-height: 36px;
  font-size: 12px !important;
  font-weight: 650 !important;
  white-space: nowrap;
}
.ce-button:hover, .ce-icon-button:hover { background: #f5f8fd; }
.ce-icon-button { flex: 0 0 auto; width: 35px; height: 35px; padding: 0; }
.ce-button svg, .ce-icon-button svg, .ce-button i, .ce-icon-button i { width: 15px; height: 15px; }
.ce-editor .ce-primary { background: var(--ce-accent); color: #fff; border-color: var(--ce-accent); }
.ce-editor .ce-primary:hover { filter: brightness(.94); }
.ce-body {
  display: grid;
  grid-template-columns: 194px minmax(0, 1fr) 290px;
  min-height: 0;
}
.ce-library, .ce-inspector { overflow-y: auto; min-height: 0; background: white; }
.ce-library { border-right: 1px solid var(--ce-line); }
.ce-inspector { border-left: 1px solid var(--ce-line); }
.ce-side-heading { padding: 21px 15px 15px; border-bottom: 1px solid var(--ce-line); }
.ce-side-heading h2, .ce-dialog h2 { margin: 0 0 3px; font-size: 14px; font-weight: 750; }
.ce-side-heading div > span, .ce-side-heading > span:not(.ce-symbol) { color: var(--ce-muted); font-size: 11px; }
.ce-inspector-heading { display: flex; align-items: center; gap: 10px; }
.ce-inspector-heading > div { flex: 1; min-width: 0; }
.ce-blocks { padding: 11px 8px; display: grid; gap: 4px; }
.ce-block {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 6px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  width: 100%;
  color: var(--ce-ink);
  text-align: left;
  font-size: 11px !important;
  font-weight: 650 !important;
}
.ce-block:hover { background: #f5f8fd; border-color: var(--ce-line); }
.ce-block-plus { width: 12px; height: 12px; margin-left: auto; opacity: 0; color: var(--ce-muted); }
.ce-block:hover .ce-block-plus { opacity: 1; }
.ce-green { --ce-tone: #108267; --ce-tint: #e4f8ef; }
.ce-blue { --ce-tone: #2572d4; --ce-tint: #e7f1ff; }
.ce-purple { --ce-tone: #7353c8; --ce-tint: #efe9ff; }
.ce-amber { --ce-tone: #a86412; --ce-tint: #fff1da; }
.ce-pink { --ce-tone: #b74f7d; --ce-tint: #ffeaf4; }
.ce-slate { --ce-tone: #546884; --ce-tint: #eef2f7; }
.ce-symbol {
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  width: 29px;
  height: 29px;
  border-radius: 7px;
  color: var(--ce-tone, #2572d4);
  background: var(--ce-tint, #e7f1ff);
}
.ce-symbol svg, .ce-symbol i { width: 15px; height: 15px; }
.ce-inspector-heading .ce-symbol { width: 35px; height: 35px; }
.ce-inspector-content { padding: 16px; display: grid; gap: 12px; }
.ce-field { min-width: 0; display: grid; gap: 5px; color: var(--ce-ink); font-size: 11px; font-weight: 700; }
.ce-field input, .ce-field textarea, .ce-field select,
.ce-sim-form input {
  min-width: 0;
  width: 100%;
  box-sizing: border-box;
  color: var(--ce-ink);
  background: #fff;
  border: 1px solid #dce2ec;
  padding: 8px 9px;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 500;
  outline: none;
}
.ce-field textarea { resize: vertical; }
.ce-field input:focus, .ce-field textarea:focus, .ce-field select:focus, .ce-sim-form input:focus { border-color: var(--ce-accent); box-shadow: 0 0 0 2px #367ee51a; }
.ce-detail { margin: 0; color: var(--ce-muted); font-size: 12px; line-height: 1.55; }
.ce-connections { border-top: 1px solid var(--ce-line); padding-top: 13px; display: grid; gap: 10px; }
.ce-connections h3 { margin: 0; font-size: 12px; }
.ce-branch, .ce-option { display: flex; align-items: end; gap: 6px; }
.ce-branch .ce-field, .ce-option .ce-field { flex: 1; }
.ce-branch .ce-field:has([data-weight]) { flex: 0 0 55px; }
.ce-branch .ce-icon-button, .ce-option .ce-icon-button { width: 31px; height: 31px; min-height: 31px; }
.ce-remove { color: #bf3d57; }
.ce-remove:hover { background: #fff0f2; }
.ce-menu-options { display: grid; gap: 8px; }
.ce-menu-options .ce-button, .ce-inspector-content > .ce-button { justify-self: start; }
.ce-work {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-width: 0;
  min-height: 0;
  position: relative;
  background-color: #f5f3fa;
  background-image: radial-gradient(circle, #d9d2e8 1px, transparent 1.15px);
  background-size: 18px 18px;
}
.ce-board-toolbar {
  position: relative;
  z-index: 1;
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 8px 12px;
  background: #fcfaff;
  border-bottom: 1px solid var(--ce-line);
}
.ce-board-guide { font-size: 12px; color: var(--ce-muted); border-radius: 6px; padding: 4px 8px; }
.ce-connecting .ce-board-guide { color: var(--ce-accent); box-shadow: 0 0 0 1px var(--ce-accent); }
.ce-viewport { width: 100%; height: 100%; overflow: auto; position: relative; outline: none; }
.ce-sheet { overflow: hidden; }
.ce-canvas { position: relative; transform-origin: top left; }
.ce-edges { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; }
.ce-edges > g > path { fill: none; stroke: #8f81ac; stroke-width: 2; }
.ce-edges > g > .ce-edge-active { stroke: var(--ce-accent); }
.ce-edges marker path { fill: #8f81ac; }
.ce-node {
  position: absolute;
  width: 240px;
  height: 106px;
  box-sizing: border-box;
  border: 1px solid #dad3e9;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 3px 10px #3249660a;
}
.ce-node.is-selected { border-color: var(--ce-accent); box-shadow: 0 0 0 2px #5745cc24, 0 4px 14px #34225116; }
.ce-node-select {
  width: 100%;
  height: 100%;
  border: 0;
  border-radius: inherit;
  background: transparent;
  color: var(--ce-ink);
  text-align: left;
  padding: 0;
  display: block;
  cursor: grab !important;
  touch-action: none;
  user-select: none;
}
.ce-node-select:active { cursor: grabbing !important; }
.ce-connecting .ce-node-select { cursor: crosshair !important; }
.ce-node-heading { display: flex; align-items: center; gap: 8px; padding: 10px 10px 8px; border-bottom: 1px solid var(--ce-line); background: #fcfaff; border-radius: 11px 11px 0 0; }
.ce-node-heading strong { font-size: 12px; line-height: 1.2; flex: 1; }
.ce-grip { width: 14px; height: 14px; color: #a0aec3; }
.ce-node-description {
  color: var(--ce-muted);
  font-size: 11px;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  padding: 8px 12px 0;
  overflow-wrap: anywhere;
  white-space: pre-line;
}
.ce-port {
  display: block;
  position: absolute;
  z-index: 1;
  top: 50%;
  transform: translateY(-50%);
  box-sizing: border-box;
  border: 2px solid #a4b8d5;
  background: #fff;
  width: 12px;
  height: 12px;
  padding: 0;
  border-radius: 50%;
}
.ce-port-in { left: -7px; pointer-events: none; }
.ce-port-out { right: -7px; }
.ce-port-out:hover, .ce-node.is-selected .ce-port { border-color: var(--ce-accent); }
.ce-port-out:hover { background: var(--ce-accent); }
.ce-zoom {
  position: absolute;
  bottom: 13px;
  left: 13px;
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 3px;
  border: 1px solid var(--ce-line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 2px 8px #32496614;
}
.ce-zoom .ce-icon-button { width: 27px; height: 27px; min-height: 27px; border: 0; }
.ce-zoom .ce-fit { border-left: 1px solid var(--ce-line); border-radius: 0 5px 5px 0; }
.ce-zoom span { width: 36px; text-align: center; font-size: 11px; color: var(--ce-muted); }
.ce-notice {
  position: absolute;
  z-index: 5;
  bottom: 22px;
  right: 22px;
  padding: 11px 14px;
  color: #fff;
  background: #24344b;
  border-radius: 8px;
  box-shadow: 0 4px 16px #1a2c4830;
  max-width: min(80%, 390px);
  font-size: 12px;
}
.ce-notice.ce-error { background: #a5334e; }
.ce-dialog-backdrop { position: absolute; inset: 0; z-index: 4; background: #1d2f4b60; display: grid; place-items: center; padding: 15px; }
.ce-dialog {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  height: min(525px, 94%);
  width: min(410px, 100%);
  overflow: hidden;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 12px 45px #1c31505c;
}
.ce-dialog header { display: flex; align-items: center; gap: 9px; padding: 12px; border-bottom: 1px solid var(--ce-line); }
.ce-dialog header div { flex: 1; }
.ce-dialog header p { margin: 0; color: var(--ce-muted); font-size: 11px; }
.ce-sim-icon { width: 37px; height: 37px; }
.ce-transcript {
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
  padding: 12px;
  background-color: #edf4f0;
  background-image: radial-gradient(circle, #d9e4dd 1px, transparent 1.1px);
  background-size: 13px 13px;
}
.ce-bubble { margin: 0; width: fit-content; max-width: 86%; padding: 9px 11px; border-radius: 8px; background: #fff; box-shadow: 0 1px 3px #32496618; font-size: 13px; white-space: pre-wrap; overflow-wrap: anywhere; }
.ce-bubble-user { align-self: flex-end; background: #d7f3de; }
.ce-sim-status { margin: 5px auto; padding: 4px 7px; color: var(--ce-muted); background: #fff; border-radius: 6px; font-size: 11px; }
.ce-sim-form { display: flex; gap: 8px; padding: 11px; border-top: 1px solid var(--ce-line); }
.ce-sim-form input { flex: 1; }
@media (max-width: 1050px) {
  .ce-body { grid-template-columns: 159px minmax(0, 1fr) 232px; }
  .ce-header { padding-inline: 12px; }
  .ce-inspector-content { padding-inline: 10px; }
}
@media (max-width: 760px) {
  .ce-editor { height: calc(100dvh - var(--top)); }
  .ce-header-actions { gap: 5px; }
  .ce-save-state { display: none; }
  .ce-header .ce-button { padding: 7px; }
  .ce-header .ce-button svg { display: none; }
  .ce-title input { font-size: 15px; }
  .ce-body { grid-template-columns: minmax(0, 1fr) 174px; grid-template-rows: auto minmax(0, 1fr); }
  .ce-library { grid-column: 1 / -1; overflow-x: auto; }
  .ce-library .ce-side-heading { display: none; }
  .ce-blocks { display: flex; padding: 5px; width: max-content; }
  .ce-block { width: auto; min-height: 33px; }
  .ce-block-plus { display: none; }
  .ce-board-guide { display: none; }
}
@media (max-width: 450px) {
  .ce-body { grid-template-columns: 1fr; grid-template-rows: auto minmax(230px, 1fr) minmax(125px, .7fr); }
  .ce-inspector { border-left: 0; border-top: 1px solid var(--ce-line); }
  .ce-side-heading { padding: 8px 10px; }
}
