/* Workflows Analyze (design: workflows.php?tab=analyze) */

.wf-page-title {
  margin: 0 0 16px;
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
}

.wf-compare {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  margin-bottom: 16px;
}

.wf-plain-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-weight: 500;
  cursor: pointer;
}

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

.wf-grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  align-items: start;
}

.wf-col {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}

.wf-card {
  padding: 0;
}

/*
 * Filter rows host CustomSelect menus. overflow:hidden on .wf-card was clipping them
 * inside the card (and under the KPI card below). Keep clipping only on chart/KPI cards.
 */
.wf-card--row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
  padding: 12px 16px;
  overflow: visible;
  position: relative;
  z-index: 3;
}

.wf-card.wf-kpis,
section.wf-card {
  overflow: hidden;
  position: relative;
  z-index: 1;
}

.wf-card--row:has(.custom-select-wrapper.is-open),
.wf-card--row:has(.wf-group-menu) {
  z-index: 5;
}

.wf-card__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 16px 0;
}

.wf-card__title {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}

.wf-card__sub {
  margin: 4px 0 0;
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.4;
}

.wf-card__foot {
  margin: 0;
  padding: 10px 16px 14px;
  font-size: 13px;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
}

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

.wf-kpi {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 16px 18px;
  border-right: 1px solid var(--border);
}

.wf-kpi:last-child {
  border-right: 0;
}

.wf-kpi__value {
  font-size: 28px;
  font-weight: 700;
  line-height: 1.15;
  color: var(--text);
  letter-spacing: -0.02em;
}

.wf-kpi__label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
}

.wf-kpi__sub {
  font-size: 12px;
  color: var(--text-muted);
}

.wf-chart {
  padding: 8px 8px 12px;
  min-height: 120px;
}

.wf-group-picker {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.wf-chipbox {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: min(420px, 70vw);
  min-height: 32px;
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  cursor: pointer;
}

.wf-chipbox__chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  min-width: 0;
}

.wf-chip {
  display: inline-flex;
  align-items: center;
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--surface-hover, #f1f3f5);
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}

.wf-group-menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  z-index: 20;
  min-width: 220px;
  max-height: 280px;
  overflow: auto;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
}

.wf-group-menu label {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
}

.wf-group-menu label:hover {
  background: var(--surface-hover);
}

.wf-line {
  padding: 4px 8px 8px;
}

.wf-line__tick {
  fill: var(--text-muted);
  font-size: 10px;
}

.wf-line__value {
  fill: var(--text);
  font-size: 10px;
  font-weight: 600;
}

.wf-line__legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
  font-size: 12px;
  color: var(--text-muted);
}

.wf-line__legend li {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.wf-line__swatch {
  width: 10px;
  height: 10px;
  border-radius: 2px;
}

.wf-kpi__value.is-up {
  color: var(--success, #0a7a3e);
}

.wf-kpi__value.is-down {
  color: var(--danger, #c62828);
}

@media (max-width: 960px) {
  .wf-grid-2 {
    grid-template-columns: 1fr;
  }
}

/* Automation page (design: workflows.php Overview / Workflows / Analyze / Health) */

/* HUB-258: "Monitor automations" with its date range picker on the right. */
.wf-section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 12px;
  margin: 24px 0 12px;
}

.wf-section-head .wf-section-title {
  margin: 0;
}

.wf-range-select {
  min-width: 170px;
}

.wf-section-title {
  margin: 24px 0 12px;
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
}

.wf-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  align-items: stretch;
}

.wf-pad {
  padding: 16px;
}

/* What do you want to automate? */
.wf-prompt {
  position: relative;
}

.wf-prompt__input {
  display: block;
  width: 100%;
  min-height: 92px;
  padding: 10px 12px 36px;
  border: 1px solid var(--pink, #c11574);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  resize: vertical;
}

.wf-prompt__input:focus {
  outline: none;
  box-shadow: 0 0 0 3px var(--pink-bg, #fdf2fa);
}

.wf-prompt__send {
  position: absolute;
  right: 10px;
  bottom: 10px;
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border: 0;
  border-radius: 50%;
  background: var(--pink, #c11574);
  color: #fff;
  cursor: pointer;
}

.wf-prompt__send:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Automation issues to review */
.wf-issues {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 12px;
}

.wf-issues__total {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.wf-issues__value {
  font-size: 28px;
  font-weight: 700;
  line-height: 1.1;
  color: var(--brand);
}

/* Pick up where you left off */
.wf-recent {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(150px, 1fr);
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 4px;
  scroll-snap-type: x mandatory;
}

.wf-recent__card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 92px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: inherit;
  text-decoration: none;
  scroll-snap-align: start;
  transition: border-color var(--fast) var(--ease);
}

.wf-recent__card:hover {
  border-color: var(--brand);
}

.wf-recent__name {
  color: var(--brand);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.wf-recent__meta {
  color: var(--text-muted);
  font-size: 11px;
  line-height: 1.35;
}

.wf-dot {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: auto;
  font-size: 11px;
  color: var(--text-muted);
}

.wf-dot::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--gray);
}

.wf-dot.is-on::before {
  background: var(--success);
}

/* Automations by object */
.wf-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px 12px;
}

.wf-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.wf-stat__label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text);
}

.wf-stat__value {
  font-size: 20px;
  font-weight: 700;
  color: var(--brand);
}

/* Discover apps to automate */
.wf-apps {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}

.wf-app {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px;
}

.wf-app__logo {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  margin-bottom: 8px;
  border-radius: 6px;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
}

.wf-app__name {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.wf-app__by {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-size: 12px;
  color: var(--text-muted);
}

.wf-app__installed {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.wf-app__text {
  margin: 4px 0 0;
  font-size: 12px;
  line-height: 1.45;
  color: var(--text);
}

.wf-app__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: auto;
  padding-top: 12px;
}

.wf-app__tag {
  padding: 1px 8px;
  border-radius: 6px;
  background: var(--neutral-bg);
  color: var(--text-muted);
  font-size: 11px;
}

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

.wf-kpis--grid .wf-kpi {
  border-right: 0;
}

.wf-kpi--center {
  align-items: center;
  text-align: center;
}

.wf-kpi--center .wf-kpi__value {
  font-size: 22px;
}

@media (max-width: 1100px) {
  .wf-grid-3 {
    grid-template-columns: 1fr;
  }
}

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

/* Automation page shell (design: workflows.php `.wf-page`, `.wf-head`) */

.wf-page {
  padding: 0 0 80px;
  font-size: 13px;
}

.wf-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 12px;
}

.wf-head__title {
  margin: 0;
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
}

.wf-head__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.wf-page .btn-crm {
  font-size: 13px;
}

.wf-round-btn {
  width: 34px;
  height: 34px;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--surface);
  color: var(--text-muted);
}

.wf-issues-btn {
  position: relative;
  gap: 8px;
}

.wf-dot-alert {
  position: absolute;
  top: -3px;
  right: -3px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--danger);
  box-shadow: 0 0 0 2px var(--surface);
}

.wf-page .dropdown__item {
  gap: 8px;
  padding: 8px 10px;
  font-size: 13px;
  border: 0;
  background: transparent;
  cursor: pointer;
  text-decoration: none;
}

.wf-page .dropdown__item:disabled {
  color: var(--text-subtle);
  cursor: not-allowed;
  background: transparent;
}

.wf-menu--left {
  left: 0;
  right: auto;
  transform-origin: top left;
}

.wf-menu--up {
  top: auto;
  bottom: calc(100% + 6px);
}

.wf-more-menu {
  min-width: 230px;
}

.wf-danger,
.wf-page .dropdown__item.wf-danger {
  color: var(--danger);
}

/* A Delete that is off does not look like one to press. */
.wf-page .dropdown__item.wf-danger:disabled {
  color: var(--text-subtle);
}

.wf-badge {
  display: inline-flex;
  align-items: center;
  margin-left: auto;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 600;
  line-height: 1.5;
}

.wf-badge--new {
  background: var(--success);
  color: #fff;
}

.wf-badge--beta {
  background: var(--indigo);
  color: #fff;
}

.wf-tabs.companies-tabs {
  gap: 24px;
  margin: 0 0 20px;
}

