:root {
  color-scheme: dark;
  --bg: #08090d;
  --panel: rgba(21, 23, 31, 0.82);
  --panel-strong: rgba(27, 31, 42, 0.96);
  --stroke: rgba(255, 255, 255, 0.12);
  --stroke-strong: rgba(255, 255, 255, 0.22);
  --text: #f5f7fb;
  --muted: #99a3b7;
  --soft: #c8d0df;
  --blue: #6da8ff;
  --mint: #32d6a1;
  --amber: #ffb45a;
  --rose: #ff6f91;
  --danger: #ff5b68;
  --shadow: 0 22px 70px rgba(0, 0, 0, 0.42);
  font-family: Inter, "SF Pro Display", "Segoe UI", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
}

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

button {
  color: inherit;
}

.hidden {
  display: none !important;
}

.login-shell {
  position: relative;
  display: grid;
  min-height: 100vh;
  place-items: center;
  overflow: hidden;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.05), transparent 34%),
    #07080c;
}

.particle-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.color-field {
  position: absolute;
  filter: blur(72px);
  opacity: 0.6;
  transform: rotate(-12deg);
  border-radius: 34% 46% 30% 52%;
}

.field-a {
  width: 42vw;
  height: 30vh;
  left: 7vw;
  top: 18vh;
  background: rgba(109, 168, 255, 0.68);
  animation: drift-a 12s ease-in-out infinite alternate;
}

.field-b {
  width: 36vw;
  height: 34vh;
  right: 7vw;
  bottom: 16vh;
  background: rgba(50, 214, 161, 0.48);
  animation: drift-b 14s ease-in-out infinite alternate;
}

.field-c {
  width: 24vw;
  height: 24vh;
  right: 24vw;
  top: 9vh;
  background: rgba(255, 180, 90, 0.42);
  animation: drift-c 16s ease-in-out infinite alternate;
}

.login-card {
  position: relative;
  z-index: 2;
  width: min(410px, calc(100vw - 42px));
  padding: 34px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 24px;
  background: rgba(245, 247, 251, 0.1);
  box-shadow: var(--shadow);
  backdrop-filter: blur(28px) saturate(160%);
}

.brand-mark {
  display: grid;
  width: 48px;
  height: 48px;
  margin-bottom: 22px;
  place-items: center;
  border-radius: 15px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.82), rgba(255, 255, 255, 0.26));
}

.brand-mark span {
  width: 22px;
  height: 22px;
  border: 2px solid #12141d;
  border-radius: 8px;
  transform: rotate(45deg);
}

.login-card h1 {
  margin: 0;
  font-size: 34px;
  line-height: 1.05;
  letter-spacing: 0;
}

.login-subtitle {
  margin: 10px 0 26px;
  color: var(--soft);
}

.auth-form {
  display: grid;
  gap: 14px;
}

.auth-form.is-busy {
  opacity: 0.72;
  pointer-events: none;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 12px;
  outline: none;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
}

input,
select {
  height: 42px;
  padding: 0 12px;
}

textarea {
  min-height: 112px;
  padding: 12px;
  resize: vertical;
  line-height: 1.45;
}

input:focus,
textarea:focus,
select:focus {
  border-color: rgba(109, 168, 255, 0.72);
  box-shadow: 0 0 0 3px rgba(109, 168, 255, 0.16);
}

.primary-btn,
.tool-btn,
.icon-btn,
.text-btn {
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.16s ease, border-color 0.16s ease, background 0.16s ease;
}

.primary-btn {
  height: 44px;
  margin-top: 6px;
  border-radius: 13px;
  background: #f5f7fb;
  color: #0b0d13;
  font-weight: 700;
}

.primary-btn:hover,
.tool-btn:hover,
.icon-btn:hover {
  transform: translateY(-1px);
}

.auth-switch {
  display: flex;
  gap: 8px;
  margin-top: 18px;
}

.text-btn {
  padding: 8px 10px;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
}

.text-btn.active {
  background: rgba(255, 255, 255, 0.11);
  color: var(--text);
}

.auth-message {
  min-height: 36px;
  margin: 16px 0 0;
  padding: 9px 11px;
  border: 1px solid rgba(255, 180, 90, 0.22);
  border-radius: 10px;
  background: rgba(255, 180, 90, 0.07);
  color: var(--amber);
  font-size: 13px;
  line-height: 1.35;
}

.auth-message:empty {
  visibility: hidden;
}

.auth-message[data-tone="success"] {
  border-color: rgba(143, 240, 200, 0.28);
  background: rgba(50, 214, 161, 0.08);
  color: #8ff0c8;
}

.auth-message[data-tone="error"] {
  border-color: rgba(255, 137, 146, 0.3);
  background: rgba(255, 91, 104, 0.08);
  color: #ff8992;
  animation: auth-error-in 0.22s ease-out;
}

.auth-message[data-tone="working"] {
  border-color: rgba(109, 168, 255, 0.26);
  background: rgba(109, 168, 255, 0.08);
  color: #b8d0ff;
}

@keyframes auth-error-in {
  from { opacity: 0; transform: translateY(-3px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes drift-a {
  from { transform: translate3d(-2vw, -1vh, 0) rotate(-12deg) scale(1); }
  to { transform: translate3d(5vw, 4vh, 0) rotate(8deg) scale(1.12); }
}

@keyframes drift-b {
  from { transform: translate3d(3vw, 2vh, 0) rotate(8deg) scale(0.96); }
  to { transform: translate3d(-5vw, -3vh, 0) rotate(-10deg) scale(1.1); }
}

@keyframes drift-c {
  from { transform: translate3d(0, -2vh, 0) rotate(-8deg) scale(1); }
  to { transform: translate3d(-4vw, 5vh, 0) rotate(14deg) scale(1.18); }
}

.app-shell {
  position: relative;
  height: 100vh;
  overflow: hidden;
  background: #07080c;
}

.topbar {
  position: absolute;
  z-index: 40;
  top: 14px;
  left: 14px;
  right: 14px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto auto auto;
  gap: 12px;
  align-items: center;
  min-height: 54px;
  padding: 8px 10px;
  border: 1px solid var(--stroke);
  border-radius: 16px;
  background: rgba(16, 18, 25, 0.78);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.topbar-left,
.topbar-tools,
.usage-pill {
  display: flex;
  align-items: center;
  gap: 8px;
}

.app-title {
  display: grid;
  gap: 2px;
}

.app-title strong {
  font-size: 13px;
}

.app-title span {
  color: var(--muted);
  font-size: 12px;
}

.topbar-tools {
  justify-content: flex-end;
}

.tool-btn,
.icon-btn {
  height: 36px;
  border-color: var(--stroke);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.07);
}

.tool-btn {
  padding: 0 13px;
  white-space: nowrap;
}

.tool-btn.save-conflict {
  border-color: rgba(255, 137, 146, 0.48);
  background: rgba(255, 91, 104, 0.12);
  color: #ffb4ba;
}

.icon-btn {
  width: 36px;
  padding: 0;
  font-size: 18px;
  line-height: 1;
}

.usage-pill {
  height: 36px;
  padding: 0 14px;
  border: 1px solid rgba(109, 168, 255, 0.25);
  border-radius: 999px;
  background: rgba(109, 168, 255, 0.1);
  color: var(--muted);
  font-size: 12px;
}

.usage-pill strong {
  color: var(--text);
}

.task-menu {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: flex-end;
}

.task-list-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
}

.task-count {
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: rgba(50, 214, 161, 0.18);
  color: #b9ffe6;
  font-size: 11px;
  line-height: 20px;
  text-align: center;
}

.task-panel {
  position: absolute;
  z-index: 180;
  top: calc(100% + 10px);
  right: 0;
  width: min(420px, calc(100vw - 28px));
  max-height: min(560px, calc(100vh - 98px));
  overflow: auto;
  padding: 12px;
  border: 1px solid var(--stroke);
  border-radius: 14px;
  background: rgba(14, 16, 23, 0.96);
  box-shadow: var(--shadow);
  backdrop-filter: blur(20px);
}

.task-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.task-panel-head strong {
  font-size: 13px;
}

.task-panel-head span,
.task-row small {
  color: var(--muted);
  font-size: 11px;
}

.task-list {
  display: grid;
  gap: 8px;
}

.task-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px 10px;
  min-width: 0;
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.045);
}

