:root {
  --ink: #1f2933;
  --muted: #6f7c87;
  --soft: #9aa5ae;
  --paper: #f7f8f5;
  --card: #ffffff;
  --line: #e5eae4;
  --line-strong: #d2dbd3;
  --navy: #2b2140;
  --navy-2: #3b2e55;
  --sage: #b9d7c3;
  --sage-2: #dceee1;
  --sage-ink: #3d7550;
  --lavender: #f2d8e6;
  --lavender-ink: #8f4773;
  --sand: #f2e8d8;
  --sand-ink: #946d31;
  --coral: #efaa91;
  --coral-2: #f9d9d0;
  --coral-ink: #a2553f;
  --shadow: 0 18px 50px rgba(35, 48, 55, 0.07);
  --shadow-sm: 0 8px 22px rgba(35, 48, 55, 0.045);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--paper);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: -0.01em;
}

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

button {
  border: 0;
  cursor: pointer;
}

code,
pre,
.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.app {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: 256px;
  background: var(--navy);
  color: #eef3ee;
  padding: 28px 18px 20px;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 11px;
  padding: 0 8px 34px;
}

.brand-left {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
}

.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 10px 10px 10px 4px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.brand-mark svg {
  display: block;
}

.sidebar-close-btn {
  display: none;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  color: #eef3ee;
  font-size: 20px;
  line-height: 1;
  place-items: center;
  flex-shrink: 0;
}

.sidebar-close-btn:hover {
  background: rgba(255, 255, 255, 0.16);
}

.topbar-mobile-brand {
  display: none;
  align-items: center;
  gap: 8px;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--navy);
}

.topbar-mobile-brand strong {
  color: var(--sage-ink);
  font-weight: 800;
}

.topbar-mobile-brand img {
  display: block;
  flex-shrink: 0;
}

.inline-action-form {
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand-name {
  font-weight: 760;
  font-size: 18px;
  letter-spacing: -0.04em;
}

.brand-name span {
  color: var(--sage);
}

.eyebrow {
  text-transform: uppercase;
  font-size: 10px;
  letter-spacing: 0.13em;
  color: #8ea0a8;
  font-weight: 750;
  padding: 0 12px 10px;
}

.collections-heading .eyebrow {
  display: block;
  padding: 0 0 6px;
}

nav {
  display: grid;
  gap: 5px;
}

.nav-item {
  color: #b4c0c5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 11px 12px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  background: transparent;
  text-align: left;
  transition: background 0.15s ease, color 0.15s ease;
}

.nav-item-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.nav-item:hover,
.nav-item.active {
  color: #ffffff;
  background: var(--navy-2);
}

.nav-item.active {
  box-shadow: inset 3px 0 var(--sage);
}

.nav-icon {
  width: 18px;
  height: 18px;
  opacity: 0.92;
  flex-shrink: 0;
}

.nav-count {
  font-size: 10px;
  font-weight: 750;
  padding: 2px 7px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.1);
  color: #dce6e9;
}

.workspace {
  margin-top: auto;
  padding: 16px 12px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.workspace-label {
  font-size: 11px;
  color: #9bb0b6;
  margin-bottom: 10px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.workspace-user {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  background: transparent;
  color: inherit;
  padding: 6px 4px;
  border-radius: 9px;
  text-align: left;
}

.workspace-user:hover {
  background: rgba(255, 255, 255, 0.06);
}

.avatar {
  width: 31px;
  height: 31px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--sage);
  color: var(--navy);
  font-size: 11px;
  font-weight: 800;
  flex-shrink: 0;
}

.workspace-user-meta {
  min-width: 0;
  flex: 1;
}

.workspace-user strong {
  display: block;
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.workspace-user small {
  display: block;
  color: #93a3a9;
  font-size: 10px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#workspaceRoleBadge {
  display: inline-flex;
  width: fit-content;
  margin-top: 6px;
  padding: 3px 8px;
  border: 1px solid rgba(185, 215, 195, 0.24);
  background: rgba(185, 215, 195, 0.12);
  color: var(--sage);
  line-height: 1.4;
}

#workspaceRoleBadge:empty {
  display: none;
}

/* Main area */
.main {
  flex: 1;
  min-width: 0;
  padding: 28px 38px 48px;
  max-width: 1580px;
  display: flex;
  flex-direction: column;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 30px;
}

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

.menu-toggle {
  display: none;
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: #ffffff;
  border: 1px solid var(--line);
  color: var(--navy);
  place-items: center;
  flex-shrink: 0;
}

.menu-toggle:hover {
  border-color: var(--line-strong);
}

.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(20, 35, 45, 0.42);
  z-index: 45;
  backdrop-filter: blur(2px);
}

.sidebar-backdrop.open {
  display: block;
}

.breadcrumbs {
  color: var(--muted);
  font-size: 12px;
}

.breadcrumbs strong {
  color: var(--ink);
  font-weight: 700;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 6px 12px;
  width: 220px;
  transition: border-color 0.15s ease, width 0.2s ease;
}

.search-box:focus-within {
  border-color: #9bbda5;
  width: 260px;
}

.search-box input {
  border: 0;
  outline: none;
  background: transparent;
  width: 100%;
  font-size: 12px;
  color: var(--ink);
}

.health-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 99px;
  padding: 7px 12px;
  font-size: 11px;
  font-weight: 650;
  color: var(--ink);
}

.health-pill:hover {
  border-color: var(--line-strong);
}

.health-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #539b6a;
}

.health-dot.warn {
  background: #d39241;
}

.health-dot.offline {
  background: #c86450;
}

/* Gateway setup banner when separate origin isn't configured yet */
.gateway-banner {
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: #ffffff;
  border: 1px solid #dfc9b8;
  border-radius: 18px 9px 18px 9px;
  padding: 14px 18px;
  margin-bottom: 22px;
  box-shadow: var(--shadow-sm);
}

.gateway-banner.visible {
  display: flex;
  flex-wrap: wrap;
}

.gateway-banner-copy strong {
  display: block;
  font-size: 12px;
  color: var(--navy);
  margin-bottom: 3px;
}

.gateway-banner-copy span {
  font-size: 11px;
  color: var(--muted);
}

.gateway-banner-form {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.gateway-banner-form input {
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  padding: 8px 11px;
  font-size: 12px;
  width: 260px;
  color: var(--ink);
}

/* Header intro */
.intro,
.section-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 26px;
}

.section-header > div {
  flex: 1;
  min-width: 0;
}

.section-header > .status-badge {
  flex-shrink: 0;
}

h1 {
  font-size: clamp(26px, 3.4vw, 38px);
  line-height: 1.06;
  letter-spacing: -0.055em;
  margin: 0 0 8px;
  color: var(--navy);
  font-weight: 760;
}

.intro p,
.section-header p {
  color: var(--muted);
  margin: 0;
  font-size: 13.5px;
}

.intro-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* A label never breaks inside a header button. On wide screens the buttons sit beside the title while the
   description keeps at least 360px; otherwise they move, whole, to their own row. */
.intro-actions > button {
  white-space: nowrap;
}

@media (min-width: 769px) {
  .intro {
    flex-wrap: wrap;
  }

  .intro > div:first-child {
    flex: 1 1 360px;
    min-width: 0;
  }

  .intro > .intro-actions {
    flex: 0 1 auto;
    flex-wrap: wrap;
  }
}

.create,
.primary-btn {
  background: var(--navy);
  color: #ffffff;
  border-radius: 9px;
  padding: 11px 16px;
  font-size: 12px;
  font-weight: 700;
  display: inline-flex;
  gap: 8px;
  align-items: center;
  box-shadow: 0 8px 16px rgba(20, 35, 45, 0.11);
  transition: background 0.15s ease, transform 0.15s ease;
}

.create:hover,
.primary-btn:hover {
  background: var(--navy-2);
  transform: translateY(-1px);
}

.secondary-btn {
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--ink);
  border-radius: 9px;
  padding: 10px 14px;
  font-size: 11.5px;
  font-weight: 650;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.secondary-btn:hover {
  border-color: var(--line-strong);
  background: #fbfcfa;
}

.primary-btn:disabled,
.secondary-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

.primary-btn:disabled:hover {
  background: var(--navy);
}

.secondary-btn:disabled:hover {
  border-color: var(--line);
  background: #ffffff;
}

.ghost-btn {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  border-radius: 9px;
  padding: 9px 14px;
  font-size: 12px;
  font-weight: 650;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.ghost-btn:hover {
  border-color: var(--line-strong);
  background: #fbfcfa;
}
.ghost-btn:focus-visible {
  outline: 2px solid var(--sage-ink);
  outline-offset: 2px;
}
.ghost-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  background: transparent;
}
.collection-filters .ghost-btn.active {
  background: #e6efe5;
  color: #315b3b;
  border-color: #9bb79e;
  box-shadow: inset 0 0 0 1px #9bb79e;
}

.danger-btn {
  border: 1px solid #f0cbc1;
  background: #fff7f5;
  color: var(--coral-ink);
  border-radius: 9px;
  padding: 9px 13px;
  font-size: 11px;
  font-weight: 700;
}

.danger-btn:hover {
  background: var(--coral-2);
}

.small-btn {
  padding: 6px 10px;
  font-size: 11px;
  border-radius: 7px;
}

/* Views */
.view-section {
  display: none;
}

.view-section.active {
  display: block;
}

/* Stats */
.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 13px;
  margin-bottom: 24px;
}

.stat {
  position: relative;
  min-width: 0;
  padding: 17px 18px 19px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 25px 11px 25px 11px;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.stat:nth-child(even) {
  border-radius: 11px 25px 11px 25px;
}

.stat::after {
  content: "";
  position: absolute;
  width: 52px;
  height: 52px;
  right: -19px;
  bottom: -21px;
  border-radius: 50%;
  background: var(--sage-2);
  opacity: 0.75;
}

.stat:nth-child(2)::after {
  background: var(--lavender);
}

.stat:nth-child(3)::after {
  background: var(--sand);
}

.stat:nth-child(4)::after {
  background: var(--coral-2);
}

.stat-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
  margin-bottom: 12px;
  position: relative;
  z-index: 1;
}

.stat-icon {
  width: 27px;
  height: 27px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: var(--navy);
  position: relative;
  z-index: 1;
}

.stat:nth-child(1) .stat-icon {
  background: var(--sage-2);
}

.stat:nth-child(2) .stat-icon {
  background: var(--lavender);
}

.stat:nth-child(3) .stat-icon {
  background: var(--sand);
}

.stat:nth-child(4) .stat-icon {
  background: var(--coral-2);
}

.stat-value {
  font-size: 26px;
  color: var(--navy);
  font-weight: 760;
  letter-spacing: -0.055em;
  position: relative;
  z-index: 1;
}

.stat-meta {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 550;
  position: relative;
  z-index: 1;
}

/* Panels & grids */
.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(290px, 0.9fr);
  gap: 18px;
}

.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 28px 14px 28px 14px;
  padding: 20px 22px;
  box-shadow: var(--shadow);
  position: relative;
}

.panel.alt-radius {
  border-radius: 14px 28px 14px 28px;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.panel-title {
  color: var(--navy);
  font-size: 14px;
  font-weight: 760;
}

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

.link-btn {
  background: transparent;
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 700;
  padding: 4px 6px;
}

.link-btn:hover {
  color: var(--navy);
}

/* Empty states */
.empty-state {
  padding: 28px 20px;
  text-align: center;
  border: 1px dashed var(--line-strong);
  border-radius: 18px 9px 18px 9px;
  background: #fbfcfa;
}

.empty-state strong {
  display: block;
  color: var(--navy);
  font-size: 13px;
  margin-bottom: 6px;
}

.empty-state p {
  color: var(--muted);
  font-size: 12px;
  margin: 0 auto 16px;
  max-width: 390px;
  line-height: 1.5;
}

.empty-actions {
  display: flex;
  justify-content: center;
  gap: 9px;
  flex-wrap: wrap;
}

/* Workflow rows */
.workflow-row {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 14px 0;
  border-top: 1px solid #eff2ef;
}

.workflow-row:first-of-type {
  border-top: 0;
}

.flow-symbol {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  flex: none;
  color: var(--navy);
  background: var(--sage-2);
}

.workflow-row:nth-of-type(3n + 2) .flow-symbol {
  background: var(--lavender);
}

.workflow-row:nth-of-type(3n + 3) .flow-symbol {
  background: var(--sand);
}

/* Saved connections show the real connector mark on a white plate in both
   themes; unknown and custom providers keep the two letter initials tile. */
.flow-symbol.has-logo,
.workflow-row:nth-of-type(3n + 2) .flow-symbol.has-logo,
.workflow-row:nth-of-type(3n + 3) .flow-symbol.has-logo {
  background: #ffffff;
  box-shadow: inset 0 0 0 1px var(--line);
}
.flow-symbol.has-logo svg {
  display: block;
}

.flow-info {
  min-width: 0;
  flex: 1;
}

.flow-title-line {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}

.flow-info strong {
  color: var(--navy);
  font-size: 13px;
  cursor: pointer;
}

.flow-info strong:hover {
  text-decoration: underline;
}

.version-pill {
  font-size: 10px;
  color: var(--muted);
  background: var(--paper);
  padding: 2px 6px;
  border-radius: 6px;
  font-weight: 650;
}

.flow-sub {
  color: var(--muted);
  font-size: 11.5px;
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.flow-meta-tags {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
  flex-wrap: wrap;
}

.meta-chip {
  font-size: 10px;
  color: var(--muted);
  background: var(--paper);
  border: 1px solid var(--line);
  padding: 2px 7px;
  border-radius: 6px;
}

.meta-chip.webhook {
  cursor: pointer;
  color: var(--navy);
}

.meta-chip.webhook:hover {
  border-color: #9bbda5;
  background: #f4faf6;
}

.status-badge {
  padding: 4px 9px;
  border-radius: 20px;
  font-size: 10px;
  font-weight: 750;
  text-transform: capitalize;
  flex-shrink: 0;
}

.status-badge.active,
.status-badge.succeeded,
.status-badge.connected {
  background: var(--sage-2);
  color: var(--sage-ink);
}

.status-badge.paused,
.status-badge.queued,
.status-badge.running {
  background: var(--sand);
  color: var(--sand-ink);
}

/* ENG-C1: a run that waits is live, like a run that is queued, in its own hue. */
.status-badge.waiting {
  background: var(--lavender);
  color: var(--lavender-ink);
}

.status-badge.draft,
.status-badge.skipped {
  background: #eef1ef;
  color: var(--muted);
}

.status-badge.failed {
  background: var(--coral-2);
  color: var(--coral-ink);
}

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

/* Activity list */
.activity {
  display: grid;
  gap: 14px;
}

.activity-item {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  gap: 11px;
  align-items: center;
  padding: 8px;
  margin: -6px -8px;
  border-radius: 10px;
  cursor: pointer;
}

.activity-item:hover {
  background: var(--paper);
}

.activity-dot {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--sage-2);
  color: var(--sage-ink);
  font-size: 11px;
  font-weight: 800;
}

.activity-dot.failed {
  background: var(--coral-2);
  color: var(--coral-ink);
}

.activity-dot.running,
.activity-dot.queued {
  background: var(--sand);
  color: var(--sand-ink);
}

.activity-copy strong {
  font-size: 12px;
  color: var(--navy);
  display: block;
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.activity-copy span {
  font-size: 10.5px;
  color: var(--muted);
}

/* Workspace usage */
.usage {
  margin-top: 18px;
  background: var(--navy);
  color: #ffffff;
  border-radius: 14px 28px 14px 28px;
  padding: 20px 22px;
}

.usage h3 {
  font-size: 13.5px;
  margin: 0 0 5px;
  font-weight: 700;
}

.usage p {
  color: #aab9be;
  font-size: 11px;
  margin: 0 0 15px;
}

.bar {
  height: 7px;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.14);
  overflow: hidden;
  margin-bottom: 9px;
}

.bar span {
  display: block;
  height: 100%;
  width: 0%;
  background: var(--sage);
  border-radius: 7px;
  transition: width 0.3s ease;
}

.usage-meta {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: #b7c6c9;
}

.usage-meta strong {
  color: #ffffff;
}

/* Filter bar */
.filter-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.pill-tabs {
  display: inline-flex;
  gap: 4px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 4px;
}

.pill-tab {
  background: transparent;
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 650;
  padding: 6px 12px;
  border-radius: 8px;
}

.pill-tab.active {
  background: var(--navy);
  color: #ffffff;
}

.filter-select {
  border: 1px solid var(--line);
  background: #ffffff;
  border-radius: 9px;
  padding: 7px 11px;
  font-size: 12px;
  color: var(--ink);
}

/* Templates & Integrations cards */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 15px;
}