.wf-tabs .companies-tab {
  padding: 10px 0;
  font-size: 13px;
}

/* Workflows tab: the card holding views, filters, toolbar and table */
.wf-table-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.wf-views {
  display: flex;
  align-items: stretch;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--border);
}

.wf-view {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 11px 16px;
  border: 0;
  border-right: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
}

.wf-view:first-child {
  border-top-left-radius: var(--radius);
}

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

.wf-view.is-active {
  font-weight: 600;
  background: var(--surface);
}

.wf-view.is-active::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 2px;
  background: var(--brand);
}

.wf-view--add {
  border-right: 0;
  font-weight: 600;
}

.wf-views > .dropdown {
  display: flex;
}

.wf-view--folders {
  margin-left: auto;
  border-right: 0;
  border-left: 1px solid var(--border);
  border-top-right-radius: var(--radius);
}

.wf-pill {
  display: inline-grid;
  place-items: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--text);
  color: var(--surface);
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
}

.wf-pill--danger {
  background: var(--danger);
  color: #fff;
}

/* Filters: plain-text toggles, a checkbox menu each */
.wf-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 6px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
}

.wf-filter__btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 6px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.wf-filter__btn:hover,
.wf-filter__btn[aria-expanded='true'] {
  background: var(--surface-hover);
}

.wf-filter__btn.is-active {
  color: var(--brand);
}

.wf-filter__count {
  display: inline-grid;
  place-items: center;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--brand);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
}

.wf-filter__menu {
  width: 230px;
  min-width: 0;
  padding: 8px;
}

.wf-filter__search .input {
  width: 100%;
  height: 32px;
  padding: 4px 10px;
  font-size: 13px;
}

.wf-filter__opts {
  max-height: 220px;
  margin: 6px 0;
  overflow-y: auto;
}

.wf-filter__opt {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 4px;
  border-radius: 6px;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
}

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

.wf-filter__opt .check__box {
  width: 16px;
  height: 16px;
  border-radius: 4px;
}

.wf-filter__opt .check input {
  width: 16px;
  height: 16px;
}

.wf-filter__none {
  margin: 6px 4px;
  color: var(--text-muted);
  font-size: 12px;
}

.wf-filter__foot {
  display: flex;
  justify-content: flex-end;
  padding-top: 6px;
  border-top: 1px solid var(--border);
}

.wf-page .btn-text {
  padding: 2px 4px;
  border: 0;
  background: transparent;
  color: var(--brand);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.wf-filters__end {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

/* Search + bulk actions */
.wf-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 12px;
}

.wf-toolbar .search-input {
  flex: 0 1 260px;
  max-width: 260px;
  padding: 2px 12px;
  border-color: var(--border-strong);
  border-radius: 999px;
  color: var(--text-muted);
}

.wf-toolbar .search-input input {
  font-size: 13px;
}

.wf-toolbar__selected {
  color: var(--text-muted);
  font-size: 13px;
}

/* Table */
.wf-table-wrap {
  border-top: 1px solid var(--border);
}

.wf-table-scroll {
  overflow-x: auto;
}

.wf-table {
  font-size: 13px;
}

.wf-table th {
  padding: 10px 12px;
  background: var(--surface);
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.wf-table td {
  padding: 14px 12px;
  font-size: 13px;
}

.wf-table tbody tr:hover td {
  background: var(--surface-hover);
}

.wf-table .check__box {
  width: 16px;
  height: 16px;
  border-radius: 4px;
}

.wf-name {
  display: inline-block;
  max-width: 240px;
  overflow: hidden;
  vertical-align: middle;
  color: var(--brand);
  font-weight: 600;
  text-decoration: none;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wf-name:hover {
  text-decoration: underline;
}

.wf-name.is-plain {
  color: var(--text);
}

.wf-issue {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  margin-left: 8px;
  vertical-align: middle;
  color: var(--danger);
  font-size: 11px;
  font-weight: 600;
  text-decoration: none;
}

.wf-tag {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--neutral-bg);
  color: var(--text-muted);
  font-size: 10.5px;
  font-weight: 500;
  vertical-align: middle;
}

.wf-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
  white-space: nowrap;
}

.wf-status__dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--gray);
}

.wf-status__dot.is-on {
  background: var(--success);
}

.wf-table .mini-avatar {
  font-size: 9px;
}

.wf-empty {
  padding: 48px 16px;
  text-align: center;
}

.wf-empty h3 {
  margin: 0 0 4px;
  font-size: 15px;
  font-weight: 600;
}

.wf-empty p {
  margin: 0 0 12px;
  color: var(--text-muted);
}

/* Folders view (design: workflows.php?tab=workflows&view=folders) */
.wf-folders {
  padding: 0 12px 12px;
}

.wf-folders__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  font-size: 12.5px;
}

.wf-folders__empty {
  margin: 0;
  padding: 24px 0;
  color: var(--text-muted);
  text-align: center;
}

.wf-folder-list {
  margin: 0;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  list-style: none;
  overflow: hidden;
}

/* HUB-250: a folder row is the folder link plus its Rename / Delete menu. */
.wf-folder-list li {
  display: flex;
  align-items: center;
  background: var(--surface);
}

.wf-folder-list li .wf-folder {
  flex: 1 1 auto;
  min-width: 0;
}

.wf-folder__menu {
  flex: none;
  padding-right: 8px;
}

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

.wf-folder {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border: 0;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

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

.wf-folder__icon {
  flex: none;
  color: var(--accent);
}

.wf-folder__name {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  color: var(--brand);
  font-size: 13px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wf-folder:hover .wf-folder__name {
  text-decoration: underline;
}

.wf-folder__count {
  flex: none;
  color: var(--text-muted);
  font-size: 11.5px;
}

/* Create folder: the workflows to put in it */
.wf-pick-list {
  max-height: 260px;
  margin: 0;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  list-style: none;
  overflow-y: auto;
}

.wf-pick-list__name {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wf-pick-list__folder {
  flex: none;
  color: var(--text-subtle);
  font-size: 11.5px;
}

/* Pager */
.wf-pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 16px;
}

.wf-pager__btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 8px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.wf-pager__btn:disabled {
  color: var(--text-subtle);
  font-weight: 500;
  cursor: default;
}

.wf-pager__size {
  margin-left: 16px;
}

.wf-pager__nums {
  display: inline-flex;
  gap: 4px;
}

.wf-pager__num {
  min-width: 28px;
  height: 28px;
  padding: 0 6px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.wf-pager__num.is-active {
  border-color: var(--border-strong);
  background: var(--surface);
  cursor: default;
}

.wf-range {
  display: inline-block;
  margin-top: 8px;
  padding: 2px 8px;
  border-radius: 6px;
  background: var(--neutral-bg);
  color: var(--text-muted);
  font-size: 12px;
}

.wf-view__muted {
  color: var(--text-muted);
  font-weight: 500;
}

/* Row hover actions (design: Edit workflow, Clone, More over the name) */
.wf-name-cell {
  min-width: 270px;
}

.wf-row-actions {
  display: none;
  align-items: center;
  gap: 4px;
  margin-left: 6px;
  vertical-align: middle;
}

.wf-table tbody tr:hover .wf-row-actions,
.wf-table tbody tr:focus-within .wf-row-actions {
  display: inline-flex;
}

/* Make room for the buttons: the name is cut short, its full text is in the tooltip. */
.wf-table tbody tr:hover .wf-name-cell .wf-name,
.wf-table tbody tr:focus-within .wf-name-cell .wf-name {
  max-width: 72px;
}

.wf-row-btn {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 7px;
  border: 1px solid var(--border-strong);
  border-radius: 5px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.5;
  white-space: nowrap;
  cursor: pointer;
}

.wf-row-btn:hover,
.wf-row-btn[aria-expanded='true'] {
  border-color: var(--brand);
  color: var(--brand);
}

.wf-row-actions .dropdown {
  display: inline-flex;
}

.wf-row-menu {
  min-width: 170px;
}

/* Workflow details drawer (design: read-only, narrow) */
#wfRowDetails .modal {
  width: min(440px, 100vw);
}

.wf-detail__name {
  margin: 0 0 4px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  overflow-wrap: anywhere;
}

.wf-detail__desc {
  margin: 0 0 16px;
  color: var(--text-muted);
  font-size: 12.5px;
}

.wf-details {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 10px 12px;
  margin: 0 0 20px;
  font-size: 12.5px;
}

.wf-details dt {
  color: var(--text-muted);
}

.wf-details dd {
  margin: 0;
  color: var(--text);
}

.wf-detail__sub {
  margin: 0 0 6px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text);
}

.wf-detail__actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 12.5px;
}

