﻿:root {
  --bg-primary: #f5f5f5;
  --bg-secondary: #ffffff;
  --text-primary: #1a1a1a;
  --text-secondary: #666666;
  --text-muted: #999999;
  --border-color: #e5e5e5;
  --accent-purple: #8b5cf6;
  --accent-purple-dark: #7c3aed;
  --shadow-card: 0 10px 30px rgba(0, 0, 0, 0.05);
  --radius-lg: 16px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
}

a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; }

.login-wrap {
  width: 100vw;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background-color: #f0f2f5;
  background-image: radial-gradient(#d1d1d1 1px, transparent 1px);
  background-size: 24px 24px;
}

.login-card {
  width: min(420px, 100%);
  background: #fff;
  border: 1px solid #ececec;
  border-radius: 20px;
  box-shadow: 0 18px 50px rgba(15, 23, 42, 0.08);
  padding: 28px;
}

.login-title {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 8px;
}

.login-sub {
  font-size: 13px;
  color: #6b7280;
  line-height: 1.7;
  margin-bottom: 18px;
}

.field-label {
  font-size: 12px;
  color: var(--text-secondary);
  display: block;
  margin-bottom: 6px;
}

.base-input,
.base-textarea,
.scene-select,
.sub-input,
.sticker-type-select,
.sticker-description-input {
  width: 100%;
  border: 1px solid #dcdde3;
  border-radius: 12px;
  background: #fafafa;
  color: #333;
  outline: none;
  transition: border-color 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;
}

.base-input,
.sub-input {
  height: 42px;
  padding: 0 14px;
}

.base-textarea {
  min-height: 84px;
  padding: 12px 14px;
  resize: vertical;
}

.base-input:focus,
.base-textarea:focus,
.scene-select:focus,
.sub-input:focus,
.sticker-type-select:focus,
.sticker-description-input:focus {
  border-color: rgba(124, 58, 237, 0.45);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.08);
}

.solid-btn,
.ghost-pill,
.secondary-wide-btn,
.toolbar-pill,
.preview-tab,
.preview-open-link {
  border: none;
  cursor: pointer;
}

.solid-btn {
  width: 100%;
  height: 46px;
  border-radius: 12px;
  background: #111827;
  color: #fff;
  font-size: 14px;
  font-weight: 600;
}

.error-text {
  font-size: 12px;
  color: #d14343;
  line-height: 1.6;
  margin-top: 10px;
}

.page-shell {
  width: 100vw;
  height: 100vh;
  display: flex;
  flex-direction: column;
  background-color: #f0f2f5;
}

.page-header {
  height: 64px;
  background: #fff;
  border-bottom: 1px solid #e5e5e5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
}

.brand-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-logo {
  width: 32px;
  height: 32px;
  object-fit: contain;
}

.brand-name {
  font-size: 18px;
  font-weight: 600;
  color: #1a1a1a;
}

.brand-name span {
  font-size: 12px;
  font-weight: 400;
  color: #999;
  margin-left: 8px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 12px;
  color: #7a7a7a;
}

.ghost-pill {
  border: 1px solid #d9d9d9;
  background: #fff;
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 12px;
}

