/* Relay — LaunchForce working demo (ops). Self-contained, no external assets. */

@font-face {
  font-family: "Space Grotesk";
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src: url("/fonts/space-grotesk-var.woff2") format("woff2");
}
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/fonts/inter-var.woff2") format("woff2");
}

:root {
  --bg: #f4f4f1;
  --surface: #ffffff;
  --surface-2: #fafaf7;
  --ink: #14161a;
  --ink-2: #3f444d;
  --muted: #747b86;
  --line: #e6e6e0;
  --line-strong: #d5d5cf;
  --dark: #0f1115;
  --dark-2: #16191f;
  --dark-line: rgba(255, 255, 255, 0.08);
  --dark-fg: #f2f3f5;
  --dark-muted: #8a919e;
  --accent: #f24700;
  --accent-deep: #d63c00;
  --accent-soft: #fff0e9;
  --accent-ink: #b83200;
  --green: #0a7d4f;
  --green-bright: #0a9d63;
  --green-soft: #e7f3ec;
  --blue: #0e7490;
  --blue-soft: #e6f2f7;
  --amber: #b45309;
  --amber-soft: #fdf3d8;
  --red: #b42318;
  --red-soft: #fdecea;
  --shadow-sm: 0 1px 2px rgba(16, 18, 22, 0.05);
  --shadow-md: 0 12px 32px -20px rgba(16, 18, 22, 0.25), 0 2px 6px rgba(16, 18, 22, 0.04);
  --shadow-lg: 0 28px 70px -34px rgba(11, 13, 17, 0.5);
  --r-sm: 8px;
  --r-md: 10px;
  --r-lg: 14px;
  --r-xl: 16px;
  --pad: clamp(16px, 2.4vw, 32px);
  --labbar-h: 48px;
  --sidebar-w: 220px;
  --font-sans: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-display: "Space Grotesk", "Inter", system-ui, sans-serif;
  --ease: cubic-bezier(0.2, 0.65, 0.25, 1);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1,
h2,
h3,
p,
ul,
ol,
dl,
dd,
figure {
  margin: 0;
  padding: 0;
}

li {
  list-style: none;
}

button {
  font: inherit;
  color: inherit;
}

svg {
  display: block;
}

[hidden] {
  display: none !important;
}

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

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.skip-link {
  position: fixed;
  top: -60px;
  left: 12px;
  z-index: 500;
  padding: 9px 14px;
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  transition: top 0.18s var(--ease);
}

.skip-link:focus-visible {
  top: 8px;
}

body.no-scroll {
  overflow: hidden;
}

/* ---------- Shared LaunchForce lab bar ---------- */

.labbar {
  position: sticky;
  top: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: var(--labbar-h);
  padding: 0 20px;
  background: #141210;
  color: #f4f1e8;
}

.labbar-left,
.labbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.labbar-brand {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.21em;
  text-transform: uppercase;
  white-space: nowrap;
}

.labbar-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #f24700;
  flex: 0 0 auto;
}

.lab-tag {
  padding: 2px 6px;
  border: 1px solid rgba(244, 241, 232, 0.24);
  border-radius: 4px;
  color: rgba(244, 241, 232, 0.55);
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.17em;
  text-transform: uppercase;
}

.demo-pill {
  display: inline-flex;
  align-items: center;
  padding: 6px 11px;
  border-radius: 999px;
  background: #f24700;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  white-space: nowrap;
}

.labbar-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: rgba(244, 241, 232, 0.72);
  font-size: 12.5px;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
  transition: color 0.18s var(--ease);
}

.labbar-back:hover {
  color: #fff;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.back-arrow {
  font-size: 14px;
  line-height: 1;
}

/* ---------- App shell / dark sidebar ---------- */

.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  align-items: start;
}

.sidebar {
  position: sticky;
  top: var(--labbar-h);
  display: flex;
  flex-direction: column;
  gap: 22px;
  height: calc(100vh - var(--labbar-h));
  padding: 20px 14px 18px;
  border-right: 1px solid #1e222a;
  background: var(--dark);
  color: #cbd0d8;
  overflow-y: auto;
}

.sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0 6px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: #fff;
  text-decoration: none;
  border-radius: 8px;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: linear-gradient(150deg, #f24700, #ff6a2b);
  color: #fff;
  box-shadow: 0 4px 14px -4px rgba(242, 71, 0, 0.7);
}

.brand-name {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.mobile-only {
  display: none;
}

.workspace-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: rgba(242, 71, 0, 0.16);
  color: #ff8a5c;
  font-size: 12px;
  font-weight: 700;
}