.wf-detail__count {
  margin-left: 6px;
  color: var(--text-muted);
}

/* Drawer footer: primary action first, on the left (design) */
.wf-drawer-foot {
  justify-content: flex-start;
}

/* Move to folder drawer (design: narrow drawer, full-width folder select) */
#wfBulkMoveModal .modal {
  width: min(440px, 100vw);
}

.wf-move__lead {
  margin: 0 0 14px;
  color: var(--text-muted);
  font-size: 12.5px;
}

.wf-move__label {
  display: block;
  margin-bottom: 6px;
  color: var(--text);
  font-size: 12.5px;
  font-weight: 600;
}

.wf-select {
  width: 100%;
  height: 36px;
  padding: 0 32px 0 12px;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  background-color: var(--surface);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23667085' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-position: right 12px center;
  background-repeat: no-repeat;
  color: var(--text);
  font: inherit;
  font-size: 13px;
  appearance: none;
  cursor: pointer;
}

.wf-select:focus {
  border-color: var(--brand);
  outline: none;
  box-shadow: var(--focus-ring);
}

/* ==========================================================================
   Editor history views (design: workflow-editor.php ?tab=history / logs / performance)
   ========================================================================== */

.wfh-card {
  padding: 14px;
}

.wfh-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
  margin-bottom: 12px;
}

.wfh-toolbar__end {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-left: auto;
}

.wfh-search {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: 260px;
  max-width: 100%;
  height: 32px;
  padding: 0 10px;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text-muted);
}

.wfh-search:focus-within {
  border-color: var(--brand);
  box-shadow: var(--focus-ring);
}

.wfh-search input {
  flex: 1 1 auto;
  min-width: 0;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 12.5px;
}

.wfh-select {
  width: auto;
  min-width: 140px;
  height: 32px;
  font-size: 12.5px;
}

.wfh-table th {
  padding: 9px 12px;
  background: var(--neutral-bg);
  color: var(--text-muted);
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
}

.wfh-table td {
  padding: 11px 12px;
  font-size: 12.5px;
}

.wfh-row {
  cursor: pointer;
}

.wfh-row:hover td,
.wfh-row:focus-visible td {
  background: var(--surface-hover);
  outline: none;
}

.wfh-sub {
  margin: 2px 0 0;
  color: var(--text-muted);
  font-size: 11.5px;
}

.wfh-truncate {
  max-width: 360px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wfh-cell-note {
  color: var(--text-muted);
}

.wfh-loading {
  margin: 0;
  padding: 32px 0;
  color: var(--text-muted);
  text-align: center;
  font-size: 12.5px;
}

.wfh-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 36px 16px 28px;
  color: var(--text-muted);
  text-align: center;
}

.wfh-empty__title {
  margin: 6px 0 0;
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
}

.wfh-empty__text {
  margin: 0;
  font-size: 12px;
}

.wfh-pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
  color: var(--text-muted);
  font-size: 12px;
}

/* Performance */
.wfp {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

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

.wfp-kpi {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 18px 12px;
}

.wfp-kpi__value {
  color: var(--text);
  font-size: 22px;
  font-weight: 700;
  line-height: 1.2;
}

.wfp-kpi__label {
  color: var(--text);
  font-size: 12.5px;
}

.wfp-card {
  padding: 16px;
}

.wfp-card__title {
  margin: 0 0 12px;
  font-size: 13px;
  font-weight: 600;
}

.wfp-chart {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
}

.wfp-chart__y {
  color: var(--text-muted);
  font-size: 11px;
  transform: rotate(-90deg);
}

.wfp-chart__x {
  grid-column: 2;
  color: var(--text-muted);
  font-size: 11px;
  text-align: center;
}

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

/* Troubleshoot drawers */
#wfTroubleshootActions .modal,
#wfTroubleshootEnrollment .modal {
  width: min(460px, 100vw);
}

.wft__lead {
  margin: 0 0 14px;
  color: var(--text-muted);
  font-size: 12.5px;
}

.wft__note {
  margin: 0 0 10px;
  padding: 8px 10px;
  border-radius: 6px;
  background: var(--warning-bg);
  color: var(--warning);
  font-size: 12px;
}

.wft-list + .wft-list {
  margin-top: 10px;
}

.wft-reviewed {
  margin-top: 16px;
}

.wft-reviewed > summary {
  margin-bottom: 10px;
  color: var(--text-muted);
  font-size: 12.5px;
  cursor: pointer;
}

.wft-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.wft-item {
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font-size: 12.5px;
}

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

.wft-item__reason {
  margin: 6px 0 0;
  color: var(--text);
}

.wft-item__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 10px;
  color: var(--text-muted);
  font-size: 11.5px;
}

/* Action logs toolbar (design): search left, results in the middle, actions right */
.wfh-toolbar--logs {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
}

.wfh-toolbar--logs > :last-child {
  justify-self: end;
}

/* Troubleshoot enrollment: the record's verdict */
.wft-result {
  margin-top: 16px;
}

.wft-verdict {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  padding: 12px;
  border: 1px solid var(--border);
  border-left-width: 3px;
  border-radius: var(--radius-sm);
  font-size: 12.5px;
}

.wft-verdict span {
  color: var(--text-muted);
}

.wft-verdict.is-in {
  border-left-color: var(--success);
}

.wft-verdict.is-was {
  border-left-color: var(--brand);
}

.wft-verdict.is-out {
  border-left-color: var(--warning);
}

/* ---------------------------------------------------------------------------------------------
 * Review automation issues (HUB-299, design workflow-issues.php)
 * ------------------------------------------------------------------------------------------- */
.wfi-page {
  padding: 8px 4px 32px;
}
.wfi-back {
  display: inline-block;
  margin-bottom: 12px;
  color: var(--brand);
  font-weight: 600;
  text-decoration: none;
}
.wfi-title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 8px;
  font-size: 22px;
  font-weight: 700;
}
.wfi-beta {
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  background: #444ce7;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
}
.wfi-dd {
  position: relative;
  display: inline-block;
}
.wfi-total {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
  border: 0;
  background: transparent;
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  cursor: pointer;
}
.wfi-total__dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--danger);
}
.wfi-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 30;
  min-width: 240px;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: 0 12px 32px rgba(16, 24, 40, 0.14);
}
.wfi-menu__title {
  padding: 6px 8px 8px;
  font-weight: 700;
}
.wfi-menu__item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  font-size: 13px;
  text-align: left;
  cursor: pointer;
}
.wfi-menu__item:hover,
.wfi-menu__item.is-active {
  background: var(--surface-hover);
}
.wfi-menu__item input {
  width: 15px;
  height: 15px;
}
.wfi-menu__label {
  flex: 1;
}
.wfi-menu__foot {
  display: flex;
  justify-content: flex-end;
  margin-top: 6px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}
