﻿:root {
  --wf-bg: #f7f7fa;
  --wf-surface: #ffffff;
  --wf-border: rgba(15, 23, 42, 0.08);
  --wf-text: #111827;
  --wf-muted: #6b7280;
  --wf-accent: #5b4fff;
  --wf-accent-2: #7c6bff;
  --wf-accent-soft: rgba(91, 79, 255, 0.1);
  --wf-danger: #dc2626;
  --wf-success: #16a34a;
  --wf-warn: #d97706;
  --creatify-promo: linear-gradient(90deg, #5b4fff 0%, #7c3aed 100%);
  --creatify-shadow: 0 8px 30px rgba(15, 23, 42, 0.08);
  --creatify-dock-shadow: 0 10px 40px rgba(15, 23, 42, 0.14);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  height: 100vh;
  overflow: hidden;
  color: var(--wf-text);
  background: var(--wf-bg);
  font-family: Inter, "Segoe UI", system-ui, -apple-system, sans-serif;
}

.flow-app,
.creatify-app {
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

/* Promo / VIP banner */
.creatify-promo,
.creatify-vip-banner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 0.55rem 2.5rem;
  background: var(--creatify-promo);
  color: #fff;
  font-size: 0.82rem;
  position: relative;
  flex-shrink: 0;
}

.creatify-promo-text { font-weight: 500; }

.creatify-promo-cta {
  border: 1px solid rgba(255, 255, 255, 0.45);
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  border-radius: 999px;
  padding: 0.22rem 0.72rem;
  font-size: 0.74rem;
  font-weight: 600;
  cursor: pointer;
}

.creatify-promo-close {
  position: absolute;
  right: 0.85rem;
  top: 50%;
  transform: translateY(-50%);
  border: none;
  background: transparent;
  color: rgba(255, 255, 255, 0.85);
  font-size: 1.1rem;
  cursor: pointer;
  line-height: 1;
}

/* Header */
.creatify-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.65rem 1rem;
  background: var(--wf-surface);
  border-bottom: 1px solid var(--wf-border);
  flex-shrink: 0;
  z-index: 20;
}

.creatify-header-left,
.creatify-header-right,
.creatify-header-center {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  min-width: 0;
}

.creatify-header-center {
  flex: 1;
  justify-content: center;
}

.creatify-logo {
  width: 28px;
  height: 28px;
  border-radius: 8px;
}

.creatify-brand {
  font-size: 0.92rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.creatify-divider {
  width: 1px;
  height: 18px;
  background: var(--wf-border);
}

.creatify-project {
  font-size: 0.88rem;
  color: var(--wf-muted);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 14rem;
}

.creatify-user {
  font-size: 0.76rem;
  color: var(--wf-muted);
  max-width: 9rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.creatify-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.38rem 0.85rem;
  border-radius: 999px;
  border: 1px solid rgba(91, 79, 255, 0.22);
  background: rgba(91, 79, 255, 0.06);
  color: #4338ca;
  font-size: 0.76rem;
  font-weight: 500;
  white-space: nowrap;
}

.creatify-status-dot {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: var(--wf-accent);
  animation: pulse-dot 1.4s ease-in-out infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.45; transform: scale(0.85); }
}

.creatify-icon-btn {
  width: 32px;
  height: 32px;
  border: 1px solid var(--wf-border);
  border-radius: 10px;
  background: #fff;
  color: #6b7280;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  transition: background 0.12s ease, color 0.12s ease;
}

.creatify-icon-btn:hover:not(:disabled) {
  background: #f9fafb;
  color: var(--wf-text);
}

.creatify-icon-btn:disabled {
  opacity: 0.38;
  cursor: not-allowed;
}

.creatify-run-all {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  border: 1px solid var(--wf-border);
  border-radius: 999px;
  background: #fff;
  color: var(--wf-text);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.42rem 0.9rem;
  cursor: pointer;
  transition: all 0.12s ease;
}

.creatify-run-all:hover:not(:disabled) {
  border-color: rgba(91, 79, 255, 0.35);
  color: var(--wf-accent);
}

.creatify-run-all:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.creatify-upgrade {
  border: none;
  border-radius: 999px;
  background: var(--wf-accent);
  color: #fff;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.45rem 1rem;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(91, 79, 255, 0.28);
}

.creatify-credits {
  display: inline-flex;
  gap: 0.28rem;
  align-items: center;
  font-size: 0.72rem;
  font-weight: 600;
  color: #4338ca;
  background: var(--wf-accent-soft);
  border-radius: 999px;
  padding: 0.2rem 0.55rem;
}

