/* AI 创作空间 — 对齐 zeroCode?tab=create */
.agent-studio-page {
  --as-purple: #e63323;
  --as-purple-light: #fde8e6;
  --as-border: #e5e7eb;
  --as-bg: #f4f6fb;
  color: #1e293b;
  margin: -24px -24px 0;
  width: calc(100% + 48px);
  min-height: calc(100vh - 56px - 48px);
}

#page-agent:has(.agent-studio-page:not(.hidden)) > .max-w-6xl {
  max-width: none;
  padding-left: 0;
  padding-right: 0;
  padding-bottom: 0;
}

.as-layout {
  display: flex;
  min-height: inherit;
  background: var(--as-bg);
}

.as-sidebar {
  width: 220px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  padding: 16px 12px;
  border-right: 1px solid var(--as-border);
  background: #fff;
}

.as-brand {
  font-size: 15px;
  font-weight: 700;
  color: #0f172a;
  padding: 4px 8px 16px;
}

.as-menu {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 16px;
}

.as-menu-btn {
  width: 100%;
  padding: 10px 12px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: #64748b;
  font-size: 14px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: all 0.16s ease;
}

.as-menu-btn:hover {
  background: #f8fafc;
  color: #334155;
}

.as-menu-btn.active {
  background: var(--as-purple-light);
  color: var(--as-purple);
  font-weight: 600;
}

.as-create-block {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 12px;
  border-top: 1px solid #f1f5f9;
}

.as-create-btn {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition: all 0.16s ease;
}

.as-create-btn.is-simple {
  border: 1px solid var(--as-border);
  background: #fff;
  color: #475569;
}

.as-create-btn.is-simple:hover {
  border-color: #f5c6c0;
  color: var(--as-purple);
}

.as-create-btn.is-advanced {
  border: 0;
  background: linear-gradient(135deg, #e63323, #c0271b);
  color: #fff;
  box-shadow: 0 6px 16px rgba(192,39,27, 0.25);
}

.as-create-btn.is-advanced.active {
  outline: 2px solid #f5c6c0;
  outline-offset: 2px;
}

.as-online-link {
  margin-top: auto;
  padding: 10px 8px 4px;
  font-size: 12px;
  color: #94a3b8;
  text-decoration: none;
}

.as-online-link:hover {
  color: var(--as-purple);
}

.as-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.as-list-view {
  flex: 1;
  padding: 20px 24px;
  overflow-y: auto;
}

.as-list-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.as-list-title {
  font-size: 18px;
  font-weight: 700;
  color: #0f172a;
}

.as-search {
  width: 240px;
  height: 36px;
  padding: 0 12px;
  border: 1px solid var(--as-border);
  border-radius: 8px;
  font-size: 13px;
  background: #fff;
  outline: none;
}

.as-search:focus {
  border-color: #f2796b;
  box-shadow: 0 0 0 3px rgba(242,121,107, 0.2);
}

.as-app-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
}

.as-app-item {
  padding: 14px;
  border: 1px solid var(--as-border);
  border-radius: 12px;
  background: #fff;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

.as-app-item:hover {
  border-color: #f5c6c0;
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.06);
}

.as-app-item-name {
  font-size: 14px;
  font-weight: 600;
  color: #0f172a;
}

.as-app-item-meta {
  margin-top: 6px;
  font-size: 12px;
  color: #94a3b8;
}

.as-editor-view {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.as-editor-view.hidden,
.as-list-view.hidden {
  display: none;
}

.as-editor-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--as-border);
  background: #fff;
  flex-wrap: wrap;
}

.as-back-btn {
  padding: 6px 10px;
  border: 1px solid var(--as-border);
  border-radius: 8px;
  background: #fff;
  color: #64748b;
  font-size: 13px;
  cursor: pointer;
}

.as-back-btn:hover {
  background: #f8fafc;
}

.as-app-name-input {
  flex: 1;
  min-width: 160px;
  max-width: 280px;
  height: 36px;
  padding: 0 12px;
  border: 1px solid var(--as-border);
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
}

.as-mode-tabs {
  display: flex;
  padding: 3px;
  border-radius: 8px;
  background: #f1f5f9;
}

