:root {
  color-scheme: dark;
  --bg: oklch(0.105 0 0);
  --canvas: oklch(0.12 0.004 145);
  --panel: oklch(0.17 0.006 145);
  --panel-raised: oklch(0.225 0.009 145);
  --surface-hover: oklch(0.27 0.011 145);
  --surface-active: oklch(0.3 0.018 145);
  --ink: oklch(0.955 0.008 145);
  --ink-soft: oklch(0.84 0.012 145);
  --muted: oklch(0.72 0.012 145);
  --faint: oklch(0.57 0.012 145);
  --line: oklch(0.34 0.01 145);
  --line-strong: oklch(0.48 0.018 145);
  --primary: oklch(0.68 0.15 145);
  --primary-strong: oklch(0.61 0.16 145);
  --primary-soft: oklch(0.25 0.055 145);
  --blue: oklch(0.68 0.13 240);
  --blue-soft: oklch(0.24 0.05 240);
  --violet: oklch(0.7 0.14 305);
  --violet-soft: oklch(0.25 0.055 305);
  --coral: oklch(0.69 0.15 28);
  --coral-soft: oklch(0.245 0.055 28);
  --amber: oklch(0.76 0.14 85);
  --danger: oklch(0.65 0.18 25);
  --danger-soft: oklch(0.23 0.06 25);
  --white: oklch(1 0 0);
  --shadow-1: 0 3px 8px oklch(0 0 0 / 0.22);
  --shadow-2: 0 6px 14px oklch(0 0 0 / 0.3);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --node-width: 360px;
  --node-label-height: 28px;
  --node-card-border-size: 1px;
  --node-port-center-y: 130px;
  --node-port-size: 22px;
  --node-port-half-size: 11px;
  --node-port-gap: 8px;
  --topbar-height: 58px;
  --library-width: 264px;
  --inspector-width: 320px;
  --asset-width: 360px;
  --agent-width: 520px;
  --z-base: 1;
  --z-floating: 10;
  --z-dropdown: 20;
  --z-drawer: 30;
  --z-scrim: 25;
  --z-toast: 40;
  --z-home: 60;
  font-family: "SF Pro Display", "Segoe UI", "Microsoft YaHei UI", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* {
  box-sizing: border-box;
}

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

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

button {
  color: inherit;
}

button:not(:disabled),
a,
select {
  cursor: pointer;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.svg-sprite {
  position: fixed;
  width: 0;
  height: 0;
  overflow: hidden;
}

svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.app-shell {
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.app-shell[hidden] {
  display: none;
}

.topbar {
  height: var(--topbar-height);
  flex: 0 0 var(--topbar-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 14px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  position: relative;
  z-index: var(--z-floating);
}

.brand-cluster,
.topbar-actions,
.brand,
.workflow-name,
.save-state,
.button,
.icon-button,
.search-field,
.canvas-controls,
.run-log-actions {
  display: flex;
  align-items: center;
}

.brand-cluster {
  min-width: 0;
  gap: 10px;
}

.brand {
  color: var(--ink);
  text-decoration: none;
  gap: 9px;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.brand-mark {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  background: var(--primary);
  color: var(--white);
  border-radius: var(--radius-sm);
}

.brand-mark svg {
  width: 19px;
  height: 19px;
}

.topbar-divider,
.control-divider {
  width: 1px;
  height: 22px;
  background: var(--line);
  flex: 0 0 1px;
}

.workflow-name {
  min-width: 0;
  gap: 4px;
  border: 0;
  background: transparent;
  padding: 7px 6px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
}

.workflow-name:hover {
  background: var(--surface-hover);
}

.workflow-name span {
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.workflow-name svg {
  width: 14px;
  transform: rotate(90deg);
  color: var(--muted);
}

.save-state {
  gap: 6px;
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
}

.save-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--primary);
}

.save-state.dirty .save-dot {
  background: var(--amber);
}

.topbar-actions {
  gap: 8px;
  flex: 0 0 auto;
}

.credit-badge {
  height: 30px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 0 8px;
  border-radius: 7px;
  color: var(--ink-soft);
  background: var(--surface-hover);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.credit-badge svg {
  width: 13px;
  height: 13px;
  color: var(--amber);
}

.button.agent-button {
  color: var(--ink);
  background: var(--surface-hover);
}

.button.agent-button:hover,
.button.agent-button[aria-expanded="true"] {
  color: var(--primary);
  background: var(--primary-soft);
}

.button,
.icon-button,
.text-button,
.zoom-value {
  border: 0;
  background: transparent;
}

.button {
  justify-content: center;
  gap: 7px;
  min-height: 36px;
  padding: 0 14px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 650;
  transition: background-color 160ms ease-out, color 160ms ease-out, transform 160ms ease-out;
}

.button:active,
.icon-button:active,
.library-item:active {
  transform: translateY(1px);
}

.button.primary {
  background: var(--primary-strong);
  color: var(--white);
}

.button.primary:hover {
  background: var(--primary);
}

.button.primary:disabled {
  background: var(--surface-active);
  color: var(--muted);
  cursor: wait;
}

.button.ghost {
  color: var(--ink-soft);
}

.button.ghost:hover {
  background: var(--surface-hover);
  color: var(--ink);
}

.button.compact {
  padding: 0 10px;
}

.icon-button {
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  justify-content: center;
  border-radius: var(--radius-sm);
  color: var(--ink-soft);
  transition: background-color 160ms ease-out, color 160ms ease-out, transform 160ms ease-out;
}

.icon-button:hover {
  color: var(--ink);
  background: var(--surface-hover);
}

.icon-button[aria-expanded="true"] {
  color: var(--primary);
  background: var(--primary-soft);
}

.workspace-shell {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  position: relative;
}

.node-library,
.inspector,
.asset-panel,
.agent-panel {
  width: var(--library-width);
  min-height: 0;
  overflow: auto;
  background: var(--panel);
  position: fixed;
  top: var(--topbar-height);
  bottom: 0;
  z-index: var(--z-drawer);
  box-shadow: var(--shadow-2);
  transition: transform 200ms cubic-bezier(.22, 1, .36, 1);
}

.node-library {
  left: 0;
  transform: translateX(-102%);
  border-right: 1px solid var(--line);
  padding: 18px 14px 14px;
  display: flex;
  flex-direction: column;
}

.inspector {
  width: var(--inspector-width);
  right: 0;
  transform: translateX(102%);
  border-left: 1px solid var(--line);
  padding: 18px;
}

.asset-panel {
  width: var(--asset-width);
  left: 0;
  transform: translateX(-102%);
  border-right: 1px solid var(--line);
  padding: 18px 14px 14px;
}

.agent-panel {
  width: var(--agent-width);
  right: 0;
  transform: translateX(102%);
  border-left: 1px solid var(--line);
  padding: 18px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.node-library.open,
.inspector.open,
.asset-panel.open,
.agent-panel.open {
  transform: translateX(0);
}

.panel-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.panel-heading h1,
.panel-heading h2,
.run-log h2 {
  margin: 3px 0 0;
  font-size: 15px;
  line-height: 1.35;
  letter-spacing: -0.01em;
  text-wrap: balance;
}

.panel-kicker {
  color: var(--muted);
  font-size: 11px;
}

.search-field {
  height: 38px;
  gap: 8px;
  padding: 0 10px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--muted);
}

.search-field:focus-within {
  border-color: var(--primary);
}

.search-field svg {
  width: 16px;
  flex: 0 0 16px;
}

.search-field input {
  min-width: 0;
  flex: 1;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-size: 12px;
}

.search-field input::placeholder {
  color: var(--muted);
}

kbd {
  min-width: 20px;
  height: 20px;
  display: inline-grid;
  place-items: center;
  padding: 0 5px;
  border-radius: 5px;
  background: var(--panel-raised);
  color: var(--muted);
  font-family: inherit;
  font-size: 10px;
}

.library-section {
  margin-top: 18px;
}

.section-label {
  margin: 0 8px 6px;
  color: var(--muted);
  font-size: 11px;
}

.library-item {
  width: 100%;
  min-height: 54px;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) 18px;
  align-items: center;
  gap: 10px;
  padding: 8px;
  text-align: left;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  transition: background-color 150ms ease-out, transform 150ms ease-out;
}

.library-item:hover,
.library-item.search-match {
  background: var(--surface-hover);
}

.library-item > span:nth-child(2) {
  min-width: 0;
}

.library-item strong,
.library-item small {
  display: block;
}

.library-item strong {
  font-size: 12px;
  line-height: 1.45;
}

.catalog-inline-badge {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 4px;
  border-radius: 4px;
  color: var(--ink-soft);
  background: var(--surface-active);
  font-size: 7px;
  font-style: normal;
  vertical-align: 1px;
}

.catalog-inline-badge.new { color: oklch(0.86 0.1 220); background: oklch(0.25 0.06 220); }
.catalog-inline-badge.model { color: oklch(0.84 0.09 200); background: oklch(0.24 0.055 200); }

.library-item small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.add-indicator {
  width: 15px;
  color: var(--faint);
}

.library-item:hover .add-indicator {
  color: var(--primary);
}

.node-glyph {
  width: 34px;
  height: 34px;
  display: inline-grid;
  place-items: center;
  border-radius: var(--radius-sm);
  flex: 0 0 34px;
}

.node-glyph svg {
  width: 17px;
  height: 17px;
}

.node-glyph.text,
.node-glyph.script {
  color: var(--violet);
  background: var(--violet-soft);
}

.node-glyph.image,
.node-glyph.video {
  color: var(--blue);
  background: var(--blue-soft);
}

.node-glyph.smartEdit,
.node-glyph.storyboard {
  color: var(--coral);
  background: var(--coral-soft);
}

.node-glyph.audio,
.node-glyph.director,
.node-glyph.asset,
.node-glyph.upload,
.node-glyph.history {
  color: var(--primary);
  background: var(--primary-soft);
}

.library-footer {
  margin-top: auto;
  display: flex;
  gap: 9px;
  padding: 12px 10px 4px;
  color: var(--muted);
}

.library-footer > svg {
  flex: 0 0 17px;
  width: 17px;
  margin-top: 1px;
}

.library-footer p,
.library-footer strong,
.library-footer span {
  margin: 0;
  display: block;
}

.library-footer strong {
  color: var(--ink-soft);
  font-size: 11px;
}

.library-footer span {
  margin-top: 3px;
  font-size: 10px;
  line-height: 1.5;
}

.canvas {
  min-width: 0;
  min-height: 0;
  position: relative;
  overflow: clip;
  background-color: var(--canvas);
  background-image: radial-gradient(circle, oklch(0.39 0.012 145 / 0.46) 1px, transparent 1.15px);
  background-size: 20px 20px;
  cursor: grab;
  isolation: isolate;
}

.canvas.is-panning,
.canvas.is-panning * {
  cursor: grabbing !important;
  user-select: none;
}

.canvas.is-connecting,
.canvas.is-connecting * {
  cursor: crosshair;
}

.canvas[data-tool="select"] {
  cursor: default;
}

.canvas[data-tool="select"].is-box-selecting,
.canvas[data-tool="select"].is-box-selecting * {
  cursor: crosshair !important;
  user-select: none;
}

.canvas[data-tool="hand"],
.canvas[data-tool="hand"] * {
  cursor: grab;
}

.canvas-stage {
  width: 1px;
  height: 1px;
  position: absolute;
  inset: 0 auto auto 0;
  transform-origin: 0 0;
}

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

.edge {
  fill: none;
  stroke: var(--line-strong);
  stroke-width: 2;
  vector-effect: non-scaling-stroke;
}

.edge.active {
  stroke: var(--primary);
}

.edge.selected {
  stroke: var(--primary);
  stroke-width: 3;
}

.edge-hit {
  fill: none;
  stroke: transparent;
  stroke-width: 16;
  pointer-events: stroke;
  cursor: pointer;
  vector-effect: non-scaling-stroke;
}

.edge.running {
  stroke: var(--amber);
  stroke-dasharray: 7 7;
  animation: edge-flow 600ms linear infinite;
}

.edge.draft {
  stroke: var(--primary);
  stroke-dasharray: 5 5;
}

.edge.draft.pending {
  stroke-width: 2.5;
  stroke-dasharray: 7 5;
}

@keyframes edge-flow {
  to { stroke-dashoffset: -14; }
}

.workflow-node {
  width: var(--node-width);
  min-height: 300px;
  position: absolute;
  cursor: default;
  user-select: none;
}

.workflow-node.node-type-image {
  min-height: calc(var(--node-card-height, 260px) + var(--node-label-height) + 12px);
}

.workflow-node.node-family-tool {
  min-height: calc(var(--node-card-height, 260px) + var(--node-label-height) + 12px);
}

.workflow-node.selected {
  min-height: 480px;
}

.workflow-node.selected.node-type-image { min-height: calc(var(--node-card-height, 260px) + 260px); }
.workflow-node.selected.node-type-video { min-height: 548px; }
.workflow-node.selected.node-type-audio { min-height: 526px; }
.workflow-node.selected.node-family-tool { min-height: 516px; }

.node-label {
  height: var(--node-label-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 2px;
  color: var(--muted);
  cursor: grab;
}

.node-label:active {
  cursor: grabbing;
}

.node-label > span:first-child {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 6px;
}

.node-label > span:first-child svg {
  width: 15px;
  height: 15px;
}

.node-label strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 650;
}

.node-card {
  height: var(--node-card-height, 260px);
  position: relative;
  overflow: visible;
  border: var(--node-card-border-size) solid var(--line-strong);
  border-radius: var(--radius-md);
  background: oklch(0.215 0.008 145);
  transition: border-color 160ms ease-out, background-color 160ms ease-out;
}

.node-card.media-card {
  overflow: visible;
  background: oklch(0.15 0.006 145);
}

.workflow-node:hover .node-card {
  border-color: oklch(0.5 0.018 145);
}

.workflow-node.selected .node-card {
  border-color: var(--ink-soft);
  background: oklch(0.235 0.01 145);
}

.workflow-node.disabled {
  opacity: 0.48;
}

.workflow-node.disabled .node-card {
  border-style: dashed;
}

.workflow-node.multi-selected .node-card {
  border-color: var(--primary);
}

.workflow-node.running .node-card {
  border-color: var(--amber);
}

.workflow-node.success .node-card {
  border-color: var(--primary);
}

.workflow-node.error .node-card {
  border-color: var(--danger);
}

.node-status {
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  flex: 0 0 20px;
  border-radius: 50%;
  color: var(--muted);
  background: transparent;
}

.node-status svg {
  width: 12px;
  height: 12px;
}

.workflow-node.running .node-status {
  color: var(--amber);
}

.workflow-node.running .node-status svg {
  animation: status-turn 900ms linear infinite;
}

.workflow-node.success .node-status {
  background: var(--primary-soft);
  color: var(--primary);
}

.workflow-node.error .node-status {
  background: var(--danger-soft);
  color: var(--danger);
}

@keyframes status-turn {
  to { transform: rotate(360deg); }
}

.node-empty-mark {
  height: 98px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  color: var(--faint);
  opacity: 0.75;
}

.node-empty-mark > svg {
  width: 42px;
  height: 42px;
  margin-bottom: 2px;
  stroke-width: 1.35;
}

.node-empty-mark > span {
  width: 46px;
  height: 4px;
  border-radius: 2px;
  background: currentColor;
}

.node-empty-mark > span:nth-of-type(2) { width: 34px; }
.node-empty-mark > span:nth-of-type(3) { width: 22px; }

.node-result-preview {
  height: 98px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 18px 24px 4px;
}

.node-result-preview > span {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--primary);
  font-size: 11px;
  font-weight: 650;
}

.node-result-preview > span svg { width: 14px; height: 14px; }

.node-result-preview p {
  margin: 7px 0 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.5;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.text-node-content {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
  padding: 18px;
}

.text-node-content p {
  width: 100%;
  min-height: 0;
  flex: 1;
  margin: 0;
  overflow: auto;
  color: var(--ink-soft);
  font-size: 13px;
  line-height: 1.65;
  user-select: text;
  white-space: pre-wrap;
}

.text-node-content button {
  min-height: 30px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 9px;
  border: 0;
  border-radius: 6px;
  color: var(--muted);
  background: var(--surface-hover);
  font-size: 10px;
}

.text-node-content button:hover { color: var(--ink); }
.text-node-content button svg { width: 13px; height: 13px; }

.text-content-actions {
  width: 100%;
  display: flex;
  justify-content: flex-end;
  gap: 6px;
}

.manual-text-editor {
  height: 100%;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
}

.manual-text-editor textarea {
  width: 100%;
  min-height: 0;
  flex: 1;
  resize: none;
  padding: 12px 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: 0;
  color: var(--ink);
  background: var(--canvas);
  font-size: 13px;
  line-height: 1.65;
  user-select: text;
}

.manual-text-editor textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-soft);
}

.manual-text-editor textarea::placeholder { color: var(--faint); }

.manual-text-footer,
.manual-text-footer > div,
.manual-text-footer > span {
  display: flex;
  align-items: center;
}

.manual-text-footer {
  justify-content: space-between;
  gap: 10px;
}

.manual-text-footer > span {
  min-width: 0;
  gap: 6px;
  color: var(--primary);
  font-size: 10px;
  white-space: nowrap;
}

.manual-text-footer > span svg {
  width: 13px;
  height: 13px;
}

.manual-text-footer > div { gap: 7px; }

.manual-text-footer button {
  height: 30px;
  padding: 0 11px;
  border: 0;
  border-radius: 7px;
  font-size: 11px;
  font-weight: 650;
}

.manual-text-cancel {
  color: var(--ink-soft);
  background: var(--surface-hover);
}

.manual-text-cancel:hover { color: var(--white); }

.manual-text-save {
  color: var(--white);
  background: var(--primary-strong);
}

.manual-text-save:hover { background: var(--primary); }

.media-node-canvas {
  height: 100%;
  position: relative;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: calc(var(--radius-md) - var(--node-card-border-size));
  background: oklch(0.17 0.006 145);
}

.media-node-canvas > img,
.media-node-canvas > video {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.image-node-canvas > img {
  object-fit: contain;
  background: oklch(0.17 0.006 145);
}

.media-empty-state {
  max-width: 220px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  color: var(--faint);
  font-size: 11px;
  text-align: center;
}

.media-empty-state svg {
  width: 44px;
  height: 44px;
  stroke-width: 1.4;
}

.workflow-node.running .media-empty-state svg { animation: status-turn 900ms linear infinite; }

.node-media-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  padding: 4px 7px;
  border-radius: 6px;
  color: var(--ink-soft);
  background: oklch(0.13 0.004 145 / 0.82);
  font-size: 9px;
}

.media-canvas-action {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  position: absolute;
  right: 10px;
  bottom: 10px;
  border: 0;
  border-radius: 7px;
  color: var(--ink-soft);
  background: oklch(0.13 0.004 145 / 0.82);
}

.media-canvas-action:hover { color: var(--white); background: var(--primary-strong); }
.media-canvas-action svg { width: 14px; height: 14px; }

.video-node-canvas::after {
  content: "";
  position: absolute;
  inset: 58% 0 0;
  pointer-events: none;
  background: linear-gradient(to bottom, transparent, oklch(0.08 0 0 / 0.8));
}

.video-play-button {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  position: absolute;
  z-index: 1;
  border: 0;
  border-radius: 50%;
  color: var(--white);
  background: oklch(0.12 0.004 145 / 0.76);
}

.video-play-button:hover { background: var(--primary-strong); }
.video-play-button svg { width: 18px; height: 18px; }

.video-timeline {
  height: 26px;
  position: absolute;
  right: 12px;
  bottom: 8px;
  left: 12px;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--ink-soft);
  font-size: 9px;
}

.video-timeline i {
  height: 3px;
  min-width: 24px;
  position: relative;
  flex: 1;
  border-radius: 2px;
  background: oklch(0.75 0 0 / 0.28);
}

.video-timeline b {
  width: 24%;
  height: 100%;
  display: block;
  border-radius: inherit;
  background: var(--ink);
}

.video-timeline svg { width: 13px; height: 13px; }

.audio-node-canvas {
  height: 100%;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  overflow: hidden;
  border-radius: calc(var(--radius-md) - var(--node-card-border-size));
  color: var(--faint);
  background: oklch(0.17 0.006 145);
}

.audio-preview-button {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  position: relative;
  z-index: 1;
  border: 0;
  border-radius: 50%;
  color: var(--faint);
  background: transparent;
}

.audio-preview-button:hover,
.audio-preview-button.playing {
  color: var(--white);
  background: var(--primary-strong);
}

.audio-preview-button svg { width: 42px; height: 42px; stroke-width: 1.5; }
.audio-node-canvas > span { position: relative; z-index: 1; font-size: 11px; }

.audio-waveform {
  height: 48px;
  position: absolute;
  right: 20px;
  bottom: 30px;
  left: 20px;
  display: flex;
  align-items: center;
  gap: 3px;
  opacity: 0.42;
  transition: opacity 160ms ease-out;
}

.audio-waveform i {
  min-width: 2px;
  height: var(--wave);
  flex: 1;
  border-radius: 2px;
  background: var(--primary);
}

.audio-timeline {
  height: 22px;
  position: absolute;
  right: 12px;
  bottom: 5px;
  left: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--ink-soft);
  font-size: 9px;
}

