:root {
  color-scheme: light;
  --brand: #2c4ef1;
  --brand-hover: #1e3dd9;
  --brand-soft: #f2f4ff;
  --page: #f7f8fc;
  --canvas: #fbfbfb;
  --surface: #ffffff;
  --ink: #18181b;
  --text: #3f3f46;
  --muted: #71717a;
  --faint: #a1a1aa;
  --border: #e4e4e7;
  --border-soft: #eff0f2;
  --success: #059669;
  --success-soft: #ecfdf5;
  --warning: #d97706;
  --warning-soft: #fffbeb;
  --danger: #dc2626;
  --danger-soft: #fef2f2;
  --info: #2563eb;
  --shadow-float: 0 18px 50px rgba(24, 24, 27, 0.12);
  --shadow-soft: 0 5px 18px rgba(34, 46, 90, 0.05);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --sidebar: 252px;
  --topbar: 76px;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--page);
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  color: var(--ink);
  background: var(--page);
  font-family: "Plus Jakarta Sans", ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

button,
[role="button"] {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible,
[contenteditable="true"]:focus-visible {
  outline: 3px solid rgba(44, 78, 241, 0.2);
  outline-offset: 2px;
}

.skip-link {
  position: fixed;
  z-index: 200;
  top: 8px;
  left: 8px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  color: #fff;
  background: var(--ink);
  transform: translateY(-140%);
}

.skip-link:focus {
  transform: translateY(0);
}

.icon {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon.sm {
  width: 15px;
  height: 15px;
}

.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar) minmax(0, 1fr);
  grid-template-rows: var(--topbar) minmax(0, 1fr);
  min-height: 100vh;
}

.app-sidebar {
  position: fixed;
  z-index: 50;
  inset: 0 auto 0 0;
  display: flex;
  width: var(--sidebar);
  flex-direction: column;
  padding: 25px 18px 18px;
  border-right: 1px solid #e3e7f0;
  background: linear-gradient(180deg, #f0f3ff 0%, #f6f8ff 56%, #eefbff 100%);
}

.sidebar-backdrop {
  display: none;
}

.brand-wordmark {
  display: flex;
  align-items: center;
  gap: 13px;
  width: fit-content;
  margin: 0 9px 27px;
  border: 0;
  color: var(--ink);
  background: transparent;
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.05em;
  cursor: pointer;
}

.brand-mark {
  width: 42px;
  height: 33px;
  background: var(--brand);
  clip-path: polygon(0 0, 100% 0, 100% 27%, 69% 27%, 69% 73%, 100% 73%, 100% 100%, 0 100%, 0 73%, 31% 73%, 31% 27%, 0 27%);
}

.workspace-switcher {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  margin-bottom: 22px;
  padding: 4px;
  border: 1px solid #dfe3ef;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.7);
}

.workspace-switcher button {
  min-height: 36px;
  border: 0;
  border-radius: 9px;
  color: var(--muted);
  background: transparent;
  font-size: 12px;
  font-weight: 650;
  cursor: pointer;
}

.workspace-switcher .active {
  color: var(--brand);
  background: #fff;
  box-shadow: 0 2px 9px rgba(24, 24, 27, 0.06);
}

.nav-label {
  margin: 10px 10px 7px;
  color: var(--faint);
  font-size: 10px;
  font-weight: 750;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.nav-list {
  display: grid;
  gap: 2px;
}

.nav-item,
.recent-item {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 0 12px;
  border: 0;
  border-radius: 10px;
  color: #5b5e6d;
  background: transparent;
  font-size: 13px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}

.nav-item:hover,
.recent-item:hover {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.62);
}

.nav-item.active {
  color: #1f3ed4;
  background: #e7ebff;
}

.nav-item .icon {
  color: #777b8c;
}

.nav-item.active .icon {
  color: var(--brand);
}

.recent-item {
  min-height: 34px;
  padding-block: 6px;
  color: #696c79;
  font-size: 11.5px;
  font-weight: 500;
}

.status-dot {
  width: 7px;
  height: 7px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.1);
}

.status-dot.warning {
  background: var(--warning);
  box-shadow: 0 0 0 3px rgba(217, 119, 6, 0.1);
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: auto;
  padding: 15px 10px 4px;
  border-top: 1px solid #dfe3ef;
}

.avatar {
  display: grid;
  width: 35px;
  height: 35px;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 50%;
  color: var(--brand);
  background: #e7eaff;
  font-size: 12px;
  font-weight: 750;
}

.sidebar-user strong,
.sidebar-user small {
  display: block;
}

.sidebar-user strong {
  font-size: 11px;
}

.sidebar-user small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 9px;
}

.app-header {
  position: sticky;
  z-index: 30;
  top: 0;
  grid-column: 2;
  grid-row: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 62px;
  margin: 14px 18px 0 14px;
  padding: 0 22px;
  border: 1px solid rgba(28, 35, 55, 0.06);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 7px 26px rgba(24, 24, 27, 0.04);
  backdrop-filter: blur(18px);
}

