:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --panel: #ffffff;
  --rail: #eef1f5;
  --sidebar: #fbfcfe;
  --input: #ffffff;
  --header: #f9fafc;
  --subtle: #f1f3f7;
  --row-id: #fbfcfe;
  --line: #dfe3ea;
  --text: #172033;
  --muted: #687386;
  --blue: #2563eb;
  --teal: #0f766e;
  --red: #dc2626;
  --amber: #b45309;
  --row: #eceff3;
  --row-selected: rgba(100, 116, 139, .16);
  --column-selected: #dbeafe;
  --column-selected-cell: rgba(37, 99, 235, .08);
  --link: #2563eb;
  --chip-bg: #eef2ff;
  --chip-border: #c7d2fe;
  --chip-text: #243c8f;
  --workflow-input: #2563eb;
  --workflow-output: #16a34a;
  --workflow-connection: #0891b2;
  --workflow-data: #d97706;
  --menu-shadow: 0 14px 44px rgba(23, 32, 51, .18);
}
[data-theme="dark"] {
  color-scheme: dark;
  --bg: #18191b;
  --panel: #1b1c1e;
  --rail: #26292c;
  --sidebar: #1e1f22;
  --input: #202124;
  --header: #26282b;
  --subtle: #2a2c30;
  --row-id: #1f2023;
  --line: #303236;
  --text: #d7dbe2;
  --muted: #8e949e;
  --blue: #579dff;
  --teal: #18a999;
  --red: #ff7875;
  --amber: #faad14;
  --row: #2a2c30;
  --row-selected: rgba(160, 166, 178, .18);
  --column-selected: #183b66;
  --column-selected-cell: rgba(87, 157, 255, .12);
  --link: #579dff;
  --chip-bg: #20304c;
  --chip-border: #2f4f7f;
  --chip-text: #8abfff;
  --workflow-input: #579dff;
  --workflow-output: #35c46a;
  --workflow-connection: #46c9e8;
  --workflow-data: #f59e0b;
  --menu-shadow: 0 18px 52px rgba(0, 0, 0, .45);
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 13px/1.35 Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}
button, input, select, textarea { font: inherit; }
button {
  border: 1px solid var(--line);
  background: var(--input);
  color: var(--text);
  border-radius: 6px;
  min-height: 32px;
  padding: 0 10px;
  cursor: pointer;
  transition: background-color .14s ease, border-color .14s ease, color .14s ease, transform .14s ease;
}
button:hover { border-color: #b8c1d1; }
button.primary { background: var(--blue); border-color: var(--blue); color: #fff; }
button.danger, .context-menu button.danger { color: var(--red); }
input, select, textarea {
  width: 100%;
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--input);
  color: var(--text);
  padding: 6px 8px;
}
input[type="number"] {
  appearance: textfield;
  -moz-appearance: textfield;
}
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
option {
  background: var(--input);
  color: var(--text);
}
textarea { min-height: 78px; resize: vertical; }
label { display: grid; gap: 6px; color: var(--muted); font-size: 12px; font-weight: 600; }
.app {
  display: grid;
  grid-template-columns: 48px 260px minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
  height: 100vh;
  min-height: 620px;
  overflow: hidden;
}
.app.app-level-mode { grid-template-columns: 48px 1fr; }
.app.app-level-mode .sidebar,
.app.app-level-mode .topbar { display: none; }
.app.app-level-mode .main {
  grid-template-rows: 1fr;
  background: var(--panel);
}
.app-rail {
  border-right: 1px solid var(--line);
  background: var(--rail);
  display: grid;
  grid-template-rows: 42px repeat(3, 54px) 1fr 54px 54px;
  align-items: start;
  padding: 6px 4px;
}
.rail-logo,
.rail-avatar {
  width: 32px;
  height: 32px;
  margin: 0 auto;
  display: grid;
  place-items: center;
  border-radius: 8px;
  font-weight: 800;
}
.rail-logo {
  border: 1px solid var(--line);
  background: var(--panel);
}
.ui-icon {
  width: 16px;
  height: 16px;
  display: inline-block;
  flex: 0 0 auto;
  overflow: visible;
  stroke-width: 1.8;
  vertical-align: middle;
  pointer-events: none;
}
.rail-item > .ui-icon { width: 20px; height: 20px; }
.icon-btn .ui-icon,
.cell-plus .ui-icon,
.chip-x .ui-icon { width: 17px; height: 17px; }
.rail-item {
  width: 40px;
  min-height: 46px;
  padding: 4px 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  display: grid;
  place-items: center;
  gap: 1px;
  color: var(--muted);
}
.rail-item small {
  font-size: 9px;
  font-weight: 700;
  max-width: 40px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.rail-item.active,
.rail-item:hover {
  background: var(--subtle);
  color: var(--blue);
}
.rail-spacer { min-height: 0; }
.rail-avatar {
  border: 0;
  background: var(--subtle);
  color: var(--text);
  font-size: 11px;
}
.rail-avatar:hover,
.rail-avatar.active {
  border: 0;
  background: var(--panel);
  color: var(--blue);
}
.user-menu {
  position: fixed;
  left: 56px;
  bottom: 10px;
  z-index: 80;
  width: 260px;
  display: grid;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--menu-shadow);
}
.user-menu.hidden { display: none; }
.user-menu-head {
  display: grid;
  gap: 2px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}
.user-menu-head strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.auth-view {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: var(--bg);
  padding: 24px;
}
.auth-panel {
  width: min(360px, calc(100vw - 32px));
  display: grid;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 20px;
}
.auth-brand { padding: 0; }
.auth-panel h1 {
  margin: 0;
  font-size: 20px;
}
.sidebar {
  border-right: 1px solid var(--line);
  background: var(--sidebar);
  display: grid;
  grid-template-rows: auto auto 1fr;
  min-height: 0;
  min-width: 0;
  overflow: hidden;
}
.brand {
  height: 40px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 16px;
  border-bottom: 1px solid var(--line);
  font-weight: 800;
}
.mark {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  display: grid;
  place-items: center;
  color: #fff;
  background: var(--teal);
  font-weight: 900;
}
.basebar {
  padding: 10px;
  display: grid;
  gap: 8px;
  border-bottom: 1px solid var(--line);
}
.base-actions { display: grid; grid-template-columns: 40px; gap: 8px; }
.table-list { overflow: auto; padding: 10px; }
.table-search {
  margin-bottom: 8px;
}
.table-expand-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin: -2px 0 8px;
}
.table-expand-actions button {
  min-height: 26px;
  padding: 0 8px;
  font-size: 12px;
}
.list-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  margin: 6px 0 8px;
  text-transform: uppercase;
}
.list-actions { display: flex; gap: 4px; }
.list-actions button {
  width: 28px;
  min-height: 28px;
  padding: 0;
  display: grid;
  place-items: center;
}
.table-button {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border: 0;
  border-radius: 6px;
  background: transparent;
  text-align: left;
  padding: 6px 8px;
  min-height: 30px;
  font-weight: 600;
}
.table-row {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) auto;
  align-items: center;
}
.table-row.nested { margin-left: 0; }
.table-expand {
  width: 24px;
  min-height: 30px;
  padding: 0;
  border: 0;
  background: transparent;
  display: grid;
  place-items: center;
  color: var(--muted);
}
.table-expand:hover { background: var(--subtle); }
.table-chevron { width: 13px; height: 13px; transition: transform .12s ease; }
.table-node:not(.expanded) .table-chevron { transform: rotate(-90deg); }
.folder-button {
  width: 100%;
  min-height: 30px;
  padding: 5px 8px 5px 4px;
  border: 0;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: space-between;
  text-align: left;
  font-weight: 650;
}
.folder-button:hover { background: var(--subtle); }
.folder-children { margin-left: 18px; }
.folder-block.closed .folder-children { display: none; }
.folder-chevron { width: 13px; height: 13px; transition: transform .12s ease; }
.folder-block.closed .folder-chevron { transform: rotate(-90deg); }
.tree-label {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.tree-label > span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.table-button .ui-icon,
.folder-button .ui-icon { width: 15px; height: 15px; color: var(--muted); }
.dragging-table { opacity: .4; }
.folder-block.table-drop-target > .folder-button {
  background: var(--row-selected);
  outline: 1px solid var(--blue);
  outline-offset: -1px;
}
.tree-empty { padding: 8px; color: var(--muted); }
.table-button.active {
  background: var(--subtle);
  color: var(--text);
  font-weight: 700;
}
.table-button:hover { background: var(--subtle); }
.table-menu {
  width: 24px;
  min-height: 30px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  opacity: 0;
}
.table-row:hover .table-menu,
.table-node.active > .table-row .table-menu { opacity: 1; }
.table-view-list {
  display: grid;
  gap: 2px;
  margin: 2px 0 6px 28px;
}
.table-view-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 24px;
  align-items: center;
  border-radius: 6px;
}
.table-view-row.active {
  background: var(--subtle);
}
.table-view-button,
.table-view-menu,
.table-view-add {
  min-height: 28px;
  border: 0;
  background: transparent;
}
.table-view-button {
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 0 8px;
  text-align: left;
  font-weight: 650;
}
.table-view-button span:last-child,
.table-view-add span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.table-view-menu {
  width: 24px;
  padding: 0;
  display: grid;
  place-items: center;
  color: var(--muted);
  opacity: 0;
}
.table-view-row:hover .table-view-menu,
.table-view-row.active .table-view-menu {
  opacity: 1;
}
.table-view-add {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  justify-content: flex-start;
  padding: 0 8px;
  color: var(--muted);
}
.table-view-add:hover { background: var(--subtle); }
.view-emoji {
  flex: 0 0 auto;
  width: 18px;
  text-align: center;
}
.main {
  min-height: 0;
  min-width: 0;
  display: grid;
  grid-template-rows: 40px 1fr;
  overflow: hidden;
}
.topbar {
  border-bottom: 1px solid var(--line);
  background: var(--panel);
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  padding: 0 12px;
  min-width: 0;
}
.title {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  overflow: hidden;
}
.title h1 {
  margin: 0;
  font-size: 14px;
  line-height: 1.1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pill {
  color: var(--muted);
  background: var(--subtle);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 12px;
  white-space: nowrap;
}
#rowCount { display: none; }
.actions, .toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.actions {
  min-width: 0;
  flex-wrap: nowrap;
  justify-content: flex-end;
}
.view-switch {
  display: inline-flex;
  align-items: center;
  justify-self: center;
  padding: 3px;
  border-radius: 8px;
  background: var(--subtle);
}
.view-switch button {
  min-height: 28px;
  border: 0;
  background: transparent;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
}
.view-switch button.active {
  background: var(--panel);
  color: var(--blue);
}
.search-box {
  position: relative;
  display: inline-flex;
  align-items: center;
}
.search-expanded {
  display: grid;
  grid-template-columns: minmax(120px, 170px) minmax(180px, 260px) 28px;
  align-items: center;
  gap: 6px;
  width: min(470px, calc(100vw - 32px));
  padding: 4px;
  border: 1px solid var(--blue);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 0 0 1px rgba(51, 102, 255, .12);
}
.search-expanded input,
.search-expanded select {
  border-radius: 6px;
}
.search-toggle {
  font-size: 19px;
  font-weight: 800;
}
.toolbar {
  border-bottom: 1px solid var(--line);
  background: var(--panel);
  padding: 4px 10px;
  flex-wrap: nowrap;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
}
.toolbar::-webkit-scrollbar { display: none; }
.toolbar > * { flex: 0 0 auto; }
.data-view {
  min-height: 0;
  display: grid;
  grid-template-rows: 36px 1fr;
  overflow: hidden;
}
.toolbar button {
  min-height: 28px;
  border: 0;
  background: transparent;
}
.toolbar button:hover { background: var(--subtle); }
.tool-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-weight: 700;
}
.tool-count {
  display: inline-grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: #16a34a;
  color: #fff;
  font-size: 12px;
}
.toolbar-label {
  display: grid;
  grid-template-columns: auto minmax(130px, 170px);
  align-items: center;
  gap: 6px;
}
.toolbar-label select { min-width: 130px; }
.key-field-icon {
  width: 14px;
  height: 14px;
  color: var(--amber);
  flex: 0 0 auto;
}
.display-field-icon {
  width: 15px;
  height: 15px;
  color: var(--amber);
  flex: 0 0 auto;
}
.display-field-marker { display: inline-flex; }
.content {
  min-height: 0;
  overflow: hidden;
  padding: 0;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
}
.gridwrap {
  --grid-row-height: 33px;
  --grid-cell-height: calc(var(--grid-row-height) - 1px);
  --grid-action-size: 28px;
  border: 0;
  background: var(--panel);
  border-radius: 0;
  height: 100%;
  overflow: auto;
  min-height: 0;
}
.gridwrap[data-row-size="compact"] { --grid-action-size: 24px; }
.gridwrap:focus { outline: none; }
table {
  width: max-content;
  table-layout: fixed;
  border-collapse: separate;
  border-spacing: 0;
}
th, td {
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  text-align: left;
  padding: 0;
  vertical-align: top;
  background: var(--panel);
}
th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--header);
  color: var(--muted);
  font-size: 12px;
  height: 32px;
  padding: 6px 8px;
  white-space: nowrap;
}
th.col-head { position: sticky; }
.column-header-row th { top: 0; }
.gridwrap.has-column-groups .column-header-row th { top: 24px; }
.column-group-row th {
  top: 0;
  z-index: 2;
  height: 24px;
  padding: 0;
  background: var(--header);
  border-bottom: 1px solid var(--line);
}
.column-group-outline {
  height: 23px;
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  align-items: center;
  color: var(--blue);
}
.column-group-outline button {
  width: 20px;
  min-height: 20px;
  margin-left: 1px;
  padding: 0;
  border: 1px solid var(--blue);
  border-radius: 4px;
  background: var(--panel);
  color: var(--blue);
  font-weight: 800;
  line-height: 18px;
}
.column-group-outline span {
  height: 10px;
  margin-right: 5px;
  border-top: 2px solid var(--blue);
  border-right: 2px solid var(--blue);
}
.column-group-track.collapsed .column-group-outline {
  grid-template-columns: 22px;
}
.column-group-track.collapsed .column-group-outline span { display: none; }
.column-group-gap { background: var(--header); }
th.col-head[draggable="true"] { cursor: grab; }
th.col-head[draggable="true"]:active { cursor: grabbing; }
.col-resizer {
  position: absolute;
  right: -3px;
  top: 0;
  width: 6px;
  height: 100%;
  cursor: col-resize;
  z-index: 3;
}
.col-resizer:hover { background: var(--blue); }
tbody tr.data-row:hover td { background: var(--row); }
tbody tr.data-row {
  height: var(--grid-row-height);
}
tbody tr.data-row > td {
  height: var(--grid-cell-height);
  max-height: var(--grid-cell-height);
  overflow: hidden;
}
.skeleton-row td {
  height: var(--grid-cell-height);
  padding: 0 8px;
  vertical-align: middle;
}
.virtual-spacer td {
  padding: 0;
  border-bottom: 0;
  background: var(--panel);
}
.cell-skeleton {
  display: block;
  width: min(140px, 82%);
  height: 12px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--subtle), var(--line), var(--subtle));
  background-size: 220% 100%;
  animation: skeletonPulse 1.15s ease-in-out infinite;
}
td.idcell {
  width: 36px;
  color: var(--muted);
  background: var(--row-id);
  height: var(--grid-cell-height);
  padding: 0 8px;
  line-height: var(--grid-cell-height);
  font-variant-numeric: tabular-nums;
}
.cell-input {
  border: 0;
  border-radius: 0;
  height: var(--grid-cell-height);
  min-height: var(--grid-cell-height);
  max-height: var(--grid-cell-height);
  padding: 0 8px;
  background: transparent;
}
.url-link {
  display: inline-flex;
  align-items: center;
  height: var(--grid-cell-height);
  min-height: var(--grid-cell-height);
  padding: 0 8px;
  color: var(--link);
  text-decoration: underline;
  text-underline-offset: 3px;
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
textarea.cell-input {
  height: var(--grid-cell-height);
  min-height: var(--grid-cell-height);
  max-height: var(--grid-cell-height);
  padding: calc((var(--grid-cell-height) - 18px) / 2) 8px;
  line-height: 18px;
  resize: none;
  overflow: hidden;
}
.boolcell { display: grid; place-items: center; min-height: var(--grid-cell-height); }
.boolcell input { width: 18px; min-height: 18px; }
.col-head {
  min-width: 0;
  cursor: context-menu;
}
.col-title {
  display: flex;
  align-items: center;
  gap: 6px;
  justify-content: space-between;
}
.col-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.col-label span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
}
.type-icon {
  width: 22px;
  height: 18px;
  display: inline-grid;
  place-items: center;
  flex: 0 0 22px;
  border: 1px solid var(--line);
  border-radius: 5px;
  color: var(--muted);
  background: var(--subtle);
  font-size: 11px;
  font-weight: 800;
}
.type-icon .ui-icon { width: 13px; height: 13px; }
.head-sort {
  width: 24px;
  min-height: 24px;
  padding: 0;
  border: 0;
  color: var(--muted);
  background: transparent;
}
.head-sort.active {
  color: var(--blue);
  background: var(--subtle);
}
.add-col-head {
  width: 44px;
  text-align: center;
  padding: 2px;
}
.dragging-column {
  opacity: .45;
}
.col-drop-before,
.col-drop-after {
  background: var(--subtle) !important;
  transition: background-color .14s ease, box-shadow .14s ease;
}
th.col-drop-before::before,
th.col-drop-after::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  width: 4px;
  z-index: 4;
  border-radius: 999px;
  background: var(--blue);
  animation: columnDropIn .14s ease-out;
}
th.col-drop-before::before { left: -2px; }
th.col-drop-after::after { right: -2px; }
.column-drop-cell {
  background: var(--row-selected) !important;
  box-shadow: inset 3px 0 0 var(--blue);
  transition: background-color .14s ease, box-shadow .14s ease;
}
.icon-btn, .cell-plus, .chip-x {
  width: 28px;
  min-height: 28px;
  padding: 0;
  display: inline-grid;
  place-items: center;
}
.cell-plus {
  border-style: dashed;
  color: var(--blue);
  flex: 0 0 28px;
}
.grid-footer {
  min-width: 0;
  border-top: 1px solid var(--line);
  background: var(--panel);
}
.grid-summary-scroll {
  overflow: hidden;
  min-width: 0;
}
.grid-summary-row {
  display: grid;
  width: max-content;
  min-height: 34px;
}
.grid-summary-row > div {
  min-width: 0;
  background: var(--header);
  color: var(--muted);
  font-size: 12px;
  border-right: 1px solid var(--line);
}
.summary-cell {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 0 8px;
  text-align: right;
}
.summary-count-cell {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  padding: 0 8px;
}
.summary-count-cell.with-summary {
  grid-template-columns: minmax(0, 1fr) auto;
}
.summary-count-cell > span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.add-row-btn {
  width: auto;
  min-height: 32px;
  border: 0;
  border-radius: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 10px;
  color: var(--blue);
  background: transparent;
}
.add-row-btn:hover {
  background: var(--subtle);
}
.add-row-line td {
  height: 32px;
  background: var(--panel);
}
.add-row-cell {
  padding: 0;
}
.summary-btn {
  max-width: 100%;
  min-height: 28px;
  padding: 0 6px;
  border: 0;
  background: transparent;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  font-size: 12px;
}
.summary-btn:hover {
  color: var(--text);
  background: var(--subtle);
}
.summary-btn.no-summary {
  opacity: 0;
}
.summary-cell:hover .summary-btn.no-summary,
.summary-count-cell:hover .summary-btn.no-summary,
.summary-btn.no-summary:focus {
  opacity: 1;
}
.summary-btn span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.summary-btn .ui-icon {
  width: 12px;
  height: 12px;
}
.group-row td {
  background: var(--subtle);
  color: var(--muted);
  font-weight: 700;
  padding: 8px;
}
.relation-cell {
  height: var(--grid-cell-height);
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--grid-action-size);
  align-items: center;
  gap: 6px;
  padding: calc((var(--grid-cell-height) - var(--grid-action-size)) / 2) 5px;
  overflow: hidden;
}
.relation-td {
  overflow: hidden;
}
.rel-chip-list {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
}
.rel-chip-list::-webkit-scrollbar { display: none; }
.rel-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: 1px solid var(--chip-border);
  background: var(--chip-bg);
  color: var(--chip-text);
  border-radius: 999px;
  flex: 0 0 auto;
  padding: 3px 5px 3px 8px;
}
th.col-head.column-selected {
  background: var(--column-selected);
  color: var(--blue);
  box-shadow: inset 0 3px 0 var(--blue);
}
.gridwrap .cell-plus {
  width: var(--grid-action-size);
  min-height: var(--grid-action-size);
  flex-basis: var(--grid-action-size);
}
.rel-chip span {
  white-space: nowrap;
}
.chip-x {
  width: 18px;
  min-height: 18px;
  border-radius: 50%;
  border: 0;
  background: transparent;
  color: var(--chip-text);
}
.cell-selected {
  outline: 2px solid var(--blue);
  outline-offset: -2px;
  background: rgba(51, 102, 255, .12) !important;
}
.column-selected-cell {
  background: var(--column-selected-cell) !important;
}
.row-selected td {
  background: var(--row-selected) !important;
}
.idcell {
  user-select: none;
  cursor: default;
}
.empty { padding: 48px; color: var(--muted); text-align: center; }
dialog {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0;
  width: min(720px, calc(100vw - 32px));
  box-shadow: 0 24px 80px rgba(23, 32, 51, .22);
  background: var(--panel);
  color: var(--text);
}
dialog::backdrop { background: rgba(23, 32, 51, .34); }
[data-theme="dark"] dialog::backdrop { background: rgba(0, 0, 0, .62); }
.modal-head, .modal-foot {
  min-height: 52px;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
}
.modal-foot {
  border-bottom: 0;
  border-top: 1px solid var(--line);
  justify-content: flex-end;
  flex-wrap: wrap;
}
.modal-submit-error {
  flex-basis: 100%;
  color: var(--red);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.45;
  text-align: right;
  white-space: pre-wrap;
}
.modal-title { margin: 0; font-size: 16px; }
.modal-body {
  padding: 16px;
  display: grid;
  gap: 14px;
  max-height: 72vh;
  overflow: auto;
}
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.api-source-form {
  display: grid;
  gap: 14px;
}
.postgres-import-form {
  display: grid;
  gap: 12px;
}
.postgres-import-progress {
  display: grid;
  gap: 7px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--subtle);
}
.postgres-import-progress-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 12px;
}
.postgres-import-progress progress {
  width: 100%;
  height: 8px;
  accent-color: var(--blue);
}
.api-async-settings {
  display: grid;
  gap: 12px;
  margin-inline: -16px;
  padding: 14px 16px;
  border-block: 1px solid var(--line);
  background: var(--subtle);
}
.api-async-settings.hidden { display: none; }
.derived-form {
  display: grid;
  gap: 12px;
  width: min(820px, 100%);
  min-width: 0;
}
.derived-mode-tabs {
  display: inline-flex;
  justify-self: start;
  gap: 3px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--subtle);
}
.derived-mode-tabs button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  border-color: transparent;
  background: transparent;
}
.derived-mode-tabs button.active {
  border-color: var(--line);
  background: var(--panel);
  color: var(--blue);
}
.derived-basic-panel,
.derived-sql-panel {
  display: grid;
  gap: 12px;
}
.derived-basic-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.derived-basic-fields {
  display: grid;
  gap: 7px;
}
[data-basic-fields] {
  display: grid;
  max-height: 220px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}