.audio-timeline svg { width: 13px; height: 13px; }
.audio-node-canvas:not(.has-audio) .audio-waveform,
.audio-node-canvas:not(.has-audio) .audio-timeline { opacity: 0; }

.capability-node-canvas,
.resource-node-canvas {
  height: 100%;
  padding: 18px;
}

.capability-node-canvas {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.capability-node-heading {
  display: flex;
  align-items: center;
  gap: 11px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.capability-node-heading > span {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  flex: 0 0 42px;
  border-radius: 10px;
  color: var(--coral);
  background: var(--coral-soft);
}

.node-type-director .capability-node-heading > span,
.node-type-storyboard .capability-node-heading > span { color: var(--primary); background: var(--primary-soft); }
.node-type-script .capability-node-heading > span { color: var(--violet); background: var(--violet-soft); }
.capability-node-heading > span svg { width: 20px; height: 20px; }
.capability-node-heading div { min-width: 0; }
.capability-node-heading strong,
.capability-node-heading small { display: block; }
.capability-node-heading strong { font-size: 13px; }
.capability-node-heading small { margin-top: 4px; overflow: hidden; color: var(--muted); font-size: 10px; white-space: nowrap; text-overflow: ellipsis; }
.capability-node-canvas.has-result .capability-node-heading > span { color: var(--primary); background: var(--primary-soft); }

.capability-runtime {
  width: fit-content;
  max-width: 100%;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: -4px;
  padding: 4px 7px;
  overflow: hidden;
  border-radius: 6px;
  color: var(--primary);
  background: var(--primary-soft);
  font-size: 9px;
  font-weight: 700;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.capability-runtime.agent { color: var(--amber); background: oklch(0.24 0.055 75); }
.capability-runtime svg { width: 11px; height: 11px; flex: 0 0 11px; }

.capability-list {
  display: grid;
  gap: 7px;
}

.capability-list button {
  height: 43px;
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) 13px;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--ink-soft);
  background: var(--surface-hover);
  font-size: 11px;
  text-align: left;
}

.capability-list button:hover { border-color: var(--primary); color: var(--white); }
.capability-list b { width: 20px; height: 20px; display: grid; place-items: center; border-radius: 6px; color: var(--primary); background: var(--primary-soft); font-size: 9px; }
.capability-list svg { width: 12px; height: 12px; transform: rotate(90deg); color: var(--faint); }

.resource-node-canvas {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.resource-node-icon {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  margin-bottom: 10px;
  border-radius: 13px;
  color: var(--primary);
  background: var(--primary-soft);
}

.resource-node-icon svg { width: 25px; height: 25px; }
.resource-node-canvas > strong { font-size: 13px; }
.resource-node-canvas > p { max-width: 270px; margin: 7px 0 12px; color: var(--muted); font-size: 10px; line-height: 1.55; }
.resource-node-canvas > div:not(.resource-node-image) { display: flex; gap: 5px; margin-bottom: 14px; }
.resource-node-canvas > div:not(.resource-node-image) span { padding: 4px 6px; border-radius: 5px; color: var(--muted); background: var(--surface-hover); font-size: 8px; }
.resource-node-image { position: relative; width: 220px; height: 104px; margin-bottom: 10px; overflow: hidden; border-radius: 9px; background: var(--canvas); }
.resource-node-image img { width: 100%; height: 100%; display: block; object-fit: cover; }
.resource-node-image span { position: absolute; top: 7px; right: 7px; display: inline-flex; align-items: center; gap: 4px; padding: 4px 6px; border-radius: 5px; color: var(--white); background: oklch(0.08 0.01 150 / 0.82); font-size: 8px; }
.resource-node-image span svg { width: 11px; height: 11px; color: var(--primary); }
.resource-node-canvas > button { height: 32px; display: flex; align-items: center; gap: 6px; padding: 0 12px; border: 0; border-radius: 7px; color: var(--white); background: var(--primary-strong); font-size: 10px; font-weight: 650; }
.resource-node-canvas > button:hover { background: var(--primary); }
.resource-node-canvas > button svg { width: 14px; height: 14px; }

.node-suggestions {
  padding: 2px 26px 18px;
}

.node-suggestions > span {
  display: block;
  margin-bottom: 9px;
  color: var(--muted);
  font-size: 12px;
}

.node-suggestions ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.node-suggestions li {
  height: 29px;
}

.node-suggestions li button {
  width: 100%;
  height: 29px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 5px;
  border: 0;
  border-radius: 5px;
  color: var(--ink-soft);
  background: transparent;
  font-size: 12px;
  font-weight: 620;
  text-align: left;
}

.node-suggestions li button:hover {
  color: var(--white);
  background: var(--surface-hover);
}

.node-suggestions li svg {
  width: 14px;
  height: 14px;
  flex: 0 0 14px;
}

.port {
  width: var(--node-port-size);
  height: var(--node-port-size);
  display: grid;
  place-items: center;
  position: absolute;
  top: calc(var(--node-port-center-y) - var(--node-port-half-size) - var(--node-card-border-size));
  border: 1px solid var(--muted);
  border-radius: 50%;
  background: var(--canvas);
  color: var(--ink-soft);
  z-index: 2;
  transition: border-color 140ms ease-out, background-color 140ms ease-out, transform 140ms ease-out;
}

.port:hover,
.canvas.is-connecting .port.input {
  border-color: var(--primary);
  background: var(--primary-strong);
  color: var(--white);
  transform: scale(1.1);
}

.port.connection-source {
  border-color: var(--primary);
  background: var(--primary-strong);
  color: var(--white);
  transform: scale(1.1);
}

.port.input {
  left: calc((var(--node-port-size) + var(--node-port-gap) + var(--node-card-border-size)) * -1);
}

.port.output {
  right: calc((var(--node-port-size) + var(--node-port-gap) + var(--node-card-border-size)) * -1);
}

.port svg {
  width: 12px;
  height: 12px;
  stroke-width: 2;
}

.node-composer {
  width: 660px;
  height: 150px;
  position: absolute;
  top: calc(var(--node-card-height, 260px) + 46px);
  left: 50%;
  z-index: 3;
  transform: translateX(-50%);
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-md);
  background: oklch(0.225 0.009 145);
  box-shadow: var(--shadow-2);
  animation: composer-in 180ms cubic-bezier(.22, 1, .36, 1) both;
}

.node-composer.expanded {
  height: 260px;
}

.node-composer.media-composer {
  height: 200px;
}

.node-composer.video-composer {
  height: 226px;
}

.node-composer.audio-composer {
  height: 210px;
}

.node-composer.tool-composer {
  height: 200px;
}

@keyframes composer-in {
  from { opacity: 0; transform: translate(-50%, 8px); }
}

.node-composer textarea {
  width: 100%;
  height: 98px;
  display: block;
  padding: 18px 52px 12px 18px;
  resize: none;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.65;
  user-select: text;
}

.node-composer.expanded textarea {
  height: 208px;
}

.media-composer > textarea {
  height: 82px;
  padding-top: 12px;
}

.media-composer-tools {
  height: 54px;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 8px 12px 4px;
}

.media-composer-tools > button,
.reference-slot {
  height: 40px;
  min-width: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 0 9px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--muted);
  background: var(--bg);
  font-size: 9px;
}