.flow-lang-toggle {
  display: inline-flex;
  border: 1px solid var(--wf-border);
  border-radius: 10px;
  padding: 2px;
  background: #fafafa;
}

.flow-lang-btn {
  border: none;
  background: transparent;
  color: var(--wf-muted);
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.28rem 0.5rem;
  border-radius: 7px;
  cursor: pointer;
}

.flow-lang-btn.active {
  color: #fff;
  background: var(--wf-accent);
}

/* Workspace */
.creatify-workspace {
  flex: 1;
  display: flex;
  min-height: 0;
  position: relative;
  overflow: hidden;
}

.creatify-canvas-zone {
  flex: 1;
  position: relative;
  min-width: 0;
  background: #fafafb;
}

.creatify-estimate {
  position: absolute;
  top: 0.75rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 12;
  font-size: 0.72rem;
  color: var(--wf-muted);
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--wf-border);
  border-radius: 999px;
  padding: 0.25rem 0.7rem;
}

.creatify-toast {
  position: absolute;
  top: 0.75rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 14;
  max-width: min(520px, 90vw);
  border: 1px solid rgba(239, 68, 68, 0.3);
  background: #fef2f2;
  color: #991b1b;
  border-radius: 12px;
  padding: 0.55rem 0.85rem;
  font-size: 0.8rem;
  box-shadow: var(--creatify-shadow);
}

.creatify-impact,
.creatify-edges {
  position: absolute;
  top: 3rem;
  left: 1rem;
  z-index: 10;
  font-size: 0.72rem;
  color: var(--wf-muted);
}

/* Canvas */
.canvas-board,
.creatify-canvas {
  position: absolute;
  inset: 0;
  overflow: hidden;
  cursor: grab;
  touch-action: none;
  user-select: none;
  background:
    radial-gradient(circle at 1px 1px, rgba(148, 163, 184, 0.28) 1px, transparent 1.2px) 0 0/20px 20px,
    #fafafb;
}

.canvas-board.no-grid {
  background: #fafafb;
}

.canvas-board.is-panning {
  cursor: grabbing;
}

.canvas-board.canvas-paused .canvas-node {
  pointer-events: none;
  opacity: 0.94;
}

.canvas-board.canvas-paused {
  cursor: grab;
}

.canvas-pan {
  width: 100%;
  min-height: 100%;
  transform-origin: 0 0;
  will-change: transform;
}

.canvas-stage {
  position: relative;
  width: 1280px;
  height: 760px;
  transform-origin: top left;
}

.canvas-links {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.canvas-nodes {
  position: relative;
  width: 1280px;
  height: 760px;
}

.canvas-node {
  position: absolute;
  width: 210px;
  border: 1px solid rgba(15, 23, 42, 0.1);
  border-radius: 14px;
  background: #fff;
  padding: 0.72rem 0.8rem;
  display: grid;
  gap: 0.45rem;
  cursor: pointer;
  user-select: none;
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.06);
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}

.canvas-node.active {
  border-color: rgba(91, 79, 255, 0.55);
  box-shadow: 0 0 0 3px rgba(91, 79, 255, 0.12), 0 8px 24px rgba(15, 23, 42, 0.08);
}

.canvas-node.dirty {
  border-color: rgba(217, 119, 6, 0.55);
  box-shadow: 0 0 0 3px rgba(217, 119, 6, 0.1);
}

.canvas-node.dragging {
  opacity: 0.96;
  box-shadow: 0 16px 32px rgba(15, 23, 42, 0.16);
}

.canvas-node-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.canvas-node-title {
  display: flex;
  gap: 0.35rem;
  align-items: center;
  font-size: 0.74rem;
  font-weight: 600;
}

.canvas-node-glyph {
  width: 20px;
  height: 20px;
  border-radius: 7px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  color: var(--wf-accent);
  background: var(--wf-accent-soft);
}