.wfi-ring {
  display: inline-block;
  flex-shrink: 0;
  width: 9px;
  height: 9px;
  border: 2px solid var(--text-subtle);
  border-radius: 50%;
}
.wfi-ring.is-high,
.wfi-priority.is-high .wfi-ring,
.wfi-status .wfi-ring {
  border-color: var(--danger);
}
.wfi-ring.is-medium,
.wfi-priority.is-medium .wfi-ring {
  border-color: #c4320a;
}
.wfi-ring.is-low,
.wfi-priority.is-low .wfi-ring {
  border-color: var(--info);
}
.wfi-priority,
.wfi-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}
.wfi-dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--text-subtle);
}
.wfi-dot.is-on {
  background: var(--success);
}
.wfi-tabs {
  display: flex;
  gap: 28px;
  margin: 18px 0 0;
  border-bottom: 1px solid var(--border);
}
.wfi-tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 2px 10px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  font-size: 14px;
  color: var(--text-muted);
  cursor: pointer;
}
.wfi-tab.is-active {
  border-bottom-color: var(--brand);
  color: var(--brand);
  font-weight: 600;
}
.wfi-howto {
  margin: 16px 0 14px;
}
.wfi-howto__toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0;
  border: 0;
  background: transparent;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
}
.wfi-howto ul {
  margin: 8px 0 0;
  padding-left: 44px;
  font-size: 13px;
  line-height: 1.9;
}
.wfi-filters {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
}
.wfi-filter {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 12px;
  border: 0;
  border-radius: var(--radius);
  background: #eceef2;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
}
.wfi-filter.is-active {
  background: var(--brand-soft);
  color: var(--brand);
}
.wfi-filter--split {
  padding: 0;
}
.wfi-filter__main,
.wfi-filter__clear {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 46px;
  padding: 0 14px;
  border: 0;
  background: transparent;
  font: inherit;
  color: inherit;
  cursor: pointer;
}
.wfi-filter__clear {
  padding: 0 14px 0 4px;
  font-size: 16px;
  font-weight: 400;
}
.wfi-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
  font-size: 11px;
}
.wfi-table-wrap {
  border-top: 2px solid var(--text);
  overflow-x: auto;
}
.wfi-table {
  width: 100%;
  border-collapse: collapse;
}
.wfi-table th {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-subtle);
  text-align: left;
  white-space: nowrap;
}
.wfi-table th button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0;
  border: 0;
  background: transparent;
  font: inherit;
  color: inherit;
  cursor: pointer;
}
.wfi-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  vertical-align: middle;
}
.wfi-row {
  cursor: pointer;
}
.wfi-row td:first-child {
  position: relative;
}
.wfi-row:hover {
  background: var(--surface-hover);
}
.wfi-view {
  position: absolute;
  top: 50%;
  right: 12px;
  transform: translateY(-50%);
  display: none;
  border-radius: var(--radius-pill);
  background: var(--surface);
}
.wfi-row:hover .wfi-view {
  display: inline-flex;
}
.wfi-link {
  padding: 0;
  border: 0;
  background: transparent;
  font-size: 14px;
  font-weight: 600;
  color: var(--brand);
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}
.wfi-issue-text {
  margin-top: 2px;
  font-size: 12.5px;
  color: var(--text-muted);
}
.wfi-source {
  max-width: 120px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.wfi-num {
  text-align: right;
  font-weight: 700;
}
.wfi-table th.wfi-num {
  text-align: right;
}
.wfi-sort {
  color: var(--border-strong);
}
.wfi-sort.is-active {
  color: var(--brand);
}
.wfi-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 40px 16px;
  color: var(--text-muted);
  text-align: center;
}
.wfi-empty strong {
  font-size: 15px;
  color: var(--text);
}
.wfi-pager {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  margin-top: 20px;
}
.wfi-pager__btn {
  border: 0;
  background: transparent;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
}
.wfi-pager__btn:disabled {
  color: var(--text-subtle);
  cursor: default;
}
.wfi-pager__num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 30px;
  height: 30px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font-weight: 600;
}
.wfi-pager__size {
  margin-left: 16px;
  border: 0;
  background: transparent;
  font-size: 13px;
  font-weight: 600;
}

/* The drawer */
.wfi-drawer__h {
  margin: 0 0 8px;
  font-size: 15px;
  font-weight: 700;
}
.wfi-eyebrow {
  margin-bottom: 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-subtle);
}
.wfi-subtabs {
  display: flex;
  gap: 24px;
  margin: 14px 0 12px;
  border-bottom: 1px solid var(--border);
}
.wfi-subtab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 0 10px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  font-size: 13px;
  color: var(--text-muted);
  cursor: pointer;
}
.wfi-subtab.is-active {
  border-bottom-color: var(--brand);
  color: var(--brand);
}
.wfi-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--panel);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
}
.wfi-drawer__filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 16px;
}
.wfi-drawer__filters label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 150px;
  font-weight: 600;
}
.wfi-selbar {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 14px;
  padding: 8px 12px;
  border-radius: var(--radius);
  background: var(--brand-soft);
  color: var(--brand);
  font-weight: 600;
}
.wfi-table--drawer th {
  background: var(--surface-hover);
}
.wfi-table--drawer tr.is-selected td {
  background: #f2f5fc;
}
.wfi-check {
  width: 36px;
}
.wfi-check input {
  width: 16px;
  height: 16px;
}
.wfi-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
  font-size: 12px;
  color: var(--text-muted);
}
.wfi-end {
  text-align: right;
}
.wfi-drawer-foot {
  justify-content: flex-start;
}
@media (max-width: 800px) {
  .wfi-title {
    font-size: 20px;
  }
  .wfi-howto ul {
    padding-left: 24px;
  }
}

/* ---------------------------------------------------------------------------------------------
 * Workflow editor (design: workflow-editor.php): dark top bar, menu bar, canvas, trigger panel.
 * ------------------------------------------------------------------------------------------- */
/* Full screen (AppShell bare mode, A-21): the header and menu bar stay put, the canvas and the
   panels scroll on their own. */