.workspace-shell {
  flex: 1;
  display: flex;
  gap: 24px;
  padding: 24px;
  position: relative;
  overflow: hidden;
  background-image: radial-gradient(#d1d1d1 1px, transparent 1px);
  background-size: 24px 24px;
}

.panel-card {
  background: #fff;
  border: 1px solid rgba(137, 120, 207, 0.14);
  border-radius: 16px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
}

.left-sidebar {
  width: 320px;
  height: 100%;
  min-height: 0;
  padding: 22px 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow: auto;
}

.config-item {
  position: relative;
  background: #f8f8f9;
  border-radius: 16px;
  padding: 14px;
  transition: background-color 0.2s ease;
}

.config-item:hover { background: #f3f3f5; }
.style-config-item { overflow: visible; }

.model-selector-box,
.style-selector-box {
  display: flex;
  align-items: center;
  gap: 12px;
}

.style-action-stack {
  display: flex;
  align-items: center;
  gap: 8px;
}

.style-picker-trigger {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
}

.model-icon {
  min-width: 44px;
  font-size: 18px;
  font-weight: 800;
}

.model-copy,
.style-copy {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.mini-label {
  font-size: 11px;
  color: var(--text-secondary);
}

.mini-value {
  margin-top: 2px;
  font-size: 13px;
  line-height: 1.35;
  font-weight: 600;
  word-break: break-all;
}

.icon-btn {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: transparent;
  color: #333;
  border: none;
}

.icon-btn:hover {
  background: rgba(0, 0, 0, 0.05);
}

.icon-btn.active {
  background: rgba(139, 92, 246, 0.12);
  color: #7c3aed;
}

.model-menu {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 200px;
  z-index: 20;
  background: #fff;
  border: 1px solid rgba(0, 0, 0, 0.06);
  border-radius: 14px;
  box-shadow: 0 12px 36px rgba(15, 23, 42, 0.14);
  padding: 8px;
}

.model-menu.open { display: block; }

.model-menu-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  text-align: left;
}

.model-menu-item + .model-menu-item { margin-top: 4px; }
.model-menu-item:hover { background: rgba(124, 58, 237, 0.05); }
.model-menu-item.active {
  background: linear-gradient(135deg, #f7f3ff, #efe8ff);
  border-color: rgba(124, 58, 237, 0.2);
}

.model-menu-badge {
  font-size: 13px;
  font-weight: 800;
}

.style-upload-box {
  position: relative;
  width: 44px;
  height: 44px;
  border: 1px dashed #9a9a9a;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
  color: #666;
  background: #fff;
}

.style-upload-box.filled {
  border-style: solid;
  border-color: rgba(124, 58, 237, 0.25);
}

.style-upload-box img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.style-upload-box input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.left-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 0;
}

.sticker-block {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sticker-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.sticker-type-select {
  width: 62px;
  min-width: 62px;
  height: 32px;
  padding: 0 8px;
  font-size: 12px;
  appearance: none;
  background-image: none;
}

.sticker-description-input {
  height: 32px;
  padding: 0 10px;
  font-size: 12px;
}

.form-section-title {
  margin-top: 6px;
  font-size: 12px;
  font-weight: 700;
  color: #333;
}

.upload-line {
  height: 34px;
  border: 1px dashed #d9d9d9;
  border-radius: 12px;
  background: #fafafa;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  font-size: 12px;
  color: #555;
}

.upload-line input { width: 110px; font-size: 12px; }

.upload-caption-row {
  margin-top: -2px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.upload-caption {
  font-size: 11px;
  color: #999;
}

.upload-clear-btn,
.clear-visual-btn {
  border: none;
  background: transparent;
  color: #a855f7;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}

.upload-clear-btn:hover,
.clear-visual-btn:hover {
  color: #7c3aed;
}

.option-stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 4px;
}

.option-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.option-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-primary);
  font-weight: 600;
  flex-shrink: 0;
}

.option-control {
  flex: 1;
  display: flex;
  justify-content: flex-end;
}

.scene-select,
.sub-input {
  min-width: 140px;
  height: 34px;
  padding: 0 12px;
  font-size: 12px;
}

.pill-switch,
.quality-switch {
  display: flex;
  align-items: center;
  gap: 4px;
  background: #f4f4f5;
  border-radius: 999px;
  padding: 3px;
}

.pill-btn,
.quality-btn {
  min-width: 52px;
  height: 32px;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: #666;
  font-size: 12px;
  padding: 0 12px;
}

.pill-btn.active,
.quality-btn.active {
  background: #fff;
  color: #111827;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.08);
  font-weight: 700;
}

.quick-meta {
  display: grid;
  gap: 6px;
  padding: 12px;
  border-radius: 14px;
  background: #fafafa;
  border: 1px solid #efefef;
  font-size: 12px;
}

.quick-meta div {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  color: #666;
}

.quick-meta strong { color: #1a1a1a; }

.generate-btn-large {
  position: relative;
  width: 100%;
  min-height: 54px;
  margin-top: auto;
  border: none;
  border-radius: 16px;
  background: linear-gradient(135deg, #8d54ff, #6d28d9);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  box-shadow: 0 12px 28px rgba(109, 40, 217, 0.22);
}

.generate-btn-large:disabled {
  background: linear-gradient(135deg, #e8e8e8, #d8d8d8);
  color: #999;
  box-shadow: none;
}

.generate-btn-large.is-generating {
  cursor: wait;
}

.cancel-generate-btn,
.secondary-wide-btn {
  width: 100%;
  height: 38px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 600;
}

.cancel-generate-btn {
  border: 1px solid rgba(239, 68, 68, 0.35);
  background: rgba(254, 242, 242, 0.9);
  color: #dc2626;
}

.secondary-wide-btn {
  border: 1px solid #e0e0e0;
  background: #fafafa;
  color: #444;
}

.cancel-generate-btn:disabled,
.secondary-wide-btn:disabled { opacity: 0.5; }

.center-column {
  flex: 1;
  min-width: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.workspace-panel {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

.workspace-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 24px;
  border-bottom: 1px solid #f0f0f0;
  background: rgba(255, 255, 255, 0.92);
}

.workspace-title {
  font-size: 15px;
  color: #333;
  font-weight: 700;
}

.workspace-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.meta-chip {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 2px 8px;
  border-radius: 999px;
  background: #f5f5f8;
  border: 1px solid #ececf2;
  color: #6d28d9;
  font-size: 11px;
  font-weight: 600;
}

.workspace-body {
  flex: 1;
  min-height: 0;
  position: relative;
  overflow: auto;
  padding: 24px;
  background-image: radial-gradient(#e0e0e0 1px, transparent 1px);
  background-size: 24px 24px;
}

.hero-preview-wrap {
  height: 100%;
  min-height: 420px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.hero-preview-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 13px;
  font-weight: 600;
  color: #555;
}

.hero-preview-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.preview-tab,
.preview-open-link {
  height: 32px;
  border-radius: 999px;
  padding: 0 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  border: 1px solid #e8e8e8;
  background: #fff;
  color: #666;
}

.preview-tab.active {
  background: rgba(139, 92, 246, 0.1);
  color: #6d28d9;
  border-color: rgba(139, 92, 246, 0.18);
}

.hero-preview-stage {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.hero-preview-stage img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 16px;
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.08);
  background: #fff;
}

.hero-preview-stage.compact {
  min-height: 260px;
}

.result-stack-view,
.inpaint-result-stack {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.result-preview-block {
  min-height: 0;
  border: 1px solid #ececf3;
  border-radius: 18px;
  background: linear-gradient(180deg, #fcfcfe 0%, #f5f7fb 100%);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.workspace-empty {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: #8a8a8a;
  text-align: center;
}

.workspace-empty-title {
  font-size: 14px;
  font-weight: 600;
  color: #666;
}

.workspace-empty-desc {
  font-size: 12px;
  line-height: 1.6;
  max-width: 260px;
}

.delivery-toolbar {
  padding: 14px 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.delivery-tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.delivery-left-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.toolbar-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid #e0e0e0;
  background: #fff;
  color: #555;
  font-size: 12px;
}

.toolbar-pill.active {
  color: #6d28d9;
  background: rgba(139, 92, 246, 0.09);
  border-color: rgba(139, 92, 246, 0.18);
}

.toolbar-pill.disabled,
.toolbar-pill:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.toolbar-status {
  font-size: 12px;
  color: #999;
  text-align: right;
}

.slice-toolbar-row {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}

.slice-toolbar-title {
  font-size: 12px;
  font-weight: 700;
  color: #666;
  padding-top: 10px;
}

.slice-toolbar-track {
  min-width: 0;
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.slice-thumb {
  width: 88px;
  min-width: 88px;
  border-radius: 12px;
  border: 1px solid #ececec;
  background: #fafafa;
  overflow: hidden;
  padding: 0;
  text-align: left;
}

.slice-thumb img {
  width: 100%;
  height: 110px;
  object-fit: cover;
  display: block;
}

.slice-thumb span {
  display: block;
  padding: 6px 8px;
  font-size: 11px;
  color: #666;
}

.slice-thumb.active {
  border-color: rgba(139, 92, 246, 0.45);
  box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.12);
}

.toolbar-empty {
  min-height: 88px;
  display: flex;
  align-items: center;
  color: #999;
  font-size: 12px;
}

.agent-panel {
  width: 312px;
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.agent-header-row {
  padding: 12px 14px;
  border-bottom: 1px solid #f0f0f0;
  font-size: 12px;
  font-weight: 700;
  color: #6a6491;
}

.agent-body {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 12px 14px 14px;
  display: grid;
  gap: 12px;
  align-content: start;
}

.agent-note {
  font-size: 11px;
  line-height: 1.8;
  color: #8e88b2;
}

.agent-summary-card,
.agent-box,
.agent-details {
  border: 1px solid rgba(137, 120, 207, 0.14);
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(255,255,255,0.98), rgba(248,246,255,0.98));
  padding: 10px 12px;
  font-size: 12px;
  color: #5f5b76;
  line-height: 1.7;
}

.agent-summary-card {
  display: grid;
  gap: 6px;
}

.agent-summary-card div {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.agent-summary-card strong,
.agent-box strong { color: #2a2344; }

.agent-stage-list {
  display: grid;
  gap: 6px;
}

.agent-stage-card {
  border: 1px solid rgba(137, 120, 207, 0.14);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.82);
  overflow: hidden;
}

.agent-stage-card summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  font-size: 12px;
  color: #7a7399;
}

.agent-stage-card summary::-webkit-details-marker {
  display: none;
}

.agent-stage-card.reached summary {
  color: #5b5775;
}

.agent-stage-card.active {
  border-color: rgba(139, 92, 246, 0.26);
  box-shadow: 0 0 0 1px rgba(139, 92, 246, 0.08);
}

.agent-stage-card.active summary {
  background: rgba(139, 92, 246, 0.08);
  color: #5d4aca;
  font-weight: 700;
}

.agent-stage-status {
  font-size: 11px;
  color: #9a95b5;
  white-space: nowrap;
}

.agent-stage-meta {
  padding: 0 12px 8px;
  font-size: 11px;
  color: #8c86aa;
}

.agent-stage-card pre {
  margin: 0;
  padding: 0 12px 12px;
  max-height: 240px;
  overflow: auto;
  white-space: pre-wrap;
  font-size: 11px;
  color: #5f5b76;
}

.agent-box-title {
  font-size: 12px;
  font-weight: 700;
  color: #2a2344;
  margin-bottom: 4px;
}

.agent-details summary {
  cursor: pointer;
  font-weight: 700;
  color: #2a2344;
}

.agent-details pre {
  margin: 10px 0 0;
  max-height: 260px;
  overflow: auto;
  white-space: pre-wrap;
  font-size: 11px;
  color: #5f5b76;
}

@media (max-width: 1400px) {
  .workspace-shell {
    gap: 16px;
    padding: 16px;
  }

  .agent-panel {
    width: 280px;
  }
}

@media (max-width: 1180px) {
  .workspace-shell {
    flex-direction: column;
    overflow: auto;
  }

  .left-sidebar,
  .agent-panel {
    width: 100%;
    height: auto;
  }

  .center-column {
    height: auto;
  }
}
.color-panel {
  display: grid;
  gap: 10px;
}

.color-popover {
  position: fixed;
  top: 88px;
  left: 88px;
  width: 258px;
  max-width: min(258px, calc(100vw - 32px));
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 22px 52px rgba(15, 23, 42, 0.18);
  padding: 14px;
  border: 1px solid rgba(15, 23, 42, 0.08);
  z-index: 9999;
  transform-origin: top right;
  animation: color-popover-enter 0.16s ease;
}

@keyframes color-popover-enter {
  from {
    opacity: 0;
    transform: translateY(-6px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.palette-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 600;
  color: #444;
}

.text-link-btn {
  border: none;
  background: transparent;
  color: #8b5cf6;
  font-size: 12px;
  cursor: pointer;
}

.color-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
  min-height: 28px;
}

.color-swatch {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 8px;
  border: 1px solid rgba(15, 23, 42, 0.08);
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.color-swatch:hover {
  transform: scale(1.04);
}

.color-swatch.selected {
  box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.18);
}

.empty-color-text {
  grid-column: 1 / -1;
  font-size: 11px;
  color: #999;
  display: flex;
  align-items: center;
}

.preset-row {
  height: 24px;
  display: flex;
  overflow: hidden;
  border-radius: 8px;
  border: 1px solid #ececec;
  background: #fff;
  padding: 0;
}

.preset-row span {
  flex: 1;
}

.create-palette-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  color: #333;
  font-size: 12px;
  text-align: left;
}

.add-icon-box {
  width: 28px;
  height: 28px;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #333;
  flex-shrink: 0;
}

.create-palette-btn input {
  position: absolute;
  width: 0;
  height: 0;
  opacity: 0;
  pointer-events: none;
}

.palette-divider {
  height: 1px;
  background: #eee;
  margin: 0;
}

.palette-presets {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.bottom-toolbar {
  padding: 10px 16px 12px;
  display: grid;
  gap: 10px;
}

.toolbar-main-row,
.toolbar-sub-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.toolbar-tools {
  display: flex;
  align-items: stretch;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.toolbar-tool {
  min-width: 74px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  border: none;
  border-radius: 14px;
  background: transparent;
  color: #666;
  padding: 10px 8px;
  font-size: 12px;
}

.toolbar-tool.active {
  background: rgba(139, 92, 246, 0.1);
  color: #7c3aed;
  font-weight: 700;
}

.toolbar-tool-icon {
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  background: rgba(139, 92, 246, 0.08);
  font-size: 15px;
}

.toolbar-side-status {
  text-align: right;
  font-size: 12px;
  color: #777;
  white-space: nowrap;
}

.toolbar-sub-left,
.toolbar-sub-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.toolbar-mini-link,
.toolbar-mini-muted {
  font-size: 12px;
}

.toolbar-mini-link {
  color: #7c3aed;
}

.toolbar-mini-muted {
  color: #999;
}

.preview-mini-btn {
  min-height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid #e0e0e0;
  background: #fff;
  color: #555;
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.preview-mini-btn.active {
  border-color: rgba(139, 92, 246, 0.18);
  background: rgba(139, 92, 246, 0.09);
  color: #7c3aed;
}

.upload-mini-btn {
  position: relative;
  overflow: hidden;
}

.upload-mini-btn input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.tool-workspace {
  height: 100%;
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 14px;
}

.tool-controls {
  display: grid;
  gap: 10px;
}

.tool-controls-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.tool-controls-row.wrap {
  align-items: flex-end;
}

.tool-controls-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
}

.tool-controls-grid label,
.tool-controls-row label {
  display: grid;
  gap: 6px;
  font-size: 12px;
  color: #666;
}

.tool-select {
  min-width: 160px;
}

.tool-source-name,
.tool-hint {
  font-size: 12px;
  color: #888;
}

.workspace-empty-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 14px;
}

.tool-stage {
  min-height: 0;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid #ededed;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: auto;
  padding: 16px;
}

.tool-stage img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 14px;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.08);
  background: #fff;
}

.tool-slider-label input[type="range"] {
  width: 180px;
}

.tool-prompt-area {
  min-height: 92px;
  width: min(820px, 100%);
}

.inpaint-workspace {
  grid-template-rows: auto 1fr;
}

.inpaint-stage-shell {
  min-height: 0;
  border-radius: 18px;
  background: linear-gradient(180deg, #f9fafc 0%, #f2f4f8 100%);
  border: 1px solid #ececf3;
  padding: 16px;
  overflow: auto;
}

.inpaint-stage-media {
  position: relative;
  width: min(100%, 980px);
  margin: 0 auto;
  border-radius: 18px;
  overflow: hidden;
  background:
    radial-gradient(circle at 1px 1px, rgba(148, 163, 184, 0.2) 1px, transparent 0);
  background-size: 18px 18px;
  box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.06);
}

.inpaint-stage-media img,
.inpaint-stage-media canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

.inpaint-stage-media img {
  object-fit: contain;
  background: #fff;
}

.inpaint-stage-media canvas {
  cursor: crosshair;
  touch-action: none;
}

.inpaint-stage-media canvas[data-mode="erase"] {
  cursor: cell;
}

.inpaint-stage-media canvas[data-mode="rect"] {
  cursor: crosshair;
}

.slice-grid-canvas {
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(var(--slice-cols, 3), minmax(0, 1fr));
  gap: 6px;
  align-content: start;
  overflow: auto;
  padding: 2px;
  border-radius: 18px;
  background: #f5f6fb;
}

.slice-grid-canvas .workspace-empty {
  grid-column: 1 / -1;
}

.slice-tile {
  position: relative;
  overflow: hidden;
  border-radius: 14px;
  background: #fff;
  box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.06);
}

.slice-tile-media {
  position: absolute;
  inset: 0;
}

.slice-tile img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.slice-tile-meta {
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 7px 9px;
  border-radius: 999px;
  background: rgba(17, 24, 39, 0.68);
  color: rgba(255, 255, 255, 0.92);
  font-size: 11px;
  backdrop-filter: blur(10px);
}

.slice-tile-meta a {
  color: #ffffff;
  text-decoration: none;
  font-weight: 700;
}

.hero-preview-head.compact {
  margin-bottom: 10px;
}

.workspace-empty.small {
  min-height: 220px;
}

@media (max-width: 1180px) {
  .slice-grid-canvas {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .toolbar-main-row,
  .toolbar-sub-row {
    flex-direction: column;
    align-items: flex-start;
  }

  .toolbar-side-status {
    text-align: left;
    white-space: normal;
  }
}

.manual-shell {
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(139, 92, 246, 0.08), transparent 26%),
    linear-gradient(180deg, #f5f7fb 0%, #eef2f8 100%);
}

.manual-topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 24px;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(15, 23, 42, 0.08);
}

.manual-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.manual-logo {
  width: 36px;
  height: 36px;
  object-fit: contain;
}

.manual-brand-title {
  font-size: 18px;
  font-weight: 700;
  color: #111827;
}

.manual-brand-sub {
  font-size: 12px;
  color: #8b5cf6;
}

.manual-nav {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.05);
}

.manual-nav a {
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  color: #6b7280;
}

.manual-nav a.active {
  background: #fff;
  color: #111827;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
}

.manual-main {
  padding: 24px;
  display: grid;
  gap: 18px;
}

.manual-card {
  background: #fff;
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 20px;
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.06);
}

.manual-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) 320px;
  gap: 18px;
  padding: 28px;
}

.promptl-hero {
  grid-template-columns: minmax(0, 1fr) 320px;
}

.manual-eyebrow {
  margin-bottom: 10px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #8b5cf6;
}

.manual-hero h1 {
  margin: 0 0 10px;
  font-size: 34px;
  line-height: 1.15;
}

.manual-hero p,
.manual-side-card p,
.promptl-section-head p,
.promptl-help {
  color: #667085;
  line-height: 1.8;
}

.manual-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.manual-primary-btn,
.manual-secondary-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 16px;
  border-radius: 12px;
  border: 1px solid transparent;
  font-size: 13px;
  font-weight: 700;
}

.manual-primary-btn {
  background: #111827;
  color: #fff;
}

.manual-secondary-btn {
  background: #fff;
  color: #4b5563;
  border-color: rgba(15, 23, 42, 0.12);
}

.as-button {
  cursor: pointer;
}

.as-button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.manual-side-note,
.manual-side-card {
  padding: 20px;
}

.manual-note-title,
.manual-side-title {
  font-size: 15px;
  font-weight: 800;
  margin-bottom: 10px;
}

.manual-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.12fr) 320px;
  gap: 18px;
  align-items: start;
}

