:root {
  --bg: #f3f7ff;
  --panel: #ffffff;
  --line: #d8e2f0;
  --line-dark: #bac8dc;
  --text: #202938;
  --muted: #6b7890;
  --blue: #2686ff;
  --deep: #1f3478;
  --green: #16a34a;
  --orange: #f59e0b;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--text);
  background: var(--bg);
  font-family: Arial, Helvetica, sans-serif;
}

button,
input,
textarea {
  font: inherit;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 118px minmax(0, 1fr);
}

.side-nav {
  background: linear-gradient(180deg, #f4f9ff, #e7f1ff);
  border-right: 1px solid var(--line);
  padding: 16px 8px;
}

.brand {
  display: flex;
  flex-direction: column;
  gap: 7px;
  align-items: center;
  margin-bottom: 24px;
  text-align: center;
}

.brand-logo {
  width: 31px;
  height: 31px;
  object-fit: contain;
  background: #fff;
}

.brand strong,
.brand span {
  display: block;
  line-height: 1.1;
  font-size: 13px;
}

.brand span {
  font-weight: 800;
}

.side-nav a {
  display: block;
  padding: 11px 6px;
  margin: 5px 0;
  color: #243044;
  text-decoration: none;
  text-align: center;
  font-size: 13px;
}

.side-nav a.active {
  color: #fff;
  background: var(--deep);
  font-weight: 700;
}

.workspace {
  min-width: 0;
}

.topbar {
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  background: rgba(255, 255, 255, 0.86);
  border-bottom: 1px solid var(--line);
}

.breadcrumbs {
  color: #71809a;
}

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

.top-actions input {
  width: 280px;
  height: 34px;
  border: 1px solid var(--line);
  padding: 0 12px;
}

.top-actions a {
  color: var(--blue);
  text-decoration: none;
  font-weight: 700;
}

.designer {
  padding: 18px 16px 24px;
}

.toolbar {
  min-height: 92px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  background: var(--panel);
  border: 1px solid var(--line);
  padding: 18px 22px;
  margin-bottom: 12px;
}

.toolbar > div:first-child {
  min-width: 240px;
  flex: 1 1 340px;
}

h1 {
  margin: 0 0 7px;
  font-size: 22px;
  letter-spacing: 0;
}

.toolbar p {
  margin: 0;
  color: var(--muted);
}

.toolbar-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(152px, 1fr));
  gap: 8px;
  min-width: 0;
  flex: 1 1 800px;
  align-items: stretch;
}

.toolbar-actions button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  height: 38px;
  margin: 0;
  padding: 0 12px;
  font-size: 14px;
  line-height: 1.2;
  white-space: nowrap;
}

.template-file-input {
  display: none;
}

.workflow-tabs-wrap {
  display: flex;
  align-items: center;
  background: var(--panel);
  border: 1px solid var(--line);
  border-bottom: 0;
  padding: 8px 10px 0;
  min-height: 43px;
  overflow-x: auto;
  overflow-y: hidden;
}

.workflow-tabs {
  display: flex;
  gap: 6px;
  min-width: 0;
}

.workflow-tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 34px;
  max-width: 260px;
  border: 1px solid #b7cef4;
  border-bottom-color: var(--line);
  background: #f7fbff;
  color: #23436f;
  padding: 0 8px 0 12px;
  white-space: nowrap;
  cursor: pointer;
}

.workflow-tab.active {
  background: var(--deep);
  border-color: var(--deep);
  color: #fff;
}

.workflow-tab-title {
  overflow: hidden;
  text-overflow: ellipsis;
}

.workflow-tab-close {
  display: inline-grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border: 0;
  background: transparent;
  color: inherit;
  padding: 0;
  font-size: 16px;
  line-height: 1;
}

.template-browser {
  background: var(--panel);
  border: 1px solid var(--line);
  margin-bottom: 12px;
}

.template-browser-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.template-browser-head strong,
.template-browser-head span {
  display: block;
}

.template-browser-head strong {
  font-size: 18px;
}

.template-browser-head span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 13px;
}

.template-browser-tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
}

.template-filter-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: min(680px, 100%);
}

.template-browser-tools input,
.template-browser-tools select {
  width: min(420px, 100%);
  height: 34px;
  border: 1px solid var(--line-dark);
  padding: 0 10px;
  background: #fff;
}

.template-browser-tools select {
  width: 190px;
  color: #1f365a;
}

.template-browser-tools span {
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

.template-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
  max-height: 380px;
  overflow: auto;
  padding: 14px 16px 16px;
}

.template-card {
  --template-accent: #60a5fa;
  --template-soft: #eff6ff;
  --template-border: #bfdbfe;
  --template-text: #1d4ed8;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 218px;
  border: 1px solid var(--line);
  border-left: 5px solid var(--template-accent);
  background: #fbfdff;
  padding: 13px;
}

.template-card.template-category-real-estate {
  --template-accent: #f97316;
  --template-soft: #fff7ed;
  --template-border: #fed7aa;
  --template-text: #9a3412;
}

.template-card.template-category-e-commerce {
  --template-accent: #2563eb;
  --template-soft: #eff6ff;
  --template-border: #bfdbfe;
  --template-text: #1d4ed8;
}

.template-card.template-category-finance {
  --template-accent: #16a34a;
  --template-soft: #f0fdf4;
  --template-border: #bbf7d0;
  --template-text: #166534;
}