.blueprint-card,
.connector-card {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 22px 10px 22px 10px;
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 14px;
}

.blueprint-card h3,
.connector-card h3 {
  margin: 0 0 6px;
  font-size: 14px;
  color: var(--navy);
}

.blueprint-card p,
.connector-card p {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
}

/* Solution packs (Blueprints view). The cards share the grid's rows, so titles, summaries, lists and buttons
   line up across a row of cards; without subgrid support the button still sits at the bottom of each card. */
.packs-panel {
  margin-bottom: 36px;
}

.packs-panel .panel-header {
  align-items: flex-start;
}

/* The packs panel and the single workflow blueprints below it are two sections of the page: same heading style,
   and a clear gap between them. */
.packs-panel h2.panel-title,
.blueprints-head h2.panel-title {
  margin: 0;
  font-size: 16px;
  line-height: 1.3;
  letter-spacing: -0.01em;
}

.packs-panel .panel-subtitle,
.blueprints-head .panel-subtitle {
  margin: 3px 0 0;
  max-width: 72ch;
  line-height: 1.5;
}

.blueprints-head {
  margin: 0 0 12px;
  padding: 0 2px;
}

.packs-status {
  margin: 0 0 12px;
  font-size: 12px;
  color: var(--muted);
}

.packs-status:empty {
  display: none;
}

.packs-status.is-error {
  color: var(--coral-ink);
  font-weight: 600;
}

.pack-card {
  justify-content: flex-start;
  gap: 10px;
}

.pack-card h3 {
  margin: 0;
  line-height: 1.35;
}

.pack-card .pack-meta {
  font-size: 11.5px;
}

.pack-meta span {
  display: block;
}

.pack-steps {
  margin: 0;
  padding-left: 18px;
  font-size: 12px;
  line-height: 1.45;
  color: var(--ink);
}

.pack-steps li + li {
  margin-top: 5px;
}

.pack-steps li::marker {
  color: var(--soft);
  font-weight: 700;
}

.pack-step-name {
  font-weight: 650;
  color: var(--navy);
}

.pack-step-meta {
  color: var(--muted);
  font-size: 11.5px;
}

.pack-steps code {
  font-size: 10.5px;
  color: var(--muted);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 0 5px;
}

#solutionPackFormBody .pack-steps {
  margin: 4px 0 10px;
}

.pack-install-note {
  margin: 0 0 14px;
}

.pack-card-actions {
  margin-top: auto;
  padding-top: 4px;
}

@supports (grid-template-rows: subgrid) {
  .packs-grid .pack-card {
    display: grid;
    grid-row: span 5;
    grid-template-rows: subgrid;
    row-gap: 10px;
  }

  .packs-grid .pack-card-actions {
    align-self: end;
  }
}

.step-chain {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.step-pill {
  font-size: 10px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 7px;
  background: var(--paper);
  color: var(--navy);
  border: 1px solid var(--line);
}

.connector-head {
  display: flex;
  align-items: center;
  gap: 12px;
}

.connector-badge {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 14px;
  background: var(--sage-2);
  color: var(--navy);
  flex-shrink: 0;
}

.connector-card:nth-child(3n + 2) .connector-badge {
  background: var(--lavender);
}

.connector-card:nth-child(3n + 3) .connector-badge {
  background: var(--sand);
}

/* Runs table list */
.runs-list {
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  background: #ffffff;
}

.run-row {
  display: grid;
  grid-template-columns: 32px minmax(0, 1.4fr) 110px 95px 150px auto;
  align-items: center;
  gap: 12px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
}

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

.run-row:hover {
  background: #fbfcfa;
}

.run-source {
  font-size: 11px;
  color: var(--muted);
}

.run-duration {
  font-size: 11px;
  color: var(--muted);
}

.run-time {
  font-size: 11px;
  color: var(--muted);
}

/* Settings layout */
.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
  gap: 18px;
}

.field-group {
  margin-bottom: 14px;
}

.field-label {
  color: var(--navy);
  font-size: 11.5px;
  font-weight: 700;
  display: block;
  margin-bottom: 6px;
}

.field-hint {
  color: var(--muted);
  font-size: 10.5px;
  margin-top: 4px;
  display: block;
}

.text-input,
.select-input,
.code-textarea {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  padding: 10px 12px;
  outline: none;
  color: var(--ink);
  background: #ffffff;
  font-size: 12.5px;
}

.text-input:focus,
.select-input:focus,
.code-textarea:focus {
  border-color: #8eb79a;
  box-shadow: 0 0 0 3px rgba(185, 215, 195, 0.28);
}

.password-input-group {
  display: flex;
  align-items: stretch;
  gap: 8px;
}

.password-input-group .text-input {
  flex: 1;
  min-width: 0;
  width: 0;
}

.password-visibility-btn {
  flex-shrink: 0;
  min-width: 64px;
  min-height: 40px;
  padding: 8px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: var(--paper);
  color: var(--navy);
  font-size: 12px;
  font-weight: 700;
}

.password-visibility-btn:hover {
  background: var(--sage-2);
}

.password-visibility-btn:focus-visible {
  outline: 2px solid var(--sage-ink);
  outline-offset: 2px;
}

.code-textarea {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 11.5px;
  line-height: 1.55;
  resize: vertical;
}

/* CODE-C: the Run code editor - line numbers share the textarea's metrics. */
.code-editor-wrap { display: flex; border: 1px solid var(--line-strong); border-radius: 9px; overflow: hidden; background: #ffffff; }
.code-editor-wrap:focus-within { border-color: #8eb79a; box-shadow: 0 0 0 3px rgba(185, 215, 195, 0.28); }
.code-editor-lines { margin: 0; padding: 10px 8px 10px 10px; min-width: 2.4em; text-align: right; color: var(--muted); background: #f6f4ee; border-right: 1px solid var(--line); font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; font-size: 11.5px; line-height: 1.55; overflow: hidden; user-select: none; }
.code-editor-input { border: 0; border-radius: 0; resize: none; flex: 1; min-width: 0; overflow: auto; white-space: pre; background: transparent; }
.code-secret-warning { margin: 0 0 14px; padding: 8px 12px; color: var(--sand-ink); background: var(--sand); border-left: 3px solid var(--sand-ink); border-radius: 0 6px 6px 0; font-size: 12px; line-height: 1.5; }
.code-secret-warning[hidden] { display: none; }
.code-secret-warning .secondary-btn { margin-left: 8px; }
.code-step-facts { margin: 0; padding-left: 18px; font-size: 12px; color: var(--muted); display: grid; gap: 4px; }
.code-step-facts li { line-height: 1.45; }

.service-status-list {
  display: grid;
  gap: 9px;
  margin-top: 14px;
}

.service-status-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--paper);
  font-size: 12px;
}

.api-key-banner {
  background: #f4faf6;
  border: 1px solid #bddbc6;
  border-radius: 11px;
  padding: 12px 14px;
  margin-bottom: 14px;
}

.api-key-banner code {
  display: block;
  margin-top: 6px;
  padding: 8px 10px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 7px;
  font-size: 11.5px;
  word-break: break-all;
}

/* Modals */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(20, 35, 45, 0.45);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 18px;
  z-index: 40;
  backdrop-filter: blur(4px);
}

.modal-backdrop.open {
  display: flex;
}

.modal-card {
  width: min(620px, 100%);
  max-height: 90vh;
  overflow: auto;
  background: #ffffff;
  border-radius: 26px 12px 26px 12px;
  box-shadow: 0 28px 80px rgba(20, 35, 45, 0.24);
  padding: 24px;
}

.modal-card.wide {
  width: min(820px, 100%);
}

.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 18px;
}

.modal-head h2 {
  color: var(--navy);
  margin: 0 0 5px;
  font-size: 20px;
  letter-spacing: -0.04em;
}

.modal-head p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.close-btn {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--paper);
  color: var(--muted);
  display: grid;
  place-items: center;
  font-size: 18px;
  flex-shrink: 0;
}

.close-btn:hover {
  color: var(--ink);
}

.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 9px;
  padding-top: 16px;
  margin-top: 18px;
  border-top: 1px solid var(--line);
  flex-wrap: wrap;
}

/* Canvas Studio Modal */
.canvas-modal {
  width: min(1180px, 100%);
  height: min(800px, 93vh);
  background: var(--paper);
  border-radius: 30px 14px 30px 14px;
  box-shadow: 0 28px 90px rgba(43, 33, 64, 0.28);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.canvas-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: #ffffff;
  border-bottom: 1px solid var(--line);
  padding: 14px 22px;
  flex-wrap: wrap;
}

.canvas-title {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.canvas-title-mark {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  flex-shrink: 0;
}

.canvas-title strong {
  display: block;
  color: var(--navy);
  font-size: 14px;
}

.canvas-title span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  margin-top: 2px;
}

.canvas-tools {
  display: flex;
  align-items: center;
  gap: 10px;
}

.mode-switch {
  display: flex;
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 3px;
  background: var(--paper);
}

.mode-switch button {
  border-radius: 16px;
  color: var(--muted);
  padding: 6px 12px;
  background: transparent;
  font-size: 11px;
  font-weight: 700;
}

.mode-switch button.active {
  background: #ffffff;
  color: var(--navy);
  box-shadow: 0 2px 7px rgba(43, 33, 64, 0.08);
}

.canvas-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  flex: 1;
  min-height: 0;
}

.flow-stage {
  position: relative;
  overflow: auto;
  padding: 34px 28px;
  background-color: #f7f8f5;
  background-image: radial-gradient(#dbd7e0 1px, transparent 1px);
  background-size: 20px 20px;
}

.flow-stack {
  width: min(460px, 100%);
  margin: 0 auto;
  display: grid;
  justify-items: center;
}

.flow-node {
  width: 100%;
  background: #ffffff;
  border: 1.5px solid var(--line);
  border-radius: 20px 9px 20px 9px;
  padding: 14px 16px;
  box-shadow: 0 10px 24px rgba(43, 33, 64, 0.06);
  cursor: pointer;
  transition: border-color 0.15s ease, transform 0.12s ease;
}

.flow-node:hover {
  border-color: #b4c7ba;
}

.flow-node.selected {
  border-color: var(--navy);
  box-shadow: 0 0 0 3px rgba(43, 33, 64, 0.1), 0 12px 26px rgba(43, 33, 64, 0.08);
}

.flow-node-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 7px;
}

.node-type-label {
  color: var(--muted);
  font-size: 9.5px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-weight: 800;
}

.node-order-btns {
  display: flex;
  gap: 4px;
}

.node-mini-btn {
  background: var(--paper);
  color: var(--muted);
  border-radius: 5px;
  padding: 2px 6px;
  font-size: 10px;
  font-weight: 700;
}

.node-mini-btn:hover {
  color: var(--navy);
  background: var(--line);
}

.flow-node-head {
  display: flex;
  align-items: center;
  gap: 10px;
}

.node-symbol {
  width: 28px;
  height: 28px;
  border-radius: 9px 4px 9px 4px;
  background: var(--sage-2);
  display: grid;
  place-items: center;
  color: var(--sage-ink);
  font-weight: 800;
  font-size: 12px;
  flex-shrink: 0;
}

.flow-node[data-kind="condition"] .node-symbol {
  background: var(--sand);
  color: var(--sand-ink);
}

.flow-node[data-kind="action"] .node-symbol {
  background: var(--lavender);
  color: var(--lavender-ink);
}

.flow-node[data-kind="ai"] .node-symbol {
  background: #e6e0f5;
  color: var(--navy);
}

.flow-node[data-kind="loop"] .node-symbol {
  background: #d8ece2;
  color: var(--sage-ink);
}

.loop-inner-box {
  border: 1px dashed var(--line-strong);
  border-radius: 12px;
  padding: 10px 11px;
  background: var(--paper);
  margin-bottom: 12px;
}

.loop-inner-box-title {
  font-size: 10.5px;
  font-weight: 760;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin-bottom: 8px;
}

.expr-chip-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 6px;
}

.expr-chip {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 10px;
  padding: 3px 7px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--navy);
  cursor: pointer;
  transition: background 0.14s ease, border-color 0.14s ease;
}

.expr-chip:hover {
  background: var(--sage-2);
  border-color: var(--sage);
}

.node-name {
  color: var(--navy);
  font-size: 12.5px;
  font-weight: 750;
}

.node-detail {
  color: var(--muted);
  font-size: 11px;
  margin: 6px 0 0 38px;
  word-break: break-all;
}

/* Studio wires: cable with joint ports, in the connected-canvas language */
.node-connector {
  height: 30px;
  width: 2px;
  margin: 0 auto;
  background: #c1b8ca;
  border-radius: 99px;
  position: relative;
}

.node-connector::before,
.node-connector::after {
  content: "";
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ffffff;
  border: 2px solid #a79ab0;
  box-sizing: border-box;
}

.node-connector::before {
  top: -5px;
}

.node-connector::after {
  bottom: -5px;
}

/* Run monitor wires (shorter cable between step traces) */
.trace-connector {
  width: 2px;
  height: 18px;
  margin: 0 auto;
  background: #c1b8ca;
  border-radius: 99px;
  position: relative;
}

.trace-connector::before,
.trace-connector::after {
  content: "";
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #ffffff;
  border: 2px solid #a79ab0;
  box-sizing: border-box;
}

.trace-connector::before {
  top: -4px;
}

.trace-connector::after {
  bottom: -4px;
}

.add-step-bar {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: center;
  background: rgba(255, 255, 255, 0.86);
  border: 1px dashed #b8aabd;
  border-radius: 16px 8px 16px 8px;
  padding: 10px 12px;
  width: 100%;
}

.add-step-chip {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 5px 9px;
  font-size: 10.5px;
  font-weight: 700;
  color: var(--navy);
}

.add-step-chip:hover {
  background: var(--sage-2);
  border-color: var(--sage);
}

.canvas-side {
  background: #ffffff;
  border-left: 1px solid var(--line);
  padding: 20px;
  overflow: auto;
}
.canvas-assistant-section {
  padding: 14px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: var(--paper);
}
.canvas-assistant-prompt {
  width: 100%;
  min-height: 72px;
  resize: vertical;
}
.canvas-assistant-reply {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.canvas-assistant-card {
  margin-top: 12px;
  padding: 12px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--surface, #fff);
}
.canvas-assistant-card .assistant-action-title {
  margin-top: 0;
}
.canvas-assistant-card-lines {
  max-height: 320px;
  overflow: auto;
}

.side-section {
  border-bottom: 1px solid var(--line);
  padding-bottom: 16px;
  margin-bottom: 16px;
}

.side-section:last-child {
  border-bottom: 0;
  margin-bottom: 0;
}

.side-label {
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 9.5px;
  font-weight: 800;
  margin-bottom: 12px;
}

/* Collapsible workflow details header in the canvas side panel */
.side-details {
  padding-bottom: 10px;
}
.side-details summary {
  cursor: pointer;
  list-style: none;
  margin-bottom: 0;
  padding: 2px 0;
}
.side-details summary::-webkit-details-marker {
  display: none;
}
.side-details summary::after {
  content: " \25be";
  font-size: 9px;
}
.side-details[open] summary {
  margin-bottom: 12px;
}
.side-details[open] summary::after {
  content: " \25b4";
}

/* Inspector Advanced section (Guided mode): step key, HTTP method, hints */
.insp-advanced {
  margin-top: 10px;
  border-top: 1px solid var(--line);
  padding-top: 8px;
}
.insp-advanced summary {
  cursor: pointer;
  font-size: 10.5px;
  font-weight: 750;
  color: var(--muted);
}
.insp-advanced .field-hint {
  display: block;
  margin-top: 6px;
}

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

.canvas-foot-note {
  color: var(--muted);
  font-size: 11px;
}

.canvas-foot-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* Step detail cards in Run Inspector */
.step-trace-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 13px 15px;
  margin-bottom: 10px;
  background: #fbfcfa;
}