.derived-basic-field-row {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr) 125px;
  align-items: center;
  gap: 9px;
  min-height: 42px;
  padding: 5px 9px;
  border-bottom: 1px solid var(--line);
}
.derived-basic-field-row:last-child { border-bottom: 0; }
.derived-basic-field-row > input {
  width: 16px;
  min-height: 16px;
}
.derived-basic-field-row > span {
  display: flex;
  min-width: 0;
  align-items: baseline;
  gap: 7px;
}
.derived-basic-field-row strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.derived-basic-field-row code {
  color: var(--muted);
  font-size: 11px;
}
.derived-basic-field-row select {
  min-height: 28px;
  height: 28px;
}
.derived-basic-generated {
  display: grid;
  gap: 6px;
}
.derived-basic-generated pre {
  max-height: 150px;
  margin: 0;
  padding: 10px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--input);
  color: var(--text);
  white-space: pre-wrap;
}
.derived-source-picker {
  display: grid;
  gap: 7px;
}
.derived-source-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-auto-rows: max-content;
  align-content: start;
  gap: 7px;
  max-height: 180px;
  overflow: auto;
}
.derived-source-card {
  display: grid;
  gap: 4px;
  min-width: 0;
  padding: 9px 10px;
  text-align: left;
}
.derived-source-card > span {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.derived-source-card small {
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.derived-query-editor,
.derived-query-readonly {
  min-height: 160px;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  line-height: 1.5;
  tab-size: 2;
}
.derived-preview-summary {
  margin-bottom: 7px;
}
.derived-preview th small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-weight: 400;
  white-space: nowrap;
}
.google-sheet-form {
  display: grid;
  gap: 10px;
  width: min(820px, 100%);
}
.google-preview-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  margin-bottom: 8px;
}
.google-preview-meta span {
  color: var(--muted);
}
.google-account-settings {
  margin-bottom: 14px;
}
.api-source-title a {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  text-decoration: none;
}
.api-source-title a:hover {
  color: var(--blue);
}