.header-title,
.header-actions,
.company-switcher {
  display: flex;
  align-items: center;
}

.header-title {
  gap: 11px;
  font-size: 18px;
  font-weight: 700;
}

.header-title .icon {
  color: var(--brand);
}

.header-actions {
  gap: 8px;
}

.header-icon,
.mobile-menu {
  display: inline-grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border: 0;
  border-radius: 9px;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
}

.header-icon:hover,
.mobile-menu:hover {
  color: var(--ink);
  background: #f4f4f5;
}

.mobile-menu {
  display: none;
}

.company-switcher {
  gap: 8px;
  min-height: 36px;
  padding: 0 10px;
  border: 0;
  border-radius: 9px;
  color: var(--text);
  background: transparent;
  font-size: 12px;
  font-weight: 650;
  cursor: pointer;
}

.app-main {
  grid-column: 2;
  grid-row: 2;
  min-width: 0;
  padding: 27px 34px 40px 30px;
}

.content-container {
  width: min(100%, 1250px);
  margin-inline: auto;
}

.page-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 22px;
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 8px;
  color: var(--brand);
  font-size: 10px;
  font-weight: 760;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: clamp(26px, 3vw, 31px);
  line-height: 1.15;
  letter-spacing: -0.04em;
}

.page-subtitle {
  margin-top: 9px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.inline-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.button {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 15px;
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  background: #fff;
  font-size: 12px;
  font-weight: 650;
  white-space: nowrap;
  cursor: pointer;
  transition: border-color 140ms ease, color 140ms ease, background 140ms ease, transform 140ms ease, box-shadow 140ms ease;
}

.button:hover:not(:disabled) {
  border-color: #cfd0d5;
  color: var(--ink);
  transform: translateY(-1px);
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.button.primary {
  border-color: var(--brand);
  color: #fff;
  background: var(--brand);
  box-shadow: 0 7px 18px rgba(44, 78, 241, 0.18);
}

.button.primary:hover:not(:disabled) {
  border-color: var(--brand-hover);
  color: #fff;
  background: var(--brand-hover);
}

.button.soft {
  border-color: #dce1ff;
  color: var(--brand);
  background: #f5f6ff;
}

.button.success {
  border-color: var(--success);
  color: #fff;
  background: var(--success);
}

.button.danger {
  border-color: #fecaca;
  color: #b91c1c;
  background: #fff;
}

.button.ghost {
  border-color: transparent;
  background: transparent;
  box-shadow: none;
}

.button.icon-only {
  width: 40px;
  padding: 0;
}

.button.small {
  min-height: 34px;
  padding-inline: 11px;
  font-size: 11px;
}

.input,
.select,
.textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 10px;
  outline: 0;
  color: var(--ink);
  background: #fff;
  transition: border-color 140ms ease, box-shadow 140ms ease;
}

.input,
.select {
  min-height: 40px;
  padding: 0 12px;
}

.textarea {
  min-height: 92px;
  resize: vertical;
  padding: 11px 12px;
  line-height: 1.5;
}

.input:focus,
.select:focus,
.textarea:focus {
  border-color: #788bf3;
  box-shadow: 0 0 0 3px rgba(44, 78, 241, 0.1);
}

.field-label {
  display: grid;
  gap: 6px;
  color: var(--text);
  font-size: 11px;
  font-weight: 650;
}

.field-label small {
  color: var(--muted);
  font-size: 9px;
  font-weight: 500;
}

.create-bar {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(240px, 330px) auto;
  align-items: center;
  gap: 14px;
  margin-bottom: 16px;
  padding: 16px 18px;
  border: 1px solid #dde2fc;
  border-radius: 14px;
  background: #fff;
  box-shadow: var(--shadow-soft);
}

.create-bar strong,
.create-bar small {
  display: block;
}

.create-bar strong {
  margin-bottom: 4px;
  font-size: 13px;
}

.create-bar small {
  color: var(--muted);
  font-size: 10px;
  line-height: 1.5;
}

.automation-list {
  display: grid;
  gap: 11px;
}

.automation-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 18px;
  min-height: 112px;
  padding: 18px 20px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 4px 14px rgba(24, 24, 27, 0.035);
  transition: border-color 140ms ease, box-shadow 140ms ease;
}

.automation-row:hover {
  border-color: #cdd5ff;
  box-shadow: 0 6px 22px rgba(44, 78, 241, 0.06);
}

.automation-row.archived {
  opacity: 0.68;
}

.automation-name-row {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}

.automation-name-row h2 {
  font-size: 16px;
  letter-spacing: -0.02em;
}

.metadata {
  color: var(--muted);
  font-size: 10.5px;
  line-height: 1.5;
}

.chip-row {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 23px;
  padding: 3px 9px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--muted);
  background: #fff;
  font-size: 9.5px;
  font-weight: 650;
  white-space: nowrap;
}

