:root {
  --primary: #3B82F6;
  --primary-hover: #2563EB;
  --primary-soft: #DBEAFE;
  --bg: #F4F8FC;
  --surface: #FFFFFF;
  --sidebar: #FFFFFF;
  --sidebar-hover: #EFF6FF;
  --sidebar-text: #64748B;
  --sidebar-text-strong: #0F172A;
  --border: #E2E8F0;
  --heading: #0F172A;
  --text: #475569;
  --muted: #94A3B8;
  --success: #22C55E;
  --warning: #F59E0B;
  --danger: #EF4444;
  --info: #0EA5E9;
  --node-trigger: #3B82F6;
  --node-ai: #0EA5E9;
  --node-knowledge: #06B6D4;
  --node-logic: #F59E0B;
  --node-output: #22C55E;
  --radius: 16px;
  --shadow: 0 8px 24px rgba(37, 99, 235, 0.06);
  --font: "Inter", system-ui, -apple-system, sans-serif;
  --sidebar-width: 280px;
  --sidebar-collapsed: 80px;
  --activity-width: 300px;
  --transition: 200ms ease;
}

html[data-theme="dark"] {
  --bg: #0B1220;
  --surface: #111827;
  --sidebar: #0F172A;
  --sidebar-hover: #1E293B;
  --sidebar-text: #94A3B8;
  --sidebar-text-strong: #F8FAFC;
  --border: #1E293B;
  --heading: #F8FAFC;
  --text: #CBD5E1;
  --muted: #64748B;
  --primary-soft: rgba(59, 130, 246, 0.18);
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }

[x-cloak] { display: none !important; }

body.app-body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
  font-size: 16px;
  transition: background var(--transition), color var(--transition);
}

h1, .h1 { font-size: 36px; font-weight: 700; color: var(--heading); letter-spacing: -0.03em; line-height: 1.25; }
h2, .h2 { font-size: 28px; font-weight: 650; color: var(--heading); letter-spacing: -0.02em; }
h3, .h3 { font-size: 22px; font-weight: 600; color: var(--heading); }
.h4, h4 { color: var(--heading); }
.h5, h5, .h6, h6 { color: var(--heading); font-weight: 600; }
.small, small, .text-muted, .caption { color: var(--muted) !important; }
.text-muted { color: var(--muted) !important; }

a { color: var(--primary); }
a:hover { color: var(--primary-hover); }

.btn {
  border-radius: 12px;
  font-weight: 550;
  transition: all var(--transition);
}

.btn-primary {
  --bs-btn-bg: var(--primary);
  --bs-btn-border-color: var(--primary);
  --bs-btn-hover-bg: var(--primary-hover);
  --bs-btn-hover-border-color: var(--primary-hover);
  --bs-btn-active-bg: var(--primary-hover);
  --bs-btn-active-border-color: var(--primary-hover);
  --bs-btn-focus-shadow-rgb: 59, 130, 246;
}

.btn-outline-primary {
  --bs-btn-color: var(--primary);
  --bs-btn-border-color: var(--primary);
  --bs-btn-hover-bg: var(--primary);
  --bs-btn-hover-border-color: var(--primary);
  --bs-btn-hover-color: #fff;
}

.btn-outline-secondary {
  --bs-btn-color: var(--text);
  --bs-btn-border-color: var(--border);
  --bs-btn-hover-bg: var(--bg);
  --bs-btn-hover-border-color: var(--border);
  --bs-btn-hover-color: var(--heading);
}

.btn-secondary {
  --bs-btn-bg: #64748B;
  --bs-btn-border-color: #64748B;
  --bs-btn-hover-bg: #475569;
  --bs-btn-hover-border-color: #475569;
}

.form-control, .form-select {
  border-radius: 12px;
  border-color: var(--border);
  background: var(--surface);
  color: var(--heading);
  padding: 0.65rem 0.9rem;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.form-control:focus, .form-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
  background: var(--surface);
  color: var(--heading);
}

.table {
  --bs-table-bg: transparent;
  --bs-table-color: var(--text);
  --bs-table-border-color: var(--border);
}

.table > :not(caption) > * > * {
  padding: 0.9rem 1rem;
  background: transparent;
  color: var(--text);
  border-bottom-color: var(--border);
}

.table thead th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
  border-bottom-width: 1px;
}

.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr;
  min-height: 100vh;
  transition: grid-template-columns var(--transition);
}

.app-shell.sidebar-collapsed {
  grid-template-columns: var(--sidebar-collapsed) 1fr;
}

.app-shell.activity-visible {
  grid-template-columns: var(--sidebar-width) 1fr var(--activity-width);
}

.app-shell.sidebar-collapsed.activity-visible {
  grid-template-columns: var(--sidebar-collapsed) 1fr var(--activity-width);
}

.app-sidebar {
  background: var(--sidebar);
  color: var(--sidebar-text);
  padding: 1rem 0.75rem 1.25rem;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  border-right: 1px solid var(--border);
  box-shadow: 1px 0 0 rgba(59, 130, 246, 0.04);
}

.app-sidebar .brand {
  color: var(--sidebar-text-strong);
  font-weight: 700;
  font-size: 1rem;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.45rem 0.65rem 0.85rem;
  letter-spacing: -0.02em;
}

.app-sidebar .brand-mark {
  width: 30px;
  height: 30px;
  border-radius: 10px;
  background: linear-gradient(135deg, #60A5FA, #2563EB);
  display: grid;
  place-items: center;
  color: #fff;
  flex-shrink: 0;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
}

.app-sidebar .side-link {
  color: var(--sidebar-text);
  border-radius: 10px;
  padding: 0.52rem 0.72rem;
  display: flex;
  align-items: center;
  gap: 0.7rem;
  text-decoration: none !important;
  transition: background var(--transition), color var(--transition);
  white-space: nowrap;
  font-size: 13.5px;
  font-weight: 500;
  line-height: 1.2;
}

.app-sidebar .side-link i,
.app-sidebar .side-link svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  opacity: 0.85;
}

