/* Nova dashboard — clean white + grey sidebar, mirroring Viktor's layout. */

:root {
  --bg: #fafafa;
  --surface: #ffffff;
  --border: #e6e6e6;
  --border-strong: #d0d0d0;
  --text: #1a1a1a;
  --text-subtle: #6b6b6b;
  --text-faint: #999;
  --accent: #1a1a1a;
  --accent-hover: #2a2a2a;
  --danger: #c0392b;
  --danger-bg: #fde8e6;
  --connected: #2e7d32;
  --connected-bg: #e7f3e8;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
  --radius: 8px;
  --radius-lg: 12px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---- layout ---- */
.layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100vh;
}

.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 24px 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand {
  font-size: 20px;
  font-weight: 700;
  padding: 4px 8px 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: inherit;
}
.brand-logo {
  /* Hard cap so the wide source PNG can't stretch the sidebar.
   * Drop border-radius — the PNG has its own padding/background and
   * rounding it makes the icon look like a clickable button. */
  width: 28px !important;
  height: 28px !important;
  max-width: 28px;
  max-height: 28px;
  object-fit: contain;
  flex: 0 0 auto;
  display: block;
}
.brand-name { line-height: 1; }

.brand-large {
  font-size: 32px;
  font-weight: 700;
  margin-bottom: 8px;
}
.signin-logo {
  width: 64px;
  height: 64px;
  max-width: 64px;
  max-height: 64px;
  object-fit: contain;
  margin-bottom: 14px;
  display: inline-block;
}

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

.nav-item {
  padding: 8px 12px;
  border-radius: var(--radius);
  font-size: 14px;
  color: var(--text-subtle);
  transition: background 0.1s, color 0.1s;
}
.nav-item:hover {
  background: var(--bg);
  color: var(--text);
  text-decoration: none;
}
.nav-item.active {
  background: #1a1a1a;
  color: #fff;
}
.nav-item.small { font-size: 13px; padding: 6px 12px; }

.nav-footer {
  margin-top: auto;
  border-top: 1px solid var(--border);
  padding-top: 12px;
}

.user-chip {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 12px 8px 4px;
}
.user-chip-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f0e6d8;
  font-weight: 600;
  color: #6b4f2c;
  flex-shrink: 0;
}
.user-chip-avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.user-chip-meta { min-width: 0; flex: 1; }
.user-chip-name { font-weight: 600; font-size: 13px; }
.user-chip-email {
  font-size: 12px;
  color: var(--text-faint);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.main {
  padding: 32px 40px;
  max-width: 1100px;
}

.main-unauth {
  max-width: 480px;
  margin: 80px auto;
  padding: 40px;
}

/* ---- page header ---- */
.page-header { margin-bottom: 24px; }
.page-header h1 { font-size: 24px; font-weight: 700; margin: 0 0 4px; }
.page-header-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 24px;
}
.subtle { color: var(--text-subtle); }
.success-card { border-color: var(--connected); background: #fcfffc; }

.alert-success {
  background: var(--connected-bg);
  color: var(--connected);
  border-color: var(--connected);
}
.alert-success a { text-decoration: underline; }
.connect-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* ---- card ---- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 20px;
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.card-header h2 { font-size: 16px; margin: 0; }
.card-action { font-size: 13px; color: var(--text-subtle); }

.card.danger { border-color: var(--danger); }
.card.danger h2 { color: var(--danger); }

.grid { display: grid; gap: 20px; }
.two-col { grid-template-columns: 1fr 1fr; }

/* ---- buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  background: var(--accent);
  color: #fff;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.1s;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-ghost {
  background: transparent;
  border-color: var(--border-strong);
  color: var(--text);
}
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #a32f23; }
.btn-danger-ghost {
  background: transparent;
  border-color: var(--danger);
  color: var(--danger);
}
.btn-danger-ghost:hover { background: var(--danger-bg); }
.btn-small { padding: 4px 10px; font-size: 13px; }

.button-row { display: flex; gap: 8px; }

/* ---- sign-in ---- */
.signin-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 40px;
  text-align: center;
  box-shadow: var(--shadow-sm);
}
.signin-card .lede {
  color: var(--text-subtle);
  margin: 8px 0 24px;
}
.signin-card .btn {
  width: 100%;
  padding: 12px 16px;
  font-size: 15px;
}
.signin-help {
  margin-top: 20px;
  font-size: 13px;
  color: var(--text-subtle);
}
.slack-mark {
  width: 18px;
  height: 18px;
  background:
    linear-gradient(45deg, #36C5F0 0 50%, #ECB22E 50% 100%);
  border-radius: 3px;
  display: inline-block;
}

/* ---- alert ---- */
.alert {
  background: var(--danger-bg);
  color: var(--danger);
  border: 1px solid var(--danger);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: 16px;
  font-size: 13px;
}

/* ---- integrations ---- */
.integrations-toolbar {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.search {
  padding: 10px 14px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  font-size: 14px;
  width: 320px;
  background: var(--surface);
}
.toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-subtle);
}

.integrations-body {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 20px;
  align-items: start;
}

.category-sidebar {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 12px 8px;
  position: sticky;
  top: 16px;
  max-height: calc(100vh - 32px);
  overflow-y: auto;
}
.category-sidebar-title {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-faint);
  padding: 6px 10px 10px;
}
.category-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.category-item {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border: none;
  background: transparent;
  border-radius: var(--radius);
  color: var(--text-subtle);
  font-size: 13px;
  text-align: left;
  cursor: pointer;
  transition: background 0.1s, color 0.1s;
}
.category-item:hover {
  background: var(--bg);
  color: var(--text);
}
.category-item.active {
  background: #1a1a1a;
  color: #fff;
}
.category-count {
  font-size: 12px;
  color: inherit;
  opacity: 0.7;
  background: rgba(255,255,255,0.08);
  padding: 1px 8px;
  border-radius: 999px;
}
.category-item:not(.active) .category-count {
  background: var(--bg);
}