.chip::before {
  display: none;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  content: "";
}

.chip.with-dot::before {
  display: block;
}

.chip.blue {
  border-color: #dbe1ff;
  color: #2947d6;
  background: var(--brand-soft);
}

.chip.green {
  border-color: #ccecdf;
  color: #047857;
  background: var(--success-soft);
}

.chip.amber {
  border-color: #fde5b7;
  color: #b45309;
  background: var(--warning-soft);
}

.chip.red {
  border-color: #fecaca;
  color: #b91c1c;
  background: var(--danger-soft);
}

.chip.gray {
  color: #686b75;
  background: #f4f4f5;
}

.row-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.empty-state {
  display: grid;
  min-height: 280px;
  place-items: center;
  padding: 40px;
  border: 1px dashed #d4d4d8;
  border-radius: 14px;
  color: var(--muted);
  background: #fff;
  text-align: center;
}

.empty-state strong {
  display: block;
  margin-bottom: 7px;
  color: var(--ink);
  font-size: 16px;
}

/* Builder */
.builder-app {
  position: fixed;
  inset: 0;
  overflow: hidden;
  background: var(--canvas);
}

.builder-toolbar {
  position: absolute;
  z-index: 40;
  inset: 14px 14px auto;
  display: flex;
  min-height: 58px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 8px 12px;
  border: 1px solid rgba(24, 24, 27, 0.09);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 9px 28px rgba(24, 24, 27, 0.07);
  backdrop-filter: blur(18px);
}

.builder-title,
.builder-actions {
  display: flex;
  align-items: center;
  gap: 9px;
}

.builder-title-text {
  min-width: 0;
}

.builder-title-text h1 {
  overflow: hidden;
  max-width: 280px;
  font-size: 15px;
  letter-spacing: -0.02em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.builder-title-text small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 9px;
}

.save-status {
  display: flex;
  align-items: center;
  gap: 5px;
  color: var(--success);
  font-size: 9.5px;
}

.builder-stage {
  position: absolute;
  inset: 86px 14px 14px;
  display: grid;
  grid-template-columns: 374px minmax(420px, 1fr) 358px;
  gap: 14px;
}

.builder-panel {
  display: flex;
  min-width: 0;
  min-height: 0;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: #fff;
}

.builder-panel.floating {
  box-shadow: var(--shadow-float);
}

.panel-header {
  display: flex;
  min-height: 63px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex: 0 0 auto;
  padding: 13px 15px;
  border-bottom: 1px solid var(--border-soft);
}

.panel-heading {
  display: flex;
  align-items: center;
  gap: 9px;
}

.copilot-mark {
  display: grid;
  width: 31px;
  height: 31px;
  place-items: center;
  border-radius: 9px;
  color: #fff;
  background: var(--brand);
  font-size: 15px;
}

.panel-heading strong,
.panel-heading small {
  display: block;
}

.panel-heading strong {
  font-size: 12px;
}

.panel-heading small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 8.5px;
}

