.workflow-root {
  display: block;
  grid-column: 1 / -1;
  min-width: 0;
  height: 100vh;
  min-height: 720px;
}

.canvas-view {
  margin: -22px;
  min-height: 100vh;
}

.canvas-view > :not(.workflow-root) {
  display: none !important;
}

.rf-shell {
  height: 100%;
  min-width: 0;
  display: grid;
  grid-template-columns: 262px minmax(520px, 1fr) 304px;
  background: #020202;
  color: #f5f7fb;
  border-top: 1px solid #171717;
}

.rf-card-library,
.rf-chat-panel {
  min-width: 0;
  background: #030303;
  border-color: #242424;
  overflow: hidden;
}

.rf-card-library {
  border-right: 1px solid #242424;
  padding: 24px 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.rf-icon-tabs {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 9px;
  padding-bottom: 20px;
  border-bottom: 1px solid #202020;
}

.rf-icon-tabs button,
.rf-toolbar-actions button,
.rf-chat-head button {
  height: 36px;
  border: 1px solid #2b2b2b;
  background: #050505;
  color: #ffffff;
  font-weight: 900;
}

.rf-icon-tabs button.active,
.rf-icon-tabs button:hover,
.rf-toolbar-actions button:hover,
.rf-chat-head button:hover {
  border-color: #f2f2f2;
}

.rf-section-title {
  color: #aee8df;
  font-size: 13px;
  font-weight: 900;
}

.rf-basic-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 13px;
}

.rf-basic-card {
  position: relative;
  height: 106px;
  border: 1px solid #262626;
  background: #050505;
  color: #ffffff;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 10px;
  font-weight: 900;
}

.rf-basic-card:hover {
  border-color: #ffffff;
}

.rf-basic-card i {
  font-style: normal;
  font-size: 25px;
  line-height: 1;
}

.rf-basic-card strong {
  font-size: 13px;
}

.rf-card-badge {
  position: absolute;
  right: 7px;
  top: 7px;
  border: 1px solid #ffffff;
  padding: 1px 4px;
  color: #ffffff;
  font-size: 10px;
  line-height: 1.2;
}

.rf-left-actions {
  margin-top: auto;
  padding-top: 20px;
  border-top: 1px solid #202020;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.rf-left-actions button,
.rf-add-menu button {
  min-height: 39px;
  border: 1px solid #2b2b2b;
  background: #050505;
  color: #ffffff;
  text-align: left;
  padding: 0 14px;
  font-weight: 900;
}

.rf-left-actions button:hover,
.rf-add-menu button:hover {
  border-color: #ffffff;
}

.rf-add-menu {
  display: grid;
  gap: 7px;
}

.rf-center {
  position: relative;
  min-width: 0;
  min-height: 0;
  background: #050505;
  overflow: hidden;
}

.rf-canvas-toolbar {
  position: absolute;
  z-index: 12;
  left: 24px;
  right: 24px;
  top: 24px;
  display: grid;
  grid-template-columns: auto minmax(120px, 260px) 1fr;
  align-items: center;
  gap: 10px;
  pointer-events: none;
}

.rf-canvas-toolbar > * {
  pointer-events: auto;
}

.rf-score,
.rf-canvas-toolbar input {
  height: 38px;
  border: 1px solid #2b2b2b;
  background: #050505;
  color: #ffffff;
  padding: 0 14px;
  font-weight: 900;
}

.rf-canvas-toolbar input {
  min-width: 0;
}

.rf-toolbar-actions {
  justify-self: end;
  display: flex;
  gap: 8px;
}

.rf-toolbar-actions button {
  min-width: 46px;
  padding: 0 12px;
}

.rf-flow {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 1px 1px, rgba(255,255,255,.16) 1px, transparent 1px),
    #050505;
  background-size: 14px 14px;
}

.rf-flow .react-flow {
  background: transparent;
}

.rf-flow .react-flow__background {
  opacity: .5;
}

.rf-flow .react-flow__edge-path {
  stroke: #686868;
  stroke-width: 2;
}

.rf-flow .react-flow__edge.selected .react-flow__edge-path,
.rf-flow .react-flow__edge:hover .react-flow__edge-path {
  stroke: #8ed9ff;
}

.rf-flow .react-flow__minimap {
  right: 28px;
  bottom: 24px;
  width: 138px;
  height: 116px;
  background: rgba(17, 72, 45, .9);
  border: 1px solid #11aa6a;
}

.rf-flow .react-flow__controls {
  left: 18px;
  bottom: 74px;
  box-shadow: none;
}

.rf-flow .react-flow__controls button {
  background: #050505;
  border: 1px solid #2b2b2b;
  color: #ffffff;
  fill: #ffffff;
}

.rf-node {
  width: 150px;
  min-height: 118px;
  border: 1px solid #343434;
  border-top: 2px solid #2c85ff;
  background: #060606;
  color: #ffffff;
  padding: 8px;
  box-shadow: 0 18px 40px rgba(0,0,0,.42);
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.rf-node.is-selected {
  border-color: #ffffff;
  box-shadow: 0 0 0 1px rgba(255,255,255,.3), 0 24px 50px rgba(0,0,0,.55);
}

.rf-node header,
.rf-node footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 5px;
}

.rf-node header span {
  color: #b8c3d8;
  font-size: 9px;
  font-weight: 900;
}