.app-sidebar .side-link:hover {
  background: var(--sidebar-hover);
  color: var(--sidebar-text-strong);
}

.app-sidebar .side-link.is-active {
  background: var(--primary-soft) !important;
  color: var(--primary-hover) !important;
  box-shadow: none;
  font-weight: 600;
}

.app-sidebar .side-link.is-active i,
.app-sidebar .side-link.is-active svg {
  opacity: 1;
  color: var(--primary);
}

.side-divider {
  height: 1px;
  background: var(--border);
  margin: 0.65rem 0.55rem;
}

.side-group {
  margin: 0;
}

.side-group-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  width: 100%;
  padding: 0.55rem 0.72rem;
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  user-select: none;
  border-radius: 8px;
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  font-family: inherit;
  text-align: left;
}

.side-group-head:hover,
.side-group-head.has-active {
  color: var(--primary);
}

.side-chevron {
  transition: transform var(--transition);
  opacity: 0.7;
  flex-shrink: 0;
  pointer-events: none;
}

.side-group.is-open .side-chevron {
  transform: rotate(90deg);
}

.side-group-body {
  display: none;
  flex-direction: column;
  gap: 2px;
  padding: 0 0 0.25rem;
}

.side-group.is-open .side-group-body {
  display: flex;
}

.app-shell.sidebar-collapsed .brand-text,
.app-shell.sidebar-collapsed .side-group-head,
.app-shell.sidebar-collapsed .side-divider,
.app-shell.sidebar-collapsed .side-link span {
  display: none;
}

.app-shell.sidebar-collapsed .side-link {
  justify-content: center;
  padding: 0.65rem;
}

.app-shell.sidebar-collapsed .brand {
  justify-content: center;
  padding-left: 0;
  padding-right: 0;
}

.app-shell.sidebar-collapsed .side-group-body {
  display: none;
}

.app-shell.sidebar-collapsed .side-group.is-open .side-group-body,
.app-shell.sidebar-collapsed .side-group-body {
  display: flex !important;
}

.app-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--bg);
}

.app-content {
  padding: 1.75rem 2rem 2.5rem;
  max-width: 100%;
}

.app-topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0.85rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  position: sticky;
  top: 0;
  z-index: 20;
  min-height: 68px;
}

.topbar-search {
  flex: 1;
  max-width: 480px;
  position: relative;
}

.topbar-search input {
  width: 100%;
  border: 1px solid var(--border);
  background: var(--bg);
  border-radius: 12px;
  padding: 0.65rem 0.9rem 0.65rem 2.4rem;
  color: var(--heading);
  outline: none;
}

.topbar-search input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}

.topbar-search .search-icon {
  position: absolute;
  left: 0.85rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  width: 16px;
  height: 16px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-left: auto;
}

.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: all var(--transition);
}

.icon-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-soft);
}

.kbd {
  font-size: 11px;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.1rem 0.35rem;
  color: var(--muted);
  background: var(--bg);
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.25rem 0.35rem 0.25rem 0.25rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--primary-soft);
  color: var(--primary);
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 13px;
}

.tenant-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 1rem;
  border-radius: 12px;
  background: var(--primary-soft);
  border: 1px solid rgba(59, 130, 246, 0.28);
  color: var(--heading);
  font-size: 14px;
}

.page-kicker {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  font-weight: 650;
  margin: 0;
}

.page-title {
  font-size: 28px;
  font-weight: 700;
  color: var(--heading);
  letter-spacing: -0.03em;
  line-height: 1.2;
}

.page-heading {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 0.75rem;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
}

.kpi-card {
  padding: 1.15rem 1.2rem;
  transition: transform var(--transition), box-shadow var(--transition);
}

.kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.08);
}

.kpi-top {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: 0.85rem;
}

.kpi-icon {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--primary-soft);
  color: var(--primary);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.kpi-label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
}

.kpi-value {
  font-size: 1.65rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--heading);
  line-height: 1.15;
}

.content-panel {
  padding: 1.15rem 1.25rem;
}

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

.panel-title {
  font-size: 15px;
  font-weight: 650;
  color: var(--heading);
  margin: 0;
}

.panel-link {
  font-size: 13px;
  font-weight: 550;
  text-decoration: none;
}

.activity-list {
  display: flex;
  flex-direction: column;
}

.activity-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.8rem 0;
  border-bottom: 1px solid var(--border);
}

.activity-row:last-child {
  border-bottom: 0;
}

.activity-action {
  color: var(--heading);
  font-size: 14px;
  font-weight: 550;
}

.activity-time {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.quick-links {
  display: grid;
  gap: 0.55rem;
}

.quick-link {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.75rem 0.9rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  color: var(--heading);
  text-decoration: none;
  background: var(--surface);
  transition: all var(--transition);
  font-weight: 550;
  font-size: 14px;
}

.quick-link:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-soft);
}

.quick-link.primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.quick-link.primary:hover {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
  color: #fff;
}

@media (max-width: 1200px) {
  .kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .kpi-grid {
    grid-template-columns: 1fr;
  }
}

.app-activity {
  background: var(--surface);
  border-left: 1px solid var(--border);
  padding: 1.25rem;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: auto;
  display: none;
}

.app-shell.activity-visible .app-activity {
  display: block;
}

.app-activity__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 1rem;
}

.app-activity .panel-title {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  font-weight: 650;
  margin-bottom: 1rem;
}