.tab-group {
  display: inline-flex;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
}
.tab {
  padding: 8px 14px;
  border: none;
  background: transparent;
  font-size: 13px;
  color: var(--text-subtle);
  cursor: pointer;
}
.tab + .tab { border-left: 1px solid var(--border); }
.tab.active {
  background: #1a1a1a;
  color: #fff;
}

.integration-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
  min-height: 200px;
}
.integration-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.integration-card.connected {
  border-color: var(--connected);
  background: #fcfffc;
}
.integration-card-head { display: flex; gap: 12px; align-items: center; }
.integration-icon {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  font-weight: 700;
  font-size: 14px;
}
.integration-icon img { width: 100%; height: 100%; object-fit: cover; border-radius: 6px; }
.integration-name { font-weight: 600; font-size: 14px; }
.integration-desc {
  font-size: 13px;
  color: var(--text-subtle);
  margin: 0;
  min-height: 36px;
}
.integration-row { display: flex; gap: 8px; flex-wrap: wrap; }
.integration-chip {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  font-size: 13px;
}
.integration-chip img { width: 16px; height: 16px; border-radius: 3px; }

/* ---- files ---- */
.files-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.files-table th,
.files-table td {
  text-align: left;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}
.files-table th {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-subtle);
  background: var(--bg);
}
.files-table tbody tr:last-child td { border-bottom: none; }

.file-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.file-list li {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}
.file-list li:last-child { border-bottom: none; }

.tool-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.tool-list li {
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fbfbfb;
}
.tool-name { font-weight: 600; font-size: 14px; }
.tool-desc { color: var(--text-subtle); font-size: 13px; margin-top: 4px; }
.tool-args {
  display: block;
  margin-top: 6px;
  font-size: 12px;
  color: #555;
  word-break: break-word;
}
.integration-icon-inline {
  width: 20px;
  height: 20px;
  border-radius: 4px;
  vertical-align: middle;
  margin-right: 6px;
}

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}
.badge-admin       { background: #fde8e6; color: var(--danger); }
.badge-member      { background: var(--bg); color: var(--text-subtle); }
.badge-active      { background: #e7f3e8; color: var(--connected); }
.badge-archived    { background: var(--bg); color: var(--text-faint); }

/* Skill editor */
.skill-form .form-row { margin-bottom: 16px; }
.form-label { font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.form-input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  font-size: 14px;
  background: var(--surface);
}
.form-input.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; }
.form-input[readonly] { background: var(--bg); color: var(--text-subtle); cursor: not-allowed; }
.form-help { font-size: 12px; color: var(--text-faint); margin-top: 4px; }
/* Inline edit: fields look like text until you hover/focus. */
/* ---- Langfuse-style skill editor ---- */
.skill-editor {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 24px;
  align-items: start;
}
.skill-versions {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 8px;
  position: sticky;
  top: 16px;
  max-height: calc(100vh - 32px);
  overflow-y: auto;
}
.skill-versions-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 10px 10px;
}
.skill-versions-title {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-faint);
  font-weight: 600;
}
.skill-version-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.skill-version-row {
  display: block;
  padding: 10px 12px;
  border-radius: var(--radius);
  text-decoration: none;
  color: inherit;
  border: 1px solid transparent;
}
.skill-version-row:hover { background: var(--bg); text-decoration: none; }
.skill-version-row.active { background: var(--bg); border-color: var(--border-strong); }
.skill-version-row-top { display: flex; align-items: center; gap: 8px; }
.skill-version-meta { font-size: 11px; margin-top: 4px; line-height: 1.4; }