.chat-scroll,
.inspector-scroll {
  flex: 1 1 auto;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.chat-scroll {
  padding: 17px 15px;
  background: linear-gradient(180deg, #fff, #fdfdff);
}

.chat-label {
  margin: 0 0 6px 3px;
  color: var(--faint);
  font-size: 8.5px;
  font-weight: 750;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.chat-bubble {
  width: fit-content;
  max-width: 100%;
  margin-bottom: 13px;
  padding: 10px 11px;
  border-radius: 12px;
  color: var(--text);
  background: #f4f4f5;
  font-size: 10.5px;
  line-height: 1.52;
}

.chat-bubble.hedi {
  border: 1px solid #e2e6ff;
  background: #f7f8ff;
}

.plan-review {
  margin: 5px 0 14px;
  padding: 12px;
  border: 1px solid #f6dca9;
  border-radius: 12px;
  background: #fffaf0;
}

.plan-review h3 {
  margin-bottom: 8px;
  font-size: 11px;
}

.plan-change {
  display: flex;
  gap: 7px;
  margin: 5px 0;
  color: #6b5a3e;
  font-size: 9.5px;
  line-height: 1.4;
}

.change-add {
  color: var(--success);
  font-weight: 800;
}

.change-update {
  color: var(--brand);
  font-weight: 800;
}

.plan-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
  margin-top: 10px;
}

.composer {
  flex: 0 0 auto;
  margin: 0 13px 13px;
  padding: 10px;
  border: 1px solid #dadce2;
  border-radius: 13px;
  background: #fff;
  box-shadow: 0 8px 22px rgba(24, 24, 27, 0.06);
}

.composer textarea {
  display: block;
  width: 100%;
  min-height: 54px;
  resize: none;
  border: 0;
  outline: 0;
  color: var(--text);
  background: transparent;
  font-size: 10.5px;
  line-height: 1.45;
}

.composer-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.mode-pill {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  gap: 5px;
  padding: 0 8px;
  border: 0;
  border-radius: 8px;
  color: var(--text);
  background: #f4f4f5;
  font-size: 9px;
  font-weight: 650;
  cursor: pointer;
}

.send-button {
  display: inline-grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border: 0;
  border-radius: 8px;
  color: #fff;
  background: var(--brand);
  cursor: pointer;
}

.send-button:disabled {
  opacity: 0.4;
}

.workflow-canvas {
  position: relative;
  overflow: hidden;
  background-color: #fdfdfd;
  background-image: radial-gradient(circle, #dedee3 1px, transparent 1px);
  background-size: 24px 24px;
}

.canvas-state {
  position: absolute;
  z-index: 4;
  top: 17px;
  left: 18px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 9px;
}

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

.canvas-svg path {
  fill: none;
  stroke: #aeb5cb;
  stroke-width: 2.2;
  vector-effect: non-scaling-stroke;
}

.canvas-node {
  position: absolute;
  z-index: 3;
  display: flex;
  width: 228px;
  min-height: 78px;
  align-items: center;
  gap: 11px;
  padding: 12px;
  border: 1px solid #dfe1e6;
  border-radius: 13px;
  color: var(--ink);
  background: #fff;
  box-shadow: 0 8px 18px rgba(24, 24, 27, 0.06);
  text-align: left;
  cursor: pointer;
  transition: border-color 140ms ease, box-shadow 140ms ease, transform 140ms ease;
}

.canvas-node:hover {
  border-color: #9da9eb;
  transform: translateY(-1px);
}

.canvas-node.selected {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(44, 78, 241, 0.09), 0 10px 22px rgba(24, 24, 27, 0.08);
}

.canvas-node.proposed {
  border: 1.5px dashed #6d82f4;
  background: #f9faff;
}

.canvas-node.completed {
  border-color: #8dd8ba;
}

.node-icon {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  flex: 0 0 auto;
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--brand);
  background: #f7f8ff;
  font-size: 11px;
  font-weight: 760;
}

.canvas-node strong,
.canvas-node small {
  display: block;
}

.canvas-node strong {
  margin-bottom: 4px;
  font-size: 10.5px;
}

.canvas-node small {
  color: var(--muted);
  font-size: 8px;
  line-height: 1.35;
}

.node-input { top: 14%; left: 7%; }
.node-agent { top: 14%; left: 53%; }
.node-condition { top: 39%; left: 53%; }
.node-approval { top: 65%; left: 7%; }
.node-output { top: 65%; left: 53%; }

.branch-label {
  position: absolute;
  z-index: 4;
  padding: 4px 7px;
  border-radius: 999px;
  background: #fff;
  font-size: 8px;
  font-weight: 750;
}

.branch-label.yes { top: 56%; left: 36%; color: var(--success); }
.branch-label.no { top: 56%; left: 67%; color: var(--warning); }

.canvas-controls {
  position: absolute;
  z-index: 5;
  bottom: 17px;
  left: 17px;
  display: flex;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 7px 18px rgba(24, 24, 27, 0.07);
}

.canvas-controls button {
  display: grid;
  width: 33px;
  height: 33px;
  place-items: center;
  border: 0;
  border-right: 1px solid var(--border-soft);
  color: var(--muted);
  background: #fff;
  cursor: pointer;
}

.canvas-controls button:last-child {
  border-right: 0;
}

.inspector-scroll {
  display: grid;
  align-content: start;
  gap: 13px;
  padding: 15px;
}

.section-label {
  color: var(--faint);
  font-size: 8.5px;
  font-weight: 750;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.connection-summary,
.info-banner {
  padding: 11px;
  border-radius: 10px;
  background: #f7f8ff;
}

.connection-summary strong,
.connection-summary small {
  display: block;
}

.connection-summary strong {
  color: #2947d6;
  font-size: 9.5px;
}

.connection-summary small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 8px;
}

.safety-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
}

.mini-stat {
  padding: 9px;
  border: 1px solid #ececef;
  border-radius: 9px;
}

.mini-stat small,
.mini-stat strong {
  display: block;
}

.mini-stat small {
  margin-bottom: 4px;
  color: var(--faint);
  font-size: 7.5px;
}

.mini-stat strong {
  font-size: 9px;
}

.info-banner {
  border: 1px solid #dbe1ff;
  color: #31449b;
  font-size: 8.8px;
  line-height: 1.5;
}

.panel-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex: 0 0 auto;
  padding: 12px 15px;
  border-top: 1px solid var(--border-soft);
  background: #fafafa;
}

.mobile-builder-tabs {
  display: none;
}

/* Run */
.breadcrumb-button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 10px;
  padding: 0;
  border: 0;
  color: var(--muted);
  background: transparent;
  font-size: 10.5px;
  cursor: pointer;
}

.run-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 20px;
}