.task-row strong,
.task-row span,
.task-row small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.task-row strong {
  font-size: 12px;
}

.task-row span {
  color: var(--muted);
  font-size: 11px;
}

.progress-bar {
  position: relative;
  overflow: hidden;
  height: 8px;
  min-width: 120px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.075);
}

.progress-bar span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, rgba(109, 168, 255, 0.95), rgba(50, 214, 161, 0.95));
  transition: width 0.22s ease;
}

.progress-bar em {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: rgba(255, 255, 255, 0.78);
  font-style: normal;
  font-size: 9px;
  line-height: 1;
}

.task-progress {
  grid-column: 1 / -1;
  width: 100%;
  margin-top: 8px;
}

.task-status {
  align-self: start;
  padding: 3px 7px;
  border-radius: 999px;
  background: rgba(109, 168, 255, 0.14);
  color: #cfe1ff;
  font-size: 11px;
}

.task-actions {
  display: grid;
  justify-items: end;
  gap: 7px;
}

.task-download {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  height: 24px;
  padding: 0 9px;
  border: 1px solid rgba(50, 214, 161, 0.38);
  border-radius: 999px;
  background: rgba(50, 214, 161, 0.12);
  color: #b9ffe6;
  font-size: 11px;
  font-weight: 700;
  text-decoration: none;
}

.task-download:hover {
  border-color: rgba(50, 214, 161, 0.68);
  background: rgba(50, 214, 161, 0.2);
}

.task-row.completed .task-status {
  background: rgba(50, 214, 161, 0.16);
  color: #a9f4d8;
}

.task-row.failed .task-status {
  background: rgba(255, 91, 104, 0.16);
  color: #ffb4bc;
}

.task-row.waiting_external .task-status {
  background: rgba(255, 184, 107, 0.16);
  color: #ffd7a6;
}

.task-row.blocked .task-status {
  background: rgba(255, 184, 107, 0.14);
  color: #ffd7a6;
}

.side-panel {
  position: absolute;
  z-index: 30;
  top: 84px;
  left: 14px;
  bottom: 14px;
  width: 258px;
  padding: 12px;
  border: 1px solid var(--stroke);
  border-radius: 16px;
  background: rgba(15, 17, 24, 0.74);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
  overflow: auto;
}

.panel-tabs {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
  margin-bottom: 12px;
}

.panel-tabs button {
  height: 34px;
  border: 1px solid var(--stroke);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--muted);
}

.panel-tabs button.active {
  border-color: rgba(109, 168, 255, 0.45);
  background: rgba(109, 168, 255, 0.14);
  color: var(--text);
}

.side-section {
  display: grid;
  gap: 8px;
}

.node-palette-item,
.asset-row,
.admin-row,
.workflow-row {
  border: 1px solid var(--stroke);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.05);
}

.node-palette-item {
  display: grid;
  gap: 4px;
  padding: 10px;
  cursor: grab;
}

.node-palette-item strong {
  font-size: 13px;
}

.node-palette-item span,
.asset-row span,
.admin-row span,
.workflow-row span,
.workflow-row small {
  color: var(--muted);
  font-size: 12px;
}

.workflow-create-btn {
  width: 100%;
  margin-bottom: 8px;
  border-color: rgba(109, 168, 255, 0.26);
  background: rgba(109, 168, 255, 0.1);
}

.workflow-list {
  display: grid;
  gap: 8px;
}

.workflow-owner-group {
  display: grid;
  gap: 8px;
}

.workflow-owner-separator {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 2px 2px 0;
  color: var(--muted);
  font-size: 11px;
}

.workflow-owner-separator strong {
  color: rgba(230, 236, 255, 0.8);
  font-size: 11px;
}

.workflow-owner-badge {
  width: max-content;
  max-width: 100%;
  padding: 2px 7px;
  border: 1px solid rgba(54, 215, 183, 0.34);
  border-radius: 999px;
  color: #8af0d6;
  background: rgba(54, 215, 183, 0.09);
  font-size: 10px;
  font-style: normal;
  font-weight: 800;
  letter-spacing: 0;
  overflow-wrap: anywhere;
}

.workflow-row {
  display: grid;
  grid-template-columns: 1fr 28px;
  align-items: center;
  gap: 8px;
  padding: 10px;
  text-align: left;
}

.workflow-open {
  display: grid;
  gap: 4px;
  min-width: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  text-align: left;
}

.workflow-row strong {
  color: var(--text);
  font-size: 13px;
}

.workflow-open strong,
.workflow-open span,
.workflow-open small {
  overflow-wrap: anywhere;
}

.workflow-delete-btn {
  width: 28px;
  height: 28px;
  min-height: 28px;
  padding: 0;
  border-radius: 7px;
  color: var(--muted);
}

.workflow-delete-btn:hover {
  border-color: rgba(255, 111, 145, 0.42);
  background: rgba(255, 111, 145, 0.12);
  color: #ffd7e0;
}

.workflow-row.active {
  border-color: rgba(109, 168, 255, 0.55);
  background: rgba(109, 168, 255, 0.14);
}

.side-hint {
  margin-top: 12px;
  color: var(--muted);
  font-size: 11px;
}

.asset-row {
  display: grid;
  grid-template-columns: 46px 1fr;
  gap: 9px;
  align-items: center;
  padding: 7px;
}

.asset-row-manage {
  grid-template-columns: minmax(0, 1fr) auto;
  padding: 6px;
}

.asset-open-btn {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr);
  gap: 9px;
  align-items: center;
  min-width: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: zoom-in;
}

.asset-row img,
.asset-row video,
.asset-row .thumb-frame {
  width: 46px;
  height: 36px;
  object-fit: cover;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
}

.asset-row img[data-lazy-src],
.node-preview img[data-lazy-src] {
  opacity: 0.72;
  filter: blur(5px);
  background:
    linear-gradient(135deg, rgba(109, 168, 255, 0.12), rgba(50, 214, 161, 0.1)),
    rgba(255, 255, 255, 0.06);
}

