/* Workflows: the list, and the builder (top bar, vertical canvas of trigger and step cards with
   side-by-side paths, the side panel, and enrollment history). */
.wf-back { justify-self: start; margin-bottom: 10px; }
.wf-back svg { transform: rotate(180deg); }

/* ---------- list ---------- */
.wf-list-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.wf-list-head p { margin: 0; }
.wf-list { padding: 4px; display: grid; }
.wf-row { display: grid; grid-template-columns: 36px minmax(0, 1fr) auto 90px 20px; align-items: center; gap: 14px; width: 100%; padding: 12px 14px;
  border: 0; background: transparent; text-align: left; cursor: pointer; color: var(--text); font: inherit; border-radius: 10px; }
.wf-row + .wf-row { border-top: 1px solid var(--border); border-radius: 0; }
.wf-row:hover { background: var(--surface); border-radius: 10px; }
.wf-row:hover + .wf-row { border-top-color: transparent; }
.wf-row-icon { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: var(--surface); color: var(--muted); }
.wf-row-icon.is-live { background: var(--brand-tint); color: var(--brand-ink); }
.wf-row-icon svg { width: 18px; height: 18px; }
.wf-row-main, .wf-row-runs { display: grid; gap: 2px; min-width: 0; font-size: 13.5px; }
.wf-row-main b { font-size: 14.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wf-row-main small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wf-row small { color: var(--muted); font-size: 12px; }
.wf-row-runs { text-align: right; }
.wf-row-runs b { font-size: 15px; }
.wf-row-go { color: var(--faint); display: grid; place-items: center; }
.wf-row-go svg { width: 16px; height: 16px; }
@media (max-width: 700px) {
  .wf-row { grid-template-columns: 36px minmax(0, 1fr) auto; }
  .wf-row-runs, .wf-row-go { display: none; }
}

/* ---------- builder: top bar ---------- */
.fb { display: grid; gap: 12px; }
.fb-top { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.fb-top .grow { flex: 1; }
.fb-back svg { transform: rotate(180deg); }
.fb-name { font: 700 18px/1.2 var(--font-head, inherit); color: var(--text); border: 1px solid transparent; background: transparent; border-radius: var(--r-ctl);
  padding: 5px 8px; min-width: 120px; max-width: 360px; width: 26ch; }
.fb-name:hover:not([readonly]) { border-color: var(--border); }
.fb-name:focus { outline: none; border-color: var(--brand); background: var(--card); }
.fb-save { font-size: 12px; white-space: nowrap; }
.fb-tabs { margin: 0; border-bottom: 0; }
.fb-pub button[aria-pressed="true"][data-pub="published"] { background: var(--good-tint); color: var(--good-ink); }
.fb-note { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--warn-ink); background: var(--warn-tint); border-radius: var(--r-ctl); padding: 7px 12px; }
.fb-note svg { width: 15px; height: 15px; flex: none; }

/* ---------- builder: canvas ---------- */
.fb-canvas { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-card); padding: 28px 16px 40px; overflow: auto; min-height: 420px;
  background-image: radial-gradient(var(--border) 1px, transparent 1px); background-size: 18px 18px; }
.fb-tree { display: flex; flex-direction: column; align-items: center; min-width: min-content; }
.fb-triggers { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; max-width: 900px; }
.fb-node { display: flex; align-items: center; gap: 10px; width: 300px; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--border);
  background: var(--card); box-shadow: var(--shadow-1); text-align: left; cursor: pointer; color: var(--text); font: inherit; flex-wrap: wrap; position: relative; }