.manual-doc {
  padding: 28px;
  color: #344054;
  line-height: 1.9;
}

.manual-doc h1,
.manual-doc h2,
.manual-doc h3,
.manual-doc h4 {
  margin: 22px 0 12px;
  color: #111827;
  line-height: 1.35;
}

.manual-doc h1 { font-size: 34px; }
.manual-doc h2 { font-size: 24px; }
.manual-doc h3 { font-size: 18px; }

.manual-doc p,
.manual-doc li,
.manual-doc blockquote {
  font-size: 14px;
}

.manual-doc ul,
.manual-side-card ul {
  margin: 0;
  padding-left: 18px;
}

.manual-doc hr {
  border: none;
  border-top: 1px solid #eceef3;
  margin: 20px 0;
}

.manual-doc code,
.manual-side-card code,
.promptl-field-top code,
.promptl-token-list code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
  padding: 2px 6px;
  border-radius: 8px;
  background: rgba(139, 92, 246, 0.12);
  color: #6d28d9;
}

.manual-doc blockquote {
  padding: 12px 14px;
  border-left: 4px solid #8b5cf6;
  background: rgba(139, 92, 246, 0.06);
  border-radius: 0 12px 12px 0;
}

.manual-code {
  overflow: auto;
  padding: 16px;
  border-radius: 14px;
  background: #111827;
  color: #e5e7eb;
  font-size: 12px;
  line-height: 1.7;
}