.app-activity__head .panel-title {
  margin-bottom: 0;
}

.card-surface {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.25rem 1.35rem;
}

.company-logo-preview {
  width: 72px;
  height: 72px;
  object-fit: contain;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg);
  padding: 6px;
}

.company-logo-placeholder,
.company-logo-thumb.placeholder {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--primary-soft);
  color: var(--primary);
  display: grid;
  place-items: center;
  font-weight: 700;
  flex-shrink: 0;
}

.company-logo-thumb {
  width: 40px;
  height: 40px;
  object-fit: contain;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg);
  flex-shrink: 0;
}

.brand-swatch-block {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.brand-swatch {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid var(--border);
  display: inline-block;
}

.brand-swatch-inline {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  margin-top: 4px;
}

.stat-card {
  padding: 1.35rem;
  position: relative;
  overflow: hidden;
}

.stat-card .stat-icon {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: var(--primary-soft);
  color: var(--primary);
  display: grid;
  place-items: center;
  margin-bottom: 1rem;
}

.stat-card .label {
  color: var(--muted);
  font-size: 14px;
  margin-bottom: 0.25rem;
}

.stat-card .value {
  font-size: 1.85rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--heading);
  line-height: 1.2;
}

.stat-card .delta {
  margin-top: 0.55rem;
  font-size: 13px;
  font-weight: 600;
}

.stat-card .delta.up { color: var(--success); }
.stat-card .delta.flat { color: var(--muted); }

.stat-card .sparkline {
  position: absolute;
  right: 1rem;
  bottom: 1rem;
  opacity: 0.7;
}

.badge-soft {
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 600;
  border-radius: 999px;
  padding: 0.35em 0.7em;
}

.activity-item {
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}

.activity-item:last-child {
  border-bottom: 0;
}

.activity-item .fw-semibold {
  color: var(--heading);
  font-size: 13px;
}

.breadcrumb-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 1rem;
}

.guest-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background:
    radial-gradient(ellipse at top left, rgba(59, 130, 246, 0.16), transparent 45%),
    radial-gradient(ellipse at bottom right, rgba(14, 165, 233, 0.10), transparent 40%),
    var(--bg);
  padding: 2rem 1rem;
  font-family: var(--font);
}

.guest-card {
  width: 100%;
  max-width: 440px;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  padding: 2rem;
}

.guest-card .brand {
  font-weight: 700;
  font-size: 1.35rem;
  color: var(--primary);
  letter-spacing: -0.02em;
  margin-bottom: 0.25rem;
}

.flash-stack {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 1080;
  width: min(360px, calc(100vw - 2rem));
}

.flash-stack .alert {
  border-radius: 14px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.command-overlay {
  position: fixed;
  inset: 0;
  background: rgba(24, 24, 27, 0.45);
  backdrop-filter: blur(4px);
  z-index: 2000;
  display: grid;
  place-items: start center;
  padding-top: 12vh;
}

.command-palette {
  width: min(640px, calc(100vw - 2rem));
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.command-palette input {
  width: 100%;
  border: 0;
  border-bottom: 1px solid var(--border);
  padding: 1rem 1.15rem;
  font-size: 16px;
  background: transparent;
  color: var(--heading);
  outline: none;
}

.command-list {
  max-height: 360px;
  overflow: auto;
  padding: 0.5rem;
}

.command-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 0.85rem;
  border-radius: 12px;
  color: var(--text);
  text-decoration: none;
  cursor: pointer;
}

.command-item:hover,
.command-item.active {
  background: var(--primary-soft);
  color: var(--heading);
}

.workflow-canvas {
  min-height: 300px;
  border-radius: var(--radius);
  background:
    linear-gradient(var(--border) 1px, transparent 1px) 0 0 / 24px 24px,
    linear-gradient(90deg, var(--border) 1px, transparent 1px) 0 0 / 24px 24px,
    var(--surface);
  border: 1px solid var(--border);
  padding: 1.25rem;
}

.wf-node {
  min-width: 168px;
  border-radius: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  padding: 0.9rem 1rem;
  border-top: 3px solid var(--node-logic);
}

.wf-node.trigger { border-top-color: var(--node-trigger); }
.wf-node.agent,
.wf-node.ai { border-top-color: var(--node-ai); }
.wf-node.knowledge { border-top-color: var(--node-knowledge); }
.wf-node.condition,
.wf-node.loop,
.wf-node.delay,
.wf-node.approval,
.wf-node.logic { border-top-color: var(--node-logic); }
.wf-node.action,
.wf-node.webhook,
.wf-node.output { border-top-color: var(--node-output); }

.empty-state {
  text-align: center;
  padding: 3rem 1.5rem;
  color: var(--muted);
}

.empty-state .empty-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 1rem;
  border-radius: 16px;
  background: var(--primary-soft);
  color: var(--primary);
  display: grid;
  place-items: center;
}

.list-group-item {
  background: transparent;
  border-color: var(--border);
  color: var(--text);
}

.list-group-item.active {
  background: var(--primary);
  border-color: var(--primary);
}

.border { border-color: var(--border) !important; }
.border-bottom { border-bottom-color: var(--border) !important; }

@media (max-width: 1280px) {
  .app-shell,
  .app-shell.sidebar-collapsed {
    grid-template-columns: var(--sidebar-width) 1fr;
  }
  .app-shell.sidebar-collapsed {
    grid-template-columns: var(--sidebar-collapsed) 1fr;
  }
  .app-activity { display: none; }
}

@media (max-width: 768px) {
  .app-shell,
  .app-shell.sidebar-collapsed {
    grid-template-columns: 1fr;
  }
  .app-sidebar {
    position: relative;
    height: auto;
    max-height: none;
  }
  .topbar-search { display: none; }
  h1, .h1 { font-size: 28px; }
  h2, .h2 { font-size: 22px; }
}