.fb-node:hover { border-color: var(--border-strong); box-shadow: var(--shadow-2); }
.fb-node.is-sel { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-tint-strong); }
.fb-node.is-off { opacity: .6; }
.fb-node.is-missing { border-color: var(--bad); }
.fb-node-icon { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; background: var(--brand-tint); color: var(--brand-ink); flex: none; }
.fb-node-icon svg { width: 16px; height: 16px; }
.fb-node-main { display: grid; gap: 1px; min-width: 0; flex: 1; }
.fb-node-main small { font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.fb-node-main b { font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fb-node-main span { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fb-node .pill { font-size: 10.5px; padding: 1px 7px; }
.fb-trigger { border-top: 3px solid var(--accent); }
.fb-trigger .fb-node-icon { background: var(--good-tint); color: var(--good-ink); }
.fb-add-trigger { justify-content: center; border: 1.5px dashed var(--border-strong); background: transparent; box-shadow: none; color: var(--muted); font-weight: 600; min-height: 56px; border-top-width: 1.5px; }
.fb-add-trigger:hover { color: var(--brand-ink); border-color: var(--brand); background: var(--card); }
.fb-add-trigger svg { width: 16px; height: 16px; }
.fb-g-workflow .fb-node-icon { background: var(--info-tint); color: var(--info-ink); }
.fb-g-contact .fb-node-icon, .fb-g-opportunities .fb-node-icon { background: var(--accent-tint, var(--good-tint)); color: var(--accent-ink, var(--good-ink)); }
.fb-g-portal .fb-node-icon { background: var(--warn-tint); color: var(--warn-ink); }

.fb-line { position: relative; width: 2px; height: 46px; background: var(--border-strong); display: grid; place-items: center; }
.fb-plus { position: absolute; width: 24px; height: 24px; border-radius: 50%; border: 1px solid var(--border-strong); background: var(--card); color: var(--muted);
  display: grid; place-items: center; cursor: pointer; padding: 0; transition: transform .12s var(--ease); }
.fb-plus svg { width: 13px; height: 13px; }
.fb-plus:hover { background: var(--brand); color: var(--brand-on); border-color: var(--brand); transform: scale(1.12); }
.fb-end { font: 700 11px/1 var(--font-body, inherit); letter-spacing: .08em; color: var(--muted); background: var(--card); border: 1px solid var(--border); border-radius: 99px; padding: 6px 14px; }

.fb-branches { display: flex; gap: 22px; align-items: flex-start; padding-top: 14px; position: relative; }
.fb-branch::after { content: ''; position: absolute; top: -14px; left: -11px; right: -11px; height: 2px; background: var(--border-strong); }
.fb-branch:first-child::after { left: 50%; }
.fb-branch:last-child::after { right: 50%; }
.fb-branch:only-child::after { display: none; }
.fb-branch { display: flex; flex-direction: column; align-items: center; position: relative; }
.fb-branch::before { content: ''; position: absolute; top: -14px; left: 50%; width: 2px; height: 14px; background: var(--border-strong); }
.fb-branch-label { font-size: 12px; font-weight: 700; color: var(--brand-ink); background: var(--brand-tint); border-radius: 99px; padding: 4px 12px; max-width: 280px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fb-branch .fb-node { width: 260px; }

/* ---------- side panel ---------- */
.fb-drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(440px, 100vw); background: var(--card); border-left: 1px solid var(--border); box-shadow: var(--shadow-3);
  z-index: 60; display: flex; flex-direction: column; animation: fb-in .16s var(--ease); }
@keyframes fb-in { from { transform: translateX(24px); opacity: 0; } to { transform: none; opacity: 1; } }
.fb-drawer-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; padding: 16px 18px 12px; border-bottom: 1px solid var(--border); }
.fb-drawer-head h2 { font-size: 16px; }
.fb-drawer-head p { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.fb-drawer-body { flex: 1; overflow: auto; padding: 14px 18px 20px; display: grid; gap: 14px; align-content: start; }
.fb-drawer-body > p.muted { margin: 0; font-size: 13px; }
.fb-drawer-foot { display: flex; align-items: center; gap: 6px; padding: 12px 18px; border-top: 1px solid var(--border); }
.fb-drawer-foot .grow { flex: 1; }
.fb-drawer .icon-btn:disabled { opacity: .3; cursor: default; }
.fb-danger { color: var(--bad-ink); }
.fb-danger:hover { background: var(--bad-tint) !important; }
.fb-textarea { height: auto; padding: 8px 12px; resize: vertical; min-height: 80px; }
.fb-req { color: var(--bad-ink); }
.fb-sub { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 2px 0 -4px; }
.fb-check { display: flex; align-items: center; gap: 8px; font-size: 13px; cursor: pointer; }
.fb-check small { font-size: 12px; }
.fb-callout { display: flex; gap: 8px; align-items: flex-start; font-size: 12.5px; padding: 9px 11px; border-radius: var(--r-ctl); background: var(--surface); border: 1px solid var(--border); }
.fb-callout.is-warn { background: var(--warn-tint); border-color: transparent; color: var(--warn-ink); }
.fb-callout svg { width: 15px; height: 15px; flex: none; margin-top: 1px; }
.fb-hint { font-size: 12px; margin: 0; }

.fb-search { position: sticky; top: -14px; z-index: 1; }
.fb-pick { display: grid; gap: 14px; }
.fb-pick-group h3 { font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: 6px; }
.fb-pick-group { display: grid; gap: 4px; }
.fb-pick-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 1px solid transparent; border-radius: 10px; background: transparent;
  text-align: left; cursor: pointer; color: var(--text); font: inherit; }
.fb-pick-item:hover { background: var(--surface); border-color: var(--border); }
.fb-pick-item .grow { display: grid; gap: 1px; min-width: 0; flex: 1; }
.fb-pick-item b { font-size: 13.5px; }
.fb-pick-item small { font-size: 12px; color: var(--muted); }
.fb-pick-item .pill { font-size: 10.5px; padding: 1px 7px; white-space: nowrap; }
.fb-pick-item > svg { width: 14px; height: 14px; color: var(--faint); }
.fb-results { display: grid; gap: 2px; max-height: 280px; overflow: auto; }

.fb-rules { display: grid; gap: 10px; }
.fb-rule { border: 1px solid var(--border); border-radius: 10px; padding: 10px; display: grid; gap: 8px; background: var(--surface); }
.fb-rule-head { display: flex; gap: 6px; align-items: center; }
.fb-rule-head .input:first-child { flex: 1; font-weight: 600; }
.fb-andor { width: auto; }
.fb-clause { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr) minmax(0, 1fr) 28px; gap: 6px; align-items: center; }
.fb-clause .input { min-width: 0; height: 34px; padding-left: 8px; padding-right: 4px; }
.fb-clause .icon-btn { width: 28px; height: 28px; }
[data-paths] .fb-clause { grid-template-columns: minmax(0, 1fr) 80px 16px 28px; }
.fb-rule .btn, .fb-rules > .btn { justify-self: start; }

/* ---------- settings + history ---------- */
.fb-settings { padding: 18px 20px; display: grid; gap: 20px; max-width: 720px; }
.fb-settings section { display: grid; gap: 8px; }
.fb-settings h3 { font-size: 14px; }
.fb-settings p { margin: 0; font-size: 13px; }
.fb-goals { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 6px; }
.fb-hist-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.fb-hist { overflow: auto; }
.fb-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.fb-table th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: 10px 14px; border-bottom: 1px solid var(--border); }
.fb-table td { padding: 10px 14px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.fb-table tbody tr { cursor: pointer; }
.fb-table tbody tr:hover { background: var(--surface); }
.fb-table tbody tr:last-child td { border-bottom: 0; }
.fb-run-head { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.fb-run-head .btn { margin-left: auto; }
.fb-log { list-style: none; margin: 0; padding: 0; display: grid; }
.fb-log li { display: grid; grid-template-columns: 14px 1fr; gap: 10px; position: relative; padding-bottom: 14px; }
.fb-log li:not(:last-child)::before { content: ''; position: absolute; left: 6px; top: 14px; bottom: 0; width: 2px; background: var(--border); }
.fb-log-dot { width: 14px; height: 14px; border-radius: 50%; background: var(--border-strong); margin-top: 2px; }
.fb-log li > div { display: grid; gap: 2px; font-size: 13px; min-width: 0; }
.fb-log li span { color: var(--text); overflow-wrap: anywhere; }
.fb-log li small { font-size: 11.5px; }
.fb-log .tone-good .fb-log-dot { background: var(--good); }
.fb-log .tone-warn .fb-log-dot { background: var(--warn); }
.fb-log .tone-info .fb-log-dot { background: var(--info); }
.fb-log .tone-bad .fb-log-dot { background: var(--bad); }
.fb-log .tone-brand .fb-log-dot { background: var(--brand); }

@media (max-width: 760px) {
  .fb-node { width: 260px; }
  .fb-branch .fb-node { width: 220px; }
  .fb-name { width: 100%; max-width: none; }
}
.fb-drawer-body > .btn { justify-self: start; }