.import-drop-zone {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 42px;
  margin-top: 10px;
  padding: 7px 10px;
  border: 1px dashed rgba(109, 168, 255, 0.38);
  border-radius: 8px;
  background: rgba(109, 168, 255, 0.08);
  color: var(--soft);
  text-align: left;
}

.import-drop-zone:hover,
.node.file-drag-over .import-drop-zone {
  border-color: rgba(50, 214, 161, 0.82);
  background: rgba(50, 214, 161, 0.12);
  color: var(--text);
}

.upload-glyph {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--green);
  font-size: 20px;
  line-height: 1;
}

.node-upload-input {
  display: none;
}

.canvas-shell {
  position: absolute;
  inset: 0;
  overflow: hidden;
  cursor: default;
}

.canvas-shell.canvas-file-drag-over::after {
  content: "";
  position: absolute;
  inset: 12px;
  z-index: 80;
  pointer-events: none;
  border: 2px dashed rgba(50, 214, 161, 0.84);
  border-radius: 8px;
  background: rgba(50, 214, 161, 0.045);
  box-shadow: inset 0 0 48px rgba(50, 214, 161, 0.08);
}

.grid-layer {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.055) 1px, transparent 1px),
    linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
  background-size: 80px 80px, 80px 80px, 16px 16px, 16px 16px;
  background-position: var(--grid-x, 0) var(--grid-y, 0);
}

.world {
  position: absolute;
  left: 0;
  top: 0;
  width: 0;
  height: 0;
  transform-origin: 0 0;
}

.edge-layer {
  position: absolute;
  left: -50000px;
  top: -50000px;
  width: 100000px;
  height: 100000px;
  overflow: visible;
  pointer-events: none;
}

.edge-path {
  fill: none;
  stroke: rgba(123, 171, 255, 0.68);
  stroke-width: 3;
  pointer-events: stroke;
  cursor: pointer;
}

.edge-path.selected {
  stroke: var(--amber);
}

.edge-hit {
  fill: none;
  stroke: transparent;
  stroke-width: 18;
  pointer-events: stroke;
  cursor: pointer;
}

.nodes-layer {
  position: absolute;
  left: 0;
  top: 0;
  overflow: visible;
}

.node {
  position: absolute;
  width: 310px;
  min-height: 126px;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 8px;
  background: rgba(20, 23, 31, 0.95);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(12px);
  user-select: none;
}

.node.selected {
  border-color: rgba(109, 168, 255, 0.82);
  box-shadow: 0 0 0 2px rgba(109, 168, 255, 0.22), 0 18px 44px rgba(0, 0, 0, 0.35);
}

.node.connection-drop-target {
  border-color: rgba(255, 180, 90, 0.9);
  box-shadow: 0 0 0 3px rgba(255, 180, 90, 0.2), 0 18px 44px rgba(0, 0, 0, 0.35);
}

.node.file-drag-over {
  border-color: rgba(50, 214, 161, 0.9);
  box-shadow: 0 0 0 3px rgba(50, 214, 161, 0.22), 0 18px 44px rgba(0, 0, 0, 0.35);
}

.node.running {
  border-color: rgba(50, 214, 161, 0.72);
}

.node.waiting_external {
  border-color: rgba(109, 168, 255, 0.76);
}

.node.failed {
  border-color: rgba(255, 91, 104, 0.8);
}

.node-head {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
  min-height: 42px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--stroke);
}