.formula-expression {
  grid-column: 1 / -1;
}

.formula-expression textarea {
  min-height: 78px;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
}

.formula-fields {
  grid-column: 1 / -1;
  display: grid;
  gap: 8px;
}

.formula-field-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.formula-field-buttons button {
  min-height: 30px;
  padding: 5px 9px;
}

.formula-cell {
  display: block;
  min-width: 0;
  padding: 7px 10px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
}

.formula-error {
  color: var(--red);
}
.api-preview-error {
  flex-basis: 100%;
  color: var(--red);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.45;
  white-space: pre-wrap;
}
.api-fields-wrap {
  max-height: 260px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}
.api-fields {
  width: 100%;
  border-collapse: collapse;
}
.api-fields th,
.api-fields td {
  padding: 8px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}
.api-fields th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--header);
  color: var(--muted);
}
.api-fields input[type="checkbox"] {
  width: auto;
  min-height: 0;
}
.api-fields code {
  color: var(--muted);
  font-size: 12px;
}
.api-source-details {
  display: grid;
  gap: 12px;
  padding: 14px;
  align-content: start;
}
.api-source-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
}
.api-source-head button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.api-source-title {
  min-width: 0;
  display: grid;
  gap: 3px;
}
.api-source-url {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.api-source-settings {
  display: grid;
  grid-template-columns: minmax(130px, 180px) minmax(220px, 1fr) minmax(180px, 320px);
  gap: 10px;
  align-items: stretch;
}
.api-setting-toggle,
.api-setting-number {
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--subtle);
}
.api-setting-number {
  align-self: stretch;
}
.api-setting-number input {
  width: 100%;
  min-height: 30px;
  margin-top: 6px;
}
.details-subtitle {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 8px;
}
.api-run-list {
  display: grid;
  gap: 8px;
  min-height: 0;
}
.api-run-scroll {
  display: grid;
  gap: 8px;
  max-height: min(320px, calc(100vh - 420px));
  overflow: auto;
  padding-right: 4px;
}
.api-run-row {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(0, 2fr);
  gap: 12px;
  align-items: start;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
}
.api-run-empty {
  padding: 10px;
  border: 1px dashed var(--line);
  border-radius: 8px;
}
.api-run-row.ok strong { color: var(--teal); }
.api-run-row.pending strong { color: var(--blue); }
.api-run-row.error strong { color: var(--red); }
.api-run-row.error code {
  padding: 7px 8px;
  border: 1px solid color-mix(in srgb, var(--red) 30%, transparent);
  border-radius: 6px;
  background: color-mix(in srgb, var(--red) 8%, transparent);
  color: var(--red);
}
.api-run-row code {
  min-width: 0;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--muted);
}
.view-settings-form {
  display: grid;
  gap: 14px;
}
.view-settings-form textarea {
  min-height: 94px;
}
.view-icon-picker {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}
.emoji-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(34px, 1fr));
  gap: 6px;
  max-height: 184px;
  overflow: auto;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--input);
}
.emoji-choice {
  min-height: 32px;
  width: 100%;
  padding: 0;
  border-radius: 6px;
  display: grid;
  place-items: center;
  font-size: 18px;
  background: transparent;
}
.emoji-choice.active {
  border-color: var(--blue);
  background: var(--subtle);
  box-shadow: inset 0 0 0 1px var(--blue);
}
.section-title {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}
.confirm-message {
  color: var(--text);
  font-size: 14px;
  line-height: 1.45;
}
.checkline {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
}
.checkline input { width: 16px; min-height: 16px; }
.hook-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
}
.context-menu {
  position: fixed;
  z-index: 10;
  min-width: 220px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--menu-shadow);
  transform-origin: top left;
}
.context-menu:not(.hidden) { animation: menuIn .12s ease-out; }
.context-menu.panel {
  min-width: 360px;
  max-width: min(720px, calc(100vw - 24px));
  padding: 0;
}
.context-menu button {
  width: 100%;
  justify-content: flex-start;
  border: 0;
  background: transparent;
  text-align: left;
  display: flex;
  align-items: center;
  gap: 9px;
}
.context-menu button:hover { background: var(--subtle); }
.context-menu button:disabled {
  color: var(--muted);
  cursor: not-allowed;
  opacity: .55;
}
.context-menu button:disabled:hover { background: transparent; }
.context-heading {
  padding: 8px 10px 5px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}