.media-composer-tools > button:hover,
.media-composer-tools > button.active,
.reference-slot:hover,
.reference-slot.has-asset {
  border-color: var(--primary);
  color: var(--ink);
  background: var(--primary-soft);
}

.media-composer-tools svg,
.reference-slot svg { width: 14px; height: 14px; }

.reference-slot img {
  width: 30px;
  height: 30px;
  margin-left: -6px;
  border-radius: 5px;
  object-fit: cover;
}

.reference-slot span {
  max-width: 76px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.video-mode-tabs {
  height: 42px;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 10px 2px;
}

.video-mode-tabs button {
  min-height: 28px;
  padding: 0 9px;
  border: 0;
  border-radius: 6px;
  color: var(--faint);
  background: transparent;
  font-size: 9px;
}

.video-mode-tabs button:hover { color: var(--ink-soft); background: var(--surface-hover); }
.video-mode-tabs button.active { color: var(--ink); background: var(--surface-active); }

.video-reference-row {
  height: 126px;
  display: grid;
  grid-template-columns: 58px 58px minmax(0, 1fr);
  gap: 8px;
  padding: 8px 12px;
}

.video-reference-row .reference-slot {
  width: 58px;
  height: 66px;
  align-self: start;
  flex-direction: column;
  padding: 5px;
}

.video-reference-row .reference-slot img {
  width: 48px;
  height: 38px;
  margin: 0;
}

.video-reference-row textarea {
  width: 100%;
  height: 100%;
  padding: 9px 10px;
  resize: none;
  border: 1px solid var(--line);
  border-radius: 7px;
  outline: 0;
  color: var(--ink);
  background: var(--bg);
  font-size: 11px;
  line-height: 1.55;
  user-select: text;
}

.video-reference-row textarea:focus { border-color: var(--primary); }

.audio-input-row {
  height: 146px;
  position: relative;
  padding: 10px 12px 0;
}

.audio-input-row textarea {
  width: 100%;
  height: 100%;
  padding: 16px 42px 12px 14px;
  resize: none;
  border: 0;
  outline: 0;
  color: var(--ink);
  background: transparent;
  font-size: 13px;
  line-height: 1.65;
  user-select: text;
}

.audio-input-row.has-input textarea { padding-top: 62px; }

.audio-input-chip {
  height: 42px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  position: absolute;
  top: 12px;
  left: 14px;
  z-index: 1;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink-soft);
  background: var(--surface-hover);
  font-size: 11px;
}