.step-trace-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.json-box {
  background: #f5f6f8;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 11px;
  font-size: 11px;
  line-height: 1.5;
  overflow-x: auto;
  max-height: 190px;
  margin: 6px 0 0;
  white-space: pre-wrap;
  word-break: break-word;
}

/* Footer & Toast */
.app-footer {
  margin-top: auto;
  padding-top: 32px;
  text-align: right;
  color: #98a3a1;
  font-size: 10.5px;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  background: var(--navy);
  color: #ffffff;
  padding: 12px 16px;
  border-radius: 10px;
  box-shadow: var(--shadow);
  font-size: 12px;
  opacity: 0;
  transform: translateY(10px);
  transition: 0.2s ease;
  pointer-events: none;
  z-index: 100;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

/* Zero-flash pre-auth gating */
.boot-splash {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 95;
  background: var(--paper);
  align-items: center;
  justify-content: center;
}

.boot-splash-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 600;
}

.boot-splash-inner img {
  display: block;
  animation: bootPulse 1.4s ease-in-out infinite;
}

@keyframes bootPulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(0.95); opacity: 0.78; }
}

html.auth-verifying .boot-splash {
  display: flex;
}

html.auth-verifying .app,
html.auth-verifying .mobile-bottom-nav,
html.auth-verifying .sidebar-backdrop {
  display: none !important;
}

html.auth-locked #authOverlay {
  display: flex !important;
}

html.auth-locked .app,
html.auth-locked .mobile-bottom-nav,
html.auth-locked .sidebar-backdrop {
  display: none !important;
}

.auth-boot-status {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 11px;
  background: var(--paper-2);
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 14px;
}

.auth-spinner {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid #cbd6ce;
  border-top-color: var(--navy);
  animation: authSpin 0.75s linear infinite;
  flex-shrink: 0;
}

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

/* Auth Overlay */
.auth-overlay {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: var(--paper);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.auth-overlay.open {
  display: flex;
}

.auth-card {
  width: min(440px, 100%);
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 26px 12px 26px 12px;
  padding: 32px 28px 26px;
  box-shadow: 0 24px 64px rgba(43, 33, 64, 0.08);
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 11px;
  margin-bottom: 22px;
}

.auth-brand-copy {
  display: flex;
  flex-direction: column;
}

.auth-brand-name {
  font-size: 18px;
  font-weight: 800;
  color: var(--navy);
  letter-spacing: -0.03em;
  line-height: 1.1;
}

.auth-brand-name span {
  color: var(--sage-ink);
}

.auth-brand-tag {
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
}

.auth-card h1 {
  font-size: 20px;
  font-weight: 800;
  color: var(--navy);
  margin: 0 0 6px;
  letter-spacing: -0.02em;
}

.auth-subcopy {
  font-size: 12.5px;
  color: var(--muted);
  margin: 0 0 18px;
  line-height: 1.5;
}

.auth-error {
  background: var(--coral-2);
  color: var(--coral-ink);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 12px;
  font-weight: 650;
  margin-bottom: 14px;
}

.auth-notice {
  background: var(--sage-2);
  color: var(--sage-ink);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 12px;
  line-height: 1.5;
  margin-top: 14px;
}

.auth-verification-gate {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.auth-gate-copy {
  color: var(--navy);
  font-size: 13px;
  line-height: 1.55;
  margin: 0 0 14px;
}

.text-btn {
  border: 0;
  background: transparent;
  color: var(--sage-ink);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  padding: 4px 0;
}

.text-btn:hover {
  text-decoration: underline;
}

.auth-gateway-details {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  font-size: 11.5px;
  color: var(--muted);
}

.auth-gateway-details summary {
  cursor: pointer;
  font-weight: 650;
}

.auth-footer {
  margin-top: 18px;
  text-align: center;
  font-size: 10.5px;
  color: var(--soft);
}

.signout-btn {
  margin-top: 8px;
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.78);
  font-size: 11.5px;
  font-weight: 650;
  transition: background 0.15s ease, color 0.15s ease;
}

.signout-btn:hover {
  background: rgba(255, 255, 255, 0.14);
  color: #ffffff;
}

.inline-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.preset-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 6px;
}

.preset-chip {
  background: var(--paper);
  border: 1px solid var(--line);
  color: var(--navy);
  font-size: 10.5px;
  font-weight: 650;
  padding: 3px 8px;
  border-radius: 999px;
}

.preset-chip:hover {
  border-color: #9bbda5;
  background: #f4faf6;
}

.capture-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px;
  margin-bottom: 10px;
}

.capture-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 10.5px;
  color: var(--muted);
  margin-bottom: 6px;
}

.token-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin: 7px 0;
}

.token-pill {
  background: #ffffff;
  border: 1px solid #c5d9cc;
  color: var(--sage-ink);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 10px;
  padding: 3px 7px;
  border-radius: 6px;
  cursor: pointer;
}

.token-pill:hover {
  background: var(--sage-2);
  border-color: #8fb89d;
}

/* Mobile Bottom Navigation (hidden on desktop/tablet) */
.mobile-bottom-nav {
  display: none;
}

/* Responsive */
@media (max-width: 1080px) {
  .sidebar {
    width: 220px;
    padding: 24px 14px 18px;
  }
  .main {
    padding: 24px 24px 40px;
  }
  .canvas-body {
    grid-template-columns: 1fr;
  }
  .canvas-side {
    border-left: 0;
    border-top: 1px solid var(--line);
  }
  .run-row {
    grid-template-columns: 28px minmax(0, 1fr) 120px auto;
  }
  .run-source,
  .run-duration {
    display: none;
  }
}

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

@media (max-width: 768px) {
  html,
  body {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
    overflow-x: clip;
  }

  body.drawer-open {
    overflow: hidden;
  }

  .app {
    display: block;
    width: 100%;
    max-width: 100%;
  }

  /* Full-width content + smooth slide-over off-canvas sidebar drawer */
  .sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    width: min(284px, 84vw);
    padding: 24px 16px calc(22px + env(safe-area-inset-bottom));
    z-index: 55;
    transform: translateX(-110%);
    visibility: hidden;
    pointer-events: none;
    transition: transform 0.24s cubic-bezier(0.22, 1, 0.36, 1), visibility 0.24s;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .sidebar.mobile-open {
    transform: translateX(0);
    visibility: visible;
    pointer-events: auto;
    box-shadow: 0 24px 64px rgba(20, 35, 45, 0.42);
  }

  .sidebar-close-btn {
    display: grid;
  }

  .menu-toggle {
    display: grid;
    width: 38px;
    height: 38px;
    border-radius: 10px;
  }

  .topbar-mobile-brand {
    display: inline-flex;
  }

  .breadcrumbs {
    display: none !important;
  }

  .main {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    padding: 16px 15px calc(92px + env(safe-area-inset-bottom));
  }

  .view-section,
  .panel,
  .stat,
  .blueprint-card,
  .connector-card,
  .runs-list {
    min-width: 0;
    max-width: 100%;
  }

  code,
  .field-hint,
  .panel-subtitle,
  .meta-chip,
  .flow-info strong,
  .service-status-item {
    overflow-wrap: anywhere;
    word-break: break-word;
    max-width: 100%;
  }

  /* Stacked topbar: Row 1 = menu + logo + health pill, Row 2 = full-width search */
  .topbar {
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 18px;
  }

  .topbar-left {
    flex: 1 1 auto;
    min-width: 0;
  }

  .top-actions {
    display: contents;
  }

  .health-pill {
    order: 2;
    padding: 7px 11px;
    font-size: 11px;
    min-width: 0;
    max-width: 46vw;
    flex-shrink: 1;
  }

  .health-dot {
    flex-shrink: 0;
  }

  #healthText {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .search-box,
  .search-box:focus-within {
    order: 3;
    flex: 1 1 100%;
    width: 100%;
    padding: 9px 13px;
    border-radius: 12px;
  }

  /* Prevent iOS Safari / mobile browser auto-zoom on focus */
  .text-input,
  .select-input,
  .code-textarea,
  .search-box input,
  .gateway-banner-form input,
  .filter-select {
    font-size: 16px;
  }

  /* Gateway setup banner */
  .gateway-banner {
    flex-direction: column;
    align-items: stretch;
    padding: 14px;
    gap: 12px;
  }

  .gateway-banner-form {
    flex-direction: column;
    align-items: stretch;
  }

  .gateway-banner-form input {
    width: 100%;
  }

  .gateway-banner-form button {
    width: 100%;
    justify-content: center;
    padding: 10px 14px;
  }

  /* Page Intro & CTA buttons */
  .intro,
  .section-header {
    flex-direction: column;
    align-items: stretch;
    gap: 13px;
    margin-bottom: 18px;
  }

  h1 {
    font-size: 26px;
    margin-bottom: 5px;
  }

  .intro p,
  .section-header p {
    font-size: 13px;
    line-height: 1.45;
  }

  .section-header {
    flex-direction: row;
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .intro-actions {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
  }

  .intro-actions > button,
  .intro > .create,
  .intro > .secondary-btn {
    flex: 1 1 auto;
    justify-content: center;
    min-height: 42px;
  }

  .packs-panel {
    margin-bottom: 28px;
  }

  /* Stats & Panels */
  .stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 18px;
  }

  .stat {
    padding: 14px 14px 15px;
    border-radius: 18px 9px 18px 9px;
  }

  .stat:nth-child(even) {
    border-radius: 9px 18px 9px 18px;
  }

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

  .panel,
  .panel.alt-radius {
    padding: 16px 15px;
    border-radius: 20px 11px 20px 11px;
  }

  .usage {
    padding: 17px 16px;
    border-radius: 12px 20px 12px 20px;
  }

  /* Workflow, Connection & API Key rows stack cleanly */
  .workflow-row {
    display: grid;
    grid-template-columns: 38px minmax(0, 1fr) auto;
    align-items: start;
    gap: 10px 11px;
    padding: 15px 0;
  }

  .workflow-row > .flow-info:first-child {
    grid-column: 1 / 3;
  }

  .flow-sub {
    white-space: normal;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    line-height: 1.4;
  }

  .workflow-row .row-actions {
    grid-column: 1 / -1;
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    padding-top: 2px;
  }

  .workflow-row .row-actions > button {
    flex: 1 1 calc(33.333% - 7px);
    min-width: 78px;
    min-height: 36px;
    justify-content: center;
    text-align: center;
  }

  /* Activity / Run rows stack cleanly without clipped timestamps */
  .run-row {
    grid-template-columns: 28px minmax(0, 1fr) auto;
    gap: 6px 10px;
    padding: 12px 13px;
  }

  .run-row .run-time {
    grid-column: 2 / -1;
    font-size: 10.5px;
    color: var(--soft);
  }

  /* Filter bars & scrollable pill tabs */
  .filter-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .pill-tabs {
    display: flex;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .pill-tabs::-webkit-scrollbar {
    display: none;
  }

  .pill-tab {
    flex: 1 0 auto;
    text-align: center;
    white-space: nowrap;
    padding: 8px 12px;
  }

  .filter-select {
    width: 100%;
  }

  /* Cards, Settings & Forms */
  .cards-grid,
  .settings-grid,
  .inline-row-2 {
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
  }

  .inline-action-form {
    flex-direction: column;
    align-items: stretch;
  }

  .inline-action-form button {
    width: 100%;
    justify-content: center;
    min-height: 40px;
  }

  .service-status-item {
    flex-wrap: wrap;
    gap: 6px;
    word-break: break-word;
  }

  /* Auth card mobile comfort */
  .auth-overlay {
    padding: 14px;
    align-items: flex-start;
    overflow-y: auto;
  }

  .auth-card {
    margin: auto 0;
    padding: 24px 18px 22px;
    border-radius: 22px 11px 22px 11px;
  }

  /* Full-screen Workflow Studio & Bottom-sheet Modals on Mobile */
  .modal-backdrop {
    padding: 0;
    align-items: flex-end;
    z-index: 70;
  }

  .modal-card,
  .modal-card.wide {
    width: 100%;
    max-height: 92dvh;
    border-radius: 22px 22px 0 0;
    padding: 20px 16px calc(20px + env(safe-area-inset-bottom));
  }

  .modal-foot {
    flex-direction: column-reverse;
    align-items: stretch;
  }

  .modal-foot > button {
    width: 100%;
    justify-content: center;
    min-height: 42px;
  }

  .canvas-modal {
    width: 100%;
    height: 100dvh;
    max-height: 100dvh;
    border-radius: 0;
  }

  .canvas-head {
    padding: 12px 14px;
    gap: 10px;
  }

  .canvas-title span {
    display: none;
  }

  .canvas-tools {
    width: 100%;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 6px;
  }

  /* Single smooth scroll container in Studio on mobile (no nested scroll trap) */
  .canvas-body {
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .flow-stage {
    overflow: visible;
    flex: none;
    padding: 18px 14px;
  }

  .canvas-side {
    overflow: visible;
    flex: none;
    padding: 18px 14px 24px;
  }

  .canvas-foot {
    padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
  }

  .canvas-foot-note {
    display: none;
  }

  .canvas-foot-actions {
    width: 100%;
    display: grid;
    grid-template-columns: auto 1fr 1.2fr;
    gap: 7px;
  }

  .canvas-foot-actions > button {
    justify-content: center;
    padding: 10px 10px;
    font-size: 11.5px;
  }

  /* Footer & Toast positioning above Mobile Bottom Bar */
  .app-footer {
    text-align: center;
    padding-top: 24px;
    line-height: 1.5;
  }

  .toast {
    left: 14px;
    right: 14px;
    bottom: calc(74px + env(safe-area-inset-bottom));
    text-align: center;
    z-index: 100;
  }

  /* Sticky Mobile Bottom Navigation */
  .mobile-bottom-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 42;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(12px);
    border-top: 1px solid var(--line);
    padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
    box-shadow: 0 -8px 24px rgba(35, 48, 55, 0.06);
  }

  .mobile-nav-item {
    background: transparent;
    color: var(--muted);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 6px 2px;
    border-radius: 10px;
    font-size: 10px;
    font-weight: 700;
  }

  .mobile-nav-item svg {
    width: 19px;
    height: 19px;
  }

  .mobile-nav-item.active {
    color: var(--navy);
    background: var(--sage-2);
  }
}

@media (max-width: 380px) {
  .stats {
    grid-template-columns: minmax(0, 1fr);
  }
  .canvas-foot-actions {
    grid-template-columns: 1fr 1fr;
  }
  .canvas-foot-actions > #testCanvasBtn {
    grid-column: 1 / -1;
  }
}

/* FlowMation Branded Email Designer & Live Preview Modal */
.email-designer-box {
  margin: 10px 0 12px;
  padding: 12px;
  background: linear-gradient(180deg, #fafbf8 0%, #f4f6f1 100%);
  border: 1px solid #dce3d9;
  border-radius: 13px;
}

.email-designer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.email-designer-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 750;
  color: var(--navy);
}

.email-designer-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--navy);
  box-shadow: 0 0 0 3px var(--sage-2);
}

.email-designer-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.email-preview-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--navy);
  color: #ffffff;
  border: none;
  border-radius: 8px;
  padding: 5px 10px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}

.email-preview-btn:hover {
  opacity: 0.92;
}