.template-card.template-category-research {
  --template-accent: #7c3aed;
  --template-soft: #f5f3ff;
  --template-border: #ddd6fe;
  --template-text: #5b21b6;
}

.template-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 9px;
}

.template-category {
  color: var(--template-text);
  background: var(--template-soft);
  border: 1px solid var(--template-border);
  padding: 3px 7px;
  font-size: 12px;
  font-weight: 700;
}

.template-file {
  color: var(--muted);
  font-size: 11px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.template-card h2 {
  margin: 0 0 8px;
  color: #111827;
  font-size: 16px;
  line-height: 1.25;
  letter-spacing: 0;
}

.template-card p {
  margin: 0;
  color: #4b5a73;
  font-size: 13px;
  line-height: 1.4;
}

.template-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
}

.template-tags span {
  color: var(--template-text);
  background: var(--template-soft);
  border: 1px solid var(--template-border);
  padding: 3px 6px;
  font-size: 11px;
  font-weight: 700;
}

.template-card-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 14px;
}

.template-card-actions button {
  font-size: 13px;
  padding: 0 10px;
}

.template-card-actions button.danger {
  color: #b42318;
  background: #fff7f5;
  border-color: #fecdca;
}

.template-card-actions button.danger:hover {
  background: #fee4e2;
}

.template-empty {
  grid-column: 1 / -1;
  color: var(--muted);
  border: 1px dashed var(--line-dark);
  padding: 24px;
  text-align: center;
}

.marketplace-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  margin-bottom: 12px;
  min-height: calc(100vh - 210px);
}

.template-manager-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  margin-bottom: 12px;
}

.ai-voice-builder-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  margin-bottom: 12px;
}

.ai-voice-builder-body {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: 14px;
  padding: 14px 16px 16px;
}

.ai-voice-input,
.ai-voice-preview {
  min-width: 0;
  background: #fbfdff;
  padding: 12px;
}

.ai-voice-input input { width: 100%; margin: 6px 0 10px; }
.ai-voice-conversation { height: clamp(280px, 45vh, 420px); overflow-y: auto; border-bottom: 1px solid var(--line); margin-bottom: 10px; }
.ai-voice-conversation p { margin: 8px 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.ai-voice-conversation strong { color: #087c70; }
.ai-voice-actions button { min-height: 32px; }
.ai-voice-actions button[aria-pressed="true"] { background: #fbe3e3; color: #912626; }
@media (max-width: 900px) {
  .ai-voice-builder-body { grid-template-columns: minmax(0, 1fr); padding: 10px; }
}

.ai-voice-input textarea {
  width: 100%;
  height: 62px;
  min-height: 62px;
  max-height: 140px;
  font-size: 14px;
  line-height: 20px;
  overflow-y: auto;
  resize: vertical;
  border: 1px solid var(--line-dark);
  padding: 10px;
  background: #fff;
}

.ai-voice-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  margin-top: 10px;
}

.ai-voice-input span {
  display: block;
  margin-top: 10px;
  color: var(--muted);
  font-size: 13px;
}

.ai-voice-preview pre {
  min-height: 180px;
  max-height: 320px;
  overflow: auto;
  margin: 0;
  padding: 12px;
  border-top: 1px solid var(--line);
  background: #fff;
  color: #14213d;
  font: 12px/1.45 Consolas, "Courier New", monospace;
  white-space: pre-wrap;
}

.template-manager-tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
}

.template-manager-tools span {
  color: var(--muted);
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.template-manager-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  padding: 14px 16px 16px;
}

.manager-section {
  min-width: 0;
  border: 1px solid var(--line);
  background: #fbfdff;
}

.manager-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  background: #f7fbff;
}

.manager-section-head strong {
  font-size: 14px;
}

.manager-section-head span {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.manager-list {
  display: grid;
  gap: 8px;
  max-height: 430px;
  overflow: auto;
  padding: 10px;
}

.manager-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  background: #fff;
  padding: 10px;
}

.manager-item strong,
.manager-item span,
.manager-item small {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.manager-item strong {
  font-size: 13px;
  color: #111827;
  white-space: nowrap;
}

.manager-item span {
  margin-top: 4px;
  color: #4b5a73;
  font-size: 12px;
  white-space: nowrap;
}

.manager-item small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
}

.manager-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
}

.manager-item button.danger,
.manager-actions button.danger {
  color: #b42318;
  background: #fff7f5;
  border-color: #fecdca;
}

.manager-timer {
  align-items: start;
}

.marketplace-grid {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 14px;
  padding: 14px 16px 16px;
  min-height: calc(100vh - 300px);
}

.marketplace-left {
  display: grid;
  gap: 12px;
  align-content: start;
  max-height: calc(100vh - 330px);
  overflow: auto;
  padding-right: 4px;
}

.developer-card {
  display: grid;
  gap: 10px;
  align-content: start;
  padding: 14px;
  background: #f8fbff;
  border: 1px solid var(--line);
}

.developer-card strong {
  font-size: 17px;
}

.developer-card > span,
.marketplace-status {
  color: var(--muted);
  font-size: 13px;
}

.developer-card label {
  display: grid;
  gap: 5px;
  color: #1f2d45;
  font-size: 13px;
  font-weight: 700;
}

.developer-card input,
.developer-card select,
.developer-card textarea,
.marketplace-tools input,
.marketplace-tools select {
  width: 100%;
  min-height: 34px;
  border: 1px solid var(--line-dark);
  background: #fff;
  padding: 7px 9px;
}