/* Workflow node library palette */
.wf-lib-group { margin-bottom: 16px; }
.wf-lib-group__title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
}
.wf-lib-nodes {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.wf-lib-node {
  --wf-node-color: #64748b;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--heading);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.05s ease;
}
.wf-lib-node:hover {
  border-color: var(--wf-node-color);
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.08);
}
.wf-lib-node:active { transform: translateY(1px); }
.wf-lib-node__dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--wf-node-color);
  flex: 0 0 auto;
}

/* Workflow visual builder */
#wf-builder {
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  background: var(--surface);
}
.wf-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.wf-toolbar__group { display: flex; align-items: center; gap: 6px; }
.wf-zoom-label { font-size: 12px; color: var(--muted); min-width: 42px; text-align: center; }
.wf-focus-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--heading, #0f172a);
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-right: 4px;
}
.wf-dirty-badge {
  font-size: 11px;
  font-weight: 600;
  color: #b45309;
  background: #fef3c7;
  border-radius: 999px;
  padding: 2px 10px;
}
.wf-autosave-status {
  font-size: 11px;
  font-weight: 600;
  color: #047857;
  background: #d1fae5;
  border-radius: 999px;
  padding: 2px 10px;
}
.wf-autosave-check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--muted, #64748b);
  user-select: none;
  cursor: pointer;
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface, #fff);
}
.wf-autosave-check input {
  margin: 0;
  accent-color: #ea580c;
}
#wf-autosave-btn.active,
[data-wf="toggle-autosave"].active {
  background: #ecfdf5;
  border-color: #6ee7b7;
  color: #047857;
}
.wf-builder-body { display: flex; height: 620px; }
.wf-palette {
  width: 230px;
  flex: 0 0 230px;
  border-right: 1px solid var(--border);
  padding: 12px;
  overflow: auto;
}
.wf-canvas-wrap {
  position: relative;
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
}