.run-title {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

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

.summary-card {
  min-width: 0;
  padding: 14px 15px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: #fff;
}

.summary-card small,
.summary-card strong {
  display: block;
}

.summary-card small {
  overflow: hidden;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 8px;
  letter-spacing: 0.06em;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.summary-card strong {
  overflow: hidden;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.run-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.52fr) minmax(330px, 0.78fr);
  gap: 14px;
}

.card-panel {
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 4px 14px rgba(24, 24, 27, 0.03);
}

.card-panel-header {
  display: flex;
  min-height: 57px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 18px;
  border-bottom: 1px solid var(--border-soft);
}

.card-panel-header h2,
.side-card h2 {
  font-size: 12px;
}

.live-status {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--success);
  font-size: 9px;
  font-weight: 650;
}

.timeline {
  padding: 20px 22px 24px;
}

.timeline-step {
  position: relative;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  gap: 12px;
  min-height: 82px;
}

.timeline-step:not(:last-child)::after {
  position: absolute;
  top: 32px;
  bottom: -3px;
  left: 15px;
  width: 2px;
  background: #e7e8ec;
  content: "";
}

.step-dot {
  position: relative;
  z-index: 2;
  display: grid;
  width: 31px;
  height: 31px;
  place-items: center;
  border: 2px solid #fff;
  border-radius: 50%;
  color: #fff;
  background: var(--success);
  box-shadow: 0 0 0 2px #ccecdf;
  font-size: 10px;
  font-weight: 750;
}

.step-dot.waiting {
  color: #92400e;
  background: #fbbf24;
  box-shadow: 0 0 0 2px #fde6ae;
}

.step-dot.future {
  color: var(--faint);
  background: #f4f4f5;
  box-shadow: 0 0 0 2px var(--border);
}

.timeline-copy {
  padding-top: 2px;
}

.timeline-copy strong {
  display: block;
  margin-bottom: 5px;
  font-size: 10.5px;
}

.timeline-copy p {
  max-width: 520px;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.5;
}

.step-time {
  padding-top: 5px;
  color: var(--faint);
  font-size: 8.5px;
  white-space: nowrap;
}

.approval-card {
  margin: 3px 0 20px 46px;
  padding: 14px;
  border: 1px solid #f4d596;
  border-radius: 12px;
  background: #fffaf0;
}

.approval-heading {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 8px;
  color: #92400e;
  font-size: 10.5px;
  font-weight: 730;
}

.approval-card > p {
  color: #6b5a3e;
  font-size: 9px;
  line-height: 1.5;
}

.approval-facts {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin: 10px 0;
}

.approval-facts div {
  padding: 8px;
  border: 1px solid #f5e5c5;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.62);
}

.approval-facts small,
.approval-facts strong {
  display: block;
}

.approval-facts small {
  margin-bottom: 4px;
  color: #a88755;
  font-size: 7px;
  letter-spacing: 0.04em;
}

.approval-facts strong {
  font-size: 8px;
}

.side-stack {
  display: grid;
  align-content: start;
  gap: 12px;
}

.side-card {
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #fff;
}

.side-card h2 {
  margin-bottom: 12px;
}

.key-value {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid #f2f2f3;
  font-size: 9px;
}

.key-value:last-child {
  border-bottom: 0;
}

.key-value span {
  color: var(--muted);
}

.key-value strong {
  text-align: right;
}

.json-preview {
  padding: 11px;
  border-radius: 9px;
  color: #d4d4d8;
  background: #202126;
  font: 9px/1.55 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  white-space: pre-wrap;
}

.json-preview.collapsed {
  display: none;
}

.reconnect-banner {
  padding: 12px;
  border: 1px solid #dbe1ff;
  border-radius: 11px;
  color: #31449b;
  background: #f5f6ff;
  font-size: 9px;
  line-height: 1.5;
}

/* Modal and toast */
.modal-backdrop {
  position: fixed;
  z-index: 100;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(24, 24, 27, 0.35);
  backdrop-filter: blur(5px);
}

.modal {
  width: min(100%, 440px);
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: #fff;
  box-shadow: 0 28px 80px rgba(24, 24, 27, 0.24);
}

.modal h2 {
  font-size: 18px;
}

.modal p {
  margin-top: 9px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.modal-content {
  display: grid;
  gap: 13px;
  margin-top: 17px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 20px;
}

.spec-main {
  padding-top: 30px;
}

.spec-container {
  width: min(100%, 1400px);
  margin-inline: auto;
}

.spec-hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 28px;
  margin-bottom: 22px;
}

.spec-hero h1 {
  max-width: 760px;
}

.spec-hero .page-subtitle {
  max-width: 720px;
}

.spec-hero-actions {
  display: flex;
  flex: 0 0 auto;
  gap: 8px;
}

.spec-hero-actions .button {
  text-decoration: none;
}

.spec-facts {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 24px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
}

.spec-facts > div {
  min-width: 0;
  padding: 15px 18px;
  border-right: 1px solid var(--border-soft);
}

.spec-facts > div:last-child {
  border-right: 0;
}