.nav-section {
  padding: 0 10px;
  color: rgba(255, 255, 255, 0.34);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: -12px;
}

.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 10px;
  border: 0;
  border-radius: 8px;
  background: none;
  color: #9aa1ad;
  font-size: 13px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: background 0.16s var(--ease), color 0.16s var(--ease);
}

.nav-item svg {
  flex: 0 0 auto;
  transition: color 0.16s var(--ease);
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
}

.nav-item.is-active {
  background: #191d24;
  color: #fff;
  font-weight: 600;
}

.nav-item.is-active svg {
  color: var(--accent);
}

.nav-item.is-active::before {
  content: "";
  position: absolute;
  top: 50%;
  left: -14px;
  width: 2px;
  height: 18px;
  border-radius: 0 2px 2px 0;
  background: var(--accent);
  transform: translateY(-50%);
}

.sidebar-foot {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: auto;
  padding: 14px 6px 0;
  border-top: 1px solid var(--dark-line);
}

.workspace-chip {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}

.workspace-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.workspace-info strong {
  overflow: hidden;
  color: #f0f2f5;
  font-size: 12.5px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.workspace-info span {
  color: var(--dark-muted);
  font-size: 10.5px;
}

.reset-link {
  align-self: flex-start;
  padding: 0;
  border: 0;
  background: none;
  color: var(--dark-muted);
  font-size: 11.5px;
  font-weight: 500;
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: rgba(255, 255, 255, 0.18);
  cursor: pointer;
  transition: color 0.16s var(--ease);
}

.reset-link:hover {
  color: #ff8a5c;
  text-decoration-color: currentColor;
}

/* ---------- Main / header ---------- */

.main {
  min-width: 0;
}

.page {
  width: 100%;
  max-width: 1400px;
  padding: 26px var(--pad) 22px;
}

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}

.eyebrow {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

h1 {
  margin-top: 5px;
  font-family: var(--font-display);
  font-size: clamp(25px, 2.2vw, 30px);
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.1;
}

.page-sub {
  margin-top: 5px;
  color: var(--muted);
  font-size: 12.5px;
}

.page-tools {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.system-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink-2);
  font-size: 10.5px;
  font-weight: 600;
  white-space: nowrap;
}

.status-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--muted);
  flex: 0 0 auto;
}

.status-dot.is-live {
  background: var(--green-bright);
  box-shadow: 0 0 0 2.5px rgba(10, 157, 99, 0.13);
}

/* ---------- Buttons / inputs ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 36px;
  padding: 0 13px;
  border: 1px solid transparent;
  border-radius: 9px;
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.16s var(--ease), border-color 0.16s var(--ease), color 0.16s var(--ease), box-shadow 0.16s var(--ease), transform 0.1s var(--ease);
}

.btn:active {
  transform: translateY(1px);
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 8px 20px -10px rgba(242, 71, 0, 0.8);
}

.btn-primary:hover {
  background: var(--accent-deep);
}

.btn-secondary {
  background: var(--dark);
  border-color: var(--dark);
  color: #fff;
}

.btn-secondary:hover {
  background: #1b2027;
  border-color: #1b2027;
}

.btn-quiet {
  background: transparent;
  border-color: var(--line-strong);
  color: var(--ink-2);
}

.btn-quiet:hover {
  background: var(--surface-2);
  border-color: #c3c3bc;
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

select {
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  height: 36px;
  padding: 0 32px 0 11px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 12.5px;
  font-weight: 550;
  cursor: pointer;
  transition: border-color 0.16s var(--ease), box-shadow 0.16s var(--ease);
}

select:hover {
  border-color: #bcbcb5;
}

select:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(242, 71, 0, 0.15);
}

.select-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.select-chevron {
  position: absolute;
  right: 10px;
  color: var(--muted);
  pointer-events: none;
}

/* ---------- KPI row ---------- */

.kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-top: 20px;
}

.kpi {
  padding: 15px 16px 14px;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

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

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

.kpi-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 26px;
  height: 26px;
  border-radius: 7px;
  background: var(--accent-soft);
  color: var(--accent);
}

.kpi:nth-child(2) .kpi-icon {
  background: var(--blue-soft);
  color: var(--blue);
}

.kpi:nth-child(3) .kpi-icon {
  background: var(--green-soft);
  color: var(--green);
}

.kpi:nth-child(4) .kpi-icon {
  background: var(--amber-soft);
  color: var(--amber);
}