.manual-loading,
.manual-error {
  font-size: 14px;
  color: #667085;
}

.promptl-grid {
  grid-template-columns: minmax(0, 1fr) 320px;
}

.promptl-main {
  display: grid;
  gap: 18px;
}

.promptl-banner {
  padding: 16px 18px;
}

.promptl-banner.success {
  border-color: rgba(34, 197, 94, 0.22);
  background: rgba(34, 197, 94, 0.08);
  color: #166534;
}

.promptl-banner.error {
  border-color: rgba(239, 68, 68, 0.22);
  background: rgba(239, 68, 68, 0.08);
  color: #991b1b;
}

.promptl-token-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  font-size: 12px;
  color: #475467;
}

.promptl-section {
  padding: 22px;
}

.promptl-section-head h2 {
  margin: 0 0 8px;
  font-size: 20px;
}

.promptl-section-head p {
  margin: 0 0 16px;
}

.promptl-field-list {
  display: grid;
  gap: 14px;
}

.promptl-field {
  display: grid;
  gap: 8px;
  padding: 16px;
  border-radius: 16px;
  border: 1px solid #eceef3;
  background: #fbfcfe;
}

.promptl-field-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.promptl-input {
  width: 100%;
  border: 1px solid #d8dce5;
  border-radius: 12px;
  background: #fff;
  color: #111827;
  padding: 12px 14px;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.promptl-input:focus {
  border-color: rgba(124, 58, 237, 0.45);
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.08);
}