.spec-facts small,
.spec-facts strong {
  display: block;
}

.spec-facts small {
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 650;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.spec-facts strong {
  overflow: hidden;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.spec-layout {
  display: grid;
  grid-template-columns: 252px minmax(0, 920px);
  align-items: start;
  justify-content: center;
  gap: 28px;
}

.spec-toc {
  position: sticky;
  top: 100px;
}

.spec-toc details {
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.9);
}

.spec-toc summary {
  display: flex;
  min-height: 48px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 14px;
  border-bottom: 1px solid var(--border-soft);
  font-size: 12px;
  font-weight: 750;
  cursor: pointer;
  list-style: none;
}

.spec-toc summary::-webkit-details-marker {
  display: none;
}

.spec-toc summary span {
  color: var(--muted);
  font-size: 9px;
  font-weight: 600;
}

.spec-toc nav {
  display: grid;
  max-height: calc(100vh - 180px);
  overflow-y: auto;
  padding: 8px;
}

.spec-toc button {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  align-items: start;
  gap: 7px;
  min-height: 34px;
  padding: 8px;
  border: 0;
  border-radius: 7px;
  color: var(--text);
  background: transparent;
  font-size: 10.5px;
  line-height: 1.35;
  text-align: left;
  cursor: pointer;
}

.spec-toc button:hover {
  color: var(--brand);
  background: var(--brand-soft);
}

.spec-toc button > span {
  color: var(--brand);
  font-size: 9px;
  font-weight: 750;
}

.spec-toc-loading {
  padding: 12px;
  color: var(--muted);
  font-size: 11px;
}

.spec-document {
  min-width: 0;
  padding: 56px 64px 72px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}

.spec-document > h1:first-child {
  display: none;
}

.spec-document h1,
.spec-document h2,
.spec-document h3,
.spec-document h4,
.spec-document h5,
.spec-document h6 {
  scroll-margin-top: 104px;
  color: var(--ink);
  letter-spacing: -0.025em;
}

.spec-document h2 {
  margin: 64px 0 20px;
  padding-top: 4px;
  border-top: 1px solid var(--border-soft);
  font-size: 25px;
  line-height: 1.25;
}

.spec-document > ul + h2,
.spec-document > p + h2 {
  margin-top: 56px;
}

.spec-document h3 {
  margin: 36px 0 14px;
  font-size: 17px;
  line-height: 1.35;
}

.spec-document h4 {
  margin: 28px 0 10px;
  font-size: 14px;
}

.spec-document p,
.spec-document li {
  color: var(--text);
  font-size: 13px;
  line-height: 1.75;
}

.spec-document p {
  margin: 0 0 16px;
}

.spec-document ul,
.spec-document ol {
  display: grid;
  gap: 7px;
  margin: 0 0 20px;
  padding-left: 22px;
}

.spec-document li::marker {
  color: var(--brand);
  font-weight: 700;
}

.spec-document strong {
  color: var(--ink);
}

.spec-document a {
  color: var(--brand);
  font-weight: 600;
  text-underline-offset: 3px;
}

.spec-source-reference {
  border-bottom: 1px dotted var(--faint);
  color: var(--text);
  cursor: help;
}

.spec-document code {
  padding: 2px 5px;
  border: 1px solid #e7e9ef;
  border-radius: 5px;
  color: #3346b6;
  background: #f6f7fb;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.88em;
}

.spec-document pre {
  margin: 20px 0 24px;
  overflow-x: auto;
  padding: 18px 20px;
  border: 1px solid #333640;
  border-radius: 10px;
  color: #f4f4f5;
  background: #202127;
  font-size: 11px;
  line-height: 1.65;
}

.spec-document pre code {
  padding: 0;
  border: 0;
  color: inherit;
  background: transparent;
  font-size: inherit;
}

.spec-document blockquote {
  margin: 24px 0;
  padding: 18px 20px;
  border-left: 4px solid var(--brand);
  border-radius: 0 10px 10px 0;
  color: #273da8;
  background: var(--brand-soft);
  font-size: 15px;
  font-weight: 600;
  line-height: 1.6;
}

.spec-document img {
  display: block;
  width: 100%;
  height: auto;
  margin: 26px 0 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--page);
}

.spec-document p:has(> img) {
  margin-bottom: 8px;
}

.spec-document p:has(> img) + p em {
  display: block;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.6;
  text-align: center;
}

.spec-table-wrap {
  max-width: 100%;
  margin: 20px 0 28px;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 10px;
}

.spec-document table {
  width: 100%;
  min-width: 620px;
  border-collapse: collapse;
  text-align: left;
}

.spec-document th,
.spec-document td {
  padding: 11px 13px;
  border-right: 1px solid var(--border-soft);
  border-bottom: 1px solid var(--border-soft);
  color: var(--text);
  font-size: 10.5px;
  line-height: 1.55;
  vertical-align: top;
}