.context-separator {
  height: 1px;
  margin: 5px -6px;
  background: var(--line);
}
.context-meta {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 28px;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}
.context-meta span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.context-meta button {
  width: 28px;
  min-height: 28px;
  justify-content: center;
  padding: 0;
  border: 1px solid var(--line);
}
.menu-icon {
  width: 18px;
  height: 18px;
  color: var(--muted);
}
.menu-badge {
  margin-left: auto;
  border-radius: 999px;
  padding: 2px 7px;
  background: #f5d0fe;
  color: #a21caf;
  font-size: 11px;
  font-weight: 800;
}
.panel-section {
  padding: 10px;
  border-bottom: 1px solid var(--line);
}
.panel-section:last-child { border-bottom: 0; }
.filter-row {
  display: grid;
  grid-template-columns: 18px 72px 110px 118px minmax(120px, 1fr) 28px;
  gap: 6px;
  align-items: center;
  margin-bottom: 8px;
  padding: 4px;
  border-radius: 6px;
  position: relative;
  transition: background-color .14s ease, box-shadow .14s ease, opacity .14s ease;
}
.filter-group .filter-row { margin-bottom: 0; }
.filter-groups {
  display: grid;
  gap: 8px;
  margin-bottom: 10px;
}
.filter-group {
  display: grid;
  gap: 6px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, .02);
}
.filter-group.logic-and {
  border-color: rgba(22, 163, 74, .45);
  background: rgba(22, 163, 74, .06);
}
.filter-group.logic-or {
  border-color: rgba(87, 157, 255, .45);
  background: rgba(87, 157, 255, .08);
}
.filter-group-head {
  display: grid;
  grid-template-columns: 90px minmax(0, 1fr) 28px 28px;
  align-items: center;
  gap: 6px;
  min-height: 28px;
}
.context-menu .filter-icon-button {
  width: 28px;
  min-height: 28px;
  padding: 0;
  justify-content: center;
}
.filter-row.logic-and {
  background: rgba(22, 163, 74, .08);
  box-shadow: inset 3px 0 0 #16a34a;
}
.filter-row.logic-or {
  background: rgba(87, 157, 255, .10);
  box-shadow: inset 3px 0 0 var(--blue);
}
.context-menu .filter-drag {
  width: 18px;
  min-height: 24px;
  padding: 0;
  justify-self: center;
  justify-content: center;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: grab;
}
.context-menu .filter-drag:active { cursor: grabbing; }
.filter-where {
  color: var(--muted);
  font-weight: 700;
}
.context-menu .filter-logic-toggle {
  width: 72px;
  min-height: 28px;
  justify-content: center;
  padding: 0 8px;
  border-radius: 4px;
  font-weight: 800;
}
.filter-logic-toggle.logic-and {
  border-color: rgba(22, 163, 74, .45);
  background: rgba(22, 163, 74, .12);
  color: #16a34a;
}
.filter-logic-toggle.logic-or {
  border-color: rgba(87, 157, 255, .45);
  background: rgba(87, 157, 255, .12);
  color: var(--blue);
}
.dragging-filter { opacity: .45; }
.filter-drop-before { box-shadow: inset 0 3px 0 var(--blue); }
.filter-drop-after { box-shadow: inset 0 -3px 0 var(--blue); }
.filter-row input,
.filter-row select,
.sort-row select,
.group-row-form select {
  min-height: 30px;
}
.panel-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.columns-list {
  display: grid;
  gap: 4px;
  max-height: 320px;
  overflow: auto;
}
.columns-search-row { padding: 8px; }
.columns-footer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 8px;
}
.column-toggle-row {
  display: grid;
  grid-template-columns: 18px 24px minmax(0, 1fr) 34px;
  align-items: center;
  gap: 8px;
  min-height: 30px;
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
}
.column-toggle-row[draggable="true"] { cursor: grab; }
.column-toggle-row[draggable="true"]:active { cursor: grabbing; }
.column-toggle-row span:nth-child(3) {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.columns-footer .column-toggle-row {
  grid-template-columns: 18px minmax(0, 1fr) 34px;
  min-width: 0;
}
.columns-footer .column-toggle-row span:nth-child(2) {
  overflow: hidden;
  text-overflow: ellipsis;
}
.drag-dots {
  color: var(--muted);
  letter-spacing: -3px;
}
.switch {
  appearance: none;
  width: 30px !important;
  min-height: 16px;
  height: 16px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: var(--line);
  position: relative;
  cursor: pointer;
}
.switch::after {
  content: "";
  position: absolute;
  width: 12px;
  height: 12px;
  left: 2px;
  top: 2px;
  border-radius: 50%;
  background: #fff;
  transition: .14s ease;
}
.switch:checked { background: var(--blue); }
.switch:checked::after { transform: translateX(14px); }
.details-view {
  min-height: 0;
  display: grid;
  grid-template-rows: 44px 1fr;
  background: var(--panel);
}
#settingsView {
  grid-template-rows: 1fr;
  overflow: auto;
}
#settingsView .details-body {
  width: min(1180px, calc(100% - 64px));
  align-content: start;
  padding: 40px 0 32px;
  overflow: visible;
}
#settingsView .details-head {
  min-height: 34px;
}
.settings-page-head h1 {
  margin: 0;
  font-size: 22px;
}
.settings-layout {
  display: grid;
  grid-template-columns: 200px minmax(0, 1fr);
  align-items: start;
  gap: 32px;
}
.settings-nav {
  position: sticky;
  top: 24px;
  display: grid;
  gap: 4px;
}
.settings-nav button {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 9px;
  width: 100%;
  min-height: 36px;
  border-color: transparent;
  background: transparent;
  color: var(--muted);
  text-align: left;
}
.settings-nav button:hover {
  background: var(--subtle);
  color: var(--text);
}
.settings-nav button.active {
  border-color: var(--line);
  background: var(--subtle);
  color: var(--text);
}
.settings-content {
  display: grid;
  min-width: 0;
  gap: 16px;
}
.flow-view {
  min-height: 0;
  overflow: auto;
  background: var(--panel);
}
.flow-body {
  width: min(1440px, calc(100vw - 100px));
  margin: 0 auto;
  padding: 48px 0 28px;
}
.flow-head {
  margin-bottom: 18px;
}
.flow-head h1 {
  margin: 0 0 5px;
  font-size: 22px;
}
.flow-head p {
  margin: 0;
  color: var(--muted);
}
.flow-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--line);
}
.flow-tabs button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 12px;
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  background: transparent;
  color: var(--muted);
}
.flow-tabs button.active {
  border-bottom-color: var(--accent);
  color: var(--text);
}
.flow-list {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: var(--panel);
}
.flow-row {
  display: grid;
  grid-template-columns: minmax(180px, 1.5fr) minmax(90px, .6fr) minmax(150px, 1fr) minmax(150px, 1fr) auto;
  align-items: center;
  gap: 16px;
  min-height: 62px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
}
.flow-row:last-child { border-bottom: 0; }
.flow-row-head {
  min-height: 38px;
  background: var(--header);
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}
.flow-source-name {
  min-width: 0;
  display: grid;
  gap: 3px;
}
.flow-source-name strong,
.flow-source-name span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.flow-source-name span,
.flow-row time {
  color: var(--muted);
  font-size: 12px;
}
.flow-row button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.flow-log-scroll { max-height: 52vh; }
.workflow-layout {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  min-height: 580px;
  height: calc(100vh - 180px);
  border: 1px solid var(--line);
  border-radius: 9px;
  overflow: hidden;
  background: var(--panel);
}
.workflow-sidebar {
  min-height: 0;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--line);
  background: var(--header);
}
.workflow-sidebar-head {
  min-height: 42px;
  padding: 8px 10px 8px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border-bottom: 1px solid var(--line);
  font-size: 12px;
}
.workflow-sidebar-head button {
  width: 28px;
  min-height: 26px;
  padding: 0;
}
.workflow-catalog-head { border-top: 1px solid var(--line); }
.workflow-list,
.workflow-hook-list {
  min-height: 0;
  overflow: auto;
}
.workflow-list { flex: 1 1 55%; }
.workflow-hook-list { flex: 1 1 45%; }
.workflow-list-row,
.workflow-hook-list > button {
  width: 100%;
  min-height: 50px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  text-align: left;
}
.workflow-list-row:hover,
.workflow-list-row.active,
.workflow-hook-list > button:hover { background: var(--subtle); }
.workflow-list-row > span:last-child,
.workflow-hook-list > button > span {
  min-width: 0;
  display: grid;
  gap: 3px;
}
.workflow-list-row strong,
.workflow-list-row small,
.workflow-hook-list strong,
.workflow-hook-list small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.workflow-list-row small,
.workflow-hook-list small { color: var(--muted); font-size: 10px; }
.workflow-state {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--muted);
}
.workflow-state.ok { background: var(--teal); }
.workflow-state.error { background: var(--red); }
.workflow-state.running {
  background: var(--amber);
  animation: workflowNodePulse 1s ease-in-out infinite alternate;
}
.workflow-empty { padding: 14px 12px; font-size: 12px; }
.workflow-editor {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}
.workflow-toolbar {
  min-height: 58px;
  padding: 8px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}