.promptl-textarea {
  min-height: 120px;
  resize: vertical;
}

.promptl-login-form {
  display: grid;
  gap: 10px;
}

.promptl-login-btn {
  height: 40px;
}

@media (max-width: 1200px) {
  .manual-grid,
  .promptl-grid,
  .manual-hero,
  .promptl-hero {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  .manual-topbar {
    position: static;
    flex-direction: column;
    align-items: flex-start;
  }

  .manual-nav {
    width: 100%;
    overflow: auto;
  }

  .manual-main {
    padding: 18px;
  }
}

.login-link-row {
  display: flex;
  gap: 10px;
  margin-top: 12px;
}

.login-link-pill {
  flex: 1;
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  border: 1px solid #e5e7eb;
  background: #fff;
  color: #4b5563;
  font-size: 13px;
  font-weight: 600;
}

.help-sync-banner {
  padding: 14px 18px;
  color: #667085;
}

.prompt-console-grid {
  grid-template-columns: minmax(0, 1fr) 360px;
}

.prompt-console-main,
.prompt-console-side {
  display: grid;
  gap: 18px;
}

.prompt-console-hero {
  grid-template-columns: minmax(0, 1fr) 320px;
}

.prompt-console-toolbar,
.prompt-console-runtime-card,
.prompt-console-side-card,
.prompt-console-section,
.prompt-console-banner {
  padding: 20px;
}

.prompt-console-toolbar-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}