.spec-document th:last-child,
.spec-document td:last-child {
  border-right: 0;
}

.spec-document tbody tr:last-child td {
  border-bottom: 0;
}

.spec-document th {
  color: var(--ink);
  background: #f8f9fc;
  font-weight: 750;
}

.spec-document tbody tr:nth-child(even) {
  background: #fcfcfd;
}

.spec-lifecycle {
  display: flex;
  align-items: stretch;
  gap: 8px;
  margin: 22px 0 28px;
  overflow-x: auto;
  padding: 4px 2px 10px;
}

.lifecycle-step {
  display: grid;
  min-width: 126px;
  align-content: start;
  gap: 6px;
  padding: 13px;
  border: 1px solid #dfe3f6;
  border-radius: 10px;
  background: #f8f9ff;
}

.lifecycle-step > span {
  display: grid;
  width: 22px;
  height: 22px;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: var(--brand);
  font-size: 9px;
  font-weight: 750;
}

.lifecycle-step strong {
  font-size: 10px;
  line-height: 1.35;
}

.lifecycle-step small {
  color: var(--muted);
  font-size: 8.5px;
  line-height: 1.45;
}

.lifecycle-arrow {
  align-self: center;
  color: var(--brand);
  font-size: 16px;
}

.spec-skeleton {
  display: grid;
  gap: 16px;
}

.spec-skeleton span {
  height: 18px;
  border-radius: 5px;
  background: linear-gradient(90deg, #f1f2f6 0%, #fafafa 45%, #f1f2f6 100%);
  background-size: 200% 100%;
  animation: skeleton-wave 1.2s linear infinite;
}

.spec-skeleton span:first-child {
  width: 72%;
  height: 36px;
}

.spec-skeleton span:nth-child(3) {
  width: 86%;
}

@keyframes skeleton-wave {
  from { background-position: 100% 0; }
  to { background-position: -100% 0; }
}

.spec-error {
  padding: 28px;
  border: 1px solid #fecaca;
  border-radius: 12px;
  background: var(--danger-soft);
}

.spec-error strong {
  display: block;
  margin-bottom: 8px;
}

.spec-error .button {
  margin-top: 16px;
}

.toast-region {
  position: fixed;
  z-index: 150;
  right: 20px;
  bottom: 20px;
  display: grid;
  width: min(360px, calc(100vw - 40px));
  gap: 8px;
}

.toast-region.builder-context {
  right: 390px;
}

.toast {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: start;
  gap: 10px;
  padding: 13px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text);
  background: #fff;
  box-shadow: var(--shadow-float);
  animation: toast-in 180ms ease-out;
}

.toast strong,
.toast small {
  display: block;
}

.toast strong {
  font-size: 11px;
}

.toast small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.4;
}

.toast-close {
  border: 0;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
}

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