.workflow-title {
  min-height: 24px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 0;
  background: transparent;
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
}
.workflow-meta {
  max-width: 640px;
  margin-top: 3px;
  overflow: hidden;
  color: var(--muted);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.workflow-meta.error { color: var(--red); }
.workflow-toolbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.workflow-toolbar-actions button,
.workflow-toolbar-actions label { white-space: nowrap; }
.danger-subtle { color: var(--red); }
.workflow-canvas-wrap {
  min-width: 0;
  min-height: 0;
  overflow: auto;
  background-color: var(--bg);
  background-image: radial-gradient(var(--line) 1px, transparent 1px);
  background-size: 18px 18px;
}
.workflow-canvas {
  position: relative;
  width: 4000px;
  height: 2400px;
}
.workflow-lines {
  position: absolute;
  inset: 0;
  z-index: 1;
  overflow: visible;
  pointer-events: auto;
}
.workflow-line {
  fill: none;
  stroke: var(--workflow-connection);
  stroke-width: 3;
  marker-end: url(#workflowArrow);
  filter: drop-shadow(0 0 3px color-mix(in srgb, var(--workflow-connection) 55%, transparent));
  pointer-events: none;
}
.workflow-arrow { fill: var(--workflow-input); }
.workflow-data-arrow { fill: var(--workflow-data); }
.workflow-line.data {
  stroke: var(--workflow-data);
  marker-end: url(#workflowDataArrow);
  filter: drop-shadow(0 0 3px color-mix(in srgb, var(--workflow-data) 55%, transparent));
}
.workflow-line.pending {
  stroke: var(--workflow-output);
  stroke-width: 4;
  stroke-dasharray: 9 6;
  opacity: 1;
  animation: workflowConnectionDash .55s linear infinite;
}
.workflow-line.pending.data { stroke: var(--workflow-data); }
.workflow-line.selected { stroke: var(--red); stroke-width: 3; }
.workflow-line-hit {
  fill: none;
  stroke: transparent;
  stroke-width: 14;
  cursor: pointer;
  pointer-events: stroke;
}
.workflow-edge-controls {
  position: absolute;
  inset: 0;
  z-index: 5;
  pointer-events: none;
}
.workflow-edge-delete {
  position: absolute;
  width: 22px;
  height: 22px;
  min-height: 22px;
  padding: 0;
  border-radius: 50%;
  border-color: var(--line);
  background: var(--panel);
  color: var(--muted);
  opacity: .72;
  pointer-events: auto;
}
.workflow-edge-delete:hover {
  border-color: var(--red);
  color: var(--red);
  opacity: 1;
}
.workflow-node {
  position: absolute;
  z-index: 2;
  width: 220px;
  min-height: 94px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--panel);
  box-shadow: 0 8px 24px rgba(0, 0, 0, .12);
  user-select: none;
}
.workflow-node.trigger { border-top: 3px solid var(--orange); }
.workflow-node.action { border-top: 3px solid var(--accent); }
.workflow-node.running {
  border-color: var(--amber);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--amber) 22%, transparent), 0 8px 24px rgba(0, 0, 0, .12);
  animation: workflowNodePulse 1s ease-in-out infinite alternate;
}
.workflow-node.error {
  border-color: var(--red);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--red) 20%, transparent), 0 8px 24px rgba(0, 0, 0, .12);
}
.workflow-node.dragging { z-index: 4; box-shadow: 0 12px 30px rgba(0, 0, 0, .22); }
.workflow-node-head {
  min-height: 34px;
  padding: 5px 7px 5px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  cursor: grab;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
}
.workflow-node-head > span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.workflow-node-actions button {
  width: 23px;
  min-height: 22px;
  padding: 0;
  border: 0;
  background: transparent;
}
.workflow-node-body {
  padding: 10px;
  display: grid;
  gap: 5px;
}
.workflow-node-body strong,
.workflow-node-body span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.workflow-node-body span { color: var(--muted); font-size: 11px; }
.workflow-node-error {
  padding: 7px 10px;
  border-top: 1px solid color-mix(in srgb, var(--red) 45%, var(--line));
  background: color-mix(in srgb, var(--red) 9%, transparent);
  color: var(--red);
  font-size: 11px;
  line-height: 1.35;
  overflow-wrap: anywhere;
  user-select: text;
}
.workflow-input-mode {
  width: max-content;
  padding: 2px 6px;
  border: 1px solid var(--workflow-input);
  border-radius: 10px;
  color: var(--workflow-input);
  font-size: 10px;
  font-weight: 700;
}
.workflow-port {
  position: absolute;
  z-index: 3;
  top: 50%;
  width: 18px;
  height: 18px;
  min-height: 18px;
  padding: 0;
  border: 3px solid var(--panel);
  border-radius: 50%;
  box-shadow: 0 0 0 2px currentColor;
  transform: translateY(-50%);
}
.workflow-port:hover { transform: translateY(-50%) scale(1.22); }
.workflow-port-control { top: 36%; }
.workflow-port-data {
  top: 72%;
  color: var(--workflow-data);
  background: var(--workflow-data);
}
.workflow-port-in {
  left: -10px;
  color: var(--workflow-input);
  background: var(--workflow-input);
}
.workflow-port-out {
  right: -10px;
  color: var(--workflow-output);
  background: var(--workflow-output);
}
.workflow-port-in.workflow-port-data,
.workflow-port-out.workflow-port-data {
  color: var(--workflow-data);
  background: var(--workflow-data);
}
.workflow-port-out.connecting-origin {
  transform: translateY(-50%) scale(1.28);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--workflow-output) 38%, transparent), 0 0 14px var(--workflow-output);
}
.workflow-port-data.connecting-origin {
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--workflow-data) 38%, transparent), 0 0 14px var(--workflow-data);
}
.workflow-canvas.connecting-control .workflow-port-in.workflow-port-control {
  animation: workflowPortPulse .75s ease-in-out infinite alternate;
}
.workflow-canvas.connecting-data .workflow-port-in.workflow-port-data {
  animation: workflowDataPortPulse .75s ease-in-out infinite alternate;
}
@keyframes workflowDataPortPulse {
  to {
    transform: translateY(-50%) scale(1.22);
    box-shadow: 0 0 0 5px color-mix(in srgb, var(--workflow-data) 24%, transparent);
  }
}
@keyframes workflowNodePulse {
  to { filter: brightness(1.12); }
}
@keyframes workflowConnectionDash {
  to { stroke-dashoffset: -15; }
}
@keyframes workflowPortPulse {
  to {
    transform: translateY(-50%) scale(1.22);
    box-shadow: 0 0 0 5px color-mix(in srgb, var(--workflow-input) 24%, transparent);
  }
}
.workflow-python-code {
  min-height: 280px;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
}
.workflow-canvas-empty {
  position: absolute;
  top: 70px;
  left: 70px;
  width: 360px;
  padding: 18px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  font-size: 12px;
}
.workflow-welcome {
  align-self: center;
  justify-self: center;
  width: min(420px, calc(100% - 40px));
  display: grid;
  justify-items: center;
  gap: 10px;
  color: var(--muted);
  text-align: center;
}
.workflow-welcome > .ui-icon { width: 36px; height: 36px; }
.workflow-welcome strong { color: var(--text); font-size: 16px; }
.workflow-template-hint { margin: -6px 0 8px; font-size: 11px; }
.workflow-data-contract {
  display: grid;
  gap: 10px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
.workflow-data-contract-title {
  display: flex;
  align-items: center;
  gap: 7px;
}
.workflow-data-contract-title .ui-icon { width: 15px; height: 15px; }
.workflow-data-contract-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 16px;
}
.workflow-data-contract-item {
  display: grid;
  min-width: 0;
  gap: 6px;
}
.workflow-data-contract-item > span,
.workflow-data-paths > span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}
.workflow-data-contract-item pre {
  min-height: 48px;
  margin: 0;
  padding: 8px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--input);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.workflow-data-contract-item small { color: var(--muted); line-height: 1.4; }