.skill-main { min-width: 0; }
.skill-main-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 4px;
}
.skill-main-title { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.skill-name-input {
  font-size: 22px;
  font-weight: 700;
  border: 1px solid transparent;
  background: transparent;
  padding: 4px 8px;
  border-radius: var(--radius);
  color: inherit;
  min-width: 0;
  flex: 1;
}
.skill-name-input:hover:not(:disabled) { background: var(--bg); }
.skill-name-input:focus { background: var(--surface); border-color: var(--border-strong); outline: none; }
.skill-name-input:disabled { color: var(--text); opacity: 1; }

.skill-subhead { margin: 0 0 20px 8px; }

.skill-field { margin-bottom: 20px; }
.skill-field-label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 4px;
}
.skill-field-help {
  font-size: 13px;
  color: var(--text-subtle);
  margin: 0 0 8px;
  line-height: 1.5;
}
.skill-input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  font-size: 14px;
  background: var(--surface);
  color: var(--text);
}
.skill-input:disabled { background: var(--bg); color: var(--text-subtle); }
.skill-body-editor {
  width: 100%;
  min-height: 420px;
  padding: 16px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 14px;
  line-height: 1.6;
  resize: vertical;
  background: var(--surface);
  color: var(--text);
}
.skill-body-editor:read-only { background: var(--bg); }
.skill-danger-row {
  display: flex;
  gap: 8px;
  margin-top: 28px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.inline-edit {
  width: 100%;
  padding: 6px 8px;
  margin: 0;
  border: 1px solid transparent;
  background: transparent;
  font: inherit;
  color: inherit;
  border-radius: var(--radius);
  transition: background 0.1s, border-color 0.1s;
}
.inline-edit:hover { background: var(--bg); }
.inline-edit:focus {
  background: var(--surface);
  border-color: var(--border-strong);
  outline: none;
}
.inline-edit-h1 {
  font-size: 24px;
  font-weight: 700;
  padding: 4px 8px;
  margin: -4px -8px 0;
}

.alert-info {
  background: #eaf3ff;
  color: #1a4d8c;
  border-color: #b0d0ee;
}

/* Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}
.modal {
  background: var(--surface);
  border-radius: var(--radius-lg);
  max-width: 90vw;
  width: 480px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 12px 40px rgba(0,0,0,0.18);
}
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.modal-header h2 { margin: 0; font-size: 16px; }
.modal-close {
  background: none;
  border: none;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  color: var(--text-subtle);
  text-decoration: none;
}
.modal-body { padding: 20px; overflow: auto; flex: 1; }

/* Side-by-side diff modal */
.modal-wide { max-width: 90vw; width: 1000px; }
.diff-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.diff-pane {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.diff-pane-title {
  background: var(--bg);
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-subtle);
  border-bottom: 1px solid var(--border);
}
.diff-pane-body {
  margin: 0;
  padding: 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 60vh;
  overflow: auto;
}
.diff-eq  { color: var(--text); }
.diff-add { background: #e6ffe6; color: #1a6b1a; padding: 0 2px; display: block; }
.diff-del { background: #ffeaea; color: #8c1a1a; padding: 0 2px; display: block; text-decoration: line-through; opacity: 0.85; }

.modal-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.form-textarea {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  font-size: 13px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  line-height: 1.55;
  resize: vertical;
  background: var(--surface);
}

.skill-body {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-wrap: break-word;
  margin: 0;
}

.version-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 12px; }
.version-list li {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  background: var(--surface);
}
.version-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.version-body summary { cursor: pointer; margin-top: 6px; font-size: 12px; }
.version-body[open] summary { margin-bottom: 8px; }
.badge-admin-small {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 6px;
  border-radius: 999px;
  background: #fde8e6;
  color: var(--danger);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  vertical-align: middle;
}

code {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 1px 6px;
  font-size: 0.9em;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

/* ── Memory section ─────────────────────────────────────────────── */
.memory-toolbar { margin: 4px 0 14px; }
.memory-list { display: flex; flex-direction: column; gap: 12px; }
.memory-card {
  background: var(--surface, #fff);
  border: 1px solid var(--border, #e5e7eb);
  border-radius: var(--radius, 10px);
  padding: 16px 18px;
}
.memory-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}
.memory-date {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-subtle, #6b7280);
  letter-spacing: .02em;
}
.memory-actions { display: flex; gap: 6px; flex: 0 0 auto; }
.memory-body {
  font-size: 14px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
}
.memory-textarea {
  width: 100%;
  box-sizing: border-box;
  font: inherit;
  font-size: 14px;
  line-height: 1.6;
  padding: 10px 12px;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: var(--radius, 10px);
  resize: vertical;
}
/* Edit form hidden until the card is in .editing state */
.memory-edit-form { display: none; margin-top: 10px; }
.memory-card.editing .memory-edit-form { display: block; }
.memory-card.editing .memory-body { display: none; }

/* ── Built-by-Parlay skills ─────────────────────────────────────── */
.badge-parlay {
  background: #15233b;
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  vertical-align: middle;
}
.badge-locked {
  background: var(--bg);
  color: var(--text-faint);
  border: 1px solid var(--border);
}

/* Inline notices */
.notice {
  border-radius: var(--radius);
  padding: 10px 14px;
  font-size: 13px;
  margin: 0 0 16px;
  border: 1px solid var(--border);
}
.notice-warn { background: var(--danger-bg); color: var(--danger); border-color: transparent; }
.notice-ok   { background: var(--connected-bg); color: var(--connected); border-color: transparent; }

/* ── Skills page: Active + Library card grid ────────────────────── */
.skills-section { margin: 28px 0; }
.skills-section-head {
  display: flex; align-items: baseline; gap: 12px;
  margin-bottom: 14px; flex-wrap: wrap;
}
.skills-section-head h2 { font-size: 16px; margin: 0; }

.skill-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}
.skill-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.skill-card.is-on { border-color: var(--connected); box-shadow: 0 0 0 1px var(--connected-bg); }
.skill-card.is-locked { background: var(--bg); }
.skill-card-top {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 10px;
}
.skill-card-title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.skill-card-title strong { font-size: 14px; }
.skill-card-title .lock { font-size: 13px; opacity: .7; }
.skill-card-desc { font-size: 13px; color: var(--text-subtle); margin: 0; line-height: 1.5; }
.skill-card-foot { margin-top: auto; }
.skill-state { font-size: 12px; }
.skill-state.on  { color: var(--connected); }
.skill-state.off { color: var(--text-faint); }
.status-dot { font-size: 12px; color: var(--text-faint); }
.status-dot.on { color: var(--connected); }

/* Toggle switch — a real form button, works without JS */
.switch {
  --w: 40px; --h: 22px;
  width: var(--w); height: var(--h);
  border-radius: 999px;
  border: none; padding: 0; cursor: pointer;
  position: relative; flex: none;
  background: var(--border-strong);
  transition: background .15s ease;
}
.switch.on { background: var(--connected); }
.switch-knob {
  position: absolute; top: 2px; left: 2px;
  width: 18px; height: 18px; border-radius: 50%;
  background: #fff; transition: transform .15s ease;
  box-shadow: 0 1px 2px rgba(0,0,0,.25);
}
.switch.on .switch-knob { transform: translateX(18px); }

/* ═══════════════════════════════════════════════════════════════════════
   Automations → Triggers — deterministic workflow UI
   Extends the app design system (monochrome + one restrained accent).
   ═══════════════════════════════════════════════════════════════════════ */
:root {
  --wf-accent: #4f46e5;          /* the single workflow accent (indigo) */
  --wf-accent-soft: #eef0fe;
  --wf-accent-line: #d7d9fb;
  --wf-good: #2e7d32;  --wf-good-soft: #e7f3e8;
  --wf-warn: #b7791f;  --wf-warn-soft: #fbf2e2;
  --wf-track: #f0f1f4;
}
@media (prefers-color-scheme: dark) {
  :root {
    --wf-accent: #8b83ff; --wf-accent-soft: #201f38; --wf-accent-line: #37356a;
    --wf-good: #4cc77f; --wf-good-soft: #13251b;
    --wf-warn: #d9a441; --wf-warn-soft: #2a2110; --wf-track: #23252b;
  }
}
:root[data-theme="dark"] {
  --wf-accent: #8b83ff; --wf-accent-soft: #201f38; --wf-accent-line: #37356a;
  --wf-good: #4cc77f; --wf-good-soft: #13251b;
  --wf-warn: #d9a441; --wf-warn-soft: #2a2110; --wf-track: #23252b;
}
:root[data-theme="light"] {
  --wf-accent: #4f46e5; --wf-accent-soft: #eef0fe; --wf-accent-line: #d7d9fb;
  --wf-good: #2e7d32; --wf-good-soft: #e7f3e8;
  --wf-warn: #b7791f; --wf-warn-soft: #fbf2e2; --wf-track: #f0f1f4;
}

.wf-card { padding: 0; overflow: hidden; }
.wf-top {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap;
  padding: 18px 20px; border-bottom: 1px solid var(--border);
}
.wf-title { display: flex; align-items: center; gap: 10px; min-width: 0; }
.wf-title h2 { margin: 0; font-size: 17px; letter-spacing: -0.01em; }
.wf-state {
  font-size: 11px; font-weight: 700; letter-spacing: .04em;
  padding: 3px 9px; border-radius: 999px; text-transform: uppercase;
}
.wf-state.on  { background: var(--wf-good-soft); color: var(--wf-good); }
.wf-state.off { background: var(--bg); color: var(--text-faint); }
.wf-actions { display: flex; gap: 6px; flex: 0 0 auto; flex-wrap: wrap; }

/* pipeline — quiet nodes, active values in the accent */
.wf-flow {
  display: flex; align-items: stretch; gap: 0;
  overflow-x: auto; padding: 16px 20px; background: var(--bg);
}
.wf-node {
  flex: 0 0 auto; width: 168px;
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); padding: 11px 12px;
  display: flex; flex-direction: column; gap: 3px;
}
.wf-node.editable { cursor: pointer; transition: border-color .12s, box-shadow .12s; }
.wf-node.editable:hover { border-color: var(--wf-accent-line); box-shadow: var(--shadow-sm); }
/* PRD §5: "write nodes are visibly dangerous". A step that writes outside
   Parlay must not look like one that only reads — the diagram is what a
   client checks before enabling a workflow. */
.wf-node.writes { border-color: var(--warn, #f7b955); }
.wf-step.needs-setup { border-color: var(--warn, #f7b955); background: rgba(247,185,85,.05); }
.s-last { font-size: 11.5px; color: var(--text-faint); margin: 4px 0 0; }
.n-gap { font-size: 10px; text-transform: uppercase; letter-spacing: .04em;
         color: var(--warn, #f7b955); border: 1px solid currentColor;
         border-radius: 3px; padding: 0 4px; margin-left: 6px; font-weight: 700; }
.wf-warn { margin: 8px 0 12px; padding: 10px 12px; font-size: 13px;
           border: 1px solid var(--warn, #f7b955); border-radius: var(--radius);
           background: rgba(247,185,85,.07); }
.n-writes { font-size: 10px; text-transform: uppercase; letter-spacing: .04em;
            color: var(--warn, #f7b955); border: 1px solid currentColor;
            border-radius: 3px; padding: 0 4px; margin-left: 6px;
            vertical-align: middle; font-weight: 700; }
.wf-node .n-num {
  font-size: 10px; font-weight: 700; color: var(--text-faint);
  font-variant-numeric: tabular-nums; letter-spacing: .06em;
}
.wf-node .n-title { font-size: 13px; font-weight: 650; letter-spacing: -0.01em; }
.wf-node .n-val {
  font-size: 12.5px; font-weight: 600; color: var(--wf-accent);
  font-variant-numeric: tabular-nums;
}
.wf-node .n-val .pencil { opacity: .5; font-size: 11px; }
.wf-node .n-desc { font-size: 11px; line-height: 1.4; color: var(--text-subtle); }
.wf-arrow { flex: 0 0 auto; align-self: center; padding: 0 4px; color: var(--border-strong); }

/* metric tiles — read at a glance, click to drill */
.wf-run { padding: 18px 20px; }
.wf-run-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 4px; }
.wf-run-head .when { font-size: 13px; color: var(--text-subtle); font-variant-numeric: tabular-nums; }
.wf-tag {
  font-size: 11px; font-weight: 700; letter-spacing: .03em; padding: 2px 9px;
  border-radius: 999px; text-transform: uppercase;
}
.wf-tag.preview { background: var(--wf-warn-soft); color: var(--wf-warn); }
.wf-tag.live    { background: var(--wf-accent-soft); color: var(--wf-accent); }

.wf-metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(128px, 1fr)); gap: 10px; margin: 14px 0; }
.wf-metric {
  text-align: left; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); padding: 12px 14px; cursor: pointer;
  transition: border-color .12s, box-shadow .12s, transform .06s;
  font-family: inherit;
}
.wf-metric:hover { border-color: var(--wf-accent-line); box-shadow: var(--shadow-sm); }
.wf-metric:active { transform: translateY(1px); }
.wf-metric.static { cursor: default; }
.wf-metric.static:hover { border-color: var(--border); box-shadow: none; }
.wf-metric .m-label {
  font-size: 11px; color: var(--text-subtle); font-weight: 600;
  display: flex; align-items: center; justify-content: space-between; gap: 6px;
}
.wf-metric .m-num { font-size: 26px; font-weight: 720; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; margin-top: 4px; line-height: 1; }
.wf-metric.accent .m-num { color: var(--wf-accent); }
.wf-metric.good .m-num { color: var(--wf-good); }
.wf-metric .caret { color: var(--text-faint); font-size: 10px; }
.wf-metric.open { border-color: var(--wf-accent); background: var(--wf-accent-soft); }
.wf-metric.open .caret { transform: rotate(180deg); }

/* drill-down tables */
.wf-drill { margin: 4px 0 14px; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.wf-drill-head { padding: 9px 14px; background: var(--bg); font-size: 12px; font-weight: 700; border-bottom: 1px solid var(--border); }
.wf-scroll { max-height: 360px; overflow: auto; }
.wf-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.wf-table th {
  text-align: left; padding: 8px 14px; font-size: 10.5px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .05em; color: var(--text-faint);
  position: sticky; top: 0; background: var(--surface); border-bottom: 1px solid var(--border);
}
.wf-table td { padding: 8px 14px; border-top: 1px solid var(--border); }
.wf-table td.co { font-weight: 600; }
.wf-table td.dom { color: var(--text-subtle); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
.wf-table td.num { text-align: right; font-variant-numeric: tabular-nums; }
.wf-empty { padding: 16px 14px; color: var(--text-subtle); font-size: 13px; }

/* run-history — clickable rows that expand */
.wf-history { border-top: 1px solid var(--border); }
.wf-history-h { padding: 12px 20px 6px; font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--text-faint); }
.wf-hrow {
  display: grid; grid-template-columns: 130px 78px repeat(5, 1fr) 44px;
  align-items: center; gap: 8px; padding: 9px 20px; cursor: pointer;
  border-top: 1px solid var(--border); font-size: 13px;
  transition: background .1s;
}
.wf-hrow.open { background: var(--wf-accent-soft); }
.wf-hrow .h-when { color: var(--text-subtle); font-variant-numeric: tabular-nums; }
.wf-hrow .h-num { text-align: right; font-variant-numeric: tabular-nums; }
.wf-hrow .h-caret { text-align: right; color: var(--text-faint); font-size: 10px; }
.wf-hrow.open .h-caret { transform: rotate(180deg); }
.wf-hbody { display: none; padding: 4px 20px 16px; border-top: 1px solid var(--border); background: var(--bg); }
.wf-hbody.open { display: block; }

/* settings sheet — grouped, labeled, not a flat row */
.wf-settings { display: none; padding: 20px; border-top: 1px solid var(--border); background: var(--bg); }
.wf-settings.open { display: block; }
.wf-set-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 18px 20px; }
.wf-fieldset { border: 0; padding: 0; margin: 0; }
.wf-fieldset legend { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--text-faint); padding: 0 0 8px; }
.wf-field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; }
.wf-field label { font-size: 13px; font-weight: 600; }
.wf-field .hint { font-size: 12px; color: var(--text-subtle); line-height: 1.4; }
.wf-field input, .wf-field select {
  font: inherit; font-size: 14px; padding: 9px 11px;
  border: 1px solid var(--border-strong); border-radius: var(--radius);
  background: var(--surface); color: var(--text); width: 100%;
}
.wf-field input:focus, .wf-field select:focus { outline: none; border-color: var(--wf-accent); box-shadow: 0 0 0 3px var(--wf-accent-soft); }
.wf-set-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--border); }

.wf-legend { padding: 12px 20px 18px; font-size: 12px; color: var(--text-subtle); line-height: 1.6; border-top: 1px solid var(--border); }
.wf-legend strong { color: var(--text); }
.wf-banner { margin: 0 20px 0; margin-top: 16px; padding: 11px 14px; border-radius: var(--radius); font-size: 13.5px; background: var(--wf-good-soft); border: 1px solid var(--wf-good); color: var(--wf-good); }

/* Automations tab bar */
.wf-tabs { display: inline-flex; gap: 3px; background: var(--bg); border: 1px solid var(--border); border-radius: 10px; padding: 3px; margin-bottom: 22px; }
.wf-tab { padding: 7px 18px; border: 0; border-radius: 7px; font: inherit; font-size: 13.5px; font-weight: 600; cursor: pointer; background: transparent; color: var(--text-subtle); transition: color .12s, background .12s; }
.wf-tab:hover { color: var(--text); }
.wf-tab.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }

/* ── the canvas — one representation of the graph (n8n-style) ──────────
   Nodes are the editor: click one, its drawer opens below. Insert points
   sit ON the connectors. Hovers are accent-tinted, never white-on-white. */
.wf-canvas {
  display: flex; align-items: stretch; gap: 0;
  overflow-x: auto; padding: 18px 20px 14px; background: var(--bg);
}
.wfc-node {
  flex: 0 0 auto; width: 172px; position: relative;
  border: 1px solid var(--border); border-radius: 10px;
  background: var(--surface); padding: 10px 12px 9px;
  display: flex; flex-direction: column; gap: 4px;
  transition: border-color .15s ease, box-shadow .15s ease,
              transform .15s ease;
}
.wfc-node[role="button"] { cursor: pointer; }
.wfc-node[role="button"]:hover, .wfc-node[role="button"]:focus-visible {
  border-color: var(--wf-accent);
  box-shadow: 0 2px 10px rgba(79, 70, 229, .12);
  transform: translateY(-1px);
  outline: none;
}
.wfc-node.open {
  border-color: var(--wf-accent);
  box-shadow: 0 0 0 3px var(--wf-accent-soft);
}
.wfc-node.writes { border-color: var(--warn, #f7b955); }
.wfc-node.gap { border-style: dashed; }
.wfc-head { display: flex; align-items: center; justify-content: space-between; }
.wfc-num { font-size: 10px; font-weight: 700; color: var(--text-faint);
           font-variant-numeric: tabular-nums; }
.wfc-dot { width: 8px; height: 8px; border-radius: 50%;
           background: var(--border-strong); }
.wfc-dot.ok  { background: var(--wf-good); }
.wfc-dot.err { background: var(--danger); }
.wfc-title { font-size: 13px; font-weight: 650; line-height: 1.3; }
.wfc-params { font-size: 11px; color: var(--wf-accent); display: flex;
              flex-wrap: wrap; gap: 3px; }
.wfc-kv { background: var(--wf-accent-soft); border-radius: 4px;
          padding: 0 5px; max-width: 100%; overflow: hidden;
          text-overflow: ellipsis; white-space: nowrap; }
.wfc-badges:empty { display: none; }

/* the connector, with the insert point living ON it */
.wfc-link {
  flex: 0 0 34px; position: relative; align-self: stretch;
  display: flex; align-items: center; justify-content: center;
}
.wfc-link::before {
  content: ""; position: absolute; left: 0; right: 0; top: 50%;
  height: 2px; background: var(--wf-accent-line);
}
.wfc-insert { position: relative; z-index: 1; }
.wfc-insert > summary {
  list-style: none; cursor: pointer; user-select: none;
  width: 20px; height: 20px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700; line-height: 1;
  background: var(--surface); border: 1px solid var(--wf-accent-line);
  color: var(--wf-accent);
  opacity: .45; transition: opacity .15s ease, transform .15s ease,
                            background .15s ease;
}
.wfc-insert > summary::-webkit-details-marker { display: none; }
.wfc-link:hover .wfc-insert > summary,
.wfc-insert[open] > summary {
  opacity: 1; transform: scale(1.15);
  background: var(--wf-accent); color: #fff; border-color: var(--wf-accent);
}
.wfc-insert-form {
  position: absolute; top: calc(50% + 16px); left: 50%;
  transform: translateX(-50%);
  display: flex; gap: 6px; align-items: center;
  background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: var(--radius); box-shadow: 0 6px 24px rgba(0, 0, 0, .12);
  padding: 8px; z-index: 30; animation: wf-pop .16s ease both;
}
.wfc-insert-form select {
  font: inherit; font-size: 13px; padding: 6px 8px; max-width: 230px;
  border: 1px solid var(--border-strong); border-radius: var(--radius);
  background: var(--surface); color: var(--text);
}
@keyframes wf-pop { from { opacity: 0; transform: translateX(-50%) translateY(-4px); }
                    to { opacity: 1; transform: translateX(-50%); } }

/* ── node drawers — one at a time, under the canvas ── */
.wf-steps { padding: 0 20px 16px; }
.wf-step {
  border: 1px solid var(--wf-accent-line); border-radius: 10px;
  background: var(--surface); padding: 14px 16px; margin: 10px 0 0;
  animation: wf-step-in .18s ease both;
}
.wf-step.writes { border-color: var(--warn, #f7b955); }
.wf-step-head { display: flex; align-items: center; gap: 9px; }
.s-num { font-size: 11px; font-weight: 700; color: var(--text-faint);
         font-variant-numeric: tabular-nums; flex: 0 0 auto; }
.s-title { font-size: 14px; font-weight: 650; flex: 1 1 auto; min-width: 0; }
.s-actions { display: flex; gap: 4px; flex: 0 0 auto; }
.s-actions .btn[disabled] { opacity: .3; cursor: not-allowed; }
.s-desc { font-size: 12.5px; line-height: 1.45; margin: 5px 0 0; }
.s-none { font-size: 12px; color: var(--text-faint); margin: 8px 0 0;
          font-style: italic; }
.s-last { font-size: 11.5px; color: var(--text-faint); margin: 4px 0 0; }
/* A code step needs a real editor. A one-line <input> is what "string"
   gave it, and a Python body in a single-line box is not editable in any
   useful sense. Monospace, resizable, full width of the form, tabs
   preserved by the textarea itself. */
.s-form .wf-code, .wf-code {
  grid-column: 1 / -1;
  width: 100%;
  min-height: 180px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12.5px;
  line-height: 1.5;
  tab-size: 4;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-soft, var(--bg));
  color: var(--fg);
  resize: vertical;
  white-space: pre;
  overflow: auto;
}
.wf-code:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}

.s-form {
  margin: 12px 0 0; padding: 13px 0 0; border-top: 1px dashed var(--border);
  display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 0 16px; align-items: start;
}
.s-form .wf-field { margin-bottom: 12px; }
.s-form > .btn { grid-column: 1 / -1; justify-self: start; }
.s-form .wf-field input[type=checkbox] { width: auto; }

.s-add {
  display: flex; align-items: center; gap: 9px; flex-wrap: wrap;
  padding: 11px 14px; margin: 12px 0 0;
  border: 1px dashed var(--border-strong); border-radius: var(--radius);
  background: var(--bg);
  transition: border-color .15s ease, background .15s ease;
}
.s-add:hover, .s-add:focus-within { border-color: var(--wf-accent); }
.s-add label { font-size: 13px; font-weight: 600; flex: 0 0 auto; }
.s-add select {
  font: inherit; font-size: 13.5px; padding: 7px 10px;
  border: 1px solid var(--border-strong); border-radius: var(--radius);
  background: var(--surface); color: var(--text); max-width: 100%;
}
.s-add select:focus { outline: none; border-color: var(--wf-accent);
                      box-shadow: 0 0 0 3px var(--wf-accent-soft); }
.s-add .hint { flex: 1 1 100%; font-size: 12px; color: var(--text-subtle);
               line-height: 1.4; }

.wf-versions { padding-top: 4px; }
.wf-versions-wrap { margin-top: 14px; }
.wf-versions-wrap > summary { list-style: none; }
.wf-versions-wrap > summary::-webkit-details-marker { display: none; }
.wf-versions-wrap > summary:hover { color: var(--wf-accent); }
.v-row {
  display: grid; grid-template-columns: 42px 92px 150px 1fr;
  align-items: baseline; gap: 10px; padding: 6px 0; font-size: 12.5px;
  border-top: 1px solid var(--border);
}
.v-n { font-weight: 700; color: var(--wf-accent);
       font-variant-numeric: tabular-nums; }
.v-when { color: var(--text-subtle); font-variant-numeric: tabular-nums; }
.v-who, .v-diff { min-width: 0; overflow-wrap: anywhere; }

/* hovers: accent-tinted, never a white flash. The old rules hovered to
   var(--bg)/#fff, which on a white card reads as elements blinking. */
.btn:hover { background: var(--accent-hover); }
.btn-ghost:hover { background: var(--wf-accent-soft, var(--bg));
                   border-color: var(--wf-accent-line, var(--border-strong)); }
.wf-hrow:hover { background: var(--wf-accent-soft); }
.wf-table tr:hover td { background: var(--wf-accent-soft); }

@media (max-width: 640px) {
  .s-form { grid-template-columns: 1fr; }
  .v-row { grid-template-columns: 42px 1fr; row-gap: 2px; }
}
@keyframes wf-step-in { from { opacity: 0; transform: translateY(-4px); }
                        to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) {
  .wf-step, .s-add { animation: none; }
  .wfc-insert-form { animation: none; }
  .wf-step, .s-actions, .s-add, .wfc-node, .wfc-insert > summary { transition: none; }
}

/* step-through: the data a step produced, in the step's own drawer */
.s-data { margin: 10px 0 0; }
.s-data > summary {
  cursor: pointer; font-size: 12px; font-weight: 650;
  color: var(--wf-accent); list-style: none;
}
.s-data > summary::-webkit-details-marker { display: none; }
.s-data-scroll { overflow-x: auto; margin-top: 6px; }
.s-data-tbl { border-collapse: collapse; font-size: 12px; width: 100%; }
.s-data-tbl th, .s-data-tbl td {
  border: 1px solid var(--border); padding: 4px 8px;
  text-align: left; white-space: nowrap; max-width: 260px;
  overflow: hidden; text-overflow: ellipsis;
}
.s-data-tbl th {
  background: var(--wf-accent-soft); color: var(--wf-accent);
  font-weight: 650; position: sticky; top: 0;
}

/* workflow picker: one workflow at a time, and a + that is findable */
.wf-switch {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin: 0 0 16px;
}
.wf-switch-l {
  font-size: 10.5px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .06em; color: var(--text-faint); margin-right: 2px;
}
.wf-pill {
  display: inline-flex; align-items: center; gap: 7px;
  font: inherit; font-size: 13px; font-weight: 600; cursor: pointer;
  padding: 6px 13px; border-radius: 999px;
  border: 1px solid var(--border-strong); background: var(--surface);
  color: var(--text-subtle);
  transition: border-color .15s ease, color .15s ease, background .15s ease;
}
.wf-pill:hover { border-color: var(--wf-accent-line); color: var(--text); }
.wf-pill.on {
  border-color: var(--wf-accent); color: var(--wf-accent);
  background: var(--wf-accent-soft);
}
.wf-pill-dot { width: 7px; height: 7px; border-radius: 50%; }
.wf-pill-dot.on { background: var(--wf-good); }
.wf-pill-dot.off { background: var(--text-faint); }
.wf-new { position: relative; }
.wf-new > summary {
  list-style: none; cursor: pointer; user-select: none;
  width: 30px; height: 30px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; line-height: 1; font-weight: 600;
  border: 1px dashed var(--border-strong); color: var(--text-subtle);
  transition: border-color .15s ease, color .15s ease, background .15s ease;
}
.wf-new > summary::-webkit-details-marker { display: none; }
.wf-new > summary:hover, .wf-new[open] > summary {
  border-style: solid; border-color: var(--wf-accent);
  color: #fff; background: var(--wf-accent);
}
.wf-new-form {
  position: absolute; top: 38px; left: 0; z-index: 30;
  display: flex; gap: 6px; padding: 9px;
  background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: var(--radius); box-shadow: 0 8px 26px rgba(0, 0, 0, .13);
  animation: wf-pop .16s ease both;
}
.wf-new-form input {
  font: inherit; font-size: 13px; padding: 7px 9px; min-width: 210px;
  border: 1px solid var(--border-strong); border-radius: var(--radius);
  background: var(--surface); color: var(--text);
}

/* inline result of an edit — the page no longer reloads to tell you */
.wf-flash {
  margin: 0; padding: 0 20px; max-height: 0; overflow: hidden;
  font-size: 13px; line-height: 1.5; color: var(--wf-good);
  background: var(--wf-good-soft);
  transition: max-height .18s ease, padding .18s ease;
}
.wf-flash.show { max-height: 90px; padding: 10px 20px; }
.wf-flash.bad { color: var(--danger); background: var(--danger-bg); }

/* live run state on the canvas */
.wfc-node.running { border-color: var(--wf-accent-line); }
.wfc-node.running .wfc-dot { background: var(--wf-accent); }
.wfc-node.running-now { border-color: var(--wf-accent); }
.wfc-node.running-now .wfc-dot {
  background: var(--wf-accent);
  animation: wf-pulse 1.1s ease-in-out infinite;
}
@keyframes wf-pulse {
  0%, 100% { box-shadow: 0 0 0 0 var(--wf-accent-soft); }
  50% { box-shadow: 0 0 0 6px var(--wf-accent-soft); }
}
.wf-stop { border-color: var(--danger); }
@media (prefers-reduced-motion: reduce) {
  .wfc-node.running-now .wfc-dot { animation: none; }
}

/* connection access (read-only / read & write) */
.cn-access { margin-top: 14px; padding-top: 12px; border-top: 1px dashed var(--border); }
.cn-access-h { font-size: 10.5px; font-weight: 700; text-transform: uppercase;
               letter-spacing: .06em; color: var(--text-faint); margin-bottom: 6px; }
.cn-mode { display: flex; flex-direction: column; gap: 8px; }
.cn-radio { display: flex; gap: 9px; align-items: flex-start; font-size: 13px;
            line-height: 1.5; cursor: pointer; }
.cn-radio input { margin-top: 3px; }
.cn-mode .btn { align-self: flex-start; margin-top: 2px; }

/* The runner cutover control. Every class the card RENDERS needs a rule:
   11 of the step editor's 12 class names once had none, and generated
   markup is exactly where nobody re-reads the stylesheet. */
.wf-engine-edit { margin: 6px 0 0; }
.wf-engine-edit > summary { list-style: none; cursor: pointer; display: inline-block; }
.wf-engine-edit > summary::-webkit-details-marker { display: none; }
.wf-engine { margin: 8px 0 0; padding: 10px 12px; border: 1px solid var(--line, #e6e8eb);
             border-radius: 8px; background: var(--bg, #fafbfc); }
.wf-engine .hint { font-size: 12px; color: var(--muted, #5b6672); margin: 0 0 8px; }
.wf-engine-form { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center;
                  margin: 0 0 8px; }
.wf-engine-form label { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; }
.wf-engine-form select { font: inherit; font-size: 13px; padding: 6px 8px;
                         border: 1px solid var(--line, #e6e8eb); border-radius: 6px; }

/* The wiring canvas (item 6). Every class the card RENDERS needs a rule:
   11 of the step editor's 12 class names once had none, and generated
   markup is exactly where nobody re-reads the stylesheet. */
.wf-wiring-edit { margin: 6px 0 0; }
.wf-wiring-edit > summary { list-style: none; cursor: pointer; display: inline-block; }
.wf-wiring-edit > summary::-webkit-details-marker { display: none; }
.wf-wiring { margin: 8px 0 0; padding: 10px 12px; border: 1px solid var(--line, #e6e8eb);
             border-radius: 8px; background: var(--bg, #fafbfc); }
.wf-wiring .hint { font-size: 12px; color: var(--muted, #5b6672); margin: 6px 0 0; }
.wf-wiring-note { font-size: 12.5px; margin: 0 0 8px; padding: 6px 8px;
                  border-left: 3px solid var(--accent, #3b6cf0);
                  background: var(--bg-alt, #fff); }
.wf-wiring-form { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center;
                  margin: 10px 0 0; }
.wf-wiring-form label { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; }
.wf-wiring-form select { font: inherit; font-size: 13px; padding: 6px 8px;
                         border: 1px solid var(--line, #e6e8eb); border-radius: 6px; }
.wf-edges { width: 100%; border-collapse: collapse; font-size: 13px; }
.wf-edges th { text-align: left; font-weight: 600; font-size: 11.5px;
               text-transform: uppercase; letter-spacing: .04em;
               color: var(--muted, #5b6672); padding: 4px 8px 4px 0; }
.wf-edges td { padding: 4px 8px 4px 0; border-top: 1px solid var(--line, #e6e8eb); }
.wf-edges form { display: inline; }
.wf-port { font-size: 11.5px; padding: 1px 6px; border-radius: 999px;
           border: 1px solid var(--line, #e6e8eb); }
.wf-port-main { border-color: var(--accent, #3b6cf0); }
.wf-port-error { border-color: #c0392b; }
.wf-port-timeout { border-color: #b7791f; }
.wf-port-else { border-color: var(--muted, #5b6672); }