.node-title {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.node-title strong {
  overflow: hidden;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.node-title span {
  color: var(--muted);
  font-size: 11px;
}

.node-run {
  width: 30px;
  height: 30px;
  border: 1px solid rgba(50, 214, 161, 0.32);
  border-radius: 9px;
  background: rgba(50, 214, 161, 0.1);
  color: var(--mint);
  cursor: pointer;
}

.node-run:disabled {
  opacity: 0.46;
  cursor: wait;
  filter: grayscale(0.35);
}

.node-body {
  display: grid;
  gap: 8px;
  padding: 10px;
  color: var(--soft);
  font-size: 12px;
}

.node-preview {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.node-preview-item {
  position: relative;
  min-width: 0;
}

.node-preview .asset-preview-btn {
  position: relative;
  width: 100%;
  height: 58px;
  padding: 0;
  border: 1px solid var(--stroke);
  border-radius: 8px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.06);
  cursor: zoom-in;
}

.asset-remove-btn,
.asset-remove-list-btn {
  border: 1px solid rgba(255, 111, 145, 0.4);
  background: rgba(255, 111, 145, 0.14);
  color: #ffd7e0;
  cursor: pointer;
}

.asset-remove-btn {
  position: absolute;
  top: 4px;
  right: 4px;
  z-index: 2;
  width: 22px;
  height: 22px;
  padding: 0;
  border-radius: 999px;
  font-size: 14px;
  line-height: 18px;
}

.asset-remove-list-btn {
  min-height: 28px;
  padding: 0 9px;
  border-radius: 8px;
  font-size: 12px;
}

.asset-remove-btn:hover,
.asset-remove-list-btn:hover {
  border-color: rgba(255, 111, 145, 0.72);
  background: rgba(255, 111, 145, 0.22);
}

.node-preview img,
.node-preview video,
.node-preview .thumb-frame {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.thumb-frame {
  display: block;
  position: relative;
  overflow: hidden;
}

.thumb-frame img,
.thumb-frame video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.video-thumb-badge {
  position: absolute;
  right: 5px;
  top: 5px;
  display: grid;
  width: 18px;
  height: 18px;
  place-items: center;
  border: 1px solid rgba(245, 247, 251, 0.34);
  border-radius: 999px;
  background: rgba(5, 7, 12, 0.72);
  color: #ffffff;
  font-size: 9px;
  line-height: 1;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.28);
}

.asset-meta-chip {
  position: absolute;
  left: 4px;
  right: 4px;
  bottom: 4px;
  padding: 2px 4px;
  border-radius: 5px;
  background: rgba(5, 7, 12, 0.72);
  color: #f5f7fb;
  font-size: 9px;
  line-height: 1.15;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  backdrop-filter: blur(8px);
}

.port {
  position: absolute;
  width: 20px;
  height: 20px;
  border: 2px solid #0b0d13;
  border-radius: 50%;
  background: var(--blue);
  cursor: crosshair;
}

.port.input {
  left: -10px;
}

.port.output {
  right: -10px;
  background: var(--mint);
}

.port[data-index="0"] {
  top: 50px;
}

.port[data-index="1"] {
  top: 78px;
}

.port[data-index="2"] {
  top: 106px;
}

.port[data-index="3"] {
  top: 134px;
}

.port-label {
  position: absolute;
  color: var(--muted);
  font-size: 10px;
  pointer-events: none;
}

.port-label.input {
  left: 12px;
}

.port-label.output {
  right: 12px;
}

.selection-box {
  position: absolute;
  z-index: 20;
  border: 1px solid rgba(109, 168, 255, 0.85);
  background: rgba(109, 168, 255, 0.12);
  pointer-events: none;
}

.overlay-layer {
  position: absolute;
  z-index: 25;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.context-menu,
.at-menu {
  position: absolute;
  z-index: 80;
  min-width: 210px;
  padding: 8px;
  border: 1px solid var(--stroke);
  border-radius: 14px;
  background: rgba(20, 22, 30, 0.96);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.context-menu button,
.at-menu button {
  display: grid;
  width: 100%;
  gap: 3px;
  padding: 9px 10px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.context-menu button:hover,
.at-menu button:hover {
  background: rgba(255, 255, 255, 0.08);
}

.context-menu button:disabled {
  cursor: default;
  opacity: 0.58;
}

.context-menu button:disabled:hover {
  background: transparent;
}

.menu-caption {
  padding: 5px 9px 8px;
  color: var(--muted);
  font-size: 11px;
}

.context-menu span,
.at-menu span {
  color: var(--muted);
  font-size: 11px;
}

.ghost-node {
  position: absolute;
  z-index: 70;
  width: 300px;
  min-height: 86px;
  border: 1px dashed rgba(109, 168, 255, 0.7);
  border-radius: 8px;
  background: rgba(109, 168, 255, 0.12);
  pointer-events: none;
}

.param-panel {
  position: absolute;
  z-index: 60;
  width: 322px;
  max-height: min(620px, calc(100vh - 120px));
  overflow: auto;
  padding: 14px;
  border: 1px solid var(--stroke);
  border-radius: 16px;
  background: rgba(18, 20, 28, 0.94);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.param-panel h2 {
  margin: 0 0 12px;
  font-size: 15px;
}

.param-grid {
  display: grid;
  gap: 12px;
}

.param-actions,
.inline-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.input-action {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.input-action .small-btn {
  white-space: nowrap;
}

.small-btn {
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid var(--stroke);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.07);
  color: var(--text);
  cursor: pointer;
}

.file-drop {
  display: grid;
  gap: 8px;
  min-height: 92px;
  padding: 12px;
  border: 1px dashed rgba(255, 255, 255, 0.24);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.05);
  place-items: center;
  text-align: center;
  color: var(--muted);
}

.file-drop input {
  height: auto;
  padding: 0;
  border: 0;
  background: transparent;
}

.file-drop.file-drag-over {
  border-color: rgba(50, 214, 161, 0.82);
  background: rgba(50, 214, 161, 0.1);
  color: var(--text);
}

.form-hint {
  margin-top: -4px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.toast {
  position: absolute;
  z-index: 120;
  left: 50%;
  bottom: 26px;
  transform: translateX(-50%);
  max-width: min(540px, calc(100vw - 40px));
  padding: 10px 14px;
  border: 1px solid var(--stroke);
  border-radius: 12px;
  background: rgba(18, 20, 28, 0.94);
  color: var(--soft);
  box-shadow: var(--shadow);
}

.preview-modal {
  position: absolute;
  z-index: 140;
  left: 24px;
  top: 92px;
  width: min(620px, calc(100vw - 32px));
  height: min(460px, calc(100vh - 112px));
  display: grid;
  grid-template-rows: 54px minmax(0, 1fr);
  border: 1px solid var(--stroke-strong);
  border-radius: 18px;
  background: rgba(7, 8, 12, 0.94);
  box-shadow: var(--shadow);
  backdrop-filter: blur(22px);
  overflow: hidden;
}

.preview-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 12px;
  border-bottom: 1px solid var(--stroke);
  cursor: move;
  user-select: none;
}

.preview-toolbar > div {
  display: flex;
  align-items: center;
  gap: 8px;
}

.preview-stage {
  position: relative;
  overflow: hidden;
  display: grid;
  place-items: center;
  min-height: 0;
  background:
    linear-gradient(45deg, rgba(255, 255, 255, 0.035) 25%, transparent 25%),
    linear-gradient(-45deg, rgba(255, 255, 255, 0.035) 25%, transparent 25%),
    rgba(4, 6, 10, 0.42);
  background-size: 28px 28px;
}

.preview-stage img,
.preview-stage video,
.preview-stage audio,
.preview-text {
  max-width: none;
  max-height: none;
  transform-origin: center;
  border-radius: 10px;
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.45);
}

.preview-stage audio {
  width: min(460px, calc(100% - 32px));
}

.preview-text {
  width: calc(100% - 28px);
  max-height: calc(100% - 28px);
  margin: 0;
  padding: 14px;
  overflow: auto;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  background: rgba(7, 9, 14, 0.92);
  color: var(--soft);
  font: 12px/1.55 Consolas, "SFMono-Regular", monospace;
}

.preview-resize-handle {
  position: absolute;
  right: 0;
  bottom: 0;
  z-index: 2;
  width: 22px;
  height: 22px;
  cursor: nwse-resize;
}

.preview-resize-handle::before {
  content: "";
  position: absolute;
  right: 7px;
  bottom: 7px;
  width: 9px;
  height: 9px;
  border-right: 2px solid rgba(255, 255, 255, 0.52);
  border-bottom: 2px solid rgba(255, 255, 255, 0.52);
}

.admin-panel {
  position: absolute;
  z-index: 130;
  top: 84px;
  right: 14px;
  bottom: 14px;
  width: min(920px, calc(100vw - 28px));
  padding: 14px;
  border: 1px solid var(--stroke);
  border-radius: 18px;
  background: rgba(15, 17, 24, 0.96);
  box-shadow: var(--shadow);
  overflow: auto;
}

.admin-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}

.admin-summary {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.admin-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
  padding: 4px;
  margin-bottom: 12px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.16);
}

.admin-tabs button {
  min-width: 0;
  min-height: 34px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}

.admin-tabs button.active {
  background: rgba(109, 168, 255, 0.18);
  color: var(--text);
  box-shadow: inset 0 0 0 1px rgba(109, 168, 255, 0.18);
}

.admin-card {
  min-width: 0;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.045);
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

button.admin-card:hover {
  border-color: rgba(109, 168, 255, 0.36);
  background: rgba(109, 168, 255, 0.09);
}

.admin-card.attention {
  border-color: rgba(255, 189, 90, 0.32);
  background: rgba(255, 189, 90, 0.07);
}

.admin-card.wide {
  grid-column: span 1;
}

.admin-card span,
.admin-card small {
  display: block;
  overflow-wrap: anywhere;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.admin-card strong {
  display: block;
  margin: 5px 0 3px;
  overflow-wrap: anywhere;
  color: var(--text);
  font-size: 18px;
  line-height: 1.1;
}

.admin-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
}

.admin-grid > section,
.admin-grid > details {
  display: none;
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--stroke);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
}

.admin-grid > .admin-section.active {
  display: grid;
  gap: 10px;
}

.admin-grid h2,
.admin-grid summary {
  margin: 0 0 12px;
  font-size: 14px;
  color: var(--text);
  font-weight: 760;
}

.admin-grid summary {
  cursor: pointer;
  list-style: none;
}

.admin-grid summary::-webkit-details-marker {
  display: none;
}

.admin-grid details:not([open]) summary {
  margin-bottom: 0;
}

.admin-list,
.settings-form {
  display: grid;
  gap: 8px;
}

.admin-tools {
  display: grid;
  gap: 8px;
}

.segmented-control {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 4px;
  padding: 4px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.14);
}