.wfe {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  background: var(--surface);
}
.app--bare .app__main > .companies-page {
  padding: var(--sp-8) clamp(16px, 3vw, 40px) var(--sp-12);
}
.wfe-top {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 16px;
  padding: 14px 16px;
  /* Go-live 952: light in light mode and dark in dark mode, as the rest of the page. */
  background: var(--surface);
  color: var(--text);
}
.wfe-top__btn {
  display: inline-flex;
  align-items: center;
  height: 40px;
  padding: 0 20px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-strong);
  background: transparent;
  color: var(--text);
  font-weight: 600;
  font-size: 15px;
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
}
.wfe-top__btn:hover {
  background: var(--surface-hover);
  color: var(--text);
}
.wfe-top__btn:disabled {
  opacity: 0.55;
  cursor: default;
}
.wfe-top__btn--primary {
  background: var(--brand);
  color: var(--brand-contrast);
  border-color: var(--brand);
}
.wfe-top__btn--primary:hover {
  background: var(--brand-hover);
  color: var(--brand-contrast);
}
.wfe-top__center {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 0;
}
.wfe-top__name {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  max-width: 420px;
  font-size: 19px;
  font-weight: 700;
}
.wfe-top__name span {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.wfe-top__edit {
  border: 0;
  background: transparent;
  color: var(--text);
  padding: 2px;
  cursor: pointer;
  line-height: 0;
}
.wfe-top__status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 2px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}
.wfe-top__status::before {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}
.wfe-top__status.is-on {
  color: var(--success);
}
.wfe-top__end {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
}
.wfe-top__saved {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
}
.wfe-menubar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  padding: 6px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.wfe-menubar__end {
  margin-left: auto;
  display: flex;
  gap: 8px;
}
.wfe-menu-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 12px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text);
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
}
.wfe-menu-btn:hover,
.wfe-menu-btn[aria-expanded="true"] {
  background: var(--surface-hover);
}
.wfe-pill-btn {
  display: inline-flex;
  align-items: center;
  height: 34px;
  padding: 0 14px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-pill);
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
}
.wfe-pill-btn:hover {
  background: var(--surface-hover);
}
.wfe-messages {
  padding: 12px 16px 0;
}
.wfe-body {
  flex: 1;
  display: flex;
  min-height: 0;
}
/* A-01: the step side panel renders here (left, as "Choose an action"). */
.wfe-step-panel-host {
  display: contents;
}
.wfe .step__card.is-selected {
  border-color: var(--brand);
  box-shadow: 0 0 0 2px var(--brand-soft);
}
.wfe .step__foot {
  display: flex;
  justify-content: flex-end;
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}
.wfe-page {
  flex: 1;
  padding: 20px;
  overflow: auto;
}
.wfe-panel {
  width: 410px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border);
  background: var(--surface);
}
.wfe-panel__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
}
.wfe-panel__title {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
}
.wfe-panel__tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-bottom: 1px solid var(--border);
}
.wfe-panel__tab {
  padding: 14px 8px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  font-size: 16px;
  color: var(--text);
  cursor: pointer;
}
.wfe-panel__tab.is-active {
  border-bottom-color: var(--text);
  font-weight: 600;
}
.wfe-panel__body {
  flex: 1;
  overflow-y: auto;
  padding: 18px;
}
.wfe-panel__foot {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 14px 18px;
  border-top: 1px solid var(--border);
}
.wfe-type {
  display: flex;
  gap: 14px;
  width: 100%;
  padding: 14px 16px;
  margin-bottom: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  text-align: left;
  cursor: pointer;
}
.wfe-type:hover {
  border-color: var(--brand);
  background: var(--brand-soft);
}
.wfe-type:disabled {
  cursor: default;
  opacity: 0.6;
}
.wfe-type__icon,
.wfe-node__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  flex-shrink: 0;
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  color: var(--accent);
}
.wfe-type__title {
  display: block;
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
}
.wfe-type__desc {
  display: block;
  margin-top: 2px;
  font-size: 14px;
  color: var(--text-muted);
}
.wfe-chosen {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  margin-bottom: 18px;
  border-radius: var(--radius);
  background: var(--accent-soft);
  font-weight: 600;
}
.wfe-chosen button {
  margin-left: auto;
}
/* A-04: "Manually triggered" is always there (no remove); OR'd event triggers, each in a box. */
.wfe-chosen--fixed {
  margin-bottom: 0;
  background: var(--surface-hover);
  font-weight: 500;
}
.wfe-or {
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}
.wfe-branch {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.wfe-branch__head {
  display: flex;
  justify-content: space-between;
  font-weight: 600;
}
.wfe-canvas {
  position: relative;
  flex: 1;
  overflow: auto;
  overscroll-behavior: contain;
  cursor: grab;
  padding: 44px 24px 80px;
  /* Go-live 952: the theme's background. */
  background-color: var(--surface-2);
  background-image: radial-gradient(var(--border-strong) 1px, transparent 1px);
  background-size: 22px 22px;
}
/* Drag on the empty canvas pans it (editor/canvasPan.ts); the step lists keep a normal cursor. */
.wfe-canvas.is-panning {
  cursor: grabbing;
  user-select: none;
}
.wfe-steps {
  cursor: auto;
}
.wfe-flow {
  display: flex;
  flex-direction: column;
  align-items: center;
  /* As wide as its widest branch; the canvas scrolls sideways. */
  width: max-content;
  min-width: min(620px, 100%);
  margin: 0 auto;
}
.wfe-node {
  width: 100%;
  max-width: 390px;
  border: 1px solid var(--border);
  border-top: 4px solid var(--accent);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: 0 1px 3px rgba(16, 24, 40, 0.08);
  text-align: left;
  cursor: pointer;
}
.wfe-node.is-selected {
  outline: 2px dashed var(--brand);
  outline-offset: 2px;
  border-top-color: var(--brand);
}
.wfe-node__head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 18px 8px;
  font-weight: 600;
}
.wfe-node__label {
  padding: 4px 18px 8px;
  font-size: 14px;
  font-weight: 600;
}
.wfe-node__group {
  margin: 0 18px 18px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.wfe-node__group strong {
  display: block;
  margin-bottom: 8px;
}
.wfe-node__summary {
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: var(--surface-hover);
  font-size: 15px;
}
/* A-04: a filter trigger's OR groups on the card. */
.wfe-node__conditions {
  margin: 0;
  list-style: none;
}
.wfe-node__conditions li + li {
  margin-top: 6px;
}
.wfe-node__and {
  color: var(--text-muted);
  font-size: 13px;
}
.wfe-node__or {
  margin: -8px 18px 10px;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  text-transform: lowercase;
}
.wfe-node__foot {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 14px;
  padding: 12px 18px;
  border-top: 1px solid var(--border);
  font-size: 14px;
}
.wfe-node__details {
  padding-left: 14px;
  border-left: 1px solid var(--border);
  color: var(--brand);
  font-weight: 600;
}
.wfe-line {
  width: 2px;
  height: 28px;
  background: var(--border-strong);
}
.wfe-steps {
  width: 100%;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
}
.wfe-end {
  padding: 8px 20px;
  border-radius: var(--radius-pill);
  background: var(--panel);
  color: #fff;
  font-weight: 600;
}
.wfe-check {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  margin-bottom: 10px;
  border-radius: var(--radius);
  font-size: 15px;
}
.wfe-check--bad {
  background: var(--danger-bg);
  color: var(--danger);
}
.wfe-check--ok {
  background: var(--success-bg);
  color: var(--success);
}
.wfe-check--warn {
  background: var(--warning-bg);
  color: var(--warning);
}
@media (max-width: 900px) {
  .wfe-top {
    grid-template-columns: 1fr;
  }
  .wfe-top__end {
    justify-content: flex-start;
  }
  .wfe-body {
    flex-direction: column;
  }
  .wfe-panel {
    width: 100%;
    max-height: 50%;
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }
}

/* Editor menus (File, Edit, View, Help, Performance history) */
.wfe-dd__root {
  position: relative;
}
.wfe-dd {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 40;
  min-width: 240px;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: 0 12px 32px rgba(16, 24, 40, 0.14);
}
.wfe-dd--right {
  left: auto;
  right: 0;
}
.wfe-dd--sub {
  top: -6px;
  left: calc(100% + 4px);
}
.wfe-dd__wrap {
  position: relative;
}
.wfe-dd__sep {
  height: 1px;
  margin: 6px -6px;
  background: var(--border);
}
.wfe-dd__item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text);
  font-size: 15px;
  text-align: left;
  white-space: nowrap;
  cursor: pointer;
}
.wfe-dd__item > span:first-child {
  flex: 1;
}
.wfe-dd__item:hover,
.wfe-dd__item.is-open {
  background: var(--surface-hover);
}
.wfe-dd__item[aria-disabled='true'] {
  color: var(--text-subtle);
  cursor: default;
  background: transparent;
}
.wfe-dd__ext {
  color: var(--text-subtle);
}
.wfe-dd__kbd {
  padding: 2px 6px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface-hover);
  font-family: inherit;
  font-size: 12px;
  color: var(--text-muted);
}

/* The design's ON / OFF switch and setting cards */
.wfe-onoff {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  flex-shrink: 0;
  width: 92px;
  height: 36px;
  padding: 0 14px;
  border: 1px solid var(--text);
  border-radius: 10px;
  background: var(--surface);
  cursor: pointer;
}
.wfe-onoff__knob {
  position: absolute;
  top: -1px;
  left: -1px;
  width: 36px;
  height: 36px;
  border: 1px solid var(--text);
  border-radius: 10px;
  background: var(--surface);
  transition: left 0.15s ease;
}
.wfe-onoff__text {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}
.wfe-onoff.is-on {
  justify-content: flex-start;
  background: var(--brand);
  border-color: var(--brand);
}
.wfe-onoff.is-on .wfe-onoff__knob {
  left: calc(100% - 35px);
  border-color: var(--brand);
}
.wfe-onoff.is-on .wfe-onoff__text {
  color: #fff;
}
.wfe-onoff:disabled {
  opacity: 0.55;
  cursor: default;
}
.wfe-setting {
  margin-bottom: 12px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}
.wfe-setting__row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}
.wfe-setting__title {
  display: block;
  font-size: 15px;
  font-weight: 600;
}
.wfe-setting__desc {
  margin: 4px 0 0;
  font-size: 14px;
  color: var(--text-muted);
}
.wfe-setting__body {
  margin-top: 14px;
}

/* Drawers: primary button first, as in the design */
.wfe-foot-left,
#wfSettingsDrawer .modal__footer {
  justify-content: flex-start;
}
#wfSettingsDrawer .modal__footer {
  flex-direction: row-reverse;
  justify-content: flex-end;
}

/* File > New */
.wfe-objects {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.wfe-object {
  display: flex;
  gap: 14px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  text-align: left;
  cursor: pointer;
}
.wfe-object:hover {
  border-color: var(--border-strong);
}
.wfe-object.is-selected {
  border-color: var(--brand);
  background: var(--brand-soft);
  box-shadow: var(--focus-ring);
}
.wfe-object__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  border-radius: var(--radius);
  background: var(--surface-hover);
  color: var(--brand);
}
.wfe-object__title {
  display: block;
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
}
.wfe-object__text {
  display: block;
  margin-top: 4px;
  font-size: 14px;
  color: var(--text-muted);
}