.audio-input-chip b {
  min-width: 17px;
  height: 17px;
  display: grid;
  place-items: center;
  margin-left: -8px;
  margin-top: -28px;
  border-radius: 50%;
  color: var(--white);
  background: var(--panel);
  font-size: 9px;
}

.audio-input-chip svg { width: 14px; height: 14px; }

.audio-composer-footer {
  height: 64px;
  padding-bottom: 9px;
  border-top: 1px solid oklch(0.3 0.008 145 / 0.5);
}

.audio-model-symbol { font-family: Georgia, serif; font-size: 15px; }
.audio-mode-option { color: var(--ink-soft); font-size: 11px; }
.audio-mode-option > svg:last-child { width: 10px; transform: rotate(90deg); }
.composer-spacer { min-width: 8px; flex: 1; }

.audio-character-count {
  color: var(--faint);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.tool-mode-tabs {
  height: 46px;
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 8px 12px 4px;
  overflow-x: auto;
}

.tool-mode-tabs button {
  min-height: 29px;
  padding: 0 10px;
  border: 0;
  border-radius: 7px;
  color: var(--faint);
  background: transparent;
  font-size: 9px;
  white-space: nowrap;
}

.tool-mode-tabs button:hover { color: var(--ink-soft); background: var(--surface-hover); }
.tool-mode-tabs button.active { color: var(--ink); background: var(--surface-active); }
.tool-composer > textarea { height: 90px; padding-top: 10px; }
.tool-composer .composer-footer { height: 64px; padding-bottom: 9px; }

.resource-composer {
  height: 150px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 20px;
  padding: 18px;
}

.resource-composer-copy { min-width: 0; display: flex; align-items: center; gap: 12px; }
.resource-composer-copy > span { width: 42px; height: 42px; display: grid; place-items: center; flex: 0 0 42px; border-radius: 10px; color: var(--primary); background: var(--primary-soft); }
.resource-composer-copy > span svg { width: 20px; height: 20px; }
.resource-composer-copy strong { display: block; font-size: 13px; }
.resource-composer-copy p { margin: 5px 0 0; overflow: hidden; color: var(--muted); font-size: 10px; white-space: nowrap; text-overflow: ellipsis; }
.resource-composer-actions { display: flex; flex-direction: column; align-items: flex-end; gap: 12px; }
.resource-composer-actions > div { display: flex; gap: 5px; }
.resource-composer-actions span { padding: 4px 6px; border-radius: 5px; color: var(--muted); background: var(--surface-hover); font-size: 8px; }
.resource-composer-actions button { height: 34px; display: flex; align-items: center; gap: 6px; padding: 0 12px; border: 0; border-radius: 7px; color: var(--white); background: var(--primary-strong); font-size: 10px; font-weight: 650; }
.resource-composer-actions button:hover { background: var(--primary); }
.resource-composer-actions button svg { width: 14px; height: 14px; }

.node-composer textarea::placeholder {
  color: var(--muted);
}

.composer-expand {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  position: absolute;
  top: 8px;
  right: 8px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
}

.composer-expand:hover { background: var(--surface-hover); color: var(--ink); }
.composer-expand svg { width: 15px; height: 15px; }

.composer-footer {
  height: 52px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 10px 10px 16px;
}

.media-composer .composer-footer {
  height: 64px;
  padding-bottom: 8px;
}

.video-composer .composer-footer {
  height: 58px;
}

.model-selector {
  min-width: 0;
  max-width: 260px;
  height: 34px;
  display: flex;
  align-items: center;
  gap: 6px;
  overflow: hidden;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--ink);
  font-size: 12px;
  font-weight: 650;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.model-selector:hover { background: var(--surface-hover); }
.model-selector > svg { width: 12px; height: 12px; transform: rotate(90deg); color: var(--muted); }

.model-symbol {
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 10px;
}

.media-footer-options {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 3px;
}

.node-option,
.composer-icon-action {
  height: 30px;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0 7px;
  border: 0;
  border-radius: 6px;
  color: var(--muted);
  background: transparent;
  font-size: 9px;
  white-space: nowrap;
}

.node-option:hover,
.node-option.active,
.composer-icon-action:hover,
.composer-icon-action.active {
  color: var(--ink);
  background: var(--surface-hover);
}

.node-option svg,
.composer-icon-action svg { width: 13px; height: 13px; }

.composer-icon-action {
  width: 30px;
  flex: 0 0 30px;
  justify-content: center;
  padding: 0;
}

.composer-cost {
  display: flex;
  align-items: center;
  gap: 3px;
  color: var(--faint);
  font-size: 9px;
}

.composer-tools {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 10px;
}

.composer-tools svg { width: 15px; height: 15px; }
.credit-mark { color: var(--amber); }

.composer-run {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: var(--ink-soft);
  color: var(--panel);
}

.composer-run:hover { background: var(--ink); }
.composer-run svg { width: 17px; height: 17px; }

.workflow-node.running .composer-run {
  background: var(--amber);
}

.workflow-node.success .composer-run {
  background: var(--primary);
  color: var(--white);
}

.canvas-hint {
  position: absolute;
  top: 16px;
  left: 50%;
  z-index: var(--z-floating);
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: calc(100% - 32px);
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--panel-raised);
  box-shadow: var(--shadow-1);
  color: var(--ink-soft);
  font-size: 11px;
}

