:root {
  color-scheme: light;
  --ink: #17202a;
  --muted: #667085;
  --line: #d8dee8;
  --panel: #f8fafc;
  --accent: #0f766e;
  --accent-2: #b45309;
  --danger: #b42318;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: #edf1f5;
  color: var(--ink);
}

button,
input,
textarea,
select {
  font: inherit;
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 2px solid #14b8a6;
  outline-offset: 2px;
}

.app-shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr) 320px;
  grid-template-rows: 56px minmax(0, 1fr);
  height: 100vh;
  overflow: hidden;
}

.topbar {
  grid-column: 1 / -1;
  border-bottom: 1px solid var(--line);
  background: #ffffff;
}

.sidebar,
.inspector {
  min-height: 0;
  overflow: auto;
  background: #ffffff;
}

.sidebar {
  border-right: 1px solid var(--line);
}

.inspector {
  border-left: 1px solid var(--line);
}

.workspace {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: 44px minmax(0, 1fr);
}

.canvas-wrap {
  position: relative;
  overflow: hidden;
  background-color: #f4f7fb;
  background-image:
    linear-gradient(#dce4ee 1px, transparent 1px),
    linear-gradient(90deg, #dce4ee 1px, transparent 1px);
  background-size: 28px 28px;
  cursor: grab;
  user-select: none;
}

.canvas-wrap.dragging {
  cursor: grabbing;
}

.canvas-stage {
  position: absolute;
  left: 0;
  top: 0;
  width: 4000px;
  height: 3000px;
  transform-origin: 0 0;
}

.node {
  position: absolute;
  width: 240px;
  min-height: 118px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 10px 24px rgba(16, 24, 40, 0.11);
  cursor: move;
}

.node.selected {
  border-color: #0f766e;
  box-shadow: 0 0 0 3px rgba(20, 184, 166, 0.18), 0 10px 24px rgba(16, 24, 40, 0.12);
}

.node.start {
  border-color: #b45309;
}

.node.start .node-title::before {
  content: "Start";
  display: inline-flex;
  margin-right: 8px;
  padding: 2px 6px;
  border-radius: 999px;
  background: #fff7ed;
  color: #9a3412;
  font-size: 11px;
  font-weight: 700;
}

.node-title {
  border-bottom: 1px solid #e2e8f0;
  padding: 8px 10px;
  font-size: 13px;
  font-weight: 700;
}

.node-text {
  padding: 10px;
  color: #344054;
  font-size: 13px;
  line-height: 1.35;
  white-space: pre-wrap;
}

.port {
  position: absolute;
  top: 50%;
  width: 14px;
  height: 14px;
  border-radius: 999px;
  border: 2px solid #ffffff;
  background: #0f766e;
  transform: translateY(-50%);
  box-shadow: 0 0 0 1px #0f766e;
}

.port.in {
  left: -7px;
}

.port.out {
  right: -7px;
  cursor: crosshair;
}

.jump-port {
  bottom: -7px;
  left: 50%;
  top: auto;
  background: #b45309;
  box-shadow: 0 0 0 1px #b45309;
  transform: translateX(-50%);
}

.edge-path {
  fill: none;
  stroke: #0f766e;
  stroke-width: 3;
  cursor: pointer;
}

.edge-path.conditional-path {
  stroke: #7c3aed;
}

.edge-path.selected {
  stroke-width: 5;
}

.jump-path {
  stroke: #b45309;
  stroke-dasharray: 8 6;
}

.jump-path.conditional-jump-path {
  stroke: #db2777;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 34px;
  border: 1px solid #cbd5e1;
  border-radius: 7px;
  background: #ffffff;
  color: #1f2937;
  padding: 7px 10px;
  font-size: 13px;
  font-weight: 650;
}

.btn:hover {
  background: #f8fafc;
}

.btn.primary {
  border-color: #0f766e;
  background: #0f766e;
  color: #ffffff;
}

.btn.danger {
  border-color: #fecaca;
  color: var(--danger);
}

.icon-btn {
  width: 34px;
  min-width: 34px;
  padding: 0;
}

.field {
  width: 100%;
  border: 1px solid #cbd5e1;
  border-radius: 7px;
  background: #ffffff;
  padding: 8px 9px;
  color: #1f2937;
  font-size: 13px;
}

.section-title {
  margin: 0 0 8px;
  color: #475467;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.list-item {
  width: 100%;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  padding: 8px;
  text-align: left;
}

.list-item:hover {
  background: #f8fafc;
}

.list-item.active {
  border-color: #99f6e4;
  background: #f0fdfa;
}

.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: #94a3b8;
}

.status-dot.ok {
  background: #10b981;
}

.status-dot.warn {
  background: #f59e0b;
}

.status-dot.error {
  background: #ef4444;
}

.validation-row {
  border-left: 3px solid #f59e0b;
  background: #fffbeb;
  padding: 7px 8px;
  color: #713f12;
  font-size: 12px;
}

@media (max-width: 1100px) {
  .app-shell {
    grid-template-columns: 240px minmax(0, 1fr);
  }

  .inspector {
    position: absolute;
    right: 0;
    top: 56px;
    bottom: 0;
    width: 320px;
    box-shadow: -18px 0 32px rgba(16, 24, 40, 0.12);
    z-index: 20;
  }
}