/* About this workflow */
.wfe-facts {
  margin: 8px 0 0;
}
.wfe-facts__row {
  display: grid;
  grid-template-columns: 180px 1fr;
  padding: 7px 0;
  font-size: 15px;
}
.wfe-facts__row dt {
  font-weight: 400;
  color: var(--text-muted);
}
.wfe-facts__row dd {
  margin: 0;
  word-break: break-all;
}

/* Manually enroll */
.wfe-records {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.wfe-record {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
}
.wfe-record input {
  margin-top: 3px;
}
.wfe-record__title {
  display: block;
  font-weight: 600;
}
.wfe-record__sub {
  display: block;
  font-size: 14px;
  color: var(--text-muted);
}

/* Choose an action */
.wfe-tiles {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin-bottom: 16px;
}
.wfe-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 12px 4px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  font-size: 12px;
  cursor: pointer;
}
.wfe-tile:hover {
  border-color: var(--brand);
}
.wfe-group-label {
  margin-bottom: 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-subtle);
}
.wfe-group {
  border-bottom: 1px solid var(--border);
}
.wfe-group__head {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 14px 0;
  border: 0;
  background: transparent;
  text-align: left;
  cursor: pointer;
}
.wfe-group__chev {
  flex-shrink: 0;
  color: var(--text-muted);
  transition: transform 0.15s ease;
}
.wfe-group__chev.is-open {
  transform: rotate(90deg);
}
.wfe-group__title {
  display: block;
  font-size: 14px;
  font-weight: 600;
}
.wfe-group__text {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
}
.wfe-actions {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 0 0 12px 24px;
}
.wfe-actions__item {
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font-size: 14px;
  text-align: left;
  cursor: pointer;
}
.wfe-actions__item:hover {
  border-color: var(--brand);
  background: var(--brand-soft);
}

/* Canvas: + on the lines, zoom */
.wfe-canvas-wrap {
  position: relative;
  flex: 1;
  display: flex;
  min-width: 0;
  min-height: 0;
}
.wfe-line {
  position: relative;
  height: 44px;
}
.wfe-plus {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 24px;
  height: 24px;
  transform: translate(-50%, -50%);
  border: 1px solid var(--border-strong);
  border-radius: 50%;
  background: var(--surface);
  color: var(--text-muted);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
}
.wfe-plus:hover {
  border-color: var(--brand);
  color: var(--brand);
}
/* A-02: the "+" between two top-level steps, and the "Configuring" spot a new step will take. */
.wfe-line--between {
  align-self: center;
  width: 2px;
  height: 32px;
  background: var(--border-strong);
}
.wfe-configuring {
  align-self: stretch;
  padding: 14px 16px;
  border: 1px dashed var(--brand);
  border-radius: var(--radius);
  background: var(--brand-soft);
  color: var(--brand);
  font-weight: 600;
  text-align: center;
}
.wfe-zoom {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: 0 1px 3px rgba(16, 24, 40, 0.08);
}
.wfe-zoom button {
  min-width: 40px;
  height: 40px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font-size: 18px;
  cursor: pointer;
}
.wfe-zoom span {
  min-width: 48px;
  text-align: center;
  font-weight: 600;
}
.wfe-zoom .wfe-zoom__reset {
  border: 0;
  color: var(--brand);
  font-size: 15px;
  font-weight: 600;
}
@media (max-width: 700px) {
  .wfe-objects {
    grid-template-columns: 1fr;
  }
}

/* Design: an orange line under the editor's top bar */
.wfe-top {
  border-bottom: 3px solid #ef6820;
}

/* Comments panel (right side) */
.wfe-panel--right {
  border-right: 0;
  border-left: 1px solid var(--border);
}
.wfe-icon-btn {
  width: 40px;
  height: 40px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font-size: 22px;
  line-height: 1;
  color: var(--text-muted);
  cursor: pointer;
}
.wfe-panel__foot--stack {
  flex-direction: column;
  align-items: stretch;
}

/* Floating canvas tools (AI, comments) */
.wfe-float {
  margin-block: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: 0 1px 3px rgba(16, 24, 40, 0.08);
}
.wfe-float button {
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text);
  cursor: pointer;
}
.wfe-float button:hover,
.wfe-float button[aria-pressed="true"] {
  background: var(--surface-hover);
}
.wfe-float button:disabled {
  color: var(--text-subtle);
  cursor: default;
  background: transparent;
}

/* View > Metrics on the trigger card */
.wfe-node__metrics {
  display: flex;
  gap: 16px;
  margin: -6px 18px 14px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  background: var(--surface-hover);
  font-size: 14px;
  color: var(--text-muted);
}
.wfe-node__metrics strong {
  color: var(--text);
}

/* Test workflow results */
.wfe-results {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 16px;
}
.wfe-result {
  display: flex;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.wfe-result svg {
  flex-shrink: 0;
  margin-top: 2px;
}
.wfe-result svg.is-ok {
  color: var(--success);
}
.wfe-result svg.is-bad {
  color: var(--danger);
}
.wfe-result strong,
.wfe-result span {
  display: block;
}
.wfe-result span {
  margin-top: 2px;
  color: var(--text-muted);
}
.wfe-result__checks {
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
}
.wfe-result__checks li {
  margin-top: 4px;
}
.wfe-result__checks .is-ok {
  color: var(--success);
}
.wfe-result__checks .is-bad {
  color: var(--danger);
}

/* Revision history (A-01) */
.wfe-revisions {
  margin: 0 0 12px;
  padding: 0;
  list-style: none;
}
.wfe-revision {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.wfe-revision > div {
  flex: 1;
  min-width: 0;
}
.wfe-revision strong,
.wfe-revision span {
  display: block;
}
.wfe-revision span {
  margin-top: 2px;
  color: var(--text-muted);
  font-size: 12px;
}

/* Connections */
.wfe-conn {
  margin-bottom: 16px;
}
.wfe-conn__title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 6px;
  font-size: 16px;
  font-weight: 700;
}
.wfe-conn__count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: var(--radius-pill);
  background: var(--panel);
  color: #fff;
  font-size: 12px;
}
.wfe-conn__list {
  margin: 0;
  padding-left: 18px;
}

/* Knowledge base */
.wfe-article {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  padding: 11px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 14px;
  text-decoration: none;
}
.wfe-article:hover {
  border-color: var(--brand);
  color: var(--brand);
}

/* Keyboard shortcuts, menu search */
.wfe-keys {
  margin: 0;
}
.wfe-keys__row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.wfe-keys__row dd {
  margin: 0;
}
.wfe-search-results {
  display: flex;
  flex-direction: column;
  max-height: 360px;
  overflow-y: auto;
}

/* Top bar: the details line under the status (type, version, owner, errors) */
.wfe-top__sub {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 2px;
  font-size: 12px;
  color: var(--text-muted);
}
.wfe-top__errors {
  padding: 1px 8px;
  border: 0;
  border-radius: var(--radius-pill);
  background: var(--danger);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}

/* ==========================================================================
   Create workflow: menu, Start from scratch, template library
   ========================================================================== */
.wfc-create { display: inline-flex; align-items: center; gap: 6px; }
.wfc-create-menu { min-width: 230px; padding: 6px 0; }
.wfc-create-menu .dropdown__item { display: flex; align-items: center; gap: 8px; width: 100%; padding: 10px 18px; font-size: 15px; }
.wfc-create-menu__soon { color: var(--text-muted); cursor: default; }
.wfc-create-menu__soon:hover { background: none; }
.wfc-soon {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 8px;
  border-radius: var(--radius-pill);
  background: #ede9fe;
  color: #6d28d9;
  font-size: 11px;
  font-weight: 700;
  vertical-align: middle;
}