.canvas-hint > svg {
  color: var(--primary);
  flex: 0 0 15px;
  width: 15px;
}

.canvas-hint button {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
}

.canvas-hint button:hover { background: var(--surface-hover); }
.canvas-hint button svg { width: 13px; }

.canvas-controls {
  position: absolute;
  left: 16px;
  bottom: 16px;
  z-index: var(--z-floating);
  gap: 2px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--panel);
  box-shadow: var(--shadow-1);
}

.canvas-controls .icon-button {
  width: 32px;
  height: 32px;
  flex-basis: 32px;
}

.canvas-controls .control-divider {
  height: 18px;
  margin: 0 3px;
}

.selection-box {
  position: absolute;
  z-index: calc(var(--z-floating) - 1);
  border: 1px solid var(--primary);
  background: oklch(0.68 0.15 145 / 0.12);
  pointer-events: none;
}

.selection-box[hidden] { display: none; }

.creation-toolbar {
  min-height: 44px;
  position: absolute;
  left: 50%;
  bottom: 16px;
  z-index: var(--z-floating);
  display: flex;
  align-items: center;
  gap: 3px;
  padding: 4px;
  border-radius: var(--radius-md);
  background: var(--panel-raised);
  box-shadow: var(--shadow-1);
  transform: translateX(-50%);
}

.creation-toolbar .control-divider {
  height: 20px;
  margin: 0 2px;
}

.tool-button {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: var(--radius-sm);
  color: var(--muted);
  background: transparent;
}

.tool-button:hover,
.tool-button.active {
  color: var(--ink);
  background: var(--surface-hover);
}

.tool-button.primary-tool {
  color: var(--white);
  background: var(--primary-strong);
}

.tool-button.primary-tool:hover { background: var(--primary); }
.tool-button svg { width: 16px; height: 16px; }

.canvas-empty {
  width: min(520px, calc(100% - 40px));
  position: absolute;
  left: 50%;
  top: 44%;
  z-index: var(--z-base);
  text-align: center;
  transform: translate(-50%, -50%);
}

.canvas-empty[hidden] { display: none; }

.canvas-empty-mark {
  width: 46px;
  height: 46px;
  display: inline-grid;
  place-items: center;
  border-radius: var(--radius-md);
  color: var(--primary);
  background: var(--primary-soft);
}

.canvas-empty h2 {
  margin: 14px 0 6px;
  font-size: 17px;
  text-wrap: balance;
}

.canvas-empty p {
  margin: 0 auto;
  max-width: 55ch;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.6;
}

.empty-template-list {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 18px;
}

.empty-template-list button,
.agent-presets button {
  min-height: 34px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--ink-soft);
  background: var(--panel);
  font-size: 10px;
}

.empty-template-list button:hover,
.agent-presets button:hover {
  border-color: var(--line-strong);
  color: var(--ink);
  background: var(--surface-hover);
}

.zoom-value {
  min-width: 48px;
  height: 32px;
  border-radius: 6px;
  color: var(--ink-soft);
  font-size: 11px;
}

.zoom-value:hover { background: var(--surface-hover); }

.minimap {
  width: 148px;
  height: 92px;
  position: absolute;
  right: 16px;
  bottom: 16px;
  z-index: var(--z-floating);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--panel);
  box-shadow: var(--shadow-1);
}

.minimap-label {
  position: absolute;
  top: 6px;
  left: 8px;
  color: var(--faint);
  font-size: 9px;
}

.minimap-node {
  position: absolute;
  width: 18px;
  height: 8px;
  border-radius: 2px;
  background: var(--muted);
}

.minimapViewport {
  position: absolute;
  border: 1px solid var(--primary);
  border-radius: 3px;
  background: oklch(0.68 0.15 145 / 0.08);
}

.add-menu {
  width: 220px;
  max-height: calc(100vh - 20px);
  position: fixed;
  z-index: var(--z-dropdown);
  overflow: auto;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--panel-raised);
  box-shadow: var(--shadow-2);
  animation: add-menu-in 160ms cubic-bezier(0.22, 1, 0.36, 1);
}

.add-menu[hidden] { display: none; }

.add-menu-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 7px 8px 9px;
  color: var(--muted);
  font-size: 10px;
}

.add-menu-title-copy {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 2px;
}

.add-menu-title-copy strong {
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 650;
}

.add-menu-title-copy small {
  color: var(--primary);
  font-size: 9px;
}