@media (max-width: 1240px) {
  .spec-layout {
    grid-template-columns: 220px minmax(0, 1fr);
    gap: 20px;
  }

  .spec-document {
    padding-inline: 48px;
  }

  .builder-stage {
    grid-template-columns: 340px minmax(380px, 1fr) 330px;
  }

  .builder-actions .save-status {
    display: none;
  }

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

@media (max-width: 1023px) {
  .toast-region.builder-context {
    right: 20px;
  }

  :root {
    --sidebar: 236px;
  }

  .app-sidebar {
    transform: translateX(-105%);
    transition: transform 180ms ease-out;
  }

  .app-sidebar.open {
    transform: translateX(0);
  }

  .sidebar-backdrop.open {
    position: fixed;
    z-index: 45;
    inset: 0;
    display: block;
    border: 0;
    background: rgba(24, 24, 27, 0.26);
  }

  .app-shell {
    grid-template-columns: 1fr;
  }

  .app-header,
  .app-main {
    grid-column: 1;
  }

  .spec-hero {
    align-items: flex-start;
    flex-direction: column;
  }

  .spec-layout {
    grid-template-columns: 1fr;
  }

  .spec-toc {
    position: static;
  }

  .spec-toc nav {
    max-height: 280px;
  }

  .spec-toc details:not([open]) summary {
    border-bottom: 0;
  }

  .mobile-menu {
    display: inline-grid;
  }

  .header-actions .header-icon {
    display: none;
  }

  .builder-stage {
    grid-template-columns: 330px minmax(0, 1fr);
  }

  .builder-inspector {
    position: absolute;
    z-index: 20;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(358px, calc(100vw - 30px));
  }

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

  .run-layout {
    grid-template-columns: 1fr;
  }

  .side-stack {
    grid-template-columns: repeat(2, 1fr);
  }

  .reconnect-banner {
    grid-column: 1 / -1;
  }
}

@media (max-width: 767px) {
  .app-header {
    margin-inline: 10px;
    padding-inline: 12px;
  }

  .header-title {
    font-size: 15px;
  }

  .company-switcher {
    max-width: 155px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .app-main {
    padding: 24px 15px 32px;
  }

  .spec-main {
    padding-top: 24px;
  }

  .spec-hero-actions {
    display: grid;
    width: 100%;
    grid-template-columns: 1fr 1fr;
  }

  .spec-hero-actions .button {
    justify-content: center;
  }

  .spec-hero-actions .button:last-child {
    grid-column: 1 / -1;
  }

  .spec-facts {
    grid-template-columns: 1fr 1fr;
  }

  .spec-facts > div:nth-child(2) {
    border-right: 0;
  }

  .spec-facts > div:nth-child(-n + 2) {
    border-bottom: 1px solid var(--border-soft);
  }

  .spec-document {
    padding: 34px 24px 48px;
    border-radius: 13px;
  }

  .spec-document h2 {
    margin-top: 50px;
    font-size: 22px;
  }

  .spec-document h3 {
    margin-top: 30px;
    font-size: 16px;
  }

  .spec-document p,
  .spec-document li {
    font-size: 12.5px;
  }

  .spec-document blockquote {
    padding: 15px 16px;
    font-size: 13px;
  }

  .page-heading,
  .run-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .page-heading .inline-actions,
  .run-heading .button {
    width: 100%;
  }

  .page-heading .select {
    flex: 1;
  }

  .create-bar {
    grid-template-columns: 1fr;
  }

  .automation-row {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .row-actions {
    width: 100%;
  }

  .row-actions .button:not(.icon-only) {
    flex: 1;
  }

  .builder-toolbar {
    align-items: flex-start;
    min-height: 69px;
  }

  .builder-title-text h1 {
    max-width: 148px;
  }

  .builder-title .chip,
  .builder-actions .button:not(.primary),
  .builder-actions .icon-only {
    display: none;
  }

  .builder-stage {
    inset: 94px 10px 66px;
    display: block;
  }

  .builder-panel {
    width: 100%;
    height: 100%;
  }

  .builder-panel.mobile-hidden {
    display: none;
  }

  .mobile-builder-tabs {
    position: fixed;
    z-index: 45;
    right: 10px;
    bottom: 10px;
    left: 10px;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 4px;
    padding: 4px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.96);
    box-shadow: var(--shadow-float);
    backdrop-filter: blur(18px);
  }

  .mobile-builder-tabs button {
    min-height: 40px;
    border: 0;
    border-radius: 9px;
    color: var(--muted);
    background: transparent;
    font-size: 10px;
    font-weight: 650;
  }

  .mobile-builder-tabs button.active {
    color: var(--brand);
    background: var(--brand-soft);
  }

  .workflow-canvas {
    min-height: 610px;
  }

  .canvas-node {
    width: 168px;
    min-height: 70px;
    padding: 10px;
  }

  .node-icon {
    width: 32px;
    height: 32px;
    font-size: 9px;
  }

  .canvas-node strong {
    font-size: 9px;
  }

  .canvas-node small {
    font-size: 7px;
  }

  .node-input { top: 12%; left: 4%; }
  .node-agent { top: 12%; left: 52%; }
  .node-condition { top: 39%; left: 52%; }
  .node-approval { top: 66%; left: 4%; }
  .node-output { top: 66%; left: 52%; }

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

  .timeline {
    padding-inline: 14px;
  }

  .timeline-step {
    grid-template-columns: 34px minmax(0, 1fr);
  }

  .step-time {
    display: none;
  }

  .approval-card {
    margin-left: 0;
  }

  .approval-facts {
    grid-template-columns: 1fr;
  }

  .approval-card .inline-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .approval-card .inline-actions .button:last-child {
    grid-column: 1 / -1;
  }

  .side-stack {
    grid-template-columns: 1fr;
  }

  .modal-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 480px) {
  .header-actions .company-switcher .icon,
  .header-actions .language-label {
    display: none;
  }

  .company-switcher {
    max-width: 120px;
  }

  .spec-document {
    padding-inline: 18px;
  }

  .spec-facts strong {
    font-size: 11px;
  }

  .spec-hero-actions .button {
    padding-inline: 10px;
    font-size: 10px;
  }

  .summary-strip {
    grid-template-columns: 1fr 1fr;
  }

  .summary-card:last-child {
    grid-column: 1 / -1;
  }

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

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

@media print {
  .app-sidebar,
  .app-header,
  .builder-toolbar,
  .mobile-builder-tabs,
  .button,
  .toast-region {
    display: none !important;
  }

  .app-shell {
    display: block;
  }

  .app-main {
    padding: 0;
  }

  .spec-hero-actions,
  .spec-toc,
  .spec-facts {
    display: none !important;
  }

  .spec-layout {
    display: block;
  }

  .spec-document {
    padding: 0;
    border: 0;
    box-shadow: none;
  }

  .spec-document h2 {
    break-after: avoid;
  }

  .spec-table-wrap,
  .spec-document img,
  .spec-document pre,
  .spec-document blockquote {
    break-inside: avoid;
  }
}