.wf-bulklink { margin-left: 12px; }
.wf-bulklink:disabled { color: var(--text-subtle); cursor: not-allowed; }
.wfc-intro { margin: 0 0 16px; color: var(--text-muted); font-size: 15px; }
/* From scratch: the trigger categories (sheet row 68). */
.wfc-heading { margin: 0 0 12px; font-size: 16px; font-weight: 700; }
.wfc-search { width: 100%; margin-bottom: 14px; border-radius: var(--radius-pill); }
.wfc-tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 8px; }
.wfc-tile { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 14px 8px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface); color: var(--text); cursor: pointer; }
.wfc-tile:hover { border-color: var(--brand); background: var(--brand-soft); }
.wfc-group { border-bottom: 1px solid var(--border); }
.wfc-group__head { display: flex; width: 100%; gap: 12px; padding: 10px 2px; border: 0; background: none; color: var(--text); text-align: left; cursor: pointer; }
.wfc-group__head > span { display: flex; flex-direction: column; }
.wfc-group__head > span > span { color: var(--text-muted); font-size: 12.5px; }
/* Drawn, not typed: a character here would be read out as part of the button's name. */
.wfc-group__head::before { content: ''; align-self: center; width: 6px; height: 6px; border-top: 2px solid var(--text-muted); border-right: 2px solid var(--text-muted); transform: rotate(45deg); }
.wfc-group__head[aria-expanded='true']::before { transform: rotate(135deg); }
.wfc-group__items { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; padding: 0 0 10px; }
.wfc-group__items .wfe-type { margin: 0; }
.wfc-objects { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.wfc-object {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  color: var(--text);
  text-align: left;
  cursor: pointer;
}
.wfc-object:hover:not(:disabled) { border-color: var(--brand); }
.wfc-object.is-on { border-color: var(--brand); background: var(--brand-soft, #eef4ff); box-shadow: 0 0 0 2px var(--focus-ring, rgba(37, 99, 235, 0.15)); }
.wfc-object.is-soon { cursor: not-allowed; opacity: 0.6; }
.wfc-object__icon {
  display: grid;
  flex: none;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: var(--radius);
  background: var(--surface-hover);
  color: var(--text-muted);
}
.wfc-object__text { display: grid; gap: 4px; }
.wfc-object__text strong { font-size: 16px; }
.wfc-object__text span { color: var(--text-muted); font-size: 14px; line-height: 1.45; }
.wfc-alt { display: flex; flex-wrap: wrap; gap: 24px; margin-top: 18px; font-size: 15px; font-weight: 600; }
.wfc-alt a { display: inline-flex; align-items: center; gap: 6px; color: var(--brand); text-decoration: none; }
.wfc-alt__soon { display: inline-flex; align-items: center; gap: 6px; color: var(--text-muted); cursor: default; }
@media (max-width: 640px) {
  .wfc-objects { grid-template-columns: 1fr; }
}

.wft-page { padding: 8px 4px 32px; }
.wft-back { display: inline-flex; align-items: center; gap: 6px; margin-bottom: 18px; color: var(--brand); font-weight: 600; text-decoration: none; }
.wft-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 22px; }
.wft-head h1 { margin: 0 0 6px; font-size: 28px; }
.wft-head p { margin: 0; color: var(--text-muted); font-size: 16px; }
.wft-head__actions { display: flex; flex-wrap: wrap; gap: 10px; }
.wft-soon-btn { display: inline-flex; align-items: center; gap: 6px; color: var(--text-muted); cursor: default; }
.wft-filters { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 14px; margin-bottom: 16px; }
.wft-search { position: relative; flex: 1 1 280px; max-width: 420px; }
.wft-search .input { width: 100%; padding-right: 38px; }
.wft-search svg { position: absolute; top: 50%; right: 12px; color: var(--text-muted); transform: translateY(-50%); }
.wft-filter { display: grid; gap: 6px; min-width: 190px; font-size: 14px; font-weight: 600; }
.wft-count { margin-left: auto; padding-bottom: 10px; color: var(--text-muted); font-size: 14px; }
.wft-chips { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 22px; }
.wft-chip {
  padding: 8px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.wft-chip:hover { border-color: var(--border-strong); }
.wft-chip.is-on { border-color: var(--text); background: var(--text); color: var(--surface); }
.wft-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 20px; }
.wft-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 22px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  color: var(--text);
  text-align: left;
  cursor: pointer;
}
.wft-card:hover, .wft-card.is-active { border-color: var(--brand); }
.wft-card__icons { display: flex; gap: 8px; }
.wft-kind, .wft-step__icon {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: var(--surface-hover);
  color: var(--text-muted);
}
.wft-kind--email, .wft-step--email .wft-step__icon, .wft-kind--notify, .wft-step--notify .wft-step__icon { background: #e8f0fe; color: #2563eb; }
.wft-kind--task, .wft-step--task .wft-step__icon, .wft-kind--edit, .wft-step--edit .wft-step__icon { background: #e7f6ee; color: #15803d; }
.wft-card__title { font-size: 19px; line-height: 1.3; }
.wft-card__by { color: var(--text-muted); font-size: 14px; }
.wft-card__text {
  display: -webkit-box;
  overflow: hidden;
  color: var(--text);
  font-size: 15px;
  line-height: 1.45;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}
.wft-card__tags { display: flex; flex-wrap: wrap; gap: 8px; }
.wft-tag { padding: 3px 10px; border-radius: 6px; background: var(--surface-hover); color: var(--text); font-size: 13px; font-weight: 600; }
.wft-tag--object { background: #e8f0fe; color: #1d4ed8; }
.wft-empty { padding: 48px 16px; border: 1px dashed var(--border); border-radius: var(--radius-lg); text-align: center; }

.wft-preview__name { margin: 0 0 6px; font-size: 20px; }
.wft-preview__text { margin: 0 0 12px; color: var(--text-muted); font-size: 15px; }
.wft-preview__heading { margin: 20px 0 12px; font-size: 16px; font-weight: 700; }
.wft-preview__note { margin: 16px 0 0; color: var(--text-muted); font-size: 14px; }
.wft-flow { display: flex; flex-direction: column; align-items: stretch; }
.wft-flow__item { position: relative; display: flex; flex-direction: column; }
.wft-flow__item + .wft-flow__item::before {
  display: block;
  width: 2px;
  height: 18px;
  margin: 0 auto;
  background: var(--border-strong);
  content: '';
}
.wft-step {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-left: 4px solid #15803d;
  border-radius: var(--radius);
  background: var(--surface);
}
.wft-step--trigger { border-left-color: #f59e0b; }
.wft-step--trigger .wft-step__icon { background: #fff4e5; color: #d97706; }
.wft-step--branch, .wft-step--delay { border-left-color: var(--text-muted); }
.wft-step div { display: grid; gap: 3px; }
.wft-step strong { font-size: 15px; }
.wft-step span:not(.wft-step__icon) { color: var(--text-muted); font-size: 14px; }
.wft-branch { display: grid; gap: 10px; margin: 10px 0 0 22px; padding-left: 14px; border-left: 2px dashed var(--border); }
.wft-branch__path { display: grid; gap: 6px; }
.wft-branch__label { font-size: 13px; font-weight: 700; }
.wft-branch__none { color: var(--text-muted); font-size: 13px; }
.wft-end {
  align-self: center;
  padding: 6px 18px;
  border-radius: var(--radius-pill);
  background: var(--text);
  color: var(--surface);
  font-size: 13px;
  font-weight: 700;
}

/* ==========================================================================
   Automation go-live (HUB-746)
   ========================================================================== */
.wfe-canvas-wrap { background: var(--surface-2); }

/* Branches side by side (AUT-27, go-live 943), joined to their node by lines. */
.wfe-steps { width: max-content; min-width: min(620px, 100%); }
.wfe .wfe-steps .step { width: 100%; max-width: 600px; margin-inline: auto; }
/* A branch is as wide as its paths, so the panel around the steps holds them. Its own card
   stays centred over them, with its number beside it. */
.wfe .wfe-steps .step.step--branch {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: max-content;
  min-width: 100%;
  max-width: none;
  gap: 0;
}
.wfe .step--branch > .step__card { width: 460px; }
.wfe .step--branch > .step__num { position: absolute; top: 0; left: calc(50% - 286px); }
.wfe .step__lanes {
  position: relative;
  display: flex;
  align-self: stretch;
  justify-content: center;
  align-items: stretch;
  gap: 24px;
  padding-top: 28px;
}
.wfe .step__lanes::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  width: 2px;
  height: 14px;
  background: var(--border-strong);
}
.wfe .step__lane {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 340px;
  flex: 0 0 auto;
  padding: 10px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
}
.wfe .step__lane:has(.step--branch) { width: max-content; min-width: 340px; }
.wfe .step__lane .step:not(.step--branch) { max-width: 318px; }
/* In a path's narrow column: no number column, and the step's buttons under its title. */
.wfe .step__lane .step:not(.step--branch) { grid-template-columns: minmax(0, 1fr); }
.wfe .step__lane .step:not(.step--branch) > .step__num { display: none; }
.wfe .step__lane .step__card > div:first-child { flex-wrap: wrap; }
.wfe .step__lane .step__card > div:first-child > button:first-child { flex-basis: 100%; }
.wfe .step__lane .step--branch { padding-inline: 48px; }
.wfe .step__lane .step--branch > .step__card { width: 318px; }
.wfe .step__lane .step--branch > .step__num { left: calc(50% - 215px); }
.wfe .step__lane::before {
  content: '';
  position: absolute;
  top: -15px;
  left: 50%;
  width: 2px;
  height: 14px;
  background: var(--border-strong);
}
.wfe .step__lane::after {
  content: '';
  position: absolute;
  top: -15px;
  left: -13px;
  right: -13px;
  height: 2px;
  background: var(--border-strong);
}
.wfe .step__lane:first-child::after { left: 50%; }
.wfe .step__lane:last-child::after { right: 50%; }
.wfe .step__lane-label {
  align-self: center;
  max-width: 100%;
  padding: 3px 12px;
  border: 1px solid var(--brand);
  border-radius: var(--radius-pill);
  background: var(--brand-soft);
  color: var(--brand-ink);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
}

/* The way the last test took (go-live 944). */
.wfe .step__card.is-traced { border-color: var(--success); box-shadow: 0 0 0 2px var(--success-bg); }
.wfe .step__lane.is-taken { border: 2px solid var(--success); }
.wfe .step__lane.is-taken > .step__lane-label {
  border-color: var(--success);
  background: var(--success-bg);
  color: var(--success);
}
.wfe-trace-note {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 6px;
  border: 1px solid var(--success);
  border-radius: var(--radius);
  text-align: center;
  background: var(--surface);
  color: var(--text);
  font-size: 12.5px;
}
.wfe-taken { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 0; padding: 0; list-style: none; }
.wfe-taken li {
  padding: 2px 10px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-pill);
  color: var(--text-muted);
  font-size: 12px;
}
.wfe-taken li.is-taken {
  border: 1px solid var(--success);
  background: var(--success-bg);
  color: var(--success);
  font-weight: 700;
}

/* Go-live 952: the canvas tools, in a column beside the canvas: nothing lies on a card. */
.wfe-side {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  width: 80px;
  flex: 0 0 auto;
  min-height: 0;
  padding: 12px 8px;
  overflow: hidden auto;
  border-left: 1px solid var(--border);
}
/* With the minimap it is as wide as the map, and the zoom fits in one row. */
.wfe-side--map { width: 212px; }
.wfe-side--map .wfe-zoom { flex-direction: row; gap: 2px; }
.wfe-side--map .wfe-zoom button { min-width: 34px; height: 34px; }
.wfe-side--map .wfe-zoom .wfe-zoom__reset { min-width: 0; padding: 0 6px; }

/* Minimap (go-live 943). */
.wfe-minimap {
  flex: 0 0 auto;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.wfe-minimap__head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
}
.wfe-minimap__head button { border: 0; background: none; color: inherit; cursor: pointer; }
.wfe-minimap svg { display: block; cursor: pointer; touch-action: none; }
.wfe-minimap__node { fill: var(--border-strong); }
.wfe-minimap__node.is-trigger { fill: var(--accent); }
.wfe-minimap__node.is-step { fill: var(--brand); opacity: 0.7; }
.wfe-minimap__node.is-bad { fill: var(--danger); }
.wfe-minimap__node.is-traced { fill: var(--success); }
.wfe-minimap__view { fill: var(--brand-soft); fill-opacity: 0.35; stroke: var(--brand); stroke-width: 1.5; }

.wfe-history { display: flex; gap: 2px; margin-left: 8px; padding-left: 8px; border-left: 1px solid var(--border); }
.wfe-history .wfe-menu-btn { display: inline-flex; align-items: center; gap: 5px; }
.wfe-history .wfe-menu-btn:disabled { opacity: 0.45; cursor: default; }

/* A narrow builder: the top bar keeps each button on one line. */
.wfe-top__end { flex-wrap: nowrap; }

/* Pop-up messages in the builder: in the empty left of the top bar, so they never lie on a
   card (go-live 952). With a drawer or dialog open they stay at the bottom, off its contents. */
body:has(.wfe):not(:has(.modal-backdrop.is-open)) .toast-region {
  left: 112px;
  right: auto;
  top: 10px;
  bottom: auto;
  transform: none;
  justify-items: start;
  max-width: 320px;
}
body:has(.wfe) .toast-region a { flex: none; white-space: nowrap; }

/* Action picker: the groups' icons (go-live 951). */
.wfe-group__icon {
  display: grid;
  flex: none;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 1px solid currentColor;
  border-radius: 50%;
}
[data-theme="dark"] .wfe-group__icon { filter: brightness(1.7); }
.wfe-actions__item:disabled { opacity: 0.5; cursor: not-allowed; }

.wfe-code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; white-space: pre; }

/* Settings: choosing suppression lists (go-live 950). */
.wfs-picker { display: flex; flex-direction: column; gap: 8px; }
.wfs-picker__tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; list-style: none; }
.wfs-picker__tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 6px 3px 10px;
  border-radius: var(--radius-pill);
  background: var(--brand-soft);
  color: var(--brand-ink);
  font-size: 12.5px;
  font-weight: 600;
}
.wfs-picker__tag button { border: 0; background: none; color: inherit; font-size: 15px; line-height: 1; cursor: pointer; }
.wfs-picker__options {
  max-height: 190px;
  margin: 0;
  padding: 4px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  list-style: none;
}
.wfs-picker__options button {
  width: 100%;
  padding: 6px 8px;
  border: 0;
  border-radius: var(--radius-sm);
  background: none;
  color: var(--text);
  font-size: 13px;
  text-align: left;
  cursor: pointer;
}
.wfs-picker__options button:hover { background: var(--surface-hover); }

/* Workflows list: breadcrumbs of an open folder (go-live 954). */
.wf-crumbs { padding: 10px 16px 0; font-size: 13px; }
.wf-crumbs ol { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; list-style: none; }
.wf-crumbs li + li::before { content: '\203A'; margin-right: 6px; color: var(--text-muted); }
.wf-crumbs li[aria-current="page"] { font-weight: 700; }

/* The checkbox and Name stay while the table scrolls sideways (go-live 948). */
@media (min-width: 769px) {
  .wf-table th:nth-child(1),
  .wf-table td:nth-child(1),
  .wf-table th:nth-child(2),
  .wf-table td:nth-child(2) {
    position: sticky;
    z-index: 2;
    background: var(--surface);
  }
  .wf-table th:nth-child(1),
  .wf-table td:nth-child(1) { left: 0; width: 44px; min-width: 44px; max-width: 44px; }
  .wf-table th:nth-child(2),
  .wf-table td:nth-child(2) { left: 44px; box-shadow: inset -1px 0 0 var(--border); }
  .wf-table thead th:nth-child(-n + 2) { z-index: 3; }
  /* The hover colour over an opaque base, so scrolled cells don't show through. */
  .wf-table tbody tr:hover td:nth-child(-n + 2) {
    background: linear-gradient(var(--surface-hover), var(--surface-hover)), var(--surface);
  }
  /* A row's open menu is above the frozen cells of the rows under it. */
  .wf-table tbody td:nth-child(2):has(.dropdown__menu) { z-index: 4; }
}

/* Overview (go-live 953): recent workflows in a list, so names aren't cut off. */
.wf-recent {
  grid-auto-flow: row;
  grid-auto-columns: auto;
  grid-template-columns: minmax(0, 1fr);
  max-height: 190px;
  overflow-x: hidden;
  overflow-y: auto;
  scroll-snap-type: none;
}
.wf-recent__card { min-height: 0; }
.wf-recent__name { display: block; overflow: visible; overflow-wrap: anywhere; -webkit-line-clamp: unset; }
/* The date range's menu opens leftwards from the right edge, never past it. */
.wf-range-select .custom-select__dropdown { left: auto; right: 0; }
.wf-prompt__input:disabled { cursor: default; opacity: 0.75; }