.segmented-control button {
  min-width: 0;
  min-height: 30px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}

.segmented-control button.active {
  background: rgba(109, 168, 255, 0.18);
  color: var(--text);
}

.admin-search {
  min-height: 34px;
}

.admin-workflow-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
}

.admin-workflow-summary span {
  min-width: 0;
  padding: 6px 7px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  font-size: 11px;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.admin-workflow-direct-list {
  display: grid;
  gap: 7px;
  padding: 8px;
  border: 1px solid rgba(109, 168, 255, 0.18);
  border-radius: 10px;
  background: rgba(109, 168, 255, 0.055);
}

.admin-workflow-direct-row {
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) auto;
  align-items: center;
  border-color: rgba(109, 168, 255, 0.22);
}

.admin-workflow-owner {
  color: var(--mint);
  font-weight: 760;
}

.admin-workflow-separator {
  color: var(--muted);
  font-weight: 560;
}

.admin-row {
  display: grid;
  gap: 8px;
  padding: 9px;
}

.settings-note {
  display: grid;
  gap: 4px;
  padding: 9px;
  border: 1px solid rgba(109, 168, 255, 0.18);
  border-radius: 8px;
  background: rgba(109, 168, 255, 0.07);
}

.settings-note strong {
  color: var(--text);
  font-size: 12px;
}

.settings-note span {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

.capability-hint {
  display: grid;
  gap: 4px;
  grid-column: 1 / -1;
  padding: 9px 10px;
  border: 1px solid rgba(50, 214, 161, 0.18);
  border-radius: 8px;
  background: rgba(50, 214, 161, 0.065);
}

.capability-hint strong {
  color: var(--text);
  font-size: 12px;
}

.capability-hint span {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

.admin-user-workflows {
  display: grid;
  gap: 8px;
  padding: 8px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.035);
}

.admin-user-workflows summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  margin: 0;
  cursor: pointer;
}

.admin-user-workflows summary strong {
  min-width: 0;
  overflow-wrap: anywhere;
  color: var(--text);
  font-size: 13px;
}

.admin-user-workflows summary span {
  color: var(--muted);
  font-size: 11px;
}

.admin-workflow-group-list {
  display: grid;
  gap: 7px;
  margin-top: 8px;
}

.admin-user-row.status-pending {
  border-color: rgba(255, 189, 90, 0.26);
  background: rgba(255, 189, 90, 0.055);
}

.admin-workflow-row.active {
  border-color: rgba(50, 214, 161, 0.28);
  background: rgba(50, 214, 161, 0.055);
}

.admin-workflow-row.attention:not(.active) {
  border-color: rgba(255, 180, 90, 0.24);
  background: rgba(255, 180, 90, 0.045);
}

.admin-workflow-row strong span {
  color: var(--muted);
  font-weight: 560;
}

.admin-row strong {
  font-size: 13px;
}

.status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 6px;
  border-radius: 50%;
  background: var(--muted);
}

.status-dot.live {
  background: var(--mint);
}

.cut-mode .canvas-shell {
  cursor: crosshair;
}

@media (max-width: 920px) {
  .topbar {
    grid-template-columns: auto minmax(54px, 1fr) auto auto;
  }

  .topbar-tools {
    display: none;
  }

  .side-panel {
    width: 230px;
  }

  .admin-grid {
    grid-template-columns: 1fr;
  }

  .admin-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .usage-pill {
    display: none;
  }

  .task-panel {
    right: -52px;
  }
}

@media (max-width: 620px) {
  .app-title { display: none; }
  .side-panel {
    top: 76px;
    left: 8px;
    right: auto;
    bottom: 8px;
    display: block;
    width: min(310px, calc(100vw - 16px));
    background: #0e1119;
    box-shadow: 0 0 0 100vmax rgba(3, 5, 9, 0.52), var(--shadow);
  }

  .topbar {
    left: 8px;
    right: 8px;
    top: 8px;
    gap: 8px;
  }

  .task-list-btn {
    min-width: 48px;
    padding: 0 8px;
  }

  .task-panel {
    right: -72px;
    width: calc(100vw - 16px);
  }

  .admin-summary,
  .admin-tabs,
  .segmented-control {
    grid-template-columns: 1fr;
  }

  .preview-modal {
    inset: 10px;
  }
}

/* Production polish layer */
:root {
  --chrome: rgba(12, 14, 20, 0.88);
  --chrome-strong: rgba(15, 18, 26, 0.96);
  --surface: rgba(22, 25, 34, 0.94);
  --surface-raised: rgba(27, 31, 42, 0.98);
  --hairline: rgba(255, 255, 255, 0.1);
  --hairline-strong: rgba(255, 255, 255, 0.18);
  --focus: rgba(112, 167, 255, 0.42);
  --workbench-shadow: 0 14px 42px rgba(0, 0, 0, 0.36);
}

.app-shell {
  background:
    radial-gradient(circle at 24% 18%, rgba(109, 168, 255, 0.12), transparent 28%),
    radial-gradient(circle at 76% 72%, rgba(50, 214, 161, 0.08), transparent 26%),
    linear-gradient(180deg, #090b12, #06070b 64%);
}

.topbar {
  min-height: 58px;
  padding: 8px 12px;
  border-radius: 10px;
  border-color: rgba(255, 255, 255, 0.14);
  background: linear-gradient(180deg, rgba(21, 24, 33, 0.92), rgba(13, 15, 22, 0.9));
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.32);
}

.app-title strong {
  font-size: 12px;
  letter-spacing: 0.08em;
  color: #ffffff;
}

.app-title span {
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tool-btn,
.icon-btn,
.small-btn,
.panel-tabs button {
  border-radius: 8px;
}

.tool-btn {
  height: 34px;
  border-color: rgba(255, 255, 255, 0.12);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.09), rgba(255, 255, 255, 0.045));
  color: #edf2ff;
}

.tool-btn.primary-tool {
  border-color: rgba(50, 214, 161, 0.42);
  background: linear-gradient(180deg, rgba(50, 214, 161, 0.26), rgba(50, 214, 161, 0.11));
  color: #eafff6;
  font-weight: 700;
}

.tool-btn.compact-tool {
  min-width: 54px;
  padding: 0 11px;
}

.icon-btn {
  border-color: rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.055);
}

.usage-pill {
  height: 34px;
  border-radius: 8px;
  background: rgba(7, 9, 15, 0.62);
  border-color: rgba(255, 255, 255, 0.12);
}

.usage-pill span {
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 10px;
}

.side-panel,
.admin-panel,
.task-panel,
.param-panel,
.context-menu,
.at-menu,
.preview-modal {
  border-radius: 10px;
  border-color: rgba(255, 255, 255, 0.13);
  background: var(--chrome);
  box-shadow: var(--workbench-shadow);
}

.side-panel {
  width: 276px;
  padding: 10px;
  background: linear-gradient(180deg, rgba(18, 21, 30, 0.9), rgba(10, 12, 18, 0.84));
}