.prompt-console-toolbar-meta {
  display: grid;
  gap: 6px;
  font-size: 12px;
  color: #667085;
  text-align: right;
}

.prompt-console-search {
  width: 100%;
  height: 46px;
  border: 1px solid #d8dce5;
  border-radius: 14px;
  padding: 0 14px;
  background: #fff;
  color: #111827;
  outline: none;
}

.prompt-console-search:focus {
  border-color: rgba(124, 58, 237, 0.45);
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.08);
}

.prompt-console-runtime-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
}

.prompt-console-runtime-item {
  padding: 12px 14px;
  border-radius: 14px;
  background: #fbfcfe;
  border: 1px solid #eceef3;
  display: grid;
  gap: 6px;
}

.prompt-console-runtime-item span {
  font-size: 12px;
  color: #667085;
}

.prompt-console-runtime-item strong {
  font-size: 13px;
  color: #111827;
  word-break: break-word;
}

.prompt-console-note,
.prompt-console-muted,
.prompt-console-help {
  font-size: 12px;
  color: #667085;
  line-height: 1.8;
}

.prompt-console-section-head h2 {
  margin: 0 0 8px;
  font-size: 20px;
}

.prompt-console-section-head p {
  margin: 0 0 16px;
  color: #667085;
  line-height: 1.8;
}