.kpi-value {
  margin-top: 9px;
  font-size: 27px;
  font-weight: 650;
  letter-spacing: -0.025em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.kpi-unit {
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
}

.kpi-trend {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 9px;
  font-size: 11.5px;
  font-weight: 500;
}

.trend-up {
  color: var(--green);
}

.trend-down {
  color: var(--red);
}

.trend-neutral {
  color: var(--muted);
}

.kpi-value.is-bumped {
  animation: value-bump 0.5s var(--ease);
}

@keyframes value-bump {
  0% {
    color: var(--accent);
  }
  100% {
    color: var(--ink);
  }
}

/* ---------- Cards ---------- */

.card {
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 15px 18px 13px;
}

.card-head h2 {
  font-size: 14.5px;
  font-weight: 650;
  letter-spacing: -0.01em;
}

.card-sub {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11.5px;
}

.live-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex: 0 0 auto;
  padding: 4px 9px;
  border-radius: 999px;
  background: var(--green-soft);
  color: var(--green);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* ---------- Builder ---------- */

.builder {
  margin-top: 14px;
  overflow: hidden;
}

.builder-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 17px 20px 0;
}

.builder-head-left {
  display: flex;
  align-items: flex-start;
  gap: 11px;
}

.builder-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: var(--accent-soft);
  color: var(--accent);
}

.builder-head h2 {
  font-size: 15px;
  font-weight: 650;
  letter-spacing: -0.01em;
}

.builder-sub {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11.5px;
}

.draft-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
  padding: 4px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.draft-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
}

.draft-badge.is-saved {
  border-color: #c9e6d8;
  background: var(--green-soft);
  color: var(--green);
}

.builder-steps {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 26px minmax(0, 1fr) 26px minmax(0, 1fr);
  padding: 16px 20px 0;
}

.step-card {
  min-width: 0;
  padding: 12px 13px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-2);
}

.step-top {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 9px;
}

.step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border: 1px solid #f6b79d;
  border-radius: 50%;
  background: #fff;
  color: var(--accent);
  font-size: 9.5px;
  font-weight: 700;
}

.step-kind {
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.step-card select {
  background: #fff;
}

.step-hint {
  margin-top: 7px;
  color: var(--muted);
  font-size: 10.5px;
}

.step-arrow {
  display: flex;
  align-items: center;
  justify-content: center;
  color: #b9b9b2;
}

.flowline {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px 9px;
  margin: 15px 20px 0;
  padding: 12px 15px;
  border-radius: 12px;
  background: var(--dark);
  color: #eef0f3;
  font-size: 12px;
}

.flow-key {
  color: #8a919e;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.12em;
}

.flow-token {
  padding: 4px 9px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.07);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.builder-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 13px 20px 17px;
}

.connectors {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.connectors-label {
  margin-right: 2px;
  color: var(--muted);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.connector-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink-2);
  font-size: 10.5px;
  font-weight: 600;
  transition: border-color 0.15s var(--ease), background 0.15s var(--ease);
}

.connector-chip:hover {
  border-color: var(--line-strong);
  background: var(--surface-2);
}

.connector-more {
  background: var(--surface-2);
  color: var(--muted);
}

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

/* ---------- Presets ---------- */

.presets {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px 12px;
  margin-top: 14px;
}

.presets-label {
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  white-space: nowrap;
}

.preset-list {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.preset {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink-2);
  font-size: 11.5px;
  font-weight: 550;
  cursor: pointer;
  transition: border-color 0.15s var(--ease), background 0.15s var(--ease), color 0.15s var(--ease);
}

.preset svg {
  flex: 0 0 auto;
  color: var(--accent);
}

.preset:hover {
  border-color: #f6b79d;
  background: var(--accent-soft);
  color: var(--accent-ink);
}

.preset.is-active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-ink);
}

/* ---------- Workflow list ---------- */

.wf-card {
  margin-top: 14px;
  overflow: hidden;
}

.wf-list {
  border-top: 1px solid var(--line);
}

.wf {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) 104px 44px 76px;
  align-items: center;
  gap: 13px;
  padding: 12px 18px;
  border-top: 1px solid var(--line);
  transition: background 0.14s var(--ease);
}

.wf:first-child {
  border-top: 0;
}

.wf:hover {
  background: var(--surface-2);
}

.wf-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--accent);
}

.wf.is-paused .wf-icon {
  background: #f1f1ec;
  color: var(--muted);
}