@keyframes add-menu-in {
  from { opacity: 0; transform: translateY(4px) scale(0.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.add-menu button[data-quick-add] {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 36px;
  padding: 6px 8px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  font-size: 11px;
  text-align: left;
}

.add-menu button[data-quick-add] > svg:first-child {
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  color: var(--ink-soft);
}

.add-menu button[data-quick-add] > span {
  min-width: 0;
  flex: 1;
}

.add-menu .menu-chevron {
  width: 13px;
  height: 13px;
  flex: 0 0 13px;
  color: var(--muted);
}

.menu-badge {
  flex: 0 0 auto;
  padding: 2px 5px;
  border-radius: 5px;
  color: var(--ink-soft);
  background: var(--surface-active);
  font-size: 8px;
  font-style: normal;
  font-weight: 700;
}

.menu-badge.new {
  color: oklch(0.86 0.1 220);
  background: oklch(0.25 0.06 220);
}

.menu-badge.model {
  color: oklch(0.84 0.09 200);
  background: oklch(0.24 0.055 200);
}

.add-menu-section {
  margin: 6px 8px 2px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
  color: var(--faint);
  font-size: 10px;
}

.add-menu button[data-quick-add]:hover,
.add-menu button[data-quick-add]:focus-visible {
  background: var(--surface-hover);
}

.context-menu,
.workflow-menu {
  width: 210px;
  position: fixed;
  z-index: var(--z-dropdown);
  padding: 6px;
  border-radius: var(--radius-sm);
  background: var(--panel-raised);
  box-shadow: var(--shadow-2);
  animation: add-menu-in 140ms cubic-bezier(0.22, 1, 0.36, 1);
}

.context-menu[hidden],
.workflow-menu[hidden] { display: none; }

.context-menu button,
.workflow-menu button {
  width: 100%;
  min-height: 34px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 6px 8px;
  border: 0;
  border-radius: 6px;
  color: var(--ink-soft);
  background: transparent;
  font-size: 11px;
  text-align: left;
}

.context-menu button:hover,
.context-menu button:focus-visible,
.workflow-menu button:hover,
.workflow-menu button:focus-visible {
  color: var(--ink);
  background: var(--surface-hover);
}

.context-menu button.danger { color: oklch(0.78 0.12 25); }
.context-menu button:disabled {
  cursor: not-allowed;
  opacity: 0.42;
}
.context-menu button svg,
.workflow-menu button svg { width: 15px; height: 15px; }

.context-menu-separator {
  height: 1px;
  margin: 5px 6px;
  background: var(--line);
}

.context-menu-shortcut {
  margin-left: auto;
  color: var(--faint);
  font-size: 9px;
}

.workflow-menu {
  top: 50px;
  left: 176px;
}

.template-palette {
  width: min(680px, calc(100% - 32px));
  position: fixed;
  left: 50%;
  top: 74px;
  z-index: var(--z-dropdown);
  padding: 16px;
  border-radius: var(--radius-md);
  background: var(--panel-raised);
  box-shadow: var(--shadow-2);
  transform: translateX(-50%);
  animation: template-in 180ms cubic-bezier(0.22, 1, 0.36, 1);
}

.template-palette[hidden] { display: none; }

.template-palette header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.template-palette h2 {
  margin: 3px 0 0;
  font-size: 15px;
}

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

.template-card {
  min-height: 104px;
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  grid-template-rows: auto auto;
  align-items: center;
  gap: 3px 10px;
  padding: 12px;
  border: 0;
  border-radius: var(--radius-sm);
  color: var(--ink);
  background: var(--panel);
  text-align: left;
}

.template-card:hover { background: var(--surface-hover); }

.template-icon {
  width: 38px;
  height: 38px;
  grid-row: 1 / 3;
  display: grid;
  place-items: center;
  border-radius: var(--radius-sm);
  color: var(--primary);
  background: var(--primary-soft);
}

.template-icon.character { color: var(--blue); background: var(--blue-soft); }
.template-icon.manga { color: var(--amber); background: oklch(0.24 0.055 75); }
.template-icon.commerce { color: var(--coral); background: var(--coral-soft); }
.template-icon.music { color: var(--violet); background: var(--violet-soft); }
.template-icon svg { width: 18px; height: 18px; }
.template-card strong { align-self: end; font-size: 12px; }
.template-card small { align-self: start; color: var(--muted); font-size: 10px; }
.template-card em { grid-column: 3; grid-row: 1 / 3; color: var(--faint); font-size: 9px; font-style: normal; }

@keyframes template-in {
  from { opacity: 0; transform: translate(-50%, -5px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

.inspector-heading {
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.inspector-content {
  padding-bottom: 40px;
}

.asset-heading,
.agent-heading {
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.asset-heading h2,
.agent-heading h2 {
  margin: 3px 0 0;
  font-size: 15px;
}

.panel-tabs {
  display: flex;
  gap: 3px;
  margin-bottom: 14px;
  padding: 3px;
  border-radius: var(--radius-sm);
  background: var(--bg);
}

.panel-tabs button {
  min-height: 32px;
  flex: 1;
  border: 0;
  border-radius: 6px;
  color: var(--muted);
  background: transparent;
  font-size: 10px;
}

.panel-tabs button.active {
  color: var(--ink);
  background: var(--surface-hover);
}

.asset-content {
  padding-bottom: 32px;
}

.asset-selection-note {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  color: var(--ink-soft);
  background: var(--primary-soft);
  font-size: 10px;
}

.asset-selection-note svg {
  width: 15px;
  height: 15px;
  flex: 0 0 15px;
  color: var(--primary);
}

.asset-dropzone {
  min-height: 112px;
  display: grid;
  place-items: center;
  padding: 16px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-md);
  color: var(--muted);
  background: var(--bg);
  text-align: center;
}

.asset-dropzone.dragging,
.asset-content.dragging .asset-dropzone {
  border-color: var(--primary);
  color: var(--ink);
  background: var(--primary-soft);
}

.asset-dropzone svg {
  width: 22px;
  height: 22px;
  margin-bottom: 7px;
  color: var(--primary);
}

.asset-dropzone strong,
.asset-dropzone span { display: block; }
.asset-dropzone strong { color: var(--ink-soft); font-size: 11px; }
.asset-dropzone span { margin-top: 4px; font-size: 9px; }

.asset-dropzone button {
  min-height: 30px;
  margin-top: 10px;
  padding: 0 10px;
  border: 0;
  border-radius: 6px;
  color: var(--white);
  background: var(--primary-strong);
  font-size: 10px;
}

.asset-list-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 18px 2px 8px;
  color: var(--muted);
  font-size: 10px;
}

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

.asset-item {
  min-width: 0;
  overflow: hidden;
  border-radius: var(--radius-sm);
  background: var(--bg);
}

.asset-preview {
  height: 88px;
  display: grid;
  place-items: center;
  overflow: hidden;
  color: var(--muted);
  background: var(--surface-hover);
}

.asset-preview img,
.asset-preview video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.asset-preview svg { width: 25px; height: 25px; }

.asset-meta {
  padding: 8px;
}

.asset-meta strong,
.asset-meta small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.asset-meta strong { font-size: 10px; }
.asset-meta small { margin-top: 3px; color: var(--faint); font-size: 8px; }

.asset-meta button {
  width: 100%;
  min-height: 28px;
  margin-top: 7px;
  border: 0;
  border-radius: 6px;
  color: var(--ink-soft);
  background: var(--surface-hover);
  font-size: 9px;
}

.asset-meta button:hover { color: var(--primary); }

.panel-empty {
  padding: 32px 14px;
  color: var(--muted);
  text-align: center;
  font-size: 10px;
  line-height: 1.6;
}

.panel-empty svg {
  width: 28px;
  height: 28px;
  margin-bottom: 8px;
  color: var(--faint);
}

.agent-thread {
  min-height: 0;
  flex: 1;
  overflow: auto;
  padding: 10px 2px 16px;
}

.agent-panel [hidden] { display: none !important; }

.agent-heading { margin-bottom: 8px; }

.agent-online {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 9px;
}

.agent-online i,
.agent-capability-strip i {
  width: 6px;
  height: 6px;
  display: inline-block;
  border-radius: 50%;
  background: var(--primary);
}

.agent-heading-actions { display: flex; gap: 6px; }

.agent-capability-strip {
  min-height: 34px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: var(--surface-hover);
  font-size: 9px;
}

.agent-capability-strip span { display: inline-flex; align-items: center; gap: 5px; color: var(--primary); }
.agent-capability-strip b { color: var(--ink-soft); font-weight: 650; }
.agent-capability-strip em { margin-left: auto; color: var(--faint); font-style: normal; }
.agent-capability-strip.is-connected { border-color: oklch(0.48 0.11 145); background: oklch(0.18 0.035 145); }
.agent-capability-strip.is-connected em { color: var(--primary); }
.agent-capability-strip.is-error span,
.agent-capability-strip.is-error em { color: var(--amber); }
.agent-capability-strip.is-error i { background: var(--amber); }

.agent-question-card {
  flex: 0 0 auto;
  margin: 4px 0 12px;
  padding: 14px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: oklch(0.205 0.008 145);
}

.agent-question-card header,
.agent-question-card footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.agent-question-card header strong { color: var(--ink); font-size: 12px; }
.agent-question-card header > span { color: var(--muted); font-size: 10px; }
.agent-question-card header > span b { color: var(--primary); }

.agent-question-progress {
  height: 2px;
  margin: 11px 0 12px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--line);
}

.agent-question-progress i {
  height: 100%;
  display: block;
  border-radius: inherit;
  background: var(--primary);
  transition: width 180ms cubic-bezier(.22, 1, .36, 1);
}

.agent-question-card > p { margin: 0 0 10px; color: var(--muted); font-size: 10px; }

.agent-question-options { display: grid; gap: 7px; }

.agent-question-options button {
  min-height: 42px;
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  align-items: center;
  gap: 9px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink-soft);
  background: var(--bg);
  font-size: 10px;
  line-height: 1.45;
  text-align: left;
}

.agent-question-options button:hover { border-color: var(--muted); color: var(--white); }
.agent-question-options button.selected { border-color: var(--primary); color: var(--white); background: var(--primary-soft); }

.agent-question-options b {
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  border-radius: 5px;
  color: var(--muted);
  background: var(--surface-active);
  font-size: 9px;
}

.agent-question-options button.selected b { color: var(--canvas); background: var(--primary); }

.agent-custom-answer {
  width: 100%;
  height: 38px;
  margin-top: 8px;
  padding: 0 10px;
  border: 1px solid var(--primary);
  border-radius: 8px;
  outline: 0;
  color: var(--ink);
  background: var(--bg);
  font-size: 10px;
}

.agent-question-card footer { margin-top: 12px; }
.agent-question-card footer button { min-height: 32px; border-radius: 7px; font-size: 10px; }
.agent-question-skip { padding: 0 8px; border: 0; color: var(--muted); background: transparent; }
.agent-question-skip:hover { color: var(--ink); }
.agent-question-next { display: inline-flex; align-items: center; gap: 5px; padding: 0 12px; border: 0; color: var(--canvas); background: var(--primary); font-weight: 750; }
.agent-question-next svg { width: 11px; height: 11px; }
.agent-question-next:disabled { color: var(--faint); background: var(--surface-active); cursor: not-allowed; }

.agent-artifact-group,
.agent-generation-block {
  margin: 0 0 14px 37px;
}

.agent-artifact-label,
.agent-generation-heading {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 9px;
}

.agent-artifact-label svg,
.agent-generation-heading svg { width: 13px; height: 13px; }

.agent-artifact-card {
  width: 100%;
  min-height: 58px;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--ink-soft);
  background: oklch(0.22 0.01 210);
  text-align: left;
}

.agent-artifact-card:hover { border-color: var(--primary); }
.agent-artifact-card > svg { width: 20px; height: 20px; color: oklch(0.74 0.12 210); }
.agent-artifact-card span { min-width: 0; flex: 1; }
.agent-artifact-card strong,
.agent-artifact-card small { display: block; }
.agent-artifact-card strong { overflow: hidden; color: var(--ink); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.agent-artifact-card small { margin-top: 3px; color: var(--muted); font-size: 8px; }

.agent-anchor-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }

.agent-anchor-card {
  aspect-ratio: 0.78;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--faint);
  background: var(--surface-hover);
  font-size: 8px;
}

.agent-anchor-card svg { width: 20px; height: 20px; }
.agent-generation-note { margin: 8px 0 0; color: var(--faint); font-size: 8px; }

.agent-stage-action {
  margin: 0 0 16px 37px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-hover);
}

.agent-stage-action > span {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 9px;
}

.agent-stage-action > span svg { width: 13px; height: 13px; color: var(--primary); }

.agent-stage-action button {
  width: 100%;
  min-height: 36px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 0 11px;
  border: 0;
  border-radius: 8px;
  color: var(--canvas);
  background: var(--primary);
  font-size: 10px;
  font-weight: 750;
}

.agent-stage-action button:hover { background: var(--primary-strong); }
.agent-stage-action button svg { width: 12px; height: 12px; }
.agent-stage-action button.completed,
.agent-stage-action button:disabled { color: var(--muted); background: var(--surface-active); cursor: default; }

.manga-agent-brief {
  flex: 0 0 auto;
  margin: 12px 0 14px;
  padding: 13px;
  border: 1px solid oklch(0.43 0.08 145 / 0.65);
  border-radius: var(--radius-md);
  background: oklch(0.16 0.025 145);
}

.manga-agent-status,
.manga-agent-title,
.manga-agent-metrics,
.manga-agent-create,
.manga-skill-list summary {
  display: flex;
  align-items: center;
}

.manga-agent-status {
  justify-content: space-between;
  color: var(--muted);
  font-size: 9px;
}

.manga-agent-status span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--primary);
  font-weight: 700;
}