.email-raw-btn {
  background: #ffffff;
  color: var(--navy);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 5px 9px;
  font-size: 11px;
  font-weight: 650;
  cursor: pointer;
}

.email-raw-btn:hover {
  background: var(--sage-2);
}

.email-preview-modal-card {
  width: min(760px, 95vw);
  max-height: 92vh;
  display: flex;
  flex-direction: column;
}

.email-preview-head-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.email-preview-envelope {
  background: #fafaf8;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 14px;
  margin-bottom: 12px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 6px 14px;
  font-size: 12px;
  color: var(--muted);
}

.email-preview-envelope strong {
  color: var(--navy);
  font-weight: 700;
}

.email-preview-stage {
  background: #eceee9;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
  display: flex;
  justify-content: center;
  overflow: auto;
  flex: 1 1 auto;
  min-height: 360px;
}

.email-preview-frame {
  width: 100%;
  max-width: 640px;
  height: 460px;
  border: 1px solid #dcdad4;
  border-radius: 12px;
  background: #f7f8f5;
  box-shadow: 0 10px 28px rgba(43, 33, 64, 0.08);
  transition: max-width 0.2s ease;
}

.email-preview-frame.is-mobile {
  max-width: 375px;
}

.email-preset-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 10px;
  padding-bottom: 9px;
  border-bottom: 1px dashed #d3dccf;
  flex-wrap: wrap;
}

.email-preset-bar .select-input {
  flex: 1 1 150px;
  min-width: 0;
  padding: 6px 9px;
  font-size: 11.5px;
}

.email-preview-foot {
  flex-wrap: wrap;
  gap: 10px;
}

.email-preview-foot-test {
  display: flex;
  align-items: center;
  gap: 7px;
  flex: 1 1 280px;
}

.email-preview-foot-test .text-input {
  max-width: 240px;
  padding: 7px 10px;
  font-size: 12px;
}

@media (max-width: 640px) {
  .email-preview-head-actions {
    width: 100%;
    justify-content: space-between;
  }
  .email-preview-frame {
    height: 390px;
  }
  .email-preview-foot-test {
    width: 100%;
  }
  .email-preview-foot-test .text-input {
    max-width: none;
    flex: 1 1 auto;
  }
}

/* Multi-Tenant Auth Mode Tabs & Sidebar Workspace Switcher */
.auth-mode-tabs {
  display: flex;
  width: 100%;
  margin: 0 0 16px;
}

.auth-mode-tabs .pill-tab {
  flex: 1 1 50%;
  text-align: center;
  justify-content: center;
}

.workspace-switcher-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 10px;
}

.workspace-switcher-select {
  flex: 1 1 auto;
  min-width: 0;
  appearance: none;
  background-color: rgba(255, 255, 255, 0.08);
  background-image: linear-gradient(45deg, transparent 50%, #dceee1 50%), linear-gradient(135deg, #dceee1 50%, transparent 50%);
  background-position: calc(100% - 14px) 52%, calc(100% - 9px) 52%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  border: 1px solid rgba(185, 215, 195, 0.25);
  color: #f7f8f5;
  border-radius: 9px;
  padding: 7px 26px 7px 10px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow: hidden;
  transition: border-color 0.16s ease, background-color 0.16s ease;
}

.workspace-switcher-select:hover,
.workspace-switcher-select:focus {
  outline: none;
  border-color: rgba(185, 215, 195, 0.52);
  background-color: rgba(255, 255, 255, 0.12);
}

.workspace-switcher-select option {
  background: #2b2140;
  color: #f7f8f5;
}

.workspace-new-btn {
  width: 31px;
  height: 31px;
  flex-shrink: 0;
  border-radius: 9px;
  border: 1px solid rgba(185, 215, 195, 0.28);
  background: rgba(185, 215, 195, 0.12);
  color: #dceee1;
  font-size: 16px;
  font-weight: 600;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color 0.16s ease, border-color 0.16s ease;
}

.workspace-new-btn:hover {
  background: rgba(185, 215, 195, 0.24);
  border-color: rgba(185, 215, 195, 0.55);
}

/* ============================================================
   Docs & orientation view
   ============================================================ */
.docs-hero {
  background: linear-gradient(135deg, #ffffff 0%, #f4f8f4 62%, #f7f1f6 100%);
  border: 1px solid var(--line);
  border-radius: 28px 14px 28px 14px;
  padding: 30px 32px;
  box-shadow: var(--shadow);
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 22px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}

.docs-hero-eyebrow {
  display: inline-block;
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--sage-ink);
  background: var(--sage-2);
  border-radius: 999px;
  padding: 5px 11px;
  margin-bottom: 12px;
}

.docs-hero h1 {
  margin-bottom: 10px;
}

.docs-hero p {
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.6;
  max-width: 560px;
  margin: 0;
}

.docs-hero-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.docs-hero-actions a {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

.docs-layout {
  display: grid;
  grid-template-columns: 236px minmax(0, 1fr);
  gap: 32px;
  align-items: start;
}

/* In-page table of contents */
.docs-toc {
  position: sticky;
  top: 22px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px 10px 18px 10px;
  padding: 16px 14px;
  box-shadow: var(--shadow-sm);
}

.docs-toc-label {
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--soft);
  padding: 0 10px 10px;
}

.docs-toc a {
  display: block;
  font-size: 12px;
  font-weight: 650;
  color: var(--muted);
  text-decoration: none;
  padding: 7px 10px;
  border-radius: 9px;
  border-left: 2px solid transparent;
  transition: color 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}

.docs-toc a:hover {
  color: var(--navy);
  background: var(--paper);
}

.docs-toc a.active {
  color: var(--navy);
  background: var(--sage-2);
  border-left-color: var(--sage-ink);
}

/* Prose content */
.docs-content {
  min-width: 0;
  max-width: 940px;
}

.docs-section {
  scroll-margin-top: 24px;
  margin-bottom: 48px;
}

.docs-section h2 {
  font-size: 21px;
  font-weight: 760;
  letter-spacing: -0.03em;
  color: var(--navy);
  margin: 0 0 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.docs-section h3 {
  font-size: 14.5px;
  font-weight: 750;
  color: var(--navy);
  margin: 26px 0 10px;
}

.docs-section p {
  font-size: 13px;
  line-height: 1.68;
  color: #3a4650;
  margin: 0 0 12px;
}

.docs-section p code,
.docs-list code,
.docs-callout code,
.docs-flow-node code,
.docs-footer-note code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 11px;
  background: #eef4ef;
  color: var(--navy);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 1.5px 6px;
  white-space: nowrap;
}

.docs-list {
  margin: 8px 0 14px;
  padding-left: 20px;
  display: grid;
  gap: 8px;
}

.docs-list li {
  font-size: 12.5px;
  line-height: 1.62;
  color: #3a4650;
}

.docs-content a {
  color: var(--sage-ink);
  font-weight: 700;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

/* Concept & roadmap cards */
.docs-grid {
  display: grid;
  gap: 13px;
  margin: 16px 0;
}

.docs-grid-4 {
  grid-template-columns: repeat(auto-fill, minmax(215px, 1fr));
}

.docs-grid-2 {
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
}

.docs-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px 10px 18px 10px;
  padding: 16px 18px;
  box-shadow: var(--shadow-sm);
}

.docs-card h4 {
  margin: 0 0 7px;
  font-size: 13px;
  font-weight: 760;
  color: var(--navy);
}

.docs-card p {
  font-size: 11.5px;
  line-height: 1.6;
  color: var(--muted);
  margin: 0;
}

.docs-card-planned {
  background: linear-gradient(180deg, #ffffff 0%, #fcf8f2 100%);
}

.docs-phase {
  display: inline-block;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--lavender-ink);
  background: var(--lavender);
  border-radius: 999px;
  padding: 4px 10px;
  margin-bottom: 10px;
}

/* Numbered quickstart / lifecycle steps */
.docs-steps {
  list-style: none;
  counter-reset: docs-step;
  margin: 12px 0 16px;
  padding: 0;
  display: grid;
  gap: 12px;
}

.docs-steps li {
  counter-increment: docs-step;
  position: relative;
  padding-left: 42px;
  font-size: 12.5px;
  line-height: 1.65;
  color: #3a4650;
}

.docs-steps li::before {
  content: counter(docs-step);
  position: absolute;
  left: 0;
  top: 1px;
  width: 27px;
  height: 27px;
  border-radius: 9px 9px 9px 4px;
  background: var(--navy);
  color: #fff;
  font-size: 11.5px;
  font-weight: 800;
  display: grid;
  place-items: center;
}

/* Architecture flow diagram */
.docs-flow {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin: 14px 0;
}

.docs-flow-node {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px 8px 14px 8px;
  padding: 12px 16px;
  min-width: 175px;
  max-width: 285px;
  box-shadow: var(--shadow-sm);
}

.docs-flow-node strong {
  display: block;
  font-size: 12.5px;
  color: var(--navy);
  margin-bottom: 4px;
}

.docs-flow-node span {
  font-size: 11px;
  line-height: 1.5;
  color: var(--muted);
}

.docs-flow-arrow {
  color: var(--soft);
  font-size: 17px;
  font-weight: 700;
}

/* Callouts */
.docs-callout {
  border-radius: 14px 8px 14px 8px;
  padding: 13px 16px;
  margin: 16px 0;
  font-size: 12px;
  line-height: 1.62;
  border-left: 3px solid;
}

.docs-callout strong {
  display: inline-block;
  margin-right: 4px;
}

.docs-callout-info {
  background: var(--sage-2);
  border-color: var(--sage-ink);
  color: #2f5c40;
}

.docs-callout-tip {
  background: var(--lavender);
  border-color: var(--lavender-ink);
  color: var(--lavender-ink);
}

.docs-callout-warn {
  background: var(--sand);
  border-color: var(--sand-ink);
  color: #6f5226;
}

.docs-callout code {
  background: rgba(255, 255, 255, 0.62);
}

/* Reference tables */
.docs-table-wrap {
  border: 1px solid var(--line);
  border-radius: 14px 8px 14px 8px;
  overflow-x: auto;
  margin: 14px 0;
  background: var(--card);
  box-shadow: var(--shadow-sm);
}

.docs-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  min-width: 420px;
}

.docs-table th {
  text-align: left;
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  background: var(--paper);
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
}

.docs-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  color: #3a4650;
  vertical-align: top;
  line-height: 1.55;
}

.docs-table tr:last-child td {
  border-bottom: 0;
}

.docs-table td code,
.docs-table th code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 10.5px;
  background: #eef4ef;
  color: var(--navy);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 1.5px 6px;
  white-space: nowrap;
}

/* Code samples */
.docs-code {
  background: #261d3d;
  border: 1px solid #3a2e58;
  border-radius: 14px 8px 14px 8px;
  margin: 14px 0;
  overflow: hidden;
}

.docs-code-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
}

.docs-code-lang {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #b9d7c3;
}

.docs-copy-btn {
  background: rgba(255, 255, 255, 0.1);
  color: #efeaf8;
  font-size: 10.5px;
  font-weight: 750;
  border-radius: 7px;
  padding: 4px 11px;
  transition: background 0.15s ease;
}

.docs-copy-btn:hover {
  background: rgba(255, 255, 255, 0.2);
}

.docs-code pre {
  margin: 0;
  padding: 14px 16px;
  overflow-x: auto;
}

.docs-code code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 11.5px;
  line-height: 1.65;
  color: #e9e5f3;
  white-space: pre;
}

.docs-footer-note {
  border-top: 1px solid var(--line);
  padding-top: 18px;
  font-size: 11px;
  color: var(--soft);
  line-height: 1.6;
}

/* Docs responsive behavior */
@media (max-width: 1080px) {
  .docs-layout {
    grid-template-columns: 208px minmax(0, 1fr);
    gap: 24px;
  }
}

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

  .docs-toc {
    position: static;
    display: flex;
    align-items: center;
    gap: 6px;
    overflow-x: auto;
    padding: 10px 12px;
    border-radius: 14px;
    scrollbar-width: thin;
  }

  .docs-toc-label {
    padding: 0 6px 0 2px;
    white-space: nowrap;
  }

  .docs-toc a {
    white-space: nowrap;
    border-left: 0;
    border-bottom: 2px solid transparent;
    padding: 6px 10px;
  }

  .docs-toc a.active {
    border-left-color: transparent;
    border-bottom-color: var(--sage-ink);
  }
}

@media (max-width: 768px) {
  .docs-hero {
    padding: 24px 20px;
  }

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

  .docs-section {
    margin-bottom: 40px;
  }
}

@media (max-width: 520px) {
  .docs-grid-4,
  .docs-grid-2 {
    grid-template-columns: minmax(0, 1fr);
  }

  .docs-flow-node {
    max-width: none;
    width: 100%;
  }

  .docs-flow-arrow {
    transform: rotate(90deg);
    margin: 2px auto;
  }
}

/* Phase 2: Dual SaaS Metering, Built-in Senviok Banner & Blueprint Badges */
.usage-divider {
  border-top: 1px solid rgba(255, 255, 255, 0.14);
  margin: 16px 0 14px;
}

.usage-subhead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 5px;
}

.usage-subhead h3 {
  margin: 0;
}

.usage .link-btn {
  color: #cfe8d6;
  font-size: 11px;
  font-weight: 600;
}

.usage .link-btn:hover {
  color: #ffffff;
}

.usage-mode-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 10.5px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 999px;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.usage-mode-pill.mode-byo {
  background: #dceee1;
  color: #1f4a32;
}

.usage-mode-pill.mode-managed {
  background: #f2d8e6;
  color: #4a2340;
}

.usage-mode-pill.mode-none {
  background: rgba(255, 255, 255, 0.16);
  color: #e2e8ea;
}

.settings-grid .usage-mode-pill.mode-none {
  background: #eef0ec;
  color: var(--muted);
}

.managed-msg-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  background: #ffffff;
  border: 1px solid var(--border);
  border-left: 4px solid #b9d7c3;
  border-radius: 14px;
  padding: 15px 18px;
  margin-bottom: 18px;
}

.managed-msg-banner.banner-byo {
  border-left-color: #2f7a4f;
  background: #f7fbf8;
}

.managed-msg-banner.banner-managed {
  border-left-color: #c98fb0;
  background: #fdf9fb;
}

.managed-msg-banner-copy strong {
  display: block;
  font-size: 13px;
  color: var(--navy);
  margin-bottom: 3px;
}

.managed-msg-banner-copy span {
  display: block;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.45;
  max-width: 720px;
}

.senviok-mode-note {
  font-size: 11.5px;
  line-height: 1.45;
  padding: 9px 11px;
  border-radius: 10px;
  margin-bottom: 12px;
  background: #f8f5f9;
  border: 1px solid #eadbe5;
  color: var(--navy);
}

.senviok-mode-note.is-byo {
  background: #f3f9f5;
  border-color: #cfe4d6;
}

.blueprint-cat-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  background: #eef4f0;
  color: #254d36;
  margin-left: auto;
}

.blueprint-cat-badge.cat-africa {
  background: #dceee1;
  color: #1f4a32;
}

.blueprint-cat-badge.cat-indie {
  background: #f2d8e6;
  color: #4a2340;
}

.blueprint-cat-badge.cat-ai {
  background: #eae7f3;
  color: #2b2140;
}

.blueprint-cat-badge.cat-marketing {
  background: #fdeecd;
  color: #5a4a1f;
}

/* Billing plan cards */

.billing-panel {
  margin-bottom: 18px;
}

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

.plan-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 14px;
  margin-top: 6px;
}

.plan-card {
  border: 1px solid var(--line);
  border-radius: 18px 10px 18px 10px;
  padding: 16px 16px 14px;
  background: var(--paper);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.plan-card.plan-card-current {
  border-color: var(--sage-ink);
  background: #f4faf5;
  box-shadow: var(--shadow-sm);
}

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

.plan-name {
  font-weight: 800;
  font-size: 15px;
  color: var(--navy);
  letter-spacing: 0.01em;
}

.plan-current-tag {
  font-size: 10px;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--sage-2);
  color: var(--sage-ink);
  white-space: nowrap;
}