.wf-main {
  min-width: 0;
}

.wf-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.wf-name {
  overflow: hidden;
  font-size: 13px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wf.is-paused .wf-name {
  color: var(--muted);
}

.success-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex: 0 0 auto;
  padding: 2px 6px;
  border-radius: 5px;
  background: var(--green-soft);
  color: var(--green);
  font-size: 9.5px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.success-badge svg {
  width: 9px;
  height: 9px;
}

.paused-badge {
  flex: 0 0 auto;
  padding: 2px 6px;
  border-radius: 5px;
  background: #f1f1ec;
  color: var(--muted);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.wf-flow {
  margin-top: 3px;
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wf-flow b {
  color: var(--ink-2);
  font-weight: 600;
}

.wf-last {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.wf-last-label {
  color: var(--muted);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.wf-last-time {
  color: var(--ink-2);
  font-size: 11.5px;
  font-weight: 550;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.switch {
  position: relative;
  width: 38px;
  height: 22px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: #d8d8d1;
  cursor: pointer;
  transition: background 0.18s var(--ease);
}

.switch::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(16, 18, 22, 0.28);
  transition: transform 0.18s var(--ease);
}

.switch[aria-checked="true"] {
  background: var(--green-bright);
}

.switch[aria-checked="true"]::after {
  transform: translateX(16px);
}

.switch:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.wf-run {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  height: 30px;
  padding: 0 10px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink-2);
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s var(--ease), background 0.15s var(--ease), color 0.15s var(--ease);
}

.wf-run svg {
  color: var(--accent);
}

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

/* ---------- Footer ---------- */

.demo-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-top: 22px;
  padding-top: 15px;
  border-top: 1px solid var(--line);
}

.demo-foot p {
  color: var(--muted);
  font-size: 11.5px;
}

.demo-foot .btn {
  height: 32px;
  font-size: 11.5px;
  color: var(--muted);
}

/* ---------- Run drawer ---------- */

.overlay {
  position: fixed;
  top: var(--labbar-h);
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 300;
  display: flex;
  background: rgba(11, 13, 17, 0.45);
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
  opacity: 0;
  transition: opacity 0.24s var(--ease);
}

.overlay.is-open {
  opacity: 1;
}

.overlay-drawer {
  justify-content: flex-end;
}

.run-panel {
  display: flex;
  flex-direction: column;
  width: min(480px, 100%);
  height: 100%;
  background: var(--dark);
  border-left: 1px solid rgba(255, 255, 255, 0.07);
  box-shadow: -30px 0 90px -40px rgba(0, 0, 0, 0.75);
  transform: translateX(100%);
  transition: transform 0.32s var(--ease);
}

.overlay.is-open .run-panel {
  transform: none;
}

.run-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 19px 22px 14px;
  border-bottom: 1px solid var(--dark-line);
}

.run-eyebrow {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--dark-muted);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.run-status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  animation: run-pulse 1.4s infinite;
}

@keyframes run-pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(242, 71, 0, 0.5);
  }
  70% {
    box-shadow: 0 0 0 7px rgba(242, 71, 0, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(242, 71, 0, 0);
  }
}

.run-eyebrow.is-complete .run-status-dot {
  background: #34d399;
  animation: none;
}

#run-title {
  margin-top: 6px;
  color: #fff;
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  transition: background 0.15s var(--ease), color 0.15s var(--ease), border-color 0.15s var(--ease);
}

.icon-btn:hover {
  border-color: var(--line-strong);
  background: var(--surface-2);
  color: var(--ink);
}

.icon-btn-dark {
  border-color: rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.05);
  color: #b7bdc7;
}

.icon-btn-dark:hover {
  border-color: rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.run-progress {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  padding: 16px 22px 0;
}

.run-seg {
  height: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  transition: background 0.35s var(--ease);
}

.run-progress[data-progress="1"] .run-seg:nth-child(-n + 1),
.run-progress[data-progress="2"] .run-seg:nth-child(-n + 2),
.run-progress[data-progress="3"] .run-seg:nth-child(-n + 3),
.run-progress[data-progress="4"] .run-seg {
  background: var(--accent);
}

.run-progress.is-complete .run-seg {
  background: var(--green-bright);
}

.run-steps {
  flex: 1;
  overflow-y: auto;
  padding: 6px 22px 18px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.18) transparent;
}

.run-steps::-webkit-scrollbar {
  width: 8px;
}

.run-steps::-webkit-scrollbar-thumb {
  border: 2px solid var(--dark);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
}