.developer-card textarea {
  resize: vertical;
}

.button-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.marketplace-tools {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) 170px auto;
  gap: 8px;
  margin-bottom: 8px;
}

.marketplace-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(255px, 1fr));
  gap: 12px;
  max-height: calc(100vh - 365px);
  min-height: 560px;
  overflow: auto;
  padding-right: 2px;
  align-content: start;
}

.marketplace-card {
  min-height: 260px;
}

.marketplace-meta {
  display: grid;
  gap: 4px;
  margin-top: 12px;
  color: #51617c;
  font-size: 12px;
}

.marketplace-status-pill {
  justify-self: start;
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  margin-top: 8px;
  padding: 3px 8px;
  border: 1px solid #bdd2f3;
  background: #eef6ff;
  color: #213f7a;
  font-size: 12px;
  font-weight: 800;
  text-transform: capitalize;
}

.marketplace-status-pill.status-pending_review {
  border-color: #f5c56b;
  background: #fff5d9;
  color: #7a4b00;
}

.marketplace-status-pill.status-listed,
.marketplace-status-pill.status-approved {
  border-color: #9ce8b6;
  background: #e6fff0;
  color: #087333;
}

.marketplace-status-pill.status-rejected {
  border-color: #ffb3b3;
  background: #fff0f0;
  color: #b11212;
}

button {
  height: 34px;
  border: 1px solid #b7cef4;
  color: var(--blue);
  background: #eef6ff;
  padding: 0 14px;
  cursor: pointer;
}

button.primary {
  color: #fff;
  background: var(--blue);
  border-color: var(--blue);
}

button.active {
  color: #fff;
  background: var(--deep);
  border-color: var(--deep);
}

.designer-grid {
  display: grid;
  grid-template-columns: 260px minmax(600px, 1fr) 320px;
  gap: 12px;
  height: calc(100vh - 231px);
  min-height: 620px;
  align-items: stretch;
}

.palette,
.canvas-wrap,
.properties {
  background: var(--panel);
  border: 1px solid var(--line);
  min-height: 0;
}

.palette,
.properties {
  padding: 16px;
  height: 100%;
}