.panel-tabs {
  padding: 3px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 9px;
  background: rgba(0, 0, 0, 0.18);
}

.panel-tabs button {
  height: 32px;
  border: 0;
  background: transparent;
}

.panel-tabs button.active {
  background: rgba(255, 255, 255, 0.1);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.side-caption {
  margin: 3px 2px 2px;
  color: #778198;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.node-palette-item {
  grid-template-columns: 28px 1fr;
  align-items: center;
  min-height: 62px;
  padding: 10px;
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.075), rgba(255, 255, 255, 0.035));
}

.node-palette-item:hover {
  border-color: color-mix(in srgb, var(--node-color) 48%, rgba(255, 255, 255, 0.16));
  background: linear-gradient(180deg, color-mix(in srgb, var(--node-color) 14%, rgba(255, 255, 255, 0.06)), rgba(255, 255, 255, 0.035));
}

.palette-swatch {
  width: 18px;
  height: 18px;
  border-radius: 6px;
  background: var(--node-color);
  box-shadow: 0 0 22px color-mix(in srgb, var(--node-color) 55%, transparent);
}

.palette-copy {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.palette-copy strong {
  font-size: 13px;
}

.palette-copy small {
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.empty-state {
  display: grid;
  gap: 6px;
  padding: 14px;
  border: 1px dashed rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.035);
}

.empty-state strong {
  font-size: 13px;
}

.empty-state span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.canvas-shell {
  background:
    linear-gradient(rgba(255, 255, 255, 0.018), rgba(255, 255, 255, 0)),
    transparent;
}

.grid-layer {
  opacity: 0.9;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.06) 1px, transparent 1px),
    linear-gradient(rgba(255, 255, 255, 0.022) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.022) 1px, transparent 1px);
}

.edge-path {
  stroke: rgba(110, 168, 255, 0.72);
  stroke-width: 2.4;
  filter: drop-shadow(0 0 5px rgba(109, 168, 255, 0.24));
}

.edge-path.selected {
  stroke: #ffca72;
  stroke-width: 3.2;
}

.node {
  min-height: 148px;
  border-radius: 8px;
  border-color: rgba(255, 255, 255, 0.14);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.055), rgba(255, 255, 255, 0.018)),
    rgba(20, 24, 34, 0.97);
  box-shadow: 0 18px 45px rgba(0, 0, 0, 0.32), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.node::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.025);
}

.node-accent {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  border-radius: 8px 8px 0 0;
  background: linear-gradient(90deg, var(--node-color), transparent 76%);
}

.node.selected {
  border-color: color-mix(in srgb, var(--node-color) 68%, #ffffff);
  box-shadow:
    0 0 0 3px color-mix(in srgb, var(--node-color) 18%, transparent),
    0 20px 52px rgba(0, 0, 0, 0.4);
}

.node.running {
  border-color: rgba(50, 214, 161, 0.76);
}

.node.waiting_external {
  border-color: rgba(109, 168, 255, 0.78);
}

.node.failed {
  border-color: rgba(255, 91, 104, 0.86);
}

.node-head {
  min-height: 56px;
  grid-template-columns: 1fr auto;
  padding: 12px 12px 10px;
  border-bottom-color: rgba(255, 255, 255, 0.08);
}

.node-title {
  gap: 4px;
}

.node-kicker {
  width: max-content;
  padding: 2px 7px;
  border: 1px solid color-mix(in srgb, var(--node-color) 38%, rgba(255, 255, 255, 0.12));
  border-radius: 999px;
  background: color-mix(in srgb, var(--node-color) 12%, rgba(255, 255, 255, 0.04));
  color: color-mix(in srgb, var(--node-color) 48%, #ffffff);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.node-title strong {
  font-size: 15px;
  line-height: 1.1;
}

.node-head-actions {
  display: grid;
  justify-items: end;
  align-self: start;
  gap: 6px;
}

.node-status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--muted);
  font-size: 11px;
}

.node-status i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--node-color);
  box-shadow: 0 0 12px var(--node-color);
}

.node-run {
  width: 30px;
  height: 30px;
  padding: 0;
  border-radius: 8px;
  border-color: color-mix(in srgb, var(--node-color) 42%, rgba(255, 255, 255, 0.14));
  background: color-mix(in srgb, var(--node-color) 16%, rgba(255, 255, 255, 0.055));
  color: #ffffff;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
}

.node-body {
  gap: 10px;
  padding: 11px 12px 12px;
}

.node-summary {
  min-height: 34px;
  color: #cdd5e7;
  font-size: 12px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.node-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.node-metrics span {
  max-width: 100%;
  padding: 3px 7px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.045);
  color: #9fa9bd;
  font-size: 11px;
  overflow-wrap: anywhere;
}

.node-metrics .execution-badge {
  border-color: rgba(255, 255, 255, 0.16);
  font-weight: 800;
  letter-spacing: 0.05em;
}

.node-progress {
  width: 100%;
  margin-top: 10px;
}

.node-progress-stage {
  margin-top: 10px;
  color: #aeb8ca;
  font-size: 12px;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.execution-badge.exec-live {
  border-color: rgba(50, 214, 161, 0.42);
  background: rgba(50, 214, 161, 0.12);
  color: #9ff7d8;
}

.execution-badge.exec-mock {
  border-color: rgba(255, 189, 90, 0.42);
  background: rgba(255, 189, 90, 0.12);
  color: #ffd89b;
}

.execution-badge.exec-waiting {
  border-color: rgba(109, 168, 255, 0.42);
  background: rgba(109, 168, 255, 0.12);
  color: #b9d4ff;
}

.execution-badge.exec-blocked {
  border-color: rgba(255, 184, 107, 0.42);
  background: rgba(255, 184, 107, 0.12);
  color: #ffd7a6;
}

.execution-badge.exec-failed {
  border-color: rgba(255, 91, 104, 0.42);
  background: rgba(255, 91, 104, 0.12);
  color: #ff9aa3;
}

.execution-badge.exec-ready {
  border-color: rgba(203, 213, 231, 0.24);
  background: rgba(203, 213, 231, 0.08);
  color: #cbd7ea;
}

.port {
  width: 20px;
  height: 20px;
  border: 3px solid #090b12;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.18), 0 0 14px color-mix(in srgb, var(--node-color) 40%, transparent);
}

.port[data-index="0"] {
  top: 64px;
}

.port[data-index="1"] {
  top: 90px;
}

.port[data-index="2"] {
  top: 116px;
}

.port[data-index="3"] {
  top: 142px;
}

.port.input {
  left: -10px;
}

.port.output {
  right: -10px;
}

.port-label {
  position: absolute;
  z-index: 6;
  white-space: nowrap;
  pointer-events: none;
  padding: 2px 5px;
  border-radius: 999px;
  background: rgba(9, 11, 18, 0.86);
  color: rgba(221, 229, 244, 0.9);
  font-size: 10px;
  opacity: 0;
  transform: translateY(-50%);
  transition: opacity 120ms ease, transform 120ms ease;
}

.port-label.input {
  left: auto;
  right: calc(100% + 12px);
  text-align: right;
}

.port-label.output {
  right: auto;
  left: calc(100% + 12px);
  text-align: left;
}

.node:hover .port-label,
.node:focus-within .port-label,
.node.selected .port-label {
  opacity: 0.88;
}

.node:focus-visible {
  outline: 2px solid rgba(109, 168, 255, 0.9);
  outline-offset: 4px;
}

.port:focus-visible,
button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 2px solid rgba(109, 168, 255, 0.9);
  outline-offset: 2px;
}