.workflow-data-paths {
  display: grid;
  gap: 4px;
  margin-top: 2px;
}
.workflow-data-paths code { white-space: pre-wrap; overflow-wrap: anywhere; }
.workflow-data-contract-note { margin: 0; font-size: 11px; line-height: 1.45; }
@media (max-width: 700px) {
  .workflow-data-contract-grid { grid-template-columns: 1fr; }
}
.details-tabs {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  border-bottom: 1px solid var(--line);
}
.details-tabs button {
  min-height: 44px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--text);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.details-tabs button.active {
  color: var(--blue);
  box-shadow: inset 0 -2px 0 var(--blue);
}
.details-body {
  width: min(980px, calc(100vw - 360px));
  justify-self: center;
  display: grid;
  align-content: start;
  grid-auto-rows: max-content;
  gap: 16px;
  padding: 24px 0;
  overflow: auto;
}
.details-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.details-head button,
.panel-actions button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.details-head input { max-width: 360px; }
.details-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: var(--panel);
}
.field-settings-row {
  display: grid;
  grid-template-columns: 22px 24px minmax(0, 1fr) 120px;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 0 14px;
  border-bottom: 1px solid var(--line);
  position: relative;
  transition: background-color .14s ease, box-shadow .14s ease, opacity .14s ease;
}
.field-settings-row[draggable="true"] { cursor: grab; }
.field-settings-row[draggable="true"]:active { cursor: grabbing; }
.field-settings-row.col-drop-before { box-shadow: inset 0 3px 0 var(--blue); }
.field-settings-row.col-drop-after { box-shadow: inset 0 -3px 0 var(--blue); }
.field-settings-row:last-child { border-bottom: 0; }
.history-list {
  display: grid;
  align-content: start;
  max-height: min(620px, calc(100vh - 180px));
  overflow: auto;
}
.history-row {
  display: block;
  padding: 14px;
  border-bottom: 1px solid var(--line);
}
.history-row-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.history-row-main {
  min-width: 0;
}
.history-row:last-child { border-bottom: 0; }
.history-row.undone {
  opacity: .62;
}
.history-action {
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.history-meta {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}
.history-changes {
  display: grid;
  gap: 6px;
  margin-top: 10px;
}
.history-change {
  display: grid;
  grid-template-columns: minmax(100px, 180px) minmax(0, 1fr) 16px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
}
.history-change code {
  min-width: 0;
  padding: 4px 6px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--input);
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.history-change.history-id {
  grid-template-columns: minmax(100px, 180px) minmax(0, 1fr);
}
.history-change.history-id code {
  justify-self: start;
}
.history-more {
  color: var(--muted);
  font-size: 12px;
}
.history-empty {
  padding: 24px;
  color: var(--muted);
  text-align: center;
}
.endpoint-list {
  display: grid;
  gap: 12px;
  padding: 14px;
}
.endpoint-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}
.derived-details {
  display: grid;
  gap: 14px;
  padding: 14px;
}
.derived-query-label {
  display: grid;
  gap: 6px;
}
.derived-query-readonly {
  resize: vertical;
}
.derived-empty {
  padding: 18px;
  color: var(--muted);
}
.google-connect-empty {
  display: grid;
  justify-items: start;
  gap: 10px;
}
.endpoint-row input,
.endpoint-row button {
  min-height: 28px;
  height: 28px;
}
.settings-title {
  margin: 0;
  font-size: 18px;
}
.settings-card {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  padding: 12px;
}
.api-variable-list {
  display: grid;
}
.api-variable-hint {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
}
.api-variable-row {
  display: grid;
  grid-template-columns: minmax(120px, .7fr) minmax(180px, 1fr) minmax(180px, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 54px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
}
.api-variable-row:last-child { border-bottom: 0; }
.api-variable-row code {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.api-variable-row.readonly input {
  color: var(--muted);
}
.api-variable-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.api-variable-actions button,
.api-variable-new button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}
.backup-stat {
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 9px 10px;
  display: grid;
  align-content: center;
  gap: 3px;
}
.backup-stat span,
.backup-size {
  color: var(--muted);
  font-size: 12px;
}
.backup-list {
  display: grid;
}
.backup-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 82px auto;
  align-items: center;
  gap: 12px;
  min-height: 56px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
}
.user-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 180px;
  align-items: center;
  gap: 12px;
  min-height: 56px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
}
.user-row:last-child { border-bottom: 0; }
.backup-row:last-child { border-bottom: 0; }
.backup-row strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.backup-row button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.empty-row {
  padding: 18px;
  color: var(--muted);
}
.record-picker {
  display: grid;
  gap: 4px;
  max-height: 320px;
  overflow: auto;
}
.record-choice {
  display: grid;
  gap: 3px;
  width: 100%;
  border: 0;
  border-radius: 6px;
  padding: 8px;
  text-align: left;
  background: transparent;
}
.record-choice:hover { background: var(--subtle); }
.record-title {
  color: var(--text);
  font-weight: 700;
}
.record-meta {
  color: var(--muted);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.muted { color: var(--muted); }
.status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
}
.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--amber);
}
.dot.live { background: var(--teal); }
.presence-users {
  display: inline-flex;
  align-items: center;
  margin-left: 2px;
  cursor: pointer;
}
.presence-avatar,
.presence-more {
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--subtle);
  color: var(--text);
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0;
  box-shadow: 0 0 0 1px var(--panel);
}
.presence-avatar:nth-child(3n + 1) { background: rgba(20, 184, 166, .14); color: var(--teal); }
.presence-avatar:nth-child(3n + 2) { background: rgba(87, 157, 255, .12); color: var(--blue); }
.presence-avatar:nth-child(3n + 3) { background: rgba(245, 158, 11, .13); color: var(--amber); }
.presence-avatar + .presence-avatar,
.presence-avatar + .presence-more {
  margin-left: -6px;
}
.presence-more {
  background: var(--subtle);
  color: var(--text);
  border-color: var(--line);
}
.presence-list {
  display: grid;
  gap: 2px;
  min-width: 260px;
  padding: 4px;
}
.presence-row {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  padding: 7px 8px;
  border-radius: 6px;
}
.presence-row:hover { background: var(--subtle); }
.presence-row .presence-avatar {
  margin: 0;
  box-shadow: none;
}
.presence-row strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.busy-indicator {
  position: fixed;
  top: 12px;
  left: 50%;
  z-index: 90;
  transform: translateX(-50%);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 32px;
  max-width: min(460px, calc(100vw - 32px));
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  color: var(--text);
  box-shadow: var(--menu-shadow);
  font-weight: 700;
}
.busy-indicator.hidden { display: none; }
.busy-spinner {
  width: 14px;
  height: 14px;
  border: 2px solid var(--line);
  border-top-color: var(--blue);
  border-radius: 50%;
  display: inline-block;
  flex: 0 0 auto;
  animation: spin .7s linear infinite;
}
button.busy {
  opacity: .82;
  cursor: wait;
}
.toast {
  position: fixed;
  right: 16px;
  bottom: 16px;
  background: #172033;
  color: #fff;
  border-radius: 8px;
  padding: 10px 12px;
  opacity: 0;
  transform: translateY(8px);
  transition: .16s ease;
  pointer-events: none;
  max-width: min(420px, calc(100vw - 32px));
}
.toast.show { opacity: 1; transform: translateY(0); }
.hidden { display: none; }
dialog[open] { animation: dialogIn .14s ease-out; }
@keyframes menuIn {
  from { opacity: 0; transform: translateY(-4px) scale(.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes dialogIn {
  from { opacity: 0; transform: translateY(8px) scale(.99); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes columnDropIn {
  from { opacity: 0; transform: scaleY(.6); }
  to { opacity: 1; transform: scaleY(1); }
}
@keyframes spin {
  to { transform: rotate(360deg); }
}
@keyframes skeletonPulse {
  from { background-position: 120% 0; }
  to { background-position: -120% 0; }
}
@media (max-width: 900px) {
  .app {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
    height: auto;
    min-height: 100vh;
    overflow: visible;
  }
  .app.app-level-mode { grid-template-columns: 1fr; }
  .app-rail { display: none; }
  .sidebar { grid-template-rows: auto auto; }
  .table-list { display: flex; gap: 8px; overflow-x: auto; padding: 8px 12px; }
  .list-title { display: none; }
  .table-button { width: auto; white-space: nowrap; }
  .main { grid-template-rows: auto 1fr; }
  .topbar { display: flex; align-items: flex-start; flex-direction: column; height: auto; padding: 12px; }
  .view-switch { align-self: center; }
  .actions { justify-content: flex-start; }
  .details-body { width: calc(100vw - 24px); padding: 12px 0; }
  #settingsView .details-body { width: calc(100vw - 24px); padding: 20px 0; }
  .settings-layout { grid-template-columns: 1fr; gap: 20px; }
  .settings-nav {
    position: static;
    grid-template-columns: repeat(4, minmax(max-content, 1fr));
    overflow-x: auto;
  }
  .settings-nav button { justify-content: center; }
  .flow-body { width: calc(100vw - 24px); padding: 20px 0; }
  .flow-row,
  .flow-row-head { grid-template-columns: 1fr; gap: 5px; }
  .flow-row-head { display: none; }
  .flow-row { padding: 14px; }
  .flow-row button { justify-self: start; margin-top: 6px; }
  .workflow-layout {
    grid-template-columns: 1fr;
    height: auto;
    min-height: 680px;
  }
  .workflow-sidebar {
    max-height: 230px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .workflow-list,
  .workflow-hook-list { max-height: 100px; }
  .workflow-toolbar {
    align-items: flex-start;
    flex-direction: column;
  }
  .workflow-toolbar-actions { flex-wrap: wrap; }
  .workflow-canvas-wrap { height: 520px; }
  .form-grid { grid-template-columns: 1fr; }
  .api-source-head,
  .api-source-settings,
  .api-run-row { grid-template-columns: 1fr; }
  .api-source-head { display: grid; }
  .api-run-scroll { max-height: 300px; }
  .settings-card,
  .backup-row,
  .user-row { grid-template-columns: 1fr; }
  .api-variable-row { grid-template-columns: 1fr; }
  .api-variable-actions { flex-wrap: wrap; }
  .history-row-top { display: grid; }
  .history-change { grid-template-columns: 1fr; }
  .backup-size { justify-self: start; }
}