.as-mode-tab {
  padding: 6px 14px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #64748b;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}

.as-mode-tab.active {
  background: #fff;
  color: var(--as-purple);
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
}

.as-toolbar-actions {
  display: flex;
  gap: 8px;
  margin-left: auto;
}

.as-tool-btn {
  padding: 6px 14px;
  border: 1px solid var(--as-border);
  border-radius: 8px;
  background: #fff;
  color: #475569;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}

.as-tool-btn:hover {
  border-color: #f5c6c0;
  color: var(--as-purple);
}

.as-tool-btn.primary {
  border-color: transparent;
  background: linear-gradient(135deg, #e63323, #c0271b);
  color: #fff;
}

.as-editor-body {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 320px;
  min-height: 0;
}

@media (max-width: 1100px) {
  .as-editor-body {
    grid-template-columns: 1fr;
  }

  .as-debug-panel {
    display: none;
  }
}

.as-canvas-area {
  position: relative;
  overflow: auto;
  padding: 20px;
  background:
    radial-gradient(circle at 1px 1px, #d1d5db 1px, transparent 0);
  background-size: 20px 20px;
  background-color: #f8fafc;
}

.as-canvas {
  position: relative;
  min-width: 720px;
  min-height: 480px;
}

.as-canvas svg.as-edges {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.as-wf-node {
  position: absolute;
  width: 200px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 2px solid #fff;
  background: #fff;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.1);
  cursor: pointer;
  transition: box-shadow 0.16s ease, border-color 0.16s ease;
}

.as-wf-node:hover,
.as-wf-node.is-selected {
  border-color: #f2796b;
  box-shadow: 0 8px 24px rgba(192,39,27, 0.18);
}

.as-wf-node.is-start {
  border-top: 3px solid #e63323;
}

.as-wf-node.is-llm {
  border-top: 3px solid #e63323;
}

.as-wf-node.is-dataset {
  border-top: 3px solid #e63323;
}

.as-wf-node.is-reply {
  border-top: 3px solid #c0271b;
}

.as-wf-node-type {
  font-size: 11px;
  font-weight: 600;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.as-wf-node-title {
  margin-top: 4px;
  font-size: 14px;
  font-weight: 600;
  color: #0f172a;
}

.as-wf-node-desc {
  margin-top: 4px;
  font-size: 12px;
  color: #64748b;
  line-height: 1.4;
}

.as-node-palette {
  position: absolute;
  left: 20px;
  bottom: 20px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  max-width: 420px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--as-border);
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
}

.as-palette-label {
  width: 100%;
  font-size: 11px;
  font-weight: 600;
  color: #94a3b8;
  margin-bottom: 2px;
}

.as-palette-chip {
  padding: 4px 10px;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  background: #f8fafc;
  font-size: 12px;
  color: #475569;
  cursor: pointer;
}

.as-palette-chip:hover {
  border-color: #f5c6c0;
  color: var(--as-purple);
  background: var(--as-purple-light);
}

.as-debug-panel {
  display: flex;
  flex-direction: column;
  border-left: 1px solid var(--as-border);
  background: #fff;
  min-height: 0;
}

.as-debug-head {
  padding: 14px 16px;
  border-bottom: 1px solid #f1f5f9;
  font-size: 14px;
  font-weight: 700;
  color: #0f172a;
}

.as-debug-chat {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.as-chat-bubble {
  max-width: 92%;
  padding: 10px 12px;
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.5;
}

.as-chat-bubble.is-bot {
  align-self: flex-start;
  background: #f1f5f9;
  color: #334155;
  border-bottom-left-radius: 4px;
}

.as-chat-bubble.is-user {
  align-self: flex-end;
  background: linear-gradient(135deg, #e63323, #c0271b);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.as-debug-input {
  padding: 12px 16px;
  border-top: 1px solid #f1f5f9;
}

.as-debug-input input {
  width: 100%;
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--as-border);
  border-radius: 10px;
  font-size: 13px;
  outline: none;
}

.as-debug-input input:focus {
  border-color: #f2796b;
}

.as-kb-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.as-kb-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--as-border);
  border-radius: 12px;
  background: #fff;
  cursor: pointer;
  text-align: left;
}

.as-kb-item:hover {
  border-color: #f5c6c0;
}

.as-kb-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: linear-gradient(135deg, #f2796b, #c0271b);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
}

.as-empty-tip {
  padding: 40px;
  text-align: center;
  color: #94a3b8;
  font-size: 14px;
}