.run-step {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) auto;
  align-items: start;
  gap: 12px;
  padding: 15px 0;
  border-top: 1px dashed rgba(255, 255, 255, 0.08);
  opacity: 0;
  transform: translateY(5px);
  transition: opacity 0.28s var(--ease), transform 0.28s var(--ease);
}

.run-step:first-child {
  border-top: 0;
}

.run-step.is-visible {
  opacity: 1;
  transform: none;
}

.run-step-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  margin-top: -1px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 50%;
  color: #34d399;
}

.run-step-icon::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.24);
}

.run-step-icon svg {
  display: none;
}

.run-step.is-active .run-step-icon {
  border-color: var(--accent);
  border-top-color: transparent;
  animation: run-spin 0.8s linear infinite;
}

.run-step.is-active .run-step-icon::before {
  display: none;
}

.run-step.is-done .run-step-icon {
  border-color: rgba(52, 211, 153, 0.4);
  background: rgba(10, 157, 99, 0.18);
}

.run-step.is-done .run-step-icon::before {
  display: none;
}

.run-step.is-done .run-step-icon svg {
  display: block;
}

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

.run-step-body {
  min-width: 0;
}

.run-step-label {
  color: #eef0f4;
  font-size: 12.5px;
  font-weight: 600;
}

.run-step-detail {
  margin-top: 3px;
  color: var(--dark-muted);
  font-size: 11.5px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.run-step-time {
  padding-top: 2px;
  color: #6f7681;
  font-size: 10.5px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.run-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 14px 22px;
  border-top: 1px solid var(--dark-line);
  background: #0c0e12;
}

.run-note {
  color: #6f7681;
  font-size: 10.5px;
}

.run-complete-line {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #34d399;
  font-size: 12px;
  font-weight: 600;
}

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

.btn-dark-quiet {
  background: transparent;
  border-color: rgba(255, 255, 255, 0.16);
  color: #d3d7de;
}

.btn-dark-quiet:hover {
  background: rgba(255, 255, 255, 0.07);
  color: #fff;
}

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

.btn-dark-primary:hover {
  background: var(--accent-deep);
  border-color: var(--accent-deep);
}

/* ---------- Toasts ---------- */

.toasts {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 400;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  pointer-events: none;
}

body.layer-right .toasts {
  right: auto;
  left: 20px;
  align-items: flex-start;
}

.toast {
  display: flex;
  align-items: center;
  gap: 9px;
  max-width: 340px;
  padding: 11px 14px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--r-md);
  background: #14171d;
  color: #eef0f4;
  font-size: 12.5px;
  font-weight: 500;
  box-shadow: 0 18px 44px -18px rgba(0, 0, 0, 0.6);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.22s var(--ease), transform 0.22s var(--ease);
}

.toast.is-visible {
  opacity: 1;
  transform: none;
}

.toast svg {
  flex: 0 0 auto;
  color: #34d399;
}

.toast.toast-warn svg {
  color: #fbbf24;
}

/* ---------- Responsive ---------- */

@media (max-width: 1120px) {
  .wf {
    grid-template-columns: 32px minmax(0, 1fr) 92px 44px 76px;
    gap: 11px;
  }
}

@media (max-width: 960px) {
  .app {
    grid-template-columns: minmax(0, 1fr);
  }

  .sidebar {
    position: static;
    height: auto;
    gap: 9px;
    padding: 11px 16px 10px;
    border-right: 0;
    border-bottom: 1px solid #1e222a;
    overflow: visible;
  }

  .sidebar-head {
    padding: 0;
  }

  .mobile-only {
    display: inline-flex;
  }

  .nav-section {
    display: none;
  }

  .nav {
    flex-direction: row;
    gap: 4px;
    margin-top: 0;
    overflow-x: auto;
    padding-bottom: 2px;
    scrollbar-width: none;
  }

  .nav::-webkit-scrollbar {
    display: none;
  }

  .nav-item {
    flex: 0 0 auto;
    width: auto;
    padding: 7px 11px;
    font-size: 12.5px;
  }

  .nav-item.is-active::before {
    top: auto;
    bottom: -9px;
    left: 12px;
    right: 12px;
    width: auto;
    height: 2px;
    border-radius: 2px 2px 0 0;
    transform: none;
  }

  .sidebar-foot {
    display: none;
  }

  .page {
    padding-top: 20px;
  }

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

  .kpi-value {
    font-size: 25px;
  }
}