.plan-price {
  font-size: 21px;
  font-weight: 800;
  color: var(--ink);
  letter-spacing: -0.01em;
}

.plan-price-note {
  font-size: 11px;
  color: var(--muted);
  margin-top: -6px;
}

.plan-quota {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.55;
}

.plan-quota::before {
  content: "\2713";
  color: var(--sage-ink);
  font-weight: 800;
  margin-right: 6px;
}

.plan-card .primary-btn,
.plan-card .secondary-btn {
  margin-top: auto;
  width: 100%;
  justify-content: center;
}

.billing-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 14px;
}

.billing-events {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.billing-event-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 11.5px;
  color: var(--muted);
  padding: 5px 10px;
  border: 1px dashed var(--line);
  border-radius: 10px;
}

.billing-event-row code {
  color: var(--navy);
  font-size: 11px;
}


/* ===== Platform admin console ===== */
#adminAuthEmailHistory .admin-event-row,
#adminAuthEmailHistory .admin-event-side {
  flex-wrap: wrap;
}

#adminAuthEmailHistory .admin-event-side {
  white-space: normal;
  gap: 6px;
}

/* Admin data tables need the full content width, not dashboard split columns. */
#view-admin > .panel {
  margin-bottom: 18px;
}

#view-admin .panel {
  min-width: 0;
}

.admin-account-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 18px;
}

.admin-email-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(300px, 0.85fr);
  align-items: start;
  gap: 24px;
}

.admin-email-layout > * {
  min-width: 0;
}

.admin-email-test-form {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 12px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--paper);
}

.admin-email-test-form .field-label,
.admin-email-test-form .field-hint {
  margin: 0;
}

.admin-email-test-form .text-input {
  width: 100%;
  min-width: 0;
}

.admin-email-test-form button {
  align-self: flex-start;
  white-space: nowrap;
}

.admin-email-test-form .field-hint {
  line-height: 1.6;
}

#adminAuthEmailStatus .admin-event-row {
  flex-wrap: wrap;
  gap: 8px 12px;
}

#adminAuthEmailStatus .admin-badge {
  max-width: 100%;
  white-space: normal;
  overflow-wrap: anywhere;
}

#view-admin .admin-table-wrap {
  max-width: 100%;
  overscroll-behavior-x: contain;
}

#view-admin .admin-table-wrap:focus-visible {
  outline: 2px solid var(--sage-ink);
  outline-offset: 3px;
  border-radius: 8px;
}

#adminUserTable {
  min-width: 760px;
}

#adminWorkspaceTable {
  min-width: 960px;
}

#view-admin .admin-table td:first-child,
#adminWorkspaceTable td:nth-child(2) {
  min-width: 160px;
  max-width: 260px;
  overflow-wrap: anywhere;
}

#adminUserTable td:last-child,
#adminUserTable td:nth-child(5),
#view-admin .admin-table button {
  white-space: nowrap;
}

#view-admin .admin-event-row > div {
  min-width: 0;
  overflow-wrap: anywhere;
}

@media (max-width: 1200px) {
  .admin-email-layout {
    grid-template-columns: minmax(0, 1fr);
    gap: 18px;
  }
}

@media (max-width: 540px) {
  .admin-email-test-form {
    padding: 14px;
  }

  .admin-email-test-form button {
    align-self: stretch;
  }
}

.admin-table-wrap {
  overflow-x: auto;
  margin-top: 12px;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.admin-table th {
  text-align: left;
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--soft);
  font-weight: 600;
  padding: 6px 10px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

.admin-table td {
  padding: 9px 10px;
  border-bottom: 1px dashed var(--line);
  vertical-align: top;
  color: var(--muted);
}

.admin-table tbody tr:hover {
  background: var(--paper);
}

.admin-row-suspended {
  background: #fdf3ef;
}

.admin-cell-strong {
  color: var(--ink);
  font-weight: 600;
  font-size: 12px;
}

.admin-cell-sub {
  color: var(--soft);
  font-size: 10.5px;
  margin-top: 2px;
}

.admin-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 600;
  text-transform: capitalize;
  white-space: nowrap;
}

.badge-ok {
  background: var(--sage-2);
  color: var(--sage-ink);
}

.badge-danger {
  background: var(--coral-2);
  color: var(--coral-ink);
}

.badge-plan {
  background: var(--lavender);
  color: var(--lavender-ink);
}

.badge-muted {
  background: var(--paper);
  color: var(--muted);
  border: 1px solid var(--line);
}

.admin-actions {
  white-space: nowrap;
}

.admin-actions .mini-btn {
  margin: 0 4px 4px 0;
}

.mini-btn {
  border: 1px solid var(--line-strong);
  background: var(--card);
  color: var(--navy);
  font-size: 10.5px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.mini-btn:hover {
  border-color: var(--navy);
  color: var(--navy-2);
}

.mini-btn-danger {
  color: var(--coral-ink);
  border-color: var(--coral);
}

.mini-btn-danger:hover {
  background: var(--coral-2);
  border-color: var(--coral-ink);
  color: var(--coral-ink);
}

.mini-btn-good {
  color: var(--sage-ink);
  border-color: var(--sage);
}

.mini-btn-good:hover {
  background: var(--sage-2);
  border-color: var(--sage-ink);
  color: var(--sage-ink);
}

.admin-empty {
  color: var(--soft);
  font-size: 11.5px;
  padding: 16px 10px;
  text-align: center;
}

.admin-events {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
}

.admin-event-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border: 1px dashed var(--line);
  border-radius: 10px;
}

.admin-event-side {
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

/* ===== Workspace suspension banner ===== */
.suspension-banner {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: var(--coral-2);
  color: var(--coral-ink);
  border: 1px solid var(--coral);
  border-radius: 12px;
  padding: 10px 14px;
  font-size: 12.5px;
  line-height: 1.5;
  margin-bottom: 16px;
}

.suspension-banner svg {
  flex: 0 0 auto;
  margin-top: 2px;
}

.auth-account-banner {
  margin-bottom: 16px;
  border: 1px solid #d8e6db;
  background: #f4faf5;
  color: var(--sage-ink);
  border-radius: 12px;
  padding: 10px 13px;
  font-size: 12px;
  line-height: 1.45;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.auth-account-banner strong,
.auth-account-banner span {
  display: block;
}

.auth-account-banner span {
  color: var(--muted);
  margin-top: 2px;
}

/* ===== Brand mark system (outbound node) ===== */

.fm-logo {
  display: block;
  flex-shrink: 0;
}

.fm-logo-live .logo-ring {
  transform-box: fill-box;
  transform-origin: center;
  animation: fm-ring-pulse 1.6s ease-in-out infinite;
}

.fm-logo-live .logo-line {
  stroke-dasharray: 64;
  animation: fm-line-out 1.6s ease-in-out infinite;
}

@keyframes fm-ring-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.14); }
}

@keyframes fm-line-out {
  0% { stroke-dashoffset: 64; opacity: 1; }
  45% { stroke-dashoffset: 0; opacity: 1; }
  78%, 100% { stroke-dashoffset: 0; opacity: 0; }
}

/* ===== Opening splash ===== */

.boot-splash-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 650;
}

/* ===== Auth split screen ===== */

.auth-shell {
  display: flex;
  flex-direction: column;
  width: min(980px, 100%);
  max-height: calc(100vh - 40px);
  overflow: auto;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 26px 12px 26px 12px;
  box-shadow: 0 24px 64px rgba(43, 33, 64, 0.08);
}

.auth-brand-panel {
  background: var(--navy);
  color: #eef3ee;
  padding: 26px 24px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-height: 176px;
}

.auth-brand-panel .auth-tagline {
  margin-top: auto;
  font-size: 12px;
  font-weight: 650;
  color: #b9c4c9;
  letter-spacing: -0.01em;
}

.auth-run-feed {
  display: grid;
  gap: 8px;
}

.auth-run-feed .feed-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 13px;
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.09);
  font-size: 11.5px;
  color: #dfe6ea;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.auth-run-feed .feed-row em {
  font-style: normal;
  color: var(--sage);
  font-weight: 700;
  white-space: nowrap;
}

@media (prefers-reduced-motion: no-preference) {
  .auth-run-feed .feed-row {
    opacity: 0;
    animation: feed-row 9s ease infinite both;
  }

  .auth-run-feed .feed-row:nth-child(1) { animation-delay: 0s; }
  .auth-run-feed .feed-row:nth-child(2) { animation-delay: 0.55s; }
  .auth-run-feed .feed-row:nth-child(3) { animation-delay: 1.1s; }
  .auth-run-feed .feed-row:nth-child(4) { animation-delay: 1.65s; }
}

@keyframes feed-row {
  0% { opacity: 0; transform: translateY(9px); }
  8% { opacity: 1; transform: translateY(0); }
  80% { opacity: 1; transform: translateY(0); }
  92%, 100% { opacity: 0; transform: translateY(-6px); }
}

@media (prefers-reduced-motion: reduce) {
  .auth-run-feed .feed-row {
    opacity: 1;
    animation: none;
    transform: none;
  }
}

@media (min-width: 901px) {
  /* Let the page scroll instead of the card: a height-capped shell with a
     centred, scrolling card clips the top of the form and cannot scroll back
     to it. Auto cross-axis margins still centre the shell when it fits. */
  .auth-overlay {
    overflow-y: auto;
  }

  .auth-shell {
    flex-direction: row;
    margin: auto;
    max-height: none;
    overflow: hidden; /* clips the two panels to the rounded corners; nothing is cut off because the shell has no height cap */
  }

  .auth-brand-panel {
    width: 44%;
    padding: 40px 34px;
    gap: 26px;
  }

  .auth-card {
    width: 56%;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    overflow: visible;
  }
}

.auth-card {
  padding: 28px 26px 22px;
}

@media (min-width: 901px) {
  .auth-card {
    padding: 40px 38px 28px;
    display: flex;
    flex-direction: column;
    justify-content: center;
  }
}

/* ===== Signed out receipt ===== */

.signout-receipt {
  width: min(420px, 100%);
  padding: 28px 20px;
  background-color: var(--paper);
  background-image: radial-gradient(var(--line-strong) 1px, transparent 1px);
  background-size: 18px 18px;
  border: 1px solid var(--line);
  border-radius: 26px 12px 26px 12px;
  box-shadow: 0 24px 64px rgba(43, 33, 64, 0.08);
}

.signout-receipt .receipt-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius, 28px 14px 28px 14px);
  padding: 26px 24px;
  box-shadow: var(--shadow);
}

.signout-receipt .receipt-rows {
  display: grid;
  gap: 8px;
  margin: 16px 0 20px;
}

.signout-receipt .receipt-line {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 12px;
  border: 1px dashed var(--line-strong);
  border-radius: 11px;
  font-size: 12px;
  color: var(--muted);
}

.signout-receipt .receipt-line strong {
  color: var(--sage-ink);
  font-weight: 700;
}

.signout-receipt .receipt-stamp {
  display: table;
  margin: 0 auto 22px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.18em;
  color: var(--sage-ink);
  border: 2px solid var(--sage-ink);
  border-radius: 10px 5px 12px 5px;
  padding: 6px 14px;
  transform: rotate(-4deg);
  background: rgba(220, 238, 225, 0.55);
}

/* ===== Loading system ===== */

.top-progress {
  display: none;
  position: sticky;
  top: 0;
  z-index: 30;
  height: 3px;
  width: 100%;
  margin: 0 0 12px;
  overflow: hidden;
  background: transparent;
}

html.data-loading .top-progress {
  display: block;
}

.top-progress::before {
  content: "";
  display: block;
  height: 100%;
  width: 38%;
  border-radius: 99px;
  background: var(--sage-ink);
}

@media (prefers-reduced-motion: no-preference) {
  html.data-loading .top-progress::before {
    animation: top-progress 1.1s ease-in-out infinite;
  }
}

@keyframes top-progress {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(320%); }
}

.skeleton-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 15px 12px;
  border-bottom: 1px dashed var(--line);
}

.skeleton-bar {
  height: 10px;
  border-radius: 99px;
  background: var(--line);
  flex-shrink: 0;
}

.skeleton-bar.w-10 { width: 10%; }
.skeleton-bar.w-12 { width: 12%; }
.skeleton-bar.w-15 { width: 15%; }
.skeleton-bar.w-30 { width: 30%; }
.skeleton-bar.w-35 { width: 35%; }