.manga-agent-status i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--primary);
  box-shadow: 0 0 7px oklch(0.7 0.16 145 / 0.68);
}

.manga-agent-status em {
  padding: 3px 6px;
  border-radius: 999px;
  color: var(--faint);
  background: var(--surface-hover);
  font-style: normal;
}

.manga-agent-title {
  gap: 10px;
  margin-top: 12px;
}

.manga-agent-title > span {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  flex: 0 0 36px;
  border-radius: 9px;
  color: oklch(0.9 0.05 145);
  background: var(--primary-strong);
}

.manga-agent-title svg { width: 19px; height: 19px; }
.manga-agent-title div { min-width: 0; }
.manga-agent-title strong,
.manga-agent-title small { display: block; }
.manga-agent-title strong { color: var(--white); font-size: 13px; }
.manga-agent-title small { margin-top: 3px; color: var(--muted); font-size: 9px; line-height: 1.45; }

.manga-agent-metrics {
  gap: 1px;
  margin-top: 12px;
  overflow: hidden;
  border-radius: 8px;
  background: var(--line);
}

.manga-agent-metrics span {
  min-width: 0;
  flex: 1;
  display: grid;
  gap: 1px;
  padding: 7px 5px;
  background: oklch(0.135 0.016 145);
  text-align: center;
}

.manga-agent-metrics b { color: var(--ink); font-size: 13px; }
.manga-agent-metrics small { color: var(--faint); font-size: 8px; white-space: nowrap; }

.manga-agent-create {
  width: 100%;
  min-height: 38px;
  justify-content: flex-start;
  gap: 7px;
  margin-top: 10px;
  padding: 0 10px;
  border: 0;
  border-radius: 8px;
  color: var(--white);
  background: var(--primary-strong);
  font-size: 10px;
  font-weight: 750;
}

.manga-agent-create:hover { background: var(--primary); }
.manga-agent-create span { flex: 1; text-align: left; }
.manga-agent-create svg { width: 14px; height: 14px; }
.manga-agent-create svg:last-child { width: 12px; }

.manga-skill-list {
  margin-top: 9px;
  color: var(--muted);
  font-size: 9px;
}

.manga-skill-list summary {
  justify-content: space-between;
  gap: 8px;
  cursor: pointer;
}

.manga-skill-list summary small { color: var(--faint); font-size: 8px; }
.manga-skill-list > div { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }
.manga-skill-list > div span { padding: 4px 6px; border-radius: 5px; color: var(--ink-soft); background: var(--surface-hover); }

.agent-message {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  margin-bottom: 12px;
}

.agent-message > span {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  flex: 0 0 28px;
  border-radius: 7px;
  color: var(--primary);
  background: var(--primary-soft);
}

.agent-message > span svg { width: 15px; height: 15px; }

.agent-message p {
  margin: 0;
  padding: 9px 10px;
  border-radius: 4px 10px 10px 10px;
  color: var(--ink-soft);
  background: var(--surface-hover);
  font-size: 11px;
  line-height: 1.6;
}