@media (max-width: 860px) {
  .builder-steps {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
  }

  .step-arrow {
    height: 22px;
    transform: rotate(90deg);
  }

  .wf {
    grid-template-columns: 32px minmax(0, 1fr) auto;
    grid-template-areas:
      "icon main toggle"
      "icon meta run";
    align-items: center;
    gap: 5px 11px;
    padding: 12px 16px;
  }

  .wf-icon {
    grid-area: icon;
  }

  .wf-main {
    grid-area: main;
  }

  .wf-last {
    grid-area: meta;
    flex-direction: row;
    align-items: center;
    gap: 5px;
  }

  .wf-last-label {
    font-size: 8.5px;
  }

  .switch {
    grid-area: toggle;
    justify-self: end;
  }

  .wf-run {
    grid-area: run;
    justify-self: end;
  }
}

@media (max-width: 700px) {
  .builder-foot {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .builder-actions {
    justify-content: flex-end;
  }

  .builder-actions .btn {
    flex: 1;
  }

  .toasts,
  body.layer-right .toasts {
    right: 12px;
    bottom: 12px;
    left: 12px;
    align-items: stretch;
  }

  .toast {
    max-width: none;
  }

  .run-panel {
    width: 100%;
  }
}

@media (max-width: 540px) {
  .labbar {
    padding: 0 12px;
  }

  .labbar-left,
  .labbar-right {
    gap: 8px;
  }

  .labbar-brand {
    font-size: 10.5px;
    letter-spacing: 0.15em;
  }

  .lab-tag {
    display: none;
  }

  .demo-pill {
    padding: 5px 8px;
    font-size: 9px;
  }

  .labbar-back {
    font-size: 11px;
  }

  .back-word {
    display: none;
  }

  .page {
    padding: 16px 14px 18px;
  }

  .page-head {
    gap: 14px;
  }

  h1 {
    font-size: 23px;
  }

  .page-tools {
    width: 100%;
    justify-content: flex-end;
  }

  .page-tools .btn {
    flex: 0 0 auto;
  }

  .system-pill {
    display: none;
  }

  .kpis {
    gap: 9px;
    margin-top: 16px;
  }

  .kpi {
    padding: 12px 13px;
  }

  .kpi-label {
    font-size: 10.5px;
  }

  .kpi-value {
    font-size: 22px;
  }

  .kpi-trend {
    font-size: 10.5px;
  }

  .builder-head {
    padding: 14px 14px 0;
  }

  .builder-sub {
    font-size: 11px;
  }

  .draft-badge {
    display: none;
  }

  .builder-steps {
    padding: 14px 14px 0;
  }

  .flowline {
    margin: 13px 14px 0;
    padding: 11px 12px;
    gap: 6px 8px;
  }

  .flow-token {
    font-size: 11.5px;
  }

  .builder-foot {
    padding: 12px 14px 14px;
  }

  .connectors-label {
    width: 100%;
  }

  .presets {
    gap: 8px;
  }

  .presets-label {
    width: 100%;
  }

  .preset {
    font-size: 11px;
    padding: 7px 10px;
  }

  .card-head {
    padding: 13px 14px 11px;
  }

  .wf {
    padding: 12px 12px;
    gap: 5px 9px;
  }

  .wf-title-row {
    flex-wrap: wrap;
    gap: 3px 6px;
  }

  .wf-name {
    display: -webkit-box;
    overflow: hidden;
    white-space: normal;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
  }

  .wf-flow {
    white-space: normal;
    overflow: visible;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
  }

  .nav {
    justify-content: space-between;
    gap: 0;
    overflow-x: visible;
  }

  .nav-item {
    flex: 0 0 auto;
    padding: 7px 7px;
    font-size: 11px;
    gap: 6px;
  }

  .nav-item svg {
    display: none;
  }

  .nav-item.is-active::before {
    left: 8px;
    right: 8px;
  }

  .brand-name {
    font-size: 16px;
  }

  .demo-foot p {
    font-size: 11px;
  }

  .drawer-head {
    padding-left: 16px;
    padding-right: 16px;
  }

  .run-head {
    padding: 16px 16px 12px;
  }

  .run-progress {
    padding: 14px 16px 0;
  }

  .run-steps {
    padding: 4px 16px 16px;
  }

  .run-foot {
    padding: 12px 16px;
  }

  .run-note {
    width: 100%;
  }

  .run-actions {
    margin-left: auto;
  }
}

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

  .run-status-dot,
  .run-step.is-active .run-step-icon {
    animation: none;
  }
}