.canvas-node-label { color: #374151; }

.canvas-node-tools {
  display: inline-flex;
  gap: 0.2rem;
  margin-left: auto;
}

.canvas-node-tool {
  border: none;
  width: 22px;
  height: 22px;
  border-radius: 7px;
  background: #f3f4f6;
  color: #6b7280;
  font-size: 11px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.canvas-node-tool:hover {
  background: var(--wf-accent-soft);
  color: var(--wf-accent);
}

.node-badge {
  font-size: 0.66rem;
  border-radius: 999px;
  padding: 0.12rem 0.42rem;
  border: 1px solid #e5e7eb;
  color: var(--wf-muted);
  background: #f9fafb;
}

.node-badge.running { color: var(--wf-warn); border-color: rgba(245, 158, 11, 0.35); background: #fffbeb; }
.node-badge.done { color: var(--wf-success); border-color: rgba(34, 197, 94, 0.35); background: #f0fdf4; }
.node-badge.fail { color: var(--wf-danger); border-color: rgba(239, 68, 68, 0.35); background: #fef2f2; }

.canvas-node-body {
  font-size: 0.74rem;
  color: var(--wf-muted);
  line-height: 1.45;
}

.canvas-node-reason {
  font-size: 0.68rem;
  color: #b45309;
  border-top: 1px dashed rgba(217, 119, 6, 0.25);
  padding-top: 0.32rem;
}

.canvas-node-ports {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.node-port {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  border: 2px solid #cbd5e1;
  background: #fff;
  cursor: pointer;
  transition: all 0.12s ease;
}

.node-port:hover {
  border-color: var(--wf-accent);
  background: var(--wf-accent-soft);
}

.node-port.hidden-port { visibility: hidden; }
.node-port.linking { border-color: #3b82f6; background: rgba(59, 130, 246, 0.35); }
.node-port.snap-target { border-color: #10b981; box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.15); }

.canvas-link { fill: none; stroke: rgba(100, 116, 139, 0.4); stroke-width: 2; }
.canvas-link.dirty { stroke: rgba(245, 158, 11, 0.75); }
.canvas-link.draft { stroke: rgba(59, 130, 246, 0.75); stroke-dasharray: 5 4; }

/* Bottom docks */
.creatify-dock {
  position: absolute;
  z-index: 16;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  background: #fff;
  border: 1px solid var(--wf-border);
  border-radius: 14px;
  box-shadow: var(--creatify-dock-shadow);
  padding: 0.35rem;
}

.creatify-dock-left {
  left: 1rem;
  bottom: 1rem;
}

.creatify-dock-center {
  left: 50%;
  bottom: 1.25rem;
  transform: translateX(-50%);
  background: #1f2937;
  border-color: rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  padding: 0.4rem 0.55rem;
  gap: 0.25rem;
}

.dock-btn,
.dock-zoom-btn,
.dock-zoom-label {
  border: none;
  background: transparent;
  color: #4b5563;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  transition: background 0.12s ease;
}

.dock-btn {
  width: 34px;
  height: 34px;
}

.dock-btn:hover,
.dock-zoom-btn:hover,
.dock-zoom-label:hover {
  background: #f3f4f6;
}

.dock-zoom {
  display: inline-flex;
  align-items: center;
  border-left: 1px solid var(--wf-border);
  border-right: 1px solid var(--wf-border);
  padding: 0 0.2rem;
}

.dock-zoom-btn {
  width: 28px;
  height: 28px;
  font-size: 1rem;
  font-weight: 500;
}

.dock-zoom-label {
  min-width: 3rem;
  height: 28px;
  font-size: 0.74rem;
  font-weight: 600;
  color: #374151;
  padding: 0 0.35rem;
}

.dock-tool {
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: rgba(255, 255, 255, 0.72);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.12s ease, color 0.12s ease;
}

.dock-tool:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.dock-tool.active {
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
}

.dock-tool-add {
  width: 42px;
  height: 42px;
  background: #fff;
  color: #111827;
  margin-right: 0.15rem;
}

.dock-tool-add:hover {
  background: #f3f4f6;
  color: #111827;
}

.creatify-copilot-fab {
  display: none;
  position: absolute;
  right: 1rem;
  bottom: 1rem;
  width: 52px;
  height: 52px;
  border: none;
  border-radius: 999px;
  background: var(--wf-accent);
  color: #fff;
  box-shadow: 0 10px 28px rgba(91, 79, 255, 0.38);
  cursor: pointer;
  z-index: 17;
  align-items: center;
  justify-content: center;
}

.creatify-branch-tabs {
  position: absolute;
  bottom: 4.5rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  z-index: 12;
}

.flow-branch-tab {
  border: 1px solid var(--wf-border);
  background: rgba(255, 255, 255, 0.95);
  color: var(--wf-muted);
  font-size: 0.72rem;
  border-radius: 999px;
  padding: 0.25rem 0.6rem;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.06);
}

.flow-branch-tab.active {
  color: #fff;
  border-color: transparent;
  background: var(--wf-accent);
}

.edge-chip {
  border: 1px solid var(--wf-border);
  background: rgba(255, 255, 255, 0.95);
  color: var(--wf-muted);
  font-size: 0.68rem;
  border-radius: 999px;
  padding: 0.2rem 0.48rem;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

.edge-chip button {
  border: none;
  background: transparent;
  color: #f87171;
  cursor: pointer;
  font-size: 0.7rem;
  padding: 0;
}

/* Right copilot panel */
.creatify-copilot {
  width: 360px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: #fff;
  border-left: 1px solid var(--wf-border);
  min-height: 0;
  transition: width 0.2s ease, margin 0.2s ease;
}

.creatify-copilot.collapsed {
  width: 0;
  overflow: hidden;
  border-left: none;
}

.creatify-copilot-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 1rem 1rem 0.75rem;
  border-bottom: 1px solid var(--wf-border);
  flex-shrink: 0;
}

.creatify-copilot-title-wrap h2 {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 700;
}

.creatify-copilot-badge {
  display: inline-block;
  margin-top: 0.35rem;
  font-size: 0.7rem;
  font-weight: 500;
  border-radius: 999px;
  padding: 0.18rem 0.55rem;
}

.creatify-copilot-badge.state-planning {
  color: #7c3aed;
  background: rgba(124, 58, 237, 0.1);
}

.creatify-copilot-badge.state-ready {
  color: #047857;
  background: rgba(16, 185, 129, 0.12);
}

.creatify-copilot-badge.state-thinking {
  color: #b45309;
  background: rgba(245, 158, 11, 0.14);
}

.creatify-copilot-badge.state-building {
  color: #4338ca;
  background: rgba(91, 79, 255, 0.12);
}

.creatify-copilot-badge.state-error {
  color: #b91c1c;
  background: rgba(239, 68, 68, 0.12);
}

.creatify-copilot-head-actions {
  display: flex;
  gap: 0.25rem;
}

.chat-log {
  flex: 1;
  padding: 1rem;
  overflow: auto;
  display: grid;
  gap: 0.85rem;
  align-content: start;
  min-height: 0;
}

.chat-msg {
  font-size: 0.82rem;
  line-height: 1.5;
  max-width: 92%;
}

.chat-msg.user {
  justify-self: end;
  background: #f3f4f6;
  border-radius: 14px 14px 4px 14px;
  padding: 0.65rem 0.8rem;
}

.chat-msg.assistant {
  justify-self: start;
}

.chat-role {
  display: block;
  font-size: 0.68rem;
  color: var(--wf-muted);
  margin-bottom: 0.35rem;
  font-weight: 600;
}

.chat-thinking-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.55rem;
  color: var(--wf-muted);
  font-size: 0.8rem;
  margin-top: 0.25rem;
}

.chat-thinking {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  color: var(--wf-muted);
  font-size: 0.8rem;
}

.chat-thinking-orb {
  width: 22px;
  height: 22px;
  border-radius: 999px;
  background: linear-gradient(135deg, #f59e0b, #ef4444, #8b5cf6);
  animation: orb-pulse 1.6s ease-in-out infinite;
}

@keyframes orb-pulse {
  0%, 100% { transform: scale(1); filter: blur(0); }
  50% { transform: scale(1.08); filter: blur(0.5px); }
}

.chat-skeleton {
  display: grid;
  gap: 0.45rem;
  margin-top: 0.5rem;
}

.chat-skeleton span {
  display: block;
  height: 10px;
  border-radius: 999px;
  background: linear-gradient(90deg, #f3f4f6 0%, #e5e7eb 50%, #f3f4f6 100%);
  background-size: 200% 100%;
  animation: shimmer 1.4s ease infinite;
}

.chat-skeleton span:nth-child(1) { width: 88%; }
.chat-skeleton span:nth-child(2) { width: 72%; }
.chat-skeleton span:nth-child(3) { width: 56%; }

@keyframes shimmer {
  0% { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}

.template-strip {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
  padding: 0 1rem 0.65rem;
  flex-shrink: 0;
}

.chip {
  border: 1px solid var(--wf-border);
  background: #fafafa;
  color: var(--wf-muted);
  font-size: 0.72rem;
  padding: 0.28rem 0.58rem;
  border-radius: 999px;
  cursor: pointer;
}

.chip:hover {
  border-color: rgba(91, 79, 255, 0.35);
  color: var(--wf-accent);
  background: var(--wf-accent-soft);
}

.creatify-composer {
  padding: 0 1rem 1rem;
  flex-shrink: 0;
}

.creatify-composer-box {
  border: 1px solid var(--wf-border);
  border-radius: 16px;
  background: #fafafa;
  padding: 0.65rem 0.75rem 0.55rem;
  display: grid;
  gap: 0.45rem;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.creatify-composer-tools {
  display: flex;
  gap: 0.35rem;
}

.composer-chip {
  border: 1px dashed #d1d5db;
  background: #fff;
  color: #4b5563;
  font-size: 0.72rem;
  font-weight: 500;
  border-radius: 999px;
  padding: 0.22rem 0.55rem;
  cursor: pointer;
}

.composer-chip:hover {
  border-color: var(--wf-accent);
  color: var(--wf-accent);
}

#chat-input {
  width: 100%;
  border: none;
  background: transparent;
  color: var(--wf-text);
  resize: none;
  min-height: 52px;
  max-height: 120px;
  padding: 0;
  font-family: inherit;
  font-size: 0.84rem;
  line-height: 1.45;
  outline: none;
}

.creatify-composer-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.creatify-composer-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.creatify-stop-btn {
  width: 32px;
  height: 32px;
  border: 1px solid rgba(239, 68, 68, 0.35);
  border-radius: 10px;
  background: #fef2f2;
  color: #dc2626;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.creatify-stop-btn:hover {
  background: #fee2e2;
}

.creatify-model-tag {
  font-size: 0.7rem;
  color: var(--wf-muted);
  font-weight: 500;
}

.creatify-send-btn {
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 10px;
  background: var(--wf-accent);
  color: #fff;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(91, 79, 255, 0.28);
}

.creatify-send-btn:hover {
  background: #4f46e5;
}

.creatify-composer-box:has(textarea:disabled) {
  opacity: 0.82;
}

/* Inspector overlay */
.creatify-inspector {
  position: absolute;
  left: 1rem;
  top: 1rem;
  bottom: 1rem;
  width: 320px;
  z-index: 18;
  display: flex;
  flex-direction: column;
  background: #fff;
  border: 1px solid var(--wf-border);
  border-radius: 16px;
  box-shadow: var(--creatify-dock-shadow);
  overflow: hidden;
}

.creatify-inspector-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--wf-border);
  flex-shrink: 0;
}

.creatify-inspector-head h2 {
  margin: 0;
  font-size: 0.88rem;
  font-weight: 700;
}

.creatify-inspector-head-actions {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.creatify-batch-label {
  font-size: 0.7rem;
  color: var(--wf-muted);
}

.creatify-inspector-scroll {
  flex: 1;
  overflow: auto;
  min-height: 0;
}

.inspector-body {
  padding: 0.9rem 1rem;
  display: grid;
  gap: 0.75rem;
}

.field {
  display: grid;
  gap: 0.3rem;
  font-size: 0.74rem;
  color: var(--wf-muted);
}

.field input,
.field select,
.field textarea {
  border: 1px solid var(--wf-border);
  background: #fff;
  border-radius: 10px;
  color: var(--wf-text);
  padding: 0.5rem 0.56rem;
  font-size: 0.82rem;
  font-family: inherit;
}

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

.inspector-actions {
  display: flex;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.preview-block,
.compare-block {
  border-top: 1px solid var(--wf-border);
  padding: 0.9rem 1rem;
}

.preview-block h3,
.compare-block h3 {
  margin: 0 0 0.55rem;
  font-size: 0.82rem;
  font-weight: 700;
}

.flow-preview-stage {
  aspect-ratio: 9 / 16;
  max-width: 200px;
  margin: 0 auto;
  border-radius: 12px;
  overflow: hidden;
  background: #111827;
  border: 1px solid var(--wf-border);
  display: flex;
  align-items: center;
  justify-content: center;
}

.flow-preview-stage video {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.flow-preview-empty {
  text-align: center;
  font-size: 0.75rem;
  color: var(--wf-muted);
  padding: 1rem;
}

.flow-preview-meta {
  font-size: 0.75rem;
  color: var(--wf-muted);
  margin: 0.55rem 0;
}

.flow-preview-actions {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.compare-list {
  font-size: 0.74rem;
  line-height: 1.45;
  display: grid;
  gap: 0.45rem;
}

.compare-controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.45rem;
}

.compare-controls label {
  display: grid;
  gap: 0.25rem;
  font-size: 0.7rem;
  color: var(--wf-muted);
}

.compare-controls select {
  border: 1px solid var(--wf-border);
  border-radius: 8px;
  background: #fff;
  color: var(--wf-text);
  font-size: 0.74rem;
  padding: 0.32rem 0.46rem;
}

.compare-grid { display: grid; gap: 0.45rem; }

.compare-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
}

.compare-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.72rem;
  color: var(--wf-muted);
}

.compare-activate-actions { display: flex; gap: 0.35rem; }

.compare-row {
  border: 1px solid var(--wf-border);
  border-radius: 10px;
  background: #fafafa;
}

.compare-row-key {
  font-size: 0.7rem;
  color: var(--wf-muted);
  border-bottom: 1px solid var(--wf-border);
  padding: 0.38rem 0.5rem;
}

.compare-row-values {
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.compare-row-values > div {
  padding: 0.45rem 0.5rem;
  font-size: 0.74rem;
  min-height: 2.4rem;
}

.compare-row-values > div + div {
  border-left: 1px dashed var(--wf-border);
}

.compare-changed { color: #b45309; }

.compare-empty {
  border: 1px dashed var(--wf-border);
  border-radius: 9px;
  padding: 0.45rem 0.55rem;
  font-size: 0.74rem;
}

.compare-item {
  border: 1px solid var(--wf-border);
  border-radius: 9px;
  padding: 0.45rem 0.55rem;
  background: #fafafa;
}

/* Generic buttons */
.btn {
  border: none;
  border-radius: 10px;
  padding: 0.42rem 0.72rem;
  font-size: 0.78rem;
  cursor: pointer;
  font-family: inherit;
}

.btn.primary {
  color: #fff;
  background: var(--wf-accent);
}

.btn.ghost {
  color: var(--wf-text);
  border: 1px solid var(--wf-border);
  background: #fff;
}

.btn-sm {
  font-size: 0.72rem;
  padding: 0.34rem 0.6rem;
}

.muted { color: var(--wf-muted); }
.hidden { display: none !important; }

.canvas-board.pan-mode {
  cursor: grab;
}

.canvas-board.pan-mode .canvas-node {
  cursor: grab;
}

/* Auth loading */
.flow-auth-loading {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(18, 22, 38, 0.52);
  backdrop-filter: blur(18px);
}

.flow-auth-loading-card {
  text-align: center;
  padding: 2rem;
}

.flow-auth-logo {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  box-shadow: 0 10px 25px rgba(91, 79, 255, 0.35);
}

.flow-auth-loading-card h2 {
  margin: 0.85rem 0 1.2rem;
  font-size: 1.15rem;
  color: #fff;
}

.flow-auth-spinner {
  width: 34px;
  height: 34px;
  margin: 0 auto 0.95rem;
  border: 3px solid rgba(255, 255, 255, 0.1);
  border-top-color: var(--wf-accent);
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
}

.flow-auth-loading-card p {
  margin: 0;
  font-size: 0.82rem;
  color: #d1d5db;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Responsive */
@media (max-width: 1024px) {
  .creatify-copilot {
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    z-index: 22;
    box-shadow: -8px 0 30px rgba(15, 23, 42, 0.1);
  }

  .creatify-copilot.collapsed {
    width: 0;
    margin-right: 0;
  }

  .creatify-copilot-fab {
    display: inline-flex;
  }
}

@media (max-width: 768px) {
  .creatify-promo { font-size: 0.74rem; padding: 0.5rem 2rem; }
  .creatify-project { display: none; }
  .creatify-header-center { display: none; }
  .creatify-dock-left { left: 0.5rem; bottom: 0.65rem; }
  .creatify-dock-center { bottom: 0.85rem; transform: translateX(-50%) scale(0.92); }
  .creatify-inspector {
    left: 0.5rem;
    right: 0.5rem;
    width: auto;
    top: auto;
    bottom: 0.65rem;
    max-height: 58vh;
  }
}

@media (max-width: 640px) {
  .creatify-copilot {
    width: 100%;
    max-width: 100%;
  }

  .creatify-copilot:not(.collapsed) {
    width: min(100%, 360px);
  }

  .flow-lang-toggle { display: none; }
  .creatify-user { display: none; }

  .canvas-stage,
  .canvas-nodes {
    width: 980px;
    height: 560px;
  }

  .canvas-node { width: 178px; }
}