.agent-message.user {
  justify-content: flex-end;
}

.agent-message.user p {
  max-width: 86%;
  border-radius: 10px 4px 10px 10px;
  color: var(--white);
  background: var(--primary-strong);
}

.agent-message.thinking p {
  display: flex;
  align-items: center;
  gap: 5px;
  color: var(--muted);
}

.agent-message.thinking p i {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--primary);
  animation: agent-thinking 900ms ease-in-out infinite alternate;
}

.agent-message.thinking p i:nth-child(2) { animation-delay: 140ms; }
.agent-message.thinking p i:nth-child(3) { animation-delay: 280ms; }

@keyframes agent-thinking {
  to { opacity: 0.32; transform: translateY(-2px); }
}

.agent-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}

.agent-presets button { min-height: 30px; padding-inline: 9px; }

.agent-composer {
  min-height: 104px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 34px;
  align-items: end;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-md);
  background: var(--bg);
}

.agent-composer textarea {
  min-height: 74px;
  resize: none;
  border: 0;
  outline: 0;
  color: var(--ink);
  background: transparent;
  font-size: 11px;
  line-height: 1.55;
}

.agent-composer textarea::placeholder { color: var(--muted); }

.agent-composer button {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  color: var(--white);
  background: var(--primary-strong);
}

.agent-composer button:hover { background: var(--primary); }
.agent-composer button svg { width: 16px; height: 16px; }

.empty-inspector {
  padding: 18px 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.65;
}

.empty-inspector-visual {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  margin-bottom: 14px;
  border-radius: var(--radius-md);
  background: var(--primary-soft);
  color: var(--primary);
}

.empty-inspector-visual svg { width: 22px; height: 22px; }
.empty-inspector p { margin: 0 0 10px; }
.empty-inspector ul { margin: 0; padding-left: 18px; }

.inspector-node-identity {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
}

.inspector-node-identity strong,
.inspector-node-identity span {
  display: block;
}

.inspector-node-identity strong { font-size: 13px; }
.inspector-node-identity span { margin-top: 2px; color: var(--muted); font-size: 10px; }

.form-section {
  margin: 0 0 20px;
  padding: 0;
  border: 0;
}

.form-section legend {
  width: 100%;
  margin-bottom: 10px;
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 650;
}

.inspector-capability-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
  margin: 4px 0 12px;
}

.inspector-capability-list span {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 7px 8px;
  border-radius: 7px;
  color: var(--ink-soft);
  background: var(--surface-hover);
  font-size: 9px;
}

.inspector-capability-list svg { width: 12px; height: 12px; color: var(--primary); }

.field {
  display: block;
  margin-bottom: 12px;
}

.field-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 10px;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--ink);
  font-size: 11px;
  line-height: 1.5;
  outline: 0;
  transition: border-color 150ms ease-out, background-color 150ms ease-out;
}

.field input,
.field select { height: 38px; padding: 0 10px; }
.field textarea { min-height: 76px; padding: 9px 10px; resize: vertical; }
.field textarea.code-field,
.field input.code-field { font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace; }

.field input:hover,
.field select:hover,
.field textarea:hover { border-color: var(--line-strong); }

.field input:focus,
.field select:focus,
.field textarea:focus { border-color: var(--primary); }

.field-hint {
  margin: 5px 0 0;
  color: var(--faint);
  font-size: 9px;
  line-height: 1.5;
}

.security-note,
.result-card {
  display: flex;
  gap: 9px;
  padding: 10px;
  border-radius: var(--radius-sm);
  background: oklch(0.22 0.035 85);
  color: oklch(0.84 0.1 85);
  font-size: 10px;
  line-height: 1.5;
}

.security-note svg,
.result-card svg { flex: 0 0 16px; width: 16px; margin-top: 1px; }

.result-card {
  margin-top: 12px;
  background: var(--primary-soft);
  color: oklch(0.82 0.1 145);
}

.result-card pre {
  max-height: 180px;
  margin: 6px 0 0;
  overflow: auto;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 9px;
}

.danger-zone {
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.button.danger {
  width: 100%;
  color: oklch(0.82 0.11 25);
  background: var(--danger-soft);
}

.button.danger:hover { background: oklch(0.28 0.08 25); }

.run-log {
  width: min(560px, calc(100% - 32px));
  max-height: min(520px, calc(100% - 32px));
  position: absolute;
  right: 16px;
  bottom: 16px;
  z-index: var(--z-dropdown);
  display: flex;
  flex-direction: column;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--panel-raised);
  box-shadow: var(--shadow-2);
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: opacity 180ms ease-out, transform 180ms ease-out;
}

.run-log.open {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.run-log header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.text-button {
  min-height: 32px;
  padding: 0 8px;
  border-radius: 6px;
  color: var(--muted);
  font-size: 10px;
}

.text-button:hover { color: var(--ink); background: var(--surface-hover); }

.log-summary {
  margin: 12px 0;
  padding: 9px 10px;
  border-radius: 7px;
  background: var(--bg);
  color: var(--ink-soft);
  font-size: 10px;
}

.log-list {
  margin: 0;
  padding: 0;
  overflow: auto;
  list-style: none;
}

.log-item {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr) auto;
  gap: 9px;
  padding: 10px 4px;
  border-bottom: 1px solid var(--line);
  font-size: 10px;
}

.log-item:last-child { border-bottom: 0; }
.log-item svg { width: 15px; height: 15px; }
.log-item.success > svg { color: var(--primary); }
.log-item.error > svg { color: var(--danger); }
.log-item.running > svg { color: var(--amber); animation: status-turn 900ms linear infinite; }

.log-item strong,
.log-item span { display: block; }
.log-item strong { color: var(--ink-soft); font-weight: 600; }
.log-item span { margin-top: 3px; color: var(--muted); line-height: 1.5; overflow-wrap: anywhere; }
.log-item time { color: var(--faint); font-variant-numeric: tabular-nums; }

.toast-region {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  pointer-events: none;
}

.toast {
  max-width: 320px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--panel-raised);
  box-shadow: var(--shadow-1);
  color: var(--ink-soft);
  font-size: 11px;
  animation: toast-in 180ms ease-out both;
}

.toast.success svg { color: var(--primary); }
.toast.error svg { color: var(--danger); }

@keyframes toast-in {
  from { opacity: 0; transform: translateY(-6px); }
}

.scrim {
  position: fixed;
  inset: var(--topbar-height) 0 0;
  z-index: var(--z-scrim);
  background: oklch(0 0 0 / 0.55);
}

.scrim[hidden] { display: none; }

@media (max-width: 1180px) {
  :root { --library-width: 232px; --inspector-width: 292px; --asset-width: 330px; --agent-width: 440px; }
  .node-library { padding-inline: 10px; }
  .inspector { padding-inline: 14px; }
  .minimap { display: none; }
  .credit-badge { display: none; }
}

@media (max-width: 900px) {
  .node-library,
  .inspector,
  .asset-panel,
  .agent-panel {
    width: min(330px, calc(100vw - 40px));
  }
  .run-log { right: 16px; }
  .template-grid { grid-template-columns: 1fr; }
  .template-palette { max-height: calc(100vh - 92px); overflow: auto; }
}

@media (max-width: 640px) {
  .topbar { padding-inline: 8px; gap: 8px; }
  .brand > span:last-child,
  .topbar-divider,
  .save-state,
  .desktop-label { display: none; }
  .workflow-name span { max-width: 118px; }
  .button.primary { padding-inline: 11px; }
  .button.primary span { display: none; }
  #templateToggle,
  #shareButton { display: none; }
  .canvas-hint { top: 10px; }
  .canvas-hint span { max-width: 230px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .canvas-controls { left: 10px; bottom: 10px; }
  .canvas-controls > :first-child,
  .canvas-controls > :nth-child(2),
  .canvas-controls > :nth-child(3) { display: none; }
  .creation-toolbar { bottom: 10px; }
  .run-log { width: calc(100% - 20px); right: 10px; bottom: 10px; max-height: 66%; }
  .workflow-menu { left: 10px; }
  .asset-list { grid-template-columns: 1fr; }
}

@media (pointer: coarse) {
  .library-item { min-height: 58px; }
  .port {
    --node-port-size: 26px;
    --node-port-half-size: 13px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 1ms !important;
  }
}