.rf-node header b,
.rf-node footer span {
  border: 1px solid #323232;
  color: #cbd5e1;
  padding: 2px 4px;
  font-size: 8px;
  font-weight: 900;
}

.rf-node > strong {
  font-size: 11px;
}

.rf-node p {
  flex: 1;
  min-height: 40px;
  max-height: 54px;
  margin: 0;
  overflow: hidden;
  color: #d6dce8;
  font-size: 8px;
  line-height: 1.45;
}

.rf-kind-text { border-top-color: #2c85ff; }
.rf-kind-image, .rf-kind-image-gen { border-top-color: #18b784; }
.rf-kind-video, .rf-kind-video-gen { border-top-color: #8957ff; }
.rf-kind-audio { border-top-color: #e24a7a; }
.rf-kind-character, .rf-kind-scene, .rf-kind-storyboard, .rf-kind-merge, .rf-kind-pdf, .rf-kind-table { border-top-color: #c059ff; }
.rf-dimmed { opacity: .22; }

.rf-handle {
  width: 7px !important;
  height: 7px !important;
  border: 1px solid #030303 !important;
  background: #2c85ff !important;
}

.rf-material-dock {
  position: absolute;
  left: 24px;
  bottom: 28px;
  z-index: 12;
  min-width: 98px;
  height: 40px;
  border: 1px solid #2b2b2b;
  background: #050505;
  color: #ffffff;
  font-weight: 900;
}

.rf-edge-strip {
  position: absolute;
  z-index: 12;
  left: 136px;
  bottom: 28px;
  max-width: 360px;
  max-height: 40px;
  overflow: hidden;
  display: flex;
  align-items: center;
  gap: 8px;
  color: #a8b3c4;
  font-size: 11px;
  pointer-events: none;
}

.rf-edge-strip div {
  display: flex;
  gap: 6px;
  overflow: hidden;
}

.rf-edge-strip span {
  flex: 0 0 auto;
  border: 1px solid #2b2b2b;
  background: #050505;
  color: #cbd5e1;
  padding: 5px 8px;
}

.rf-chat-panel {
  border-left: 1px solid #242424;
  display: grid;
  grid-template-rows: auto minmax(150px, 1fr) auto auto;
}

.rf-chat-head {
  height: 74px;
  border-bottom: 1px solid #202020;
  display: grid;
  grid-template-columns: 44px auto 1fr 36px 36px;
  align-items: center;
  gap: 8px;
  padding: 0 16px;
}

.rf-chat-head strong {
  color: #ffffff;
  font-size: 14px;
}

.rf-chat-head button {
  width: 36px;
}

.rf-chat-body {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 70px 20px 20px;
  overflow: auto;
  color: #b7d8ff;
  font-size: 13px;
}

.rf-chat-body p {
  margin: 0 0 12px;
}

.rf-node-details {
  margin: 0 16px 12px;
  border: 1px solid #242424;
  background: #050505;
  max-height: 300px;
  overflow: auto;
}

.rf-node-details summary {
  padding: 10px 12px;
  border-bottom: 1px solid #202020;
  color: #ffffff;
  font-weight: 900;
}

.rf-node-details > *:not(summary) {
  margin: 10px 12px;
}

.rf-field,
.rf-inspector-actions,
.rf-references {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.rf-field span,
.rf-references > span {
  color: #a8b3c4;
  font-size: 11px;
  font-weight: 900;
}

.rf-field input,
.rf-field select,
.rf-field textarea,
.rf-chat-compose textarea,
.rf-chat-compose select {
  width: 100%;
  border: 1px solid #2b2b2b;
  background: #050505;
  color: #ffffff;
  padding: 8px 9px;
}

.rf-field textarea {
  min-height: 74px;
  resize: vertical;
}

.rf-prop-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.rf-references div {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.rf-references b {
  border: 1px solid #2b2b2b;
  color: #cbd5e1;
  padding: 4px 7px;
  font-size: 11px;
}

.rf-inspector-actions button,
.rf-chat-compose button {
  min-height: 34px;
  border: 1px solid #2b2b2b;
  background: #050505;
  color: #ffffff;
  padding: 0 11px;
  font-weight: 900;
}

.rf-primary {
  border-color: #ffffff !important;
}

.rf-danger {
  color: #ff6b8a !important;
}

.rf-chat-compose {
  padding: 0 16px 14px;
  display: grid;
  grid-template-columns: 40px 1fr;
  gap: 10px;
}

.rf-chat-compose > button {
  height: 40px;
  align-self: start;
}

.rf-chat-compose textarea {
  min-height: 90px;
  resize: vertical;
}

.rf-chat-compose div {
  grid-column: 2;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}

@media (max-width: 1180px) {
  .rf-shell {
    grid-template-columns: 220px minmax(420px, 1fr) 280px;
  }

  .rf-basic-grid {
    gap: 9px;
  }
}

@media (max-width: 860px) {
  .workflow-root {
    height: auto;
  }

  .rf-shell {
    min-height: 100vh;
    grid-template-columns: 1fr;
  }

  .rf-center {
    min-height: 720px;
  }

  .rf-canvas-toolbar {
    position: static;
    padding: 12px;
    grid-template-columns: 1fr;
    background: #030303;
  }

  .rf-flow {
    top: 132px;
  }
}