.prompt-console-field-list {
  display: grid;
  gap: 14px;
}

.prompt-console-field {
  display: grid;
  gap: 8px;
  padding: 16px;
  border-radius: 16px;
  border: 1px solid #eceef3;
  background: #fbfcfe;
}

.prompt-console-field-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.prompt-console-field-top strong {
  font-size: 14px;
  color: #111827;
}

.prompt-console-input {
  width: 100%;
  border: 1px solid #d8dce5;
  border-radius: 12px;
  background: #fff;
  color: #111827;
  padding: 12px 14px;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.prompt-console-input:focus {
  border-color: rgba(124, 58, 237, 0.45);
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.08);
}

.prompt-console-textarea {
  min-height: 120px;
  resize: vertical;
}

.prompt-console-anchor-list {
  display: grid;
  gap: 8px;
}

.prompt-console-anchor-list a {
  padding: 10px 12px;
  border-radius: 12px;
  background: #fbfcfe;
  border: 1px solid #eceef3;
  color: #475467;
  font-size: 13px;
  font-weight: 600;
}

.prompt-console-token-list {
  display: grid;
  gap: 8px;
  color: #475467;
  font-size: 12px;
}

.prompt-console-json {
  width: 100%;
  min-height: 320px;
  border: 1px solid #d8dce5;
  border-radius: 14px;
  background: #0f172a;
  color: #e5e7eb;
  padding: 14px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
  line-height: 1.7;
  resize: vertical;
  outline: none;
}

.prompt-console-json:focus {
  border-color: rgba(124, 58, 237, 0.45);
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.08);
}

.prompt-console-json-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 10px;
}

.prompt-console-login-form {
  display: grid;
  gap: 10px;
}

.prompt-console-login-btn {
  height: 40px;
}

.prompt-console-banner.success {
  border-color: rgba(34, 197, 94, 0.22);
  background: rgba(34, 197, 94, 0.08);
  color: #166534;
}

.prompt-console-banner.error {
  border-color: rgba(239, 68, 68, 0.22);
  background: rgba(239, 68, 68, 0.08);
  color: #991b1b;
}

@media (max-width: 1280px) {
  .prompt-console-grid,
  .prompt-console-hero {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  .login-link-row,
  .prompt-console-toolbar-top {
    flex-direction: column;
  }

  .prompt-console-toolbar-meta {
    text-align: left;
  }
}