@media (prefers-reduced-motion: no-preference) {
  .skeleton-bar {
    background: linear-gradient(90deg, var(--line) 25%, var(--paper-2, #eef1ec) 50%, var(--line) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.3s linear infinite;
  }
}

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

html.data-loading .stat-value,
html.data-loading .stat-meta {
  color: transparent;
  background: var(--line);
  border-radius: 6px;
  user-select: none;
}

@media (prefers-reduced-motion: no-preference) {
  html.data-loading .stat-value,
  html.data-loading .stat-meta {
    background: linear-gradient(90deg, var(--line) 25%, var(--paper-2, #eef1ec) 50%, var(--line) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.3s linear infinite;
  }
}

html.data-loading .stat-value {
  min-height: 30px;
}

/* Button loading dots (label stays, width pinned by JS) */

.btn-dots {
  display: none;
  align-items: center;
  gap: 4px;
  margin-left: 2px;
}

.btn-dots i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.75;
}

.is-loading .btn-dots {
  display: inline-flex;
}

@media (prefers-reduced-motion: no-preference) {
  .btn-dots i {
    animation: dot-hop 0.9s ease-in-out infinite;
  }

  .btn-dots i:nth-child(2) { animation-delay: 0.12s; }
  .btn-dots i:nth-child(3) { animation-delay: 0.24s; }
}

@keyframes dot-hop {
  0%, 60%, 100% { transform: translateY(0); }
  30% { transform: translateY(-4px); }
}

.is-loading {
  cursor: progress;
  pointer-events: none;
}

/* Success toast check draw */

.toast .check-draw {
  flex-shrink: 0;
  margin-right: 2px;
}

.toast .check-draw path {
  stroke-dasharray: 24;
  stroke-dashoffset: 24;
}

@media (prefers-reduced-motion: no-preference) {
  .toast .check-draw path {
    animation: draw-check 0.45s 0.05s ease forwards;
  }
}

@media (prefers-reduced-motion: reduce) {
  .toast .check-draw path {
    stroke-dashoffset: 0;
  }
}

@keyframes draw-check {
  to { stroke-dashoffset: 0; }
}

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

/* ===== Gateway unreachable state ===== */

.gateway-banner {
  display: none;
  background: transparent;
  border: 0;
  border-radius: 0;
  padding: 0;
  box-shadow: none;
}

.gateway-banner.visible {
  display: block;
  margin-bottom: 18px;
}

.gateway-state {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius, 28px 14px 28px 14px);
  box-shadow: var(--shadow);
  padding: 34px 30px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.gateway-state h2 {
  font-size: 20px;
  color: var(--navy);
  margin: 8px 0 0;
  letter-spacing: -0.02em;
}

.gateway-state > p {
  max-width: 460px;
  color: var(--muted);
  font-size: 12.5px;
  margin: 0;
}

.gateway-state .gw-retry-note {
  color: var(--soft);
  font-size: 11.5px;
  font-weight: 650;
}

.gateway-state .btn-row {
  justify-content: center;
}

.gateway-state-fix {
  margin-top: 14px;
  padding-top: 16px;
  border-top: 1px dashed var(--line-strong);
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: center;
  font-size: 11.5px;
  color: var(--soft);
}

.gateway-state-fix .gateway-banner-form {
  display: flex;
  gap: 8px;
  width: min(420px, 100%);
}

.gateway-state-fix .gateway-banner-form input {
  flex: 1;
}

/* Reduced motion global fallback */

@media (prefers-reduced-motion: reduce) {
  .fm-logo-live .logo-ring,
  .fm-logo-live .logo-line {
    animation: none;
  }

  .fm-logo-live .logo-line {
    stroke-dashoffset: 0;
    opacity: 1;
  }
}

/* Health pill as a quiet status indicator for non-operators */

.health-pill[aria-disabled="true"] {
  cursor: default;
  pointer-events: none;
  opacity: 1;
}

/* Ambient connection lines (brand motif) */

.auth-brand-panel {
  position: relative;
  overflow: hidden;
}

.auth-lines {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}

.auth-brand-panel > .fm-logo,
.auth-brand-panel > .auth-run-feed,
.auth-brand-panel > .auth-tagline {
  position: relative;
  z-index: 1;
}

@media (prefers-reduced-motion: no-preference) {
  .auth-lines .al-path {
    stroke-dasharray: 12 18;
    animation: line-drift 7s linear infinite;
  }

  .auth-lines .al-path-2 {
    animation-duration: 9s;
    animation-direction: reverse;
  }

  .auth-lines .al-path-3 {
    animation-duration: 11s;
  }
}

@keyframes line-drift {
  to {
    stroke-dashoffset: -60;
  }
}

/* Brand logo tiles in the studio */

.flow-node .node-symbol.has-logo {
  background: #ffffff;
  border: 1px solid var(--line);
  color: initial;
}

/* Drawn step icons and brand marks in tiles and chips */

.node-symbol svg,
.connector-badge svg {
  display: block;
}

.connector-badge.has-logo {
  background: #ffffff;
  border: 1px solid var(--line);
  color: initial;
}

.add-step-chip svg {
  display: inline-block;
  vertical-align: -3px;
  margin-right: 4px;
}

/* Ticket canvas mount inside the workflow editor (guided stage): edge to
   edge in the left pane. No inner frame of its own, so wires reach the pane
   edges instead of being clipped by a bordered box. */
.ticket-canvas-mount {
  width: 100%;
  height: 100%;
  border: 0;
  border-radius: 0;
  overflow: hidden;
}
.flow-stack.ticket-canvas-mount {
  width: 100%;
  margin: 0;
  display: block;
}
#canvasGuidedStage {
  padding: 0;
  overflow: hidden;
}

/* Regional settings, team access, and audit controls. */
.workspace-control-panel { margin-bottom: 18px; min-width: 0; }
.regional-fields { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.team-invite-form { display: flex; gap: 12px; align-items: end; flex-wrap: wrap; margin: 20px 0; }
.team-invite-form .field-group { flex: 1 1 180px; margin: 0; }
#workspaceSeatMeter { width: 100%; height: 16px; accent-color: var(--sage-ink); }
#workspaceTeamPanel .admin-table { min-width: 560px; }
#workspaceTeamPanel .admin-table td { overflow-wrap: anywhere; }
#workspaceTeamPanel .admin-table button { white-space: nowrap; }
#workspaceTeamPanel .admin-event-row, #workspaceAuditRows .admin-event-row { flex-wrap: wrap; }
[data-role-locked="true"] { opacity: 0.5; cursor: not-allowed; }
@media (max-width: 960px) { .regional-fields { grid-template-columns: minmax(0, 1fr); gap: 0; } }

/* Workspace operations and supervised execution */
.inbox-tabs { display: flex; gap: 8px; margin: 24px 0 18px; flex-wrap: wrap; }
.inbox-tabs button { border: 1px solid var(--line); border-radius: 24px; background: var(--surface, #fff); color: var(--muted); padding: 12px 18px; font: inherit; font-weight: 650; cursor: pointer; min-height: 44px; }
.inbox-tabs button.active { background: #e8efe7; border-color: #aec3ab; color: #304936; }
.inbox-tabs button:focus-visible, .inbox-card button:focus-visible { outline: 3px solid #9ebd99; outline-offset: 3px; }
.inbox-items { display: grid; gap: 18px; min-width: 0; }
.inbox-card, .inbox-empty { padding: 24px; min-width: 0; }
.inbox-card h3, .inbox-empty h3 { margin: 0 0 8px; font-size: 17px; color: var(--navy); }
.inbox-card p, .inbox-empty p { font-size: 13px; line-height: 1.65; overflow-wrap: anywhere; }
.inbox-card-heading, .supervised-banner { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
.supervised-banner { background: #edf2e9; border: 1px solid #cbd9c6; color: #344c38; padding: 16px 20px; border-radius: 12px; margin: 16px 0; font-size: 13px; }
.supervised-banner p { margin: 5px 0 0; line-height: 1.5; }
.canvas-modal > .supervised-banner { margin: 10px 20px; flex-shrink: 0; }
.inbox-guidance, .inbox-message { background: #f4f0f7; border: 1px solid #ddd3e6; color: #503862; padding: 14px 16px; border-radius: 10px; font-size: 13px; line-height: 1.65; }
.inbox-guidance p { margin: 4px 0 0; }
.inbox-request { border: 1px solid var(--line); border-radius: 10px; margin: 10px 0; padding: 12px; min-width: 0; }
.inbox-request summary { cursor: pointer; overflow-wrap: anywhere; font-size: 12px; line-height: 1.6; }
.inbox-request .json-box { max-height: 360px; white-space: pre-wrap; overflow-wrap: anywhere; margin-bottom: 0; }
.inbox-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.inbox-actions button { min-height: 44px; }
.inbox-protected { padding-left: 20px; font-size: 12px; line-height: 1.9; color: #3b6042; overflow-wrap: anywhere; }
.protected-label { display: block; color: #3b6042; font-size: 12px; margin-top: 5px; }
.inbox-empty { text-align: center; padding: 42px 24px; }
.policy-toggle { display: flex; align-items: flex-start; gap: 12px; margin: 18px 0; cursor: pointer; font-size: 14px; }
.policy-toggle input { width: 20px; height: 20px; accent-color: #6f8d69; flex-shrink: 0; }
.policy-toggle small { display: block; margin-top: 6px; color: var(--muted); font-size: 12px; line-height: 1.7; }
.inbox-mobile-count { position: absolute; top: 2px; right: 6px; background: #503862; color: #fff; min-width: 16px; padding: 1px 4px; border-radius: 12px; font-size: 9px; }
@media (max-width: 768px) {
  .mobile-bottom-nav { grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); }
  .mobile-nav-item { position: relative; min-width: 0; font-size: 9px; }
  .inbox-card, .inbox-empty { padding: 18px; }
  .inbox-card-heading, .supervised-banner { flex-direction: column; gap: 10px; }
  .inbox-tabs { gap: 6px; }
  .inbox-tabs button { padding: 10px 12px; font-size: 11px; }
  .inbox-actions button { flex: 1 1 180px; }
}

/* Collection operations use the workspace brand, without adding mobile tabs. */
.payment-overview, .getting-started, .collections-toolbar, .payment-guide { padding:24px; margin-bottom:24px; }
.collections-heading { display:flex; align-items:center; justify-content:space-between; gap:16px; flex-wrap:wrap; }
.collections-heading p { color:var(--muted); margin:8px 0; }
.collections-heading h2, .collection-case h3 { margin:0; }
.collection-totals, .collections-grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(min(100%,300px),1fr)); gap:16px; }
.payment-total { padding:20px; background:var(--card); border:1px solid var(--line); border-radius:25px 11px 25px 11px; box-shadow:var(--shadow-sm); margin:16px 0; }
.collection-totals .payment-total:nth-child(even) { border-radius:11px 25px 11px 25px; }
.payment-total-head { display:flex; align-items:center; justify-content:space-between; gap:10px; flex-wrap:wrap; }
.payment-total-head h3 { margin:0; font-size:12px; font-weight:750; letter-spacing:0.08em; color:var(--sage-ink); background:var(--sage-2); border-radius:999px; padding:5px 12px; }
.payment-total-head small { color:var(--muted); font-size:11px; font-weight:600; overflow-wrap:anywhere; }
.payment-total-figures { display:grid; grid-template-columns:repeat(auto-fit,minmax(min(100%,170px),1fr)); gap:14px; margin-top:18px; }
.payment-total-figure p { color:var(--muted); font-size:11px; font-weight:650; margin:0 0 6px; }
.payment-total-figure strong { display:block; font-size:16px; color:var(--sage-ink); overflow-wrap:anywhere; }
.payment-total-figure.is-open strong { font-size:24px; color:var(--navy); }
.getting-started .gs-progress { height:6px; border-radius:999px; background:var(--line); overflow:hidden; margin:14px 0 4px; }
.getting-started .gs-progress span { display:block; height:100%; width:0; background:var(--sage-ink); border-radius:999px; transition:width .25s ease; }
.getting-started .gs-list { list-style:none; margin:12px 0 0; padding:0; display:grid; gap:10px; }
.gs-item { display:flex; align-items:center; gap:12px; padding:12px 14px; border:1px solid var(--line); border-radius:14px; background:var(--card); }
.gs-check { width:22px; height:22px; border-radius:50%; flex-shrink:0; display:grid; place-items:center; background:var(--line); color:#fff; }
.gs-item.done .gs-check { background:var(--sage-ink); }
.gs-item.done .gs-label { color:var(--muted); }
.gs-body { flex:1; min-width:0; }
.gs-label { font-size:13px; font-weight:650; color:var(--navy); }
.gs-hint { font-size:12px; color:var(--muted); margin-top:2px; }
.gs-actions { display:flex; gap:8px; flex-wrap:wrap; justify-content:flex-end; align-items:center; }
.gs-done-tag { font-size:11px; font-weight:700; color:var(--sage-ink); background:var(--sage-2); border-radius:999px; padding:4px 10px; }
@media(max-width:640px) { .gs-item { flex-direction:column; align-items:flex-start; } .gs-actions { justify-content:flex-start; } }
.collection-case { padding:22px; min-width:0; }
.collection-amounts { display:flex; flex-wrap:wrap; gap:18px; margin:20px 0; }
.collection-amounts small, .collection-amounts strong { display:block; }
.collection-amounts small { color:var(--muted); margin-bottom:5px; }
.collection-amounts strong, .payment-keys { overflow-wrap:anywhere; }
.collection-filters { display:flex; flex-wrap:wrap; gap:6px; margin-bottom:16px; }
.collection-filters .active { background:#e6efe5; color:#315b3b; box-shadow:inset 0 0 0 1px #9bb79e; }
.payment-status { text-transform:capitalize; }
.payment-status.partial { background:#fff2d8; color:#79551b; }
.payment-status.paid { background:#e6efe5; color:#315b3b; }
.payment-status.overpaid { background:#eee8f4; color:#49345e; }
.payment-dialog { border:1px solid #d9d4df; border-radius:20px; padding:28px; width:min(680px,calc(100% - 24px)); max-height:90dvh; overflow:auto; color:#2b2140; background:#fcfbf8; }
.payment-dialog::backdrop { background:rgba(35,24,49,.45); }
.payment-dialog[open] { display:block; }
.payment-detail-drawer { margin:0 0 0 auto; height:100dvh; max-height:100dvh; border-radius:20px 0 0 20px; }
.payment-form-grid, .payment-resolution-fields { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:16px; margin:20px 0; }
.payment-form-grid label, .payment-resolution-fields label { display:grid; gap:7px; font-size:13px; }
.payment-detail-keys { display:grid; grid-template-columns:120px 1fr; gap:12px; margin:22px 0; }
.payment-detail-keys dd { margin:0; overflow-wrap:anywhere; }
.payment-timeline { padding-left:24px; }
.payment-timeline li { padding:8px 0 18px 10px; border-left:2px solid #b9d7c3; overflow-wrap:anywhere; }
.payment-timeline p { margin:7px 0; }
#collectionsMore { margin-top:20px; }
#paymentCaseError { color:#9b3030; }
@media(max-width:640px) { .payment-form-grid, .payment-resolution-fields { grid-template-columns:1fr; } .payment-overview, .collections-toolbar, .collection-case { padding:18px; } .payment-dialog { padding:20px; } .payment-detail-keys { grid-template-columns:1fr; gap:5px; } .payment-detail-keys dd { margin-bottom:10px; } .inbox-tabs { overflow-x:auto; } }

/* Customer communication and prepaid credit controls. */
.communication-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; align-items: end; margin: 16px 0; }
.communication-fields label { display: grid; gap: 7px; font-size: 12px; color: var(--navy); }
.credit-summary { background: #f1f6ef; color: #30233f; border: 1px solid #d3e3d1; border-radius: 12px; padding: 16px; margin-bottom: 14px; }
.suppression-list { list-style: none; padding: 0; margin: 12px 0; }
.suppression-list li { display: flex; align-items: center; justify-content: space-between; gap: 12px; border-bottom: 1px solid #e8e2db; padding: 14px 0; overflow-wrap: anywhere; }
.suppression-list li > div { min-width: 0; }
.followup-fields { padding: 14px; border: 1px solid #d3e3d1; border-radius: 12px; background: #f7f8f3; margin: 14px 0; }
.followup-fields label { display: grid; gap: 6px; margin-top: 10px; }
.followup-fields label.policy-toggle { display: flex; }
.topup-grid { margin-bottom: 16px; }
@media (max-width: 600px) { .communication-fields { grid-template-columns: 1fr; } .suppression-list li { align-items: flex-start; flex-direction: column; } .billing-header-actions { flex-wrap: wrap; } }

/* Customer receipts are isolated from workspace and authentication chrome. */
html.receipt-mode body { min-width: 0; background: #f5f3ed; color: #30263e; }
html.receipt-mode body > :not(#publicReceipt):not(script) { display: none !important; }
.public-receipt { max-width: 760px; margin: 0 auto; padding: 32px 18px; }
.receipt-card { background: #fffefa; border: 1px solid #dddcd1; border-radius: 20px; padding: 32px; overflow-wrap: anywhere; box-shadow: 0 12px 40px #30263e0a; }
.receipt-card header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 24px; }
.receipt-card header p, .receipt-zone { font-size: 13px; color: #645c6b; }
.receipt-card h1 { font-size: clamp(23px, 5vw, 32px); line-height: 1.2; margin-bottom: 12px; }
.receipt-card h2 { font-size: 19px; margin: 20px 0 12px; }
.receipt-card p { line-height: 1.6; margin: 8px 0; }
.receipt-languages, .receipt-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.receipt-card button { min-height: 44px; padding: 10px 16px; border: 1px solid #c7cbbd; border-radius: 10px; color: #30263e; background: #f2f3ec; }
.receipt-languages button[aria-pressed="true"] { background: #30263e; color: #fffefa; }
.receipt-card button:disabled { opacity: .6; cursor: wait; }
.receipt-card button:focus-visible, .receipt-card a:focus-visible { outline: 3px solid #5d8060; outline-offset: 3px; }
.receipt-status { display: inline-block; padding: 7px 12px; border-radius: 24px; margin-top: 8px; font-weight: 650; background: #efeadb; }
.receipt-status-partial { background: #e5ebda; }
.receipt-status-paid { background: #dceadc; color: #23482c; }
.receipt-status-overpaid { background: #e7deed; }
.receipt-status-cancelled { background: #eee5e2; }
.receipt-amounts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin: 26px 0 20px; }
.receipt-amounts > div { padding: 16px 12px; background: #f1f2e9; border-radius: 12px; }
.receipt-amounts dt { font-size: 13px; margin-bottom: 8px; }
.receipt-amounts dd { font-size: clamp(18px, 3vw, 24px); font-weight: 700; margin: 0; }
.receipt-progress { height: 10px; border-radius: 8px; overflow: hidden; background: #e6e8dd; }
.receipt-progress span { display: block; height: 100%; background: #638566; }
.receipt-progress-label { font-size: 13px; text-align: right; }
.receipt-details { display: grid; grid-template-columns: minmax(100px, 1fr) minmax(0, 2fr); gap: 10px 16px; margin: 28px 0 12px; }
.receipt-details dt { color: #645c6b; }
.receipt-details dd { margin: 0; }
.receipt-payments { list-style: none; padding: 0; margin: 0 0 24px; }
.receipt-payments li { border-top: 1px solid #e6e5dc; padding: 16px 0; }
.receipt-payments time { color: #645c6b; font-size: 13px; }
.receipt-branding { text-align: center; margin-top: 28px; font-size: 13px; }
.receipt-branding a { color: #476a4b; }
.public-link-controls { border: 1px solid var(--border); border-radius: 12px; padding: 16px; margin: 20px 0; overflow-wrap: anywhere; }
.public-link-controls .inbox-actions { margin-top: 12px; }
@media (max-width: 480px) {
  .public-receipt { padding: 16px 10px; }
  .receipt-card { padding: 20px 16px; border-radius: 16px; }
  .receipt-amounts { grid-template-columns: 1fr; }
  .receipt-amounts > div { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
  .receipt-amounts dt { margin: 0; }
  .receipt-details { grid-template-columns: minmax(85px, 1fr) minmax(0, 2fr); gap: 10px; }
}
@media print {
  html.receipt-mode body { background: white; }
  html.receipt-mode .public-receipt { max-width: none; padding: 0; }
  html.receipt-mode .receipt-card { border: 0; box-shadow: none; padding: 0; }
  html.receipt-mode .receipt-actions, html.receipt-mode .receipt-languages, html.receipt-mode [role="status"] { display: none !important; }
  html.receipt-mode .receipt-payments li, html.receipt-mode .receipt-amounts { break-inside: avoid; }
  html.receipt-mode a[href]::after { content: none; }
}

/* Telegram Assistant */
.telegram-assistant-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-top: 12px;
}
.telegram-pair-command {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin: 14px 0 8px;
}
.telegram-pair-command code {
  background: #f4f7f2;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 12px;
  font-size: 12px;
  overflow-wrap: anywhere;
}
.telegram-assistant-toggles {
  display: grid;
  gap: 10px;
  margin: 14px 0 18px;
}
.telegram-admin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}
.telegram-webhook-form {
  display: grid;
  gap: 8px;
  align-items: start;
}
.telegram-webhook-form .primary-btn {
  justify-self: start;
}

/* In-app assistant (phase 1 web channel) */
.assistant-panels,
#view-assistant .section-header {
  max-width: 880px;
}
.assistant-panels {
  display: grid;
  gap: 16px;
}
.assistant-status-off {
  background: var(--line);
  color: var(--muted);
}
.assistant-provider-notice {
  margin: 12px 0;
  padding-left: 20px;
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.55;
}
.assistant-provider-notice li + li {
  margin-top: 5px;
}
.assistant-provider-notice code {
  color: var(--navy);
  font-size: 12px;
  overflow-wrap: anywhere;
}
.assistant-empty-state {
  padding: 20px;
  border: 1px dashed var(--line-strong);
  border-radius: 12px;
  background: var(--paper);
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}
.assistant-examples {
  display: grid;
  gap: 12px;
}
.assistant-example-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.assistant-example-actions button {
  text-align: left;
  line-height: 1.5;
}
.assistant-accept {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  margin: 10px 0;
  font-size: 13px;
}
.assistant-notice-actions {
  display: flex;
  gap: 10px;
}
.assistant-chat-panel {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.assistant-chat-log {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 420px;
  overflow-y: auto;
  padding: 4px;
}
.assistant-bubble {
  max-width: 85%;
  padding: 8px 12px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}
.assistant-bubble-user {
  align-self: flex-end;
  background: var(--navy);
  color: #fff;
}
.assistant-bubble-bot {
  align-self: flex-start;
  background: rgba(127, 127, 127, 0.12);
}
.assistant-bubble-bot .assistant-paragraph {
  margin: 0 0 6px;
}
.assistant-bubble-bot .assistant-paragraph:last-child {
  margin-bottom: 0;
}
.assistant-bubble-bot .assistant-list {
  margin: 0 0 6px;
  padding-left: 18px;
}
.assistant-bubble-bot code {
  background: rgba(127, 127, 127, 0.18);
  padding: 1px 4px;
  border-radius: 4px;
  font-size: 12.5px;
}
.assistant-chat-form {
  display: flex;
  gap: 8px;
}
.assistant-chat-form .text-input {
  flex: 1;
  min-width: 0;
}
.assistant-chat-form button {
  flex-shrink: 0;
}
.assistant-chat-panel > .field-hint {
  margin: 0;
}
.assistant-summary-row {
  font-size: 13px;
  margin: 2px 0;
}
.assistant-action-card {
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: var(--paper);
  color: var(--ink);
  margin-top: 12px;
  padding: 14px;
}
.assistant-action-title {
  color: var(--navy);
  font-size: 15px;
  margin: 0 0 10px;
}
.assistant-action-lines {
  margin: 0;
}
.assistant-action-line {
  display: grid;
  gap: 4px;
  margin: 7px 0;
}
.assistant-action-line dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}
.assistant-action-line dd {
  margin: 0;
  overflow-wrap: anywhere;
}
.assistant-action-note,
.assistant-action-expiry,
.assistant-action-result {
  font-size: 12px;
  line-height: 1.5;
  margin: 10px 0 0;
}
.assistant-action-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}
.assistant-action-buttons button {
  margin-top: 0;
}
.assistant-action-result:focus {
  outline: 2px solid var(--sage-ink);
  outline-offset: 3px;
}
.assistant-draft-panel .primary-btn {
  margin-top: 8px;
}

/* U1 floating assistant: the C mini-workflow mark, its dock and side panel. */
.assistant-settings-panel {
  scroll-margin-top: 20px;
}
.assistant-settings-notice h3 {
  color: var(--navy);
  font-size: 14px;
  margin: 14px 0 0;
}
.assistant-shortcut-help {
  margin: 14px 0 0;
}
.assistant-shortcut-help kbd {
  border: 1px solid var(--line-strong);
  border-bottom-width: 2px;
  border-radius: 5px;
  background: var(--paper);
  color: var(--navy);
  font-family: inherit;
  font-size: 11px;
  font-weight: 700;
  padding: 1px 5px;
}
.assistant-floating-button {
  position: fixed;
  z-index: 64;
  bottom: 24px;
  width: 56px;
  height: 56px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  cursor: grab;
  touch-action: none;
  filter: drop-shadow(0 8px 14px rgba(43, 33, 64, 0.28));
  transition: transform 160ms ease, filter 160ms ease, left 180ms ease, right 180ms ease;
}
.assistant-floating-button.dock-right { right: 24px; left: auto; }
.assistant-floating-button.dock-left { left: 24px; right: auto; }
.assistant-floating-button:hover,
.assistant-floating-button:focus-visible {
  transform: translateY(-2px) scale(1.04);
  filter: drop-shadow(0 10px 18px rgba(43, 33, 64, 0.35));
  outline: none;
}
.assistant-floating-button:focus-visible .assistant-flow-mark {
  outline: 3px solid var(--sage-ink);
  outline-offset: 3px;
  border-radius: 50%;
}
.assistant-floating-button.is-dragging {
  cursor: grabbing;
  transition: none;
}
.assistant-floating-button.is-off .assistant-flow-mark { opacity: 0.58; }
.assistant-flow-mark {
  display: block;
  width: 56px;
  height: 56px;
  overflow: visible;
}
.assistant-flow-trigger {
  transform-box: fill-box;
  transform-origin: center;
  animation: assistant-node-breathe 3s ease-in-out infinite;
}
.assistant-flow-dot {
  opacity: 0;
  offset-path: path("M 24 32 C 31 32 31 21 38 21");
  offset-rotate: 0deg;
}
.assistant-floating-button.is-working .assistant-flow-dot {
  opacity: 1;
  animation: assistant-dot-travel 1s linear infinite;
}
.assistant-floating-badge {
  position: absolute;
  top: -2px;
  right: -3px;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  display: grid;
  place-items: center;
  border: 2px solid var(--paper);
  border-radius: 999px;
  background: var(--coral-ink);
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  line-height: 1;
}
.dock-left .assistant-floating-badge { right: auto; left: -3px; }
.assistant-floating-tooltip {
  position: absolute;
  top: 50%;
  right: calc(100% + 10px);
  width: max-content;
  max-width: min(220px, calc(100vw - 100px));
  transform: translateY(-50%) translateX(4px);
  padding: 8px 11px;
  border: 1px solid rgba(220, 238, 225, 0.35);
  border-radius: 999px;
  background: var(--navy);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  opacity: 0;
  pointer-events: none;
  transition: opacity 160ms ease, transform 160ms ease;
}
.dock-left .assistant-floating-tooltip {
  right: auto;
  left: calc(100% + 10px);
  transform: translateY(-50%) translateX(-4px);
}
.assistant-floating-button:hover .assistant-floating-tooltip,
.assistant-floating-button:focus-visible .assistant-floating-tooltip {
  opacity: 1;
  transform: translateY(-50%) translateX(0);
}
@keyframes assistant-node-breathe {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.12); opacity: 0.72; }
}
@keyframes assistant-dot-travel {
  from { offset-distance: 0%; }
  to { offset-distance: 100%; }
}
.assistant-panel-scrim {
  position: fixed;
  z-index: 62;
  inset: 0;
  background: rgba(31, 24, 44, 0.2);
  opacity: 0;
  transition: opacity 180ms ease;
}
.assistant-panel-scrim.is-open { opacity: 1; }
.assistant-side-panel {
  position: fixed;
  z-index: 63;
  top: 0;
  bottom: 0;
  width: min(400px, calc(100vw - 20px));
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--paper);
  box-shadow: 0 18px 58px rgba(35, 24, 49, 0.27);
  outline: 0;
}
.assistant-side-panel.dock-right { right: 0; border-left: 1px solid var(--line); }
.assistant-side-panel.dock-left { left: 0; border-right: 1px solid var(--line); }
.assistant-panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 18px 15px;
  border-bottom: 1px solid var(--line);
  background: #fcfbf8;
}
.assistant-panel-header h2 {
  margin: 0;
  color: var(--navy);
  font-size: 18px;
}
.assistant-panel-header p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}
.assistant-panel-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 5px;
}
.assistant-forget-button {
  white-space: nowrap;
  padding: 8px 12px;
  border-color: #e4d6d2;
  color: #7a3b2e;
  font-size: 12px;
}
.assistant-forget-button:hover {
  border-color: #d8b8b0;
  background: #faf3f1;
  color: #6d3327;
}
.assistant-panel-body {
  display: flex;
  min-height: 0;
  flex: 1;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
  padding: 16px;
}
.assistant-panel-body .panel {
  padding: 15px;
}
.assistant-settings-link {
  align-self: flex-start;
}
.assistant-side-panel .assistant-chat-log {
  max-height: none;
  min-height: 180px;
  flex: 1 1 180px;
}
.assistant-context-chip {
  white-space: nowrap;
}
.run-row .assistant-context-chip {
  grid-column: 2 / -1;
  justify-self: start;
  margin-top: -4px;
}
html.auth-locked #assistantFloatingButton,
html.auth-locked #assistantSidePanel,
html.auth-locked #assistantPanelScrim,
html.auth-verifying #assistantFloatingButton,
html.auth-verifying #assistantSidePanel,
html.auth-verifying #assistantPanelScrim {
  display: none !important;
}
@media (max-width: 768px) {
  .assistant-action-buttons button {
    min-height: 44px;
  }
  .assistant-floating-button {
    bottom: calc(82px + env(safe-area-inset-bottom));
    width: 52px;
    height: 52px;
  }
  .assistant-floating-button.dock-right { right: 14px; }
  .assistant-floating-button.dock-left { left: 14px; }
  .assistant-flow-mark { width: 52px; height: 52px; }
  .assistant-side-panel {
    width: 100%;
    max-width: none;
    border: 0 !important;
  }
  .assistant-panel-header {
    padding: calc(15px + env(safe-area-inset-top)) 15px 14px;
  }
  .assistant-panel-body {
    padding: 14px 15px calc(18px + env(safe-area-inset-bottom));
  }
  .assistant-context-chip { max-width: 132px; overflow: hidden; text-overflow: ellipsis; }
}
@media (prefers-reduced-motion: reduce) {
  .assistant-floating-button,
  .assistant-floating-tooltip,
  .assistant-panel-scrim,
  .assistant-flow-trigger,
  .assistant-flow-dot {
    animation: none !important;
    transition: none !important;
  }
  .assistant-floating-button.is-working .assistant-flow-dot { opacity: 0; }
}

@media (max-width: 768px) {
  #canvasAssistantSection {
    display: none !important;
  }
}

/* Forward routing and read-only path views. */
.canvas-routing-notices {
  flex-shrink: 0;
  max-height: 130px;
  overflow-y: auto;
  margin: 10px 20px;
  padding: 10px 14px;
  border-left: 3px solid var(--sand-ink, #946d31);
  background: var(--sand-2, #f8f1e5);
  color: var(--navy);
  font-size: 12px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}
.canvas-routing-notices ul { margin: 4px 0 8px; padding-left: 20px; }
.switch-case-editor { min-width: 0; border: 1px solid var(--line); border-radius: 6px; padding: 12px; margin: 12px 0; }
.switch-case-editor legend { font-size: 12px; font-weight: 750; color: var(--navy); overflow-wrap: anywhere; }
.switch-case-editor .field-label { display: block; margin: 8px 0; }
.switch-case-editor input, .switch-case-editor select, .after-step-editor select, .routing-otherwise select { margin-top: 5px; }
.switch-case-heading, .switch-check-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0 8px; }
.switch-check-row { border-top: 1px solid var(--line); padding: 6px 0 10px; }
.switch-check-row > label:first-child, .switch-check-row > button { grid-column: 1 / -1; }
.switch-check-row > button { justify-self: start; }
.switch-case-editor input, .switch-case-editor select { font-weight: 400; }
.switch-case-actions { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0; }
.after-step-editor, .routing-otherwise { display: block; margin-top: 18px; border-top: 1px solid var(--line); padding-top: 12px; }
.step-trace-card.is-not-on-path { background: var(--paper); color: var(--muted); border-color: var(--line); }
.step-trace-card.is-not-on-path .step-trace-head strong { color: var(--muted) !important; }
.step-trace-card.is-not-on-path .status-badge { background: var(--line); color: var(--muted); white-space: normal; text-transform: none; }
.run-routing-line { font-size: 12px; color: var(--sage-ink); margin: 8px 0; overflow-wrap: anywhere; }
.canvas-simulator-section { border-top: 1px solid var(--line); }
.simulator-act-list { margin: 6px 0 0; padding-left: 18px; font-size: 12px; color: var(--navy); }
.simulator-act-list li { margin: 3px 0; }
.simulator-act-list span { color: var(--muted); font-size: 11px; }
.simulator-tick { display: flex; align-items: flex-start; gap: 8px; font-size: 12px; color: var(--navy); font-weight: 650; }
.simulator-tick input { margin-top: 2px; }
.simulator-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }
.simulator-banner { background: var(--sage-2); color: var(--sage-ink); border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; font-size: 12px; font-weight: 700; margin: 10px 0; }
.simulator-error { background: var(--coral-2); color: var(--coral-ink); border-radius: 10px; padding: 9px 12px; font-size: 12px; font-weight: 650; margin: 8px 0; }
.simulator-sample-editor { margin-top: 10px; }
.simulator-sample-editor .field-label { font-size: 11px; }
.simulator-sample-editor textarea { min-height: 70px; }
.simulated-pill { background: var(--sage-2); color: var(--sage-ink); }
.canvas-path-stage { padding: 22px; }
#canvasPathList { color: var(--navy); font-size: 14px; line-height: 1.6; overflow-wrap: anywhere; }
#canvasPathList h3 { margin: 0 0 8px; }
#canvasPathList ol { padding-left: 22px; }
#canvasPathList li { margin: 14px 0; }
#canvasPathList p { margin: 4px 0; }
.canvas-path-group { margin: 12px 0; padding-left: 12px; border-left: 2px solid var(--line); }
.canvas-path-group h4 { font-size: 13px; margin: 0; }
.canvas-path-end { font-weight: 750; color: var(--muted); }
@media (max-width: 768px) {
  #canvasGuidedStage, #canvasDeveloperStage, #canvasModal .canvas-side,
  #canvasModal .mode-switch, #canvasModal #exportCanvasJsonBtn, #canvasModal #assistantStudioHint,
  #canvasModal #saveCanvasOnlyBtn, #canvasModal #testCanvasBtn { display: none !important; }
  #canvasPathStage { width: 100%; padding: 18px; overflow: visible; }
  #canvasModal .canvas-foot-actions { grid-template-columns: 1fr 1fr; }
  #canvasModal .canvas-routing-notices { margin: 8px 14px; }
}


/* Full page workflow editor layout */
@media (min-width: 769px) {
  #canvasModal {
    z-index: 100;
    padding: 0;
    background: transparent;
    backdrop-filter: none;
  }
  #canvasModal .canvas-modal {
    width: 100vw;
    height: 100dvh;
    max-height: 100dvh;
    border-radius: 0;
    box-shadow: none;
  }
  #canvasModal .canvas-head {
    min-height: 58px;
    flex-wrap: nowrap;
    gap: 10px;
    padding: 7px 12px;
  }
  #canvasModal .canvas-back-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    width: auto;
    min-height: 36px;
    padding: 0 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    color: var(--navy);
    font-size: 11px;
    font-weight: 700;
    flex: 0 0 auto;
  }
  #canvasModal .canvas-back-icon { display: none; }
  #canvasModal .canvas-title { gap: 8px; flex: 0 1 auto; min-width: 0; }
  #canvasModal .canvas-title-mark { display: none; }
  #canvasModal .canvas-title > div:not(.canvas-title-mark) { min-width: 0; }
  #canvasModal .canvas-title strong { overflow: hidden; text-overflow: ellipsis; font-size: 13px; white-space: nowrap; }
  #canvasModal .canvas-title span:not(.canvas-status-pill) { max-width: 190px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  #canvasModal .canvas-status-pill {
    display: inline-flex;
    align-items: center;
    padding: 4px 8px;
    border-radius: 999px;
    background: #f1edf4;
    color: #5b456b;
    font-size: 10px;
    font-weight: 750;
    text-transform: capitalize;
  }
  #canvasModal .canvas-status-pill.is-active { background: #e6f0e7; color: #315d3b; }
  #canvasModal .canvas-status-pill.is-paused { background: #f8eedb; color: #785a26; }
  #canvasModal .canvas-tools { flex: 0 0 auto; min-width: 0; gap: 6px; }
  #canvasModal .canvas-tools > button { white-space: nowrap; }
  #canvasModal .canvas-tools .small-btn { padding: 7px 9px; font-size: 11px; }
  #canvasModal .mode-switch { flex: 0 0 auto; }
  #canvasModal .mode-switch button { padding: 6px 8px; font-size: 11px; white-space: nowrap; }
  #canvasModal .canvas-supervised-pill {
    align-items: center;
    gap: 7px;
    margin: 0;
    padding: 4px 6px 4px 9px;
    border-radius: 999px;
    font-size: 11px;
    flex: 0 0 auto;
  }
  #canvasModal .canvas-supervised-pill p { display: none; }
  #canvasModal .canvas-supervised-pill .secondary-btn { padding: 5px 7px; font-size: 11px; }
  #canvasModal .canvas-header-action-slot { display: flex; align-items: center; gap: 6px; }
  #canvasModal .canvas-header-action-slot > button { min-height: 34px; padding: 7px 9px; font-size: 11px; white-space: nowrap; }
  #canvasModal .canvas-routing-notices { max-height: 112px; overflow: auto; margin: 0; padding: 6px 14px; flex: 0 0 auto; }
  #canvasModal .canvas-body {
    display: grid;
    grid-template-columns: 280px minmax(0, 1fr) 360px;
    flex: 1;
    min-height: 0;
    overflow: hidden;
  }
  #canvasModal.steps-collapsed .canvas-body { grid-template-columns: 48px minmax(0, 1fr) 360px; }
  #canvasModal.side-collapsed .canvas-body { grid-template-columns: 280px minmax(0, 1fr) 48px; }
  #canvasModal.steps-collapsed.side-collapsed .canvas-body { grid-template-columns: 48px minmax(0, 1fr) 48px; }
  #canvasModal .canvas-steps-sidebar {
    position: relative;
    grid-column: 1;
    grid-row: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
    padding: 14px 10px 10px;
    border-right: 1px solid var(--line);
    background: #fff;
  }
  #canvasModal .canvas-steps-search-label { margin: 0 0 6px; color: var(--muted); font-size: 10px; font-weight: 750; }
  #canvasModal .canvas-steps-search { width: 100%; min-height: 36px; margin-bottom: 9px; padding: 8px 10px; font-size: 11px; }
  #canvasModal .canvas-steps-toggle { align-self: flex-end; order: -1; margin: 0 0 8px; }
  #canvasModal .canvas-panel-toggle {
    position: relative;
    border: 1px solid var(--line);
    border-radius: 7px;
    background: #fff;
    color: var(--navy);
    font-size: 10px;
    font-weight: 700;
    padding: 6px 8px;
    cursor: pointer;
  }
  #canvasModal .canvas-panel-toggle:focus-visible,
  #canvasModal .canvas-step-row:focus-visible,
  #canvasModal .canvas-step-group-toggle:focus-visible { outline: 3px solid #9ebd99; outline-offset: 2px; }
  #canvasModal .canvas-steps-list { min-height: 0; overflow: auto; overscroll-behavior: contain; }
  #canvasModal .canvas-step-group { border-bottom: 1px solid #eeebf0; }
  #canvasModal .canvas-step-group > h3 { margin: 10px 0 5px; padding: 0 5px; font-size: 12px; color: var(--muted); }
  #canvasModal .canvas-step-group-toggle { display: flex; align-items: center; justify-content: space-between; width: 100%; border: 0; background: transparent; color: var(--navy); padding: 8px 5px; font-size: 12px; font-weight: 750; text-align: left; cursor: pointer; }
  #canvasModal .canvas-step-count { min-width: 20px; padding: 2px 5px; border-radius: 10px; background: #f0edf3; color: var(--muted); text-align: center; font-size: 12px; }
  #canvasModal .canvas-step-row { display: flex; align-items: center; gap: 8px; width: 100%; min-height: 35px; padding: 5px 6px; border: 0; border-radius: 6px; background: transparent; color: var(--navy); text-align: left; cursor: pointer; }
  #canvasModal .canvas-step-row:hover:not(:disabled) { background: #f2f5f1; }
  #canvasModal .canvas-step-row:disabled { opacity: .55; cursor: not-allowed; }
  #canvasModal .canvas-step-logo { display: grid; place-items: center; width: 22px; height: 22px; flex: 0 0 22px; }
  #canvasModal .canvas-step-logo svg { display: block; width: 20px; height: 20px; }
  #canvasModal .canvas-step-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; font-weight: 650; }
  #canvasModal.steps-collapsed .canvas-steps-sidebar { padding: 8px 4px; }
  #canvasModal.steps-collapsed .canvas-steps-search-label,
  #canvasModal.steps-collapsed .canvas-steps-search,
  #canvasModal.steps-collapsed .canvas-steps-list { display: none; }
  #canvasModal.steps-collapsed .canvas-steps-toggle { align-self: center; margin: 0; }
  #canvasModal .canvas-steps-toggle,
  #canvasModal .canvas-side-toggle { font-size: 0; width: 30px; min-height: 30px; padding: 4px; }
  #canvasModal .canvas-steps-toggle::after { content: "‹"; font-size: 19px; line-height: 1; }
  #canvasModal.steps-collapsed .canvas-steps-toggle::after { content: "›"; }
  #canvasModal .flow-stage { grid-column: 2; grid-row: 1; min-width: 0; min-height: 0; overflow: auto; }
  #canvasModal .canvas-side {
    grid-column: 3;
    grid-row: 1;
    min-width: 0;
    min-height: 0;
    padding: 10px 12px;
    overflow: auto;
    border-top: 0;
    border-left: 1px solid var(--line);
  }
  #canvasModal .canvas-side-toggle { position: sticky; top: 0; z-index: 2; display: block; margin: 0 0 9px auto; }
  #canvasModal .canvas-side-toggle::after { content: "›"; font-size: 19px; line-height: 1; }
  #canvasModal.side-collapsed .canvas-side { padding: 8px 4px; overflow: hidden; }
  #canvasModal.side-collapsed .canvas-side > :not(.canvas-side-toggle) { display: none !important; }
  #canvasModal.side-collapsed .canvas-side-toggle { margin: 0 auto; }
  #canvasModal.side-collapsed .canvas-side-toggle::after { content: "‹"; }
  #canvasModal .canvas-foot { display: none; }
  #canvasModal .canvas-leave-confirm[hidden] { display: none; }
  #canvasModal .canvas-leave-confirm { position: absolute; inset: 0; z-index: 10; display: grid; place-items: center; padding: 20px; background: rgba(25, 27, 35, .48); }
  #canvasModal .canvas-leave-card { width: min(440px, 100%); padding: 24px; border: 1px solid var(--line); border-radius: 14px; background: #fff; box-shadow: 0 24px 80px rgba(20, 25, 35, .3); }
  #canvasModal .canvas-leave-card h2 { margin: 0 0 8px; color: var(--navy); font-size: 18px; }
  #canvasModal .canvas-leave-card p { margin: 0 0 20px; color: var(--muted); font-size: 13px; line-height: 1.55; }
  #canvasModal .canvas-leave-actions { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
}

@media (min-width: 769px) and (max-width: 1199px) {
  #canvasModal .canvas-head {
    flex-wrap: wrap;
    justify-content: flex-start;
  }
  #canvasModal .canvas-title {
    min-width: 0;
    flex: 1 1 0;
  }
  #canvasModal .canvas-tools {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    flex: 1 0 100%;
    flex-wrap: wrap;
    justify-content: flex-start;
  }
  #canvasModal .canvas-header-action-slot {
    flex: 0 0 auto;
    margin-left: auto;
  }
}

@media (max-width: 768px) {
  #canvasModal .canvas-steps-sidebar,
  #canvasModal .canvas-steps-toggle,
  #canvasModal .canvas-side-toggle,
  #canvasModal .canvas-status-pill { display: none !important; }
  #canvasModal .canvas-back-btn { order: 4; width: 30px; height: 30px; min-height: 30px; padding: 0; border-radius: 50%; background: var(--paper); color: var(--muted); display: grid; place-items: center; font-size: 18px; flex-shrink: 0; }
  #canvasModal .canvas-back-label { display: none; }
  #canvasModal .canvas-back-icon { display: inline; }
  #canvasModal .canvas-header-action-slot { display: none; }
  #canvasModal .canvas-supervised-pill { width: auto; }
  #canvasModal .canvas-supervised-pill p { display: block; }
  #canvasModal .canvas-leave-confirm[hidden] { display: none; }
  #canvasModal .canvas-leave-confirm { position: fixed; }
  #canvasModal .canvas-leave-actions { flex-direction: column-reverse; }
  #canvasModal .canvas-leave-actions > button { width: 100%; min-height: 42px; justify-content: center; }
}

/* ENG-C1: the Wait inspector, the waiting run detail and Stop waiting. */
.wait-inline { display: flex; align-items: center; gap: 8px; }
.wait-inline > .text-input { flex: 1 1 auto; min-width: 0; }
.wait-inline > .select-input { flex: 0 0 auto; width: auto; }
.wait-problem { color: var(--coral-ink); font-weight: 650; }
.waiting-run { display: grid; gap: 6px; margin: 0 0 12px; }
.waiting-run > button { justify-self: start; }
@media (max-width: 768px) {
  .wait-inline { flex-wrap: wrap; }
  .wait-inline > .select-input { width: 100%; }
  .waiting-run > button { width: 100%; justify-content: center; min-height: 42px; }
}

/* Intake form ticket (round intake-frontend) */
.form-field-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  padding: 6px 0;
  border-bottom: 1px dashed var(--line);
}

.form-share-block {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.form-share-steps {
  margin: 6px 0;
  padding-left: 18px;
  font-size: 12px;
  color: var(--muted);
}

.form-share-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: flex-start;
  margin-top: 8px;
}

/* AI steps (round AI-C): inspector task fields, the approval control and the Inbox message. */
.ai-rows { display: grid; gap: 6px; margin-bottom: 8px; }
.ai-row { display: flex; align-items: center; gap: 8px; min-width: 0; }
.ai-row > .text-input { flex: 1 1 auto; min-width: 0; }
.ai-field-card { display: grid; gap: 6px; padding: 10px; margin-bottom: 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); }
.ai-field-card .ai-row { justify-content: space-between; }
.ai-check { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--navy); cursor: pointer; }
.ai-range { width: 100%; accent-color: var(--lavender-ink); }
.ai-task-note { margin: 6px 0 0; font-size: 11.5px; line-height: 1.5; color: var(--muted); }
.ai-approval { padding: 10px 12px; border-left: 3px solid var(--sand-ink); background: var(--sand); border-radius: 0 8px 8px 0; }
.ai-approval-note { margin: 0 0 6px; font-size: 12px; line-height: 1.5; color: var(--navy); }
.ai-approval-note:last-child { margin-bottom: 0; }
.simulator-approval-line { color: var(--sand-ink); background: var(--sand); border-left: 3px solid var(--sand-ink); padding: 6px 10px; border-radius: 0 6px 6px 0; }
.inbox-message { border: 1px solid var(--line); border-radius: 10px; margin: 10px 0; padding: 12px; min-width: 0; max-width: 100%; }
.inbox-message-head { margin: 0 0 8px; font-size: 12px; line-height: 1.6; color: var(--muted); overflow-wrap: anywhere; }
.inbox-ai-badge { display: inline-block; margin-left: 8px; padding: 1px 6px; border-radius: 4px; border: 1px solid var(--lavender-ink); color: var(--lavender-ink); font-size: 11px; font-weight: 650; }
.inbox-message-fields { display: grid; gap: 4px; margin: 0 0 8px; }
.inbox-message-row { display: grid; grid-template-columns: 70px minmax(0, 1fr); gap: 8px; font-size: 12.5px; }
.inbox-message-row dt { color: var(--muted); font-weight: 650; }
.inbox-message-row dd { margin: 0; color: var(--ink); overflow-wrap: anywhere; }
.inbox-message-text { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 13px; line-height: 1.55; color: var(--ink); background: var(--paper); border-radius: 8px; padding: 10px; }
.inbox-message-more { margin-top: 6px; }
.inbox-message-more summary { cursor: pointer; font-size: 12px; color: var(--navy); }
.inbox-message-more .inbox-message-text { margin-top: 6px; }
.inbox-message-note { margin: 6px 0; font-size: 12px; color: var(--sand-ink); font-weight: 650; }
.inbox-message .inbox-request { margin-bottom: 0; }

/* ENG-C2: list inspector problem hint. Uses its own class (not .field-hint) so
   renderStepInspector never moves {{ }}-containing problem text into .insp-advanced. */
.list-problem { color: var(--coral-ink); font-size: 12px; font-weight: 650; margin: 4px 0 0; }
.list-problem[hidden] { display: none; }
.list-check-row, .list-sort-row, .list-agg-row { display: grid; grid-template-columns: minmax(0, 1fr); gap: 4px; border-top: 1px solid var(--line); padding: 8px 0 10px; margin-bottom: 0; }
.list-check-row > .field-label, .list-sort-row > .field-label, .list-agg-row > .field-label { margin: 4px 0 0; }
.list-check-row > button, .list-sort-row > button, .list-agg-row > button { justify-self: start; margin-top: 6px; }
.list-header-row { display: flex; align-items: flex-start; gap: 8px; font-size: 12px; line-height: 1.5; color: var(--navy); cursor: pointer; }
.list-header-row input { width: 16px; height: 16px; margin: 1px 0 0; flex-shrink: 0; accent-color: #6f8d69; }