.palette {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.node-library {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  padding-right: 2px;
}

.properties {
  overflow: auto;
}

.panel-title {
  font-weight: 800;
  color: #1e293b;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 12px;
}

.palette-node {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  border: 1px solid #c7d7ee;
  background: #f7fbff;
  padding: 10px 9px;
  margin-bottom: 8px;
  cursor: grab;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.palette-node:hover {
  border-color: #8bbcff;
  background: #ffffff;
  box-shadow: 0 6px 14px rgba(33, 84, 154, 0.08);
}

.palette-node:active {
  cursor: grabbing;
}

.palette-copy {
  min-width: 0;
}

.palette-node strong {
  display: block;
  font-size: 13px;
  line-height: 1.25;
}

.palette-node span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.node-search {
  width: 100%;
  height: 34px;
  border: 1px solid var(--line-dark);
  padding: 0 10px;
  margin-bottom: 12px;
}

.node-library {
  display: grid;
  gap: 9px;
}

.node-group {
  border: 1px solid var(--line);
  background: #fbfdff;
}

.node-group summary {
  display: flex;
  align-items: center;
  gap: 9px;
  cursor: pointer;
  padding: 10px 11px;
  font-weight: 800;
  color: #243044;
  list-style: none;
}

.node-group summary::-webkit-details-marker {
  display: none;
}

.node-group summary::before {
  content: "+";
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  color: var(--blue);
  border: 1px solid #bfdbfe;
  font-size: 12px;
}

.node-group[open] summary::before {
  content: "-";
}

.group-icon,
.node-icon {
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  object-fit: contain;
}

.group-icon {
  width: 20px;
  height: 20px;
}

.node-icon {
  margin-top: 2px;
}

.group-icon.fallback,
.node-icon.fallback {
  display: inline-grid;
  place-items: center;
  color: #fff;
  background: linear-gradient(135deg, #2563eb, #06b6d4);
  font-size: 11px;
  font-weight: 800;
}

.node-subgroup {
  padding: 0 10px 8px 10px;
}

#nodeLibrary .fallback {
  background: var(--library-icon-color, #2563eb);
}

.node-subgroup-title {
  display: flex;
  align-items: center;
  margin: 8px 0 7px;
  padding: 5px 0;
  color: #64748b;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  cursor: pointer;
  list-style: none;
}

.node-subgroup-title::-webkit-details-marker {
  display: none;
}

.node-subgroup-title::before {
  content: "+";
  display: inline-grid;
  place-items: center;
  width: 14px;
  height: 14px;
  margin-right: 6px;
  color: #2563eb;
  border: 1px solid #bfdbfe;
  font-size: 10px;
}

.node-subgroup[open] > .node-subgroup-title::before {
  content: "-";
}

.node-tag {
  display: inline-block;
  margin-top: 7px;
  padding: 2px 6px;
  background: #eef2ff;
  color: #1d4ed8;
  font-size: 10px;
  font-weight: 800;
}

.runtime-card {
  margin-top: 14px;
  padding: 13px;
  border: 1px solid var(--line);
  background: #f9fbff;
}

.runtime-card span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 4px;
}

.runtime-card strong {
  font-size: 13px;
}

.canvas-wrap {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}

.canvas-head {
  display: grid;
  grid-template-columns: minmax(240px, 0.36fr) minmax(360px, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 0 16px;
  min-height: 46px;
  border-bottom: 1px solid var(--line);
}

.canvas-head > div:first-child {
  min-width: 0;
}

.workflow-title-block {
  position: relative;
  min-width: 0;
}

.workflow-title-block strong {
  display: block;
  overflow: hidden;
  color: #172033;
  font-size: 16px;
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.workflow-title-block span {
  position: absolute;
  left: 0;
  top: calc(100% + 9px);
  z-index: 20;
  display: none;
  width: min(420px, 70vw);
  padding: 9px 10px;
  color: #334155;
  background: #fff;
  border: 1px solid #bfdbfe;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.16);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.35;
}

.workflow-title-block:hover span,
.workflow-title-block:focus-within span {
  display: block;
}

.canvas-result-tabs-host {
  min-width: 0;
}

.canvas-result-tabs-shell {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 9px;
  min-width: 0;
}

.canvas-result-tabs-shell > strong {
  color: #64748b;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.canvas-result-tabs {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
  padding: 6px 2px;
  scrollbar-width: thin;
}

.canvas-result-tabs button {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 6px;
  flex: 0 0 172px;
  min-height: 32px;
  padding: 5px 8px;
  text-align: left;
  color: #0f172a;
  background: #fff;
  border: 1px solid #d7e4f5;
  box-shadow: 0 2px 5px rgba(15, 23, 42, 0.05);
}

.canvas-result-tabs button.active {
  color: #0f172a;
  background: #eef6ff;
  border-color: #2563eb;
  box-shadow: inset 0 -2px 0 #2563eb, 0 2px 5px rgba(37, 99, 235, 0.08);
}

.canvas-result-tabs button b,
.canvas-result-tabs button em {
  min-width: 0;
}

.canvas-result-tabs button b {
  overflow: hidden;
  font-size: 11px;
  font-weight: 900;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.result-step-number {
  display: inline-grid;
  place-items: center;
  width: 18px;
  height: 18px;
  color: #334155;
  background: #e2e8f0;
  font-size: 10px;
  font-weight: 900;
}

.result-step-number.pass,
.result-step-number.connected {
  color: #065f46;
  background: #dcfce7;
}

.result-step-number.error,
.result-step-number.failed {
  color: #991b1b;
  background: #fee2e2;
}

.result-step-number.pending {
  color: #475569;
  background: #e2e8f0;
}

.canvas-result-tabs button em {
  width: fit-content;
  max-width: 58px;
  overflow: hidden;
  padding: 2px 5px;
  color: #065f46;
  background: #dcfce7;
  font-style: normal;
  font-size: 9px;
  font-weight: 900;
  line-height: 1.1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.canvas-result-tabs button.active em {
  color: #1e3a8a;
  background: #dbeafe;
}

.canvas-result-tabs em.error {
  color: #991b1b;
  background: #fee2e2;
}

.canvas-result-table-host {
  min-width: 0;
  max-height: 230px;
  overflow: auto;
  background: #fff;
  border-bottom: 1px solid var(--line);
}

.canvas-result-panel {
  padding: 9px 14px 11px;
}

.canvas-result-panel .result-table-wrap {
  max-height: 148px;
}

.canvas {
  position: relative;
  overflow: auto;
  background:
    linear-gradient(to right, rgba(38, 134, 255, 0.08) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(38, 134, 255, 0.08) 1px, transparent 1px),
    #fbfdff;
  background-size: 24px 24px;
}

.links {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.workflow-node {
  position: absolute;
  width: 188px;
  min-height: 76px;
  border: 1px solid #bed0e8;
  background: #fff;
  box-shadow: 0 8px 18px rgba(25, 43, 80, 0.09);
  cursor: move;
}

.workflow-node.selected {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(38, 134, 255, 0.15), 0 8px 18px rgba(25, 43, 80, 0.09);
}

.node-head {
  height: 28px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  background: var(--deep);
}

.canvas-node-icon {
  width: 18px;
  height: 18px;
  object-fit: contain;
  background: #fff;
  border: 1px solid rgba(255, 255, 255, 0.76);
}

.canvas-node-icon.fallback {
  display: inline-grid;
  place-items: center;
  color: var(--deep);
  font-size: 10px;
  font-weight: 900;
}

.node-body {
  padding: 10px;
}

.node-body strong {
  display: block;
  margin-bottom: 5px;
}

.node-body span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.node-connection {
  display: inline-flex;
  margin-top: 8px;
  padding: 3px 7px;
  font-style: normal;
  font-size: 10px;
  font-weight: 800;
}

.node-connection.success {
  color: #047857;
  background: #dcfce7;
}

.node-connection.error {
  color: #b91c1c;
  background: #fee2e2;
}

.node-connection.testing {
  color: #1d4ed8;
  background: #dbeafe;
}

.node-connection.manual {
  color: #92400e;
  background: #fef3c7;
}

.type-trigger .node-head { background: var(--blue); }
.type-condition .node-head { background: var(--orange); }
.type-control .node-head { background: #475569; }
.type-cellx-db .node-head { background: #0f766e; }
.type-ai .node-head { background: #7c3aed; }
.type-external-agent .node-head { background: #4f46e5; }
.type-carrier .node-head { background: #0891b2; }
.type-amazon .node-head { background: #334155; }
.type-script .node-head { background: #111827; }
.type-action .node-head { background: var(--green); }
.type-log .node-head { background: #64748b; }

.properties label {
  display: block;
  color: #334155;
  font-weight: 700;
  margin: 14px 0;
}

.properties input,
.properties select,
.properties textarea {
  width: 100%;
  margin-top: 7px;
  border: 1px solid var(--line-dark);
  padding: 9px 10px;
  color: var(--text);
  background: #fff;
}

.properties textarea {
  resize: vertical;
  line-height: 1.5;
}

.integration-fields {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.integration-title {
  margin-bottom: 12px;
}

.integration-title strong {
  display: block;
  color: #1e293b;
  font-size: 15px;
}

.integration-title span {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.integration-field {
  margin: 10px 0;
  font-size: 12px;
}

.daily-time-field {
  min-width: 0;
}

.daily-time-field input {
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}

.daily-time-field input[type="time"] {
  min-height: 40px;
  font-size: 16px;
  font-variant-numeric: tabular-nums;
}

.daily-cron-advanced summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 12px;
}

.daily-cron-status {
  font-size: 12px;
  line-height: 1.4;
  color: #92400e;
  overflow-wrap: anywhere;
}

.required-mark,
.optional-mark {
  float: right;
  padding: 2px 6px;
  font-size: 10px;
  font-weight: 800;
}

.required-mark {
  color: #b91c1c;
  background: #fee2e2;
}

.optional-mark {
  color: #475569;
  background: #eef2ff;
}

.integration-field input,
.integration-field select,
.integration-field textarea {
  margin-top: 6px;
  font-size: 12px;
}

.integration-field select {
  appearance: auto;
  height: 36px;
}

.connection-actions {
  display: grid;
  grid-template-columns: 1fr 1.15fr 1fr;
  gap: 8px;
  align-items: stretch;
  margin: 14px 0 12px;
}

.property-action-bar {
  position: sticky;
  top: -16px;
  z-index: 4;
  margin: -2px 0 12px;
  padding: 8px 0 10px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}

.property-actions {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 0;
}

.connection-actions button {
  min-width: 0;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
  font-size: 12px;
  line-height: 1.08;
  text-align: center;
  white-space: normal;
}

.mapping-builder {
  margin: 12px 0;
  padding: 10px;
  border: 1px solid #dbe6f5;
  background: #f8fbff;
}

.mapping-title strong,
.mapping-title span {
  display: block;
}

.mapping-title strong {
  color: #1e293b;
  font-size: 12px;
}

.mapping-title span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.mapping-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.mapping-row label {
  margin: 9px 0;
  font-size: 11px;
}

.mapping-builder button {
  width: 100%;
  margin-top: 2px;
}

.manual-handoff-tools {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 12px 0;
}

.manual-handoff-tools button {
  min-width: 0;
  min-height: 36px;
  padding: 0 8px;
  font-size: 12px;
  line-height: 1.15;
  text-align: center;
}

.connection-status {
  padding: 11px 12px;
  border: 1px solid;
  margin-bottom: 12px;
}

.connection-status strong,
.connection-status span {
  display: block;
}

.connection-status strong {
  font-size: 13px;
}

.connection-status span {
  margin-top: 4px;
  font-size: 12px;
  line-height: 1.45;
}

.connection-status.success {
  color: #065f46;
  background: #ecfdf5;
  border-color: #86efac;
}

.connection-status.error {
  color: #991b1b;
  background: #fef2f2;
  border-color: #fca5a5;
}

.connection-status.testing {
  color: #1e40af;
  background: #eff6ff;
  border-color: #93c5fd;
}

.connection-status.manual {
  color: #92400e;
  background: #fffbeb;
  border-color: #fcd34d;
}

.secret-note {
  margin: 10px 0 0;
  padding: 9px 10px;
  color: #475569;
  background: #f8fbff;
  border: 1px dashed #c7d7ee;
  font-size: 12px;
  line-height: 1.45;
}

.test-results {
  margin: 12px 0;
  border: 1px solid var(--line);
  background: #f8fbff;
}

.test-results.empty {
  padding: 12px;
  color: var(--muted);
  font-size: 12px;
}

.test-results-title {
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.test-results-title strong,
.test-results-title span {
  display: block;
}

.test-results-title strong {
  color: #1e293b;
  font-size: 13px;
}

.test-results-title span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
}

.workflow-result-tabs {
  margin: 10px;
  background: #fff;
  border: 1px solid #dbe6f5;
}

.result-tabs-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 10px;
  border-bottom: 1px solid #e2e8f0;
}

.result-tabs-title strong {
  color: #172033;
  font-size: 12px;
}

.result-tabs-title span {
  color: var(--muted);
  font-size: 11px;
}

.result-tab-list {
  display: flex;
  gap: 6px;
  padding: 8px;
  overflow-x: auto;
  border-bottom: 1px solid #e2e8f0;
}

.result-tab-list button {
  flex: 0 0 150px;
  min-height: 50px;
  padding: 7px 8px;
  text-align: left;
  background: #f8fbff;
  border: 1px solid #c7d7ee;
}

.result-tab-list button.active {
  color: #fff;
  background: #1e40af;
  border-color: #1e40af;
}

.result-tab-list button span,
.result-tab-list button em {
  display: block;
}

.result-tab-list button span {
  overflow: hidden;
  font-size: 11px;
  font-weight: 800;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.result-tab-list button em {
  margin-top: 5px;
  width: fit-content;
  padding: 2px 5px;
  color: #475569;
  background: #e2e8f0;
  font-style: normal;
  font-size: 10px;
  font-weight: 800;
}

.result-tab-list button.active em {
  color: #1e3a8a;
  background: #dbeafe;
}

.result-tab-list em.success {
  color: #065f46;
  background: #dcfce7;
}

.result-tab-list em.error {
  color: #991b1b;
  background: #fee2e2;
}

.result-tab-panel {
  padding: 10px;
}

.result-tab-panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.result-tab-panel-head strong,
.result-tab-panel-head span {
  display: block;
}

.result-tab-panel-head strong {
  color: #172033;
  font-size: 13px;
}

.result-tab-panel-head span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.result-tab-panel-head button {
  flex: 0 0 auto;
  min-height: 28px;
  padding: 4px 9px;
  color: var(--blue);
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  font-size: 11px;
  font-weight: 800;
}

.result-table-shell {
  position: relative;
  width: 100%;
  min-width: 0;
}

.result-scroll-hint {
  position: absolute;
  right: 20px;
  top: 8px;
  z-index: 4;
  padding: 3px 8px;
  color: #1e40af;
  background: rgba(239, 246, 255, 0.92);
  border: 1px solid #bfdbfe;
  font-size: 10px;
  font-weight: 800;
  pointer-events: none;
}

.result-table-shell::after {
  content: "";
  position: absolute;
  top: 1px;
  right: 16px;
  bottom: 16px;
  width: 34px;
  z-index: 3;
  pointer-events: none;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0), rgba(30, 64, 175, 0.12));
}

.result-table-wrap {
  width: 100%;
  min-width: 0;
  max-height: 320px;
  overflow-x: scroll;
  overflow-y: scroll;
  border: 1px solid #dbe6f5;
  background: #fff;
  scrollbar-gutter: stable both-edges;
  scrollbar-color: #8b98aa #eef2f7;
  scrollbar-width: auto;
}

.result-table-wrap::-webkit-scrollbar {
  width: 15px;
  height: 15px;
}

.result-table-wrap::-webkit-scrollbar-track {
  background: #eef2f7;
  border-top: 1px solid #dbe6f5;
  border-left: 1px solid #dbe6f5;
}

.result-table-wrap::-webkit-scrollbar-thumb {
  background: #8b98aa;
  border: 3px solid #eef2f7;
}

.result-table-wrap::-webkit-scrollbar-thumb:hover {
  background: #64748b;
}

.result-table-wrap::-webkit-scrollbar-corner {
  background: #eef2f7;
}

.result-data-table {
  width: max-content;
  min-width: 680px;
  border-collapse: collapse;
  table-layout: auto;
}

.result-data-table th,
.result-data-table td {
  min-width: 116px;
  max-width: 260px;
  padding: 8px 10px;
  border-bottom: 1px solid #e2e8f0;
  border-right: 1px solid #eef2f7;
  color: #172033;
  font-size: 12px;
  line-height: 1.35;
  text-align: left;
  vertical-align: top;
}

.result-data-table th {
  position: sticky;
  top: 0;
  z-index: 2;
  color: #0f172a;
  background: #eef6ff;
  font-weight: 900;
  white-space: normal;
  overflow-wrap: anywhere;
}

.result-data-table td {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.result-cell-link {
  display: inline-block;
  max-width: 100%;
  overflow: hidden;
  color: var(--blue);
  font-weight: 700;
  text-decoration: underline;
  text-overflow: ellipsis;
  vertical-align: top;
  white-space: nowrap;
}

.result-cell-link:hover {
  color: #1d4ed8;
}

.result-data-table th:first-child,
.result-data-table td:first-child {
  position: sticky;
  left: 0;
  z-index: 1;
  min-width: 92px;
  background: inherit;
}

.result-data-table th:first-child {
  z-index: 3;
  background: #eef6ff;
}

.result-data-table td:first-child {
  background: #fff;
}

.result-data-table tr:hover td {
  background: #f8fbff;
}

.result-data-table tr:hover td:first-child {
  background: #f8fbff;
}

.result-table-foot,
.result-table-empty {
  padding: 7px 2px 0;
  color: var(--muted);
  font-size: 11px;
}

.result-table-empty {
  padding: 10px;
  border: 1px dashed #c7d7ee;
  background: #f8fbff;
}

.test-result-card {
  padding: 11px 12px;
  border-top: 1px solid #e2e8f0;
}

.test-result-card:first-of-type {
  border-top: 0;
}

.test-result-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.test-result-head span {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 6px;
}

.test-result-head strong {
  min-width: 0;
  color: #172033;
  font-size: 12px;
  line-height: 1.25;
}

.test-result-head button {
  min-height: 24px;
  padding: 3px 7px;
  color: var(--blue);
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  font-size: 10px;
  font-weight: 800;
}

.test-result-head em {
  flex: 0 0 auto;
  padding: 2px 6px;
  font-style: normal;
  font-size: 10px;
  font-weight: 800;
  color: #475569;
  background: #e2e8f0;
}

.test-result-card.success .test-result-head em {
  color: #065f46;
  background: #dcfce7;
}

.test-result-card.error .test-result-head em {
  color: #991b1b;
  background: #fee2e2;
}

.test-result-card.testing .test-result-head em {
  color: #1e40af;
  background: #dbeafe;
}

.test-result-card.manual .test-result-head em {
  color: #92400e;
  background: #fef3c7;
}

.test-result-card p {
  margin: 7px 0 9px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.io-grid {
  display: grid;
  gap: 8px;
}

.io-grid b {
  display: block;
  margin-bottom: 4px;
  color: #334155;
  font-size: 10px;
  text-transform: uppercase;
}

.io-title-row {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 6px;
  margin-bottom: 7px;
}

.io-title-row b {
  margin-bottom: 0;
}

[data-copy-node-output] {
  min-width: 44px;
  min-height: 22px;
  height: 22px;
  padding: 2px 7px;
  color: var(--blue);
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  font-size: 10px;
  font-weight: 800;
  line-height: 1;
}

[data-copy-node-output].copied {
  color: #047857;
  background: #ecfdf5;
  border-color: #86efac;
}

[data-copy-node-output].copy-failed {
  color: #991b1b;
  background: #fef2f2;
  border-color: #fca5a5;
}

.io-grid pre {
  max-height: 112px;
  margin: 0;
  padding: 8px;
  overflow: auto;
  color: #172033;
  background: #fff;
  border: 1px solid #dbe6f5;
  font-size: 10px;
  line-height: 1.35;
  white-space: pre-wrap;
  word-break: break-word;
}

.result-dialog-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(15, 23, 42, 0.38);
}

.result-dialog {
  width: min(1080px, 94vw);
  max-height: 88vh;
  overflow: hidden;
  display: grid;
  grid-template-rows: auto auto auto minmax(0, 1fr);
  background: #f8fbff;
  border: 1px solid #bfdbfe;
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.24);
}

.result-dialog header {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 88px 16px 18px;
  background: #fff;
  border-bottom: 1px solid var(--line);
}

.result-dialog header button {
  position: absolute;
  top: 14px;
  right: 18px;
  z-index: 5;
  min-width: 56px;
  min-height: 34px;
  color: var(--blue);
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  font-weight: 800;
}

.result-dialog header strong,
.result-dialog header span {
  display: block;
}

.result-dialog header strong {
  color: #111827;
  font-size: 18px;
}

.result-dialog header span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.result-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
}

.result-summary div {
  padding: 10px;
  background: #fff;
  border: 1px solid #dbe6f5;
}

.result-summary span {
  display: block;
  color: var(--muted);
  font-size: 11px;
}

.result-summary strong {
  display: block;
  margin-top: 4px;
  color: #111827;
  font-size: 14px;
  line-height: 1.3;
  word-break: break-word;
}

.result-dialog-table {
  min-width: 0;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.result-dialog-section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.result-dialog-section-title b {
  color: #334155;
  font-size: 11px;
  text-transform: uppercase;
}

.result-dialog-section-title span {
  color: var(--muted);
  font-size: 11px;
}

.result-dialog-table .result-table-wrap {
  height: clamp(260px, 44vh, 430px);
  max-height: 48vh;
  min-height: 260px;
}

.result-dialog-grid {
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: 12px;
  padding: 16px 18px 18px;
  overflow: auto;
}

.result-dialog-grid b {
  display: block;
  margin-bottom: 7px;
  color: #334155;
  font-size: 11px;
  text-transform: uppercase;
}

.result-dialog-grid pre {
  max-height: 56vh;
  margin: 0;
  padding: 12px;
  overflow: auto;
  color: #172033;
  background: #fff;
  border: 1px solid #dbe6f5;
  font-size: 12px;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}

.hint {
  color: var(--muted);
  background: #f7fbff;
  border: 1px solid var(--line);
  padding: 12px;
  line-height: 1.5;
}

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

  .side-nav {
    display: none;
  }

  .designer-grid {
    grid-template-columns: 1fr;
    height: auto;
  }

  .canvas {
    height: 560px;
  }
}

@media (max-width: 720px) {
  body {
    background: #eef5ff;
  }

  .workspace {
    width: 100%;
    overflow-x: hidden;
  }

  .topbar {
    height: auto;
    min-height: 58px;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px;
    padding: 10px 12px;
  }

  .breadcrumbs {
    font-size: 12px;
    line-height: 1.35;
  }

  .top-actions {
    justify-content: flex-end;
  }

  .top-actions input {
    display: none;
  }

  .top-actions a {
    font-size: 12px;
    line-height: 1.2;
  }

  .designer {
    padding: 10px;
  }

  .toolbar {
    display: grid;
    min-height: 0;
    gap: 14px;
    padding: 14px;
    margin-bottom: 10px;
  }

  h1 {
    font-size: 21px;
  }

  .toolbar p {
    font-size: 13px;
    line-height: 1.45;
  }

  .toolbar-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(124px, 1fr));
    gap: 8px;
  }

  .toolbar-actions button {
    padding: 0 8px;
    font-size: 12px;
  }

  button {
    min-width: 0;
    height: 38px;
    padding: 0 8px;
    font-size: 12px;
    white-space: normal;
    line-height: 1.15;
  }

  .designer-grid {
    gap: 10px;
    min-height: 0;
  }

  .palette,
  .properties {
    padding: 12px;
  }

  .palette {
    max-height: 420px;
  }

  .panel-title {
    margin-bottom: 10px;
    padding-bottom: 10px;
  }

  .node-search {
    height: 38px;
  }

  .node-group summary {
    min-height: 44px;
    padding: 10px;
    font-size: 14px;
  }

  .node-subgroup-title {
    min-height: 36px;
  }

  .palette-node {
    grid-template-columns: 28px minmax(0, 1fr);
    padding: 10px;
  }

  .palette-node strong {
    font-size: 13px;
  }

  .palette-node span {
    font-size: 12px;
  }

  .runtime-card {
    margin-top: 10px;
  }

  .canvas-wrap {
    min-width: 0;
  }

  .canvas-head {
    grid-template-columns: 1fr;
    min-height: 58px;
    gap: 10px;
    padding: 8px 10px;
  }

  .canvas-head strong {
    display: block;
    font-size: 14px;
  }

  .canvas-head span {
    font-size: 11px;
    line-height: 1.35;
  }

  .canvas-result-tabs-shell {
    grid-template-columns: 1fr;
    gap: 5px;
  }

  .canvas-result-tabs {
    padding: 4px 1px;
  }

  .canvas-result-tabs button {
    flex-basis: 148px;
  }

  .canvas-result-table-host {
    max-height: 240px;
  }

  .canvas {
    height: 760px;
    overflow: auto;
    touch-action: pan-x pan-y;
  }

  .links {
    min-width: 280px;
    min-height: 760px;
  }

  .workflow-node {
    width: 176px;
    min-height: 74px;
  }

  .node-head {
    height: 27px;
    font-size: 11px;
  }

  .node-body {
    padding: 9px;
  }

  .node-body span {
    font-size: 11px;
    overflow-wrap: anywhere;
  }

  .properties label {
    margin: 12px 0;
    font-size: 13px;
  }

  .properties input,
  .properties textarea {
    padding: 9px;
  }

  .hint {
    font-size: 13px;
  }

  .tabs {
    overflow-x: auto;
    padding-bottom: 2px;
  }

  .tabs button {
    flex: 0 0 auto;
    min-width: 170px;
  }

  .marketplace-panel {
    min-height: 0;
    margin-bottom: 10px;
    overflow: hidden;
  }

  .template-browser-head {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    padding: 12px;
  }

  .template-browser-head button {
    width: 100%;
  }

  .template-browser-tools {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    padding: 12px;
  }

  .template-filter-row {
    display: grid;
    grid-template-columns: 1fr;
    min-width: 0;
  }

  .template-browser-tools input,
  .template-browser-tools select {
    width: 100%;
    min-height: 40px;
  }

  .template-browser-tools span {
    white-space: normal;
  }

  .template-list {
    grid-template-columns: 1fr;
    max-height: none;
    overflow: visible;
    padding: 12px;
  }

  .marketplace-grid {
    grid-template-columns: 1fr;
    min-height: 0;
    gap: 12px;
    padding: 12px;
  }

  .marketplace-left {
    max-height: none;
    overflow: visible;
    padding-right: 0;
  }

  .developer-card {
    padding: 12px;
    gap: 9px;
  }

  .developer-card strong {
    font-size: 16px;
  }

  .developer-card label {
    font-size: 12px;
  }

  .developer-card input,
  .developer-card select,
  .developer-card textarea,
  .marketplace-tools input,
  .marketplace-tools select {
    min-height: 40px;
    font-size: 13px;
  }

  .button-row {
    grid-template-columns: 1fr;
  }

  .marketplace-tools {
    grid-template-columns: 1fr;
    gap: 8px;
    margin-bottom: 10px;
  }

  .marketplace-status {
    font-size: 12px;
    margin-bottom: 8px;
  }

  .marketplace-list {
    grid-template-columns: 1fr;
    max-height: none;
    min-height: 0;
    overflow: visible;
    padding-right: 0;
    gap: 10px;
  }

  .marketplace-card {
    min-height: 0;
  }

  .marketplace-card .template-card-top {
    gap: 8px;
  }

  .marketplace-card h2 {
    font-size: 16px;
    line-height: 1.22;
  }

  .marketplace-card p {
    font-size: 13px;
    line-height: 1.4;
  }

  .marketplace-meta {
    font-size: 12px;
  }

  .template-card-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .template-card-actions button {
    width: 100%;
    min-height: 38px;
  }

  .result-dialog-backdrop {
    padding: 10px;
    align-items: stretch;
  }

  .result-dialog {
    width: 100%;
    max-height: calc(100vh - 20px);
  }

  .result-dialog header {
    align-items: flex-start;
    flex-direction: column;
    padding-right: 88px;
  }

  .result-dialog header button {
    width: auto;
  }

  .result-tabs-title,
  .result-tab-panel-head,
  .result-dialog-section-title {
    align-items: flex-start;
    flex-direction: column;
  }

  .result-tab-list button {
    flex-basis: 132px;
  }

  .result-tab-panel-head button {
    width: 100%;
  }

  .result-table-wrap {
    max-height: 300px;
    min-height: 220px;
  }

  .result-dialog-table .result-table-wrap {
    height: 300px;
    max-height: 42vh;
  }

  .result-data-table {
    min-width: 620px;
  }

  .result-dialog-grid {
    grid-template-columns: 1fr;
  }
}

/* Spacious result dialogs across all Agent nodes. */
.result-dialog-backdrop { padding: 12px; }
.result-dialog { width: 80vw; height: 80dvh; max-height: 80dvh; box-sizing: border-box; }
@media (max-width: 640px) { .result-dialog-backdrop { padding: 6px; } .result-dialog { width: calc(100vw - 12px); height: calc(100dvh - 12px); max-height: calc(100dvh - 12px); } }