/* ---------- Workflow editor fullscreen / focus mode ---------- */
body.wf-focus-mode {
  overflow: hidden;
}
body.wf-focus-mode .app-sidebar,
body.wf-focus-mode .app-topbar,
body.wf-focus-mode .app-activity,
body.wf-focus-mode .tenant-banner,
body.wf-focus-mode .page-heading,
body.wf-focus-mode .flash-toast-host {
  display: none !important;
}
body.wf-focus-mode .app-shell,
body.wf-focus-mode .app-shell.sidebar-collapsed,
body.wf-focus-mode .app-shell.activity-visible,
body.wf-focus-mode .app-shell.sidebar-collapsed.activity-visible {
  grid-template-columns: 1fr !important;
  min-height: 100vh;
}
body.wf-focus-mode .app-main {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
body.wf-focus-mode .app-content {
  padding: 0 !important;
  margin: 0 !important;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
body.wf-focus-mode .wf-page {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  height: 100vh;
}
body.wf-focus-mode .wf-page__header {
  display: none !important;
}
body.wf-focus-mode #wf-builder {
  flex: 1;
  min-height: 0;
  border: none;
  border-radius: 0;
  display: flex;
  flex-direction: column;
}
body.wf-focus-mode #wf-builder > .wf-pane {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
body.wf-focus-mode #wf-builder > .wf-pane.d-none {
  display: none !important;
}
body.wf-focus-mode .wf-builder-body {
  flex: 1;
  height: auto !important;
  min-height: 0;
}
body.wf-focus-mode .wf-exec {
  height: calc(100vh - 48px) !important;
}
body.wf-focus-mode .wf-toolbar [data-wf="toggle-focus"].active {
  background: #fff7ed;
  border-color: #fdba74;
  color: #c2410c;
}
.wf-canvas {
  position: relative;
  flex: 1 1 auto;
  overflow: hidden;
  background-color: var(--bg, #f8fafc);
  background-image:
    linear-gradient(to right, rgba(148, 163, 184, 0.18) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(148, 163, 184, 0.18) 1px, transparent 1px);
  background-size: 22px 22px;
  cursor: grab;
  outline: none;
  touch-action: none;
}
.wf-canvas.panning { cursor: grabbing; }
.wf-world {
  position: absolute;
  top: 0;
  left: 0;
  width: 5000px;
  height: 4000px;
  transform-origin: 0 0;
}
.wf-edges {
  position: absolute;
  top: 0;
  left: 0;
  width: 5000px;
  height: 4000px;
  overflow: visible;
  pointer-events: none;
}
.wf-edge {
  fill: none;
  stroke: #94a3b8;
  stroke-width: 2;
}
.wf-edge.is-run-success {
  stroke: #16a34a;
  stroke-width: 2.75;
}
.wf-edge.is-run-muted {
  stroke: #64748b;
  stroke-width: 2;
  opacity: 0.85;
}
.wf-edge--temp { stroke-dasharray: 5 4; stroke: var(--primary); }
.wf-edge-hit {
  fill: none;
  stroke: transparent;
  stroke-width: 14;
  pointer-events: stroke;
  cursor: pointer;
}
.wf-canvas-empty {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 14px;
  pointer-events: none;
}
.wf-node-card {
  position: absolute;
  width: 190px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--wf-node-color, #64748b);
  border-radius: 10px;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
  padding: 10px 12px;
  cursor: grab;
  user-select: none;
}
.wf-node-card.selected {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-soft), 0 4px 12px rgba(15, 23, 42, 0.12);
}
.wf-node-card.is-disabled { opacity: 0.55; }
.wf-node-card__head { display: flex; flex-direction: column; gap: 2px; pointer-events: none; }
.wf-node-card__type {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--muted);
}
.wf-node-card__title { font-size: 13px; font-weight: 600; color: var(--heading); }
.wf-port {
  position: absolute;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--surface);
  border: 2px solid var(--wf-node-color, #64748b);
  top: 27px;
  z-index: 2;
}
.wf-port.in { left: -8px; }
.wf-port.out { right: -8px; cursor: crosshair; }
.wf-port.out:hover { background: var(--wf-node-color, #64748b); }
.wf-node-card--multi {
  min-height: 92px;
  padding: 14px 14px 14px 58px;
  display: flex;
  align-items: center;
}
.wf-node-card--multi .wf-node-card__head {
  width: 100%;
  padding-right: 4px;
}
.wf-port-label {
  position: absolute;
  right: 10px;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  pointer-events: none;
  line-height: 1.2;
  z-index: 1;
  background: var(--surface);
  padding: 0 2px;
}
.wf-port-label--in {
  right: auto;
  left: 10px;
  max-width: 46px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.wf-settings {
  width: 280px;
  flex: 0 0 280px;
  border-left: 1px solid var(--border);
  padding: 12px;
  overflow: auto;
}
.wf-settings__head { margin-bottom: 8px; }
.wf-settings__type {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--muted);
}
.wf-field { margin-bottom: 10px; }
.wf-field__label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 4px;
}
.wf-settings__actions { display: flex; gap: 8px; margin-top: 14px; }
.wf-toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 1080;
  padding: 10px 16px;
  border-radius: 10px;
  color: #fff;
  font-size: 13px;
  box-shadow: 0 6px 20px rgba(15, 23, 42, 0.2);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.wf-toast.show { opacity: 1; transform: translateY(0); }
.wf-toast--ok { background: #16a34a; }
.wf-toast--error { background: #dc2626; }

/* Phase 12 — builder polish */
.wf-toolbar [data-wf].active {
  background: #e2e8f0;
  border-color: #94a3b8;
}
.wf-stickies {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1;
}
.wf-sticky {
  position: absolute;
  width: 140px;
  min-height: 90px;
  padding: 6px;
  border-radius: 4px;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.12);
  pointer-events: auto;
  z-index: 2;
  border: 1px solid rgba(15, 23, 42, 0.08);
}
.wf-sticky.selected { outline: 2px solid #2563eb; }
.wf-sticky textarea {
  width: 100%;
  height: 78px;
  border: none;
  background: transparent;
  resize: none;
  font-size: 12px;
  line-height: 1.35;
  outline: none;
}
.wf-minimap {
  position: absolute;
  right: 10px;
  bottom: 10px;
  width: 160px;
  height: 100px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.1);
  z-index: 5;
  overflow: hidden;
  pointer-events: none;
}
.wf-editor-logs,
.wf-versions {
  border-top: 1px solid var(--border);
  max-height: 160px;
  overflow: auto;
  background: var(--surface);
  flex: 0 0 auto;
}
.wf-editor-logs__head,
.wf-versions__head {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 6px 10px;
  border-bottom: 1px solid var(--border);
}
.wf-editor-logs__body,
.wf-versions__list { padding: 4px 0; }
.wf-log-row {
  display: flex;
  gap: 8px;
  padding: 3px 10px;
  font-size: 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.wf-log-row__lvl {
  flex: 0 0 64px;
  color: var(--muted);
  text-transform: uppercase;
  font-size: 10px;
}
.wf-version-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.wf-cmd {
  position: fixed;
  inset: 0;
  z-index: 1100;
  background: rgba(15, 23, 42, 0.4);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 12vh;
}
.wf-cmd__panel {
  width: min(520px, 92vw);
  background: var(--surface, #fff);
  border-radius: 12px;
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.3);
  overflow: hidden;
}
.wf-cmd__panel .form-control {
  border: none;
  border-bottom: 1px solid var(--border);
  border-radius: 0;
  padding: 14px 16px;
  font-size: 15px;
}
.wf-cmd__list {
  max-height: 360px;
  overflow: auto;
}
.wf-cmd__item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  text-align: left;
  border: none;
  background: transparent;
  padding: 10px 16px;
  font-size: 13px;
  cursor: pointer;
}
.wf-cmd__item:hover,
.wf-cmd__item:focus { background: #f1f5f9; }
.wf-cmd__item span { color: var(--muted); font-size: 11px; }
.wf-evals-stub {
  padding: 48px 24px;
  text-align: center;
  max-width: 480px;
  margin: 0 auto;
}
.wf-evals { padding: 16px; }
.wf-evals__head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 16px;
}
.wf-eval-ds,
.wf-eval-run-row {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  width: 100%;
  text-align: left;
  border: 1px solid var(--border);
  background: var(--surface, #fff);
  border-radius: 8px;
  padding: 8px 10px;
  margin-bottom: 6px;
  cursor: pointer;
}
.wf-eval-ds.active,
.wf-eval-ds:hover,
.wf-eval-run-row:hover {
  border-color: #94a3b8;
  background: #f8fafc;
}
.wf-eval-summary {
  font-weight: 600;
  margin-bottom: 8px;
}
.wf-eval-case {
  font-size: 13px;
  padding: 6px 8px;
  border-radius: 6px;
  margin-bottom: 4px;
}
.wf-eval-case.ok { background: #ecfdf5; color: #065f46; }
.wf-eval-case.bad { background: #fef2f2; color: #991b1b; }
.wf-template-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px;
  background: var(--bg, #f8fafc);
}


@media (max-width: 992px) {
  .wf-builder-body { flex-direction: column; height: auto; }
  .wf-palette, .wf-settings { width: 100%; flex-basis: auto; max-height: 220px; border: none; border-bottom: 1px solid var(--border); }
  .wf-canvas-wrap { height: 460px; }
  .wf-canvas { height: 100%; }
}

/* ---------- Node Detail View (NDV) ---------- */
.wf-node-card__pin {
  margin-left: auto;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: #b45309;
  background: #fef3c7;
  border-radius: 4px;
  padding: 1px 4px;
}
.wf-ndv {
  position: fixed;
  inset: 0;
  z-index: 1090;
  background: rgba(15, 23, 42, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.wf-ndv__panel {
  background: var(--surface, #fff);
  width: min(1200px, 96vw);
  height: min(760px, 92vh);
  border-radius: 14px;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.35);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.wf-ndv__head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}
.wf-ndv__dot { width: 12px; height: 12px; border-radius: 50%; }
.wf-ndv__title { font-weight: 600; font-size: 15px; }
.wf-ndv__type {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: var(--muted, #64748b);
  background: var(--surface-2, #f1f5f9);
  border-radius: 5px;
  padding: 2px 6px;
}
.wf-ndv__spacer { flex: 1; }
.wf-ndv__close {
  border: none;
  background: transparent;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  color: var(--muted, #64748b);
  padding: 0 6px;
}
.wf-ndv__close:hover { color: #dc2626; }
.wf-ndv__body {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 1.1fr 1fr;
  min-height: 0;
  overflow: hidden;
}
.wf-ndv__col {
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
  overflow: hidden;
  border-right: 1px solid var(--border);
}
.wf-ndv__col:last-child { border-right: none; }
.wf-ndv__col--data { background: var(--surface-2, #f8fafc); }
.wf-ndv__col-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.6px;
  color: var(--muted, #64748b);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.wf-ndv__params {
  padding: 14px;
  overflow-x: hidden;
  overflow-y: auto;
  flex: 1 1 auto;
  min-height: 0;
  scrollbar-gutter: stable;
}
.wf-ndv__content {
  padding: 12px 14px;
  overflow-x: auto;
  overflow-y: auto;
  flex: 1 1 auto;
  min-height: 0;
  min-width: 0;
  scrollbar-gutter: stable;
  overscroll-behavior: contain;
}
.wf-ndv__content::-webkit-scrollbar,
.wf-ndv__params::-webkit-scrollbar,
.wf-data-table-wrap::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
.wf-ndv__content::-webkit-scrollbar-thumb,
.wf-ndv__params::-webkit-scrollbar-thumb,
.wf-data-table-wrap::-webkit-scrollbar-thumb {
  background: #94a3b8;
  border-radius: 6px;
}
.wf-ndv__content::-webkit-scrollbar-track,
.wf-ndv__params::-webkit-scrollbar-track,
.wf-data-table-wrap::-webkit-scrollbar-track {
  background: #e2e8f0;
  border-radius: 6px;
}
.wf-tabs { display: flex; gap: 4px; padding: 8px 14px 0; flex-shrink: 0; }
.wf-tab {
  border: none;
  background: transparent;
  font-size: 12px;
  padding: 5px 10px;
  border-radius: 6px 6px 0 0;
  color: var(--muted, #64748b);
  cursor: pointer;
}
.wf-tab.active { background: var(--surface, #fff); color: var(--text, #0f172a); font-weight: 600; box-shadow: inset 0 -2px 0 var(--primary, #2563eb); }
.wf-ndv__empty { color: var(--muted, #94a3b8); font-size: 13px; padding: 20px 4px; text-align: center; }
.wf-ndv__pin-note { font-size: 11px; color: #b45309; margin-bottom: 8px; }
.wf-data-json {
  display: block;
  font-size: 12px;
  line-height: 1.5;
  margin: 0;
  max-width: 100%;
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: anywhere;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.wf-data-table-wrap {
  overflow: auto;
  max-width: 100%;
  max-height: 100%;
}
.wf-data-table {
  width: max-content;
  min-width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.wf-data-table th,
.wf-data-table td {
  border: 1px solid var(--border);
  padding: 6px 8px;
  text-align: left;
  vertical-align: top;
  max-width: 420px;
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: anywhere;
}
.wf-data-table th {
  background: var(--surface-2, #f1f5f9);
  font-weight: 600;
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 1;
}
.wf-data-table__idx {
  color: var(--muted, #94a3b8);
  white-space: nowrap;
  max-width: 40px;
}
.wf-data-table__cell--object {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11px;
  line-height: 1.45;
  max-width: 520px;
  background: #fff;
}
.wf-data-table__cell.is-collapsed {
  max-height: 7.5em;
  overflow: hidden;
  cursor: pointer;
  position: relative;
}
.wf-data-table__cell.is-collapsed::after {
  content: 'Click to expand';
  display: block;
  margin-top: 4px;
  font-size: 10px;
  font-weight: 600;
  color: var(--primary, #2563eb);
  font-family: var(--font, system-ui, sans-serif);
}
.wf-data-table__cell.is-expanded {
  max-width: min(720px, 70vw);
  max-height: none;
  cursor: pointer;
}
.wf-schema__count { font-size: 11px; color: var(--muted, #94a3b8); margin-bottom: 8px; }
.wf-schema__row { display: flex; justify-content: space-between; padding: 4px 0; border-bottom: 1px dashed var(--border); }
.wf-schema__key { font-size: 12px; font-weight: 500; }
.wf-schema__type { font-size: 11px; color: var(--muted, #64748b); font-family: ui-monospace, monospace; }
.wf-field__labelrow { display: flex; align-items: center; justify-content: space-between; margin-bottom: 3px; }
.wf-expr-toggle {
  border: 1px solid var(--border);
  background: var(--surface-2, #f1f5f9);
  border-radius: 5px;
  font-size: 10px;
  padding: 1px 7px;
  cursor: pointer;
  color: var(--muted, #64748b);
}
.wf-expr-input { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.wf-ndv__pin { display: flex; align-items: center; gap: 8px; margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--border); }
.wf-ndv__pin-badge { font-size: 10px; font-weight: 700; color: #b45309; background: #fef3c7; border-radius: 4px; padding: 2px 6px; }
.wf-ndv__exec { white-space: nowrap; }

@media (max-width: 992px) {
  .wf-ndv__body {
    grid-template-columns: 1fr;
    grid-auto-rows: minmax(220px, 42vh);
    overflow-y: auto;
  }
  .wf-ndv__col {
    border-right: none;
    border-bottom: 1px solid var(--border);
    max-height: 42vh;
  }
}

/* ---------- Editor / Executions tabs ---------- */
.wf-view-tabs {
  display: inline-flex;
  gap: 2px;
  background: var(--surface-2, #f1f5f9);
  border-radius: 8px;
  padding: 3px;
}
.wf-view-tab {
  border: none;
  background: transparent;
  font-size: 13px;
  font-weight: 500;
  padding: 5px 12px;
  border-radius: 6px;
  color: var(--muted, #64748b);
  cursor: pointer;
}
.wf-view-tab.active {
  background: var(--surface, #fff);
  color: var(--text, #0f172a);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
}
.wf-ndv__settings-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: var(--muted, #64748b);
  margin: 14px 0 8px;
  text-transform: uppercase;
}
.wf-ndv__options-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 16px 0 8px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
.wf-ndv__options-body { padding: 4px 0 8px; }
.wf-ndv__param-tabs { display: inline-flex; gap: 2px; }
.wf-ndv__param-tab {
  border: none;
  background: transparent;
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 6px;
  color: var(--muted, #64748b);
  cursor: pointer;
}
.wf-ndv__param-tab.active {
  background: var(--surface-2, #f1f5f9);
  color: var(--text, #0f172a);
}
.wf-ndv__exec-prev { white-space: nowrap; font-size: 11px !important; padding: 3px 8px !important; }
.wf-ndv__upstream {
  padding: 8px 14px 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex-shrink: 0;
}
.wf-ndv__upstream-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  padding: 4px 8px;
  border-radius: 6px;
  background: var(--surface, #fff);
  border: 1px solid var(--border);
}
.wf-ndv__upstream-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.wf-ndv__upstream-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wf-ndv__vars-hint { margin-top: 4px; }
.wf-schema__row { cursor: grab; }
.wf-schema__row:active { cursor: grabbing; }
.wf-field-mapping { margin-bottom: 12px; }
.wf-map-list { display: flex; flex-direction: column; gap: 8px; }
.wf-map-row {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px;
  background: var(--surface, #fff);
}
.wf-map-row__top {
  display: grid;
  grid-template-columns: 1fr 110px 28px;
  gap: 6px;
  margin-bottom: 6px;
}
.wf-map-row__name,
.wf-map-row__type,
.wf-map-row__value { width: 100%; }
.wf-map-row__del {
  border: 1px solid var(--border);
  background: transparent;
  border-radius: 6px;
  cursor: pointer;
  color: var(--muted, #64748b);
  font-size: 16px;
  line-height: 1;
}
.wf-map-row__del:hover { color: #dc2626; border-color: #fca5a5; }
.wf-map-add {
  border: 1px dashed var(--border);
  background: transparent;
  border-radius: 8px;
  padding: 14px 10px;
  color: var(--muted, #64748b);
  font-size: 12px;
  cursor: pointer;
  text-align: center;
}
.wf-map-add:hover,
.wf-map-add.is-drag {
  border-color: #ea580c;
  color: #c2410c;
  background: #fff7ed;
}
.wf-conditions { margin-bottom: 12px; }
.wf-cond-list { display: flex; flex-direction: column; gap: 8px; }
.wf-cond-join {
  display: flex;
  justify-content: center;
  margin: -2px 0;
}
.wf-cond-join__sel {
  width: auto !important;
  min-width: 72px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  padding: 2px 8px;
}
.wf-cond-row {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px;
  background: var(--surface, #fff);
}
.wf-cond-row__grid {
  display: grid;
  grid-template-columns: 1fr 1.1fr 0.7fr 28px;
  gap: 6px;
  align-items: center;
}
.wf-cond-row__left,
.wf-cond-row__op,
.wf-cond-row__right { width: 100%; font-size: 12px; }
.wf-cond-row__del {
  border: 1px solid var(--border);
  background: transparent;
  border-radius: 6px;
  cursor: pointer;
  color: var(--muted, #64748b);
  font-size: 16px;
  line-height: 1;
  height: 32px;
}
.wf-cond-row__del:hover { color: #dc2626; border-color: #fca5a5; }
.wf-cond-add {
  border: 1px dashed var(--border);
  background: transparent;
  border-radius: 8px;
  padding: 10px;
  color: var(--muted, #64748b);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
}
.wf-cond-add:hover {
  border-color: #ea580c;
  color: #c2410c;
  background: #fff7ed;
}
@media (max-width: 1100px) {
  .wf-cond-row__grid { grid-template-columns: 1fr; }
}
.wf-json-editor {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  line-height: 1.45;
  min-height: 160px;
  background: #0f172a;
  color: #e2e8f0;
  border-radius: 8px;
  border: 1px solid #334155;
}
.wf-field__host input[type="checkbox"] {
  width: 2.2em;
  height: 1.2em;
  accent-color: #ea580c;
}

/* ---------- Executions view ---------- */
.wf-exec {
  display: flex;
  height: 620px;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  background: var(--surface, #fff);
}
.wf-exec__list {
  width: 280px;
  flex-shrink: 0;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  background: var(--surface-2, #f8fafc);
}
.wf-exec__list-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.4px;
  border-bottom: 1px solid var(--border);
}
.wf-exec__auto { font-size: 11px; font-weight: 500; color: var(--muted, #64748b); display: flex; align-items: center; gap: 4px; }
.wf-exec__filters { display: flex; gap: 6px; padding: 8px 10px; border-bottom: 1px solid var(--border); }
.wf-exec__runs { flex: 1; overflow-y: auto; }
.wf-exec-run {
  display: flex;
  gap: 10px;
  width: 100%;
  text-align: left;
  border: none;
  border-bottom: 1px solid var(--border);
  background: transparent;
  padding: 10px 12px;
  cursor: pointer;
}
.wf-exec-run:hover { background: rgba(37, 99, 235, 0.04); }
.wf-exec-run.active { background: rgba(37, 99, 235, 0.08); }
.wf-exec-run__status {
  width: 4px;
  border-radius: 2px;
  flex-shrink: 0;
  align-self: stretch;
  background: #94a3b8;
}
.wf-exec-run__status--success { background: #16a34a; }
.wf-exec-run__status--failed { background: #dc2626; }
.wf-exec-run__status--running { background: #2563eb; }
.wf-exec-run__status--pending { background: #f59e0b; }
.wf-exec-run__title { font-size: 13px; font-weight: 600; }
.wf-exec-run__meta { font-size: 11px; color: var(--muted, #64748b); margin-top: 2px; }
.wf-exec__main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.wf-exec__meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.wf-exec__meta-left { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.wf-exec__meta-actions { display: flex; gap: 8px; }
.wf-exec__err { color: #dc2626; font-size: 12px; }
.wf-exec-badge {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  border-radius: 4px;
  padding: 2px 7px;
  background: #e2e8f0;
  color: #475569;
}
.wf-exec-badge--success { background: #dcfce7; color: #166534; }
.wf-exec-badge--failed { background: #fee2e2; color: #991b1b; }
.wf-exec-badge--running { background: #dbeafe; color: #1e40af; }
.wf-exec__canvas {
  flex: 1;
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(circle, rgba(148, 163, 184, 0.25) 1px, transparent 1px) 0 0 / 18px 18px,
    var(--surface-2, #f8fafc);
  cursor: grab;
}
.wf-exec-world {
  position: absolute;
  left: 0; top: 0;
  transform-origin: 0 0;
}
.wf-node-card--exec { cursor: default; min-height: 56px; }
.wf-node-card__exec-meta {
  display: flex;
  gap: 8px;
  padding: 4px 10px 8px;
  font-size: 10px;
  color: var(--muted, #64748b);
}
.wf-status--success {
  border-color: #16a34a !important;
  box-shadow: 0 0 0 2px rgba(22, 163, 74, 0.28), 0 1px 3px rgba(15, 23, 42, 0.08);
}
.wf-status--error,
.wf-status--failed {
  border-color: #64748b !important;
  opacity: 0.92;
  filter: grayscale(0.25);
  background: #f1f5f9;
  box-shadow: inset 4px 0 0 #64748b;
}
.wf-status--idle {
  opacity: 0.9;
  filter: grayscale(0.2);
  border-color: #64748b !important;
  background: #e2e8f0;
  box-shadow: inset 4px 0 0 #475569;
}
.wf-status--idle .wf-node-card__title,
.wf-status--idle .wf-node-card__type {
  color: #334155;
  opacity: 1;
}
.wf-status--skipped,
.wf-status--muted {
  opacity: 0.65;
  filter: grayscale(0.35);
  box-shadow: inset 3px 0 0 #94a3b8;
}
.wf-status--running { box-shadow: inset 3px 0 0 #2563eb; }
.wf-node-card__run-badge {
  position: absolute;
  top: -11px;
  left: 50%;
  transform: translateX(-50%);
  background: #16a34a;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  line-height: 1.2;
  padding: 2px 7px;
  border-radius: 999px;
  white-space: nowrap;
  z-index: 3;
  pointer-events: none;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.15);
}
.wf-node-card__run-badge--error,
.wf-node-card__run-badge--idle {
  background: #475569;
  color: #fff;
}
.wf-exec__logs { border-top: 1px solid var(--border); background: var(--surface, #fff); }
.wf-exec__logs-toggle {
  width: 100%;
  text-align: left;
  border: none;
  background: transparent;
  padding: 8px 14px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted, #64748b);
  cursor: pointer;
}
.wf-exec__logs-toggle:hover { color: var(--text, #0f172a); }
.wf-exec__logs-body {
  max-height: 200px;
  overflow-y: auto;
  padding: 0 10px 10px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11px;
}
.wf-log-row {
  border-left: 3px solid #94a3b8;
  padding: 6px 8px;
  margin-bottom: 6px;
  background: var(--surface-2, #f8fafc);
  border-radius: 0 6px 6px 0;
}
.wf-log-row--error, .wf-log-row--failed { border-left-color: #dc2626; }
.wf-log-row--success { border-left-color: #16a34a; }
.wf-log-row--warning { border-left-color: #f59e0b; }
.wf-log-row__head { font-weight: 600; color: var(--muted, #64748b); margin-bottom: 2px; }
.wf-log-row__err { color: #dc2626; }
.wf-log-row__line { white-space: pre-wrap; word-break: break-word; }

@media (max-width: 992px) {
  .wf-exec { flex-direction: column; height: auto; }
  .wf-exec__list { width: 100%; max-height: 220px; border-right: none; border-bottom: 1px solid var(--border); }
  .wf-exec__canvas { height: 360px; }
}