.node:hover .port-label.input,
.node:focus-within .port-label.input,
.node.selected .port-label.input {
  transform: translate(-2px, -50%);
}

.node:hover .port-label.output,
.node:focus-within .port-label.output,
.node.selected .port-label.output {
  transform: translate(2px, -50%);
}

.node-preview {
  grid-template-columns: repeat(3, 1fr);
}

.node-preview .asset-preview-btn {
  height: 64px;
  border-radius: 7px;
  border-color: rgba(255, 255, 255, 0.12);
}

.param-panel {
  width: min(560px, calc(100vw - 32px));
  padding: 0;
  overflow: visible;
  transform: scale(var(--param-panel-scale, 1));
  transform-origin: top left;
  background: linear-gradient(180deg, rgba(24, 28, 38, 0.96), rgba(13, 15, 22, 0.94));
  border-radius: 10px;
}

.param-head {
  z-index: 2;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 15px 16px 13px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(18, 21, 30, 0.96);
  backdrop-filter: blur(18px);
}

.param-kicker {
  display: inline-flex;
  width: max-content;
  margin-bottom: 6px;
  padding: 2px 7px;
  border: 1px solid rgba(109, 168, 255, 0.22);
  border-radius: 999px;
  color: #9ebfff;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.param-panel h2 {
  margin: 0;
  font-size: 16px;
  line-height: 1.25;
}

.param-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  padding: 13px 14px 14px;
  gap: 10px;
  align-content: start;
}

.param-actions {
  display: flex;
  gap: 8px;
  grid-column: 1 / -1;
  margin: 2px 0 0;
  padding: 10px 0 0;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  background: transparent;
}

label span {
  color: #9ca7bc;
  font-weight: 650;
}

.param-field {
  display: grid;
  gap: 5px;
  font-size: 12px;
}

.param-field.wide,
.param-grid > .file-drop,
.param-grid > .form-hint,
.param-grid > .admin-list,
.param-grid > .param-check-grid,
.param-grid > .node-readiness,
.param-grid > .external-prompt-note {
  grid-column: 1 / -1;
}

.param-field > span {
  font-size: 11px;
}

.param-field input,
.param-field select {
  height: 34px;
  padding: 0 9px;
}

.param-field textarea {
  min-height: 92px;
  padding: 9px;
  resize: vertical;
}

.external-prompt-note {
  display: grid;
  gap: 6px;
  padding: 10px 11px;
  border: 1px solid rgba(255, 180, 90, 0.22);
  border-radius: 8px;
  background: rgba(255, 180, 90, 0.08);
  color: #dce4f5;
  font-size: 12px;
  line-height: 1.4;
}

.external-prompt-note strong {
  color: #ffd39a;
  font-size: 12px;
}

.external-prompt-note span,
.external-prompt-note small {
  color: #aab4c8;
  overflow-wrap: anywhere;
}

.ratio-control {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(92px, 0.7fr);
  gap: 8px;
}

.param-two-col {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.param-check-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
}

.param-check {
  display: flex;
  align-items: center;
  min-height: 32px;
  gap: 7px;
  padding: 6px 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.045);
  color: #cbd5e8;
  font-size: 12px;
}

.param-check input {
  width: 15px;
  height: 15px;
  margin: 0;
  flex: 0 0 auto;
}

.param-check span {
  min-width: 0;
  color: inherit;
  font-weight: 650;
  line-height: 1.25;
}

.node-readiness {
  display: grid;
  gap: 5px;
  padding: 10px 11px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.045);
}

.node-readiness strong {
  color: #edf3ff;
  font-size: 12px;
}

.node-readiness span,
.node-readiness small {
  color: #aeb8cb;
  font-size: 11px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.node-readiness.ok {
  border-color: rgba(72, 214, 161, 0.25);
  background: rgba(72, 214, 161, 0.08);
}

.node-readiness.warn {
  border-color: rgba(255, 189, 90, 0.32);
  background: rgba(255, 189, 90, 0.09);
}

input,
textarea,
select {
  border-radius: 8px;
  background: rgba(4, 6, 11, 0.46);
}

textarea {
  min-height: 132px;
}

.small-btn {
  min-height: 32px;
  background: rgba(255, 255, 255, 0.065);
}

.danger-btn {
  border-color: rgba(255, 91, 104, 0.28);
  background: rgba(255, 91, 104, 0.09);
  color: #ffb6bd;
}

.danger-btn:hover {
  border-color: rgba(255, 91, 104, 0.48);
  background: rgba(255, 91, 104, 0.14);
}

.file-drop {
  border-radius: 8px;
  background: rgba(109, 168, 255, 0.055);
}

.context-menu,
.at-menu {
  min-width: 236px;
  padding: 6px;
}

.context-menu button,
.at-menu button {
  border-radius: 7px;
}

.asset-row,
.admin-row {
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.045);
}

.provider-health {
  display: grid;
  gap: 8px;
}

.public-base-status {
  display: grid;
  gap: 4px;
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
}

.public-base-status strong {
  color: #edf3ff;
  font-size: 12px;
}

.public-base-status span {
  color: #aeb8cb;
  font-size: 11px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.public-base-status.ok {
  border-color: rgba(72, 214, 161, 0.26);
  background: rgba(72, 214, 161, 0.08);
}

.public-base-status.warn {
  border-color: rgba(255, 189, 90, 0.32);
  background: rgba(255, 189, 90, 0.09);
}

.provider-checklist {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.provider-check {
  display: grid;
  gap: 4px;
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
}

.provider-check strong {
  color: #edf3ff;
  font-size: 12px;
}

.provider-check span {
  color: #aeb8cb;
  font-size: 11px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.provider-check.pass {
  border-color: rgba(72, 214, 161, 0.26);
  background: rgba(72, 214, 161, 0.08);
}

.provider-check.warn {
  border-color: rgba(255, 189, 90, 0.32);
  background: rgba(255, 189, 90, 0.09);
}

.remote-setup {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid rgba(109, 168, 255, 0.18);
  border-radius: 8px;
  background: rgba(109, 168, 255, 0.055);
}

.remote-setup > strong {
  color: #edf3ff;
  font-size: 12px;
}

.remote-setup small {
  color: #8e98ab;
  font-size: 11px;
  line-height: 1.4;
}

.remote-status-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
}

.remote-status-grid span {
  display: grid;
  gap: 2px;
  min-width: 0;
  padding: 7px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 7px;
  color: #cbd7ea;
  font-size: 11px;
  background: rgba(255, 255, 255, 0.04);
  overflow-wrap: anywhere;
}

.remote-status-grid b {
  color: #edf3ff;
  font-size: 10px;
  text-transform: uppercase;
}

.command-line {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  align-items: start;
  gap: 8px;
}

.command-line span {
  color: #aeb8cb;
  font-size: 11px;
  padding-top: 5px;
}

.command-line code {
  min-width: 0;
  padding: 6px 8px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 7px;
  color: #dce8ff;
  font-size: 11px;
  line-height: 1.35;
  background: rgba(0, 0, 0, 0.18);
  white-space: normal;
  overflow-wrap: anywhere;
}

.remote-preflight-result {
  display: grid;
  gap: 5px;
}

.remote-preflight-result div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 8px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.035);
}

.remote-preflight-result div.pass {
  border-color: rgba(72, 214, 161, 0.26);
}

.remote-preflight-result div.warn {
  border-color: rgba(255, 189, 90, 0.32);
}

.remote-preflight-result span {
  color: #aeb8cb;
  font-size: 11px;
  overflow-wrap: anywhere;
}

.remote-preflight-result strong {
  color: #edf3ff;
  font-size: 11px;
}

.provider-row {
  display: grid;
  gap: 4px;
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
}

.provider-row strong {
  color: #f2f6ff;
  font-size: 12px;
}

.provider-row span {
  color: #cbd7ea;
  font-size: 12px;
}

.provider-row small {
  color: #8e98ab;
  font-size: 11px;
  line-height: 1.45;
}

.provider-row .audit-remediation {
  color: #ffd89b;
}

.provider-row.audit-pass {
  border-color: rgba(50, 214, 161, 0.24);
}

.provider-row.audit-warn {
  border-color: rgba(255, 189, 90, 0.28);
  background: rgba(255, 189, 90, 0.055);
}

.admin-panel {
  width: min(1040px, calc(100vw - 28px));
  background: #0f121a;
  box-shadow: 0 0 0 100vmax rgba(3, 5, 9, 0.56), var(--workbench-shadow);
  backdrop-filter: none;
}

.mobile-side-actions {
  display: none;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.balance-actions {
  display: inline-grid;
  grid-template-columns: minmax(108px, 1fr) auto auto;
  gap: 6px;
  align-items: center;
}

.balance-actions input {
  min-width: 0;
  height: 32px;
  padding: 0 8px;
}

.admin-grid section {
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.035);
}

.preview-modal {
  border-radius: 10px;
}

.preview-toolbar {
  min-height: 58px;
}

.canvas-status {
  position: absolute;
  z-index: 55;
  left: 304px;
  bottom: 16px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  padding: 0 10px;
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: 8px;
  background: rgba(12, 14, 20, 0.72);
  color: #9fa9bd;
  font-size: 12px;
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(12px);
}

.ghost-node {
  display: grid;
  align-items: center;
  padding: 12px;
  border-radius: 8px;
  background: rgba(109, 168, 255, 0.16);
  color: #edf4ff;
  font-weight: 700;
}

.toast {
  border-radius: 8px;
  background: rgba(17, 20, 28, 0.96);
}

.recharge-btn {
  border-color: rgba(50, 214, 161, 0.38);
  background: rgba(50, 214, 161, 0.13);
  color: #c8ffeb;
  font-weight: 700;
}

.recharge-modal {
  position: fixed;
  z-index: 120;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(3, 5, 9, 0.72);
  backdrop-filter: blur(10px);
}

.recharge-dialog {
  width: min(620px, 100%);
  max-height: min(760px, calc(100vh - 36px));
  overflow: auto;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  background: #11141c;
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.52);
}

.recharge-head {
  position: sticky;
  z-index: 2;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 66px;
  padding: 12px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(17, 20, 28, 0.97);
}

.recharge-head > div { display: grid; gap: 3px; }
.recharge-head strong { font-size: 17px; }
.recharge-head span { color: var(--muted); font-size: 12px; }
.recharge-body { display: grid; gap: 18px; padding: 18px; }
.recharge-body section { display: grid; gap: 9px; }
.recharge-body h2 { margin: 0; font-size: 13px; }

.recharge-tiers {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.recharge-tier,
.payment-method {
  min-width: 0;
  min-height: 66px;
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.045);
  color: var(--text);
  cursor: pointer;
}

.recharge-tier strong,
.recharge-tier span { display: block; }
.recharge-tier strong { font-size: 17px; }
.recharge-tier span { margin-top: 4px; color: var(--muted); font-size: 11px; }
.recharge-tier.active,
.payment-method.active { border-color: rgba(50, 214, 161, 0.6); background: rgba(50, 214, 161, 0.12); }
.payment-method:disabled { opacity: 0.42; cursor: not-allowed; }

.payment-methods {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.recharge-current-order {
  display: grid;
  justify-items: center;
  gap: 10px;
  padding: 14px;
  border: 1px solid rgba(50, 214, 161, 0.24);
  border-radius: 8px;
  background: rgba(50, 214, 161, 0.055);
  text-align: center;
}

.recharge-current-order img { width: min(280px, 78vw); aspect-ratio: 1; object-fit: contain; background: #fff; }
.recharge-current-order p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.recharge-history { display: grid; gap: 6px; }
.recharge-order-row { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; padding: 10px 0; border-top: 1px solid rgba(255, 255, 255, 0.08); }
.recharge-order-row span { color: var(--muted); font-size: 12px; }
.recharge-order-row .paid { color: #8ff0c8; }
.recharge-order-row .rejected,
.recharge-order-row .expired,
.recharge-order-row .cancelled { color: #ff9ea6; }

.payment-qr-admin {
  display: grid;
  grid-template-columns: 76px auto auto;
  gap: 8px;
  align-items: center;
}

.payment-qr-admin img,
.payment-qr-empty {
  width: 76px;
  height: 76px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  object-fit: contain;
  background: #fff;
}

.payment-qr-empty {
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  font-size: 11px;
}

.payment-qr-upload {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.payment-qr-upload input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.billing-quote {
  display: grid;
  gap: 5px;
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 7px;
  background: rgba(0, 0, 0, 0.14);
}
.billing-quote strong { font-size: 13px; }
.billing-quote span { color: var(--muted); font-size: 11px; line-height: 1.45; }

.admin-tabs { grid-template-columns: repeat(4, minmax(0, 1fr)); }

@media (max-width: 920px) {
  .mobile-side-actions {
    display: grid;
  }

  .admin-panel {
    top: 76px;
    left: 8px;
    right: 8px;
    bottom: 8px;
    width: auto;
  }

  .balance-actions {
    width: 100%;
  }

  .canvas-status {
    left: 18px;
  }

  .param-panel {
    left: 12px;
    right: auto;
    top: 74px;
    bottom: auto;
    width: calc(100vw - 24px);
  }

  .param-grid {
    grid-template-columns: 1fr;
  }

  .recharge-tiers { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .recharge-modal { padding: 8px; }
  .recharge-dialog { max-height: calc(100vh - 16px); }
}

#lanConnection[data-mode="lan"] { color: #32d6a1; border-color: #389b7c; }
#lanConnection[data-mode="lan"] span::before { content: "● "; }

@media (max-width: 620px) { #lanConnection { padding: 0 6px; font-size: 12px; white-space: nowrap; } }
